try to better handle non-ascii file names

This commit is contained in:
dockes
2006-03-29 11:18:15 +00:00
parent d47f70c595
commit 516a588d04
13 changed files with 159 additions and 65 deletions
+10 -5
View File
@@ -351,11 +351,13 @@ class LoadThread : public QThread {
string ipath;
string *mtype;
string tmpdir;
int loglevel;
public:
LoadThread(int *stp, Rcl::Doc *odoc, string fn, string ip, string *mt)
: statusp(stp), out(odoc), filename(fn), ipath(ip), mtype(mt)
{}
{
loglevel = DebugLog::getdbl()->getlevel();
}
~LoadThread() {
if (tmpdir.length()) {
wipedir(tmpdir);
@@ -363,7 +365,7 @@ class LoadThread : public QThread {
}
}
virtual void run() {
DebugLog::getdbl()->setloglevel(DEBDEB1);
DebugLog::getdbl()->setloglevel(loglevel);
if (!maketmpdir(tmpdir)) {
QMessageBox::critical(0, "Recoll",
Preview::tr("Cannot create temporary directory"));
@@ -389,14 +391,17 @@ class ToRichThread : public QThread {
list<string> &terms;
string& firstTerm;
QString &out;
int loglevel;
public:
ToRichThread(string &i, list<string> &trms,
string& ft, QString &o)
: in(i), terms(trms), firstTerm(ft), out(o)
{}
{
loglevel = DebugLog::getdbl()->getlevel();
}
virtual void run()
{
DebugLog::getdbl()->setloglevel(DEBDEB1);
DebugLog::getdbl()->setloglevel(loglevel);
string rich;
try {
plaintorich(in, rich, terms, &firstTerm);
+25 -5
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.5 2006-03-22 11:17:49 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.6 2006-03-29 11:18:14 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
#include <time.h>
@@ -19,6 +19,8 @@ static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.5 2006-03-22 11:17:49 dockes E
#include "guiutils.h"
#include "pathut.h"
#include "docseq.h"
#include "transcode.h"
#include "pathut.h"
#include "rclreslist.h"
#include "moc_rclreslist.cpp"
@@ -242,7 +244,7 @@ void RclResList::showResultPage()
.arg(resCnt);
append(chunk);
}
gotone = true;
// Determine icon to display if any
@@ -265,9 +267,17 @@ void RclResList::showResultPage()
sprintf(perbuf, "%3d%% ", percent);
// Make title out of file name if none yet
if (doc.title.empty())
doc.title = path_getsimple(doc.url);
string fcharset = rclconfig->getDefCharset(true);
if (doc.title.empty()) {
transcode(path_getsimple(doc.url), doc.title, fcharset, "UTF-8");
}
// Printable url: either utf-8 if transcoding succeeds, or url-encoded
string url; int ecnt = 0;
if (!transcode(doc.url, url, fcharset, "UTF-8", &ecnt) || ecnt) {
url = url_encode(doc.url, 7);
}
// Document date: either doc or file modification time
char datebuf[100];
datebuf[0] = 0;
@@ -317,7 +327,7 @@ void RclResList::showResultPage()
if (!img_name.empty()) {
result += "<img source=\"" + img_name + "\" align=\"left\">";
}
result += "<i>" + doc.url + +"</i><br>";
result += "<i>" + url + +"</i><br>";
if (!abst.empty())
result += abst + "<br>";
if (!doc.keywords.empty())
@@ -417,6 +427,7 @@ QPopupMenu *RclResList::createPopupMenu(const QPoint& pos)
popup->insertItem(tr("&Preview"), this, SLOT(menuPreview()));
popup->insertItem(tr("&Edit"), this, SLOT(menuEdit()));
popup->insertItem(tr("&Copy File Name"), this, SLOT(menuCopyFN()));
popup->insertItem(tr("Copy &Url"), this, SLOT(menuCopyURL()));
return popup;
}
@@ -437,3 +448,12 @@ void RclResList::menuCopyFN()
QClipboard::Selection);
}
}
void RclResList::menuCopyURL()
{
Rcl::Doc doc;
if (getDoc(m_docnum, doc)) {
string url = url_encode(doc.url, 7);
QApplication::clipboard()->setText(url.c_str(),
QClipboard::Selection);
}
}
+2 -1
View File
@@ -1,6 +1,6 @@
#ifndef _RCLRESLIST_H_INCLUDED_
#define _RCLRESLIST_H_INCLUDED_
/* @(#$Id: rclreslist.h,v 1.3 2006-03-21 15:11:30 dockes Exp $ (C) 2005 J.F.Dockes */
/* @(#$Id: rclreslist.h,v 1.4 2006-03-29 11:18:14 dockes Exp $ (C) 2005 J.F.Dockes */
#include <qtextbrowser.h>
#include <qpopupmenu.h>
@@ -30,6 +30,7 @@ class RclResList : public QTextBrowser
virtual void menuPreview();
virtual void menuEdit();
virtual void menuCopyFN();
virtual void menuCopyURL();
signals:
void nextPageAvailable(bool);