diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index db7d9a26..6dfa659a 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -134,6 +134,11 @@ void rwSettings(bool writing) SETTING_RW(prefs.abssep, "/Recoll/prefs/reslist/abssep", String,"…"); if (!writing && prefs.abssep == "") prefs.abssep = "…"; + SETTING_RW(prefs.reslistdateformat, "/Recoll/prefs/reslist/dateformat", + String," %Y-%m-%d %H:%M:%S %z"); + if (!writing && prefs.reslistdateformat == "") + 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, ""); diff --git a/src/qtgui/guiutils.h b/src/qtgui/guiutils.h index 24774b37..93c7f9e7 100644 --- a/src/qtgui/guiutils.h +++ b/src/qtgui/guiutils.h @@ -50,6 +50,9 @@ class PrefsPack { string creslistformat; // Abstract snippet separator QString abssep; + // Date strftime format + QString reslistdateformat; + string creslistdateformat; QString stylesheetFile; QString queryStemLang; int mainwidth; diff --git a/src/qtgui/reslist.cpp b/src/qtgui/reslist.cpp index 71a06ef9..b8615a8e 100644 --- a/src/qtgui/reslist.cpp +++ b/src/qtgui/reslist.cpp @@ -71,6 +71,7 @@ public: virtual string trans(const string& in); virtual string detailsLink(); virtual const string &parFormat(); + virtual const string &dateFormat(); virtual string nextUrl(); virtual string prevUrl(); virtual string pageTop(); @@ -140,6 +141,10 @@ const string& QtGuiResListPager::parFormat() { return prefs.creslistformat; } +const string& QtGuiResListPager::dateFormat() +{ + return prefs.creslistdateformat; +} string QtGuiResListPager::nextUrl() { diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index 4c75f2da..a40b59d5 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -7,7 +7,7 @@ 0 0 530 - 559 + 446 @@ -22,7 +22,7 @@ - 0 + 3 @@ -31,36 +31,6 @@ - - - - - - - 1 - 0 - - - - Number of entries in a result page - - - false - - - - - - - 1 - - - 8 - - - - - @@ -85,109 +55,6 @@ - - - - - - Result list font - - - false - - - - - - - Opens a dialog to select the result list font - - - Helvetica-10 - - - - - - - Resets the result list font to the system default - - - Reset - - - - - - - - - - - - 0 - 0 - - - - Defines the format for each result list paragraph. Use qt html format and printf-like replacements:<br>%A Abstract<br> %D Date<br> %I Icon image name<br> %K Keywords (if any)<br> %L Preview and Edit links<br> %M Mime type<br> %N Result number<br> %R Relevance percentage<br> %S Size information<br> %T Title<br> %U Url<br> - - - Result paragraph<br>format string - - - false - - - - - - - - 1 - 0 - - - - - 0 - 0 - - - - true - - - - - - - - - - - - - - Abstract snippet separator - - - false - - - - - - - - 30 - 0 - - - - - - @@ -255,6 +122,29 @@ + + + + Prefer Html to plain text for preview. + + + false + + + + + + + Lines in PRE text are not folded. Using BR loses some indentation. + + + Use <PRE> tags instead of <BR>to display plain text as html in preview. + + + false + + + @@ -313,27 +203,188 @@ - - - Prefer Html to plain text for preview. + + + Qt::Vertical - - false + + QSizePolicy::Expanding - + + + 20 + 70 + + + + + + + + + + + Result List + + + + + + + + + + + 1 + 0 + + + + Number of entries in a result page + + + false + + + + + + + 1 + + + 8 + + + + - - - Lines in PRE text are not folded. Using BR loses indentation. - - - Use <PRE> tags instead of <BR>to display plain text as html. - - - false - - + + + + + Result list font + + + false + + + + + + + Opens a dialog to select the result list font + + + Helvetica-10 + + + + + + + Resets the result list font to the system default + + + Reset + + + + + + + + + + + + 0 + 0 + + + + Defines the format for each result list paragraph. Use qt html format and printf-like replacements:<br>%A Abstract<br> %D Date<br> %I Icon image name<br> %K Keywords (if any)<br> %L Preview and Edit links<br> %M Mime type<br> %N Result number<br> %R Relevance percentage<br> %S Size information<br> %T Title<br> %U Url<br> Go to http://www.recoll.org/custom.html for examples. + + + Result paragraph<br>format string + + + false + + + + + + + + 1 + 0 + + + + + 0 + 0 + + + + true + + + + + + + + + + + + + + Date format (strftime(3)) + + + false + + + + + + + + 30 + 0 + + + + + + + + + + + + Abstract snippet separator + + + false + + + + + + + + 30 + 0 + + + + + @@ -344,19 +395,19 @@ Search parameters - - - - If checked, results with the same content under different names will only be shown once. - - - Hide duplicate results. - - - false - - - + + + + If checked, results with the same content under different names will only be shown once. + + + Hide duplicate results. + + + false + + + diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index fcee1482..ad55f3d1 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -106,6 +106,7 @@ void UIPrefsDialog::setFromPrefs() qtermColorLE->setText(prefs.qtermcolor); // Abstract snippet separator string abssepLE->setText(prefs.abssep); + dateformatLE->setText(prefs.reslistdateformat); // Result list font family and size reslistFontFamily = prefs.reslistfontfamily; @@ -194,6 +195,8 @@ void UIPrefsDialog::accept() prefs.qtermcolor = qtermColorLE->text(); prefs.abssep = abssepLE->text(); + prefs.reslistdateformat = dateformatLE->text(); + prefs.creslistdateformat = (const char*)prefs.reslistdateformat.toUtf8(); prefs.reslistfontfamily = reslistFontFamily; prefs.reslistfontsize = reslistFontSize; diff --git a/src/query/reslistpager.cpp b/src/query/reslistpager.cpp index 4b8a5aa9..49ba253d 100644 --- a/src/query/reslistpager.cpp +++ b/src/query/reslistpager.cpp @@ -161,7 +161,7 @@ void ResListPager::displayDoc(RclConfig *config, time_t mtime = doc.dmtime.empty() ? atol(doc.fmtime.c_str()) : atol(doc.dmtime.c_str()); struct tm *tm = localtime(&mtime); - strftime(datebuf, 99, " %Y-%m-%d %H:%M:%S %z", tm); + strftime(datebuf, 99, dateFormat().c_str(), tm); } // Size information. We print both doc and file if they differ a lot @@ -414,3 +414,9 @@ const string &ResListPager::parFormat() return cstr_format; } +const string &ResListPager::dateFormat() +{ + static const string cstr_format(" %Y-%m-%d %H:%M:%S %z"); + return cstr_format; +} + diff --git a/src/query/reslistpager.h b/src/query/reslistpager.h index 517efd44..05a690b1 100644 --- a/src/query/reslistpager.h +++ b/src/query/reslistpager.h @@ -106,6 +106,7 @@ public: virtual string trans(const string& in); virtual string detailsLink(); virtual const string &parFormat(); + virtual const string &dateFormat(); virtual string nextUrl(); virtual string prevUrl(); virtual string pageTop() {return string();}