Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.3:Rings:2-TestDVD
plasma5-workspace
applauncher-allow-to-show-apps-by-name.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File applauncher-allow-to-show-apps-by-name.patch of Package plasma5-workspace
From bdaaaedbfbbe72673c288a5acc8a8366d3f6bc1e Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik <kde@privat.broulik.de> Date: Fri, 30 Jun 2017 10:43:38 +0200 Subject: [AppLauncher Containment Action] Add option to "show apps by name" This will have it show the actual application name instead of the description. BUG: 358423 FIXED-IN: 5.11.0 CHANGELOG: Application launcher mouse action can now be configured to show application names instead of their description Differential Revision: https://phabricator.kde.org/D6441 --- containmentactions/applauncher/CMakeLists.txt | 5 +++- containmentactions/applauncher/Messages.sh | 2 ++ containmentactions/applauncher/config.ui | 25 ++++++++++++++++ containmentactions/applauncher/launch.cpp | 33 +++++++++++++++++++++- containmentactions/applauncher/launch.h | 11 ++++++++ .../plasma-containmentactions-applauncher.desktop | 1 + 6 files changed, 75 insertions(+), 2 deletions(-) create mode 100755 containmentactions/applauncher/Messages.sh create mode 100644 containmentactions/applauncher/config.ui diff --git a/containmentactions/applauncher/CMakeLists.txt b/containmentactions/applauncher/CMakeLists.txt index ead6e81..084ec28 100644 --- a/containmentactions/applauncher/CMakeLists.txt +++ b/containmentactions/applauncher/CMakeLists.txt @@ -1,12 +1,15 @@ +add_definitions(-DTRANSLATION_DOMAIN=\"plasma_containmentactions_applauncher\") + set(applauncher_SRCS launch.cpp ) +ki18n_wrap_ui(applauncher_SRCS config.ui) add_library(plasma_containmentactions_applauncher MODULE ${applauncher_SRCS}) kcoreaddons_desktop_to_json(plasma_containmentactions_applauncher plasma-containmentactions-applauncher.desktop) -target_link_libraries(plasma_containmentactions_applauncher KF5::Plasma KF5::KIOCore KF5::KIOWidgets) +target_link_libraries(plasma_containmentactions_applauncher KF5::Plasma KF5::KIOCore KF5::KIOWidgets KF5::I18n) install(TARGETS plasma_containmentactions_applauncher DESTINATION ${KDE_INSTALL_PLUGINDIR}) install(FILES plasma-containmentactions-applauncher.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/containmentactions/applauncher/Messages.sh b/containmentactions/applauncher/Messages.sh new file mode 100755 index 0000000..0083c51 --- /dev/null +++ b/containmentactions/applauncher/Messages.sh @@ -0,0 +1,2 @@ +#! /usr/bin/env bash +$XGETTEXT *.cpp -o $podir/plasma_containmentactions_applauncher.pot diff --git a/containmentactions/applauncher/config.ui b/containmentactions/applauncher/config.ui new file mode 100644 index 0000000..d2389ae --- /dev/null +++ b/containmentactions/applauncher/config.ui @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Config</class> + <widget class="QWidget" name="Config"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>397</width> + <height>123</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="showAppsByName"> + <property name="text"> + <string>Show applications by name</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/containmentactions/applauncher/launch.cpp b/containmentactions/applauncher/launch.cpp index abda409..7ea8ae8 100644 --- a/containmentactions/applauncher/launch.cpp +++ b/containmentactions/applauncher/launch.cpp @@ -52,7 +52,13 @@ void AppLauncher::makeMenu(QMenu *menu, const KServiceGroup::Ptr group) foreach (KSycocaEntry::Ptr p, group->entries(true, false, true)) { if (p->isType(KST_KService)) { const KService::Ptr service(static_cast<KService*>(p.data())); - QAction *action = new QAction(QIcon::fromTheme(service->icon()), service->genericName().isEmpty() ? service->name() : service->genericName(), this); + + QString text = service->name(); + if (!m_showAppsByName && !service->genericName().isEmpty()) { + text = service->genericName(); + } + + QAction *action = new QAction(QIcon::fromTheme(service->icon()), text, this); connect(action, &QAction::triggered, [action](){ KService::Ptr service = KService::serviceByStorageId(action->data().toString()); new KRun(QUrl("file://"+service->entryPath()), 0); @@ -85,6 +91,31 @@ void AppLauncher::makeMenu(QMenu *menu, const KServiceGroup::Ptr group) } } +QWidget *AppLauncher::createConfigurationInterface(QWidget *parent) +{ + QWidget *widget = new QWidget(parent); + m_ui.setupUi(widget); + widget->setWindowTitle(i18nc("plasma_containmentactions_applauncher", "Configure Application Launcher Plugin")); + + m_ui.showAppsByName->setChecked(m_showAppsByName); + + return widget; +} + +void AppLauncher::configurationAccepted() +{ + m_showAppsByName = m_ui.showAppsByName->isChecked(); +} + +void AppLauncher::restore(const KConfigGroup &config) +{ + m_showAppsByName = config.readEntry(QStringLiteral("showAppsByName"), false); +} + +void AppLauncher::save(KConfigGroup &config) +{ + config.writeEntry(QStringLiteral("showAppsByName"), m_showAppsByName); +} K_EXPORT_PLASMA_CONTAINMENTACTIONS_WITH_JSON(applauncher, AppLauncher, "plasma-containmentactions-applauncher.json") diff --git a/containmentactions/applauncher/launch.h b/containmentactions/applauncher/launch.h index 4738c89..95b5123 100644 --- a/containmentactions/applauncher/launch.h +++ b/containmentactions/applauncher/launch.h @@ -26,6 +26,8 @@ #include <plasma/containmentactions.h> +#include "ui_config.h" + class QAction; class QMenu; @@ -40,12 +42,21 @@ class AppLauncher : public Plasma::ContainmentActions QList<QAction*> contextualActions() override; + QWidget *createConfigurationInterface(QWidget* parent) override; + void configurationAccepted() override; + + void restore(const KConfigGroup &config) override; + void save(KConfigGroup &config) override; + protected: void makeMenu(QMenu *menu, const KServiceGroup::Ptr group); private: KServiceGroup::Ptr m_group; QList<QAction *> m_actions; + + Ui::Config m_ui; + bool m_showAppsByName = false; }; diff --git a/containmentactions/applauncher/plasma-containmentactions-applauncher.desktop b/containmentactions/applauncher/plasma-containmentactions-applauncher.desktop index b5112c8..5d955cf 100644 --- a/containmentactions/applauncher/plasma-containmentactions-applauncher.desktop +++ b/containmentactions/applauncher/plasma-containmentactions-applauncher.desktop @@ -165,3 +165,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true +X-Plasma-HasConfigurationInterface=true -- cgit v0.11.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor