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:
parent
6659a2be0d
commit
6d98115eac
@ -611,6 +611,7 @@ class LoadThread : public QThread {
|
|||||||
public:
|
public:
|
||||||
string missing;
|
string missing;
|
||||||
TempFile imgtmp;
|
TempFile imgtmp;
|
||||||
|
string tdirreason;
|
||||||
|
|
||||||
LoadThread(int *stp, Rcl::Doc& odoc, const Rcl::Doc& idc)
|
LoadThread(int *stp, Rcl::Doc& odoc, const Rcl::Doc& idc)
|
||||||
: statusp(stp), out(odoc), idoc(idc)
|
: statusp(stp), out(odoc), idoc(idc)
|
||||||
@ -621,11 +622,9 @@ class LoadThread : public QThread {
|
|||||||
}
|
}
|
||||||
virtual void run() {
|
virtual void run() {
|
||||||
DebugLog::getdbl()->setloglevel(loglevel);
|
DebugLog::getdbl()->setloglevel(loglevel);
|
||||||
string reason;
|
|
||||||
if (!tmpdir.ok()) {
|
if (!tmpdir.ok()) {
|
||||||
QMessageBox::critical(0, "Recoll",
|
tdirreason = tmpdir.getreason();
|
||||||
Preview::tr("Cannot create temporary directory"));
|
LOGERR(("Preview: %s\n", tdirreason.c_str()));
|
||||||
LOGERR(("Preview: %s\n", tmpdir.getreason().c_str()));
|
|
||||||
*statusp = -1;
|
*statusp = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -753,15 +752,23 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
|||||||
return false;
|
return false;
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
QString explain;
|
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>") +
|
explain = QString::fromAscii("<br>") +
|
||||||
tr("Missing helper program: ") +
|
tr("Missing helper program: ") +
|
||||||
QString::fromLocal8Bit(lthr.missing.c_str());
|
QString::fromLocal8Bit(lthr.missing.c_str());
|
||||||
}
|
QMessageBox::warning(0, "Recoll",
|
||||||
QMessageBox::warning(0, "Recoll",
|
tr("Can't turn doc into internal "
|
||||||
tr("Can't turn doc into internal "
|
"representation for ") +
|
||||||
"representation for ") +
|
fdoc.mimetype.c_str() + explain);
|
||||||
fdoc.mimetype.c_str() + explain);
|
} else {
|
||||||
|
QMessageBox::warning(0, "Recoll",
|
||||||
|
tr("Error while loading file"));
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Reset config just in case.
|
// Reset config just in case.
|
||||||
|
|||||||
@ -589,8 +589,8 @@ void ResList::mouseDoubleClickEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
void ResList::linkWasClicked(const QUrl &url)
|
void ResList::linkWasClicked(const QUrl &url)
|
||||||
{
|
{
|
||||||
QString s = url.toString();
|
QByteArray s = url.toString().toAscii();
|
||||||
const char *ascurl = s.toAscii();
|
const char *ascurl = (const char *)s;
|
||||||
LOGDEB(("ResList::linkWasClicked: [%s]\n", ascurl));
|
LOGDEB(("ResList::linkWasClicked: [%s]\n", ascurl));
|
||||||
|
|
||||||
int i = atoi(ascurl+1) - 1;
|
int i = atoi(ascurl+1) - 1;
|
||||||
|
|||||||
@ -124,7 +124,8 @@ bool maketmpdir(string& tdir, string& reason)
|
|||||||
#endif // HAVE_MKDTEMP
|
#endif // HAVE_MKDTEMP
|
||||||
) {
|
) {
|
||||||
free(cp);
|
free(cp);
|
||||||
reason = "maketmpdir: mktemp failed\n";
|
reason = "maketmpdir: mktemp failed for [" + tdir + "] : " +
|
||||||
|
strerror(errno);
|
||||||
tdir.erase();
|
tdir.erase();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user