Merge branch 'master' of https://framagit.org/medoc92/recoll
This commit is contained in:
commit
ecd7fe4065
@ -491,23 +491,21 @@ void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
|
|||||||
int curidx = pvTab->currentIndex();
|
int curidx = pvTab->currentIndex();
|
||||||
pvTab->setTabText(curidx, title);
|
pvTab->setTabText(curidx, title);
|
||||||
|
|
||||||
char datebuf[100];
|
string datebuf;
|
||||||
datebuf[0] = 0;
|
|
||||||
if (!doc.fmtime.empty() || !doc.dmtime.empty()) {
|
if (!doc.fmtime.empty() || !doc.dmtime.empty()) {
|
||||||
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);
|
||||||
strftime(datebuf, 99, "%Y-%m-%d %H:%M:%S", tm);
|
datebuf = utf8datestring("%Y-%m-%d %H:%M:%S", tm);
|
||||||
}
|
}
|
||||||
LOGDEB("Doc.url: [" << doc.url << "]\n");
|
LOGDEB("Doc.url: [" << doc.url << "]\n");
|
||||||
string url;
|
string url;
|
||||||
printableUrl(theconfig->getDefCharset(), doc.url, url);
|
printableUrl(theconfig->getDefCharset(), doc.url, url);
|
||||||
string tiptxt = url + string("\n");
|
string tiptxt = url + string("\n");
|
||||||
tiptxt += doc.mimetype + " " + string(datebuf) + "\n";
|
tiptxt += doc.mimetype + " " + datebuf + "\n";
|
||||||
if (!ctitle.empty())
|
if (!ctitle.empty())
|
||||||
tiptxt += ctitle + "\n";
|
tiptxt += ctitle + "\n";
|
||||||
pvTab->setTabToolTip(curidx,
|
pvTab->setTabToolTip(curidx, u8s2qs(tiptxt));
|
||||||
QString::fromUtf8(tiptxt.c_str(), tiptxt.length()));
|
|
||||||
|
|
||||||
PreviewTextEdit *e = currentEditor();
|
PreviewTextEdit *e = currentEditor();
|
||||||
if (e) {
|
if (e) {
|
||||||
|
|||||||
@ -194,26 +194,22 @@ static string dategetter(const string&, const Rcl::Doc& doc)
|
|||||||
{
|
{
|
||||||
string sdate;
|
string sdate;
|
||||||
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
|
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
|
||||||
char datebuf[100];
|
|
||||||
datebuf[0] = 0;
|
|
||||||
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);
|
||||||
strftime(datebuf, 99, "%Y-%m-%d", tm);
|
sdate = utf8datestring("%Y-%m-%d", tm);
|
||||||
transcode(datebuf, sdate, RclConfig::getLocaleCharset(), "UTF-8");
|
|
||||||
}
|
}
|
||||||
return sdate;
|
return sdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
static string datetimegetter(const string&, const Rcl::Doc& doc)
|
static string datetimegetter(const string&, const Rcl::Doc& doc)
|
||||||
{
|
{
|
||||||
char datebuf[100];
|
string datebuf;
|
||||||
datebuf[0] = 0;
|
|
||||||
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
|
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
|
||||||
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);
|
||||||
strftime(datebuf, 99, prefs.creslistdateformat.c_str(), tm);
|
datebuf = utf8datestring(prefs.creslistdateformat.c_str(), tm);
|
||||||
}
|
}
|
||||||
return datebuf;
|
return datebuf;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -196,13 +196,10 @@ void ResListPager::displayDoc(RclConfig *config, int i, Rcl::Doc& doc,
|
|||||||
// Document date: either doc or file modification times
|
// Document date: either doc or file modification times
|
||||||
string datebuf;
|
string datebuf;
|
||||||
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
|
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
|
||||||
char cdate[100];
|
|
||||||
cdate[0] = 0;
|
|
||||||
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);
|
||||||
strftime(cdate, 99, dateFormat().c_str(), tm);
|
datebuf = utf8datestring(dateFormat(), tm);
|
||||||
transcode(cdate, datebuf, RclConfig::getLocaleCharset(), "UTF-8");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size information. We print both doc and file if they differ a lot
|
// Size information. We print both doc and file if they differ a lot
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifdef BUILDING_RECOLL
|
#ifdef BUILDING_RECOLL
|
||||||
#include "autoconfig.h"
|
#include "autoconfig.h"
|
||||||
|
#include "transcode.h"
|
||||||
#else
|
#else
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -49,6 +49,7 @@
|
|||||||
#include "md5ut.h"
|
#include "md5ut.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "smallut.h"
|
#include "smallut.h"
|
||||||
|
#include "rclconfig.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -277,6 +278,23 @@ string url_gpathS(const string& url)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string utf8datestring(const std::string& format, struct tm *tm)
|
||||||
|
{
|
||||||
|
string u8date;
|
||||||
|
#ifdef _WIN32
|
||||||
|
wchar_t wformat[200];
|
||||||
|
utf8towchar(format, wformat, 199);
|
||||||
|
wchar_t wdate[250];
|
||||||
|
wcsftime(wdate, 250, wformat, tm);
|
||||||
|
wchartoutf8(wformat, u8date);
|
||||||
|
#else
|
||||||
|
char datebuf[200];
|
||||||
|
strftime(datebuf, 199, format.c_str(), tm);
|
||||||
|
transcode(datebuf, u8date, RclConfig::getLocaleCharset(), "UTF-8");
|
||||||
|
#endif
|
||||||
|
return u8date;
|
||||||
|
}
|
||||||
|
|
||||||
const string& tmplocation()
|
const string& tmplocation()
|
||||||
{
|
{
|
||||||
static string stmpdir;
|
static string stmpdir;
|
||||||
|
|||||||
@ -47,6 +47,10 @@ extern bool printableUrl(const std::string& fcharset,
|
|||||||
/// "/c/" This should be used only for splitting the path in rcldb.
|
/// "/c/" This should be used only for splitting the path in rcldb.
|
||||||
extern std::string url_gpathS(const std::string& url);
|
extern std::string url_gpathS(const std::string& url);
|
||||||
|
|
||||||
|
/// Like strftime but guaranteed utf-8 output (esp. useful on Windows)
|
||||||
|
struct tm;
|
||||||
|
extern std::string utf8datestring(const std::string& format, struct tm *tm);
|
||||||
|
|
||||||
/// Retrieve the temp dir location: $RECOLL_TMPDIR else $TMPDIR else /tmp
|
/// Retrieve the temp dir location: $RECOLL_TMPDIR else $TMPDIR else /tmp
|
||||||
extern const std::string& tmplocation();
|
extern const std::string& tmplocation();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user