GUI: got rid of redundant creslistdateformat

This commit is contained in:
Jean-Francois Dockes 2021-03-22 16:07:12 +01:00
parent df3809a32f
commit 26d3964c1f
5 changed files with 7 additions and 10 deletions

View File

@ -192,11 +192,10 @@ void rwSettings(bool writing)
} }
} }
SETTING_RW(prefs.reslistdateformat, "/Recoll/prefs/reslist/dateformat", SETTING_RW(u8s2qs(prefs.reslistdateformat), "/Recoll/prefs/reslist/dateformat",
String," %Y-%m-%d %H:%M:%S %z"); String, " %Y-%m-%d %H:%M:%S %z");
if (!writing && prefs.reslistdateformat == "") if (!writing && prefs.reslistdateformat == "")
prefs.reslistdateformat = " %Y-%m-%d %H:%M:%S %z"; prefs.reslistdateformat = " %Y-%m-%d %H:%M:%S %z";
prefs.creslistdateformat = (const char*)prefs.reslistdateformat.toUtf8();
SETTING_RW(prefs.reslistfontfamily, "/Recoll/prefs/reslist/fontFamily", SETTING_RW(prefs.reslistfontfamily, "/Recoll/prefs/reslist/fontFamily",
String, ""); String, "");

View File

@ -65,8 +65,7 @@ public:
// is controled by darkMode // is controled by darkMode
QString darkreslistheadertext; QString darkreslistheadertext;
// Date strftime format // Date strftime format
QString reslistdateformat; string reslistdateformat;
string creslistdateformat;
// General Qt style sheet. // General Qt style sheet.
QString qssFile; QString qssFile;

View File

@ -218,7 +218,7 @@ const string& QtGuiResListPager::parFormat()
} }
const string& QtGuiResListPager::dateFormat() const string& QtGuiResListPager::dateFormat()
{ {
return prefs.creslistdateformat; return prefs.reslistdateformat;
} }
string QtGuiResListPager::nextUrl() string QtGuiResListPager::nextUrl()

View File

@ -220,7 +220,7 @@ static string datetimegetter(const string&, const Rcl::Doc& doc)
time_t mtime = doc.dmtime.empty() ? time_t mtime = doc.dmtime.empty() ?
atoll(doc.fmtime.c_str()) : atoll(doc.dmtime.c_str()); atoll(doc.fmtime.c_str()) : atoll(doc.dmtime.c_str());
struct tm *tm = localtime(&mtime); struct tm *tm = localtime(&mtime);
datebuf = utf8datestring(prefs.creslistdateformat.c_str(), tm); datebuf = utf8datestring(prefs.reslistdateformat.c_str(), tm);
} }
return datebuf; return datebuf;
} }

View File

@ -200,7 +200,7 @@ void UIPrefsDialog::setFromPrefs()
} }
// Abstract snippet separator string // Abstract snippet separator string
abssepLE->setText(prefs.abssep); abssepLE->setText(prefs.abssep);
dateformatLE->setText(prefs.reslistdateformat); dateformatLE->setText(u8s2qs(prefs.reslistdateformat));
// Result list font family and size // Result list font family and size
reslistFontFamily = prefs.reslistfontfamily; reslistFontFamily = prefs.reslistfontfamily;
@ -394,8 +394,7 @@ void UIPrefsDialog::accept()
prefs.qtermstyle = qtermStyleCMB->currentText(); prefs.qtermstyle = qtermStyleCMB->currentText();
prefs.abssep = abssepLE->text(); prefs.abssep = abssepLE->text();
prefs.reslistdateformat = dateformatLE->text(); prefs.reslistdateformat = qs2utf8s(dateformatLE->text());
prefs.creslistdateformat = (const char*)prefs.reslistdateformat.toUtf8();
prefs.reslistfontfamily = reslistFontFamily; prefs.reslistfontfamily = reslistFontFamily;
prefs.reslistfontsize = reslistFontSize; prefs.reslistfontsize = reslistFontSize;