diff --git a/clients/aurorae/src/CMakeLists.txt b/clients/aurorae/src/CMakeLists.txt index 41ab990a00..0427013965 100644 --- a/clients/aurorae/src/CMakeLists.txt +++ b/clients/aurorae/src/CMakeLists.txt @@ -41,11 +41,13 @@ install( FILES qml/Decoration.qml qml/DecorationButton.qml qml/MenuButton.qml + qml/AppMenuButton.qml DESTINATION ${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 ${IMPORTS_INSTALL_DIR}/org/kde/kwin/decoration ) diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index 7308e62c12..aaa52bfd87 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -192,6 +192,7 @@ 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: @@ -240,6 +241,8 @@ 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() @@ -441,6 +444,11 @@ void AuroraeClient::menuClicked() showWindowMenu(QCursor::pos()); } +void AuroraeClient::appMenuClicked() +{ + showApplicationMenu(QCursor::pos()); +} + void AuroraeClient::toggleShade() { setShade(!isShade()); diff --git a/clients/aurorae/src/aurorae.h b/clients/aurorae/src/aurorae.h index 44c6007556..6e1a460462 100644 --- a/clients/aurorae/src/aurorae.h +++ b/clients/aurorae/src/aurorae.h @@ -106,6 +106,7 @@ class AuroraeClient : public KDecorationUnstable 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) @@ -150,9 +151,11 @@ Q_SIGNALS: **/ void configChanged(); void fontChanged(); + void appMenuAvailableChanged(); public slots: void menuClicked(); + void appMenuClicked(); void toggleShade(); void toggleKeepAbove(); void toggleKeepBelow(); diff --git a/clients/aurorae/src/lib/auroraetheme.cpp b/clients/aurorae/src/lib/auroraetheme.cpp index 0b199b3321..82844ff5d6 100644 --- a/clients/aurorae/src/lib/auroraetheme.cpp +++ b/clients/aurorae/src/lib/auroraetheme.cpp @@ -167,6 +167,8 @@ QLatin1String AuroraeTheme::mapButtonToName(AuroraeButtonType type) return QLatin1String("help"); case MenuButton: return QLatin1String("menu"); + case AppMenuButton: + return QLatin1String("appmenu"); default: return QLatin1String(""); } @@ -363,6 +365,7 @@ 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/clients/aurorae/src/lib/auroraetheme.h b/clients/aurorae/src/lib/auroraetheme.h index 84415f2906..07b28ceafc 100644 --- a/clients/aurorae/src/lib/auroraetheme.h +++ b/clients/aurorae/src/lib/auroraetheme.h @@ -42,7 +42,8 @@ enum AuroraeButtonType { KeepBelowButton, ShadeButton, HelpButton, - MenuButton + MenuButton, + AppMenuButton }; enum DecorationPosition { @@ -79,6 +80,7 @@ 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) @@ -138,6 +140,7 @@ 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/clients/aurorae/src/lib/themeconfig.cpp b/clients/aurorae/src/lib/themeconfig.cpp index 10a0f27f9a..216b023a9e 100644 --- a/clients/aurorae/src/lib/themeconfig.cpp +++ b/clients/aurorae/src/lib/themeconfig.cpp @@ -67,6 +67,7 @@ ThemeConfig::ThemeConfig() , m_buttonWidthShade(defaultButtonWidthShade()) , m_buttonWidthHelp(defaultButtonWidthHelp()) , m_buttonWidthMenu(defaultButtonWidthMenu()) + , m_buttonWidthAppMenu(defaultButtonWidthAppMenu()) , m_buttonHeight(defaultButtonHeight()) , m_buttonSpacing(defaultButtonSpacing()) , m_buttonMarginTop(defaultButtonMarginTop()) @@ -155,6 +156,7 @@ 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/clients/aurorae/src/lib/themeconfig.h b/clients/aurorae/src/lib/themeconfig.h index c44f6c860b..2f5eb98d54 100644 --- a/clients/aurorae/src/lib/themeconfig.h +++ b/clients/aurorae/src/lib/themeconfig.h @@ -145,6 +145,9 @@ public: int buttonWidthMenu() const { return m_buttonWidthMenu; } + int buttonWidthAppMenu() const { + return m_buttonWidthAppMenu; + } int buttonHeight() const { return m_buttonHeight; } @@ -308,6 +311,9 @@ public: static int defaultButtonWidthMenu() { return defaultButtonWidth(); } + static int defaultButtonWidthAppMenu() { + return defaultButtonWidthMenu(); + } static int defaultButtonHeight() { return 20; } @@ -389,6 +395,7 @@ 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/clients/aurorae/src/qml/AppMenuButton.qml b/clients/aurorae/src/qml/AppMenuButton.qml new file mode 100644 index 0000000000..8e187822b4 --- /dev/null +++ b/clients/aurorae/src/qml/AppMenuButton.qml @@ -0,0 +1,28 @@ +/******************************************************************** +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/clients/aurorae/src/qml/AuroraeButton.qml b/clients/aurorae/src/qml/AuroraeButton.qml index 18d5caaecf..7282fd549b 100644 --- a/clients/aurorae/src/qml/AuroraeButton.qml +++ b/clients/aurorae/src/qml/AuroraeButton.qml @@ -23,6 +23,9 @@ DecorationButton { case "M": // menu return auroraeTheme.buttonWidthMenu; + case "N": + // app menu + return auroraeTheme.buttonWidthAppMenu; case "S": // all desktops return auroraeTheme.buttonWidthAllDesktops; diff --git a/clients/aurorae/src/qml/AuroraeButtonGroup.qml b/clients/aurorae/src/qml/AuroraeButtonGroup.qml index 7c1bebe318..934a5db439 100644 --- a/clients/aurorae/src/qml/AuroraeButtonGroup.qml +++ b/clients/aurorae/src/qml/AuroraeButtonGroup.qml @@ -27,6 +27,9 @@ 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/clients/aurorae/src/qml/ButtonGroup.qml b/clients/aurorae/src/qml/ButtonGroup.qml index be2156de43..36b1f94936 100644 --- a/clients/aurorae/src/qml/ButtonGroup.qml +++ b/clients/aurorae/src/qml/ButtonGroup.qml @@ -45,6 +45,9 @@ Item { case "M": component = group.menuButton; break; + case "N": + component = group.appMenuButton; + break; case "S": component = group.allDesktopsButton; break; @@ -70,6 +73,7 @@ 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/clients/aurorae/src/qml/DecorationButton.qml b/clients/aurorae/src/qml/DecorationButton.qml index d61dcc9f4f..bf816bcc3a 100644 --- a/clients/aurorae/src/qml/DecorationButton.qml +++ b/clients/aurorae/src/qml/DecorationButton.qml @@ -62,6 +62,10 @@ Item { // menu decoration.menuClicked(); break; + case "N": + // app menu + decoration.appMenuClicked(); + break; case "S": // all desktops decoration.toggleOnAllDesktops(); diff --git a/clients/aurorae/src/qml/qmldir b/clients/aurorae/src/qml/qmldir index a509471b7d..3c36d7748c 100644 --- a/clients/aurorae/src/qml/qmldir +++ b/clients/aurorae/src/qml/qmldir @@ -3,4 +3,5 @@ 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/kcmkwin/kwindecoration/qml/AuroraeDecoration.qml b/kcmkwin/kwindecoration/qml/AuroraeDecoration.qml index e8108264b3..b50e94ee5b 100644 --- a/kcmkwin/kwindecoration/qml/AuroraeDecoration.qml +++ b/kcmkwin/kwindecoration/qml/AuroraeDecoration.qml @@ -41,6 +41,7 @@ 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() {}