X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=d5e9b0cda6a19feb766bbba77e3cb5e974757717;hp=fc53283b02fef73527cfeb0b80cd6cd48b99c462;hb=47a6910aed00018c7230cc2cc90ae8e80fa77dda;hpb=4df8d4afa450d4686bc4321b399bcb244f04d220 diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index fc53283b..d5e9b0cd 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -94,6 +94,9 @@ # ifdef HAVE_PHONON # include "phononnotificationbackend.h" # endif +# ifdef HAVE_LIBSNORE +# include "snorenotificationbackend.h" +# endif # include "systraynotificationbackend.h" # include "taskbarnotificationbackend.h" #else /* HAVE_KDE */ @@ -112,6 +115,10 @@ #include "osxnotificationbackend.h" #endif +#ifdef HAVE_DBUS + #include "dockmanagernotificationbackend.h" +#endif + #include "settingspages/aliasessettingspage.h" #include "settingspages/appearancesettingspage.h" #include "settingspages/backlogsettingspage.h" @@ -208,7 +215,9 @@ void MainWin::init() # ifdef HAVE_PHONON QtUi::registerNotificationBackend(new PhononNotificationBackend(this)); # endif -# ifndef QT_NO_SYSTEMTRAYICON +# ifdef HAVE_LIBSNORE + QtUi::registerNotificationBackend(new SnoreNotificationBackend(this)); +# elif !defined(QT_NO_SYSTEMTRAYICON) QtUi::registerNotificationBackend(new SystrayNotificationBackend(this)); # endif @@ -226,6 +235,10 @@ void MainWin::init() QtUi::registerNotificationBackend(new OSXNotificationBackend(this)); #endif +#ifdef HAVE_DBUS + QtUi::registerNotificationBackend(new DockManagerNotificationBackend(this)); +#endif + // we assume that at this point, all configurable actions are defined! QtUi::loadShortcuts(); @@ -372,13 +385,13 @@ void MainWin::setupActions() 0, 0))->setCheckable(true); #ifdef HAVE_KDE - QAction *fullScreenAct = KStandardAction::fullScreen(this, SLOT(toggleFullscreen()), this, coll); + QAction *fullScreenAct = KStandardAction::fullScreen(this, SLOT(onFullScreenToggled()), this, coll); #else QAction *fullScreenAct = new Action(SmallIcon("view-fullscreen"), tr("&Full Screen Mode"), coll, - this, SLOT(toggleFullscreen()), QKeySequence(Qt::Key_F11)); + this, SLOT(onFullScreenToggled()), QKeySequence(Qt::Key_F11)); fullScreenAct->setCheckable(true); #endif - coll->addAction("ToggleFullscreen", fullScreenAct); + coll->addAction("ToggleFullScreen", fullScreenAct); // Settings QAction *configureShortcutsAct = new Action(SmallIcon("configure-shortcuts"), tr("Configure &Shortcuts..."), coll, @@ -644,7 +657,7 @@ void MainWin::removeBufferView(int bufferViewConfigId) void MainWin::bufferViewToggled(bool enabled) { - if (!enabled && !isVisible()) { + if (!enabled && !isMinimized()) { // hiding the mainwindow triggers a toggle of the bufferview (which pretty much sucks big time) // since this isn't our fault and we can't do anything about it, we suppress the resulting calls return; @@ -907,7 +920,7 @@ void MainWin::setupTopicWidget() void MainWin::setupViewMenuTail() { _viewMenu->addSeparator(); - _viewMenu->addAction(QtUi::actionCollection("General")->action("ToggleFullscreen")); + _viewMenu->addAction(QtUi::actionCollection("General")->action("ToggleFullScreen")); } @@ -1345,12 +1358,24 @@ void MainWin::showShortcutsDlg() } -void MainWin::toggleFullscreen() +void MainWin::onFullScreenToggled() { - if (isFullScreen()) - showNormal(); + // 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()); +#else + if (action->isChecked()) + setWindowState(windowState() | Qt::WindowFullScreen); else - showFullScreen(); + setWindowState(windowState() & ~Qt::WindowFullScreen); +#endif }