diff --git a/src/qtgui/main.cpp b/src/qtgui/main.cpp index 25fb4672..99cbd942 100644 --- a/src/qtgui/main.cpp +++ b/src/qtgui/main.cpp @@ -111,8 +111,6 @@ bool maybeOpenDb(string &reason, bool force, bool *maindberror) if (!edbs->empty()) { rcldb->setExtraQueryDbs(*edbs); } - prefs.useTmpActiveExtraDbs = false; - prefs.tmpActiveExtraDbs.clear(); Rcl::Db::OpenError error; if (!rcldb->isopen() && !rcldb->open(Rcl::Db::DbRO, &error)) { diff --git a/src/qtgui/rclm_wins.cpp b/src/qtgui/rclm_wins.cpp index 88dead81..dba70f9c 100644 --- a/src/qtgui/rclm_wins.cpp +++ b/src/qtgui/rclm_wins.cpp @@ -46,38 +46,38 @@ static const QKeySequence closeKeySeq("Ctrl+w"); void RclMain::showAdvSearchDialog() { if (asearchform == 0) { - asearchform = new AdvSearch(0); + asearchform = new AdvSearch(0); if (asearchform == 0) { return; } - connect(new QShortcut(quitKeySeq, asearchform), SIGNAL (activated()), - this, SLOT (fileExit())); + connect(new QShortcut(quitKeySeq, asearchform), SIGNAL (activated()), + this, SLOT (fileExit())); - connect(asearchform, - SIGNAL(startSearch(std::shared_ptr, bool)), - this, SLOT(startSearch(std::shared_ptr, bool))); + connect(asearchform, + SIGNAL(startSearch(std::shared_ptr, bool)), + this, SLOT(startSearch(std::shared_ptr, bool))); connect(asearchform, SIGNAL(setDescription(QString)), this, SLOT(onSetDescription(QString))); - asearchform->show(); + asearchform->show(); } else { - // Close and reopen, in hope that makes us visible... - asearchform->close(); - asearchform->show(); + // Close and reopen, in hope that makes us visible... + asearchform->close(); + asearchform->show(); } } void RclMain::showSpellDialog() { if (spellform == 0) { - spellform = new SpellW(0); - connect(new QShortcut(quitKeySeq, spellform), SIGNAL (activated()), - this, SLOT (fileExit())); - connect(spellform, SIGNAL(wordSelect(QString)), - sSearch, SLOT(addTerm(QString))); - spellform->show(); + spellform = new SpellW(0); + connect(new QShortcut(quitKeySeq, spellform), SIGNAL (activated()), + this, SLOT (fileExit())); + connect(spellform, SIGNAL(wordSelect(QString)), + sSearch, SLOT(addTerm(QString))); + spellform->show(); } else { - // Close and reopen, in hope that makes us visible... - spellform->close(); + // Close and reopen, in hope that makes us visible... + spellform->close(); spellform->show(); } } @@ -111,10 +111,10 @@ void RclMain::showWebcacheDialog() } if (webcache == 0) { - webcache = new WebcacheEdit(this); + webcache = new WebcacheEdit(this); webcache->setAttribute(Qt::WA_DeleteOnClose); connect(new QShortcut(quitKeySeq, webcache), SIGNAL (activated()), - this, SLOT (fileExit())); + this, SLOT (fileExit())); connect(webcache, SIGNAL(destroyed(QObject*)), this, SLOT(onWebcacheDestroyed(QObject*)) ); webcache->show(); @@ -140,7 +140,7 @@ void RclMain::showFragButs() deleteZ(fragbuts); } if (fragbuts == 0) { - fragbuts = new FragButs(0); + fragbuts = new FragButs(0); if (fragbuts->ok()) { fragbuts->show(); connect(fragbuts, SIGNAL(fragmentsChanged()), @@ -149,8 +149,8 @@ void RclMain::showFragButs() deleteZ(fragbuts); } } else { - // Close and reopen, in hope that makes us visible... - fragbuts->close(); + // Close and reopen, in hope that makes us visible... + fragbuts->close(); fragbuts->show(); } } @@ -158,12 +158,12 @@ void RclMain::showFragButs() void RclMain::showSpecIdx() { if (specidx == 0) { - specidx = new SpecIdxW(0); + specidx = new SpecIdxW(0); connect(specidx, SIGNAL(accepted()), this, SLOT(specialIndex())); specidx->show(); } else { - // Close and reopen, in hope that makes us visible... - specidx->close(); + // Close and reopen, in hope that makes us visible... + specidx->close(); specidx->show(); } } @@ -182,11 +182,11 @@ void RclMain::showIndexConfig(bool modal) bool created{false}; if (indexConfig == 0) { created = true; - indexConfig = new ConfIndexW(0, theconfig); + indexConfig = new ConfIndexW(0, theconfig); } indexConfig->showPrefs(modal); if (created) { - connect(new QShortcut(quitKeySeq, indexConfig->getDialog()), + connect(new QShortcut(quitKeySeq, indexConfig->getDialog()), SIGNAL (activated()), this, SLOT (fileExit())); } } @@ -203,9 +203,9 @@ void RclMain::showIndexSched(bool modal) { LOGDEB("showIndexSched()\n" ); if (indexSched == 0) { - indexSched = new IdxSchedW(this); - connect(new QShortcut(quitKeySeq, indexSched), SIGNAL (activated()), - this, SLOT (fileExit())); + indexSched = new IdxSchedW(this); + connect(new QShortcut(quitKeySeq, indexSched), SIGNAL (activated()), + this, SLOT (fileExit())); #ifdef _WIN32 indexSched->cronCLB->setText(tr("Batch scheduling")); indexSched->cronCLB->setDescription( @@ -214,29 +214,29 @@ void RclMain::showIndexSched(bool modal) indexSched->mainExplainLBL->hide(); indexSched->rtidxCLB->hide(); #endif - connect(indexSched->cronCLB, SIGNAL(clicked()), - this, SLOT(execCronTool())); - if (theconfig && theconfig->isDefaultConfig()) { + connect(indexSched->cronCLB, SIGNAL(clicked()), + this, SLOT(execCronTool())); + if (theconfig && theconfig->isDefaultConfig()) { #ifdef RCL_MONITOR - connect(indexSched->rtidxCLB, SIGNAL(clicked()), - this, SLOT(execRTITool())); + connect(indexSched->rtidxCLB, SIGNAL(clicked()), + this, SLOT(execRTITool())); #else - indexSched->rtidxCLB->setEnabled(false); - indexSched->rtidxCLB->setToolTip(tr("Disabled because the real time indexer was not compiled in.")); + indexSched->rtidxCLB->setEnabled(false); + indexSched->rtidxCLB->setToolTip(tr("Disabled because the real time indexer was not compiled in.")); #endif - } else { - indexSched->rtidxCLB->setEnabled(false); - indexSched->rtidxCLB->setToolTip(tr("This configuration tool only works for the main index.")); - } + } else { + indexSched->rtidxCLB->setEnabled(false); + indexSched->rtidxCLB->setToolTip(tr("This configuration tool only works for the main index.")); + } } else { - // Close and reopen, in hope that makes us visible... - indexSched->close(); + // Close and reopen, in hope that makes us visible... + indexSched->close(); } if (modal) { - indexSched->exec(); - indexSched->setModal(false); + indexSched->exec(); + indexSched->setModal(false); } else { - indexSched->show(); + indexSched->show(); } } @@ -254,21 +254,21 @@ void RclMain::showCronTool(bool modal) LOGDEB("showCronTool()\n" ); if (cronTool == 0) { #ifdef _WIN32 - cronTool = new WinSchedToolW(0); + cronTool = new WinSchedToolW(0); #else - cronTool = new CronToolW(0); + cronTool = new CronToolW(0); #endif - connect(new QShortcut(quitKeySeq, cronTool), SIGNAL (activated()), - this, SLOT (fileExit())); + connect(new QShortcut(quitKeySeq, cronTool), SIGNAL (activated()), + this, SLOT (fileExit())); } else { - // Close and reopen, in hope that makes us visible... - cronTool->close(); + // Close and reopen, in hope that makes us visible... + cronTool->close(); } if (modal) { - cronTool->exec(); - cronTool->setModal(false); + cronTool->exec(); + cronTool->setModal(false); } else { - cronTool->show(); + cronTool->show(); } } @@ -285,18 +285,18 @@ void RclMain::showRTITool(bool modal) #ifndef _WIN32 LOGDEB("showRTITool()\n" ); if (rtiTool == 0) { - rtiTool = new RTIToolW(0); - connect(new QShortcut(quitKeySeq, rtiTool), SIGNAL (activated()), - this, SLOT (fileExit())); + rtiTool = new RTIToolW(0); + connect(new QShortcut(quitKeySeq, rtiTool), SIGNAL (activated()), + this, SLOT (fileExit())); } else { - // Close and reopen, in hope that makes us visible... - rtiTool->close(); + // Close and reopen, in hope that makes us visible... + rtiTool->close(); } if (modal) { - rtiTool->exec(); - rtiTool->setModal(false); + rtiTool->exec(); + rtiTool->setModal(false); } else { - rtiTool->show(); + rtiTool->show(); } #else PRETEND_USE(modal); @@ -305,16 +305,18 @@ void RclMain::showRTITool(bool modal) void RclMain::showUIPrefs() { + prefs.useTmpActiveExtraDbs = false; + prefs.tmpActiveExtraDbs.clear(); if (uiprefs == 0) { - uiprefs = new UIPrefsDialog(this); - connect(new QShortcut(quitKeySeq, uiprefs), SIGNAL (activated()), - this, SLOT (fileExit())); - connect(uiprefs, SIGNAL(uiprefsDone()), this, SLOT(setUIPrefs())); - connect(this, SIGNAL(stemLangChanged(const QString&)), - uiprefs, SLOT(setStemLang(const QString&))); + uiprefs = new UIPrefsDialog(this); + connect(new QShortcut(quitKeySeq, uiprefs), SIGNAL (activated()), + this, SLOT (fileExit())); + connect(uiprefs, SIGNAL(uiprefsDone()), this, SLOT(setUIPrefs())); + connect(this, SIGNAL(stemLangChanged(const QString&)), + uiprefs, SLOT(setStemLang(const QString&))); } else { - // Close and reopen, in hope that makes us visible... - uiprefs->close(); + // Close and reopen, in hope that makes us visible... + uiprefs->close(); rwSettings(false); uiprefs->setFromPrefs(); } @@ -331,7 +333,7 @@ void RclMain::showAboutDialog() { string vstring = Rcl::version_string() + string("
www.recoll.org") + - string("
www.xapian.org"); + string("
www.xapian.org"); QMessageBox::information(this, tr("About Recoll"), vstring.c_str()); } @@ -339,20 +341,20 @@ void RclMain::showMissingHelpers() { string miss; if (!theconfig->getMissingHelperDesc(miss)) { - QMessageBox::information( + QMessageBox::information( this, "", tr("No information: initial indexing not yet performed.")); - return; + return; } QString msg = QString::fromUtf8("

") + - tr("External applications/commands needed for your file types " - "and not found, as stored by the last indexing pass in "); + tr("External applications/commands needed for your file types " + "and not found, as stored by the last indexing pass in "); msg += ""; msg += path2qs(theconfig->getConfDir()); msg += "/missing:

\n";
     if (!miss.empty()) {
-	msg += QString::fromUtf8(miss.c_str());
+        msg += QString::fromUtf8(miss.c_str());
     } else {
-	msg += tr("No helpers found missing");
+        msg += tr("No helpers found missing");
     }
     msg += "
"; QMessageBox::information(this, tr("Missing helper programs"), msg); @@ -363,21 +365,21 @@ void RclMain::showActiveTypes() string reason; bool maindberror; if (!maybeOpenDb(reason, true, &maindberror)) { - QMessageBox::warning(0, tr("Error"), - u8s2qs(reason), - QMessageBox::Ok, - QMessageBox::NoButton); - return; + QMessageBox::warning(0, tr("Error"), + u8s2qs(reason), + QMessageBox::Ok, + QMessageBox::NoButton); + return; } // All mime types in index. vector vdbtypes; if (!rcldb->getAllDbMimeTypes(vdbtypes)) { - QMessageBox::warning(0, tr("Error"), - tr("Index query error"), - QMessageBox::Ok, - QMessageBox::NoButton); - return; + QMessageBox::warning(0, tr("Error"), + tr("Index query error"), + QMessageBox::Ok, + QMessageBox::NoButton); + return; } set mtypesfromdb; mtypesfromdb.insert(vdbtypes.begin(), vdbtypes.end()); @@ -389,27 +391,27 @@ void RclMain::showActiveTypes() // config can be indexed by name, not by content) set mtypesfromdbconf; for (vector::const_iterator it = mtypesfromconfig.begin(); - it != mtypesfromconfig.end(); it++) { - if (mtypesfromdb.find(*it) != mtypesfromdb.end()) - mtypesfromdbconf.insert(*it); + it != mtypesfromconfig.end(); it++) { + if (mtypesfromdb.find(*it) != mtypesfromdb.end()) + mtypesfromdbconf.insert(*it); } // Substract the types for missing helpers (the docs are indexed // by name only): string miss; if (theconfig->getMissingHelperDesc(miss) && !miss.empty()) { - FIMissingStore st(miss); - map >::const_iterator it; - for (it = st.m_typesForMissing.begin(); - it != st.m_typesForMissing.end(); it++) { - set::const_iterator it1; - for (it1 = it->second.begin(); - it1 != it->second.end(); it1++) { - set::iterator it2 = mtypesfromdbconf.find(*it1); - if (it2 != mtypesfromdbconf.end()) - mtypesfromdbconf.erase(it2); - } - } + FIMissingStore st(miss); + map >::const_iterator it; + for (it = st.m_typesForMissing.begin(); + it != st.m_typesForMissing.end(); it++) { + set::const_iterator it1; + for (it1 = it->second.begin(); + it1 != it->second.end(); it1++) { + set::iterator it2 = mtypesfromdbconf.find(*it1); + if (it2 != mtypesfromdbconf.end()) + mtypesfromdbconf.erase(it2); + } + } } ListDialog dialog; dialog.setWindowTitle(tr("Indexed MIME Types")); @@ -424,7 +426,7 @@ void RclMain::showActiveTypes() dialog.horizontalLayout->addWidget(editor); if (mtypesfromdbconf.empty()) { - editor->append(tr("Types list empty: maybe wait for indexing to " + editor->append(tr("Types list empty: maybe wait for indexing to " "progress?")); } else { for (set::const_iterator it = mtypesfromdbconf.begin(); @@ -443,7 +445,7 @@ void RclMain::newDupsW(const Rcl::Doc, const vector dups) dialog.setWindowTitle(tr("Duplicate documents")); dialog.groupBox->setTitle(tr("These Urls ( | ipath) share the same" - " content:")); + " content:")); // We replace the list with an editor so that the user can copy/paste delete dialog.listWidget; QTextEdit *editor = new QTextEdit(dialog.groupBox); @@ -451,11 +453,11 @@ void RclMain::newDupsW(const Rcl::Doc, const vector dups) dialog.horizontalLayout->addWidget(editor); for (vector::const_iterator it = dups.begin(); - it != dups.end(); it++) { - if (it->ipath.empty()) - editor->append(path2qs(it->url)); - else - editor->append(path2qs(it->url) + " | " + u8s2qs(it->ipath)); + it != dups.end(); it++) { + if (it->ipath.empty()) + editor->append(path2qs(it->url)); + else + editor->append(path2qs(it->url) + " | " + u8s2qs(it->ipath)); } editor->moveCursor(QTextCursor::Start); editor->ensureCursorVisible();