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); Bool, false);
SETTING_RW(prefs.showTrayIcon, "/Recoll/prefs/showTrayIcon", Bool, false); SETTING_RW(prefs.showTrayIcon, "/Recoll/prefs/showTrayIcon", Bool, false);
SETTING_RW(prefs.closeToTray, "/Recoll/prefs/closeToTray", 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", SETTING_RW(prefs.showTempFileWarning, "Recoll/prefs/showTempFileWarning",
Int, -1); Int, -1);

View File

@ -141,6 +141,7 @@ class PrefsPack {
bool showTrayIcon{false}; bool showTrayIcon{false};
bool closeToTray{false}; bool closeToTray{false};
bool trayMessages{false};
int showTempFileWarning; int showTempFileWarning;

View File

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

View File

@ -351,6 +351,16 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<widget class="QCheckBox" name="showTempFileWarningCB"> <widget class="QCheckBox" name="showTempFileWarningCB">
<property name="text"> <property name="text">

View File

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