Work around weirdly broken MOCs
[quassel.git] / src / qtui / mainwin.cpp
index aadddff..b64a0d9 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2014 by the Quassel Project                        *
+ *   Copyright (C) 2005-2015 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -26,7 +26,7 @@
 #include <QStatusBar>
 #include <QToolBar>
 
-#ifdef HAVE_KDE
+#ifdef HAVE_KDE4
 #  include <KAction>
 #  include <KActionCollection>
 #  include <KHelpMenu>
 #  include <KWindowSystem>
 #endif
 
+#ifdef HAVE_KF5
+#  include <KConfigWidgets/KStandardAction>
+#  include <KXmlGui/KHelpMenu>
+#endif
+
 #ifdef Q_WS_X11
 #  include <QX11Info>
 #endif
@@ -93,7 +98,7 @@
 #include "topicwidget.h"
 #include "verticaldock.h"
 
-#ifndef HAVE_KDE
+#ifndef HAVE_KDE4
 #  ifdef HAVE_PHONON
 #    include "phononnotificationbackend.h"
 #  endif
 #  endif
 #  include "systraynotificationbackend.h"
 #  include "taskbarnotificationbackend.h"
-#else /* HAVE_KDE */
+#else /* HAVE_KDE4 */
 #  include "knotificationbackend.h"
-#endif /* HAVE_KDE */
+#endif /* HAVE_KDE4 */
 
 #ifdef HAVE_SSL
 #  include "sslinfodlg.h"
 #include "settingspages/notificationssettingspage.h"
 #include "settingspages/topicwidgetsettingspage.h"
 
-#ifndef HAVE_KDE
+#ifndef HAVE_KDE4
 #  include "settingspages/shortcutssettingspage.h"
 #endif
 
 MainWin::MainWin(QWidget *parent)
 #ifdef HAVE_KDE
-    : KMainWindow(parent),
-    _kHelpMenu(new KHelpMenu(this, KGlobal::mainComponent().aboutData())),
+    : KMainWindow(parent), _kHelpMenu(new KHelpMenu(this)),
 #else
     : QMainWindow(parent),
 #endif
@@ -214,7 +218,7 @@ void MainWin::init()
     setupTitleSetter();
     setupHotList();
 
-#ifndef HAVE_KDE
+#ifndef HAVE_KDE4
 #  ifdef HAVE_PHONON
     QtUi::registerNotificationBackend(new PhononNotificationBackend(this));
 #  endif
@@ -226,9 +230,9 @@ void MainWin::init()
 
     QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this));
 
-#else /* HAVE_KDE */
+#else /* HAVE_KDE4 */
     QtUi::registerNotificationBackend(new KNotificationBackend(this));
-#endif /* HAVE_KDE */
+#endif /* HAVE_KDE4 */
 
 #ifdef HAVE_INDICATEQT
     QtUi::registerNotificationBackend(new IndicatorNotificationBackend(this));
@@ -381,7 +385,7 @@ void MainWin::setupActions()
     coll->addAction("ToggleStatusBar", new Action(tr("Show Status &Bar"), coll,
             0, 0))->setCheckable(true);
 
-#ifdef HAVE_KDE
+#ifdef HAVE_KDE4
     QAction *fullScreenAct = KStandardAction::fullScreen(this, SLOT(onFullScreenToggled()), this, coll);
 #else
     QAction *fullScreenAct = new Action(QIcon::fromTheme("view-fullscreen"), tr("&Full Screen Mode"), coll,
@@ -396,14 +400,14 @@ void MainWin::setupActions()
     configureShortcutsAct->setMenuRole(QAction::NoRole);
     coll->addAction("ConfigureShortcuts", configureShortcutsAct);
 
-  #ifdef Q_OS_MAC
+#ifdef Q_OS_MAC
     QAction *configureQuasselAct = new Action(QIcon::fromTheme("configure"), tr("&Configure Quassel..."), coll,
         this, SLOT(showSettingsDlg()));
     configureQuasselAct->setMenuRole(QAction::PreferencesRole);
-  #else
+#else
     QAction *configureQuasselAct = new Action(QIcon::fromTheme("configure"), tr("&Configure Quassel..."), coll,
         this, SLOT(showSettingsDlg()), QKeySequence(Qt::Key_F7));
-  #endif
+#endif
     coll->addAction("ConfigureQuassel", configureQuasselAct);
 
     // Help
@@ -542,7 +546,7 @@ void MainWin::setupMenus()
     _viewMenu->addAction(coll->action("LockLayout"));
 
     _settingsMenu = menuBar()->addMenu(tr("&Settings"));
-#ifdef HAVE_KDE
+#ifdef HAVE_KDE4
     _settingsMenu->addAction(KStandardAction::configureNotifications(this, SLOT(showNotificationsDlg()), this));
     _settingsMenu->addAction(KStandardAction::keyBindings(this, SLOT(showShortcutsDlg()), this));
 #else
@@ -551,6 +555,7 @@ void MainWin::setupMenus()
     _settingsMenu->addAction(coll->action("ConfigureQuassel"));
 
     _helpMenu = menuBar()->addMenu(tr("&Help"));
+
     _helpMenu->addAction(coll->action("AboutQuassel"));
 #ifndef HAVE_KDE
     _helpMenu->addAction(coll->action("AboutQt"));
@@ -998,7 +1003,7 @@ void MainWin::setupToolBars()
     setUnifiedTitleAndToolBarOnMac(true);
 #endif
 
-#ifdef HAVE_KDE
+#ifdef HAVE_KDE4
     _mainToolBar = new KToolBar("MainToolBar", this, Qt::TopToolBarArea, false, true, true);
 #else
     _mainToolBar = new QToolBar(this);
@@ -1363,7 +1368,7 @@ void MainWin::showAboutDlg()
 
 void MainWin::showShortcutsDlg()
 {
-#ifdef HAVE_KDE
+#ifdef HAVE_KDE4
     KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsDisallowed, this);
     foreach(KActionCollection *coll, QtUi::actionCollections())
     dlg.addCollection(coll, coll->property("Category").toString());
@@ -1391,7 +1396,7 @@ void MainWin::onFullScreenToggled()
     if (!action)
         return;
 
-#ifdef HAVE_KDE
+#ifdef HAVE_KDE4
     KToggleFullScreenAction *kAct = static_cast<KToggleFullScreenAction *>(action);
     kAct->setFullScreen(this, kAct->isChecked());
 #else