1 #include <kdesktopfile.h>
3 #include <kconfiggroup.h>
4 #include "saverconfig.h"
6 SaverConfig::SaverConfig()
10 bool SaverConfig::read(const QString
&file
)
12 KDesktopFile
config(file
);
13 const KConfigGroup group
= config
.desktopGroup();
15 if( !config
.tryExec())
18 mExec
= group
.readPathEntry("Exec", QString());
19 mName
= group
.readEntry("Name");
20 QString categoryName
= group
.readEntry("X-KDE-Category");
21 if(categoryName
.isEmpty())
22 mCategory
= categoryName
;
24 mCategory
= i18nc("Screen saver category", // Must be same in CMakeFiles.txt
25 categoryName
.toUtf8());
27 if (config
.hasActionGroup("Setup"))
29 mSetup
= config
.actionGroup("Setup").readPathEntry("Exec", QString());
32 if (config
.hasActionGroup("InWindow"))
34 mSaver
= config
.actionGroup("InWindow").readPathEntry("Exec", QString());
37 int indx
= file
.lastIndexOf('/');
39 mFile
= file
.mid(indx
+1);
42 return !mSaver
.isEmpty();