#include "osxnotificationbackend.h"
#endif
+#ifdef HAVE_DBUS
+ #include "dockmanagernotificationbackend.h"
+#endif
+
#include "settingspages/aliasessettingspage.h"
#include "settingspages/appearancesettingspage.h"
#include "settingspages/backlogsettingspage.h"
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();
move(_normalPos);
#endif
- if (s.value("MainWinHidden").toBool() && QtUi::haveSystemTray())
+ if ((Quassel::isOptionSet("hidewindow")
+ || s.value("MainWinHidden").toBool())
+ && _systemTray->isSystemTrayAvailable())
QtUi::hideMainWidget();
else if (s.value("MainWinMinimized").toBool())
showMinimized();
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,
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;
void MainWin::setupViewMenuTail()
{
_viewMenu->addSeparator();
- _viewMenu->addAction(QtUi::actionCollection("General")->action("ToggleFullscreen"));
+ _viewMenu->addAction(QtUi::actionCollection("General")->action("ToggleFullScreen"));
}
QtUi::toolBarActionProvider()->addActions(_mainToolBar, ToolBarActionProvider::MainToolBar);
_toolbarMenu->addAction(_mainToolBar->toggleViewAction());
+
+#ifndef HAVE_KDE
+ QtUiSettings uiSettings;
+
+ bool visible = uiSettings.value("ShowMainToolBar", QVariant(true)).toBool();
+ _mainToolBar->setVisible(visible);
+ connect(_mainToolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(saveMainToolBarStatus(bool)));
+#endif
+}
+
+#ifndef HAVE_KDE
+void MainWin::saveMainToolBarStatus(bool enabled)
+{
+ QtUiSettings uiSettings;
+ uiSettings.setValue("ShowMainToolBar", enabled);
}
+#endif
void MainWin::connectedToCore()
}
-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<KToggleFullScreenAction *>(action);
+ kAct->setFullScreen(this, kAct->isChecked());
+#else
+ if (action->isChecked())
+ setWindowState(windowState() | Qt::WindowFullScreen);
else
- showFullScreen();
+ setWindowState(windowState() & ~Qt::WindowFullScreen);
+#endif
}