remove relevance percent from default reslist par format. Dont save format if default

This commit is contained in:
Jean-Francois Dockes 2013-04-14 09:29:12 +02:00
parent ec99c6bf51
commit 1554573a18

View file

@ -39,25 +39,12 @@ RclConfig *theconfig;
// qt 4.6 qtextedit to clear the margins after the float img without // qt 4.6 qtextedit to clear the margins after the float img without
// introducing blank space. // introducing blank space.
const char *PrefsPack::dfltResListFormat = const char *PrefsPack::dfltResListFormat =
#if 1
"<table><tr><td><a href='%U'><img src='%I' width='64'></a></td>" "<table><tr><td><a href='%U'><img src='%I' width='64'></a></td>"
"<td>%R %S %L &nbsp;&nbsp;<b>%T</b><br>" "<td>%S %L &nbsp;&nbsp;<b>%T</b><br>"
"%M&nbsp;%D&nbsp;&nbsp;&nbsp;<i>%U</i>&nbsp;%i<br>" "%M&nbsp;%D&nbsp;&nbsp;&nbsp;<i>%U</i>&nbsp;%i<br>"
"%A %K</td></tr></table>" "%A %K</td></tr></table>"
#elif 0
"<img src='%I' align='left'>"
"%R %S %L &nbsp;&nbsp;<b>%T</b><br>"
"%M&nbsp;%D&nbsp;&nbsp;&nbsp;<i>%U</i><br>"
"%A %K"
#endif
; ;
const char* v162reslistformat="<table><tr><td><img src='%I'></td>"
"<td>%R %S %L &nbsp;&nbsp;<b>%T</b><br>"
"%M&nbsp;%D&nbsp;&nbsp;&nbsp;<i>%U</i><br>"
"%A %K</td></tr></table>";
// The global preferences structure // The global preferences structure
PrefsPack prefs; PrefsPack prefs;
@ -145,29 +132,32 @@ void rwSettings(bool writing)
prefs.reslistdateformat = "&nbsp;%Y-%m-%d&nbsp;%H:%M:%S&nbsp;%z"; prefs.reslistdateformat = "&nbsp;%Y-%m-%d&nbsp;%H:%M:%S&nbsp;%z";
prefs.creslistdateformat = (const char*)prefs.reslistdateformat.toUtf8(); 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, SETTING_RW(prefs.reslistfontsize, "/Recoll/prefs/reslist/fontSize", Int,
10); 10);
QString rlfDflt = QString::fromAscii(prefs.dfltResListFormat); QString rlfDflt = QString::fromAscii(prefs.dfltResListFormat);
SETTING_RW(prefs.reslistformat, "/Recoll/prefs/reslist/format", String, rlfDflt); if (writing) {
prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8(); if (prefs.reslistformat.compare(rlfDflt)) {
if (!writing) { settings.setValue("/Recoll/prefs/reslist/format",
// If the current value of the format is the default for the prefs.reslistformat);
// previous version, replace it with the new default. We } else {
// should have a flag to say if it was changed instead settings.remove("/Recoll/prefs/reslist/format");
if (!prefs.creslistformat.compare(v162reslistformat)) {
LOGDEB(("Replacing old default format\n"));
prefs.reslistformat = rlfDflt;
prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();
} }
} 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.stylesheetFile, "/Recoll/prefs/stylesheet", String, "");
SETTING_RW(prefs.queryStemLang, "/Recoll/prefs/query/stemLang", String, SETTING_RW(prefs.queryStemLang, "/Recoll/prefs/query/stemLang", String,
"english"); "english");
SETTING_RW(prefs.useDesktopOpen, SETTING_RW(prefs.useDesktopOpen, "/Recoll/prefs/useDesktopOpen",
"/Recoll/prefs/useDesktopOpen", Bool, true); Bool, true);
SETTING_RW(prefs.keepSort, SETTING_RW(prefs.keepSort,
"/Recoll/prefs/keepSort", Bool, false); "/Recoll/prefs/keepSort", Bool, false);
@ -199,8 +189,7 @@ void rwSettings(bool writing)
Int, 0); Int, 0);
// This is not really the current program version, just a value to // This is not really the current program version, just a value to
// be used in case we have incompatible changes one day // be used in case we have incompatible changes one day
SETTING_RW(prefs.rclVersion, "/Recoll/prefs/rclVersion", SETTING_RW(prefs.rclVersion, "/Recoll/prefs/rclVersion", Int, 1009);
Int, 1009);
// Ssearch combobox history list // Ssearch combobox history list
if (writing) { if (writing) {