|
a/src/qtgui/preview_w.cpp |
|
b/src/qtgui/preview_w.cpp |
|
... |
|
... |
713 |
/* A thread to to the file reading / format conversion */
|
713 |
/* A thread to to the file reading / format conversion */
|
714 |
class LoadThread : public QThread {
|
714 |
class LoadThread : public QThread {
|
715 |
int *statusp;
|
715 |
int *statusp;
|
716 |
Rcl::Doc& out;
|
716 |
Rcl::Doc& out;
|
717 |
const Rcl::Doc& idoc;
|
717 |
const Rcl::Doc& idoc;
|
718 |
TempDir tmpdir;
|
|
|
719 |
int loglevel;
|
718 |
int loglevel;
|
720 |
public:
|
719 |
public:
|
721 |
string missing;
|
720 |
string missing;
|
722 |
TempFile imgtmp;
|
721 |
TempFile imgtmp;
|
723 |
string tdirreason;
|
|
|
724 |
|
722 |
|
725 |
LoadThread(int *stp, Rcl::Doc& odoc, const Rcl::Doc& idc)
|
723 |
LoadThread(int *stp, Rcl::Doc& odoc, const Rcl::Doc& idc)
|
726 |
: statusp(stp), out(odoc), idoc(idc)
|
724 |
: statusp(stp), out(odoc), idoc(idc)
|
727 |
{
|
725 |
{
|
728 |
loglevel = DebugLog::getdbl()->getlevel();
|
726 |
loglevel = DebugLog::getdbl()->getlevel();
|
729 |
}
|
727 |
}
|
730 |
~LoadThread() {
|
728 |
~LoadThread() {
|
731 |
}
|
729 |
}
|
732 |
virtual void run() {
|
730 |
virtual void run() {
|
733 |
DebugLog::getdbl()->setloglevel(loglevel);
|
731 |
DebugLog::getdbl()->setloglevel(loglevel);
|
734 |
if (!tmpdir.ok()) {
|
|
|
735 |
tdirreason = tmpdir.getreason();
|
|
|
736 |
LOGERR(("Preview: %s\n", tdirreason.c_str()));
|
|
|
737 |
*statusp = -1;
|
|
|
738 |
return;
|
|
|
739 |
}
|
|
|
740 |
|
732 |
|
741 |
FileInterner interner(idoc, theconfig, tmpdir,
|
733 |
FileInterner interner(idoc, theconfig, FileInterner::FIF_forPreview);
|
742 |
FileInterner::FIF_forPreview);
|
|
|
743 |
FIMissingStore mst;
|
734 |
FIMissingStore mst;
|
744 |
interner.setMissingStore(&mst);
|
735 |
interner.setMissingStore(&mst);
|
745 |
// Even when previewHtml is set, we don't set the interner's
|
736 |
// Even when previewHtml is set, we don't set the interner's
|
746 |
// target mtype to html because we do want the html filter to
|
737 |
// target mtype to html because we do want the html filter to
|
747 |
// do its work: we won't use the text/plain, but we want the
|
738 |
// do its work: we won't use the text/plain, but we want the
|
|
... |
|
... |
857 |
|
848 |
|
858 |
if (CancelCheck::instance().cancelState())
|
849 |
if (CancelCheck::instance().cancelState())
|
859 |
return false;
|
850 |
return false;
|
860 |
if (status != 0) {
|
851 |
if (status != 0) {
|
861 |
QString explain;
|
852 |
QString explain;
|
862 |
if (!lthr.tdirreason.empty()) {
|
|
|
863 |
explain = tr("Cannot create temporary directory: ") +
|
|
|
864 |
QString::fromLocal8Bit(lthr.tdirreason.c_str());
|
|
|
865 |
QMessageBox::critical(0, "Recoll", explain);
|
|
|
866 |
} else if (!lthr.missing.empty()) {
|
853 |
if (!lthr.missing.empty()) {
|
867 |
explain = QString::fromAscii("<br>") +
|
854 |
explain = QString::fromAscii("<br>") +
|
868 |
tr("Missing helper program: ") +
|
855 |
tr("Missing helper program: ") +
|
869 |
QString::fromLocal8Bit(lthr.missing.c_str());
|
856 |
QString::fromLocal8Bit(lthr.missing.c_str());
|
870 |
QMessageBox::warning(0, "Recoll",
|
857 |
QMessageBox::warning(0, "Recoll",
|
871 |
tr("Can't turn doc into internal "
|
858 |
tr("Can't turn doc into internal "
|