X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=70e2285206e6ce860eac77e2f797258b92804886;hp=c7796ca18b9e6f292107f20d7b7ed4f126a2b750;hb=2088ce3b27f71c7c7e4f91d8f2428f7ccecf4074;hpb=7de4debb5a6744d9f67cb09c5fc0aa136f05be96 diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index c7796ca1..70e22852 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -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 * @@ -20,21 +20,27 @@ #include "mainwin.h" +#include #include #include #include #include -#ifdef HAVE_KDE -# include -# include +#ifdef HAVE_KDE4 # include # include # include # include # include # include -# include +#endif + +#ifdef HAVE_KF5 +# include +# include +# include +# include +# include #endif #ifdef Q_WS_X11 @@ -74,7 +80,6 @@ #include "debuglogwidget.h" #include "debugmessagemodelfilter.h" #include "flatproxymodel.h" -#include "iconloader.h" #include "inputwidget.h" #include "irclistmodel.h" #include "ircconnectionwizard.h" @@ -146,8 +151,7 @@ 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 @@ -382,13 +386,13 @@ void MainWin::setupActions() 0, 0))->setCheckable(true); #ifdef HAVE_KDE - QAction *fullScreenAct = KStandardAction::fullScreen(this, SLOT(onFullScreenToggled()), this, coll); + _fullScreenAction = KStandardAction::fullScreen(this, SLOT(onFullScreenToggled()), this, coll); #else - QAction *fullScreenAct = new Action(QIcon::fromTheme("view-fullscreen"), tr("&Full Screen Mode"), coll, + _fullScreenAction = new Action(QIcon::fromTheme("view-fullscreen"), tr("&Full Screen Mode"), coll, this, SLOT(onFullScreenToggled()), QKeySequence(Qt::Key_F11)); - fullScreenAct->setCheckable(true); + _fullScreenAction->setCheckable(true); + coll->addAction("ToggleFullScreen", _fullScreenAction); #endif - coll->addAction("ToggleFullScreen", fullScreenAct); // Settings QAction *configureShortcutsAct = new Action(QIcon::fromTheme("configure-shortcuts"), tr("Configure &Shortcuts..."), 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 @@ -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")); @@ -917,7 +922,7 @@ void MainWin::setupTopicWidget() void MainWin::setupViewMenuTail() { _viewMenu->addSeparator(); - _viewMenu->addAction(QtUi::actionCollection("General")->action("ToggleFullScreen")); + _viewMenu->addAction(_fullScreenAction); } @@ -1367,7 +1372,7 @@ void MainWin::showShortcutsDlg() KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsDisallowed, this); foreach(KActionCollection *coll, QtUi::actionCollections()) dlg.addCollection(coll, coll->property("Category").toString()); - dlg.exec(); + dlg.configure(true); #else SettingsPageDlg dlg(new ShortcutsSettingsPage(QtUi::actionCollections(), this), this); dlg.exec(); @@ -1387,15 +1392,10 @@ void MainWin::onFullScreenToggled() // Relying on QWidget::isFullScreen is discouraged, see the KToggleFullScreenAction docs // Also, one should not use showFullScreen() or showNormal(), as those reset all other window flags - QAction *action = QtUi::actionCollection("General")->action("ToggleFullScreen"); - if (!action) - return; - #ifdef HAVE_KDE - KToggleFullScreenAction *kAct = static_cast(action); - kAct->setFullScreen(this, kAct->isChecked()); + static_cast(_fullScreenAction)->setFullScreen(this, _fullScreenAction->isChecked()); #else - if (action->isChecked()) + if (_fullScreenAction->isChecked()) setWindowState(windowState() | Qt::WindowFullScreen); else setWindowState(windowState() & ~Qt::WindowFullScreen);