From 661f76a718f37999325d82775ea6bebf56edc76f Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sun, 14 Apr 2013 09:29:12 +0200 Subject: [PATCH] remove relevance percent from default reslist par format. Dont save format if default --- src/qtgui/guiutils.cpp | 51 +++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index a9cdb46b..d164defb 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -39,25 +39,12 @@ RclConfig *theconfig; // qt 4.6 qtextedit to clear the margins after the float img without // introducing blank space. const char *PrefsPack::dfltResListFormat = -#if 1 "" - "
%R %S %L   %T
" + "
%S %L   %T
" "%M %D   %U %i
" "%A %K
" -#elif 0 - "" - "%R %S %L   %T
" - "%M %D   %U
" - "%A %K" -#endif ; -const char* v162reslistformat="" - "
%R %S %L   %T
" - "%M %D   %U
" - "%A %K
"; - - // The global preferences structure PrefsPack prefs; @@ -145,29 +132,32 @@ void rwSettings(bool writing) prefs.reslistdateformat = " %Y-%m-%d %H:%M:%S %z"; prefs.creslistdateformat = (const char*)prefs.reslistdateformat.toUtf8(); - SETTING_RW(prefs.reslistfontfamily, "/Recoll/prefs/reslist/fontFamily", String, - ""); + SETTING_RW(prefs.reslistfontfamily, "/Recoll/prefs/reslist/fontFamily", + String, ""); SETTING_RW(prefs.reslistfontsize, "/Recoll/prefs/reslist/fontSize", Int, 10); + QString rlfDflt = QString::fromAscii(prefs.dfltResListFormat); - SETTING_RW(prefs.reslistformat, "/Recoll/prefs/reslist/format", String, rlfDflt); - prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8(); - if (!writing) { - // If the current value of the format is the default for the - // previous version, replace it with the new default. We - // should have a flag to say if it was changed instead - if (!prefs.creslistformat.compare(v162reslistformat)) { - LOGDEB(("Replacing old default format\n")); - prefs.reslistformat = rlfDflt; - prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8(); + if (writing) { + if (prefs.reslistformat.compare(rlfDflt)) { + settings.setValue("/Recoll/prefs/reslist/format", + prefs.reslistformat); + } else { + settings.remove("/Recoll/prefs/reslist/format"); } + } else { + prefs.reslistformat = + settings.value("/Recoll/prefs/reslist/format", rlfDflt).toString(); + prefs.creslistformat = qs2utf8s(prefs.reslistformat); } - SETTING_RW(prefs.reslistheadertext, "/Recoll/prefs/reslist/headertext", String, ""); + + SETTING_RW(prefs.reslistheadertext, "/Recoll/prefs/reslist/headertext", + String, ""); SETTING_RW(prefs.stylesheetFile, "/Recoll/prefs/stylesheet", String, ""); SETTING_RW(prefs.queryStemLang, "/Recoll/prefs/query/stemLang", String, "english"); - SETTING_RW(prefs.useDesktopOpen, - "/Recoll/prefs/useDesktopOpen", Bool, true); + SETTING_RW(prefs.useDesktopOpen, "/Recoll/prefs/useDesktopOpen", + Bool, true); SETTING_RW(prefs.keepSort, "/Recoll/prefs/keepSort", Bool, false); @@ -199,8 +189,7 @@ void rwSettings(bool writing) Int, 0); // This is not really the current program version, just a value to // be used in case we have incompatible changes one day - SETTING_RW(prefs.rclVersion, "/Recoll/prefs/rclVersion", - Int, 1009); + SETTING_RW(prefs.rclVersion, "/Recoll/prefs/rclVersion", Int, 1009); // Ssearch combobox history list if (writing) {