[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/actions
From:       Aurélien Gâteau <agateau () kde ! org>
Date:       2010-10-16 22:12:56
Message-ID: 20101016221256.CEDFDAC896 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1186566 by gateau:

Introduce KStandardAction::showHideMenubar()

A KDualAction version of showMenubar()

 M  +28 -0     kstandardaction.cpp  
 M  +9 -1      kstandardaction.h  


--- trunk/KDE/kdelibs/kdeui/actions/kstandardaction.cpp #1186565:1186566
@@ -37,6 +37,7 @@
 #include <kmainwindow.h>
 #include <kicon.h>
 
+#include "kdualaction.h"
 #include "krecentfilesaction.h"
 #include "ktogglefullscreenaction.h"
 #include "kpastetextaction.h"
@@ -533,6 +534,33 @@
   return ret;
 }
 
+KDualAction *showHideMenubar(const QObject *recvr, const char *slot, QObject \
*parent) +{
+  KDualAction *ret = new KDualAction(
+    i18n( "Show &Menubar" ),
+    i18n( "Hide Menubar" ),
+    parent);
+  ret->setObjectName(name(ShowMenubar));
+
+  ret->setShortcut( KStandardShortcut::shortcut( KStandardShortcut::ShowMenubar ) );
+
+  ret->setWhatsThis( i18n( "Show Menubar<p>"
+                           "Shows the menubar again after it has been hidden</p>" ) \
); +
+  ret->setIconForStates( KIcon( "show-menu" ) );
+
+  ret->setActive( true );
+
+  if ( recvr && slot )
+    QObject::connect( ret, SIGNAL( activeChangedByUser( bool ) ), recvr, slot );
+
+  KActionCollection *collection = qobject_cast<KActionCollection *>(parent);
+  if (collection)
+    collection->addAction(ret->objectName(), ret);
+
+  return ret;
+}
+
 KToggleAction *showStatusbar(const QObject *recvr, const char *slot, QObject \
*parent)  {
   KToggleAction *ret = new KToggleAction(i18n( "Show St&atusbar" ), parent);
--- trunk/KDE/kdelibs/kdeui/actions/kstandardaction.h #1186565:1186566
@@ -28,6 +28,7 @@
 class QWidget;
 class KAction;
 class KRecentFilesAction;
+class KDualAction;
 class KToggleAction;
 class KToggleFullScreenAction;
 
@@ -515,10 +516,17 @@
 
   /**
    * Show/Hide the menubar.
+   * @deprecated use showHideMenubar instead.
    */
-  KDEUI_EXPORT KToggleAction *showMenubar(const QObject *recvr, const char *slot, \
QObject *parent); +  KDEUI_EXPORT_DEPRECATED KToggleAction *showMenubar(const QObject \
*recvr, const char *slot, QObject *parent);  
   /**
+   * Show/Hide the menubar.
+   * @since 4.6
+   */
+  KDEUI_EXPORT KDualAction *showHideMenubar(const QObject *recvr, const char *slot, \
QObject *parent); +
+  /**
    * Show/Hide the statusbar.
    */
   KDEUI_EXPORT KToggleAction *showStatusbar(const QObject *recvr, const char *slot, \
QObject *parent);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic