Plasma
plasma-add-shortcut-to-menu.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <KComponentData>
00020 #include <KConfig>
00021 #include <KConfigGroup>
00022 #include <KStandardDirs>
00023
00024 int main()
00025 {
00026 KComponentData cd("plasma-add-shortcut-to-menu-update");
00027 QString file = KStandardDirs::locateLocal("config", "plasma-appletsrc");
00028
00029 if (file.isEmpty()) {
00030 return 0;
00031 }
00032
00033 KConfig config(file);
00034 KConfigGroup containments(&config, "Containments");
00035 foreach (const QString &group, containments.groupList()) {
00036 KConfigGroup applets(&containments, group);
00037 applets = KConfigGroup(&applets, "Applets");
00038 foreach (const QString &appletGroup, applets.groupList()) {
00039 KConfigGroup applet(&applets, appletGroup);
00040 QString plugin = applet.readEntry("plugin", QString());
00041 if (plugin == "launcher" || plugin == "simplelauncher") {
00042 KConfigGroup shortcuts(&applet, "Shortcuts");
00043
00044 if (!shortcuts.hasKey("global")) {
00045 shortcuts.writeEntry("global", "Alt+F1");
00046 }
00047
00048 return 0;
00049 }
00050 }
00051 }
00052
00053 return 0;
00054 }
00055