enable/disable the tray icon when pref is changed (no restart needed)
This commit is contained in:
parent
4e711e1901
commit
2e4f4d7702
@ -449,13 +449,7 @@ void RclMain::init()
|
||||
emit sortDataChanged(m_sortspec);
|
||||
}
|
||||
|
||||
if (prefs.showTrayIcon && QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||
m_trayicon = new RclTrayIcon(this,
|
||||
QIcon(QString(":/images/recoll.png")));
|
||||
m_trayicon->show();
|
||||
} else {
|
||||
m_trayicon = 0;
|
||||
}
|
||||
enableTrayIcon(prefs.showTrayIcon);
|
||||
|
||||
fileRebuildIndexAction->setEnabled(false);
|
||||
fileToggleIndexingAction->setEnabled(false);
|
||||
@ -465,6 +459,21 @@ void RclMain::init()
|
||||
periodictimer->start(1000);
|
||||
}
|
||||
|
||||
void RclMain::enableTrayIcon(bool on)
|
||||
{
|
||||
on = on && QSystemTrayIcon::isSystemTrayAvailable();
|
||||
if (on) {
|
||||
if (nullptr == m_trayicon) {
|
||||
m_trayicon = new RclTrayIcon(this,
|
||||
QIcon(QString(":/images/recoll.png")));
|
||||
}
|
||||
m_trayicon->show();
|
||||
} else {
|
||||
delete m_trayicon;
|
||||
m_trayicon = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void RclMain::setSynEnabled(bool on)
|
||||
{
|
||||
prefs.synFileEnable = on;
|
||||
|
||||
@ -90,7 +90,7 @@ public:
|
||||
IndexerState indexerState() const {
|
||||
return m_indexerState;
|
||||
}
|
||||
|
||||
void enableTrayIcon(bool onoff);
|
||||
|
||||
public slots:
|
||||
virtual void fileExit();
|
||||
|
||||
@ -315,6 +315,7 @@ void UIPrefsDialog::accept()
|
||||
|
||||
prefs.keepSort = keepSortCB->isChecked();
|
||||
prefs.showTrayIcon = showTrayIconCB->isChecked();
|
||||
m_mainWindow->enableTrayIcon(prefs.showTrayIcon);
|
||||
prefs.closeToTray = closeToTrayCB->isChecked();
|
||||
prefs.showTempFileWarning = showTempFileWarningCB->isChecked() ?
|
||||
-1 : 1024;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user