Changeset View
Changeset View
Standalone View
Standalone View
kcms/icons/changeicons.cpp
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include <QApplication> | 20 | #include <QApplication> | ||
21 | #include <KConfigGroup> | 21 | #include "iconssettings.h" | ||
22 | #include <KIconTheme> | | |||
23 | #include <KSharedConfig> | | |||
24 | #include <KSharedDataCache> | | |||
25 | #include <KBuildSycocaProgressDialog> | | |||
26 | #include <QDebug> | | |||
27 | 22 | | |||
28 | int main(int argc, char** argv) | 23 | int main(int argc, char** argv) | ||
29 | { | 24 | { | ||
30 | QApplication app(argc, argv); | 25 | QApplication app(argc, argv); | ||
31 | 26 | | |||
32 | if (app.arguments().count() != 2) { | 27 | if (app.arguments().count() != 2) { | ||
33 | return 1; | 28 | return 1; | ||
34 | } | 29 | } | ||
35 | 30 | | |||
36 | { | | |||
37 | //KNS will give us a path | 31 | //KNS will give us a path | ||
38 | QString themeName = app.arguments().last(); | 32 | QString themeName = app.arguments().last(); | ||
39 | int idx = themeName.lastIndexOf('/'); | 33 | int idx = themeName.lastIndexOf('/'); | ||
40 | if (idx>=0) { | 34 | if (idx>=0) { | ||
41 | themeName = themeName.mid(idx); | 35 | themeName = themeName.mid(idx); | ||
42 | } | 36 | } | ||
43 | 37 | | |||
44 | KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::SimpleConfig), "Icons"); | 38 | IconsSettings settings; | ||
45 | config.writeEntry("Theme", themeName); | 39 | settings.setTheme(themeName); | ||
46 | config.sync(); | 40 | settings.save(); | ||
47 | } | | |||
48 | | ||||
49 | KIconTheme::reconfigure(); | | |||
50 | | ||||
51 | KSharedDataCache::deleteCache(QStringLiteral("icon-cache")); | | |||
52 | | ||||
53 | for (int i=0; i<KIconLoader::LastGroup; i++) | | |||
54 | { | | |||
55 | KIconLoader::emitChange(KIconLoader::Group(i)); | | |||
56 | } | | |||
57 | | ||||
58 | KBuildSycocaProgressDialog::rebuildKSycoca(nullptr); | | |||
59 | return 0; | 41 | return 0; | ||
60 | } | 42 | } |