X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=760f867a61c74bbd7b5d886dcb8e6cc645a502f5;hp=9019e24c60a53392e96472923dfde90df7cde87f;hb=0d7b511c8510d7fd05d3a704114e34ff37f7a995;hpb=fd97519376748925efe765d138ad5af637d809bd diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 9019e24c..760f867a 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -62,6 +62,7 @@ #include "clientbufferviewconfig.h" #include "clientbufferviewmanager.h" #include "clientignorelistmanager.h" +#include "clienttransfermanager.h" #include "coreconfigwizard.h" #include "coreconnectdlg.h" #include "coreconnection.h" @@ -83,11 +84,13 @@ #include "qtuimessageprocessor.h" #include "qtuisettings.h" #include "qtuistyle.h" +#include "receivefiledlg.h" #include "settingsdlg.h" #include "settingspagedlg.h" #include "statusnotifieritem.h" #include "toolbaractionprovider.h" #include "topicwidget.h" +#include "transfer.h" #include "verticaldock.h" #ifndef HAVE_KDE @@ -385,13 +388,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, @@ -920,7 +923,7 @@ void MainWin::setupTopicWidget() void MainWin::setupViewMenuTail() { _viewMenu->addSeparator(); - _viewMenu->addAction(QtUi::actionCollection("General")->action("ToggleFullscreen")); + _viewMenu->addAction(QtUi::actionCollection("General")->action("ToggleFullScreen")); } @@ -1022,6 +1025,8 @@ void MainWin::connectedToCore() connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int))); connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout())); + connect(Client::transferManager(), SIGNAL(transferAdded(const Transfer*)), SLOT(showNewTransferDlg(const Transfer*))); + setConnectedState(); } @@ -1358,12 +1363,31 @@ void MainWin::showShortcutsDlg() } -void MainWin::toggleFullscreen() +void MainWin::showNewTransferDlg(const Transfer *transfer) { - if (isFullScreen()) - showNormal(); + ReceiveFileDlg *dlg = new ReceiveFileDlg(transfer, this); + dlg->show(); +} + + +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()); +#else + if (action->isChecked()) + setWindowState(windowState() | Qt::WindowFullScreen); else - showFullScreen(); + setWindowState(windowState() & ~Qt::WindowFullScreen); +#endif }