aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-06-13 22:49:38 -0700
committerWladimir J. van der Laan <laanwj@gmail.com>2012-06-13 22:49:38 -0700
commit7a98f19fb6e40e2929abfff6b1f20f13c091d32d (patch)
tree29baa57634c3c9d6cdc5801a2e841226fa28c64f /src/qt
parentd518e444f83c7b88422f9bb8bbc89cefb2272b88 (diff)
parentd2e6dd6c993946b2d48f4cd8777704549af9ea78 (diff)
Merge pull request #1420 from Diapolo/extend_showNormalIfMinimized
GUI: merge toggleHidden() code into showNormalIfMinimized()
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoingui.cpp50
-rw-r--r--src/qt/bitcoingui.h6
2 files changed, 25 insertions, 31 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 546a39f43d..e15bc6690a 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -439,28 +439,6 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
}
#endif
-void BitcoinGUI::toggleHidden()
-{
- // activateWindow() (sometimes) helps with keyboard focus on Windows
- if (isHidden())
- {
- show();
- activateWindow();
- }
- else if (isMinimized())
- {
- showNormal();
- activateWindow();
- }
- else if (GUIUtil::isObscured(this))
- {
- raise();
- activateWindow();
- }
- else
- hide();
-}
-
void BitcoinGUI::optionsClicked()
{
if(!clientModel || !clientModel->getOptionsModel())
@@ -782,9 +760,6 @@ void BitcoinGUI::handleURI(QString strURI)
gotoSendCoinsPage();
sendCoinsPage->handleURI(strURI);
- if(!isActiveWindow())
- activateWindow();
-
showNormalIfMinimized();
}
@@ -867,10 +842,29 @@ void BitcoinGUI::unlockWallet()
}
}
-void BitcoinGUI::showNormalIfMinimized()
+void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
{
- if(!isVisible()) // Show, if hidden
+ // activateWindow() (sometimes) helps with keyboard focus on Windows
+ if (isHidden())
+ {
show();
- if(isMinimized()) // Unminimize, if minimized
+ activateWindow();
+ }
+ else if (isMinimized())
+ {
showNormal();
+ activateWindow();
+ }
+ else if (GUIUtil::isObscured(this))
+ {
+ raise();
+ activateWindow();
+ }
+ else if(fToggleHidden)
+ hide();
+}
+
+void BitcoinGUI::toggleHidden()
+{
+ showNormalIfMinimized(true);
}
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 8a7f6e541b..3c82cbc968 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -169,9 +169,9 @@ private slots:
/** Ask for pass phrase to unlock wallet temporarily */
void unlockWallet();
- /** Show window if hidden, unminimize when minimized */
- void showNormalIfMinimized();
- /** Hide window if visible, show if hidden */
+ /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
+ void showNormalIfMinimized(bool fToggleHidden = false);
+ /** simply calls showNormalIfMinimized(true) for use in SLOT() macro */
void toggleHidden();
};