GUI: Automatically popup the "show missing helpers" dialog after first indexing

This commit is contained in:
Jean-Francois Dockes 2012-10-23 20:06:16 +02:00
parent 95ef518ec7
commit 96a04211af
2 changed files with 22 additions and 2 deletions

View File

@ -621,6 +621,10 @@ void RclMain::periodic100()
if (status) { if (status) {
QMessageBox::warning(0, "Recoll", QMessageBox::warning(0, "Recoll",
tr("Indexing failed")); tr("Indexing failed"));
} else {
// On the first run, show missing helpers. We only do this once
if (m_firstIndexing)
showMissingHelpers();
} }
string reason; string reason;
maybeOpenDb(reason, 1); maybeOpenDb(reason, 1);
@ -713,6 +717,11 @@ void RclMain::toggleIndexing()
break; break;
case IXST_NOTRUNNING: case IXST_NOTRUNNING:
{ {
// Could also mean that no helpers are missing, but then we
// won't try to show a message anyway (which is what
// firstIndexing is used for)
m_firstIndexing = theconfig->getMissingHelperDesc().empty();
vector<string> args; vector<string> args;
args.push_back("-c"); args.push_back("-c");
args.push_back(theconfig->getConfDir()); args.push_back(theconfig->getConfDir());
@ -739,6 +748,10 @@ void RclMain::rebuildIndex()
QMessageBox::Cancel, QMessageBox::Cancel,
QMessageBox::NoButton); QMessageBox::NoButton);
if (rep == QMessageBox::Ok) { if (rep == QMessageBox::Ok) {
// Could also mean that no helpers are missing, but then we
// won't try to show a message anyway (which is what
// firstIndexing is used for)
m_firstIndexing = theconfig->getMissingHelperDesc().empty();
vector<string> args; vector<string> args;
args.push_back("-c"); args.push_back("-c");
args.push_back(theconfig->getConfDir()); args.push_back(theconfig->getConfDir());
@ -1058,13 +1071,18 @@ void RclMain::showAboutDialog()
void RclMain::showMissingHelpers() void RclMain::showMissingHelpers()
{ {
string miss = theconfig->getMissingHelperDesc(); string miss = theconfig->getMissingHelperDesc();
QString msg = tr("External applications/commands needed and not found " QString msg = QString::fromAscii("<p>") +
tr("External applications/commands needed and not found "
"for indexing your file types:\n\n"); "for indexing your file types:\n\n");
msg += "(<i>";
msg += QString::fromLocal8Bit(theconfig->getConfDir().c_str());
msg += "/missing</i>):<pre>\n";
if (!miss.empty()) { if (!miss.empty()) {
msg += QString::fromUtf8(miss.c_str()); msg += QString::fromUtf8(miss.c_str());
} else { } else {
msg += tr("No helpers found missing"); msg += tr("No helpers found missing");
} }
msg += "</pre>";
QMessageBox::information(this, tr("Missing helper programs"), msg); QMessageBox::information(this, tr("Missing helper programs"), msg);
} }

View File

@ -71,7 +71,8 @@ public:
m_idxproc(0), m_idxproc(0),
m_sortspecnochange(false), m_sortspecnochange(false),
m_indexerState(IXST_RUNNINGNOTMINE), m_indexerState(IXST_RUNNINGNOTMINE),
m_queryActive(false) m_queryActive(false),
m_firstIndexing(false)
{ {
setupUi(this); setupUi(this);
init(); init();
@ -177,6 +178,7 @@ private:
RefCntr<DocSequence> m_source; RefCntr<DocSequence> m_source;
IndexerState m_indexerState; IndexerState m_indexerState;
bool m_queryActive; bool m_queryActive;
bool m_firstIndexing;
// If set on init, will be displayed either through ext app, or // If set on init, will be displayed either through ext app, or
// preview (if no ext app set) // preview (if no ext app set)