aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-02-17 09:16:19 -0500
committerLuke Dashjr <luke-jr+git@utopios.org>2012-02-17 09:16:19 -0500
commitfb811c31fd28d1d637a50f784af620d085fa32d4 (patch)
treed665c0e80f5461ca3b819d2cefdf342b90476d77 /src/qt
parent9ab932b76988d41ea83d4c5cfb9353e06922ccaa (diff)
parent0365f19dececa3bd84ae28ec4aabb955ffb8b405 (diff)
downloadbitcoin-fb811c31fd28d1d637a50f784af620d085fa32d4.tar.xz
Merge branch '0.5.0.x' into 0.5.x
Conflicts: src/qt/bitcoingui.cpp
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoingui.cpp32
-rw-r--r--src/qt/bitcoingui.h4
2 files changed, 26 insertions, 10 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 5d9c0d9f00..cfcff136e0 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -55,6 +55,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
QMainWindow(parent),
clientModel(0),
walletModel(0),
+ dummyWidget(0),
encryptWalletAction(0),
changePassphraseAction(0),
aboutQtAction(0),
@@ -84,6 +85,9 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
// Create the tray icon (or setup the dock icon)
createTrayIcon();
+ // Dummy widget used when restoring window state after minimization
+ dummyWidget = new QWidget();
+
// Create tabs
overviewPage = new OverviewPage();
@@ -157,6 +161,7 @@ BitcoinGUI::~BitcoinGUI()
#ifdef Q_WS_MAC
delete appMenuBar;
#endif
+ delete dummyWidget;
}
void BitcoinGUI::createActions()
@@ -193,15 +198,15 @@ void BitcoinGUI::createActions()
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
- connect(overviewAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
- connect(historyAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
- connect(addressBookAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
- connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
- connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
@@ -379,10 +384,17 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
// Click on system tray icon triggers "open bitcoin"
openBitcoinAction->trigger();
}
-
}
#endif
+void BitcoinGUI::showNormal()
+{
+ // Reparent window to the desktop (in case it was hidden on minimize)
+ if(parent() != NULL)
+ setParent(NULL, Qt::Window);
+ QMainWindow::showNormal();
+}
+
void BitcoinGUI::optionsClicked()
{
if(!clientModel || !clientModel->getOptionsModel())
@@ -524,13 +536,13 @@ void BitcoinGUI::changeEvent(QEvent *e)
{
if(isMinimized())
{
- hide();
- e->ignore();
+ // Hiding the window from taskbar
+ setParent(dummyWidget, Qt::SubWindow);
+ return;
}
else
{
- show();
- e->accept();
+ showNormal();
}
}
}
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index a0905e44ad..48eac2aa33 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -57,6 +57,8 @@ private:
QStackedWidget *centralWidget;
+ QWidget *dummyWidget;
+
OverviewPage *overviewPage;
QWidget *transactionsPage;
AddressBookPage *addressBookPage;
@@ -124,6 +126,8 @@ public slots:
*/
void askFee(qint64 nFeeRequired, bool *payFee);
+ void showNormal();
+
private slots:
/** Switch to overview (home) page */
void gotoOverviewPage();