Fix restore to maximize state on tray click

This commit is contained in:
Thorvald Natvig 2010-03-09 15:08:15 +01:00
parent 2ba4270cbb
commit ab21722653
3 changed files with 5 additions and 15 deletions

View File

@ -151,7 +151,6 @@ MainWindow::MainWindow(QWidget *p) : QMainWindow(p) {
banEdit = NULL;
userEdit = NULL;
tokenEdit = NULL;
bNoHide = false;
uiContextSession = ~0;
iContextChannel = -1;
@ -392,13 +391,12 @@ void MainWindow::hideEvent(QHideEvent *e) {
e->ignore();
return;
}
#ifndef Q_OS_MAC
#ifdef Q_OS_UNIX
if (! qApp->activeModalWidget() && ! qApp->activePopupWidget())
#endif
if (g.s.bHideTray && !bNoHide && qstiIcon->isSystemTrayAvailable())
qApp->postEvent(this, new QEvent(static_cast<QEvent::Type>(TI_QEVENT)));
if (g.s.bHideTray && qstiIcon->isSystemTrayAvailable() && e->spontaneous())
QMetaObject::invokeMethod(this, "hide", Qt::QueuedConnection);
QMainWindow::hideEvent(e);
#endif
}
@ -659,18 +657,14 @@ void MainWindow::setOnTop(bool top) {
wf |= Qt::WindowStaysOnTopHint;
else
wf &= ~Qt::WindowStaysOnTopHint;
bNoHide = true;
setWindowFlags(wf);
show();
bNoHide = false;
}
}
void MainWindow::setupView(bool toggle_minimize) {
bool showit = ! g.s.bMinimalView;
bNoHide = true;
// Update window layout
Settings::WindowLayout wlTmp = g.s.wlWindowLayout;
switch (wlTmp) {
@ -779,7 +773,6 @@ void MainWindow::setupView(bool toggle_minimize) {
show();
activateWindow();
bNoHide = false;
}
void MainWindow::on_qaServerConnect_triggered(bool autoconnect) {
@ -2245,8 +2238,9 @@ void MainWindow::on_Icon_activated(QSystemTrayIcon::ActivationReason reason) {
if (reason == QSystemTrayIcon::Trigger) {
if (! isVisible()) {
show();
if (isMinimized())
if (isMaximized())
showMaximized();
else
showNormal();
activateWindow();
} else {

View File

@ -98,8 +98,6 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin
bool bSuppressAskOnQuit;
bool bAutoUnmute;
bool bNoHide;
unsigned int uiContextSession;
int iContextChannel;

View File

@ -2115,12 +2115,10 @@ void OverlayClient::hideGui() {
if (g.ocIntercept == this)
g.ocIntercept = NULL;
g.mw->bNoHide = true;
foreach(QWidget *w, widgetlist) {
if (bWasVisible)
w->show();
}
g.mw->bNoHide = false;
setupScene(false);