You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
plasma-desktop/Handle-non-existing-kickoff...

77 lines
2.8 KiB

From fc9a550fbd0cb51f5342972948c38129de1bac35 Mon Sep 17 00:00:00 2001
From: Eike Hein <hein@kde.org>
Date: Sun, 27 Mar 2016 17:13:46 +0900
Subject: [PATCH 44/46] Handle non-existing kickoffrc correctly.
BUG:357029
---
.../contents/updates/obsolete_kickoffrc.js | 24 ++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/desktoppackage/contents/updates/obsolete_kickoffrc.js b/desktoppackage/contents/updates/obsolete_kickoffrc.js
index a3e6e9f..b95dd46 100644
--- a/desktoppackage/contents/updates/obsolete_kickoffrc.js
+++ b/desktoppackage/contents/updates/obsolete_kickoffrc.js
@@ -1,18 +1,26 @@
var kickoffConfig = ConfigFile("kickoffrc");
kickoffConfig.group = "Favorites";
-var favorites = kickoffConfig.readEntry("FavoriteURLs").split(',');
+var favorites = kickoffConfig.readEntry("FavoriteURLs");
+var haveFavorites = (favorites.length > 0);
+
+if (haveFavorites) {
+ favorites = favorites.split(',');
+}
kickoffConfig.group = "SystemApplications";
-var systemApplications = kickoffConfig.readEntry("DesktopFiles").split(',');
+var systemApplications = kickoffConfig.readEntry("DesktopFiles");
+var haveSystemApplications = (systemApplications.length > 0);
+
+if (haveSystemApplications) {
+ systemApplications = systemApplications.split(',');
-if (systemApplications.length) {
// This used to be hardcoded in Kickoff C++ code; it's now the KConfigXT
// default but needs to be added in when migrating from the rc file.
systemApplications.unshift("systemsettings.desktop");
}
-if (favorites.length || systemApplications.length) {
+if (haveFavorites || haveSystemApplications) {
for (var i in panels()) {
var panel = panels()[i];
@@ -22,11 +30,11 @@ if (favorites.length || systemApplications.length) {
if (widget.type == "org.kde.plasma.kickoff") {
widget.currentConfigGroup = ["General"];
- if (favorites.length) {
+ if (haveFavorites) {
widget.writeConfig("favorites", favorites);
}
- if (systemApplications.length) {
+ if (haveSystemApplications) {
widget.writeConfig("systemApplications", systemApplications);
}
}
@@ -42,11 +50,11 @@ if (favorites.length || systemApplications.length) {
if (widget.type == "org.kde.plasma.kickoff") {
widget.currentConfigGroup = ["General"];
- if (favorites.length) {
+ if (haveFavorites) {
widget.writeConfig("favorites", favorites);
}
- if (systemApplications.length) {
+ if (haveSystemApplications) {
widget.writeConfig("systemApplications", systemApplications);
}
}
--
1.9.3