From a90c4bf698d423fc4adb72170fd7a5031695495b Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sun, 20 Oct 2019 10:31:40 +0200 Subject: [PATCH] GUI: warning when opening temp file: really remember the preference from the dialog --- src/qtgui/guiutils.cpp | 1 + src/qtgui/guiutils.h | 1 + src/qtgui/rclm_view.cpp | 5 +++++ src/qtgui/ssearch_w.cpp | 1 + src/qtgui/uiprefs_w.cpp | 1 + 5 files changed, 9 insertions(+) diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index 41085fcd..e27ebed2 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -306,6 +306,7 @@ void rwSettings(bool writing) 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); + // See qxtconfirmationmessage. Needs to be -1 for the dialog to show. SETTING_RW(prefs.showTempFileWarning, "Recoll/prefs/showTempFileWarning", Int, -1); diff --git a/src/qtgui/guiutils.h b/src/qtgui/guiutils.h index 60d5e99b..fcf64c8d 100644 --- a/src/qtgui/guiutils.h +++ b/src/qtgui/guiutils.h @@ -143,6 +143,7 @@ class PrefsPack { bool closeToTray{false}; bool trayMessages{false}; + // See qxtconfirmationmessage. Needs to be -1 for the dialog to show int showTempFileWarning; // Advanced search window clause list state diff --git a/src/qtgui/rclm_view.cpp b/src/qtgui/rclm_view.cpp index 5be8aadb..393c1b69 100644 --- a/src/qtgui/rclm_view.cpp +++ b/src/qtgui/rclm_view.cpp @@ -375,6 +375,11 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term) confirm.setSettingsPath("Recoll/prefs"); confirm.setOverrideSettingsKey("showTempFileWarning"); confirm.exec(); + // Pita: need to keep the prefs struct in sync, else the value + // will be clobbered on program exit. + QSettings settings("Recoll.org", "recoll"); + prefs.showTempFileWarning = + settings.value("Recoll/prefs/showTempFileWarning").toInt(); } // If we are not called with a page number (which would happen for a call diff --git a/src/qtgui/ssearch_w.cpp b/src/qtgui/ssearch_w.cpp index 70c892dc..8cfd16ed 100644 --- a/src/qtgui/ssearch_w.cpp +++ b/src/qtgui/ssearch_w.cpp @@ -253,6 +253,7 @@ void SSearch::onCompleterShown() // nothing was typed. So we disable the completion if a bool SSearch::eventFilter(QObject *target, QEvent *event) { + Q_UNUSED(target); LOGDEB1("SSearch::eventFilter: event\n"); if (event->type() != QEvent::KeyPress) { return false; diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index 3d6f18ff..3d5bcefa 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -154,6 +154,7 @@ void UIPrefsDialog::setFromPrefs() closeToTrayCB->setChecked(prefs.closeToTray); trayMessagesCB->setChecked(prefs.trayMessages); + // See qxtconfirmationmessage. Needs to be -1 for the dialog to show. showTempFileWarningCB->setChecked(prefs.showTempFileWarning == -1); anchorTamilHackCB->setChecked(settings.value("anchorSpcHack", 0).toBool()); previewHtmlCB->setChecked(prefs.previewHtml);