Prevent a user from losing access to the main window by minimizing it to the tray on the systems which have not “system tray” or “notification area” available (e.g. GNOME 3.26+).
Tested on Fedora 28 + GNOME 3.28.
Prevent a user from losing access to the main window by minimizing it to the tray on the systems which have not “system tray” or “notification area” available (e.g. GNOME 3.26+).
Tested on Fedora 28 + GNOME 3.28.
Original PR title: “Qt: Don’t use systray icon on inappropriate systems”
When reading the PR title I first thought you were referring to Windows platforms :-)
53@@ -53,12 +54,16 @@ void OptionsModel::Init(bool resetSettings)
54 // These are Qt-only settings:
55
56 // Window
57- if (!settings.contains("fHideTrayIcon"))
58+ if (!QSystemTrayIcon::isSystemTrayAvailable()) {
59+ settings.setValue("fHideTrayIcon", true);
54@@ -54,7 +55,7 @@ void OptionsModel::Init(bool resetSettings)
55
56 // Window
57 if (!settings.contains("fHideTrayIcon"))
58- settings.setValue("fHideTrayIcon", false);
59+ settings.setValue("fHideTrayIcon", !QSystemTrayIcon::isSystemTrayAvailable());
OptionsModel
constructor sets fHideTrayIcon
to the false
anyway.
Why cannot it be initialized to the true
on the GNOME environment?
584@@ -585,6 +585,9 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
585
586 void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
587 {
588+ if (!QSystemTrayIcon::isSystemTrayAvailable()) {
createTrayIcon
and maybe assert(QSystemTrayIcon::isSystemTrayAvailable())
here?
createTrayIconMenu
?
Thank you for your review.
How about
createTrayIconMenu
?
Is it not enough?
Could guard these mappings https://github.com/bitcoin/bitcoin/blob/244774d9626f37e15d8e021de4e735302ae2d292/src/qt/optionsdialog.cpp#L222-L223
but since these widgets are disabled and the options dialog is the only place that changes these options, the guard is not necessary.
nit, could fix the comment
https://github.com/bitcoin/bitcoin/blob/244774d9626f37e15d8e021de4e735302ae2d292/src/qt/optionsdialog.cpp#L220
utACK 244774d — tomorrow I can setup a system without tray to test.
but since these widgets are disabled and the options dialog is the only place that changes these options, the guard is not necessary.
In fact, the guard around mapper
is necessary: addMapping
effectively overwrites ui
settings in the OptionsDialog
constructor.
Thank you for this catch. I’m going to fix it.
Prevent a user from losing access to the main window by minimizing it to
the tray on some systems (e.g. GNOME 3.26+).
Coverage | Change (pull 14228) | Reference (master) |
---|---|---|
Lines | +0.0287 % | 87.0361 % |
Functions | +0.1235 % | 84.1130 % |
Branches | +0.0085 % | 51.5451 % |