GUI: add preference to turn off tray messages (notifications) when systray is in use

This commit is contained in:
Jean-Francois Dockes 2019-10-09 09:42:28 +02:00
parent 85397eac08
commit c46446ae1f
5 changed files with 23 additions and 2 deletions

View File

@ -305,6 +305,7 @@ void rwSettings(bool writing)
Bool, false);
SETTING_RW(prefs.showTrayIcon, "/Recoll/prefs/showTrayIcon", Bool, false);
SETTING_RW(prefs.closeToTray, "/Recoll/prefs/closeToTray", Bool, false);
SETTING_RW(prefs.trayMessages, "/Recoll/prefs/trayMessages", Bool, false);
SETTING_RW(prefs.showTempFileWarning, "Recoll/prefs/showTempFileWarning",
Int, -1);

View File

@ -141,7 +141,8 @@ class PrefsPack {
bool showTrayIcon{false};
bool closeToTray{false};
bool trayMessages{false};
int showTempFileWarning;
// Advanced search window clause list state

View File

@ -637,7 +637,7 @@ void RclMain::adjustPrefsMenu()
void RclMain::showTrayMessage(const QString& text)
{
if (m_trayicon)
if (m_trayicon && prefs.trayMessages)
m_trayicon->showMessage("Recoll", text,
QSystemTrayIcon::Information, 1000);
}

View File

@ -351,6 +351,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="trayMessagesCB">
<property name="text">
<string>Generate desktop notifications.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showTempFileWarningCB">
<property name="text">

View File

@ -143,12 +143,17 @@ void UIPrefsDialog::setFromPrefs()
initStartAdvCB->setChecked(prefs.startWithAdvSearchOpen);
keepSortCB->setChecked(prefs.keepSort);
showTrayIconCB->setChecked(prefs.showTrayIcon);
if (!prefs.showTrayIcon) {
prefs.closeToTray = false;
prefs.trayMessages = false;
}
closeToTrayCB->setEnabled(showTrayIconCB->checkState());
trayMessagesCB->setEnabled(showTrayIconCB->checkState());
closeToTrayCB->setChecked(prefs.closeToTray);
trayMessagesCB->setChecked(prefs.trayMessages);
showTempFileWarningCB->setChecked(prefs.showTempFileWarning == -1);
anchorTamilHackCB->setChecked(settings.value("anchorSpcHack", 0).toBool());
previewHtmlCB->setChecked(prefs.previewHtml);
@ -339,6 +344,8 @@ void UIPrefsDialog::accept()
prefs.showTrayIcon = showTrayIconCB->isChecked();
m_mainWindow->enableTrayIcon(prefs.showTrayIcon);
prefs.closeToTray = closeToTrayCB->isChecked();
prefs.trayMessages = trayMessagesCB->isChecked();
prefs.showTempFileWarning = showTempFileWarningCB->isChecked() ?
-1 : 1024;
settings.setValue("anchorSpcHack", anchorTamilHackCB->isChecked());
@ -598,8 +605,10 @@ void UIPrefsDialog::on_showTrayIconCB_clicked()
{
if (!showTrayIconCB->checkState()) {
closeToTrayCB->setChecked(false);
trayMessagesCB->setChecked(false);
}
closeToTrayCB->setEnabled(showTrayIconCB->checkState());
trayMessagesCB->setEnabled(showTrayIconCB->checkState());
}
/**