diff --git a/containmentactions/applauncher/CMakeLists.txt b/containmentactions/applauncher/CMakeLists.txt index ead6e8192..084ec2897 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 000000000..0083c517c --- /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 000000000..d2389aeb0 --- /dev/null +++ b/containmentactions/applauncher/config.ui @@ -0,0 +1,25 @@ + + + Config + + + + 0 + 0 + 397 + 123 + + + + + + + Show applications by name + + + + + + + + diff --git a/containmentactions/applauncher/launch.cpp b/containmentactions/applauncher/launch.cpp index abda409cc..7ea8ae8ae 100644 --- a/containmentactions/applauncher/launch.cpp +++ b/containmentactions/applauncher/launch.cpp @@ -1,92 +1,123 @@ /* * Copyright 2009 by Chani Armitage * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "launch.h" #include #include #include AppLauncher::AppLauncher(QObject *parent, const QVariantList &args) : Plasma::ContainmentActions(parent, args), m_group(new KServiceGroup(QStringLiteral("/"))) { } AppLauncher::~AppLauncher() { } void AppLauncher::init(const KConfigGroup &) { } QList AppLauncher::contextualActions() { qDeleteAll(m_actions); m_actions.clear(); makeMenu(0, m_group); return m_actions; } 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(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); }); action->setData(service->storageId()); if (menu) { menu->addAction(action); } else { m_actions << action; } } else if (p->isType(KST_KServiceGroup)) { const KServiceGroup::Ptr service(static_cast(p.data())); if (service->childCount() == 0) { continue; } QAction *action = new QAction(QIcon::fromTheme(service->icon()), service->caption(), this); QMenu *subMenu = new QMenu(); makeMenu(subMenu, service); action->setMenu(subMenu); if (menu) { menu->addAction(action); } else { m_actions << action; } } else if (p->isType(KST_KServiceSeparator)) { if (menu) { menu->addSeparator(); } } } } +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") #include "launch.moc" diff --git a/containmentactions/applauncher/launch.h b/containmentactions/applauncher/launch.h index 4738c899c..95b5123e3 100644 --- a/containmentactions/applauncher/launch.h +++ b/containmentactions/applauncher/launch.h @@ -1,52 +1,63 @@ /* * Copyright 2009 by Chani Armitage * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SWITCHWINDOW_HEADER #define SWITCHWINDOW_HEADER #include #include #include +#include "ui_config.h" + class QAction; class QMenu; class AppLauncher : public Plasma::ContainmentActions { Q_OBJECT public: AppLauncher(QObject* parent, const QVariantList& args); ~AppLauncher() override; void init(const KConfigGroup &config); QList 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 m_actions; + + Ui::Config m_ui; + bool m_showAppsByName = false; }; #endif diff --git a/containmentactions/applauncher/plasma-containmentactions-applauncher.desktop b/containmentactions/applauncher/plasma-containmentactions-applauncher.desktop index b5112c827..5d955cf4b 100644 --- a/containmentactions/applauncher/plasma-containmentactions-applauncher.desktop +++ b/containmentactions/applauncher/plasma-containmentactions-applauncher.desktop @@ -1,167 +1,168 @@ [Desktop Entry] Name=Application Launcher Name[af]=Programlanseerder Name[ar]=مُطلِق التطبيقات Name[be]=Запуск праграмаў Name[be@latin]=Uklučeńnie aplikacyi Name[bg]=Стартиране на програми Name[bn]=অ্যাপলিকেশন লঞ্চার Name[bn_IN]=অ্যাপ্লিকেশন সঞ্চালনকারী Name[bs]=Pokretač programa Name[ca]=Llançador d'aplicacions Name[ca@valencia]=Llançador d'aplicacions Name[cs]=Spouštěč aplikací Name[csb]=Zrëszôcz programów Name[da]=Startmenu Name[de]=Anwendungsstarter Name[el]=Εκτέλεση εφαρμογών Name[en_GB]=Application Launcher Name[eo]=Aplikaĵolanĉilo Name[es]=Lanzador de aplicaciones Name[et]=Rakenduste käivitaja Name[eu]=Aplikazio-abiarazlea Name[fa]=راه‌انداز برنامه Name[fi]=Sovelluskäynnistin Name[fr]=Lanceur d'application Name[fy]=In applikaashe starter Name[ga]=Tosaitheoir Feidhmchlár Name[gl]=Iniciador de aplicativos Name[gu]=કાર્યક્રમ ચલાવનાર Name[he]=משגר יישומים Name[hi]=अनुप्रयोग चालक Name[hne]=अनुपरयोग चालू करइया Name[hr]=Pokretač aplikacija Name[hsb]=Startowar za aplikacije Name[hu]=Programindító Name[ia]=Lanceator de application Name[id]=Peluncur Aplikasi Name[is]=Forrita-Ræsir Name[it]=Avviatore di applicazioni Name[ja]=Kickoff アプリケーションランチャー Name[kk]=Қолданбаны жегу Name[km]=កម្មវិធី​ចាប់ផ្ដើម​កម្មវិធី​ Name[kn]=ಅನ್ವಯ ಪ್ರಕ್ಷೇಪಕ (ಲಾಚರ್) Name[ko]=프로그램 실행기 Name[ku]=Deskpêkerê Sepanan Name[lt]=Programų paleidiklis Name[lv]=Programmu palaidējs Name[mai]=अनुप्रयोग चालक Name[mk]=Стартувач на апликации Name[ml]=പ്രയോഗവിക്ഷേപിണി Name[mr]=अनुप्रयोग प्रक्षेपक Name[nb]=Programstarter Name[nds]=Programmoproper Name[ne]=अनुप्रयोक सुरुआतकर्ता Name[nl]=Programmastarter Name[nn]=Programstartar Name[or]=ପ୍ରୟୋଗ ଆରମ୍ଭକର୍ତ୍ତା Name[pa]=ਐਪਲੀਕੇਸ਼ ਲਾਂਚਰ Name[pl]=Aktywator programów Name[pt]=Lançador de Aplicações Name[pt_BR]=Lançador de aplicativos Name[ro]=Lansator de aplicații Name[ru]=Меню запуска приложений Name[se]=Prográmmaálggaheaddji Name[si]=යෙදුම් ඇරඹුම Name[sk]=Spúšťač aplikácií Name[sl]=Zaganjalnik programov Name[sr]=покретач програма Name[sr@ijekavian]=покретач програма Name[sr@ijekavianlatin]=pokretač programa Name[sr@latin]=pokretač programa Name[sv]=Starta program Name[ta]=பயன்பாடு ஏவி Name[te]=అనువర్తనం దించునది Name[tg]=Оғози барномаҳо Name[th]=ตัวเรียกใช้งานโปรแกรม Name[tr]=Uygulama Başlatıcısı Name[ug]=پروگرامما ئىجرا قىلغۇچ Name[uk]=Інструмент запуску програм Name[uz]=Dasturlarni ishga tushiruvchi Name[uz@cyrillic]=Дастурларни ишга туширувчи Name[vi]=Trình chạy ứng dụng Name[wa]=Enondeu di programe Name[x-test]=xxApplication Launcherxx Name[zh_CN]=程序启动器 Name[zh_TW]=應用程式啟動器 Type=Service Icon=preferences-desktop-launch-feedback Comment=Simple application launcher Comment[ar]=مُطلِق تطبيقات بسيط Comment[bg]=Стартиране на програми Comment[bs]=Jednostavan pokretač programa Comment[ca]=Llançador d'aplicacions senzill Comment[ca@valencia]=Llançador d'aplicacions senzill Comment[cs]=Jednoduchý spouštěč aplikací Comment[csb]=Prosti zrëszôcz programów Comment[da]=Simpel startmenu Comment[de]=Einfacher Anwendungsstarter Comment[el]=Απλή εκτέλεση εφαρμογών Comment[en_GB]=Simple application launcher Comment[eo]=Simpla plikaĵolanĉilo Comment[es]=Lanzador de aplicaciones sencillo Comment[et]=Lihtne rakenduste käivitaja Comment[eu]=Aplikazio-abiarazle soila Comment[fi]=Yksinkertainen sovelluskäynnistin Comment[fr]=Lanceur simple d'application Comment[fy]=Ienfâldige applikaasje útfierder Comment[ga]=Tosaitheoir simplí feidhmchlár Comment[gl]=Iniciador simple de aplicativos Comment[he]=משגר יישומים פשוט Comment[hi]=सरल अनुप्रयोग चालक Comment[hr]=Jednostavan pokretač aplikacija Comment[hu]=Egyszerű alkalmazásindító Comment[ia]=Simple lanceator de application Comment[id]=Peluncur aplikasi sederhana Comment[is]=Einfaldur forritaræsir Comment[it]=Semplice avviatore di applicazioni Comment[ja]=シンプルなアプリケーションランチャー Comment[kk]=Қапапайым қолданба жеккіші Comment[km]=កម្មវិធី​ចាប់ផ្ដើម​កម្មវិធី​សាមញ្ញ​ Comment[kn]=ಸರಳ ಅನ್ವಯ ಪ್ರಕ್ಷೇಪಕ (ಲಾಂಚರ್) Comment[ko]=간단한 프로그램 실행기 Comment[lt]=Paprastas programų paleidiklis Comment[lv]=Vienkāršs programmu palaidējs Comment[mk]=Едноставен стартувач на апликации Comment[ml]=ലളിതമായ പ്രയോഗവിക്ഷേപിണി Comment[mr]=सोपा अनुप्रयोग प्रक्षेपक Comment[nb]=Enkel programstarter Comment[nds]=Eenfach Programmoproper Comment[nl]=Eenvoudige programmastarter Comment[nn]=Enkel programstartar Comment[pa]=ਸਧਾਰਨ ਐਪਲੀਕੇਸ਼ ਲਾਂਚਰ Comment[pl]=Uruchamia programy w prosty sposób Comment[pt]=Lançador de aplicações simples Comment[pt_BR]=Lançador de aplicativos simples Comment[ro]=Lansator de aplicații simplu Comment[ru]=Упрощённое меню запуска приложений Comment[si]=සරල යෙදුම් අරඹනය Comment[sk]=Jednoduchý spúšťač aplikácií Comment[sl]=Preprost zaganjalnik programov Comment[sr]=Једноставан покретач програма Comment[sr@ijekavian]=Једноставан покретач програма Comment[sr@ijekavianlatin]=Jednostavan pokretač programa Comment[sr@latin]=Jednostavan pokretač programa Comment[sv]=Enkel programstart Comment[tg]=Иҷрогари барномаҳо Comment[th]=ตัวเรียกใช้งานโปรแกรมพื้นฐาน Comment[tr]=Basit uygulama başlatıcı Comment[ug]=ئاددىي پروگرامما ئىجراچىسى Comment[uk]=Простий інструмент запуску програм Comment[wa]=Simpe enondeu di programe Comment[x-test]=xxSimple application launcherxx Comment[zh_CN]=简易程序启动器 Comment[zh_TW]=簡單的應用程式啟動器 ServiceTypes=Plasma/ContainmentActions X-KDE-Library=plasma_containmentactions_applauncher X-KDE-PluginInfo-Author=Chani X-KDE-PluginInfo-Email=chani@kde.org X-KDE-PluginInfo-Name=org.kde.applauncher X-KDE-PluginInfo-Version=pre0.1 X-KDE-PluginInfo-Website=http://plasma.kde.org/ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true +X-Plasma-HasConfigurationInterface=true