File 0001-kicker-Configurable_Power_Session_Menu_Entry.patch of Package plasma5-desktop
From: Petros Stavrakakis <petros.stavrakakis@br-automation.com>
Date: Tue, 18 Apr 2017 17:54:54 +0100
Subject: [PATCH 1/1] Configurable Power / Session Menu Entry in Kicker Menu
Summary:
Backport part of Patch "Kicker backend changes for Simple Menu." (5.9.0) to make it work in 5.8.6
* Make showing the Power / Session top-level category optional.
https://cgit.kde.org/plasma-desktop.git/commit/?id=3e88ac63f25d526f8f7d4d58266fd303b722a1d0
---
package/contents/config/main.xml | 4 ++++
package/contents/ui/ConfigGeneral.qml | 8 ++++++++
package/contents/ui/main.qml | 5 +++++
plugin/rootmodel.cpp | 24 ++++++++++++++++++++++--
plugin/rootmodel.h | 6 ++++++
5 files changed, 45 insertions(+), 2 deletions(-)
diff -Nur plasma-desktop-5.8.6.org/applets/kicker/package/contents/config/main.xml plasma-desktop-5.8.6/applets/kicker/package/contents/config/main.xml
--- plasma-desktop-5.8.6.org/applets/kicker/package/contents/config/main.xml 2017-02-21 13:09:30.000000000 +0100
+++ plasma-desktop-5.8.6/applets/kicker/package/contents/config/main.xml 2017-04-18 11:57:57.486309023 +0200
@@ -53,6 +53,10 @@
<label>Whether to show the "Recent Contacts" category.</label>
<default>false</default>
</entry>
+ <entry name="showPowerSession" type="Bool">
+ <label>Whether to show the "Power / Session" entry.</label>
+ <default>true</default>
+ </entry>
<entry name="useExtraRunners" type="Bool">
<label>Whether to use additional KRunner plugins to produce results in the search.</label>
diff -Nur plasma-desktop-5.8.6.org/applets/kicker/package/contents/ui/ConfigGeneral.qml plasma-desktop-5.8.6/applets/kicker/package/contents/ui/ConfigGeneral.qml
--- plasma-desktop-5.8.6.org/applets/kicker/package/contents/ui/ConfigGeneral.qml 2017-02-21 13:09:30.000000000 +0100
+++ plasma-desktop-5.8.6/applets/kicker/package/contents/ui/ConfigGeneral.qml 2017-04-18 12:26:02.215871304 +0200
@@ -41,6 +41,7 @@
property alias cfg_showRecentApps: showRecentApps.checked
property alias cfg_showRecentDocs: showRecentDocs.checked
property alias cfg_showRecentContacts: showRecentContacts.checked
+ property alias cfg_showPowerSession: showPowerSession.checked
property alias cfg_useExtraRunners: useExtraRunners.checked
property alias cfg_alignResultsToBottom: alignResultsToBottom.checked
@@ -158,6 +159,13 @@
text: i18n("Show recent contacts")
}
+
+ CheckBox {
+ id: showPowerSession
+
+ text: i18n("Show Power / Session Entry")
+ }
+
}
}
diff -Nur plasma-desktop-5.8.6.org/applets/kicker/package/contents/ui/main.qml plasma-desktop-5.8.6/applets/kicker/package/contents/ui/main.qml
--- plasma-desktop-5.8.6.org/applets/kicker/package/contents/ui/main.qml 2017-02-21 13:09:30.000000000 +0100
+++ plasma-desktop-5.8.6/applets/kicker/package/contents/ui/main.qml 2017-04-18 12:04:23.286889425 +0200
@@ -85,6 +85,7 @@
showRecentApps: plasmoid.configuration.showRecentApps
showRecentDocs: plasmoid.configuration.showRecentDocs
showRecentContacts: plasmoid.configuration.showRecentContacts
+ showPowerSession: plasmoid.configuration.showPowerSession
onShowRecentAppsChanged: {
plasmoid.configuration.showRecentApps = showRecentApps;
@@ -98,6 +99,10 @@
plasmoid.configuration.showRecentContacts = showRecentContacts;
}
+ onShowPowerSessionChanged: {
+ plasmoid.configuration.showPowerSession = showPowerSession;
+ }
+
Component.onCompleted: {
favoritesModel.favorites = plasmoid.configuration.favoriteApps;
}
diff -Nur plasma-desktop-5.8.6.org/applets/kicker/plugin/rootmodel.cpp plasma-desktop-5.8.6/applets/kicker/plugin/rootmodel.cpp
--- plasma-desktop-5.8.6.org/applets/kicker/plugin/rootmodel.cpp 2017-02-21 13:09:30.000000000 +0100
+++ plasma-desktop-5.8.6/applets/kicker/plugin/rootmodel.cpp 2017-04-18 12:02:05.615825924 +0200
@@ -23,6 +23,7 @@
#include "recentcontactsmodel.h"
#include "recentusagemodel.h"
#include "systemmodel.h"
+#include "rootmodel.h"
#include <KLocalizedString>
@@ -70,6 +71,7 @@
, m_recentAppsModel(0)
, m_recentDocsModel(0)
, m_recentContactsModel(0)
+, m_showPowerSession(true)
{
}
@@ -203,6 +205,22 @@
}
}
+bool RootModel::showPowerSession() const
+{
+ return m_showPowerSession;
+}
+
+void RootModel::setShowPowerSession(bool show)
+{
+ if (show != m_showPowerSession) {
+ m_showPowerSession = show;
+
+ refresh();
+
+ emit showPowerSessionChanged();
+ }
+}
+
AbstractModel* RootModel::favoritesModel()
{
return m_favorites;
@@ -293,9 +311,11 @@
m_entryList.insert(separatorPosition, new SeparatorEntry(this));
++m_separatorCount;
}
-
+
m_systemModel = new SystemModel(this);
- m_entryList << new GroupEntry(this, i18n("Power / Session"), QString(), m_systemModel);
+ if (m_showPowerSession) {
+ m_entryList << new GroupEntry(this, i18n("Power / Session"), QString(), m_systemModel);
+ }
endResetModel();
diff -Nur plasma-desktop-5.8.6.org/applets/kicker/plugin/rootmodel.h plasma-desktop-5.8.6/applets/kicker/plugin/rootmodel.h
--- plasma-desktop-5.8.6.org/applets/kicker/plugin/rootmodel.h 2017-02-21 13:09:30.000000000 +0100
+++ plasma-desktop-5.8.6/applets/kicker/plugin/rootmodel.h 2017-04-18 12:03:08.385222471 +0200
@@ -57,6 +57,7 @@
Q_PROPERTY(bool showRecentApps READ showRecentApps WRITE setShowRecentApps NOTIFY showRecentAppsChanged)
Q_PROPERTY(bool showRecentDocs READ showRecentDocs WRITE setShowRecentDocs NOTIFY showRecentDocsChanged)
Q_PROPERTY(bool showRecentContacts READ showRecentContacts WRITE setShowRecentContacts NOTIFY showRecentContactsChanged)
+ Q_PROPERTY(bool showPowerSession READ showPowerSession WRITE setShowPowerSession NOTIFY showPowerSessionChanged)
public:
explicit RootModel(QObject *parent = 0);
@@ -78,6 +79,9 @@
bool showRecentContacts() const;
void setShowRecentContacts(bool show);
+ bool showPowerSession() const;
+ void setShowPowerSession(bool show);
+
AbstractModel* favoritesModel();
AbstractModel* systemFavoritesModel();
@@ -89,6 +93,7 @@
void showRecentDocsChanged() const;
void showRecentContactsChanged() const;
void recentAppsModelChanged() const;
+ void showPowerSessionChanged() const;
protected Q_SLOTS:
void refresh();
@@ -103,6 +108,7 @@
bool m_showRecentApps;
bool m_showRecentDocs;
bool m_showRecentContacts;
+ bool m_showPowerSession;
RecentUsageModel *m_recentAppsModel;
RecentUsageModel *m_recentDocsModel;