let the user override the message about mbox index not up to date

This commit is contained in:
Jean-Francois Dockes 2013-06-18 12:12:17 +02:00
parent 214a06bc5b
commit 5bd16e37d8

View file

@ -1232,23 +1232,26 @@ void RclMain::startPreview(int docnum, Rcl::Doc doc, int mod)
if (rcldb->needUpdate(udi, sig)) { if (rcldb->needUpdate(udi, sig)) {
QString msg = QString msg =
tr("Index not up to date for this file. " tr("Index not up to date for this file. "
"Refusing to risk showing the wrong entry."); "Refusing to risk showing the wrong entry. ");
if (m_indexerState == IXST_NOTRUNNING) { bool ixnotact = (m_indexerState == IXST_NOTRUNNING);
if (ixnotact) {
msg += tr("Click Ok to update the " msg += tr("Click Ok to update the "
"index for this file, then re-run the " "index for this file, then you will need to "
"query when indexing is done. " "re-run the query when indexing is done. ");
"Else, Cancel.");
} else { } else {
msg += tr("Indexer running so things should improve when " msg += tr("The indexer is running so things should "
"it's done"); "improve when it's done. ");
} }
msg += tr("Click Cancel to return to the list. "
"Click Ignore to show the preview anyway. ");
QMessageBox::StandardButtons bts =
QMessageBox::Ignore | QMessageBox::Cancel;
if (ixnotact)
bts |= QMessageBox::Ok;
int rep = int rep =
QMessageBox::warning(0, tr("Warning"), QMessageBox::warning(0, tr("Warning"),
msg, msg, bts,
QMessageBox::Ok, ixnotact? QMessageBox::Cancel :
(m_indexerState == IXST_NOTRUNNING) ?
QMessageBox::Cancel :
QMessageBox::NoButton,
QMessageBox::NoButton); QMessageBox::NoButton);
if (m_indexerState == IXST_NOTRUNNING && if (m_indexerState == IXST_NOTRUNNING &&
rep == QMessageBox::Ok) { rep == QMessageBox::Ok) {
@ -1257,6 +1260,7 @@ void RclMain::startPreview(int docnum, Rcl::Doc doc, int mod)
vector<Rcl::Doc> docs(1, doc); vector<Rcl::Doc> docs(1, doc);
updateIdxForDocs(docs); updateIdxForDocs(docs);
} }
if (rep != QMessageBox::Ignore)
return; return;
} }
} }