Commit 4e59619b authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Define default set of "frequently used" settings in desktop file

This has the advantages of:
* not hardcoding them in code so they can be customized by e.g. distros
* showing in places like Task Manager and Kickoff

Unfortunately the name and icon of the relevant setting has to be duplicated here.
parent 2b61b00d
......@@ -6,6 +6,7 @@ X-DocPath=systemsettings/index.html
X-KDE-StartupNotify=true
X-KDE-Shortcuts=Tools
OnlyShowIn=KDE;
Actions=kcm_lookandfeel;kcm_users;screenlocker;powerdevilprofilesconfig;kcm_kscreen;
GenericName=System Settings
GenericName[ar]=إعدادات النّظام
......@@ -224,3 +225,28 @@ Comment[zh_TW]=提供給您電腦的配置工具
X-DBUS-StartupType=Unique
X-DBUS-ServiceName=org.kde.systemsettings
Categories=Qt;KDE;Settings;
[Desktop Action kcm_lookandfeel]
Name=Global Theme
Icon=preferences-desktop-theme-global
Exec=systemsettings5 kcm_lookandfeel
[Desktop Action kcm_users]
Name=Users
Icon=preferences-system-users
Exec=systemsettings5 kcm_users
[Desktop Action screenlocker]
Name=Screen Locking
Icon=preferences-desktop-user-password
Exec=systemsettings5 screenlocker
[Desktop Action powerdevilprofilesconfig]
Name=Energy Saving
Icon=preferences-system-power-management
Exec=systemsettings5 powerdevilprofilesconfig
[Desktop Action kcm_kscreen]
Name=Display Configuration
Icon=preferences-desktop-display-randr
Exec=systemsettings5 kcm_kscreen
......@@ -26,6 +26,7 @@
#include "BaseData.h"
#include "ToolTips/tooltipmanager.h"
#include <QGuiApplication>
#include <QHBoxLayout>
#include <QAction>
......@@ -111,21 +112,18 @@ public:
setDynamicSortFilter(true);
//prepare default items
m_defaultModel = new QStandardItemModel(this);
QStandardItem *item = new QStandardItem();
item->setData(QUrl(QStringLiteral("kcm:kcm_lookandfeel.desktop")), ResultModel::ResourceRole);
m_defaultModel->appendRow(item);
item = new QStandardItem();
item->setData(QUrl(QStringLiteral("kcm:kcm_users.desktop")), ResultModel::ResourceRole);
m_defaultModel->appendRow(item);
item = new QStandardItem();
item->setData(QUrl(QStringLiteral("kcm:screenlocker.desktop")), ResultModel::ResourceRole);
m_defaultModel->appendRow(item);
item = new QStandardItem();
item->setData(QUrl(QStringLiteral("kcm:powerdevilprofilesconfig.desktop")), ResultModel::ResourceRole);
m_defaultModel->appendRow(item);
item = new QStandardItem();
item->setData(QUrl(QStringLiteral("kcm:kcm_kscreen.desktop")), ResultModel::ResourceRole);
m_defaultModel->appendRow(item);
KService::Ptr service = KService::serviceByDesktopName(qGuiApp->desktopFileName());
if (service) {
const auto actions = service->actions();
for (const KServiceAction &action : actions) {
QStandardItem *item = new QStandardItem();
item->setData(QUrl(QStringLiteral("kcm:%1.desktop").arg(action.name())), ResultModel::ResourceRole);
m_defaultModel->appendRow(item);
}
} else {
qCritical() << "Failed to find desktop file for" << qGuiApp->desktopFileName();
}
}
void setResultModel(ResultModel *model)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment