diff --git a/appmenu/CMakeLists.txt b/appmenu/CMakeLists.txt index 95670568..5060675b 100644 --- a/appmenu/CMakeLists.txt +++ b/appmenu/CMakeLists.txt @@ -1,44 +1,44 @@ include_directories(${dbusmenu-qt5_INCLUDE_DIRS}) remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS) set(kded_appmenu_SRCS appmenu.cpp menuimporter.cpp appmenu_dbus.cpp # menubutton.cpp # menuwidget.cpp # menubar.cpp # topmenubar.cpp # glowbar.cpp verticalmenu.cpp # shadows.cpp ) qt5_add_dbus_adaptor(kded_appmenu_SRCS com.canonical.AppMenu.Registrar.xml menuimporter.h MenuImporter menuimporteradaptor MenuImporterAdaptor) qt5_add_dbus_adaptor(kded_appmenu_SRCS org.kde.kappmenu.xml appmenu_dbus.h AppmenuDBus appmenuadaptor AppmenuAdaptor) -add_library(kded_appmenu MODULE ${kded_appmenu_SRCS}) +add_library(appmenu MODULE ${kded_appmenu_SRCS}) +kcoreaddons_desktop_to_json(appmenu appmenu.desktop) -target_link_libraries(kded_appmenu +target_link_libraries(appmenu Qt5::DBus Qt5::X11Extras KF5::DBusAddons KF5::KIOCore KF5::KIOWidgets KF5::WindowSystem KF5::KDELibs4Support ${X11_LIBRARIES} dbusmenu-qt5 ) -install(TARGETS kded_appmenu DESTINATION ${KDE_INSTALL_PLUGINDIR} ) +install(TARGETS appmenu DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kded ) ########### install files ############### -install( FILES appmenu.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kded ) install( FILES com.canonical.AppMenu.Registrar.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR} ) install( FILES org.kde.kappmenu.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR} ) diff --git a/appmenu/appmenu.cpp b/appmenu/appmenu.cpp index d5620fa4..cbeea4dd 100644 --- a/appmenu/appmenu.cpp +++ b/appmenu/appmenu.cpp @@ -1,421 +1,420 @@ /* This file is part of the KDE project. Copyright (c) 2011 Lionel Chauvin Copyright (c) 2011,2012 Cédric Bellegarde Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "appmenu.h" #include "kdbusimporter.h" #include "menuimporteradaptor.h" #include "appmenuadaptor.h" #include "appmenu_dbus.h" #if 0 #include "topmenubar.h" #endif #include "verticalmenu.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include -K_PLUGIN_FACTORY(AppMenuFactory, - registerPlugin(); - ) -K_EXPORT_PLUGIN(AppMenuFactory("appmenu")) +K_PLUGIN_FACTORY_WITH_JSON(AppMenuFactory, + "appmenu.json", + registerPlugin();) AppMenuModule::AppMenuModule(QObject* parent, const QList&) : KDEDModule(parent), m_parent(parent), m_menuImporter(0), m_appmenuDBus(new AppmenuDBus(parent)), m_menubar(0), m_menu(0), m_screenTimer(new QTimer(this)), m_waitingAction(0), m_currentScreen(-1) { reconfigure(); m_appmenuDBus->connectToBus(); m_currentScreen = currentScreen(); connect(m_appmenuDBus, SIGNAL(appShowMenu(int, int, WId)), SLOT(slotShowMenu(int, int, WId))); connect(m_appmenuDBus, SIGNAL(moduleReconfigure()), SLOT(reconfigure())); // transfer our signals to dbus connect(this, SIGNAL(showRequest(qulonglong)), m_appmenuDBus, SIGNAL(showRequest(qulonglong))); connect(this, SIGNAL(menuAvailable(qulonglong)), m_appmenuDBus, SIGNAL(menuAvailable(qulonglong))); connect(this, SIGNAL(clearMenus()), m_appmenuDBus, SIGNAL(clearMenus())); connect(this, SIGNAL(menuHidden(qulonglong)), m_appmenuDBus, SIGNAL(menuHidden(qulonglong))); connect(this, SIGNAL(WindowRegistered(qulonglong, const QString&, const QDBusObjectPath&)), m_appmenuDBus, SIGNAL(WindowRegistered(qulonglong, const QString&, const QDBusObjectPath&))); connect(this, SIGNAL(WindowUnregistered(qulonglong)), m_appmenuDBus, SIGNAL(WindowUnregistered(qulonglong))); } AppMenuModule::~AppMenuModule() { emit clearMenus(); hideMenubar(); if (m_menubar) { delete m_menubar; } delete m_menuImporter; delete m_appmenuDBus; } void AppMenuModule::slotShowMenu(int x, int y, WId id) { static KDBusMenuImporter *importer = 0; if (!m_menuImporter) { return; } // If menu visible, hide it if (m_menu && m_menu->isVisible()) { m_menu->hide(); return; } //dbus call by user (for khotkey shortcut) if (x == -1 || y == -1) { // We do not know kwin button position, so tell kwin to show menu emit showRequest(KWindowSystem::self()->activeWindow()); return; } importer = getImporter(id); if (!importer) { return; } QMenu *menu = importer->menu(); // Window do not have menu if (!menu) { return; } m_menu = new VerticalMenu(); m_menu->setParentWid(id); // Populate menu foreach (QAction *action, menu->actions()) { m_menu->addAction(action); } m_menu->popup(QPoint(x, y)); // Activate waiting action if exist if (m_waitingAction) { m_menu->setActiveAction(m_waitingAction); m_waitingAction = 0; } connect(m_menu, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHide())); } void AppMenuModule::slotAboutToHide() { if (m_menu) { emit menuHidden(m_menu->parentWid()); m_menu->deleteLater(); m_menu = 0; } } // New window registered void AppMenuModule::slotWindowRegistered(WId id, const QString& service, const QDBusObjectPath& path) { KDBusMenuImporter* importer = m_importers.take(id); if (importer) { delete importer; } // Application already active so check if we need create menubar if ( m_menuStyle == "TopMenuBar" && id == KWindowSystem::self()->activeWindow()) { slotActiveWindowChanged(id); } else if (m_menuStyle == "ButtonVertical") { KWindowInfo info(id, 0, NET::WM2WindowClass); // Tell Kwin menu is available emit menuAvailable(id); // FIXME: https://bugs.kde.org/show_bug.cgi?id=317926 if (info.windowClassName() != "kmix") { getImporter(id); } } // Send a signal on bus for others dbus interface registrars emit WindowRegistered(id, service, path); } // Window unregistered void AppMenuModule::slotWindowUnregistered(WId id) { KDBusMenuImporter* importer = m_importers.take(id); // Send a signal on bus for others dbus interface registrars emit WindowUnregistered(id); if (importer) { delete importer; } #if 0 if (m_menubar && m_menubar->parentWid() == id) { hideMenubar(); } #endif } // Keyboard activation requested, transmit it to menu void AppMenuModule::slotActionActivationRequested(QAction* a) { // If we have a topmenubar, activate action #if 0 if (m_menubar) { m_menubar->setActiveAction(a); m_menubar->show(); } else #endif { // else send request to kwin or others dbus interface registrars m_waitingAction = a; emit showRequest(KWindowSystem::self()->activeWindow()); } } // Current window change, update menubar // See comments in slotWindowRegistered() for why we get importers here void AppMenuModule::slotActiveWindowChanged(WId id) { KWindowInfo info(id, NET::WMWindowType); NET::WindowTypes mask = NET::AllTypesMask; m_currentScreen = currentScreen(); if (id == 0) {// Ignore root window return; } else if (info.windowType(mask) & NET::Dock) { // Hide immediatly menubar for docks (krunner) hideMenubar(); return; } if (!m_menuImporter->serviceExist(id)) { // No menu exist, check for another menu for application WId recursiveId = m_menuImporter->recursiveMenuId(id); if (recursiveId) { id = recursiveId; } } KDBusMenuImporter *importer = getImporter(id); if (!importer) { hideMenubar(); return; } #if 0 QMenu *menu = importer->menu(); if(menu) { showMenuBar(menu); m_menubar->setParentWid(id); } else { hideMenubar(); } #endif } void AppMenuModule::slotShowCurrentWindowMenu() { slotActiveWindowChanged(KWindowSystem::self()->activeWindow()); } void AppMenuModule::slotCurrentScreenChanged() { if (m_currentScreen != currentScreen()) { #if 0 if (m_menubar) { m_menubar->setParentWid(0); } #endif slotActiveWindowChanged(KWindowSystem::self()->activeWindow()); } } void AppMenuModule::slotBarNeedResize() { #if 0 if (m_menubar) { m_menubar->updateSize(); m_menubar->move(centeredMenubarPos()); } #endif } // reload settings void AppMenuModule::reconfigure() { KConfig config( "kdeglobals", KConfig::FullConfig ); KConfigGroup configGroup = config.group("Appmenu Style"); m_menuStyle = configGroup.readEntry("Style", "InApplication"); m_waitingAction = 0; // hide menubar if exist hideMenubar(); if (m_menubar) { delete m_menubar; m_menubar = 0; } slotAboutToHide(); // hide vertical menu if exist // Disconnect all options specifics signals disconnect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(slotActiveWindowChanged(WId))); disconnect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(slotShowCurrentWindowMenu())); disconnect(m_screenTimer, SIGNAL(timeout()), this, SLOT(slotCurrentScreenChanged())); m_screenTimer->stop(); // Tell kwin to clean its titlebar emit clearMenus(); if (m_menuStyle == "InApplication") { if (m_menuImporter) { delete m_menuImporter; m_menuImporter = 0; } return; } // Setup a menu importer if needed if (!m_menuImporter) { m_menuImporter = new MenuImporter(m_parent); connect(m_menuImporter, SIGNAL(WindowRegistered(WId, const QString&, const QDBusObjectPath&)), SLOT(slotWindowRegistered(WId, const QString&, const QDBusObjectPath&))); connect(m_menuImporter, SIGNAL(WindowUnregistered(WId)), SLOT(slotWindowUnregistered(WId))); m_menuImporter->connectToBus(); } if( m_menuStyle == "ButtonVertical" ) { foreach(WId id, m_menuImporter->ids()) { emit menuAvailable(id); } } // Setup top menubar if needed if (m_menuStyle == "TopMenuBar") { #if 0 m_menubar = new TopMenuBar(); connect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(slotActiveWindowChanged(WId))); connect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(slotShowCurrentWindowMenu())); connect(m_screenTimer, SIGNAL(timeout()), this, SLOT(slotCurrentScreenChanged())); connect(m_menubar, SIGNAL(needResize()), SLOT(slotBarNeedResize())); m_screenTimer->start(1000); slotShowCurrentWindowMenu(); #endif } } KDBusMenuImporter* AppMenuModule::getImporter(WId id) { KDBusMenuImporter* importer = 0; if (m_importers.contains(id)) { // importer already exist importer = m_importers.value(id); } else if (m_menuImporter->serviceExist(id)) { // get importer importer = new KDBusMenuImporter(id, m_menuImporter->serviceForWindow(id), &m_icons, m_menuImporter->pathForWindow(id), this); if (importer) { QMetaObject::invokeMethod(importer, "updateMenu", Qt::DirectConnection); connect(importer, SIGNAL(actionActivationRequested(QAction*)), SLOT(slotActionActivationRequested(QAction*))); m_importers.insert(id, importer); } } return importer; } void AppMenuModule::showMenuBar(QMenu *menu) { #if 0 if (!menu) { return; } m_menubar->setMenu(menu); if (menu->actions().length()) { m_menubar->enableMouseTracking(); } #endif } void AppMenuModule::hideMenubar() { #if 0 if (!m_menubar) { return; } m_menubar->enableMouseTracking(false); if (m_menubar->isVisible()) { m_menubar->hide(); } #endif } int AppMenuModule::currentScreen() { KWindowInfo info(KWindowSystem::self()->activeWindow(), NET::WMGeometry); int x = info.geometry().x(); int y = info.geometry().y(); QDesktopWidget *desktop = QApplication::desktop(); return desktop->screenNumber(QPoint(x,y)); } QPoint AppMenuModule::centeredMenubarPos() { QDesktopWidget *desktop = QApplication::desktop(); m_currentScreen = currentScreen(); QRect screen = desktop->availableGeometry(m_currentScreen); #if 0 int x = screen.center().x() - m_menubar->sizeHint().width()/2; return QPoint(x, screen.topLeft().y()); #else return QPoint(screen.center().x(), screen.topLeft().y()); #endif } #include "appmenu.moc" diff --git a/freespacenotifier/CMakeLists.txt b/freespacenotifier/CMakeLists.txt index aa083863..259bc66f 100644 --- a/freespacenotifier/CMakeLists.txt +++ b/freespacenotifier/CMakeLists.txt @@ -1,28 +1,27 @@ add_definitions(-DTRANSLATION_DOMAIN=\"freespacenotifier\") set(kded_freespacenotifier_SRCS freespacenotifier.cpp module.cpp) ki18n_wrap_ui(kded_freespacenotifier_SRCS freespacenotifier_prefs_base.ui) kconfig_add_kcfg_files(kded_freespacenotifier_SRCS settings.kcfgc) -add_library(kded_freespacenotifier MODULE ${kded_freespacenotifier_SRCS}) -kcoreaddons_desktop_to_json(kded_freespacenotifier freespacenotifier.desktop) +add_library(freespacenotifier MODULE ${kded_freespacenotifier_SRCS}) +kcoreaddons_desktop_to_json(freespacenotifier freespacenotifier.desktop) -target_link_libraries(kded_freespacenotifier +target_link_libraries(freespacenotifier KF5::ConfigWidgets KF5::DBusAddons KF5::I18n KF5::KIOCore KF5::KIOWidgets KF5::Notifications ) -install(TARGETS kded_freespacenotifier DESTINATION ${KDE_INSTALL_PLUGINDIR} ) +install(TARGETS freespacenotifier DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kded ) ########### install files ############### -install( FILES freespacenotifier.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kded ) install( FILES freespacenotifier.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR} ) install( FILES freespacenotifier.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR} ) diff --git a/freespacenotifier/freespacenotifier.desktop b/freespacenotifier/freespacenotifier.desktop index 1b170da8..8e778d7a 100644 --- a/freespacenotifier/freespacenotifier.desktop +++ b/freespacenotifier/freespacenotifier.desktop @@ -1,129 +1,130 @@ [Desktop Entry] +Type=Service +X-KDE-ServiceTypes=KDEDModule +X-KDE-Library=freespacenotifier +X-KDE-DBus-ModuleName=freespacenotifier +X-KDE-Kded-autoload=true + Name=Free Space Notifier Name[ar]=مُخطِر المساحة الحرّة Name[bg]=Уведомяване за свободно пространство Name[bs]=Izvještač o slobodnom prostoru Name[ca]=Notificador d'espai lliure Name[ca@valencia]=Notificador d'espai lliure Name[cs]=Oznamování volného místa Name[da]=Bekendtgørelse om ledig plads Name[de]=Speicherplatzbenachrichtigung Name[el]=Ειδοποίηση ελεύθερου χώρου Name[en_GB]=Free Space Notifier Name[es]=Notificador de espacio libre Name[et]=Vaba ruumi teavitaja Name[eu]=Leku askearen jakinarazlea Name[fi]=Vapaan tilan ilmoitin Name[fr]=Notification d'espace libre Name[ga]=Fógróir Spáis Shaoir Name[gl]=Notificador de espazo libre Name[he]=Free Space Notifier Name[hi]=खाली स्थान सूचक Name[hr]=Glasnik slobodnog prostora Name[hu]=Szabad hely értesítő Name[ia]=Notificator de spatio libere Name[id]=Notifikasi Ruang Kosong Name[is]=Tilkynningar um laust pláss Name[it]=Notificatore dello spazio libero Name[ja]=空き領域の通知 Name[kk]=KDE-нің бос орын туралы құлақтандыруы Name[km]=កម្មវិធី​ជូនដំណឹង​​ទំហំ​ទំនេរ Name[kn]=ಖಾಲಿ ಜಾಗ ಸೂಚಕ Name[ko]=남은 공간 알림이 Name[lt]=Laisvos vietos pranešėjas Name[lv]=Brīvās vietas ziņotājs Name[ml]=ലഭ്യമായ സ്ഥലം അറിയിക്കുന്നതിനുള്ള സംവിധാനം Name[mr]=मोकळी जागा निदर्शक Name[nb]=Ledig plass-varsler Name[nds]=Freeruumbescheden Name[nl]=Vrije ruimte-melder Name[nn]=Varsel om lite ledig plass Name[pa]=ਖਾਲੀ ਥਾਂ ਨੋਟੀਫਾਇਰ Name[pl]=Powiadomienie o wolnym miejscu Name[pt]=Notificação de Espaço Livre Name[pt_BR]=Notificação de espaço livre Name[ro]=Notificare spațiu liber Name[ru]=Слежение за свободным местом на диске Name[si]=හිස් ඉඩ දැනුම් දෙන්නා Name[sk]=Monitor voľného miesta Name[sl]=Obvestilnik o neporabljenem prostoru Name[sr]=Извештавач о слободном простору Name[sr@ijekavian]=Извјештавач о слободном простору Name[sr@ijekavianlatin]=Izvještavač o slobodnom prostoru Name[sr@latin]=Izveštavač o slobodnom prostoru Name[sv]=Information om ledigt utrymme Name[th]=ตัวแจ้งพื้นที่ว่าง Name[tr]=Boş Alan Bildirici Name[ug]=بىكار بوشلۇق خەۋەرچىسى Name[uk]=Сповіщення про вільне місце Name[vi]=Trình thông báo không gian trống Name[wa]=Notifieu del plaece di libe Name[x-test]=xxFree Space Notifierxx Name[zh_CN]=空闲空间通知器 Name[zh_TW]=剩餘空間通知 Comment=Warns when running out of space on your home folder Comment[ar]=يحذّرك عندما تنفذ مساحة مجلد المنزل Comment[bg]=Предупреждение при твърде малко пространство в домашната директория Comment[bn]=ব্যক্তিগত ফোল্ডারে জায়গা কমে গেলে সতর্ক করে Comment[bs]=Upozorava kada vam ponestaje prostora u ličnom direktoriju Comment[ca]=Avisa quan s'exhaureix l'espai de la carpeta personal Comment[ca@valencia]=Avisa quan s'exhaureix l'espai de la carpeta personal Comment[cs]=Varování při blížícím se nedostatku místa v domácí složce Comment[da]=Advarer når du er ved at løbe tør for plads i din hjemmemappe Comment[de]=Gibt eine Warnung aus, wenn der freie Speicherplatz in Ihrem Persönlichen Ordner knapp wird Comment[el]=Προειδοποιεί όταν τελειώνει ο ελεύθερος χώρος στον 'Προσωπικό φάκελό' σας Comment[en_GB]=Warns when running out of space on your home folder Comment[es]=Le avisa cuando se está quedando sin espacio en su carpeta personal Comment[et]=Hoiatus, kui kodukataloogis hakkab ruumi nappima Comment[eu]=Abisua ematen du etxeko karpetan lekurik gabe gelditzen ari zarenean Comment[fi]=Varoittaa kun kotikansiosta on tila loppumassa Comment[fr]=Avertit lorsque l'espace vient à manquer dans votre dossier utilisateur Comment[ga]=Tugann sé rabhadh duit nuair atá d'fhillteán baile ag éirí lán Comment[gl]=Avisa cando se está a quedar sen espazo no cartafol persoal Comment[he]=משמש לאזהרה כאשר המקום הפנוי בתיקיית הבית מועט Comment[hr]=Upozori kada nestaje prostora u mojoj korisničkoj mapi Comment[hu]=Figyelmeztet, ha kezd elfogyni a szabad lemezterület a saját könyvtárában Comment[ia]=Il avisa quando il termina le spatio sur tu dossier domo Comment[id]=Memperingatkan jika kehabisan ruang kosong di folder rumah anda Comment[is]=Varar við þegar lítið pláss er eftir í heimamöppunni þinni Comment[it]=Avvisa quando si sta esaurendo lo spazio nella tua cartella Home Comment[ja]=ホームフォルダの空き領域が少なくなったとき警告します Comment[kk]=Мекен қапшығыңызда орын тапшылығы туралы ескерту Comment[km]=ព្រមាន នៅពេល​ដំណើរការ​អស់ទំហំ​នៅ​លើ​ក្នុង​​ផ្ទះ​របស់​អ្នក Comment[kn]=ನೆಲೆ ಕೋಶದಲ್ಲಿ ಖಾಲಿ ಸ್ಥಳವು ಇದಕ್ಕಿಂತ ಕಡಿಮೆಯಾದರೆ ಎಚ್ಚರಿಸುತ್ತದೆ Comment[ko]=홈 폴더에 공간이 없을 때 알려 줍니다 Comment[lt]=Įspėja, kai namų aplanke baigiasi laisva vieta Comment[lv]=Brīdina, kad mājas mapē beidzas brīvā vieta Comment[mr]=तुमच्या मुख्य संचयीकेतील जागा संपत आल्याची सूचना देतो Comment[nb]=Varsler når det er lite plass igjen i hjemmemappa Comment[nds]=Wohrschoen bi to minn free Ruum binnen Dien Tohuusorner Comment[nl]=Geeft een waarschuwing bij een lage stand van de vrije ruimte voor uw persoonlijke map Comment[nn]=Varslar når det er lite plass i heimemappa Comment[pa]=ਚੇਤਾਵਨੀ ਦਿਉ, ਜਦੋਂ ਤੁਹਾਡੇ ਘਰ ਫੋਲਡਰ ਉੱਤੇ ਥਾਂ ਖਤਮ ਹੋ ਰਹੀ ਹੋਵੇ Comment[pl]=Ostrzega, kiedy zaczyna brakować miejsca w katalogu domowym Comment[pt]=Avisa de estiver com falta de espaço na sua pasta pessoal Comment[pt_BR]=Avisa quando ficar sem espaço na sua pasta pessoal Comment[ro]=Atenționează cînd spațiul de stocare din dosarul acasă este pe cale să se termine Comment[ru]=Предупреждает о нехватке дискового пространства в домашней папке Comment[si]=ඔබගේ නිවාස බහාලුමේ ඉඩ අඩුවෙන් ධාවනය වෙන විට ඇනතුරු අඟවයි Comment[sk]=Upozorňuje, keď dochádza voľné miesto v domovskom priečinku Comment[sl]=Opozori, ko v domači mapi primanjkuje prostora Comment[sr]=Упозорава када вам понестаје простора у домаћој фасцикли Comment[sr@ijekavian]=Упозорава када вам понестаје простора у домаћој фасцикли Comment[sr@ijekavianlatin]=Upozorava kada vam ponestaje prostora u domaćoj fascikli Comment[sr@latin]=Upozorava kada vam ponestaje prostora u domaćoj fascikli Comment[sv]=Varnar när utrymmet i hemkatalogen håller på att ta slut Comment[th]=เตือนเมื่อพื้นที่ในโฟลเดอร์บ้านเหลือน้อย Comment[tr]=Ev dizininizde boş alan azaldığı zaman uyarır Comment[ug]=ماكان قىسقۇچىڭىزدىكى دىسكا بوشلۇقى ئاز قالغاندا ئەسكەرتىدۇ Comment[uk]=Попереджає, якщо у домашній теці залишається мало місця Comment[vi]=Cảnh báo khi sắp hết không gian cho thư mục chính của bạn Comment[wa]=Advierti cwand i gn a cåzu pupont d' plaece dins vosse ridant måjhon Comment[x-test]=xxWarns when running out of space on your home folderxx Comment[zh_CN]=在您主目录磁盘空间过低时发出警告 Comment[zh_TW]=當您的家目錄剩餘空間快不足時警告您 -Type=Service -X-KDE-ServiceTypes=KDEDModule -X-KDE-Library=freespacenotifier -X-KDE-DBus-ModuleName=freespacenotifier -X-KDE-Kded-autoload=true diff --git a/kioslave/remote/kdedmodule/CMakeLists.txt b/kioslave/remote/kdedmodule/CMakeLists.txt index deae4846..a3d98ea0 100644 --- a/kioslave/remote/kdedmodule/CMakeLists.txt +++ b/kioslave/remote/kdedmodule/CMakeLists.txt @@ -1,6 +1,6 @@ -add_library(kded_remotedirnotify MODULE remotedirnotify.cpp remotedirnotifymodule.cpp ../kio_remote_debug.cpp) -target_link_libraries(kded_remotedirnotify KF5::DBusAddons KF5::KIOCore KF5::KDELibs4Support) +add_library(remotedirnotify MODULE remotedirnotify.cpp remotedirnotifymodule.cpp ../kio_remote_debug.cpp) +kcoreaddons_desktop_to_json(remotedirnotify remotedirnotify.desktop) -install(TARGETS kded_remotedirnotify DESTINATION ${KDE_INSTALL_PLUGINDIR} ) -install( FILES remotedirnotify.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kded ) +target_link_libraries(remotedirnotify KF5::DBusAddons KF5::KIOCore KF5::KDELibs4Support) +install(TARGETS remotedirnotify DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kded ) diff --git a/kioslave/remote/kdedmodule/remotedirnotifymodule.cpp b/kioslave/remote/kdedmodule/remotedirnotifymodule.cpp index 38676e7d..3190dfff 100644 --- a/kioslave/remote/kdedmodule/remotedirnotifymodule.cpp +++ b/kioslave/remote/kdedmodule/remotedirnotifymodule.cpp @@ -1,38 +1,37 @@ /* This file is part of the KDE Project Copyright (c) 2004 Kévin Ottens This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "remotedirnotifymodule.h" #include #include #include #include -#include +//#include -K_PLUGIN_FACTORY(RemoteDirNotifyFactory, - registerPlugin(); - ) -K_EXPORT_PLUGIN(RemoteDirNotifyFactory("kio_remote")) +K_PLUGIN_FACTORY_WITH_JSON(RemoteDirNotifyFactory, + "remotedirnotify.json", + registerPlugin();) RemoteDirNotifyModule::RemoteDirNotifyModule(QObject* parent, const QList&) : KDEDModule(parent) { } #include "remotedirnotifymodule.moc" diff --git a/ktimezoned/CMakeLists.txt b/ktimezoned/CMakeLists.txt index d7e3e016..b9a8204a 100644 --- a/ktimezoned/CMakeLists.txt +++ b/ktimezoned/CMakeLists.txt @@ -1,27 +1,20 @@ if (WIN32) set(kded_ktimezoned_SRCS ktimezoned_win.cpp) else () set(kded_ktimezoned_SRCS ktimezoned.cpp) endif () -add_library(kded_ktimezoned MODULE ${kded_ktimezoned_SRCS}) - -kcoreaddons_desktop_to_json(kded_ktimezoned ktimezoned.desktop) +add_library(ktimezoned MODULE ${kded_ktimezoned_SRCS}) +kcoreaddons_desktop_to_json(ktimezoned ktimezoned.desktop) #qt5_add_dbus_adaptor(kded_ktimezoned_SRCS org.kde.KTimeZoned ktimezonedbus.h DBusHandler) -target_link_libraries(kded_ktimezoned +target_link_libraries(ktimezoned Qt5::Core Qt5::DBus KF5::Service # plugin factory KF5::CoreAddons # KDirWatch KF5::DBusAddons # kdedmodule ) -install(TARGETS kded_ktimezoned DESTINATION ${KDE_INSTALL_PLUGINDIR}) - -########### install files ############### - -install( FILES ktimezoned.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kded ) - - +install(TARGETS ktimezoned DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kded) diff --git a/solidautoeject/CMakeLists.txt b/solidautoeject/CMakeLists.txt index c6661eb4..af0f2be7 100644 --- a/solidautoeject/CMakeLists.txt +++ b/solidautoeject/CMakeLists.txt @@ -1,17 +1,13 @@ ########### next target ############### add_definitions(-DTRANSLATION_DOMAIN=\"solidautoeject\") set(kded_solidautoeject_SRCS solidautoeject.cpp ) -add_library(kded_solidautoeject MODULE ${kded_solidautoeject_SRCS}) +add_library(solidautoeject MODULE ${kded_solidautoeject_SRCS}) +kcoreaddons_desktop_to_json(solidautoeject solidautoeject.desktop) -target_link_libraries(kded_solidautoeject KF5::Solid KF5::DBusAddons KF5::CoreAddons) +target_link_libraries(solidautoeject KF5::Solid KF5::DBusAddons KF5::CoreAddons) -install(TARGETS kded_solidautoeject DESTINATION ${KDE_INSTALL_PLUGINDIR}) - - -########### install files ############### - -install(FILES solidautoeject.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kded) +install(TARGETS solidautoeject DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kded) diff --git a/solidautoeject/solidautoeject.cpp b/solidautoeject/solidautoeject.cpp index 9709e74f..b0766f0e 100644 --- a/solidautoeject/solidautoeject.cpp +++ b/solidautoeject/solidautoeject.cpp @@ -1,62 +1,64 @@ /* This file is part of the KDE Project Copyright (c) 2009 Kevin Ottens This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "solidautoeject.h" #include #include #include #include -K_PLUGIN_FACTORY(SolidAutoEjectFactory, registerPlugin();) +K_PLUGIN_FACTORY_WITH_JSON(SolidAutoEjectFactory, + "solidautoeject.json", + registerPlugin();) SolidAutoEject::SolidAutoEject(QObject* parent, const QList&) : KDEDModule(parent) { const QList drives = Solid::Device::listFromType(Solid::DeviceInterface::OpticalDrive); foreach (const Solid::Device &drive, drives) { connectDevice(drive); } connect(Solid::DeviceNotifier::instance(), &Solid::DeviceNotifier::deviceAdded, this, &SolidAutoEject::onDeviceAdded); } SolidAutoEject::~SolidAutoEject() { } void SolidAutoEject::onDeviceAdded(const QString &udi) { connectDevice(Solid::Device(udi)); } void SolidAutoEject::onEjectPressed(const QString &udi) { Solid::Device dev(udi); dev.as()->eject(); } void SolidAutoEject::connectDevice(const Solid::Device &device) { connect(device.as(), &Solid::OpticalDrive::ejectPressed, this, &SolidAutoEject::onEjectPressed); } #include "solidautoeject.moc" diff --git a/soliduiserver/CMakeLists.txt b/soliduiserver/CMakeLists.txt index 0a8ed6be..8bcfe6e5 100644 --- a/soliduiserver/CMakeLists.txt +++ b/soliduiserver/CMakeLists.txt @@ -1,24 +1,19 @@ ########### next target ############### add_definitions(-DTRANSLATION_DOMAIN=\"soliduiserver\") set(kded_soliduiserver_SRCS soliduiserver.cpp deviceactionsdialog.cpp deviceaction.cpp devicenothingaction.cpp deviceserviceaction.cpp ) ki18n_wrap_ui(kded_soliduiserver_SRCS deviceactionsdialogview.ui) -add_library(kded_soliduiserver MODULE ${kded_soliduiserver_SRCS}) -kcoreaddons_desktop_to_json(kded_soliduiserver soliduiserver.desktop) +add_library(soliduiserver MODULE ${kded_soliduiserver_SRCS}) +kcoreaddons_desktop_to_json(soliduiserver soliduiserver.desktop) -target_link_libraries(kded_soliduiserver KF5::Solid KF5::DBusAddons KF5::Wallet KF5::KIOCore KF5::WindowSystem KF5::KDELibs4Support) +target_link_libraries(soliduiserver KF5::Solid KF5::DBusAddons KF5::Wallet KF5::KIOCore KF5::WindowSystem KF5::KDELibs4Support) -install(TARGETS kded_soliduiserver DESTINATION ${KDE_INSTALL_PLUGINDIR}) - - -########### install files ############### - -install(FILES soliduiserver.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kded) +install(TARGETS soliduiserver DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kded) diff --git a/statusnotifierwatcher/CMakeLists.txt b/statusnotifierwatcher/CMakeLists.txt index bd6a82b4..6a9c0d16 100644 --- a/statusnotifierwatcher/CMakeLists.txt +++ b/statusnotifierwatcher/CMakeLists.txt @@ -1,24 +1,21 @@ set(kded_statusnotifierwatcher_SRCS statusnotifierwatcher.cpp ) qt5_add_dbus_adaptor(kded_statusnotifierwatcher_SRCS ${KNOTIFICATIONS_DBUS_INTERFACES_DIR}/kf5_org.kde.StatusNotifierWatcher.xml statusnotifierwatcher.h StatusNotifierWatcher) set(statusnotifieritem_xml ${KNOTIFICATIONS_DBUS_INTERFACES_DIR}/kf5_org.kde.StatusNotifierItem.xml) set_source_files_properties(${statusnotifieritem_xml} PROPERTIES NO_NAMESPACE false INCLUDE "systemtraytypedefs.h" CLASSNAME OrgKdeStatusNotifierItemInterface ) qt5_add_dbus_interface(kded_statusnotifierwatcher_SRCS ${statusnotifieritem_xml} statusnotifieritem_interface) -add_library(kded_statusnotifierwatcher MODULE ${kded_statusnotifierwatcher_SRCS}) +add_library(statusnotifierwatcher MODULE ${kded_statusnotifierwatcher_SRCS}) +kcoreaddons_desktop_to_json(statusnotifierwatcher statusnotifierwatcher.desktop) -target_link_libraries(kded_statusnotifierwatcher Qt5::DBus KF5::DBusAddons KF5::CoreAddons) - -install(TARGETS kded_statusnotifierwatcher DESTINATION ${KDE_INSTALL_PLUGINDIR}) - - -install( FILES statusnotifierwatcher.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kded) +target_link_libraries(statusnotifierwatcher Qt5::DBus KF5::DBusAddons KF5::CoreAddons) +install(TARGETS statusnotifierwatcher DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kded) diff --git a/statusnotifierwatcher/statusnotifierwatcher.cpp b/statusnotifierwatcher/statusnotifierwatcher.cpp index 3a9fcdc9..0c6f3469 100644 --- a/statusnotifierwatcher/statusnotifierwatcher.cpp +++ b/statusnotifierwatcher/statusnotifierwatcher.cpp @@ -1,137 +1,137 @@ /*************************************************************************** * Copyright 2009 by Marco Martin * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, 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 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 "statusnotifierwatcher.h" #include #include #include #include #include "statusnotifierwatcheradaptor.h" #include "statusnotifieritem_interface.h" -K_PLUGIN_FACTORY(StatusNotifierWatcherFactory, - registerPlugin(); - ) +K_PLUGIN_FACTORY_WITH_JSON(StatusNotifierWatcherFactory, + "statusnotifierwatcher.json", + registerPlugin();) StatusNotifierWatcher::StatusNotifierWatcher(QObject *parent, const QList&) : KDEDModule(parent) { setModuleName("StatusNotifierWatcher"); new StatusNotifierWatcherAdaptor(this); QDBusConnection dbus = QDBusConnection::sessionBus(); dbus.registerService("org.kde.StatusNotifierWatcher"); dbus.registerObject("/StatusNotifierWatcher", this); m_serviceWatcher = new QDBusServiceWatcher(this); m_serviceWatcher->setConnection(dbus); m_serviceWatcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration); connect(m_serviceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, &StatusNotifierWatcher::serviceUnregistered); } StatusNotifierWatcher::~StatusNotifierWatcher() { QDBusConnection dbus = QDBusConnection::sessionBus(); dbus.unregisterService("org.kde.StatusNotifierWatcher"); } void StatusNotifierWatcher::RegisterStatusNotifierItem(const QString &serviceOrPath) { QString service; QString path; if (serviceOrPath.startsWith('/')) { service = message().service(); path = serviceOrPath; } else { service = serviceOrPath; path = "/StatusNotifierItem"; } QString notifierItemId = service + path; if (QDBusConnection::sessionBus().interface()->isServiceRegistered(service).value() && !m_registeredServices.contains(notifierItemId)) { qDebug()<<"Registering" << notifierItemId << "to system tray"; //check if the service has registered a SystemTray object org::kde::StatusNotifierItem trayclient(service, path, QDBusConnection::sessionBus()); if (trayclient.isValid()) { m_registeredServices.append(notifierItemId); m_serviceWatcher->addWatchedService(service); emit StatusNotifierItemRegistered(notifierItemId); } } } QStringList StatusNotifierWatcher::RegisteredStatusNotifierItems() const { return m_registeredServices; } void StatusNotifierWatcher::serviceUnregistered(const QString& name) { qDebug()<<"Service "<< name << "unregistered"; m_serviceWatcher->removeWatchedService(name); QString match = name + '/'; QStringList::Iterator it = m_registeredServices.begin(); while (it != m_registeredServices.end()) { if (it->startsWith(match)) { QString name = *it; it = m_registeredServices.erase(it); emit StatusNotifierItemUnregistered(name); } else { ++it; } } if (m_statusNotifierHostServices.contains(name)) { m_statusNotifierHostServices.remove(name); emit StatusNotifierHostUnregistered(); } } void StatusNotifierWatcher::RegisterStatusNotifierHost(const QString &service) { if (service.contains("org.kde.StatusNotifierHost-") && QDBusConnection::sessionBus().interface()->isServiceRegistered(service).value() && !m_statusNotifierHostServices.contains(service)) { qDebug()<<"Registering"<addWatchedService(service); emit StatusNotifierHostRegistered(); } } bool StatusNotifierWatcher::IsStatusNotifierHostRegistered() const { return !m_statusNotifierHostServices.isEmpty(); } int StatusNotifierWatcher::ProtocolVersion() const { return 0; } #include "statusnotifierwatcher.moc" diff --git a/systemmonitor/CMakeLists.txt b/systemmonitor/CMakeLists.txt index ab189f8c..ecfdfbd2 100644 --- a/systemmonitor/CMakeLists.txt +++ b/systemmonitor/CMakeLists.txt @@ -1,34 +1,34 @@ add_definitions(-DTRANSLATION_DOMAIN=\"systemmonitor\") set (KDED_KSYSGUARD_SRCS kdedksysguard.cpp ) -add_library(kded_ksysguard MODULE ${KDED_KSYSGUARD_SRCS}) +add_library(ksysguard MODULE ${KDED_KSYSGUARD_SRCS}) +kcoreaddons_desktop_to_json(ksysguard ksysguard.desktop) -target_link_libraries(kded_ksysguard +target_link_libraries(ksysguard KF5::ProcessCore KF5::ProcessUi KF5::DBusAddons KF5::I18n KF5::XmlGui KF5::GlobalAccel ) -install(TARGETS kded_ksysguard DESTINATION ${KDE_INSTALL_PLUGINDIR}) -install(FILES ksysguard.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kded) +install(TARGETS ksysguard DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kded) add_executable(systemmonitor ksystemactivitydialog.cpp main.cpp) target_link_libraries(systemmonitor KF5::ProcessCore KF5::ProcessUi KF5::DBusAddons KF5::ConfigCore KF5::I18n KF5::XmlGui KF5::GlobalAccel KF5::WindowSystem ) install(TARGETS systemmonitor DESTINATION ${KDE_INSTALL_BINDIR}) diff --git a/systemmonitor/kdedksysguard.cpp b/systemmonitor/kdedksysguard.cpp index 83b68769..7f867dee 100644 --- a/systemmonitor/kdedksysguard.cpp +++ b/systemmonitor/kdedksysguard.cpp @@ -1,76 +1,78 @@ /* * Copyright (C) 2014 Vishesh Handa * Copyright (C) 2006 Aaron Seigo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License version 2 as * published by the Free Software Foundation * * 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 "kdedksysguard.h" #include #include #include #include #include #include #include #include #include #include #include -K_PLUGIN_FACTORY(KSysGuardFactory, registerPlugin();) +K_PLUGIN_FACTORY_WITH_JSON(KSysGuardFactory, + "ksysguard.json", + registerPlugin();) KDEDKSysGuard::KDEDKSysGuard(QObject* parent, const QVariantList&) { QTimer::singleShot(0, this, SLOT(init())); } KDEDKSysGuard::~KDEDKSysGuard() { } void KDEDKSysGuard::init() { KActionCollection* actionCollection = new KActionCollection(this); QAction* action = actionCollection->addAction(QLatin1String("Show System Activity")); action->setText(i18n("Show System Activity")); connect(action, &QAction::triggered, this, &KDEDKSysGuard::showTaskManager); KGlobalAccel::self()->setGlobalShortcut(action, QKeySequence(Qt::CTRL + Qt::Key_Escape)); } void KDEDKSysGuard::showTaskManager() { QDBusConnection con = QDBusConnection::sessionBus(); QDBusConnectionInterface* interface = con.interface(); if (interface->isServiceRegistered("org.kde.systemmonitor")) { QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.systemmonitor"), QStringLiteral("/"), QStringLiteral("org.qtproject.Qt.QWidget"), QStringLiteral("close")); con.asyncCall(msg); } else { QString exe = QStandardPaths::findExecutable("systemmonitor"); QProcess::startDetached(exe); } } #include "kdedksysguard.moc"