diff --git a/applets/kicker/package/contents/config/main.xml b/applets/kicker/package/contents/config/main.xml
--- a/applets/kicker/package/contents/config/main.xml
+++ b/applets/kicker/package/contents/config/main.xml
@@ -32,6 +32,10 @@
false
+
+
+ 0
+
preferred://browser,kontact.desktop,systemsettings.desktop,org.kde.dolphin.desktop,ktp-contactlist.desktop,org.kde.kate.desktop,org.kde.discover
diff --git a/applets/kicker/package/contents/ui/ConfigGeneral.qml b/applets/kicker/package/contents/ui/ConfigGeneral.qml
--- a/applets/kicker/package/contents/ui/ConfigGeneral.qml
+++ b/applets/kicker/package/contents/ui/ConfigGeneral.qml
@@ -39,6 +39,7 @@
property alias cfg_limitDepth: limitDepth.checked
property alias cfg_alphaSort: alphaSort.checked
+ property alias cfg_recentOrdering: recentOrdering.currentIndex
property alias cfg_showRecentApps: showRecentApps.checked
property alias cfg_showRecentDocs: showRecentDocs.checked
property alias cfg_showRecentContacts: showRecentContacts.checked
@@ -148,22 +149,42 @@
flat: true
ColumnLayout {
+ RowLayout {
+ Label {
+ text: i18n("Show:")
+ }
+
+ ComboBox {
+ id: recentOrdering
+
+ Layout.fillWidth: true
+
+ model: [i18n("Recently used"), i18n("Often used")]
+ }
+ }
+
CheckBox {
id: showRecentApps
- text: i18n("Show recent applications")
+ text: recentOrdering.currentIndex == 0
+ ? i18n("Show recent applications")
+ : i18n("Show often used applications")
}
CheckBox {
id: showRecentDocs
- text: i18n("Show recent documents")
+ text: recentOrdering.currentIndex == 0
+ ? i18n("Show recent documents")
+ : i18n("Show often used documents")
}
CheckBox {
id: showRecentContacts
- text: i18n("Show recent contacts")
+ text: recentOrdering.currentIndex == 0
+ ? i18n("Show recent contacts")
+ : i18n("Show often used contacts")
}
}
}
diff --git a/applets/kicker/package/contents/ui/main.qml b/applets/kicker/package/contents/ui/main.qml
--- a/applets/kicker/package/contents/ui/main.qml
+++ b/applets/kicker/package/contents/ui/main.qml
@@ -90,6 +90,7 @@
showRecentApps: plasmoid.configuration.showRecentApps
showRecentDocs: plasmoid.configuration.showRecentDocs
showRecentContacts: plasmoid.configuration.showRecentContacts
+ recentOrdering: plasmoid.configuration.recentOrdering
onShowRecentAppsChanged: {
plasmoid.configuration.showRecentApps = showRecentApps;
@@ -103,6 +104,10 @@
plasmoid.configuration.showRecentContacts = showRecentContacts;
}
+ onRecentOrderingChanged: {
+ plasmoid.configuration.recentOrdering = recentOrdering;
+ }
+
Component.onCompleted: {
favoritesModel.favorites = plasmoid.configuration.favoriteApps;
rootModel.refresh();
diff --git a/applets/kicker/plugin/recentusagemodel.h b/applets/kicker/plugin/recentusagemodel.h
--- a/applets/kicker/plugin/recentusagemodel.h
+++ b/applets/kicker/plugin/recentusagemodel.h
@@ -56,10 +56,16 @@
{
Q_OBJECT
+ Q_PROPERTY(int ordering READ ordering WRITE setOrdering NOTIFY orderingChanged)
+
public:
enum IncludeUsage { AppsAndDocs, OnlyApps, OnlyDocs };
+ enum Ordering { Recent, Popular };
- explicit RecentUsageModel(QObject *parent = 0, IncludeUsage usage = AppsAndDocs);
+ explicit RecentUsageModel(
+ QObject *parent = 0,
+ IncludeUsage usage = AppsAndDocs,
+ int ordering = Recent);
~RecentUsageModel();
QString description() const;
@@ -73,6 +79,12 @@
IncludeUsage usage() const;
+ void setOrdering(int ordering);
+ int ordering() const;
+
+ Q_SIGNALS:
+ void orderingChanged(int ordering);
+
private Q_SLOTS:
void refresh();
@@ -86,6 +98,8 @@
IncludeUsage m_usage;
QPointer m_activitiesModel;
+
+ Ordering m_ordering;
};
#endif
diff --git a/applets/kicker/plugin/recentusagemodel.cpp b/applets/kicker/plugin/recentusagemodel.cpp
--- a/applets/kicker/plugin/recentusagemodel.cpp
+++ b/applets/kicker/plugin/recentusagemodel.cpp
@@ -112,8 +112,10 @@
return (left.row() < right.row());
}
-RecentUsageModel::RecentUsageModel(QObject *parent, IncludeUsage usage) : ForwardingModel(parent)
+RecentUsageModel::RecentUsageModel(QObject *parent, IncludeUsage usage, int ordering)
+: ForwardingModel(parent)
, m_usage(usage)
+, m_ordering((Ordering)ordering)
{
refresh();
}
@@ -378,12 +380,27 @@
}
}
+void RecentUsageModel::setOrdering(int ordering)
+{
+ if (ordering == m_ordering) return;
+
+ m_ordering = (Ordering)ordering;
+ refresh();
+
+ emit orderingChanged(ordering);
+}
+
+int RecentUsageModel::ordering() const
+{
+ return m_ordering;
+}
+
void RecentUsageModel::refresh()
{
QAbstractItemModel *oldModel = sourceModel();
auto query = UsedResources
- | RecentlyUsedFirst
+ | (m_ordering == Recent ? RecentlyUsedFirst : HighScoredFirst)
| Agent::any()
| Type::any()
| Activity::current();
diff --git a/applets/kicker/plugin/rootmodel.h b/applets/kicker/plugin/rootmodel.h
--- a/applets/kicker/plugin/rootmodel.h
+++ b/applets/kicker/plugin/rootmodel.h
@@ -61,6 +61,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(int recentOrdering READ recentOrdering WRITE setRecentOrdering NOTIFY recentOrderingChanged)
Q_PROPERTY(bool showPowerSession READ showPowerSession WRITE setShowPowerSession NOTIFY showPowerSessionChanged)
public:
@@ -86,6 +87,9 @@
bool showRecentContacts() const;
void setShowRecentContacts(bool show);
+ int recentOrdering() const;
+ void setRecentOrdering(int ordering);
+
bool showPowerSession() const;
void setShowPowerSession(bool show);
@@ -104,6 +108,7 @@
void showRecentDocsChanged() const;
void showRecentContactsChanged() const;
void showPowerSessionChanged() const;
+ void recentOrderingChanged() const;
void recentAppsModelChanged() const;
protected Q_SLOTS:
@@ -121,6 +126,7 @@
bool m_showRecentApps;
bool m_showRecentDocs;
bool m_showRecentContacts;
+ int m_recentOrdering;
bool m_showPowerSession;
RecentUsageModel *m_recentAppsModel;
diff --git a/applets/kicker/plugin/rootmodel.cpp b/applets/kicker/plugin/rootmodel.cpp
--- a/applets/kicker/plugin/rootmodel.cpp
+++ b/applets/kicker/plugin/rootmodel.cpp
@@ -71,6 +71,7 @@
, m_showRecentApps(true)
, m_showRecentDocs(true)
, m_showRecentContacts(false)
+, m_recentOrdering(RecentUsageModel::Recent)
, m_showPowerSession(true)
, m_recentAppsModel(0)
, m_recentDocsModel(0)
@@ -222,6 +223,22 @@
}
}
+int RootModel::recentOrdering() const
+{
+ return m_recentOrdering;
+}
+
+void RootModel::setRecentOrdering(int ordering)
+{
+ if (ordering != m_recentOrdering) {
+ m_recentOrdering = ordering;
+
+ refresh();
+
+ emit recentOrderingChanged();
+ }
+}
+
bool RootModel::showPowerSession() const
{
return m_showPowerSession;
@@ -392,14 +409,24 @@
}
if (m_showRecentDocs) {
- m_recentDocsModel = new RecentUsageModel(this, RecentUsageModel::OnlyDocs);
- m_entryList.prepend(new GroupEntry(this, i18n("Recent Documents"), QString(), m_recentDocsModel));
+ m_recentDocsModel = new RecentUsageModel(this, RecentUsageModel::OnlyDocs, m_recentOrdering);
+ m_entryList.prepend(new GroupEntry(this,
+ m_recentOrdering == RecentUsageModel::Recent
+ ? i18n("Recent Documents")
+ : i18n("Often Used Documents"),
+ QString(),
+ m_recentDocsModel));
++separatorPosition;
}
if (m_showRecentApps) {
- m_recentAppsModel = new RecentUsageModel(this, RecentUsageModel::OnlyApps);
- m_entryList.prepend(new GroupEntry(this, i18n("Recent Applications"), QString(), m_recentAppsModel));
+ m_recentAppsModel = new RecentUsageModel(this, RecentUsageModel::OnlyApps, m_recentOrdering);
+ m_entryList.prepend(new GroupEntry(this,
+ m_recentOrdering == RecentUsageModel::Recent
+ ? i18n("Recent Applications")
+ : i18n("Often Used Applications"),
+ QString(),
+ m_recentAppsModel));
++separatorPosition;
}