Changeset View
Changeset View
Standalone View
Standalone View
kcms/icons/changeicons.cpp
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 20016 Aleix Pol Gonzalez <aleixpol@kde.org> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU Library General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Library General Public | ||||
15 | * License along with this program; if not, write to the | ||||
16 | * Free Software Foundation, Inc., | ||||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #include <QApplication> | ||||
21 | #include <KConfigGroup> | ||||
22 | #include <KIconTheme> | ||||
23 | #include <KSharedConfig> | ||||
24 | #include <KSharedDataCache> | ||||
25 | #include <KBuildSycocaProgressDialog> | ||||
26 | #include <QDebug> | ||||
27 | | ||||
28 | int main(int argc, char** argv) | ||||
29 | { | ||||
30 | QApplication app(argc, argv); | ||||
31 | | ||||
32 | if (app.arguments().count() != 2) { | ||||
33 | return 1; | ||||
34 | } | ||||
35 | | ||||
36 | { | ||||
37 | //KNS will give us a path | ||||
38 | QString themeName = app.arguments().last(); | ||||
39 | int idx = themeName.lastIndexOf('/'); | ||||
40 | if (idx>=0) { | ||||
41 | themeName = themeName.mid(idx); | ||||
42 | } | ||||
43 | | ||||
44 | KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::SimpleConfig), "Icons"); | ||||
45 | config.writeEntry("Theme", themeName); | ||||
46 | } | ||||
47 | | ||||
48 | KIconTheme::reconfigure(); | ||||
49 | | ||||
50 | KSharedDataCache::deleteCache(QStringLiteral("icon-cache")); | ||||
51 | | ||||
52 | for (int i=0; i<KIconLoader::LastGroup; i++) | ||||
53 | { | ||||
54 | KIconLoader::emitChange(KIconLoader::Group(i)); | ||||
55 | } | ||||
56 | | ||||
57 | KBuildSycocaProgressDialog::rebuildKSycoca(nullptr); | ||||
58 | app.exec(); | ||||
59 | } |