Fixed GUI bugs revealed by qt 4.7.4/opensuse 12.1. Symptoms: the result list links would not work, the GUI would crash after temp directory creation failure in preview

This commit is contained in:
Jean-Francois Dockes 2011-11-07 13:47:38 +01:00
parent 6659a2be0d
commit 6d98115eac
3 changed files with 21 additions and 13 deletions

View File

@ -611,6 +611,7 @@ class LoadThread : public QThread {
public:
string missing;
TempFile imgtmp;
string tdirreason;
LoadThread(int *stp, Rcl::Doc& odoc, const Rcl::Doc& idc)
: statusp(stp), out(odoc), idoc(idc)
@ -621,11 +622,9 @@ class LoadThread : public QThread {
}
virtual void run() {
DebugLog::getdbl()->setloglevel(loglevel);
string reason;
if (!tmpdir.ok()) {
QMessageBox::critical(0, "Recoll",
Preview::tr("Cannot create temporary directory"));
LOGERR(("Preview: %s\n", tmpdir.getreason().c_str()));
tdirreason = tmpdir.getreason();
LOGERR(("Preview: %s\n", tdirreason.c_str()));
*statusp = -1;
return;
}
@ -753,15 +752,23 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
return false;
if (status != 0) {
QString explain;
if (!lthr.missing.empty()) {
if (!lthr.tdirreason.empty()) {
explain = tr("Cannot create temporary directory: ") +
QString::fromLocal8Bit(lthr.tdirreason.c_str());
QMessageBox::critical(0, "Recoll", explain);
} else if (!lthr.missing.empty()) {
explain = QString::fromAscii("<br>") +
tr("Missing helper program: ") +
QString::fromLocal8Bit(lthr.missing.c_str());
}
QMessageBox::warning(0, "Recoll",
tr("Can't turn doc into internal "
"representation for ") +
fdoc.mimetype.c_str() + explain);
QMessageBox::warning(0, "Recoll",
tr("Can't turn doc into internal "
"representation for ") +
fdoc.mimetype.c_str() + explain);
} else {
QMessageBox::warning(0, "Recoll",
tr("Error while loading file"));
}
return false;
}
// Reset config just in case.

View File

@ -589,8 +589,8 @@ void ResList::mouseDoubleClickEvent(QMouseEvent *event)
void ResList::linkWasClicked(const QUrl &url)
{
QString s = url.toString();
const char *ascurl = s.toAscii();
QByteArray s = url.toString().toAscii();
const char *ascurl = (const char *)s;
LOGDEB(("ResList::linkWasClicked: [%s]\n", ascurl));
int i = atoi(ascurl+1) - 1;

View File

@ -124,7 +124,8 @@ bool maketmpdir(string& tdir, string& reason)
#endif // HAVE_MKDTEMP
) {
free(cp);
reason = "maketmpdir: mktemp failed\n";
reason = "maketmpdir: mktemp failed for [" + tdir + "] : " +
strerror(errno);
tdir.erase();
return false;
}