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);
|
emit sortDataChanged(m_sortspec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefs.showTrayIcon && QSystemTrayIcon::isSystemTrayAvailable()) {
|
enableTrayIcon(prefs.showTrayIcon);
|
||||||
m_trayicon = new RclTrayIcon(this,
|
|
||||||
QIcon(QString(":/images/recoll.png")));
|
|
||||||
m_trayicon->show();
|
|
||||||
} else {
|
|
||||||
m_trayicon = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fileRebuildIndexAction->setEnabled(false);
|
fileRebuildIndexAction->setEnabled(false);
|
||||||
fileToggleIndexingAction->setEnabled(false);
|
fileToggleIndexingAction->setEnabled(false);
|
||||||
@ -465,6 +459,21 @@ void RclMain::init()
|
|||||||
periodictimer->start(1000);
|
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)
|
void RclMain::setSynEnabled(bool on)
|
||||||
{
|
{
|
||||||
prefs.synFileEnable = on;
|
prefs.synFileEnable = on;
|
||||||
|
|||||||
@ -90,7 +90,7 @@ public:
|
|||||||
IndexerState indexerState() const {
|
IndexerState indexerState() const {
|
||||||
return m_indexerState;
|
return m_indexerState;
|
||||||
}
|
}
|
||||||
|
void enableTrayIcon(bool onoff);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void fileExit();
|
virtual void fileExit();
|
||||||
|
|||||||
@ -315,6 +315,7 @@ void UIPrefsDialog::accept()
|
|||||||
|
|
||||||
prefs.keepSort = keepSortCB->isChecked();
|
prefs.keepSort = keepSortCB->isChecked();
|
||||||
prefs.showTrayIcon = showTrayIconCB->isChecked();
|
prefs.showTrayIcon = showTrayIconCB->isChecked();
|
||||||
|
m_mainWindow->enableTrayIcon(prefs.showTrayIcon);
|
||||||
prefs.closeToTray = closeToTrayCB->isChecked();
|
prefs.closeToTray = closeToTrayCB->isChecked();
|
||||||
prefs.showTempFileWarning = showTempFileWarningCB->isChecked() ?
|
prefs.showTempFileWarning = showTempFileWarningCB->isChecked() ?
|
||||||
-1 : 1024;
|
-1 : 1024;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user