Warning, file /plasma/plasma-workspace/kcms/icons/changeicons.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "iconssettings.h"
0008 #include "plasma_changeicons_debug.h"
0009 
0010 #include <KLocalizedString>
0011 #include <QApplication>
0012 
0013 int main(int argc, char **argv)
0014 {
0015     QApplication app(argc, argv);
0016 
0017     if (argc != 2) {
0018         return 1;
0019     }
0020 
0021     // KNS will give us a path
0022     const QStringList args = app.arguments();
0023     QString themeName = args.last();
0024     int idx = themeName.lastIndexOf('/');
0025     if (idx >= 0) {
0026         themeName = themeName.mid(idx + 1);
0027     }
0028 
0029     IconsSettings settings;
0030     if (settings.theme() == themeName) {
0031         // In KNS this will be displayed as a warning in the UI
0032         qCWarning(PLASMA_CHANGEICONS_DEBUG).noquote() << "Icon theme is already used";
0033     } else {
0034         settings.setTheme(themeName);
0035         settings.save();
0036     }
0037     return 0;
0038 }