c++11 initializers
This commit is contained in:
parent
4d911028d8
commit
2135e50b50
1 changed files with 18 additions and 44 deletions
|
@ -179,22 +179,14 @@ void RclMain::periodic100()
|
||||||
|
|
||||||
bool RclMain::checkIdxPaths()
|
bool RclMain::checkIdxPaths()
|
||||||
{
|
{
|
||||||
vector<string> args;
|
|
||||||
|
|
||||||
string badpaths;
|
string badpaths;
|
||||||
args.push_back("recollindex");
|
vector<string> args {"recollindex", "-c", theconfig->getConfDir(), "-E"};
|
||||||
args.push_back("-E");
|
|
||||||
args.push_back("-c");
|
|
||||||
args.push_back(theconfig->getConfDir());
|
|
||||||
ExecCmd::backtick(args, badpaths);
|
ExecCmd::backtick(args, badpaths);
|
||||||
if (!badpaths.empty()) {
|
if (!badpaths.empty()) {
|
||||||
int rep =
|
int rep = QMessageBox::warning(
|
||||||
QMessageBox::warning(0, tr("Bad paths"),
|
0, tr("Bad paths"), tr("Bad paths in configuration file:\n") +
|
||||||
tr("Bad paths in configuration file:\n") +
|
|
||||||
QString::fromLocal8Bit(badpaths.c_str()),
|
QString::fromLocal8Bit(badpaths.c_str()),
|
||||||
QMessageBox::Ok,
|
QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton);
|
||||||
QMessageBox::Cancel,
|
|
||||||
QMessageBox::NoButton);
|
|
||||||
if (rep == QMessageBox::Cancel)
|
if (rep == QMessageBox::Cancel)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -223,18 +215,15 @@ void RclMain::toggleIndexing()
|
||||||
tr("The current indexing process "
|
tr("The current indexing process "
|
||||||
"was not started from this "
|
"was not started from this "
|
||||||
"interface, can't kill it"),
|
"interface, can't kill it"),
|
||||||
QMessageBox::Ok,
|
QMessageBox::Ok, QMessageBox::NoButton);
|
||||||
QMessageBox::NoButton);
|
|
||||||
#else
|
#else
|
||||||
int rep =
|
int rep =
|
||||||
QMessageBox::information(0, tr("Warning"),
|
QMessageBox::information(
|
||||||
tr("The current indexing process "
|
0, tr("Warning"),
|
||||||
"was not started from this "
|
tr("The current indexing process was not started from this "
|
||||||
"interface. Click Ok to kill it "
|
"interface. Click Ok to kill it "
|
||||||
"anyway, or Cancel to leave it alone"),
|
"anyway, or Cancel to leave it alone"),
|
||||||
QMessageBox::Ok,
|
QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton);
|
||||||
QMessageBox::Cancel,
|
|
||||||
QMessageBox::NoButton);
|
|
||||||
if (rep == QMessageBox::Ok) {
|
if (rep == QMessageBox::Ok) {
|
||||||
Pidfile pidfile(theconfig->getPidfile());
|
Pidfile pidfile(theconfig->getPidfile());
|
||||||
pid_t pid = pidfile.open();
|
pid_t pid = pidfile.open();
|
||||||
|
@ -255,9 +244,7 @@ void RclMain::toggleIndexing()
|
||||||
if (!checkIdxPaths()) {
|
if (!checkIdxPaths()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vector<string> args;
|
vector<string> args{"-c", theconfig->getConfDir()};
|
||||||
args.push_back("-c");
|
|
||||||
args.push_back(theconfig->getConfDir());
|
|
||||||
m_idxproc = new ExecCmd;
|
m_idxproc = new ExecCmd;
|
||||||
m_idxproc->startExec("recollindex", args, false, false);
|
m_idxproc->startExec("recollindex", args, false, false);
|
||||||
}
|
}
|
||||||
|
@ -306,10 +293,7 @@ void RclMain::rebuildIndex()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<string> args;
|
vector<string> args{"-c", theconfig->getConfDir(), "-z"};
|
||||||
args.push_back("-c");
|
|
||||||
args.push_back(theconfig->getConfDir());
|
|
||||||
args.push_back("-z");
|
|
||||||
m_idxproc = new ExecCmd;
|
m_idxproc = new ExecCmd;
|
||||||
m_idxproc->startExec("recollindex", args, false, false);
|
m_idxproc->startExec("recollindex", args, false, false);
|
||||||
}
|
}
|
||||||
|
@ -386,9 +370,7 @@ void RclMain::specialIndex()
|
||||||
if (!specidx) // ??
|
if (!specidx) // ??
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vector<string> args;
|
vector<string> args{"-c", theconfig->getConfDir()};
|
||||||
args.push_back("-c");
|
|
||||||
args.push_back(theconfig->getConfDir());
|
|
||||||
|
|
||||||
string top = specidx->toptarg();
|
string top = specidx->toptarg();
|
||||||
if (!top.empty()) {
|
if (!top.empty()) {
|
||||||
|
@ -419,8 +401,7 @@ void RclMain::specialIndex()
|
||||||
QMessageBox::warning(0, tr("Selection patterns need topdir"),
|
QMessageBox::warning(0, tr("Selection patterns need topdir"),
|
||||||
tr("Selection patterns can only be used with a "
|
tr("Selection patterns can only be used with a "
|
||||||
"start directory"),
|
"start directory"),
|
||||||
QMessageBox::Ok,
|
QMessageBox::Ok, QMessageBox::NoButton);
|
||||||
QMessageBox::NoButton);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,18 +423,13 @@ void RclMain::updateIdxForDocs(vector<Rcl::Doc>& docs)
|
||||||
if (m_idxproc) {
|
if (m_idxproc) {
|
||||||
QMessageBox::warning(0, tr("Warning"),
|
QMessageBox::warning(0, tr("Warning"),
|
||||||
tr("Can't update index: indexer running"),
|
tr("Can't update index: indexer running"),
|
||||||
QMessageBox::Ok,
|
QMessageBox::Ok, QMessageBox::NoButton);
|
||||||
QMessageBox::NoButton);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<string> paths;
|
vector<string> paths;
|
||||||
if (ConfIndexer::docsToPaths(docs, paths)) {
|
if (ConfIndexer::docsToPaths(docs, paths)) {
|
||||||
vector<string> args;
|
vector<string> args{"-c", theconfig->getConfDir(), "-e", "-i"};
|
||||||
args.push_back("-c");
|
|
||||||
args.push_back(theconfig->getConfDir());
|
|
||||||
args.push_back("-e");
|
|
||||||
args.push_back("-i");
|
|
||||||
args.insert(args.end(), paths.begin(), paths.end());
|
args.insert(args.end(), paths.begin(), paths.end());
|
||||||
m_idxproc = new ExecCmd;
|
m_idxproc = new ExecCmd;
|
||||||
m_idxproc->startExec("recollindex", args, false, false);
|
m_idxproc->startExec("recollindex", args, false, false);
|
||||||
|
@ -462,5 +438,3 @@ void RclMain::updateIdxForDocs(vector<Rcl::Doc>& docs)
|
||||||
fileToggleIndexingAction->setEnabled(false);
|
fileToggleIndexingAction->setEnabled(false);
|
||||||
actionSpecial_Indexing->setEnabled(false);
|
actionSpecial_Indexing->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue