Merge pull request #1391 from namecheap/nc/fix/trayicon_unchecked

NC/fix - 'Show tray icon' checkbox is automatically unchecked when checking some other check boxes
This commit is contained in:
borgmanJeremy
2021-02-24 12:35:59 -06:00
committed by GitHub
2 changed files with 4 additions and 6 deletions

View File

@@ -204,8 +204,7 @@ void GeneralConf::initShowTrayIcon()
{
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
m_showTray = new QCheckBox(tr("Show tray icon"), this);
ConfigHandler config;
bool checked = !config.disabledTrayIconValue();
bool checked = !ConfigHandler().disabledTrayIconValue();
m_showTray->setChecked(checked);
m_showTray->setToolTip(tr("Show the systemtray icon"));
m_layout->addWidget(m_showTray);
@@ -281,8 +280,7 @@ void GeneralConf::initCheckForUpdates()
void GeneralConf::initAutostart()
{
m_autostart = new QCheckBox(tr("Launch at startup"), this);
ConfigHandler config;
bool checked = config.startupLaunchValue();
bool checked = ConfigHandler().startupLaunchValue();
m_autostart->setChecked(checked);
m_autostart->setToolTip(tr("Launch Flameshot"));
m_layout->addWidget(m_autostart);

View File

@@ -382,6 +382,7 @@ void Controller::openLauncherWindow()
void Controller::enableTrayIcon()
{
ConfigHandler().setDisabledTrayIcon(false);
if (m_trayIcon) {
m_trayIcon->show();
return;
@@ -391,7 +392,6 @@ void Controller::enableTrayIcon()
Q_ASSERT(m_trayIconMenu);
}
ConfigHandler().setDisabledTrayIcon(false);
QAction* captureAction = new QAction(tr("&Take Screenshot"), this);
connect(captureAction, &QAction::triggered, this, [this]() {
#if defined(Q_OS_MACOS)
@@ -508,7 +508,7 @@ void Controller::enableTrayIcon()
void Controller::disableTrayIcon()
{
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) || defined(Q_OS_MACOS)
if (m_trayIcon) {
m_trayIcon->hide();
}