From 46d0116dd54576ed7ca53924bb19a7c147be38c5 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 7 Jun 2012 12:28:25 -0700 Subject: [PATCH] Added hidden configuration option to enable/disable closing windows by clicking on menu button. Option is called "CloseFromMenuButton" It is false by default. To turn it on, add CloseFromMenuButton=true in [Windeco] section of $HOME/.kde4/share/config/oxygenrc. Note that it results in poor usability of the menu button, if enabled. CCBUG: 301237 --- clients/oxygen/oxygenclient.cpp | 2 +- clients/oxygen/oxygenconfiguration.cpp | 8 ++++++++ clients/oxygen/oxygenconfiguration.h | 12 ++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index 59d615ef65..5fbb4fbce7 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -193,7 +193,7 @@ namespace Oxygen { case DB_MenuClose: - return true; + return configuration().closeFromMenuButton(); case DB_WindowMask: return false; diff --git a/clients/oxygen/oxygenconfiguration.cpp b/clients/oxygen/oxygenconfiguration.cpp index 54c1f59c47..913ae76754 100644 --- a/clients/oxygen/oxygenconfiguration.cpp +++ b/clients/oxygen/oxygenconfiguration.cpp @@ -47,6 +47,7 @@ namespace Oxygen _hideTitleBar( false ), _useDropShadows( true ), _useOxygenShadows( true ), + _closeFromMenuButton( false ), _useNarrowButtonSpacing( false ), _animationsEnabled( true ), _buttonAnimationsEnabled( true ), @@ -127,6 +128,11 @@ namespace Oxygen OxygenConfig::USE_OXYGEN_SHADOWS, defaultConfiguration.useOxygenShadows() ) ); + // close from menu button + setCloseFromMenuButton( group.readEntry( + OxygenConfig::CLOSE_FROM_MENU_BUTTON, + defaultConfiguration.closeFromMenuButton() ) ); + // buttonSpacing setUseNarrowButtonSpacing( group.readEntry( OxygenConfig::NARROW_BUTTON_SPACING, @@ -207,6 +213,7 @@ namespace Oxygen if( hideTitleBar() != defaultConfiguration.hideTitleBar() ) group.writeEntry( OxygenConfig::HIDE_TITLEBAR, hideTitleBar() ); if( useDropShadows() != defaultConfiguration.useDropShadows() ) group.writeEntry( OxygenConfig::USE_DROP_SHADOWS, useDropShadows() ); if( useOxygenShadows() != defaultConfiguration.useOxygenShadows() ) group.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, useOxygenShadows() ); + if( closeFromMenuButton() != defaultConfiguration.closeFromMenuButton() ) group.writeEntry( OxygenConfig::CLOSE_FROM_MENU_BUTTON, closeFromMenuButton() ); if( useNarrowButtonSpacing() != defaultConfiguration.useNarrowButtonSpacing() ) group.writeEntry( OxygenConfig::NARROW_BUTTON_SPACING, useNarrowButtonSpacing() ); // animations @@ -400,6 +407,7 @@ namespace Oxygen hideTitleBar() == other.hideTitleBar() && useDropShadows() == other.useDropShadows() && useOxygenShadows() == other.useOxygenShadows() && + closeFromMenuButton() == other.closeFromMenuButton() && useNarrowButtonSpacing() == other.useNarrowButtonSpacing() && animationsEnabled() == other.animationsEnabled() && buttonAnimationsEnabled() == other.buttonAnimationsEnabled() && diff --git a/clients/oxygen/oxygenconfiguration.h b/clients/oxygen/oxygenconfiguration.h index 231d26ac3f..1550273350 100644 --- a/clients/oxygen/oxygenconfiguration.h +++ b/clients/oxygen/oxygenconfiguration.h @@ -44,6 +44,7 @@ namespace OxygenConfig static const QString HIDE_TITLEBAR = "HideTitleBar"; static const QString ANIMATIONS_ENABLED = "AnimationsEnabled"; static const QString NARROW_BUTTON_SPACING = "UseNarrowButtonSpacing"; + static const QString CLOSE_FROM_MENU_BUTTON = "CloseFromMenuButton"; //!@name animation flags //@{ @@ -300,6 +301,14 @@ namespace Oxygen virtual void setUseOxygenShadows( bool value ) { _useOxygenShadows = value; } + //! close from menu button + virtual bool closeFromMenuButton( void ) const + { return _closeFromMenuButton; } + + //! close from menu button + virtual void setCloseFromMenuButton( bool value ) + { _closeFromMenuButton = value; } + //!@name animations //@{ @@ -412,6 +421,9 @@ namespace Oxygen //! oxygen shadows bool _useOxygenShadows; + //! close window from menu button + bool _closeFromMenuButton; + //! narrow button spacing bool _useNarrowButtonSpacing;