mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
Don't use systray icon on inappropriate systems
Prevent a user from losing access to the main window by minimizing it to the tray on some systems (e.g. GNOME 3.26+).
This commit is contained in:
parent
d799efe214
commit
ec1201a368
2 changed files with 17 additions and 3 deletions
|
@ -131,7 +131,9 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
|
||||||
createToolBars();
|
createToolBars();
|
||||||
|
|
||||||
// Create system tray icon and notification
|
// Create system tray icon and notification
|
||||||
createTrayIcon(networkStyle);
|
if (QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||||
|
createTrayIcon(networkStyle);
|
||||||
|
}
|
||||||
|
|
||||||
// Create status bar
|
// Create status bar
|
||||||
statusBar();
|
statusBar();
|
||||||
|
@ -585,6 +587,8 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
|
||||||
|
|
||||||
void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
|
void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
|
||||||
{
|
{
|
||||||
|
assert(QSystemTrayIcon::isSystemTrayAvailable());
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
trayIcon = new QSystemTrayIcon(this);
|
trayIcon = new QSystemTrayIcon(this);
|
||||||
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
|
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <QIntValidator>
|
#include <QIntValidator>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QSystemTrayIcon>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
|
OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
|
||||||
|
@ -126,6 +127,13 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
|
||||||
connect(ui->proxyIpTor, &QValidatedLineEdit::validationDidChange, this, &OptionsDialog::updateProxyValidationState);
|
connect(ui->proxyIpTor, &QValidatedLineEdit::validationDidChange, this, &OptionsDialog::updateProxyValidationState);
|
||||||
connect(ui->proxyPort, &QLineEdit::textChanged, this, &OptionsDialog::updateProxyValidationState);
|
connect(ui->proxyPort, &QLineEdit::textChanged, this, &OptionsDialog::updateProxyValidationState);
|
||||||
connect(ui->proxyPortTor, &QLineEdit::textChanged, this, &OptionsDialog::updateProxyValidationState);
|
connect(ui->proxyPortTor, &QLineEdit::textChanged, this, &OptionsDialog::updateProxyValidationState);
|
||||||
|
|
||||||
|
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||||
|
ui->hideTrayIcon->setChecked(true);
|
||||||
|
ui->hideTrayIcon->setEnabled(false);
|
||||||
|
ui->minimizeToTray->setChecked(false);
|
||||||
|
ui->minimizeToTray->setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionsDialog::~OptionsDialog()
|
OptionsDialog::~OptionsDialog()
|
||||||
|
@ -211,8 +219,10 @@ void OptionsDialog::setMapper()
|
||||||
|
|
||||||
/* Window */
|
/* Window */
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
mapper->addMapping(ui->hideTrayIcon, OptionsModel::HideTrayIcon);
|
if (QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||||
mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);
|
mapper->addMapping(ui->hideTrayIcon, OptionsModel::HideTrayIcon);
|
||||||
|
mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);
|
||||||
|
}
|
||||||
mapper->addMapping(ui->minimizeOnClose, OptionsModel::MinimizeOnClose);
|
mapper->addMapping(ui->minimizeOnClose, OptionsModel::MinimizeOnClose);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue