From 1fb5e677626e4a74a10bccc25ebc8d46449e2e05 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Wed, 14 Jul 2021 17:27:30 +0300 Subject: [PATCH] generic: remove appmenu support Signed-off-by: Ivailo Monev --- CMakeLists.txt | 1 - appmenu/CMakeLists.txt | 67 --- appmenu/appmenu.cpp | 399 ------------------ appmenu/appmenu.desktop | 96 ----- appmenu/appmenu.h | 154 ------- appmenu/appmenu_dbus.cpp | 69 --- appmenu/appmenu_dbus.h | 100 ----- appmenu/com.canonical.AppMenu.Registrar.xml | 56 --- appmenu/glowbar.cpp | 107 ----- appmenu/glowbar.h | 51 --- appmenu/gtkicons.h | 146 ------- appmenu/kdbusimporter.h | 75 ---- appmenu/menubar.cpp | 166 -------- appmenu/menubar.h | 87 ---- appmenu/menubutton.cpp | 85 ---- appmenu/menubutton.h | 54 --- appmenu/menuimporter.cpp | 224 ---------- appmenu/menuimporter.h | 98 ----- appmenu/menuwidget.cpp | 387 ----------------- appmenu/menuwidget.h | 143 ------- appmenu/org.kde.kded.appmenu.xml | 31 -- appmenu/shadows.cpp | 381 ----------------- appmenu/shadows.h | 51 --- appmenu/topmenubar.cpp | 176 -------- appmenu/topmenubar.h | 81 ---- appmenu/verticalmenu.cpp | 79 ---- appmenu/verticalmenu.h | 56 --- kcontrol/style/finetuning.ui | 129 ++---- kcontrol/style/kcmstyle.cpp | 103 ----- kcontrol/style/kcmstyle.h | 2 - kwin/CMakeLists.txt | 13 - kwin/appmenu.cpp | 97 ----- kwin/appmenu.h | 60 --- kwin/bridge.cpp | 16 - kwin/bridge.h | 2 - kwin/client.cpp | 31 -- kwin/client.h | 36 -- kwin/clients/aurorae/src/CMakeLists.txt | 2 - kwin/clients/aurorae/src/aurorae.cpp | 8 - kwin/clients/aurorae/src/aurorae.h | 3 - kwin/clients/aurorae/src/lib/auroraetheme.cpp | 3 - kwin/clients/aurorae/src/lib/auroraetheme.h | 5 +- kwin/clients/aurorae/src/lib/themeconfig.cpp | 2 - kwin/clients/aurorae/src/lib/themeconfig.h | 7 - .../clients/aurorae/src/qml/AppMenuButton.qml | 28 -- .../clients/aurorae/src/qml/AuroraeButton.qml | 3 - .../aurorae/src/qml/AuroraeButtonGroup.qml | 3 - kwin/clients/aurorae/src/qml/ButtonGroup.qml | 4 - .../aurorae/src/qml/DecorationButton.qml | 4 - kwin/clients/aurorae/src/qml/qmldir | 1 - .../themes/plastik/code/plastikbutton.cpp | 9 - .../themes/plastik/code/plastikbutton.h | 1 - .../package/contents/ui/PlastikButton.qml | 8 - .../plastik/package/contents/ui/main.qml | 9 - kwin/clients/oxygen/oxygenbutton.cpp | 109 +++-- kwin/clients/oxygen/oxygenbutton.h | 3 - kwin/clients/oxygen/oxygenclient.cpp | 3 - kwin/clients/oxygen/oxygendecorationdefines.h | 1 - kwin/clients/oxygen/oxygenfactory.cpp | 1 - kwin/config-kwin.h.cmake | 1 - kwin/kcmkwin/kwindecoration/buttons.cpp | 21 - kwin/kcmkwin/kwindecoration/preview.cpp | 9 - kwin/kcmkwin/kwindecoration/preview.h | 2 - .../kwindecoration/qml/AuroraeDecoration.qml | 1 - kwin/libkdecorations/kcommondecoration.cpp | 61 +-- kwin/libkdecorations/kcommondecoration.h | 5 +- kwin/libkdecorations/kdecoration.cpp | 10 - kwin/libkdecorations/kdecoration.h | 40 +- kwin/libkdecorations/kdecorationbridge.h | 2 - kwin/workspace.cpp | 11 - 70 files changed, 93 insertions(+), 4196 deletions(-) delete mode 100644 appmenu/CMakeLists.txt delete mode 100644 appmenu/appmenu.cpp delete mode 100644 appmenu/appmenu.desktop delete mode 100644 appmenu/appmenu.h delete mode 100644 appmenu/appmenu_dbus.cpp delete mode 100644 appmenu/appmenu_dbus.h delete mode 100644 appmenu/com.canonical.AppMenu.Registrar.xml delete mode 100644 appmenu/glowbar.cpp delete mode 100644 appmenu/glowbar.h delete mode 100644 appmenu/gtkicons.h delete mode 100644 appmenu/kdbusimporter.h delete mode 100644 appmenu/menubar.cpp delete mode 100644 appmenu/menubar.h delete mode 100644 appmenu/menubutton.cpp delete mode 100644 appmenu/menubutton.h delete mode 100644 appmenu/menuimporter.cpp delete mode 100644 appmenu/menuimporter.h delete mode 100644 appmenu/menuwidget.cpp delete mode 100644 appmenu/menuwidget.h delete mode 100644 appmenu/org.kde.kded.appmenu.xml delete mode 100644 appmenu/shadows.cpp delete mode 100644 appmenu/shadows.h delete mode 100644 appmenu/topmenubar.cpp delete mode 100644 appmenu/topmenubar.h delete mode 100644 appmenu/verticalmenu.cpp delete mode 100644 appmenu/verticalmenu.h delete mode 100644 kwin/appmenu.cpp delete mode 100644 kwin/appmenu.h delete mode 100644 kwin/clients/aurorae/src/qml/AppMenuButton.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index d82611a1..e186209d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -337,7 +337,6 @@ endif(Q_WS_X11 AND X11_Xinput_FOUND) add_subdirectory(kcminit) add_subdirectory(khotkeys) add_subdirectory(ksystraycmd) -add_subdirectory(appmenu) if(X11_Xau_FOUND AND X11_Xdmcp_FOUND) add_subdirectory( kdm ) diff --git a/appmenu/CMakeLists.txt b/appmenu/CMakeLists.txt deleted file mode 100644 index 6a0b8f7f..00000000 --- a/appmenu/CMakeLists.txt +++ /dev/null @@ -1,67 +0,0 @@ -include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) - -set(kded_appmenu_SRCS - menubutton.cpp - menuwidget.cpp - menubar.cpp - topmenubar.cpp - glowbar.cpp - verticalmenu.cpp - shadows.cpp -) - -if(DBUSMENUEQT_FOUND) - set(kded_appmenu_SRCS - ${kded_appmenu_SRCS} - appmenu.cpp - appmenu_dbus.cpp - menuimporter.cpp - ) - - qt4_add_dbus_adaptor(kded_appmenu_SRCS - com.canonical.AppMenu.Registrar.xml - menuimporter.h - MenuImporter - menuimporteradaptor - MenuImporterAdaptor - ) - - qt4_add_dbus_adaptor(kded_appmenu_SRCS - org.kde.kded.appmenu.xml - appmenu_dbus.h - AppmenuDBus - appmenuadaptor - AppmenuAdaptor - ) -endif() - -kde4_add_plugin(kded_appmenu ${kded_appmenu_SRCS}) - -target_link_libraries(kded_appmenu - ${KDE4_KIO_LIBS} - ${X11_LIBRARIES} - ${KDE4_PLASMA_LIBS} -) - -if(DBUSMENUQT_FOUND) - target_link_libraries(kded_appmenu ${DBUSMENUQT_LIBRARIES}) - include_directories(${DBUSMENUQT_INCLUDE_DIR}) -endif() - -install( - TARGETS kded_appmenu - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) - -########### install files ############### - -install( - FILES appmenu.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kded -) -install( - FILES - com.canonical.AppMenu.Registrar.xml - org.kde.kded.appmenu.xml - DESTINATION ${KDE4_DBUS_INTERFACES_INSTALL_DIR} -) diff --git a/appmenu/appmenu.cpp b/appmenu/appmenu.cpp deleted file mode 100644 index 3d155ee2..00000000 --- a/appmenu/appmenu.cpp +++ /dev/null @@ -1,399 +0,0 @@ -/* - 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" -#include "topmenubar.h" -#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")) - -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 = KWindowSystem::windowInfo(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 (m_menubar && m_menubar->parentWid() == id) { - hideMenubar(); - } -} - -// Keyboard activation requested, transmit it to menu -void AppMenuModule::slotActionActivationRequested(QAction* a) -{ - // If we have a topmenubar, activate action - if (m_menubar) { - m_menubar->setActiveAction(a); - m_menubar->show(); - } else { // 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 = KWindowSystem::windowInfo(id, NET::WMWindowType); - unsigned long 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; - } - - QMenu *menu = importer->menu(); - - if(menu) { - showMenuBar(menu); - m_menubar->setParentWid(id); - } else { - hideMenubar(); - } -} - -void AppMenuModule::slotShowCurrentWindowMenu() -{ - slotActiveWindowChanged(KWindowSystem::self()->activeWindow()); -} - -void AppMenuModule::slotCurrentScreenChanged() -{ - if (m_currentScreen != currentScreen()) { - if (m_menubar) { - m_menubar->setParentWid(0); - } - slotActiveWindowChanged(KWindowSystem::self()->activeWindow()); - } -} - -void AppMenuModule::slotBarNeedResize() -{ - if (m_menubar) { - m_menubar->updateSize(); - m_menubar->move(centeredMenubarPos()); - } -} - -// 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") { - 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(); - } -} - -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 (!menu) { - return; - } - - m_menubar->setMenu(menu); - if (menu->actions().length()) { - m_menubar->enableMouseTracking(); - } -} - -void AppMenuModule::hideMenubar() -{ - if (!m_menubar) { - return; - } - - m_menubar->enableMouseTracking(false); - if (m_menubar->isVisible()) { - m_menubar->hide(); - } -} - -int AppMenuModule::currentScreen() -{ - KWindowInfo info = KWindowSystem::windowInfo(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); - int x = screen.center().x() - m_menubar->sizeHint().width()/2; - return QPoint(x, screen.topLeft().y()); -} - - -#include "moc_appmenu.cpp" diff --git a/appmenu/appmenu.desktop b/appmenu/appmenu.desktop deleted file mode 100644 index 242c5feb..00000000 --- a/appmenu/appmenu.desktop +++ /dev/null @@ -1,96 +0,0 @@ -[Desktop Entry] -Type=Service -Name=Application menus daemon -Name[bs]=Demon za aplikacijske menije -Name[ca]=Dimoni de menús d'aplicació -Name[ca@valencia]=Dimoni de menús d'aplicació -Name[cs]=Démon nabídky aplikací -Name[da]=Dæmon til programmenuer -Name[de]=Dienst für Anwendungsmenüs -Name[el]=Δαίμων για τα μενού των εφαρμογών -Name[en_GB]=Application menus daemon -Name[es]=Demonio de menús de aplicación -Name[et]=Rakenduste menüü deemon -Name[eu]=Aplikazio-menuen daimona -Name[fi]=Sovellusvalikkopalvelu -Name[fr]=Démon de menus des applications -Name[gl]=Daemon de menús do programa -Name[he]=תהליך רקע של תפריט היישומים -Name[hu]=Alkalmazás menük démon -Name[ia]=Demone de menus de application -Name[it]=Demone dei menu delle applicazioni -Name[kk]=Қолданба мәзірінің қызметі -Name[ko]=프로그램 메뉴 데몬 -Name[lt]=Programos meniu tarnyba -Name[mr]=अनुप्रयोग मेन्यू डीमन -Name[nb]=Daemon for programmenyer -Name[nds]=Programmmenü-Dämoon -Name[nl]=Daemon voor menu van toepassingen -Name[pa]=ਐਪਲੀਕੇਸ਼ਨ ਮੈਨੂ ਡੈਮਨ -Name[pl]=Demon menu programów -Name[pt]=Servidor dos menus da aplicação -Name[pt_BR]=Servidor dos menus do aplicativo -Name[ro]=Demon pentru meniurile aplicațiilor -Name[ru]=Фоновая служба меню приложений -Name[sk]=Démon ponúk aplikácie -Name[sl]=Ozadnji program za programske menije -Name[sr]=Демон програмских менија -Name[sr@ijekavian]=Демон програмских менија -Name[sr@ijekavianlatin]=Demon programskih menija -Name[sr@latin]=Demon programskih menija -Name[sv]=Demon för programmenyer -Name[tr]=Uygulama menü araçları -Name[uk]=Фонова служба меню програм -Name[x-test]=xxApplication menus daemonxx -Name[zh_CN]=应用程序菜单守护程序 -Name[zh_TW]=應用程式選單伺服程式應用程式選單伺服程式 -Comment=Transfers application's menu to the desktop -Comment[bs]=Prebacuje aplikacijski meni na radnu površinu -Comment[ca]=Transfereix els menús d'aplicació a l'escriptori -Comment[ca@valencia]=Transfereix els menús d'aplicació a l'escriptori -Comment[cs]=Přesouvá nabídku aplikací na plochu -Comment[da]=Overfører programmets menu til skrivebordet -Comment[de]=Überträgt Anwendungsmenüs auf die Arbeitsfläche -Comment[el]=Μεταφέρει το μενού της εφαρμογής στην επιφάνεια εργασίας -Comment[en_GB]=Transfers application's menu to the desktop -Comment[es]=Transfiere el menú de aplicaciones al escritorio -Comment[et]=Rakenduste menüü paigutamine töölauale -Comment[eu]=Aplikazioen menua mahaigainera transferitzen du -Comment[fi]=Siirtää sovelluksen valikon työpöydälle -Comment[fr]=Transfère le menu des applications sur le bureau -Comment[gl]=Transfire o menú do programa ao escritorio -Comment[he]=מעביר את התפריטים של היישום אל שולחן העבודה -Comment[hu]=Átviszi az alkalmazás menüjét az asztalra -Comment[ia]=Il transfere menu de applicationes al scriptorio -Comment[it]=Trasferisce al desktop i menu delle applicazioni -Comment[kk]=Қолданбаның мәзірін үстел бетіне тапсыру -Comment[ko]=프로그램 메뉴를 데스크톱으로 보내기 -Comment[lt]=Perkelia programos meniu į darbastalį -Comment[mr]=अनुप्रयोग मेन्यूचे डेस्कटॉपवर स्थानान्तरण -Comment[nb]=Overfører programmets meny til skrivebordet -Comment[nds]=Dat Programmmenü na den Schriefdisch överdregen -Comment[nl]=Brengt het menu van de toepassing over naar het bureaublad -Comment[pa]=ਐਪਲੀਕੇਸ਼ਨ ਦੇ ਮੇਨੂ ਨੂੰ ਡੈਸਕਟਾਪ ਉੱਤੇ ਭੇਜੋ -Comment[pl]=Przenosi menu aplikacji na pulpit -Comment[pt]=Transfere o menu da aplicação para o ecrã -Comment[pt_BR]=Transfere o menu do aplicativo para a área de trabalho -Comment[ro]=Transferă meniul aplicațiilor către birou -Comment[ru]=Перемещает меню приложения на рабочий стол -Comment[sk]=Presunúť ponuky aplikácie na plochu -Comment[sl]=Prenese programski meni na namizje -Comment[sr]=Пребацује меније програма на површ -Comment[sr@ijekavian]=Пребацује меније програма на површ -Comment[sr@ijekavianlatin]=Prebacuje menije programa na površ -Comment[sr@latin]=Prebacuje menije programa na površ -Comment[sv]=Överför programmets meny till skrivbordet -Comment[tr]=Uygulamanın menüsünü masaüstüne aktarır -Comment[uk]=Передає меню програм на стільницю -Comment[x-test]=xxTransfers application's menu to the desktopxx -Comment[zh_CN]=将应用程序的菜单转移到桌面上 -Comment[zh_TW]=將應用程式選單傳送到桌面 -X-KDE-ServiceTypes=KDEDModule -X-KDE-Library=appmenu -X-KDE-DBus-ModuleName=appmenu -X-KDE-Kded-autoload=true -X-KDE-Kded-load-on-demand=false - diff --git a/appmenu/appmenu.h b/appmenu/appmenu.h deleted file mode 100644 index 7095ea14..00000000 --- a/appmenu/appmenu.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - 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. -*/ - -#ifndef APPMENUMODULE_H -#define APPMENUMODULE_H - -#include -#include "menuimporter.h" -#include "gtkicons.h" - -#include -class KDBusMenuImporter; -class AppmenuDBus; -class TopMenuBar; -class VerticalMenu; - -class AppMenuModule : public KDEDModule, - protected QDBusContext -{ - Q_OBJECT -public: - AppMenuModule(QObject* parent, const QList& list); - virtual ~AppMenuModule(); - -Q_SIGNALS: - /** - * We do not know where is menu decoration button, so tell kwin to show menu - */ - void showRequest(qulonglong); - /** - * This signal is emitted whenever application menu becomes available - */ - void menuAvailable(qulonglong); - /** - * This signal is emitted whenever menus are unavailables - */ - void clearMenus(); - /** - * This signal is emitted whenever popup menu/menubar is hidden - * Useful for decorations to know if menu button should be release - */ - void menuHidden(qulonglong); - /** - * This signal is emitted whenever a window register to appmenu - */ - void WindowRegistered(qulonglong wid, const QString& service, const QDBusObjectPath&); - /** - * This signal is emitted whenever a window unregister from appmenu - */ - void WindowUnregistered(qulonglong wid); - -private Q_SLOTS: - /** - * Show menu at QPoint(x,y) for id - * if x or y == -1, show in application window - */ - void slotShowMenu(int x, int y, WId); - /** - * Send menuHidden signal over bus when menu is about to hide - */ - void slotAboutToHide(); - /** - * New window registered to appmenu - * Emit WindowRegistered signal over bus - */ - void slotWindowRegistered(WId id, const QString& service, const QDBusObjectPath& path); - /** - * Window unregistered from appmenu - * Emit WindowUnregistered signal over bus - */ - void slotWindowUnregistered(WId id); - /** - * Open a action in current menu - */ - void slotActionActivationRequested(QAction* a); - /** - * Active window changed, show menubar for id - */ - void slotActiveWindowChanged(WId id); - /** - * Update menubar with current window menu - */ - void slotShowCurrentWindowMenu(); - /** - * Current screen changed, update menubar - */ - void slotCurrentScreenChanged(); - /** - * Resize menubar - */ - void slotBarNeedResize(); - /** - * Reconfigure module - */ - void reconfigure(); - -private: - /** - * return an importer for window id - */ - KDBusMenuImporter* getImporter(WId id); - /** - * Show menubar and update it with menu - */ - void showMenuBar(QMenu *menu); - /** - * Hide menubar - */ - void hideMenubar(); - /** - * Return current screen - */ - int currentScreen(); - /** - * Return position of menubar for being centered on screen - */ - QPoint centeredMenubarPos(); - - QObject* m_parent; - MenuImporter* m_menuImporter; - AppmenuDBus* m_appmenuDBus; - QHash m_importers; - GtkIcons m_icons; - QString m_menuStyle; - TopMenuBar* m_menubar; - VerticalMenu* m_menu; - QTimer* m_screenTimer; - QAction *m_waitingAction; - int m_currentScreen; -}; - -#endif diff --git a/appmenu/appmenu_dbus.cpp b/appmenu/appmenu_dbus.cpp deleted file mode 100644 index aef25a39..00000000 --- a/appmenu/appmenu_dbus.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - 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_dbus.h" -#include "kdbusimporter.h" -#include "appmenuadaptor.h" - -#include -#include -#include -#include - -static const char* DBUS_SERVICE = "org.kde.kded"; -static const char* DBUS_OBJECT_PATH = "/modules/appmenu"; - -AppmenuDBus::AppmenuDBus(QObject* parent) -: QObject(parent) -{ -} - -AppmenuDBus::~AppmenuDBus() -{ -} - -bool AppmenuDBus::connectToBus(const QString& service, const QString& path) -{ - m_service = service.isEmpty() ? DBUS_SERVICE : service; - QString newPath = path.isEmpty() ? DBUS_OBJECT_PATH : path; - - if (!QDBusConnection::sessionBus().registerService(m_service)) { - return false; - } - new AppmenuAdaptor(this); - QDBusConnection::sessionBus().registerObject(newPath, this); - - return true; -} - -void AppmenuDBus::showMenu(int x, int y, WId id) -{ - emit appShowMenu(x, y, id); -} - -void AppmenuDBus::reconfigure() -{ - emit moduleReconfigure(); -} \ No newline at end of file diff --git a/appmenu/appmenu_dbus.h b/appmenu/appmenu_dbus.h deleted file mode 100644 index c14373da..00000000 --- a/appmenu/appmenu_dbus.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - 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. -*/ - -#ifndef APPMENU_DBUS_H -#define APPMENU_DBUS_H - -// Qt -#include -#include -#include -#include -#include - -class KDBusMenuImporter; - -class AppmenuDBus : public QObject, protected QDBusContext -{ - Q_OBJECT - -public: - AppmenuDBus(QObject*); - ~AppmenuDBus(); - - bool connectToBus(const QString& service = QString(), const QString& path = QString()); - - /** - * DBus method showing menu at QPoint(x,y) for id - * if x or y == -1, show in application window - */ - void showMenu(int x, int y, WId id); - /** - * DBus method reconfiguring kded module - */ - void reconfigure(); - -Q_SIGNALS: - /** - * This signal is emitted on showMenu() request - */ - void appShowMenu(int x, int y, WId id); - /** - * This signal is emitted on reconfigure() request - */ - void moduleReconfigure(); - - // Dbus signals - /** - * This signal is emitted whenever kded want to show menu - * We do not know where is menu decoration button, so tell kwin to show menu - */ - void showRequest(qulonglong); - /** - * This signal is emitted whenever application menu becomes available - */ - void menuAvailable(qulonglong); - /** - * This signal is emitted whenever menus are unavailables - */ - void clearMenus(); - /** - * This signal is emitted whenever popup menu/menubar is hidden - * Useful for decorations to know if menu button should be release - */ - void menuHidden(qulonglong); - /** - * This signal is emitted whenever a window register to appmenu - */ - void WindowRegistered(qulonglong wid, const QString& service, const QDBusObjectPath&); - /** - * This signal is emitted whenever a window unregister from appmenu - */ - void WindowUnregistered(qulonglong wid); - -private: - QString m_service; -}; - -#endif // APPMENU_DBUS_H diff --git a/appmenu/com.canonical.AppMenu.Registrar.xml b/appmenu/com.canonical.AppMenu.Registrar.xml deleted file mode 100644 index bc2be43c..00000000 --- a/appmenu/com.canonical.AppMenu.Registrar.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - An interface to register a menu from an application's window to be displayed in another - window.  This manages that association between XWindow Window IDs and the dbus - address and object that provides the menu using the dbusmenu dbus interface. - - - - - The XWindow ID of the window - - - The object on the dbus interface implementing the dbusmenu interface - - - - - A method to allow removing a window from the database. Windows will also be removed - when the client drops off DBus so this is not required. It is polite though. And - important for testing. - - - The XWindow ID of the window - - - - Gets the registered menu for a given window ID. - - The XWindow ID of the window to get - - - The address of the connection on DBus (e.g. :1.23 or org.example.service) - - - The path to the object which implements the com.canonical.dbusmenu interface. - - - - diff --git a/appmenu/glowbar.cpp b/appmenu/glowbar.cpp deleted file mode 100644 index c3e77905..00000000 --- a/appmenu/glowbar.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - 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 "glowbar.h" - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - - -GlowBar::GlowBar() - : QWidget(0), - m_svg(new Plasma::Svg(this)) -{ - m_svg->setImagePath("widgets/glowbar"); - - setWindowFlags(Qt::Tool | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint); - setAttribute(Qt::WA_TranslucentBackground); - setAutoFillBackground(false); - KWindowSystem::setType(winId(), NET::Dock); - - QPalette pal = palette(); - pal.setColor(backgroundRole(), Qt::transparent); - setPalette(pal); - - setInputMask(); -} - -GlowBar::~GlowBar() -{ -} - -void GlowBar::paintEvent(QPaintEvent*) -{ - QPixmap l, r, c; - QPoint pixmapPosition(0, 0); - - m_buffer.fill(QColor(0, 0, 0, int(qreal(255)*0.3))); - QPainter p(&m_buffer); - p.setCompositionMode(QPainter::CompositionMode_SourceIn); - l = m_svg->pixmap("bottomleft"); - r = m_svg->pixmap("bottomright"); - c = m_svg->pixmap("bottom"); - p.drawPixmap(pixmapPosition, l); - p.drawTiledPixmap(QRect(l.width(), pixmapPosition.y(), width() - l.width() - r.width(), c.height()), c); - p.drawPixmap(QPoint(width() - r.width(), pixmapPosition.y()), r); - p.end(); - p.begin(this); - p.drawPixmap(QPoint(0, 0), m_buffer); -} - -void GlowBar::setPixmap(const QPoint pos, uint width) -{ - QRect zone = QRect(pos, QSize(width, 10)); - setGeometry(zone); - m_buffer = QPixmap(zone.size()); -} - -void GlowBar::setInputMask() -{ - // Create an empty input mask to achieve click-through effect - // Thanks to MacSlow for this! - Pixmap mask = XCreatePixmap(QX11Info::display(), - winId(), - 1, /* width */ - 1, /* height */ - 1 /* depth */); - XShapeCombineMask(QX11Info::display(), - winId(), - ShapeInput, - 0, /* x-offset */ - 0, /* y-offset */ - mask, - ShapeSet); - XFreePixmap(QX11Info::display(), mask); -} -#include "moc_glowbar.cpp" diff --git a/appmenu/glowbar.h b/appmenu/glowbar.h deleted file mode 100644 index 5a51beb9..00000000 --- a/appmenu/glowbar.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - 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. -*/ - -#ifndef GLOWBAR__H -#define GLOWBAR__H - -#include - -namespace Plasma -{ - class Svg; -} - -class GlowBar : public QWidget -{ -Q_OBJECT -public: - GlowBar(); - ~GlowBar(); - - void paintEvent(QPaintEvent*); - - void setPixmap(const QPoint pos, uint width); -private: - void setInputMask(); - Plasma::Svg *m_svg; - QPixmap m_buffer; -}; -#endif diff --git a/appmenu/gtkicons.h b/appmenu/gtkicons.h deleted file mode 100644 index d11d73de..00000000 --- a/appmenu/gtkicons.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - 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. -*/ - -#ifndef GTKICONS_H -#define GTKICONS_H - -#include - -class GtkIcons : public QMap -{ - public: - GtkIcons( void ) : QMap () - { - insert(QString("gnome-fs-directory"), QString("folder.png")); - insert(QString("gnome-fs-regular.png"), QString("application-x-zerosize.png")); - insert(QString("gtk-about"), QString("help-about.png")); - insert(QString("gtk-add"), QString("list-add.png")); - insert(QString("gtk-apply"), QString("dialog-ok-apply.png ok-apply.png apply.png")); - insert(QString("gtk-bold"), QString("format-text-bold.png")); - insert(QString("gtk-cancel"), QString("dialog-cancel.png cancel.png")); - insert(QString("gtk-cdrom"), QString("media-optical.png")); - insert(QString("gtk-clear"), QString("edit-clear.png")); - insert(QString("gtk-close"), QString("window-close.png")); - insert(QString("gtk-color-picker"), QString("color-picker.png")); - insert(QString("gtk-connect"), QString("network-connect.png")); - insert(QString("gtk-convert"), QString("document-export.png")); - insert(QString("gtk-copy"), QString("edit-copy.png")); - insert(QString("gtk-cut"), QString("edit-cut.png")); - insert(QString("gtk-delete"), QString("edit-delete.png")); - insert(QString("gtk-dialog-authentication"), QString("dialog-password.png document-encrypt.png object-locked.png")); - insert(QString("gtk-dialog-error"), QString("dialog-error.png")); - insert(QString("gtk-dialog-info"), QString("dialog-information.png")); - insert(QString("gtk-dialog-question"), QString("dialog-information.png")); - insert(QString("gtk-dialog-warning"), QString("dialog-warning.png")); - insert(QString("gtk-directory"), QString("folder.png")); - insert(QString("gtk-disconnect"), QString("network-disconnect.png")); - insert(QString("gtk-dnd"), QString("application-x-zerosize.png")); - insert(QString("gtk-dnd-multiple"), QString("document-multiple.png")); - insert(QString("gtk-edit"), QString("document-properties.png")); - insert(QString("gtk-execute"), QString("fork.png")); - insert(QString("gtk-file"), QString("application-x-zerosize.png")); - insert(QString("gtk-find"), QString("edit-find.png")); - insert(QString("gtk-find-and-replace"), QString("edit-find-replace.png")); - insert(QString("gtk-floppy"), QString("media-floppy.png")); - insert(QString("gtk-fullscreen"), QString("view-fullscreen.png")); - insert(QString("gtk-goto-bottom"), QString("go-bottom.png")); - insert(QString("gtk-goto-first"), QString("go-first.png")); - insert(QString("gtk-goto-last"), QString("go-last.png")); - insert(QString("gtk-goto-top"), QString("go-top.png")); - insert(QString("gtk-go-back"), QString("go-previous.png")); - insert(QString("gtk-go-back-ltr"), QString("go-previous.png")); - insert(QString("gtk-go-back-rtl"), QString("go-next.png")); - insert(QString("gtk-go-down"), QString("go-down.png")); - insert(QString("gtk-go-forward"), QString("go-next.png")); - insert(QString("gtk-go-forward-ltr"), QString("go-next.png")); - insert(QString("gtk-go-forward-rtl"), QString("go-previous.png")); - insert(QString("gtk-go-up"), QString("go-up.png")); - insert(QString("gtk-harddisk"), QString("drive-harddisk.png")); - insert(QString("gtk-help"), QString("help-contents.png")); - insert(QString("gtk-home"), QString("go-home.png")); - insert(QString("gtk-indent"), QString("format-indent-more.png")); - insert(QString("gtk-index"), QString("help-contents.png")); - insert(QString("gtk-info"), QString("help-about.png")); - insert(QString("gtk-italic"), QString("format-text-italic.png")); - insert(QString("gtk-jump-to"), QString("go-jump.png")); - insert(QString("gtk-justify-center"), QString("format-justify-center.png")); - insert(QString("gtk-justify-fill"), QString("format-justify-fill.png")); - insert(QString("gtk-justify-left"), QString("format-justify-left.png")); - insert(QString("gtk-justify-right"), QString("format-justify-right.png")); - insert(QString("gtk-leave-fullscreen"), QString("view-restore.png")); - insert(QString("gtk-media-forward"), QString("media-seek-forward.png")); - insert(QString("gtk-media-next"), QString("media-skip-forward.png")); - insert(QString("gtk-media-pause"), QString("media-playback-pause.png")); - insert(QString("gtk-media-play"), QString("media-playback-start.png")); - insert(QString("gtk-media-previous"), QString("media-skip-backward.png")); - insert(QString("gtk-media-record"), QString("media-record.png")); - insert(QString("gtk-media-rewind"), QString("media-seek-backward.png")); - insert(QString("gtk-media-stop"), QString("media-playback-stop.png")); - insert(QString("gtk-missing-image"), QString("unknown.png")); - insert(QString("gtk-network"), QString("network-server.png")); - insert(QString("gtk-new"), QString("document-new.png")); - insert(QString("gtk-no"), QString("edit-delete.png")); - insert(QString("gtk-ok"), QString("dialog-ok.png ok.png")); - insert(QString("gtk-open"), QString("document-open.png")); - insert(QString("gtk-paste"), QString("edit-paste.png")); - insert(QString("gtk-preferences"), QString("configure.png")); - insert(QString("gtk-print"), QString("document-print.png")); - insert(QString("gtk-print-preview"), QString("document-print-preview.png")); - insert(QString("gtk-properties"), QString("document-properties.png")); - insert(QString("gtk-quit"), QString("application-exit.png")); - insert(QString("gtk-redo"), QString("edit-redo.png")); - insert(QString("gtk-refresh"), QString("view-refresh.png")); - insert(QString("gtk-remove"), QString("edit-delete.png")); - insert(QString("gtk-revert-to-saved"), QString("document-revert.png")); - insert(QString("gtk-save"), QString("document-save.png")); - insert(QString("gtk-save-as"), QString("document-save-as.png")); - insert(QString("gtk-select-all"), QString("edit-select-all.png")); - insert(QString("gtk-select-color"), QString("color-picker.png")); - insert(QString("gtk-select-font"), QString("preferences-desktop-font.png")); - insert(QString("gtk-sort-ascending"), QString("view-sort-ascending.png")); - insert(QString("gtk-sort-descending"), QString("view-sort-descending.png")); - insert(QString("gtk-spell-check"), QString("tools-check-spelling.png")); - insert(QString("gtk-stop"), QString("process-stop.png")); - insert(QString("gtk-strikethrough"), QString("format-text-strikethrough.png")); - insert(QString("gtk-undelete"), QString("edit-undo.png")); - insert(QString("gtk-underline"), QString("format-text-underline.png")); - insert(QString("gtk-undo"), QString("edit-undo.png")); - insert(QString("gtk-unindent"), QString("format-indent-less.png")); - insert(QString("gtk-yes"), QString("dialog-ok.png ok.png")); - insert(QString("gtk-zoom-100"), QString("zoom-original.png")); - insert(QString("gtk-zoom-fit"), QString("zoom-fit-best.png")); - insert(QString("gtk-zoom-in"), QString("zoom-in.png")); - insert(QString("gtk-zoom-out"), QString("zoom-out.png")); - insert(QString("stock_edit-bookmark"), QString("bookmarks-organize.png")); - insert(QString("gimp-edit"), QString("edit.png")); - insert(QString("gimp-info"), QString("dialog-information.png")); - insert(QString("gimp-reset"), QString("reload.png")); - insert(QString("gimp-warning"), QString("dialog-warning.png")); - insert(QString("gimp-tool-options"), QString("tool.png")); - insert(QString("gimp-images"), QString("image.png")); - } -}; - -#endif // GTKICONS_H \ No newline at end of file diff --git a/appmenu/kdbusimporter.h b/appmenu/kdbusimporter.h deleted file mode 100644 index 986783b7..00000000 --- a/appmenu/kdbusimporter.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - 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. -*/ - -#ifndef KDBUSMENUIMPORTER_H -#define KDBUSMENUIMPORTER_H - -#include "gtkicons.h" - -#include -#include - -#include - -#include - -class KDBusMenuImporter : public DBusMenuImporter -{ - -public: - KDBusMenuImporter(WId wid, const QString &service, GtkIcons *icons, const QString &path, QObject *parent) - : DBusMenuImporter(service, path, parent) - , m_service(service) - , m_path(path) - , m_WId(wid) - { - m_icons = icons; - } - - QString service() const { return m_service; } - QString path() const { return m_path; } - WId wid() const { return m_WId; } - -protected: - virtual QIcon iconForName(const QString &name) - { - KIcon icon; - if(m_icons->contains(name)){ - icon = KIcon(m_icons->value(name)); - } - else if(!KIconLoader::global()->iconPath(name, 1, true ).isNull()){ - icon = KIcon(name); - } - return icon; - } - -private: - GtkIcons *m_icons; - QString m_service; - QString m_path; - WId m_WId; -}; - -#endif //KDBUSMENUIMPORTER_H \ No newline at end of file diff --git a/appmenu/menubar.cpp b/appmenu/menubar.cpp deleted file mode 100644 index 7bc72f9a..00000000 --- a/appmenu/menubar.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - 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 "menubar.h" -#include "shadows.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -MenuBar::MenuBar() - : QGraphicsView(), - m_hideTimer(new QTimer(this)), - m_background(new Plasma::FrameSvg(this)), - m_shadows(new Shadows(this)), - m_scene(new QGraphicsScene(this)), - m_container(new MenuWidget(this)) -{ - qreal left, top, right, bottom; - - //Setup the window properties - setWindowFlags(Qt::Tool|Qt::X11BypassWindowManagerHint|Qt::WindowStaysOnTopHint); - setAttribute(Qt::WA_TranslucentBackground); - KWindowSystem::setType(winId(), NET::Dock); - setFrameStyle(QFrame::NoFrame); - viewport()->setAutoFillBackground(false); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - - //Setup the widgets - m_background->setImagePath("widgets/tooltip"); - m_background->setEnabledBorders(Plasma::FrameSvg::BottomBorder|Plasma::FrameSvg::LeftBorder|Plasma::FrameSvg::RightBorder); - - m_container->initLayout(); - - m_scene->addItem(m_container); - - setScene(m_scene); - - m_background->getMargins(left, top, right, bottom); - m_container->layout()->setContentsMargins(left, top, right, bottom); - - resize(sizeHint()); - - connect(m_container, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHide())); - connect(m_container, SIGNAL(needResize()), this, SIGNAL(needResize())); - connect(m_hideTimer, SIGNAL(timeout()), this, SLOT(slotAboutToHide())); - - connect(KWindowSystem::self(), SIGNAL(compositingChanged(bool)), this, SLOT(slotCompositingChanged(bool))); -} - -MenuBar::~MenuBar() -{ -} - -QSize MenuBar::sizeHint() const -{ - QSizeF size = m_container->minimumSize(); - return QSize(size.width(), size.height() - m_container->contentBottomMargin()); -} - -void MenuBar::show() -{ - // Add shadow for better readability - if (! Plasma::WindowEffects::isEffectAvailable(Plasma::WindowEffects::BlurBehind)) { - QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect(); - shadow->setBlurRadius(5); - shadow->setOffset(QPointF(1, 1)); - shadow->setColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor)); - setGraphicsEffect(shadow); - } else { - setGraphicsEffect(0); - } - m_hideTimer->start(1000); - QGraphicsView::show(); - -} - -void MenuBar::hide() -{ - emit aboutToHide(); - m_hideTimer->stop(); - QGraphicsView::hide(); -} - -void MenuBar::slotAboutToHide() -{ - if (m_container->aMenuIsVisible()) { // MenuBar::m_hideTimer - m_hideTimer->stop(); // menu is visible, menubar will be hidden by another aboutToHide() signal - } - else if (!cursorInMenuBar()) { //MenuWidget::AboutToHide signal - hide(); - } else if (!m_hideTimer->isActive()){ //use click on menubar button while a popup was shown - m_hideTimer->start(1000); - } -} - -void MenuBar::slotCompositingChanged(bool) -{ - updateMask(); -} - -bool MenuBar::cursorInMenuBar() -{ - return QRect(pos(), size()).contains(QCursor::pos()); -} - -void MenuBar::drawBackground(QPainter *painter, const QRectF &/*rectF*/) -{ - painter->save(); - painter->setCompositionMode(QPainter::CompositionMode_Source); - m_background->paintFrame(painter); - painter->restore(); -} - -void MenuBar::resizeEvent(QResizeEvent*) -{ - m_background->resizeFrame(size()); - m_scene->setSceneRect(0, 0, width(), height()); - updateMask(); -} - -void MenuBar::updateMask() -{ - // Enable the mask only when compositing is disabled; - // As this operation is quite slow, it would be nice to find some - // way to workaround it for no-compositing users. - if (KWindowSystem::compositingActive()) { - clearMask(); - Plasma::WindowEffects::overrideShadow(winId(), true); - Plasma::WindowEffects::enableBlurBehind(winId(), true, m_background->mask()); - m_shadows->addWindow(this, Plasma::FrameSvg::BottomBorder|Plasma::FrameSvg::LeftBorder|Plasma::FrameSvg::RightBorder); - } else { - setMask(m_background->mask()); - } -} \ No newline at end of file diff --git a/appmenu/menubar.h b/appmenu/menubar.h deleted file mode 100644 index 9daa6ccc..00000000 --- a/appmenu/menubar.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - 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. -*/ - -#ifndef MENUBAR__H -#define MENUBAR__H - -#include "menuwidget.h" - -#include - -#include -class Shadows; - -namespace Plasma -{ - class FrameSvg; -} - -class MenuBar : public QGraphicsView -{ -Q_OBJECT -public: - MenuBar(); - ~MenuBar(); - - /** - * Set root menu - */ - void setMenu(QMenu *menu) { m_container->setMenu(menu); } - /** - * Auto open menu items on mouse over - */ - void autoOpen() { m_container->autoOpen(); } - /** - * Set action as active menubar action - */ - void setActiveAction(QAction *action) { m_container->setActiveAction(action); } - - virtual QSize sizeHint() const; - virtual void show(); - virtual void hide(); - -private Q_SLOTS: - void slotAboutToHide(); - void slotCompositingChanged(bool); -Q_SIGNALS: - void needResize(); - void aboutToHide(); -protected: - /** - * Return true if cursor in menubar - */ - virtual bool cursorInMenuBar(); - virtual void drawBackground(QPainter* painter, const QRectF &rectF); - virtual void resizeEvent(QResizeEvent* event); -private: - void updateMask(); - QTimer* m_hideTimer; - Plasma::FrameSvg* m_background; - Shadows *m_shadows; - QGraphicsScene* m_scene; - MenuWidget* m_container; -}; - -#endif diff --git a/appmenu/menubutton.cpp b/appmenu/menubutton.cpp deleted file mode 100644 index 835c22f8..00000000 --- a/appmenu/menubutton.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - 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 "menubutton.h" - -#include -#include -#include - -#include - -MenuButton::MenuButton(QGraphicsWidget *parent): - Plasma::ToolButton(parent), - m_enterEvent(false), - m_menu(0) -{ - QGraphicsDropShadowEffect* shadow = new QGraphicsDropShadowEffect(); - shadow->setBlurRadius(5); - shadow->setOffset(QPointF(1, 1)); - shadow->setColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor)); - setGraphicsEffect(shadow); -} - -void MenuButton::setHovered(bool hovered) -{ - if (hovered) { - hoverEnterEvent(0); - } else { - hoverLeaveEvent(0); - } -} - -QSizeF MenuButton::sizeHint(Qt::SizeHint which, const QSizeF& constraint) const -{ - QSizeF sh = Plasma::ToolButton::sizeHint(which, constraint); - if (which == Qt::MinimumSize || which == Qt::PreferredSize) { - sh.setHeight(nativeWidget()->fontMetrics().height() + bottomMargin()); - } - return sh; -} - -qreal MenuButton::bottomMargin() const -{ - qreal left, right, top, bottom; - getContentsMargins(&left, &right, &top, &bottom); - return bottom; -} - -void MenuButton::hoverEnterEvent(QGraphicsSceneHoverEvent *e) -{ - m_enterEvent = true; - Plasma::ToolButton::hoverEnterEvent(e); -} - -void MenuButton::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) -{ - if (m_enterEvent) { - m_enterEvent = false; - Plasma::ToolButton::hoverLeaveEvent(e); - } -} - -#include "moc_menubutton.cpp" \ No newline at end of file diff --git a/appmenu/menubutton.h b/appmenu/menubutton.h deleted file mode 100644 index 35e3d6ed..00000000 --- a/appmenu/menubutton.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - 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. -*/ - -#ifndef MENUBUTTON__H -#define MENUBUTTON__H - -#include -#include - -#include - -class MenuButton : public Plasma::ToolButton -{ -Q_OBJECT -public: - MenuButton(QGraphicsWidget *parent); - - void setHovered(bool hovered); - - QSizeF sizeHint(Qt::SizeHint which, const QSizeF& constraint) const; - qreal bottomMargin() const; - - void setMenu(QMenu *menu) { m_menu = menu; } - QMenu* menu() { return m_menu; } -protected: - void hoverEnterEvent(QGraphicsSceneHoverEvent *); - void hoverLeaveEvent(QGraphicsSceneHoverEvent *); -private: - bool m_enterEvent; - QMenu *m_menu; -}; -#endif diff --git a/appmenu/menuimporter.cpp b/appmenu/menuimporter.cpp deleted file mode 100644 index f6d4cd21..00000000 --- a/appmenu/menuimporter.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/* - 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 "menuimporter.h" -#include "menuimporteradaptor.h" - -#include -#include -#include -#include - -#include -#include -#include - -static const char* DBUS_SERVICE = "com.canonical.AppMenu.Registrar"; -static const char* DBUS_OBJECT_PATH = "/com/canonical/AppMenu/Registrar"; - -// Marshalling code for DBusMenuLayoutItem -QDBusArgument &operator<<(QDBusArgument &argument, const DBusMenuLayoutItem &obj) -{ - argument.beginStructure(); - argument << obj.id << obj.properties; - argument.beginArray(qMetaTypeId()); - Q_FOREACH(const DBusMenuLayoutItem& child, obj.children) { - argument << QDBusVariant(QVariant::fromValue(child)); - } - argument.endArray(); - argument.endStructure(); - return argument; -} - -const QDBusArgument &operator>>(const QDBusArgument &argument, DBusMenuLayoutItem &obj) -{ - argument.beginStructure(); - argument >> obj.id >> obj.properties; - argument.beginArray(); - while (!argument.atEnd()) { - QDBusVariant dbusVariant; - argument >> dbusVariant; - QDBusArgument childArgument = dbusVariant.variant().value(); - - DBusMenuLayoutItem child; - childArgument >> child; - obj.children.append(child); - } - argument.endArray(); - argument.endStructure(); - return argument; -} - -MenuImporter::MenuImporter(QObject* parent) -: QObject(parent) -, m_serviceWatcher(new QDBusServiceWatcher(this)) -{ - qDBusRegisterMetaType(); - m_serviceWatcher->setConnection(QDBusConnection::sessionBus()); - m_serviceWatcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration); - connect(m_serviceWatcher, SIGNAL(serviceUnregistered(const QString&)), SLOT(slotServiceUnregistered(const QString&))); - - QDBusConnection::sessionBus().connect("", "", "com.canonical.dbusmenu", "LayoutUpdated", - this, SLOT(slotLayoutUpdated(uint,int))); -} - -MenuImporter::~MenuImporter() -{ - QDBusConnection::sessionBus().unregisterService(DBUS_SERVICE); - QDBusConnection::sessionBus().disconnect("", "", "com.canonical.dbusmenu", "LayoutUpdated", - this, SLOT(slotLayoutUpdated(uint,int))); -} - -bool MenuImporter::connectToBus() -{ - if (!QDBusConnection::sessionBus().registerService(DBUS_SERVICE)) { - return false; - } - new MenuImporterAdaptor(this); - QDBusConnection::sessionBus().registerObject(DBUS_OBJECT_PATH, this); - - return true; -} - -WId MenuImporter::recursiveMenuId(WId id) -{ - KWindowInfo info = KWindowSystem::windowInfo(id, 0, NET::WM2WindowClass); - QString classClass = info.windowClassClass(); - WId classId = 0; - - // First look at transient windows - WId tid = KWindowSystem::transientFor(id); - while (tid) { - if (serviceExist(tid)) { - classId = tid; - break; - } - tid = KWindowSystem::transientFor(tid); - } - - if (classId == 0) { - // Look at friends windows - QHashIterator i(m_windowClasses); - while (i.hasNext()) { - i.next(); - if (i.value() == classClass) { - classId = i.key(); - } - } - } - - return classId; -} - -void MenuImporter::RegisterWindow(WId id, const QDBusObjectPath& path) -{ - KWindowInfo info = KWindowSystem::windowInfo(id, NET::WMWindowType); - unsigned long mask = NET::AllTypesMask; - - // Menu can try to register, right click in gimp for exemple - if (info.windowType(mask) & (NET::Menu|NET::DropdownMenu||NET::PopupMenu)) { - return; - } - - if (path.path().isEmpty()) //prevent bad dbusmenu usage - return; - - QString service = message().service(); - - info = KWindowSystem::windowInfo(id, 0, NET::WM2WindowClass); - QString classClass = info.windowClassClass(); - m_windowClasses.insert(id, classClass); - m_menuServices.insert(id, service); - m_menuPaths.insert(id, path); - if (! m_serviceWatcher->watchedServices().contains(service)) { - m_serviceWatcher->addWatchedService(service); - } - emit WindowRegistered(id, service, path); -} - -void MenuImporter::UnregisterWindow(WId id) -{ - m_menuServices.remove(id); - m_menuPaths.remove(id); - m_windowClasses.remove(id); - - emit WindowUnregistered(id); -} - -QString MenuImporter::GetMenuForWindow(WId id, QDBusObjectPath& path) -{ - path = m_menuPaths.value(id); - return m_menuServices.value(id); -} - -void MenuImporter::slotServiceUnregistered(const QString& service) -{ - WId id = m_menuServices.key(service); - m_menuServices.remove(id); - m_menuPaths.remove(id); - m_windowClasses.remove(id); - emit WindowUnregistered(id); - m_serviceWatcher->removeWatchedService(service); -} - -void MenuImporter::slotLayoutUpdated(uint /*revision*/, int parentId) -{ - // Fake unity-panel-service weird behavior of calling aboutToShow on - // startup. This is necessary for Firefox menubar to work correctly at - // startup. - // See: https://bugs.launchpad.net/plasma-idget-menubar/+bug/878165 - - if (parentId == 0) { //root menu - fakeUnityAboutToShow(); - } -} - -void MenuImporter::fakeUnityAboutToShow() -{ - QDBusInterface iface(message().service(), message().path(), "com.canonical.dbusmenu"); - QDBusPendingCall call = iface.asyncCall("GetLayout", 0, 1, QStringList()); - QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(call, this); - watcher->setProperty("service", message().service()); - watcher->setProperty("path", message().path()); - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - SLOT(finishFakeUnityAboutToShow(QDBusPendingCallWatcher*))); -} - -void MenuImporter::finishFakeUnityAboutToShow(QDBusPendingCallWatcher* watcher) -{ - QDBusPendingReply reply = *watcher; - if (reply.isError()) { - kWarning() << "Call to GetLayout failed:" << reply.error().message(); - return; - } - QString service = watcher->property("service").toString(); - QString path = watcher->property("path").toString(); - DBusMenuLayoutItem root = reply.argumentAt<1>(); - - QDBusInterface iface(service, path, "com.canonical.dbusmenu"); - Q_FOREACH(const DBusMenuLayoutItem& dbusMenuItem, root.children) { - iface.asyncCall("AboutToShow", dbusMenuItem.id); - } -} diff --git a/appmenu/menuimporter.h b/appmenu/menuimporter.h deleted file mode 100644 index 804587d5..00000000 --- a/appmenu/menuimporter.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - 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. -*/ - -#ifndef MENUIMPORTER_H -#define MENUIMPORTER_H - -// Qt -#include -#include -#include -#include // For WId - -#include -#include -#include -#include - -/** - * Represents an item with its children. GetLayout() returns a - * DBusMenuLayoutItemList. - */ -struct DBusMenuLayoutItem -{ - int id; - QVariantMap properties; - QList children; -}; -Q_DECLARE_METATYPE(DBusMenuLayoutItem) - -class MenuImporter : public QObject, protected QDBusContext -{ - Q_OBJECT - -public: - MenuImporter(QObject*); - ~MenuImporter(); - - bool connectToBus(); - - bool serviceExist(WId id) { return m_menuServices.contains(id); } - QString serviceForWindow(WId id) { return m_menuServices.value(id); } - - bool pathExist(WId id) { return m_menuPaths.contains(id); } - QString pathForWindow(WId id) { return m_menuPaths.value(id).path(); } - - QList ids() { return m_menuServices.keys(); } - - /** - * Return id of first transient/friend window with a menu available - */ - WId recursiveMenuId(WId id); - -Q_SIGNALS: - void WindowRegistered(WId id, const QString& service, const QDBusObjectPath&); - void WindowUnregistered(WId id); - -public Q_SLOTS: - void RegisterWindow(WId id, const QDBusObjectPath& path); - void UnregisterWindow(WId id); - QString GetMenuForWindow(WId id, QDBusObjectPath& path); - -private Q_SLOTS: - void slotServiceUnregistered(const QString& service); - void slotLayoutUpdated(uint revision, int parentId); - void finishFakeUnityAboutToShow(QDBusPendingCallWatcher*); - -private: - QDBusServiceWatcher* m_serviceWatcher; - QHash m_menuServices; - QHash m_menuPaths; - QHash m_windowClasses; - - void fakeUnityAboutToShow(); -}; - -#endif /* MENUIMPORTER_H */ diff --git a/appmenu/menuwidget.cpp b/appmenu/menuwidget.cpp deleted file mode 100644 index 36c4931d..00000000 --- a/appmenu/menuwidget.cpp +++ /dev/null @@ -1,387 +0,0 @@ -/* - 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 "menuwidget.h" - -#include -#include -#include -#include - -#include -#include -#include - -MenuWidget::MenuWidget(QGraphicsView *view) : - QGraphicsWidget(), - m_mouseTimer(new QTimer(this)), - m_actionTimer(new QTimer(this)), - m_view(view), - m_layout(new QGraphicsLinearLayout(this)), - m_currentButton(0), - m_contentBottomMargin(0), - m_mousePosition(-1, -1), - m_visibleMenu(0), - m_menu(0) -{ - connect(m_actionTimer, SIGNAL(timeout()), SLOT(slotUpdateActions())); - connect(m_mouseTimer, SIGNAL(timeout()), SLOT(slotCheckActiveItem())); -} - -MenuWidget::~MenuWidget() -{ - while (!m_buttons.isEmpty()) { - delete m_buttons.front(); - m_buttons.pop_front(); - } -} - -void MenuWidget::setMenu(QMenu *menu) -{ - if (m_menu) { - disconnect(m_menu, SIGNAL(destroyed()), this, SLOT(slotMenuDestroyed())); - m_menu->removeEventFilter(this); - } - if (menu) { - if (m_mouseTimer->isActive()) { - m_mouseTimer->stop(); - } - m_visibleMenu = 0; - m_menu = menu; - connect(m_menu, SIGNAL(destroyed()), SLOT(slotMenuDestroyed()), Qt::UniqueConnection); - m_menu->installEventFilter(this); - slotUpdateActions(); - } -} - -void MenuWidget::initLayout() -{ - MenuButton* button = 0; - - if (!m_menu) { - return; - } - - foreach (QAction* action, m_menu->actions()) - { - button = createButton(action); - if (button) { - m_layout->addItem(button); - button->setMenu(action->menu()); - m_buttons << button; - } - } - - //Assume all buttons have same margins - if (button) { - m_contentBottomMargin = button->bottomMargin(); - } -} - -bool MenuWidget::eventFilter(QObject* object, QEvent* event) -{ - bool filtered; - if (object == m_menu) { - filtered = menuEventFilter(event); - } else { - filtered = subMenuEventFilter(static_cast(object), event); - } - return filtered ? true : QGraphicsWidget::eventFilter(object, event); -} - -bool MenuWidget::menuEventFilter(QEvent* event) -{ - switch (event->type()) { - case QEvent::ActionAdded: - case QEvent::ActionRemoved: - case QEvent::ActionChanged: - // Try to limit layout updates - m_actionTimer->start(500); - break; - default: - break; - } - return false; -} - -bool MenuWidget::subMenuEventFilter(QObject* object, QEvent* event) -{ - QMenu *menu = static_cast(object); - - if (event->type() == QEvent::KeyPress) { - menu->removeEventFilter(this); - QApplication::sendEvent(menu, event); - menu->installEventFilter(this); - if (!event->isAccepted()) { - QKeyEvent* keyEvent = static_cast(event); - switch (keyEvent->key()) { - case Qt::Key_Left: - showLeftRightMenu(false); - break; - case Qt::Key_Right: - showLeftRightMenu(true); - break; - case Qt::Key_Escape: - menu->hide(); - break; - default: - break; - } - } - return true; - } - return false; -} - -void MenuWidget::slotMenuDestroyed() -{ - m_menu = 0; - m_visibleMenu = 0; - m_currentButton = 0; -} - -void MenuWidget::slotCheckActiveItem() -{ - MenuButton* buttonBelow = 0; - QPoint pos = m_view->mapFromGlobal(QCursor::pos()); - QGraphicsItem* item = m_view->itemAt(pos); - - if (pos == m_mousePosition) { - return; - } else { - m_mousePosition = pos; - } - - if (item) { - buttonBelow = qobject_cast(item->toGraphicsObject()); - } - - if (!buttonBelow) { - return; - } - - if (buttonBelow != m_currentButton) { - if (m_currentButton && m_currentButton->nativeWidget()) { - m_currentButton->nativeWidget()->setDown(false); - m_currentButton->setHovered(false); - } - m_currentButton = buttonBelow; - if (m_currentButton->nativeWidget()) { - m_currentButton->nativeWidget()->setDown(true); - } - m_visibleMenu = showMenu(); - } -} - -void MenuWidget::slotMenuAboutToHide() -{ - if (m_currentButton && m_currentButton->nativeWidget()) { - m_currentButton->nativeWidget()->setDown(false); - } - - if (m_mouseTimer->isActive()) { - m_mouseTimer->stop(); - } - m_visibleMenu = 0; - emit aboutToHide(); -} - -void MenuWidget::slotButtonClicked() -{ - m_currentButton = qobject_cast(sender()); - - if (m_currentButton && m_currentButton->nativeWidget()) { - m_currentButton->nativeWidget()->setDown(true); - } - m_visibleMenu = showMenu(); - // Start auto navigation after click - if (!m_mouseTimer->isActive()) - m_mouseTimer->start(100); -} - -void MenuWidget::slotUpdateActions() -{ - if (m_visibleMenu) { - return; // Later - } - - m_actionTimer->stop(); - m_currentButton = 0; - foreach (MenuButton *button, m_buttons) { - disconnect(button, SIGNAL(clicked()), this, SLOT(slotButtonClicked())); - m_layout->removeItem(button); - button->hide(); - m_buttons.removeOne(button); - delete button; - } - initLayout(); - // Menu may be empty on application startup - // slotUpdateActions will be called later by eventFilter() - if (m_menu && m_menu->actions().length()) { - emit needResize(); - } -} - -void MenuWidget::setActiveAction(QAction *action) -{ - if (!m_menu) { - return; - } - - m_currentButton = m_buttons.first(); - - if (action) { - QMenu *menu; - int i = 0; - foreach (MenuButton *button, m_buttons) { - menu = m_menu->actions()[i]->menu(); - if (menu && menu == action->menu()) { - m_currentButton = button; - break; - } - if (++i >= m_menu->actions().length()) { - break; - } - } - } - m_currentButton->nativeWidget()->animateClick(); -} - -void MenuWidget::hide() -{ - if (m_mouseTimer->isActive()) { - m_mouseTimer->stop(); - } - QGraphicsWidget::hide(); -} - -MenuButton* MenuWidget::createButton(QAction *action) -{ - if( action->isSeparator() || !action->menu() || !action->isVisible()) { - return 0; - } - - action->setShortcut(QKeySequence()); - MenuButton *button = new MenuButton(this); - button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); - button->setText(action->text()); - connect(button, SIGNAL(clicked()), SLOT(slotButtonClicked())); - return button; -} - -QMenu* MenuWidget::showMenu() -{ - QMenu *menu = 0; - - if (m_visibleMenu) { - disconnect(m_visibleMenu, SIGNAL(aboutToHide()), this, SLOT(slotMenuAboutToHide())); - m_visibleMenu->hide(); - } - - if (m_currentButton && m_menu) { - menu = m_currentButton->menu(); - } - - // Last chance to get menu - // Some applications like Firefox have empties menus on layout updates - // They should populate this menu later but in fact, they use another object - // So, we check here directly the button name, may fail with menubar with buttons with same name (test apps) - if (menu && menu->actions().length() == 0) { - foreach (QAction *action, m_menu->actions()) { - if (action->text() == m_currentButton->text()) { - menu = action->menu(); - break; - } - } - } - - if (menu) { - QPoint globalPos = m_view->mapToGlobal(QPoint(0,0)); - QPointF parentPos = m_currentButton->mapFromParent(QPoint(0,0)); - QRect screen = KApplication::desktop()->screenGeometry(); - int x = globalPos.x() - parentPos.x(); - int y = globalPos.y() + m_currentButton->size().height() - parentPos.y(); - - menu->popup(QPoint(x, y)); - - // Fix offscreen menu - if (menu->size().height() + y > screen.height() + screen.y()) { - y = globalPos.y() - parentPos.y() - menu->size().height(); - if (menu->size().width() + x > screen.width() + screen.x()) - x = screen.width() + screen.x() - menu->size().width(); - else if (menu->size().width() + x < screen.x()) - x = screen.x(); - menu->move(x, y); - } - - connect(menu, SIGNAL(aboutToHide()), this, SLOT(slotMenuAboutToHide())); - - installEventFilterForAll(menu, this); - } - return menu; -} - -void MenuWidget::showLeftRightMenu(bool next) -{ - if (!m_currentButton) { - return; - } - - int index = m_buttons.indexOf(m_currentButton); - if (index == -1) { - kWarning() << "Couldn't find button!"; - return; - } - if (next) { - index = (index + 1) % m_buttons.count(); - } else { - index = (index == 0 ? m_buttons.count() : index) - 1; - } - - if (m_currentButton && m_currentButton->nativeWidget()) { - m_currentButton->nativeWidget()->setDown(false); - } - m_currentButton = m_buttons.at(index); - if (m_currentButton && m_currentButton->nativeWidget()) { - m_currentButton->nativeWidget()->setDown(true); - } - m_visibleMenu = showMenu(); -} - -void MenuWidget::installEventFilterForAll(QMenu *menu, QObject *object) -{ - if (!menu) { - return; - } - - menu->installEventFilter(this); - - foreach (QAction *action, menu->actions()) { - if (action->menu()) - installEventFilterForAll(action->menu(), object); - } -} - -#include "moc_menuwidget.cpp" \ No newline at end of file diff --git a/appmenu/menuwidget.h b/appmenu/menuwidget.h deleted file mode 100644 index 9b12db43..00000000 --- a/appmenu/menuwidget.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - 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. -*/ - -#ifndef MENUWIDGET__H -#define MENUWIDGET__H - -#include "menubutton.h" - -#include -#include - -#include -#include - -class MenuWidget : public QGraphicsWidget -{ -Q_OBJECT -public: - MenuWidget(QGraphicsView *view = 0); - ~MenuWidget(); - - /** - * Set root menu - */ - void setMenu(QMenu *menu); - /** - * Init layout with root menu - */ - void initLayout(); - /** - * True if a menu is visible in menuwidget - */ - bool aMenuIsVisible() { return m_visibleMenu; } - /** - * Activate action, or first action if null - */ - void setActiveAction(QAction *action); - - /** - * Auto open menu items on mouse over - */ - void autoOpen() { m_mouseTimer->start(100); } - - /** - * Return content bottom margin - */ - qreal contentBottomMargin() { return m_contentBottomMargin; } - - void hide(); - -protected: - /** - * Use to get keyboard events - */ - virtual bool eventFilter(QObject*, QEvent*); - /** - * Filter events on main menu - */ - bool menuEventFilter(QEvent* event); - /** - * Filter events on submenus - */ - bool subMenuEventFilter(QObject* object, QEvent* event); -private Q_SLOTS: - /** - * Clean menu if destroyed - */ - void slotMenuDestroyed(); - /** - * Check hovered item and active it - */ - void slotCheckActiveItem(); - /** - * A menu is hidding - */ - void slotMenuAboutToHide(); - /** - * Menubar button clicked - */ - void slotButtonClicked(); - /** - * Update pending actions - */ - void slotUpdateActions(); -Q_SIGNALS: - void needResize(); - void aboutToHide(); -private: - /** - * Return a button based on action - */ - MenuButton* createButton(QAction *action); - /** - * Show current button menu - * return showed menu - */ - QMenu* showMenu(); - /** - * Show next menu if next, otherwise previous - */ - void showLeftRightMenu(bool next); - /** - * Install event filter for menu and it submenus - */ - void installEventFilterForAll(QMenu *menu, QObject *object); - - //Follow mouse position - QTimer *m_mouseTimer; - //Update actions - QTimer *m_actionTimer; - QGraphicsView *m_view; - QGraphicsLinearLayout *m_layout; - QList m_buttons; - MenuButton *m_currentButton; - qreal m_contentBottomMargin; - QPoint m_mousePosition; - QMenu *m_visibleMenu; - QMenu *m_menu; -}; - -#endif //MENUWIDGET__H diff --git a/appmenu/org.kde.kded.appmenu.xml b/appmenu/org.kde.kded.appmenu.xml deleted file mode 100644 index 8056fba3..00000000 --- a/appmenu/org.kde.kded.appmenu.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/appmenu/shadows.cpp b/appmenu/shadows.cpp deleted file mode 100644 index f10d4d03..00000000 --- a/appmenu/shadows.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* -* Copyright 2011 by 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, -* 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 "shadows.h" - -#include -#include - -#ifdef Q_WS_X11 -#include -#include -#include -#include -#endif - -#include -#include - -class Shadows::Private -{ -public: - Private(Shadows *shadows) - : q(shadows), - m_managePixmaps(false) - { - } - - ~Private() - { - clearPixmaps(); - } - - void clearPixmaps(); - void setupPixmaps(); - void initPixmap(const QString &element); - QPixmap initEmptyPixmap(const QSize &size); - void updateShadow(const QWidget *window, Plasma::FrameSvg::EnabledBorders); - void clearShadow(const QWidget *window); - void updateShadows(); - void windowDestroyed(QObject *deletedObject); - void setupData(Plasma::FrameSvg::EnabledBorders enabledBorders); - - Shadows *q; - QList m_shadowPixmaps; - - QPixmap m_emptyCornerPix; - QPixmap m_emptyCornerLeftPix; - QPixmap m_emptyCornerTopPix; - QPixmap m_emptyCornerRightPix; - QPixmap m_emptyCornerBottomPix; - QPixmap m_emptyVerticalPix; - QPixmap m_emptyHorizontalPix; - - QHash > data; - QHash m_windows; - bool m_managePixmaps; -}; - -class ShadowsSingleton -{ -public: - ShadowsSingleton() - { - } - - Shadows self; -}; - -K_GLOBAL_STATIC(ShadowsSingleton, privateShadowsSelf) - -Shadows::Shadows(QObject *parent, const QString &prefix) - : Plasma::Svg(parent), - d(new Private(this)) -{ - setImagePath(prefix); - connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateShadows())); -} - -Shadows *Shadows::self() -{ - return &privateShadowsSelf->self; -} - -void Shadows::addWindow(const QWidget *window, Plasma::FrameSvg::EnabledBorders enabledBorders) -{ - if (!window || !window->isWindow()) { - return; - } - - d->m_windows[window] = enabledBorders; - d->updateShadow(window, enabledBorders); - connect(window, SIGNAL(destroyed(QObject*)), - this, SLOT(windowDestroyed(QObject*)), Qt::UniqueConnection); -} - -void Shadows::removeWindow(const QWidget *window) -{ - if (!d->m_windows.contains(window)) { - return; - } - - d->m_windows.remove(window); - disconnect(window, 0, this, 0); - d->clearShadow(window); - - if (d->m_windows.isEmpty()) { - d->clearPixmaps(); - } -} - -void Shadows::Private::windowDestroyed(QObject *deletedObject) -{ - m_windows.remove(static_cast(deletedObject)); - - if (m_windows.isEmpty()) { - clearPixmaps(); - } -} - -void Shadows::Private::updateShadows() -{ - setupPixmaps(); - QHash::const_iterator i; - for (i = m_windows.constBegin(); i != m_windows.constEnd(); ++i) { - updateShadow(i.key(), i.value()); - } -} - -void Shadows::Private::initPixmap(const QString &element) -{ -#ifdef Q_WS_X11 - QPixmap pix = q->pixmap(element); - if (!pix.isNull() && pix.handle() == 0) { - Pixmap xPix = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), pix.width(), pix.height(), 32); - QPixmap tempPix = QPixmap::fromX11Pixmap(xPix, QPixmap::ExplicitlyShared); - tempPix.fill(Qt::transparent); - QPainter p(&tempPix); - p.drawPixmap(QPoint(0, 0), pix); - m_shadowPixmaps << tempPix; - m_managePixmaps = true; - } else { - m_shadowPixmaps << pix; - } -#endif -} - -QPixmap Shadows::Private::initEmptyPixmap(const QSize &size) -{ - Pixmap emptyXPix = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), size.width(), size.height(), 32); - QPixmap tempEmptyPix = QPixmap::fromX11Pixmap(emptyXPix, QPixmap::ExplicitlyShared); - tempEmptyPix.fill(Qt::transparent); - return tempEmptyPix; -} - -void Shadows::Private::setupPixmaps() -{ - clearPixmaps(); - initPixmap("shadow-top"); - initPixmap("shadow-topright"); - initPixmap("shadow-right"); - initPixmap("shadow-bottomright"); - initPixmap("shadow-bottom"); - initPixmap("shadow-bottomleft"); - initPixmap("shadow-left"); - initPixmap("shadow-topleft"); - - m_emptyCornerPix = initEmptyPixmap(QSize(1,1)); - m_emptyCornerLeftPix = initEmptyPixmap(QSize(q->elementSize("shadow-topleft").width(), 1)); - m_emptyCornerTopPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-topleft").height())); - m_emptyCornerRightPix = initEmptyPixmap(QSize(q->elementSize("shadow-bottomright").width(), 1)); - m_emptyCornerBottomPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-bottomright").height())); - m_emptyVerticalPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-left").height())); - m_emptyHorizontalPix = initEmptyPixmap(QSize(q->elementSize("shadow-top").width(), 1)); - -} - - -void Shadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledBorders) -{ -#ifdef Q_WS_X11 - //shadow-top - if (enabledBorders & Plasma::FrameSvg::TopBorder) { - data[enabledBorders] << m_shadowPixmaps[0].handle(); - } else { - data[enabledBorders] << m_emptyHorizontalPix.handle(); - } - - //shadow-topright - if (enabledBorders & Plasma::FrameSvg::TopBorder && - enabledBorders & Plasma::FrameSvg::RightBorder) { - data[enabledBorders] << m_shadowPixmaps[1].handle(); - } else if (enabledBorders & Plasma::FrameSvg::TopBorder) { - data[enabledBorders] << m_emptyCornerTopPix.handle(); - } else if (enabledBorders & Plasma::FrameSvg::RightBorder) { - data[enabledBorders] << m_emptyCornerRightPix.handle(); - } else { - data[enabledBorders] << m_emptyCornerPix.handle(); - } - - //shadow-right - if (enabledBorders & Plasma::FrameSvg::RightBorder) { - data[enabledBorders] << m_shadowPixmaps[2].handle(); - } else { - data[enabledBorders] << m_emptyVerticalPix.handle(); - } - - //shadow-bottomright - if (enabledBorders & Plasma::FrameSvg::BottomBorder && - enabledBorders & Plasma::FrameSvg::RightBorder) { - data[enabledBorders] << m_shadowPixmaps[3].handle(); - } else if (enabledBorders & Plasma::FrameSvg::BottomBorder) { - data[enabledBorders] << m_emptyCornerBottomPix.handle(); - } else if (enabledBorders & Plasma::FrameSvg::RightBorder) { - data[enabledBorders] << m_emptyCornerRightPix.handle(); - } else { - data[enabledBorders] << m_emptyCornerPix.handle(); - } - - //shadow-bottom - if (enabledBorders & Plasma::FrameSvg::BottomBorder) { - data[enabledBorders] << m_shadowPixmaps[4].handle(); - } else { - data[enabledBorders] << m_emptyHorizontalPix.handle(); - } - - //shadow-bottomleft - if (enabledBorders & Plasma::FrameSvg::BottomBorder && - enabledBorders & Plasma::FrameSvg::LeftBorder) { - data[enabledBorders] << m_shadowPixmaps[5].handle(); - } else if (enabledBorders & Plasma::FrameSvg::BottomBorder) { - data[enabledBorders] << m_emptyCornerBottomPix.handle(); - } else if (enabledBorders & Plasma::FrameSvg::LeftBorder) { - data[enabledBorders] << m_emptyCornerLeftPix.handle(); - } else { - data[enabledBorders] << m_emptyCornerPix.handle(); - } - - //shadow-left - if (enabledBorders & Plasma::FrameSvg::LeftBorder) { - data[enabledBorders] << m_shadowPixmaps[6].handle(); - } else { - data[enabledBorders] << m_emptyVerticalPix.handle(); - } - - //shadow-topleft - if (enabledBorders & Plasma::FrameSvg::TopBorder && - enabledBorders & Plasma::FrameSvg::LeftBorder) { - data[enabledBorders] << m_shadowPixmaps[7].handle(); - } else if (enabledBorders & Plasma::FrameSvg::TopBorder) { - data[enabledBorders] << m_emptyCornerTopPix.handle(); - } else if (enabledBorders & Plasma::FrameSvg::LeftBorder) { - data[enabledBorders] << m_emptyCornerLeftPix.handle(); - } else { - data[enabledBorders] << m_emptyCornerPix.handle(); - } -#endif - - int left, top, right, bottom = 0; - - QSize marginHint; - if (enabledBorders & Plasma::FrameSvg::TopBorder) { - marginHint = q->elementSize("shadow-hint-top-margin"); - if (marginHint.isValid()) { - top = marginHint.height(); - } else { - top = m_shadowPixmaps[0].height(); // top - } - } else { - top = 1; - } - - if (enabledBorders & Plasma::FrameSvg::RightBorder) { - marginHint = q->elementSize("shadow-hint-right-margin"); - if (marginHint.isValid()) { - right = marginHint.width(); - } else { - right = m_shadowPixmaps[2].width(); // right - } - } else { - right = 1; - } - - if (enabledBorders & Plasma::FrameSvg::BottomBorder) { - marginHint = q->elementSize("shadow-hint-bottom-margin"); - if (marginHint.isValid()) { - bottom = marginHint.height(); - } else { - bottom = m_shadowPixmaps[4].height(); // bottom - } - } else { - bottom = 1; - } - - if (enabledBorders & Plasma::FrameSvg::LeftBorder) { - marginHint = q->elementSize("shadow-hint-left-margin"); - if (marginHint.isValid()) { - left = marginHint.width(); - } else { - left = m_shadowPixmaps[6].width(); // left - } - } else { - left = 1; - } - - data[enabledBorders] << top << right << bottom << left; -} - -void Shadows::Private::clearPixmaps() -{ -#ifdef Q_WS_X11 - if (m_managePixmaps) { - foreach (const QPixmap &pixmap, m_shadowPixmaps) { - XFreePixmap(QX11Info::display(), pixmap.handle()); - } - - XFreePixmap(QX11Info::display(), m_emptyCornerPix.handle()); - XFreePixmap(QX11Info::display(), m_emptyCornerBottomPix.handle()); - XFreePixmap(QX11Info::display(), m_emptyCornerLeftPix.handle()); - XFreePixmap(QX11Info::display(), m_emptyCornerRightPix.handle()); - XFreePixmap(QX11Info::display(), m_emptyCornerTopPix.handle()); - XFreePixmap(QX11Info::display(), m_emptyVerticalPix.handle()); - XFreePixmap(QX11Info::display(), m_emptyHorizontalPix.handle()); - - m_managePixmaps = false; - } -#endif - m_shadowPixmaps.clear(); - data.clear(); -} - -void Shadows::Private::updateShadow(const QWidget *window, Plasma::FrameSvg::EnabledBorders enabledBorders) -{ -#ifdef Q_WS_X11 - if (m_shadowPixmaps.isEmpty()) { - setupPixmaps(); - } - - if (!data.contains(enabledBorders)) { - setupData(enabledBorders); - } - - Display *dpy = QX11Info::display(); - Atom atom = XInternAtom(dpy, "_KDE_NET_WM_SHADOW", False); - - //kDebug() << "going to set the shadow of" << winId() << "to" << data; - XChangeProperty(dpy, window->winId(), atom, XA_CARDINAL, 32, PropModeReplace, - reinterpret_cast(data[enabledBorders].constData()), data[enabledBorders].size()); -#endif -} - -void Shadows::Private::clearShadow(const QWidget *window) -{ -#ifdef Q_WS_X11 - Display *dpy = QX11Info::display(); - Atom atom = XInternAtom(dpy, "_KDE_NET_WM_SHADOW", False); - XDeleteProperty(dpy, window->winId(), atom); -#endif -} - -bool Shadows::enabled() const -{ - return hasElement("shadow-left"); -} - -#include "moc_shadows.cpp" - diff --git a/appmenu/shadows.h b/appmenu/shadows.h deleted file mode 100644 index afbc49ef..00000000 --- a/appmenu/shadows.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* Copyright 2011 by 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, -* 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 SHADOWS_H -#define SHADOWS_H - -#include - -#include "plasma/framesvg.h" -#include "plasma/svg.h" - - -class Shadows : public Plasma::Svg -{ - Q_OBJECT - -public: - explicit Shadows(QObject *parent = 0, const QString &prefix = "widgets/panel-background"); - - static Shadows *self(); - - void addWindow(const QWidget *window, Plasma::FrameSvg::EnabledBorders enabledBorders = Plasma::FrameSvg::AllBorders); - void removeWindow(const QWidget *window); - - bool enabled() const; - -private: - class Private; - Private * const d; - - Q_PRIVATE_SLOT(d, void updateShadows()) - Q_PRIVATE_SLOT(d, void windowDestroyed(QObject *deletedObject)) -}; - -#endif - diff --git a/appmenu/topmenubar.cpp b/appmenu/topmenubar.cpp deleted file mode 100644 index dc97cced..00000000 --- a/appmenu/topmenubar.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - 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 "topmenubar.h" -#include "glowbar.h" - -//KDE -#include -#include - -// Qt -#include -#include -#include -#include -#include -#include - -TopMenuBar::TopMenuBar() - : MenuBar(), - m_prevCursorPos(-1, -1), - m_mouseTracker(new QTimer(this)), - m_hideGlowTimer(new QTimer(this)), - m_glowBar(new GlowBar()) -{ - connect(this, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHide())); - connect(m_mouseTracker, SIGNAL(timeout()), this, SLOT(slotMouseTracker())); - connect(m_hideGlowTimer, SIGNAL(timeout()), this, SLOT(slotHideGlowBar())); -} - -TopMenuBar::~TopMenuBar() -{ - delete m_mouseTracker; - delete m_hideGlowTimer; - hideGlowBar(); - delete m_glowBar; -} - -void TopMenuBar::enableMouseTracking(bool enable) -{ - if (enable) { - if (!cursorInMenuBar()) { - showGlowBar(); - } - m_mouseTracker->start(250); - } else { - hideGlowBar(); - m_mouseTracker->stop(); - } -} - -void TopMenuBar::updateSize() -{ - // Enable mouse tracking on resize if needed - if (!m_mouseTracker->isActive() && !cursorInMenuBar()) { - enableMouseTracking(); - } - resize(sizeHint()); -} - -void TopMenuBar::move(QPoint p) -{ - MenuBar::move(p); - if (m_glowBar) { - m_glowBar->move(p); - m_glowBar->setPixmap(triggerRect().topLeft(), triggerRect().width()); - } -} - -bool TopMenuBar::cursorInMenuBar() -{ - if (m_mouseTracker->isActive()) { - return triggerRect().contains(QCursor::pos()); - } else { - return MenuBar::cursorInMenuBar(); - } -} - -void TopMenuBar::slotAboutToHide() -{ - enableMouseTracking(); -} - -void TopMenuBar::slotMouseTracker() -{ - QPoint cursorPos = QCursor::pos(); - - // reset timer - if (cursorPos != m_prevCursorPos && m_hideGlowTimer->isActive()) { - m_hideGlowTimer->stop(); - m_hideGlowTimer->start(10000); - } - - if (cursorInMenuBar()) { // show menubar - m_mouseTracker->stop(); - hideGlowBar(); - show(); - } else if(cursorPos != m_prevCursorPos) { // change glowbar opacity - qreal opacity = glowBarOpacity(); - QPropertyAnimation *anim = new QPropertyAnimation(m_glowBar, "windowOpacity"); - anim->setStartValue(m_glowBar->windowOpacity()); - anim->setEndValue(opacity); - anim->setDuration(200); - anim->start(QAbstractAnimation::DeleteWhenStopped); - // Show menubar if auto hidden - if (!m_glowBar->isVisible()) { - m_glowBar->show(); - } - } - m_prevCursorPos = cursorPos; -} - -void TopMenuBar::slotHideGlowBar() -{ - if (m_prevCursorPos == QCursor::pos()) { - hideGlowBar(); - } else { - m_hideGlowTimer->start(10000); - } -} - -void TopMenuBar::showGlowBar() -{ - if (m_glowBar) { - m_hideGlowTimer->start(10000); - m_glowBar->setWindowOpacity(glowBarOpacity()); - m_glowBar->show(); - } -} - -void TopMenuBar::hideGlowBar() -{ - if (m_glowBar) { - m_glowBar->hide(); - } -} - -qreal TopMenuBar::glowBarOpacity() -{ - QPoint cursorPos = QCursor::pos(); - QDesktopWidget *desktop = QApplication::desktop(); - int screen = desktop->screenNumber(cursorPos); - QRect desktopRect = desktop->availableGeometry(screen); - return 1.0 - ((cursorPos.y() - desktopRect.y())/qreal(desktopRect.height())*2.0); -} - -QRect TopMenuBar::triggerRect() -{ - QPoint triggerPoint = QPoint(x(), y()); - QSize triggerSize = QSize(sizeHint().width(), 5); - return QRect(triggerPoint, triggerSize); -} - -#include "moc_topmenubar.cpp" \ No newline at end of file diff --git a/appmenu/topmenubar.h b/appmenu/topmenubar.h deleted file mode 100644 index 9fddb52a..00000000 --- a/appmenu/topmenubar.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - 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. -*/ - -#ifndef TOPMENUBAR__H -#define TOPMENUBAR__H - -#include "menubar.h" - -#include -class GlowBar; - -class TopMenuBar : public MenuBar -{ -Q_OBJECT -public: - TopMenuBar(); - ~TopMenuBar(); - - /** - * Start mouse tracking (hide/show on mouse event) - */ - void enableMouseTracking(bool enable = true); - - /** - * Set menubar parent window id - */ - void setParentWid(WId id) { m_wid = id; } - /** - * Get menubar parent window id - */ - WId parentWid() { return m_wid; } - /** - * resize menu bar to feet content - */ - void updateSize(); - /** - * Move menubar and glow bar at position - */ - void move(QPoint p); -protected: - bool cursorInMenuBar(); -private Q_SLOTS: - void slotAboutToHide(); - void slotMouseTracker(); - void slotHideGlowBar(); -private: - void showGlowBar(); - void hideGlowBar(); - qreal glowBarOpacity(); - QRect triggerRect(); - - WId m_wid; - QPoint m_prevCursorPos; - QTimer* m_mouseTracker; - QTimer* m_hideGlowTimer; - GlowBar* m_glowBar; -}; - -#endif diff --git a/appmenu/verticalmenu.cpp b/appmenu/verticalmenu.cpp deleted file mode 100644 index 3c92d749..00000000 --- a/appmenu/verticalmenu.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - 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 "verticalmenu.h" - -#include -#include -#include -#include -#include - -VerticalMenu::VerticalMenu(QWidget* parent) : QMenu(parent) -{ -} - -VerticalMenu::~VerticalMenu() -{ -} - -QMenu *VerticalMenu::leafMenu() -{ - QMenu *leaf = this; - while (true) { - QAction *act = leaf->activeAction(); - if (act && act->menu() && act->menu()->isVisible()) { - leaf = act->menu(); - continue; - } - return leaf == this ? 0 : leaf; - } - return 0; // make gcc happy -} - -void VerticalMenu::paintEvent(QPaintEvent *pe) -{ - QMenu::paintEvent(pe); - if (QWidget::mouseGrabber() == this) - return; - if (QWidget::mouseGrabber()) - QWidget::mouseGrabber()->releaseMouse(); - grabMouse(); - grabKeyboard(); -} - -#define FORWARD(_EVENT_, _TYPE_) \ -void VerticalMenu::_EVENT_##Event(Q##_TYPE_##Event *e) \ -{ \ - if (QMenu *leaf = leafMenu()) \ - QCoreApplication::sendEvent(leaf, e); \ - else \ - QMenu::_EVENT_##Event(e); \ -} \ - -FORWARD(keyPress, Key) -FORWARD(keyRelease, Key) - -#include "moc_verticalmenu.cpp" \ No newline at end of file diff --git a/appmenu/verticalmenu.h b/appmenu/verticalmenu.h deleted file mode 100644 index 1b28ce27..00000000 --- a/appmenu/verticalmenu.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - 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. -*/ - -#ifndef VERTICALMENU_H -#define VERTICALMENU_H - -#include - -class VerticalMenu : public QMenu -{ -Q_OBJECT -public: - VerticalMenu(QWidget * parent = 0); - ~VerticalMenu(); - - /** - * Set menu parent window id - */ - void setParentWid(WId id) { m_wid = id; } - /** - * Get menu parent window id - */ - WId parentWid() { return m_wid; } -protected: - void keyPressEvent(QKeyEvent*); - void keyReleaseEvent(QKeyEvent*); - void paintEvent(QPaintEvent*); -private: - QMenu *leafMenu(); -private: - WId m_wid; -}; - -#endif //VERTICALMENU_H diff --git a/kcontrol/style/finetuning.ui b/kcontrol/style/finetuning.ui index 3abb6927..2a1b6b4a 100644 --- a/kcontrol/style/finetuning.ui +++ b/kcontrol/style/finetuning.ui @@ -1,4 +1,4 @@ - + FineTuning @@ -7,23 +7,10 @@ 0 0 422 - 358 + 206 - - - - Graphical effects: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - @@ -37,25 +24,8 @@ - - - - Show icons on buttons: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - cbIconsOnButtons - - - - - - - - - + + @@ -77,6 +47,26 @@ + + + + + + + + + + + Show icons on buttons: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + cbIconsOnButtons + + + @@ -173,66 +163,7 @@ - - - - Menubar - - - - - - Menubar style: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - comboMenubarStyle - - - - - - - - In application - - - - - Title bar button - - - - - Top screen menubar - - - - - Only export - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - + Qt::Vertical @@ -245,6 +176,16 @@ + + + + Graphical effects: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + diff --git a/kcontrol/style/kcmstyle.cpp b/kcontrol/style/kcmstyle.cpp index 4c3e752c..2038b740 100644 --- a/kcontrol/style/kcmstyle.cpp +++ b/kcontrol/style/kcmstyle.cpp @@ -259,7 +259,6 @@ KCMStyle::KCMStyle( QWidget* parent, const QVariantList& ) connect(fineTuningUi.comboGraphicEffectsLevel, SIGNAL(activated(int)), this, SLOT(setEffectsDirty())); connect(fineTuningUi.comboToolbarIcons, SIGNAL(activated(int)), this, SLOT(setEffectsDirty())); connect(fineTuningUi.comboSecondaryToolbarIcons, SIGNAL(activated(int)), this, SLOT(setEffectsDirty())); - connect(fineTuningUi.comboMenubarStyle, SIGNAL(activated(int)), this, SLOT(setEffectsDirty())); // Page1 cbStyle->setWhatsThis( i18n("Here you can choose from a list of" @@ -284,10 +283,6 @@ KCMStyle::KCMStyle( QWidget* parent, const QVariantList& ) fineTuningUi.comboGraphicEffectsLevel->setWhatsThis( i18n( "If you enable this option, KDE Applications will " "run internal animations.") ); - if (!QFile::exists(QLibraryInfo::location(QLibraryInfo::PluginsPath) + "/menubar/libappmenu-qt.so")) { - fineTuningUi.menubarBox->hide(); - } - // Insert the pages into the tabWidget tabWidget->addTab(page1, i18nc("@title:tab", "&Applications")); tabWidget->addTab(page2, i18nc("@title:tab", "&Fine Tuning")); @@ -428,74 +423,8 @@ void KCMStyle::save() toolbarStyleGroup.writeEntry("ToolButtonStyleOtherToolbars", toolbarButtonText(fineTuningUi.comboSecondaryToolbarIcons->currentIndex())); - // menubar page - KConfigGroup menuBarStyleGroup(&_config, "Appmenu Style"); - - // load kded module if needed - bool load = false; - QList args; - - QString style = menuBarStyleText(fineTuningUi.comboMenubarStyle->currentIndex()); - - QString previous = menuBarStyleGroup.readEntry("Style", "InApplication"); - menuBarStyleGroup.writeEntry("Style", style); _config.sync(); - QDBusMessage method = QDBusMessage::createMethodCall("org.kde.kded", - "/modules/appmenu", - "org.kde.kded", - "reconfigure"); - QDBusConnection::sessionBus().asyncCall(method); - - if (previous == "InApplication" && style != "InApplication") { - load = true; - KNotification *notification = new KNotification("reload", 0); - notification->setComponentData(KComponentData("kcmstyle")); - notification->setText(i18n("Settings changes will take effect only on application restart")); - notification->sendEvent(); - } - -#ifdef Q_WS_X11 - // If user select ButtonVertical, we add (if needed) a button to titlebar - if (style == "ButtonVertical") { - KConfig _kwinConfig("kwinrc", KConfig::NoGlobals); - KConfigGroup kwinConfig(&_kwinConfig, "Style"); - QString buttonsOnLeft = kwinConfig.readEntry("ButtonsOnLeft", KDecorationOptions::defaultTitleButtonsLeft()); - QString buttonsOnRight = kwinConfig.readEntry("ButtonsOnRight", KDecorationOptions::defaultTitleButtonsRight()); - qDebug() << buttonsOnLeft << buttonsOnRight; - if (!buttonsOnLeft.contains("N") && !buttonsOnRight.contains("N")) { - buttonsOnLeft = "N" + buttonsOnLeft; - } - kwinConfig.writeEntry("ButtonsOnLeft", buttonsOnLeft); - kwinConfig.writeEntry("CustomButtonPositions", "true"); - } -#endif - - args = QList() << "appmenu" << (style != "InApplication"); - method = QDBusMessage::createMethodCall("org.kde.kded", - "/kded", - "org.kde.kded", - "setModuleAutoloading"); - method.setArguments(args); - QDBusConnection::sessionBus().asyncCall(method); - - args = QList() << "appmenu"; - if (load) { - method = QDBusMessage::createMethodCall("org.kde.kded", - "/kded", - "org.kde.kded", - "loadModule"); - QDBusMessage method = QDBusMessage::createMethodCall("org.kde.kded", "/modules/appmenu", "org.kde.kded", "reconfigure"); - QDBusConnection::sessionBus().asyncCall(method); - } else if (style == "InApplication") { - method = QDBusMessage::createMethodCall("org.kde.kded", - "/kded", - "org.kde.kded", - "unloadModule"); - } - method.setArguments(args); - QDBusConnection::sessionBus().asyncCall(method); - // Export the changes we made to qtrc, and update all qt-only // applications on the fly, ensuring that we still follow the user's // export fonts/colors settings. @@ -581,7 +510,6 @@ void KCMStyle::defaults() // Effects fineTuningUi.comboToolbarIcons->setCurrentIndex(toolbarButtonIndex("TextBesideIcon")); fineTuningUi.comboSecondaryToolbarIcons->setCurrentIndex(toolbarButtonIndex("TextBesideIcon")); - fineTuningUi.comboMenubarStyle->setCurrentIndex(menuBarStyleIndex("InApplication")); fineTuningUi.cbIconsOnButtons->setChecked(true); fineTuningUi.cbIconsInMenus->setChecked(true); fineTuningUi.comboGraphicEffectsLevel->setCurrentIndex(fineTuningUi.comboGraphicEffectsLevel->findData(((int) KGlobalSettings::graphicEffectsLevelDefault()))); @@ -803,33 +731,6 @@ int KCMStyle::toolbarButtonIndex(const QString &text) return 0; } -QString KCMStyle::menuBarStyleText(int index) -{ - switch (index) { - case 1: - return "ButtonVertical"; - case 2: - return "TopMenuBar"; - case 3: - return "Others"; - } - - return "InApplication"; -} - -int KCMStyle::menuBarStyleIndex(const QString &text) -{ - if (text == "ButtonVertical") { - return 1; - } else if (text == "TopMenuBar") { - return 2; - } else if (text == "Others") { - return 3; - } - - return 0; -} - void KCMStyle::loadEffects( KConfig& config ) { // KDE's Part via KConfig @@ -840,10 +741,6 @@ void KCMStyle::loadEffects( KConfig& config ) tbIcon = configGroup.readEntry("ToolButtonStyleOtherToolbars", "TextBesideIcon"); fineTuningUi.comboSecondaryToolbarIcons->setCurrentIndex(toolbarButtonIndex(tbIcon)); - configGroup = config.group("Appmenu Style"); - QString menuBarStyle = configGroup.readEntry("Style", "InApplication"); - fineTuningUi.comboMenubarStyle->setCurrentIndex(menuBarStyleIndex(menuBarStyle)); - configGroup = config.group("KDE"); fineTuningUi.cbIconsOnButtons->setChecked(configGroup.readEntry("ShowIconsOnPushButtons", true)); fineTuningUi.cbIconsInMenus->setChecked(configGroup.readEntry("ShowIconsInMenuItems", true)); diff --git a/kcontrol/style/kcmstyle.h b/kcontrol/style/kcmstyle.h index 626121d9..48fc49b8 100644 --- a/kcontrol/style/kcmstyle.h +++ b/kcontrol/style/kcmstyle.h @@ -88,8 +88,6 @@ private: QString currentStyle(); static QString toolbarButtonText(int index); static int toolbarButtonIndex(const QString &text); - static QString menuBarStyleText(int index); - static int menuBarStyleIndex(const QString &text); bool m_bStyleDirty, m_bEffectsDirty; QHash styleEntries; diff --git a/kwin/CMakeLists.txt b/kwin/CMakeLists.txt index 0cf85f03..97ba7808 100644 --- a/kwin/CMakeLists.txt +++ b/kwin/CMakeLists.txt @@ -4,14 +4,8 @@ option(KWIN_BUILD_OXYGEN "Enable building of default decoration Oxygen" ON) option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON) option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON) option(KWIN_BUILD_SCREENEDGES "Enable building of KWin with screen edge support" ON) -option(KWIN_BUILD_KAPPMENU "Enable building of KWin with application menu support" ON) option(KWIN_BUILD_COMPOSITE "Enable building of KWin with XRender Compositing support" ON) -# without dbusmenu-qt the functionality is useless -if(NOT DBUSMENUQT_FOUND) - set(KWIN_BUILD_KAPPMENU OFF) -endif() - include_directories( ${XCB_INCLUDE_DIR} # for kworkspace_export.h @@ -145,13 +139,6 @@ if(KWIN_BUILD_SCREENEDGES) ) endif() -if(KWIN_BUILD_KAPPMENU) - set(kwin_SRCS - ${kwin_SRCS} - appmenu.cpp - ) -endif() - kde4_add_kcfg_files(kwin_SRCS settings.kcfgc) qt4_add_dbus_adaptor(kwin_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface) diff --git a/kwin/appmenu.cpp b/kwin/appmenu.cpp deleted file mode 100644 index ba53f1d1..00000000 --- a/kwin/appmenu.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (c) 2011 Lionel Chauvin -Copyright (c) 2011,2012 Cédric Bellegarde -Copyright (C) 2013 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "appmenu.h" -#include "client.h" -#include "workspace.h" -// Qt -#include -#include -#include - -namespace KWin { - -static const char *KDED_SERVICE = "org.kde.kded"; -static const char *KDED_APPMENU_PATH = "/modules/appmenu"; -static const char *KDED_INTERFACE = "org.kde.kded"; - -KWIN_SINGLETON_FACTORY(ApplicationMenu) - -ApplicationMenu::ApplicationMenu(QObject *parent) - : QObject(parent) -{ - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.connect(KDED_SERVICE, KDED_APPMENU_PATH, KDED_INTERFACE, "showRequest", - this, SLOT(slotShowRequest(qulonglong))); - dbus.connect(KDED_SERVICE, KDED_APPMENU_PATH, KDED_INTERFACE, "menuAvailable", - this, SLOT(slotMenuAvailable(qulonglong))); - dbus.connect(KDED_SERVICE, KDED_APPMENU_PATH, KDED_INTERFACE, "menuHidden", - this, SLOT(slotMenuHidden(qulonglong))); - dbus.connect(KDED_SERVICE, KDED_APPMENU_PATH, KDED_INTERFACE, "clearMenus", - this, SLOT(slotClearMenus())); -} - -ApplicationMenu::~ApplicationMenu() -{ - s_self = NULL; -} - -bool ApplicationMenu::hasMenu(xcb_window_t window) -{ - return m_windowsMenu.removeOne(window); -} - -void ApplicationMenu::slotShowRequest(qulonglong wid) -{ - if (Client *c = Workspace::self()->findClient(WindowMatchPredicate(wid))) - c->emitShowRequest(); -} - -void ApplicationMenu::slotMenuAvailable(qulonglong wid) -{ - if (Client *c = Workspace::self()->findClient(WindowMatchPredicate(wid))) - c->setAppMenuAvailable(); - else - m_windowsMenu.append(wid); -} - -void ApplicationMenu::slotMenuHidden(qulonglong wid) -{ - if (Client *c = Workspace::self()->findClient(WindowMatchPredicate(wid))) - c->emitMenuHidden(); -} - -void ApplicationMenu::slotClearMenus() -{ - foreach (Client *c, Workspace::self()->clientList()) { - c->setAppMenuUnavailable(); - } -} - -void ApplicationMenu::showApplicationMenu(const QPoint &p, const xcb_window_t id) -{ - QList args = QList() << p.x() << p.y() << qulonglong(id); - QDBusMessage method = QDBusMessage::createMethodCall(KDED_SERVICE, KDED_APPMENU_PATH, KDED_INTERFACE, "showMenu"); - method.setArguments(args); - QDBusConnection::sessionBus().asyncCall(method); -} - -} // namespace diff --git a/kwin/appmenu.h b/kwin/appmenu.h deleted file mode 100644 index e6f0f73e..00000000 --- a/kwin/appmenu.h +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (c) 2011 Lionel Chauvin -Copyright (c) 2011,2012 Cédric Bellegarde -Copyright (C) 2013 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWIN_APPLICATIONMENU_H -#define KWIN_APPLICATIONMENU_H -// KWin -#include -// Qt -#include -// xcb -#include - -#include - -namespace KWin -{ - -class ApplicationMenu : public QObject -{ - Q_OBJECT - -public: - virtual ~ApplicationMenu(); - - bool hasMenu(xcb_window_t window); - void showApplicationMenu(const QPoint &pos, const xcb_window_t window); - -private Q_SLOTS: - void slotShowRequest(qulonglong wid); - void slotMenuAvailable(qulonglong wid); - void slotMenuHidden(qulonglong wid); - void slotClearMenus(); - -private: - QList m_windowsMenu; - - KWIN_SINGLETON(ApplicationMenu) -}; - -} - -#endif // KWIN_APPLICATIONMENU_H diff --git a/kwin/bridge.cpp b/kwin/bridge.cpp index 5fc6679c..2a786842 100644 --- a/kwin/bridge.cpp +++ b/kwin/bridge.cpp @@ -115,22 +115,6 @@ void Bridge::showWindowMenu(const QRect &p) workspace()->showWindowMenu(p, c); } -void Bridge::showApplicationMenu(const QPoint &p) -{ -#ifdef KWIN_BUILD_KAPPMENU - c->showApplicationMenu(p); -#endif -} - -bool Bridge::menuAvailable() const -{ -#ifdef KWIN_BUILD_KAPPMENU - return c->menuAvailable(); -#else - return false; -#endif -} - void Bridge::performWindowOperation(WindowOperation op) { workspace()->performWindowOperation(c, op); diff --git a/kwin/bridge.h b/kwin/bridge.h index 200ba68e..63f9ac6c 100644 --- a/kwin/bridge.h +++ b/kwin/bridge.h @@ -54,8 +54,6 @@ public: virtual void processMousePressEvent(QMouseEvent*); virtual void showWindowMenu(const QPoint &); virtual void showWindowMenu(const QRect &); - virtual void showApplicationMenu(const QPoint &); - virtual bool menuAvailable() const; virtual void performWindowOperation(WindowOperation); virtual void setMask(const QRegion&, int); virtual bool isPreview() const; diff --git a/kwin/client.cpp b/kwin/client.cpp index 531b49d1..7757d308 100644 --- a/kwin/client.cpp +++ b/kwin/client.cpp @@ -21,9 +21,6 @@ along with this program. If not, see . // own #include "client.h" // kwin -#ifdef KWIN_BUILD_KAPPMENU -#include "appmenu.h" -#endif #include "atoms.h" #include "bridge.h" #include "client_machine.h" @@ -126,9 +123,6 @@ Client::Client() , electricMaximizing(false) , needsSessionInteract(false) , needsXWindowMove(false) -#ifdef KWIN_BUILD_KAPPMENU - , m_menuAvailable(false) -#endif , m_decoInputExtent() { // TODO: Do all as initialization @@ -448,12 +442,6 @@ void Client::createDecoration(const QRect& oldgeom) decoration, SLOT(maximizeChange())); connect(this, SIGNAL(keepAboveChanged(bool)), decoration, SIGNAL(keepAboveChanged(bool))); connect(this, SIGNAL(keepBelowChanged(bool)), decoration, SIGNAL(keepBelowChanged(bool))); -#ifdef KWIN_BUILD_KAPPMENU - connect(this, SIGNAL(showRequest()), decoration, SIGNAL(showRequest())); - connect(this, SIGNAL(appMenuAvailable()), decoration, SIGNAL(appMenuAvailable())); - connect(this, SIGNAL(appMenuUnavailable()), decoration, SIGNAL(appMenuUnavailable())); - connect(this, SIGNAL(menuHidden()), decoration, SIGNAL(menuHidden())); -#endif // TODO: Check decoration's minimum size? decoration->init(); decoration->widget()->installEventFilter(this); @@ -2246,25 +2234,6 @@ bool Client::isClient() const return true; } -#ifdef KWIN_BUILD_KAPPMENU -void Client::setAppMenuAvailable() -{ - m_menuAvailable = true; - emit appMenuAvailable(); -} - -void Client::setAppMenuUnavailable() -{ - m_menuAvailable = false; - emit appMenuUnavailable(); -} - -void Client::showApplicationMenu(const QPoint &p) -{ - ApplicationMenu::self()->showApplicationMenu(p, window()); -} -#endif - NET::WindowType Client::windowType(bool direct, int supportedTypes) const { // TODO: does it make sense to cache the returned window type for SUPPORTED_MANAGED_WINDOW_TYPES_MASK? diff --git a/kwin/client.h b/kwin/client.h index e518f2c9..f1e5e3bc 100644 --- a/kwin/client.h +++ b/kwin/client.h @@ -624,22 +624,6 @@ public: // a helper for the workspace window packing. tests for screen validity and updates since in maximization case as with normal moving void packTo(int left, int top); -#ifdef KWIN_BUILD_KAPPMENU - // Used by workspace - void emitShowRequest() { - emit showRequest(); - } - void emitMenuHidden() { - emit menuHidden(); - } - void setAppMenuAvailable(); - void setAppMenuUnavailable(); - void showApplicationMenu(const QPoint&); - bool menuAvailable() { - return m_menuAvailable; - } -#endif - template void print(T &stream) const; @@ -734,23 +718,6 @@ signals: **/ void tabGroupChanged(); - /** - * Emitted whenever the Client want to show it menu - */ - void showRequest(); - /** - * Emitted whenever the Client's menu is closed - */ - void menuHidden(); - /** - * Emitted whenever the Client's menu is available - **/ - void appMenuAvailable(); - /** - * Emitted whenever the Client's menu is unavailable - */ - void appMenuUnavailable(); - /** * Emitted whenever the demands attention state changes. **/ @@ -977,9 +944,6 @@ private: bool needsSessionInteract; bool needsXWindowMove; -#ifdef KWIN_BUILD_KAPPMENU - bool m_menuAvailable; -#endif Xcb::Window m_decoInputExtent; QPoint input_offset; }; diff --git a/kwin/clients/aurorae/src/CMakeLists.txt b/kwin/clients/aurorae/src/CMakeLists.txt index 09499a9c..ad4848c2 100644 --- a/kwin/clients/aurorae/src/CMakeLists.txt +++ b/kwin/clients/aurorae/src/CMakeLists.txt @@ -38,13 +38,11 @@ install( FILES qml/Decoration.qml qml/DecorationButton.qml qml/MenuButton.qml - qml/AppMenuButton.qml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/aurorae ) install( FILES qml/Decoration.qml qml/DecorationButton.qml qml/MenuButton.qml - qml/AppMenuButton.qml qml/ButtonGroup.qml qml/qmldir DESTINATION ${KDE4_IMPORTS_INSTALL_DIR}/org/kde/kwin/decoration ) diff --git a/kwin/clients/aurorae/src/aurorae.cpp b/kwin/clients/aurorae/src/aurorae.cpp index 9778ebcc..3454558c 100644 --- a/kwin/clients/aurorae/src/aurorae.cpp +++ b/kwin/clients/aurorae/src/aurorae.cpp @@ -198,7 +198,6 @@ bool AuroraeFactory::supports(Ability ability) const case AbilityButtonShade: case AbilityButtonOnAllDesktops: case AbilityButtonHelp: - case AbilityButtonApplicationMenu: case AbilityProvidesShadow: return true; // TODO: correct value from theme case AbilityTabbing: @@ -247,8 +246,6 @@ AuroraeClient::AuroraeClient(KDecorationBridge *bridge, KDecorationFactory *fact connect(AuroraeFactory::instance(), SIGNAL(configChanged()), SIGNAL(configChanged())); connect(AuroraeFactory::instance(), SIGNAL(titleFontChanged()), SIGNAL(fontChanged())); connect(m_item, SIGNAL(alphaChanged()), SLOT(slotAlphaChanged())); - connect(this, SIGNAL(appMenuAvailable()), SIGNAL(appMenuAvailableChanged())); - connect(this, SIGNAL(appMenuUnavailable()), SIGNAL(appMenuAvailableChanged())); } AuroraeClient::~AuroraeClient() @@ -450,11 +447,6 @@ void AuroraeClient::menuClicked() showWindowMenu(QCursor::pos()); } -void AuroraeClient::appMenuClicked() -{ - showApplicationMenu(QCursor::pos()); -} - void AuroraeClient::toggleShade() { setShade(!isShade()); diff --git a/kwin/clients/aurorae/src/aurorae.h b/kwin/clients/aurorae/src/aurorae.h index fd47438b..47e821e2 100644 --- a/kwin/clients/aurorae/src/aurorae.h +++ b/kwin/clients/aurorae/src/aurorae.h @@ -106,7 +106,6 @@ class AuroraeClient : public KDecoration Q_PROPERTY(bool keepBelow READ keepBelow WRITE setKeepBelow NOTIFY keepBelowChangedWrapper) Q_PROPERTY(bool maximized READ isMaximized NOTIFY maximizeChanged) Q_PROPERTY(bool providesContextHelp READ providesContextHelp) - Q_PROPERTY(bool appMenu READ menuAvailable NOTIFY appMenuAvailableChanged) Q_PROPERTY(QRect transparentRect READ transparentRect) Q_PROPERTY(int width READ width) Q_PROPERTY(qulonglong windowId READ windowId CONSTANT) @@ -154,11 +153,9 @@ Q_SIGNALS: **/ void configChanged(); void fontChanged(); - void appMenuAvailableChanged(); public slots: void menuClicked(); - void appMenuClicked(); void toggleShade(); void toggleKeepAbove(); void toggleKeepBelow(); diff --git a/kwin/clients/aurorae/src/lib/auroraetheme.cpp b/kwin/clients/aurorae/src/lib/auroraetheme.cpp index 94f16ffc..d3c265a9 100644 --- a/kwin/clients/aurorae/src/lib/auroraetheme.cpp +++ b/kwin/clients/aurorae/src/lib/auroraetheme.cpp @@ -167,8 +167,6 @@ QLatin1String AuroraeTheme::mapButtonToName(AuroraeButtonType type) return QLatin1String("help"); case MenuButton: return QLatin1String("menu"); - case AppMenuButton: - return QLatin1String("appmenu"); default: return QLatin1String(""); } @@ -365,7 +363,6 @@ THEME_CONFIG(buttonWidthKeepBelow) THEME_CONFIG(buttonWidthShade) THEME_CONFIG(buttonWidthHelp) THEME_CONFIG(buttonWidthMenu) -THEME_CONFIG(buttonWidthAppMenu) THEME_CONFIG(buttonHeight) THEME_CONFIG(buttonSpacing) THEME_CONFIG(buttonMarginTop) diff --git a/kwin/clients/aurorae/src/lib/auroraetheme.h b/kwin/clients/aurorae/src/lib/auroraetheme.h index ff224763..ad013b84 100644 --- a/kwin/clients/aurorae/src/lib/auroraetheme.h +++ b/kwin/clients/aurorae/src/lib/auroraetheme.h @@ -42,8 +42,7 @@ enum AuroraeButtonType { KeepBelowButton, ShadeButton, HelpButton, - MenuButton, - AppMenuButton + MenuButton }; enum DecorationPosition { @@ -80,7 +79,6 @@ class /*LIBAURORAE_EXPORT*/ AuroraeTheme : public QObject Q_PROPERTY(int buttonWidthShade READ buttonWidthShade NOTIFY themeChanged) Q_PROPERTY(int buttonWidthHelp READ buttonWidthHelp NOTIFY themeChanged) Q_PROPERTY(int buttonWidthMenu READ buttonWidthMenu NOTIFY themeChanged) - Q_PROPERTY(int buttonWidthAppMenu READ buttonWidthAppMenu NOTIFY themeChanged) Q_PROPERTY(int buttonSpacing READ buttonSpacing NOTIFY themeChanged) Q_PROPERTY(int buttonMarginTop READ buttonMarginTop NOTIFY themeChanged) Q_PROPERTY(int explicitButtonSpacer READ explicitButtonSpacer NOTIFY themeChanged) @@ -140,7 +138,6 @@ public: int buttonWidthShade() const; int buttonWidthHelp() const; int buttonWidthMenu() const; - int buttonWidthAppMenu() const; int buttonHeight() const; int buttonSpacing() const; int buttonMarginTop() const; diff --git a/kwin/clients/aurorae/src/lib/themeconfig.cpp b/kwin/clients/aurorae/src/lib/themeconfig.cpp index f8613dac..799067ed 100644 --- a/kwin/clients/aurorae/src/lib/themeconfig.cpp +++ b/kwin/clients/aurorae/src/lib/themeconfig.cpp @@ -67,7 +67,6 @@ ThemeConfig::ThemeConfig() , m_buttonWidthShade(defaultButtonWidthShade()) , m_buttonWidthHelp(defaultButtonWidthHelp()) , m_buttonWidthMenu(defaultButtonWidthMenu()) - , m_buttonWidthAppMenu(defaultButtonWidthAppMenu()) , m_buttonHeight(defaultButtonHeight()) , m_buttonSpacing(defaultButtonSpacing()) , m_buttonMarginTop(defaultButtonMarginTop()) @@ -156,7 +155,6 @@ void ThemeConfig::load(const KConfig &conf) m_buttonWidthShade = border.readEntry("ButtonWidthShade", m_buttonWidth); m_buttonWidthHelp = border.readEntry("ButtonWidthHelp", m_buttonWidth); m_buttonWidthMenu = border.readEntry("ButtonWidthMenu", m_buttonWidth); - m_buttonWidthAppMenu = border.readEntry("ButtonWidthAppMenu", m_buttonWidthMenu); m_buttonHeight = border.readEntry("ButtonHeight", defaultButtonHeight()); m_buttonSpacing = border.readEntry("ButtonSpacing", defaultButtonSpacing()); m_buttonMarginTop = border.readEntry("ButtonMarginTop", defaultButtonMarginTop()); diff --git a/kwin/clients/aurorae/src/lib/themeconfig.h b/kwin/clients/aurorae/src/lib/themeconfig.h index 7fd64794..caeac446 100644 --- a/kwin/clients/aurorae/src/lib/themeconfig.h +++ b/kwin/clients/aurorae/src/lib/themeconfig.h @@ -145,9 +145,6 @@ public: int buttonWidthMenu() const { return m_buttonWidthMenu; } - int buttonWidthAppMenu() const { - return m_buttonWidthAppMenu; - } int buttonHeight() const { return m_buttonHeight; } @@ -311,9 +308,6 @@ public: static int defaultButtonWidthMenu() { return defaultButtonWidth(); } - static int defaultButtonWidthAppMenu() { - return defaultButtonWidthMenu(); - } static int defaultButtonHeight() { return 20; } @@ -395,7 +389,6 @@ private: int m_buttonWidthShade; int m_buttonWidthHelp; int m_buttonWidthMenu; - int m_buttonWidthAppMenu; int m_buttonHeight; int m_buttonSpacing; int m_buttonMarginTop; diff --git a/kwin/clients/aurorae/src/qml/AppMenuButton.qml b/kwin/clients/aurorae/src/qml/AppMenuButton.qml deleted file mode 100644 index 8e187822..00000000 --- a/kwin/clients/aurorae/src/qml/AppMenuButton.qml +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************** -Copyright (C) 2012 Martin Gräßlin - -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, see . -*********************************************************************/ -import QtQuick 1.1 -import org.kde.qtextracomponents 0.1 as QtExtra - -DecorationButton { - id: appMenuButton - buttonType: "N" - visible: decoration.appMenu - QtExtra.QIconItem { - icon: decoration.icon - anchors.fill: parent - } -} diff --git a/kwin/clients/aurorae/src/qml/AuroraeButton.qml b/kwin/clients/aurorae/src/qml/AuroraeButton.qml index 7282fd54..18d5caae 100644 --- a/kwin/clients/aurorae/src/qml/AuroraeButton.qml +++ b/kwin/clients/aurorae/src/qml/AuroraeButton.qml @@ -23,9 +23,6 @@ DecorationButton { case "M": // menu return auroraeTheme.buttonWidthMenu; - case "N": - // app menu - return auroraeTheme.buttonWidthAppMenu; case "S": // all desktops return auroraeTheme.buttonWidthAllDesktops; diff --git a/kwin/clients/aurorae/src/qml/AuroraeButtonGroup.qml b/kwin/clients/aurorae/src/qml/AuroraeButtonGroup.qml index c49975f7..7bf11dc6 100644 --- a/kwin/clients/aurorae/src/qml/AuroraeButtonGroup.qml +++ b/kwin/clients/aurorae/src/qml/AuroraeButtonGroup.qml @@ -27,9 +27,6 @@ Item { } else if (buttons.charAt(i) == "M") { Qt.createQmlObject("import QtQuick 1.1; MenuButton { width: auroraeTheme.buttonWidthMenu * auroraeTheme.buttonSizeFactor; height: auroraeTheme.buttonHeight * auroraeTheme.buttonSizeFactor }", groupRow, "menuButton" + buttons + i); - } else if (buttons.charAt(i) == "N") { - Qt.createQmlObject("import QtQuick 1.1; AppMenuButton { width: auroraeTheme.buttonWidthAppMenu * auroraeTheme.buttonSizeFactor; height: auroraeTheme.buttonHeight * auroraeTheme.buttonSizeFactor }", - groupRow, "appMenuButton" + buttons + i); } else if (buttons.charAt(i) == "A") { var maximizeComponent = Qt.createComponent("AuroraeMaximizeButton.qml"); maximizeComponent.createObject(groupRow); diff --git a/kwin/clients/aurorae/src/qml/ButtonGroup.qml b/kwin/clients/aurorae/src/qml/ButtonGroup.qml index 36b1f949..be2156de 100644 --- a/kwin/clients/aurorae/src/qml/ButtonGroup.qml +++ b/kwin/clients/aurorae/src/qml/ButtonGroup.qml @@ -45,9 +45,6 @@ Item { case "M": component = group.menuButton; break; - case "N": - component = group.appMenuButton; - break; case "S": component = group.allDesktopsButton; break; @@ -73,7 +70,6 @@ Item { property variant keepBelowButton property variant maximizeButton property variant menuButton - property variant appMenuButton property variant minimizeButton property variant allDesktopsButton property variant shadeButton diff --git a/kwin/clients/aurorae/src/qml/DecorationButton.qml b/kwin/clients/aurorae/src/qml/DecorationButton.qml index bf816bcc..d61dcc9f 100644 --- a/kwin/clients/aurorae/src/qml/DecorationButton.qml +++ b/kwin/clients/aurorae/src/qml/DecorationButton.qml @@ -62,10 +62,6 @@ Item { // menu decoration.menuClicked(); break; - case "N": - // app menu - decoration.appMenuClicked(); - break; case "S": // all desktops decoration.toggleOnAllDesktops(); diff --git a/kwin/clients/aurorae/src/qml/qmldir b/kwin/clients/aurorae/src/qml/qmldir index 3c36d774..a509471b 100644 --- a/kwin/clients/aurorae/src/qml/qmldir +++ b/kwin/clients/aurorae/src/qml/qmldir @@ -3,5 +3,4 @@ plugin decorationplugin Decoration 0.1 Decoration.qml DecorationButton 0.1 DecorationButton.qml MenuButton 0.1 MenuButton.qml -AppMenuButton 0.1 AppMenuButton.qml ButtonGroup 0.1 ButtonGroup.qml diff --git a/kwin/clients/aurorae/themes/plastik/code/plastikbutton.cpp b/kwin/clients/aurorae/themes/plastik/code/plastikbutton.cpp index fae1a05d..db08e2a4 100644 --- a/kwin/clients/aurorae/themes/plastik/code/plastikbutton.cpp +++ b/kwin/clients/aurorae/themes/plastik/code/plastikbutton.cpp @@ -91,8 +91,6 @@ QPixmap PlastikButtonProvider::requestPixmap(const QString &id, QSize *size, con } else { button = ShadeIcon; } - } else if (idParts[0] == "N") { - button = AppMenuIcon; } else { // not recognized icon return QDeclarativeImageProvider::requestPixmap(id, size, requestedSize); @@ -362,13 +360,6 @@ QPixmap PlastikButtonProvider::icon(ButtonIcon icon, int size, bool active, bool break; } - case AppMenuIcon: - { - drawObject(p, HorizontalLine, r.x(), r.top()+(lwTitleBar-1), r.width(), lwTitleBar); - drawObject(p, HorizontalLine, r.x(), r.center().y(), r.width(), lwTitleBar); - drawObject(p, HorizontalLine, r.x(), r.bottom()-(lwTitleBar-1), r.width(), lwTitleBar); - break; - } default: break; diff --git a/kwin/clients/aurorae/themes/plastik/code/plastikbutton.h b/kwin/clients/aurorae/themes/plastik/code/plastikbutton.h index 6a646863..0daa5fd2 100644 --- a/kwin/clients/aurorae/themes/plastik/code/plastikbutton.h +++ b/kwin/clients/aurorae/themes/plastik/code/plastikbutton.h @@ -44,7 +44,6 @@ private: NoKeepBelowIcon, ShadeIcon, UnShadeIcon, - AppMenuIcon, NumButtonIcons }; enum Object { diff --git a/kwin/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml b/kwin/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml index 1b3c2150..6a065463 100644 --- a/kwin/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml +++ b/kwin/clients/aurorae/themes/plastik/package/contents/ui/PlastikButton.qml @@ -143,19 +143,11 @@ DecorationButton { if (buttonType == "H") { visible = decoration.providesContextHelp; } - if (buttonType == "N") { - visible = decoration.appMenu; - } } onHoveredChanged: colorize() onPressedChanged: colorize() Connections { target: decoration onActiveChanged: button.colorize() - onAppMenuChanged: { - if (buttonType == "N") { - visible = decoration.appMenu; - } - } } } diff --git a/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml b/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml index 77676bf5..bc2cd929 100644 --- a/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml +++ b/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml @@ -254,7 +254,6 @@ Decoration { spacing: 1 explicitSpacer: root.buttonSize menuButton: menuButtonComponent - appMenuButton: appMenuButtonComponent minimizeButton: minimizeButtonComponent maximizeButton: maximizeButtonComponent keepBelowButton: keepBelowButtonComponent @@ -295,7 +294,6 @@ Decoration { spacing: 1 explicitSpacer: root.buttonSize menuButton: menuButtonComponent - appMenuButton: appMenuButtonComponent minimizeButton: minimizeButtonComponent maximizeButton: maximizeButtonComponent keepBelowButton: keepBelowButtonComponent @@ -409,13 +407,6 @@ Decoration { height: root.buttonSize } } - Component { - id: appMenuButtonComponent - PlastikButton { - buttonType: "N" - size: root.buttonSize - } - } Component.onCompleted: { borders.setBorders(4); borders.setTitle(top.normalHeight); diff --git a/kwin/clients/oxygen/oxygenbutton.cpp b/kwin/clients/oxygen/oxygenbutton.cpp index e90cdf1b..01a9ec33 100644 --- a/kwin/clients/oxygen/oxygenbutton.cpp +++ b/kwin/clients/oxygen/oxygenbutton.cpp @@ -205,11 +205,8 @@ namespace Oxygen //___________________________________________________ void Button::mouseReleaseEvent( QMouseEvent* event ) { - if (_type != ButtonApplicationMenu) - { - _status &= ~Pressed; - parentUpdate(); - } + _status &= ~Pressed; + parentUpdate(); KCommonDecorationButton::mouseReleaseEvent( event ); } @@ -307,68 +304,62 @@ namespace Oxygen { case ButtonSticky: - painter->drawPoint(QPointF(10.5,10.5)); - break; - - case ButtonHelp: - painter->translate(1.5, 1.5); - painter->drawArc(7,5,4,4,135*16, -180*16); - painter->drawArc(9,8,4,4,135*16,45*16); - painter->drawPoint(9,12); - painter->translate(-1.5, -1.5); - break; - - case ButtonApplicationMenu: - painter->drawLine(QPointF(7.5, 7.5), QPointF(13.5, 7.5)); - painter->drawLine(QPointF(7.5, 10.5), QPointF(13.5, 10.5)); - painter->drawLine(QPointF(7.5, 13.5), QPointF(13.5, 13.5)); - break; - - case ButtonMin: - painter->drawLine(QPointF( 7.5, 9.5), QPointF(10.5,12.5)); - painter->drawLine(QPointF(10.5,12.5), QPointF(13.5, 9.5)); - break; - - case ButtonMax: - switch(_client.maximizeMode()) - { - case Client::MaximizeRestore: - case Client::MaximizeVertical: - case Client::MaximizeHorizontal: - painter->drawLine(QPointF( 7.5,11.5), QPointF(10.5, 8.5)); - painter->drawLine(QPointF(10.5, 8.5), QPointF(13.5,11.5)); + painter->drawPoint(QPointF(10.5,10.5)); break; - case Client::MaximizeFull: + case ButtonHelp: + painter->translate(1.5, 1.5); + painter->drawArc(7,5,4,4,135*16, -180*16); + painter->drawArc(9,8,4,4,135*16,45*16); + painter->drawPoint(9,12); + painter->translate(-1.5, -1.5); + break; + + case ButtonMin: + painter->drawLine(QPointF( 7.5, 9.5), QPointF(10.5,12.5)); + painter->drawLine(QPointF(10.5,12.5), QPointF(13.5, 9.5)); + break; + + case ButtonMax: + switch(_client.maximizeMode()) { - painter->translate(1.5, 1.5); - QPoint points[4] = {QPoint(9, 6), QPoint(12, 9), QPoint(9, 12), QPoint(6, 9)}; - painter->drawPolygon(points, 4); - painter->translate(-1.5, -1.5); - break; + case Client::MaximizeRestore: + case Client::MaximizeVertical: + case Client::MaximizeHorizontal: + painter->drawLine(QPointF( 7.5,11.5), QPointF(10.5, 8.5)); + painter->drawLine(QPointF(10.5, 8.5), QPointF(13.5,11.5)); + break; + + case Client::MaximizeFull: + { + painter->translate(1.5, 1.5); + QPoint points[4] = {QPoint(9, 6), QPoint(12, 9), QPoint(9, 12), QPoint(6, 9)}; + painter->drawPolygon(points, 4); + painter->translate(-1.5, -1.5); + break; + } } - } - break; + break; case ButtonItemClose: case ButtonClose: - painter->drawLine(QPointF( 7.5,7.5), QPointF(13.5,13.5)); - painter->drawLine(QPointF(13.5,7.5), QPointF( 7.5,13.5)); - break; + painter->drawLine(QPointF( 7.5,7.5), QPointF(13.5,13.5)); + painter->drawLine(QPointF(13.5,7.5), QPointF( 7.5,13.5)); + break; case ButtonAbove: - painter->drawLine(QPointF( 7.5,14), QPointF(10.5,11)); - painter->drawLine(QPointF(10.5,11), QPointF(13.5,14)); - painter->drawLine(QPointF( 7.5,10), QPointF(10.5, 7)); - painter->drawLine(QPointF(10.5, 7), QPointF(13.5,10)); - break; + painter->drawLine(QPointF( 7.5,14), QPointF(10.5,11)); + painter->drawLine(QPointF(10.5,11), QPointF(13.5,14)); + painter->drawLine(QPointF( 7.5,10), QPointF(10.5, 7)); + painter->drawLine(QPointF(10.5, 7), QPointF(13.5,10)); + break; case ButtonBelow: - painter->drawLine(QPointF( 7.5,11), QPointF(10.5,14)); - painter->drawLine(QPointF(10.5,14), QPointF(13.5,11)); - painter->drawLine(QPointF( 7.5, 7), QPointF(10.5,10)); - painter->drawLine(QPointF(10.5,10), QPointF(13.5, 7)); - break; + painter->drawLine(QPointF( 7.5,11), QPointF(10.5,14)); + painter->drawLine(QPointF(10.5,14), QPointF(13.5,11)); + painter->drawLine(QPointF( 7.5, 7), QPointF(10.5,10)); + painter->drawLine(QPointF(10.5,10), QPointF(13.5, 7)); + break; case ButtonShade: if (!isChecked()) @@ -396,10 +387,4 @@ namespace Oxygen return; } - void Button::slotAppMenuHidden() - { - _status = Normal; - update(); - } - } diff --git a/kwin/clients/oxygen/oxygenbutton.h b/kwin/clients/oxygen/oxygenbutton.h index a82d5fa5..d4f99940 100644 --- a/kwin/clients/oxygen/oxygenbutton.h +++ b/kwin/clients/oxygen/oxygenbutton.h @@ -160,9 +160,6 @@ namespace Oxygen //@} - private slots: - void slotAppMenuHidden(); - private: //! parent client diff --git a/kwin/clients/oxygen/oxygenclient.cpp b/kwin/clients/oxygen/oxygenclient.cpp index 70f53368..b7b88948 100644 --- a/kwin/clients/oxygen/oxygenclient.cpp +++ b/kwin/clients/oxygen/oxygenclient.cpp @@ -187,9 +187,6 @@ namespace Oxygen case MenuButton: return new Button(*this, i18n("Window Actions Menu"), ButtonMenu); - case AppMenuButton: - return new Button(*this, i18n("Application Menu"), ButtonApplicationMenu); - case HelpButton: return new Button(*this, i18n("Help"), ButtonHelp); diff --git a/kwin/clients/oxygen/oxygendecorationdefines.h b/kwin/clients/oxygen/oxygendecorationdefines.h index 98a51ab3..b12716e3 100644 --- a/kwin/clients/oxygen/oxygendecorationdefines.h +++ b/kwin/clients/oxygen/oxygendecorationdefines.h @@ -49,7 +49,6 @@ namespace Oxygen ButtonAbove, ButtonBelow, ButtonShade, - ButtonApplicationMenu, ButtonTypeCount, // Close only one tab diff --git a/kwin/clients/oxygen/oxygenfactory.cpp b/kwin/clients/oxygen/oxygenfactory.cpp index 3b424204..3563c319 100644 --- a/kwin/clients/oxygen/oxygenfactory.cpp +++ b/kwin/clients/oxygen/oxygenfactory.cpp @@ -117,7 +117,6 @@ namespace Oxygen { // buttons case AbilityButtonMenu: - case AbilityButtonApplicationMenu: case AbilityButtonHelp: case AbilityButtonMinimize: case AbilityButtonMaximize: diff --git a/kwin/config-kwin.h.cmake b/kwin/config-kwin.h.cmake index 69485572..fe60650c 100644 --- a/kwin/config-kwin.h.cmake +++ b/kwin/config-kwin.h.cmake @@ -1,6 +1,5 @@ #cmakedefine KWIN_BUILD_TABBOX 1 #cmakedefine KWIN_BUILD_SCREENEDGES 1 -#cmakedefine KWIN_BUILD_KAPPMENU 1 #cmakedefine KWIN_BUILD_OXYGEN 1 #cmakedefine KWIN_BUILD_COMPOSITE 1 #define KWIN_VERSION_STRING "${KDE_VERSION_STRING}" diff --git a/kwin/kcmkwin/kwindecoration/buttons.cpp b/kwin/kcmkwin/kwindecoration/buttons.cpp index dd89c8a4..fbd5c2ea 100644 --- a/kwin/kcmkwin/kwindecoration/buttons.cpp +++ b/kwin/kcmkwin/kwindecoration/buttons.cpp @@ -43,11 +43,6 @@ #include #include -#ifdef KWIN_BUILD_KAPPMENU -#include -#include -#endif - #include @@ -688,16 +683,6 @@ ButtonPositionWidget::ButtonPositionWidget(QWidget *parent) bool dummy; m_supportedButtons = "MSHIAX_FBLR"; -#ifdef KWIN_BUILD_KAPPMENU - KConfig config("kdeglobals", KConfig::FullConfig); - KConfigGroup configGroup = config.group("Appmenu Style"); - QString style = configGroup.readEntry("Style", "InApplication"); - - if (style == "ButtonVertical") { - m_supportedButtons = "MNSHIAX_FBLR"; // support all buttons - new ButtonSourceItem(m_buttonSource, getButton('N', dummy)); - } -#endif new ButtonSourceItem(m_buttonSource, getButton('R', dummy)); new ButtonSourceItem(m_buttonSource, getButton('L', dummy)); @@ -760,12 +745,6 @@ Button ButtonPositionWidget::getButton(QChar type, bool& success) QBitmap bmp = QBitmap::fromData(QSize(menu_width, menu_height), menu_bits); bmp.createMaskFromColor(Qt::white); return Button(i18nc("Button showing window actions menu", "Window Menu"), bmp, 'M', false, m_supportedButtons.contains('M')); -#ifdef KWIN_BUILD_KAPPMENU - } else if (type == 'N') { - QBitmap bmp = QBitmap::fromData(QSize(menu_width, menu_height), menu_bits); - bmp.createMaskFromColor(Qt::white); - return Button(i18nc("Button showing application menu imported from dbusmenu", "Application Menu"), bmp, 'N', false, m_supportedButtons.contains('N')); -#endif } else if (type == '_') { QBitmap bmp = QBitmap::fromData(QSize(spacer_width, spacer_height), spacer_bits); bmp.createMaskFromColor(Qt::white); diff --git a/kwin/kcmkwin/kwindecoration/preview.cpp b/kwin/kcmkwin/kwindecoration/preview.cpp index ffdb8b53..3e38e59d 100644 --- a/kwin/kcmkwin/kwindecoration/preview.cpp +++ b/kwin/kcmkwin/kwindecoration/preview.cpp @@ -299,15 +299,6 @@ void KDecorationPreviewBridge::showWindowMenu(const QPoint &) { } -void KDecorationPreviewBridge::showApplicationMenu(const QPoint &) -{ -} - -bool KDecorationPreviewBridge::menuAvailable() const -{ - return false; -} - void KDecorationPreviewBridge::performWindowOperation(WindowOperation) { } diff --git a/kwin/kcmkwin/kwindecoration/preview.h b/kwin/kcmkwin/kwindecoration/preview.h index 1e9263f9..d1ac6309 100644 --- a/kwin/kcmkwin/kwindecoration/preview.h +++ b/kwin/kcmkwin/kwindecoration/preview.h @@ -86,8 +86,6 @@ public: virtual void processMousePressEvent(QMouseEvent*); virtual void showWindowMenu(const QRect &); virtual void showWindowMenu(const QPoint &); - virtual void showApplicationMenu(const QPoint &); - virtual bool menuAvailable() const; virtual void performWindowOperation(WindowOperation); virtual void setMask(const QRegion&, int); virtual bool isPreview() const; diff --git a/kwin/kcmkwin/kwindecoration/qml/AuroraeDecoration.qml b/kwin/kcmkwin/kwindecoration/qml/AuroraeDecoration.qml index b50e94ee..e8108264 100644 --- a/kwin/kcmkwin/kwindecoration/qml/AuroraeDecoration.qml +++ b/kwin/kcmkwin/kwindecoration/qml/AuroraeDecoration.qml @@ -41,7 +41,6 @@ Item { property bool keepBelow: false property bool maximized: false property bool providesContextHelp: true - property bool appMenu: true property string leftButtons: "MS" property string rightButtons: "HIA__X" function titleMouseMoved() {} diff --git a/kwin/libkdecorations/kcommondecoration.cpp b/kwin/libkdecorations/kcommondecoration.cpp index 9714ccd5..88f49f00 100644 --- a/kwin/libkdecorations/kcommondecoration.cpp +++ b/kwin/libkdecorations/kcommondecoration.cpp @@ -393,27 +393,6 @@ void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const QString& m_button[MenuButton] = btn; } break; - case 'N': // Application Menu button - if (!m_button[AppMenuButton]) { - btn = createButton(AppMenuButton); - if (!btn) break; - btn->setTipText(i18nc("Button showing application menu", "Application Menu")); - btn->setRealizeButtons(Qt::LeftButton); - connect(btn, SIGNAL(clicked()), SLOT(appMenuButtonPressed()), Qt::QueuedConnection); - // Application want to show it menu - connect(decoration(), SIGNAL(showRequest()), this, SLOT(appMenuButtonPressed()), Qt::UniqueConnection); - // Wait for menu to become available before displaying any button - connect(decoration(), SIGNAL(appMenuAvailable()), this, SLOT(slotAppMenuAvailable()), Qt::UniqueConnection); - // On Kded module shutdown, hide application menu button - connect(decoration(), SIGNAL(appMenuUnavailable()), this, SLOT(slotAppMenuUnavailable()), Qt::UniqueConnection); - // Application menu button may need to be modified on this signal - connect(decoration(), SIGNAL(menuHidden()), btn, SLOT(slotAppMenuHidden()), Qt::UniqueConnection); - - // fix double deletion, see objDestroyed() - connect(btn, SIGNAL(destroyed(QObject*)), this, SLOT(objDestroyed(QObject*))); - m_button[AppMenuButton] = btn; - } - break; case 'S': // OnAllDesktops button if (!m_button[OnAllDesktopsButton]) { btn = createButton(OnAllDesktopsButton); @@ -542,12 +521,7 @@ void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const QString& if (btn) { btn->setLeft(isLeft); btn->setSize(QSize(layoutMetric(LM_ButtonWidth, true, btn), layoutMetric(LM_ButtonHeight, true, btn))); - // will be shown later on window registration - if (btn->type() == AppMenuButton && !isPreview() && !wrapper->menuAvailable()) { - btn->hide(); - } else { - btn->show(); - } + btn->show(); btnContainer.append(btn); } @@ -564,7 +538,7 @@ void KCommonDecoration::calcHiddenButtons() btnHideLastWidth = width(); //Hide buttons in the following order: - KCommonDecorationButton* btnArray[] = { m_button[HelpButton], m_button[AppMenuButton], m_button[ShadeButton], m_button[BelowButton], + KCommonDecorationButton* btnArray[] = { m_button[HelpButton], m_button[ShadeButton], m_button[BelowButton], m_button[AboveButton], m_button[OnAllDesktopsButton], m_button[MaxButton], m_button[MinButton], m_button[MenuButton], m_button[CloseButton] }; @@ -589,8 +563,7 @@ void KCommonDecoration::calcHiddenButtons() if (! btnArray[i]->isHidden()) break; // all buttons shown... - if (btnArray[i]->type() != AppMenuButton || wrapper->menuAvailable()) - btnArray[i]->show(); + btnArray[i]->show(); } } } @@ -788,34 +761,6 @@ void KCommonDecoration::doShowWindowMenu() showWindowMenu(QRect(menutop, menubottom)); } - -void KCommonDecoration::appMenuButtonPressed() -{ - QRect menuRect = m_button[AppMenuButton]->rect(); - wrapper->showApplicationMenu(m_button[AppMenuButton]->mapToGlobal(menuRect.bottomLeft())); - - KDecorationFactory* f = factory(); - if (!f->exists(decoration())) // 'this' was deleted - return; - m_button[AppMenuButton]->setDown(false); -} - -void KCommonDecoration::slotAppMenuAvailable() -{ - if (m_button[AppMenuButton]) { - m_button[AppMenuButton]->show(); - updateLayout(); - } -} - -void KCommonDecoration::slotAppMenuUnavailable() -{ - if (m_button[AppMenuButton]) { - m_button[AppMenuButton]->hide(); - updateLayout(); - } -} - void KCommonDecoration::resizeEvent(QResizeEvent */*e*/) { if (decorationBehaviour(DB_ButtonHide)) diff --git a/kwin/libkdecorations/kcommondecoration.h b/kwin/libkdecorations/kcommondecoration.h index 09753f38..feb99a95 100644 --- a/kwin/libkdecorations/kcommondecoration.h +++ b/kwin/libkdecorations/kcommondecoration.h @@ -46,7 +46,6 @@ enum ButtonType { AboveButton, BelowButton, ShadeButton, - AppMenuButton, NumButtons, ItemCloseButton = 100, // Close only one tab ItemMenuButton // shows the window menu for one tab @@ -270,9 +269,7 @@ public Q_SLOTS: void slotKeepBelow(); void menuButtonPressed(); void menuButtonReleased(); - void appMenuButtonPressed(); - void slotAppMenuAvailable(); - void slotAppMenuUnavailable(); + public: virtual Position mousePosition(const QPoint &point) const; diff --git a/kwin/libkdecorations/kdecoration.cpp b/kwin/libkdecorations/kdecoration.cpp index 5446d5b0..e1cd8947 100644 --- a/kwin/libkdecorations/kdecoration.cpp +++ b/kwin/libkdecorations/kdecoration.cpp @@ -227,16 +227,6 @@ void KDecoration::showWindowMenu(QPoint pos) bridge_->showWindowMenu(pos); } -void KDecoration::showApplicationMenu(const QPoint &p) -{ - bridge_->showApplicationMenu(p); -} - -bool KDecoration::menuAvailable() const -{ - return bridge_->menuAvailable(); -} - void KDecoration::performWindowOperation(WindowOperation op) { bridge_->performWindowOperation(op); diff --git a/kwin/libkdecorations/kdecoration.h b/kwin/libkdecorations/kdecoration.h index 19390f2b..034fea77 100644 --- a/kwin/libkdecorations/kdecoration.h +++ b/kwin/libkdecorations/kdecoration.h @@ -204,22 +204,21 @@ public: AbilityButtonBelowOthers = 8, ///< decoration supports a below button AbilityButtonShade = 9, ///< decoration supports a shade button AbilityButtonResize = 10, ///< decoration supports a resize button - AbilityButtonApplicationMenu = 11, ///< decoration supports the application menu button // compositing - AbilityProvidesShadow = 12, ///< The decoration draws its own shadows. + AbilityProvidesShadow = 11, ///< The decoration draws its own shadows. /// @since 4.3 - AbilityUsesAlphaChannel = 13, ///< The decoration isn't clipped to the mask when compositing is enabled. + AbilityUsesAlphaChannel = 12, ///< The decoration isn't clipped to the mask when compositing is enabled. /// The mask is still used to define the input region and the blurred /// region, when the blur plugin is enabled. /// @since 4.3 - AbilityExtendIntoClientArea = 14, ///< The decoration respects transparentRect() + AbilityExtendIntoClientArea = 13, ///< The decoration respects transparentRect() /// @since 4.4 - AbilityUsesBlurBehind = 15, ///< The decoration wants the background to be blurred, when the blur plugin is enabled. + AbilityUsesBlurBehind = 14, ///< The decoration wants the background to be blurred, when the blur plugin is enabled. /// @since 4.6 - AbilityAnnounceAlphaChannel = 16, ///< The decoration can tell whether it currently uses an alpha channel or not. Requires AbilityUsesAlphaChannel. + AbilityAnnounceAlphaChannel = 15, ///< The decoration can tell whether it currently uses an alpha channel or not. Requires AbilityUsesAlphaChannel. /// @since 4.10 // Tabbing - AbilityTabbing = 17, ///< The decoration supports tabbing + AbilityTabbing = 16, ///< The decoration supports tabbing }; /** @@ -309,7 +308,6 @@ public: * If customButtonPositions() returns true, titleButtonsLeft * returns which buttons should be on the left side of the titlebar from left * to right. Characters in the returned string have this meaning : - * @li 'N' application menu button * @li 'M' window menu button * @li 'S' on_all_desktops button * @li 'H' quickhelp button @@ -578,14 +576,6 @@ public: * Overloaded version of the above. */ void showWindowMenu(QPoint pos); - /** - * show application menu at p - */ - void showApplicationMenu(const QPoint& p); - /** - * Returns @a true if menu available for client - */ - bool menuAvailable() const; /** * This function performs the given window operation. This function may destroy * the current decoration object, just like showWindowMenu(). @@ -855,24 +845,6 @@ Q_SIGNALS: */ void keepBelowChanged(bool); - /** - * This signal is emitted whenever application menu is closed - * Application menu button may need to be modified on this signal - */ - void menuHidden(); - /** - * This signal is emitted whenever application want to show it menu - */ - void showRequest(); - /** - * This signal is emitted whenever application menu becomes available - */ - void appMenuAvailable(); - /** - * This signal is emitted whenever application menu becomes unavailable - */ - void appMenuUnavailable(); - /** * This signal is emitted whenever the decoration changes it's alpha enabled * change. Only relevant in case the decoration provides AbilityAnnounceAlphaChannel. diff --git a/kwin/libkdecorations/kdecorationbridge.h b/kwin/libkdecorations/kdecorationbridge.h index a1e572ba..910dbcfc 100644 --- a/kwin/libkdecorations/kdecorationbridge.h +++ b/kwin/libkdecorations/kdecorationbridge.h @@ -60,8 +60,6 @@ public: virtual void processMousePressEvent(QMouseEvent*) = 0; virtual void showWindowMenu(const QRect &) = 0; virtual void showWindowMenu(const QPoint &) = 0; - virtual void showApplicationMenu(const QPoint&) = 0; - virtual bool menuAvailable() const = 0; virtual void performWindowOperation(WindowOperation) = 0; virtual void setMask(const QRegion&, int) = 0; virtual bool isPreview() const = 0; diff --git a/kwin/workspace.cpp b/kwin/workspace.cpp index 2a546aaa..45d78e1d 100644 --- a/kwin/workspace.cpp +++ b/kwin/workspace.cpp @@ -23,9 +23,6 @@ along with this program. If not, see . // kwin libs #include // kwin -#ifdef KWIN_BUILD_KAPPMENU -#include "appmenu.h" -#endif #include "atoms.h" #include "client.h" #include "composite.h" @@ -134,10 +131,6 @@ Workspace::Workspace(bool restore) // If KWin was already running it saved its configuration after loosing the selection -> Reread QFuture reparseConfigFuture = QtConcurrent::run(options, &Options::reparseConfiguration); -#ifdef KWIN_BUILD_KAPPMENU - ApplicationMenu::create(this); -#endif - _self = this; // first initialize the extensions @@ -518,10 +511,6 @@ void Workspace::addClient(Client* c) if (TabBox::TabBox::self()->isDisplayed()) TabBox::TabBox::self()->reset(true); #endif -#ifdef KWIN_BUILD_KAPPMENU - if (ApplicationMenu::self()->hasMenu(c->window())) - c->setAppMenuAvailable(); -#endif } void Workspace::addUnmanaged(Unmanaged* c)