[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdeui
From: Aurélien Gâteau <agateau () kde ! org>
Date: 2010-10-16 22:12:59
Message-ID: 20101016221259.56EA8AC898 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1186567 by gateau:
Introduce KStandardAction::showHideStatusbar()
M +23 -0 actions/kstandardaction.cpp
M +8 -1 actions/kstandardaction.h
M +9 -14 xmlgui/kxmlguiwindow.cpp
--- trunk/KDE/kdelibs/kdeui/actions/kstandardaction.cpp #1186566:1186567
@@ -581,6 +581,29 @@
return ret;
}
+KDualAction *showHideStatusbar(const QObject *recvr, const char *slot, QObject \
*parent) +{
+ KDualAction *ret = new KDualAction(
+ i18n( "Show Statusbar" ),
+ i18n( "Hide Statusbar" ),
+ parent);
+ ret->setObjectName(name(ShowStatusbar));
+
+ ret->setWhatsThis( i18n( "Show Statusbar<br /><br />"
+ "Shows the statusbar, which is the bar at the bottom of \
the window used for status information." ) ); +
+ 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;
+}
+
KToggleFullScreenAction *fullScreen(const QObject *recvr, const char *slot, QWidget* \
window, QObject *parent) {
KToggleFullScreenAction *ret;
--- trunk/KDE/kdelibs/kdeui/actions/kstandardaction.h #1186566:1186567
@@ -528,10 +528,17 @@
/**
* Show/Hide the statusbar.
+ * @deprecated use showHideStatusbar instead.
*/
- KDEUI_EXPORT KToggleAction *showStatusbar(const QObject *recvr, const char *slot, \
QObject *parent); + KDEUI_EXPORT_DEPRECATED KToggleAction *showStatusbar(const \
QObject *recvr, const char *slot, QObject *parent);
/**
+ * Show/Hide the statusbar.
+ * @since 4.6
+ */
+ KDEUI_EXPORT KDualAction *showHideStatusbar(const QObject *recvr, const char \
*slot, QObject *parent); +
+ /**
* Switch to/from full screen mode
*/
KDEUI_EXPORT KToggleFullScreenAction *fullScreen(const QObject *recvr, const char \
*slot, QWidget *window, QObject *parent);
--- trunk/KDE/kdelibs/kdeui/xmlgui/kxmlguiwindow.cpp #1186566:1186567
@@ -52,6 +52,7 @@
#include <kauthorized.h>
#include <kconfig.h>
#include <kdebug.h>
+#include <kdualaction.h>
#include <kedittoolbar.h>
#include <khelpmenu.h>
#include <klocale.h>
@@ -62,12 +63,6 @@
#include <kwindowsystem.h>
#include <kconfiggroup.h>
-#if defined Q_WS_X11
-#include <qx11info_x11.h>
-#include <netwm.h>
-#include <kstartupinfo.h>
-#endif
-
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
@@ -86,7 +81,7 @@
QSize defaultSize;
KDEPrivate::ToolBarHandler *toolBarHandler;
- KToggleAction *showStatusBarAction;
+ KDualAction *showStatusBarAction;
QPointer<KEditToolBar> toolBarEditor;
KXMLGUIFactory *factory;
};
@@ -326,15 +321,15 @@
void KXmlGuiWindow::createStandardStatusBarAction(){
K_D(KXmlGuiWindow);
if(!d->showStatusBarAction){
- d->showStatusBarAction = KStandardAction::showStatusbar(this, \
SLOT(setSettingsDirty()), actionCollection()); + d->showStatusBarAction = \
KStandardAction::showHideStatusbar(this, SLOT(setSettingsDirty()), \
actionCollection());
KStatusBar *sb = statusBar(); // Creates statusbar if it doesn't exist \
already.
- connect(d->showStatusBarAction, SIGNAL(toggled(bool)), sb, \
SLOT(setVisible(bool)));
- d->showStatusBarAction->setChecked(sb->isHidden());
+ connect(d->showStatusBarAction, SIGNAL(activeChangedByUser(bool)), sb, \
SLOT(setVisible(bool))); + d->showStatusBarAction->setActive(sb->isHidden());
} else {
// If the language has changed, we'll need to grab the new text and \
whatsThis
- KAction *tmpStatusBar = KStandardAction::showStatusbar(NULL, NULL, NULL);
- d->showStatusBarAction->setText(tmpStatusBar->text());
- d->showStatusBarAction->setWhatsThis(tmpStatusBar->whatsThis());
+ KDualAction *tmpStatusBar = KStandardAction::showHideStatusbar(NULL, NULL, \
NULL); + d->showStatusBarAction->setGuiItemForState(KDualAction::InactiveState, \
tmpStatusBar->guiItemForState(KDualAction::InactiveState)); + \
d->showStatusBarAction->setGuiItemForState(KDualAction::ActiveState, \
tmpStatusBar->guiItemForState(KDualAction::ActiveState)); delete tmpStatusBar;
}
}
@@ -356,7 +351,7 @@
KMainWindow::applyMainWindowSettings(config, force);
KStatusBar *sb = qFindChild<KStatusBar *>(this);
if (sb && d->showStatusBarAction)
- d->showStatusBarAction->setChecked(!sb->isHidden());
+ d->showStatusBarAction->setActive(!sb->isHidden());
}
// KDE5 TODO: change it to "using KXMLGUIBuilder::finalizeGUI;" in the header
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic