Skip to content

Commit

Permalink
Merge bitcoin#14517: qt: Fix start with the -min option
Browse files Browse the repository at this point in the history
9300961 Fix start with the `-min` option (Hennadii Stepanov)

Pull request description:

  From IRC:

  > 2018-10-17T12:36:38  \<Drakon\> The option to minimize to system tray instead of the taskbar ist available, but doesn't have an effect if it is started with the -min option. If I start it via that option, I have to click on the program symbil on the taskbar and then minimize it again in order to get it minimized to system tray.
  > 2018-10-17T12:37:28  \<Drakon\> That's annoying.
  > 2018-10-17T13:51:19  \<wumpus\> can you open an issue for that please? https://github.com/bitcoin/bitcoin/issues/new
  > 2018-10-17T13:53:24  \<wumpus\> (if there isn't one yet-)

  This PR fixes this bug.

Tree-SHA512: c5a5521287b49b13859edc7c6bd1cd07cac14b84740450181dce00bf2781fc3dfc84476794baa16b0e26a2d004164617afdb61f829e629569703c5bcc45e2a4e
  • Loading branch information
laanwj committed Jan 9, 2019
2 parents c7fab55 + 9300961 commit 0ed279c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/qt/bitcoin.cpp
Expand Up @@ -392,14 +392,13 @@ void BitcoinApplication::initializeResult(bool success)
}
#endif

// If -min option passed, start window minimized.
if(gArgs.GetBoolArg("-min", false))
{
window->showMinimized();
}
else
{
// If -min option passed, start window minimized (iconified) or minimized to tray
if (!gArgs.GetBoolArg("-min", false)) {
window->show();
} else if (clientModel->getOptionsModel()->getMinimizeToTray() && window->hasTrayIcon()) {
// do nothing as the window is managed by the tray icon
} else {
window->showMinimized();
}
Q_EMIT splashFinished();
Q_EMIT windowShown(window);
Expand Down
5 changes: 5 additions & 0 deletions src/qt/bitcoingui.h
Expand Up @@ -86,6 +86,11 @@ class BitcoinGUI : public QMainWindow
#endif // ENABLE_WALLET
bool enableWallet = false;

/** Get the tray icon status.
Some systems have not "system tray" or "notification area" available.
*/
bool hasTrayIcon() const { return trayIcon; }

protected:
void changeEvent(QEvent *e);
void closeEvent(QCloseEvent *event);
Expand Down

0 comments on commit 0ed279c

Please sign in to comment.