Fix up fullscreen action
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 16 Aug 2010 08:38:09 +0000 (10:38 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 16 Aug 2010 08:38:09 +0000 (10:38 +0200)
* Use the appropriate KStandardAction for KDEified Quassel
* Use proper icon naming ("view-fullscreen")
* Make it a toggle action

src/qtui/mainwin.cpp

index 3e97835..00407ef 100644 (file)
@@ -26,6 +26,7 @@
 #  include <KMenuBar>
 #  include <KShortcutsDialog>
 #  include <KStatusBar>
 #  include <KMenuBar>
 #  include <KShortcutsDialog>
 #  include <KStatusBar>
+#  include <KToggleFullScreenAction>
 #  include <KToolBar>
 #  include <KWindowSystem>
 #endif
 #  include <KToolBar>
 #  include <KWindowSystem>
 #endif
@@ -340,8 +341,15 @@ void MainWin::setupActions() {
 
   coll->addAction("ToggleStatusBar", new Action(tr("Show Status &Bar"), coll,
                                                 0, 0))->setCheckable(true);
 
   coll->addAction("ToggleStatusBar", new Action(tr("Show Status &Bar"), coll,
                                                 0, 0))->setCheckable(true);
-  coll->addAction("ToggleFullscreen", new Action(SmallIcon("window_fullscreen"), tr("&Fullscreen mode"), coll,
-                                                  this, SLOT(toggleFullscreen()), QKeySequence(Qt::Key_F11)));
+
+#ifdef HAVE_KDE
+  QAction *fullScreenAct = KStandardAction::fullScreen(this, SLOT(toggleFullscreen()), this, coll);
+#else
+  QAction *fullScreenAct = new Action(SmallIcon("view-fullscreen"), tr("&Full Screen Mode"), coll,
+                             this, SLOT(toggleFullscreen()), QKeySequence(Qt::Key_F11));
+  fullScreenAct->setCheckable(true);
+#endif
+  coll->addAction("ToggleFullscreen", fullScreenAct);
 
   // Settings
   coll->addAction("ConfigureShortcuts", new Action(SmallIcon("configure-shortcuts"), tr("Configure &Shortcuts..."), coll,
 
   // Settings
   coll->addAction("ConfigureShortcuts", new Action(SmallIcon("configure-shortcuts"), tr("Configure &Shortcuts..."), coll,
@@ -1177,18 +1185,10 @@ void MainWin::showShortcutsDlg() {
 }
 
 void MainWin::toggleFullscreen() {
 }
 
 void MainWin::toggleFullscreen() {
-  QAction *action = QtUi::actionCollection("General")->action("ToggleFullscreen");
-
-  if(isFullScreen()) {
+  if(isFullScreen())
     showNormal();
     showNormal();
-    action->setIcon(SmallIcon("window_fullscreen"));
-    action->setText(tr("&Fullscreen mode"));
-  }
-  else {
+  else
     showFullScreen();
     showFullScreen();
-    action->setIcon(SmallIcon("window_nofullscreen"));
-    action->setText(tr("&Normal mode"));
-  }
 }
 
 /********************************************************************************************************/
 }
 
 /********************************************************************************************************/