|
a/src/qtgui/rclm_idx.cpp |
|
b/src/qtgui/rclm_idx.cpp |
|
... |
|
... |
26 |
#include "log.h"
|
26 |
#include "log.h"
|
27 |
#include "transcode.h"
|
27 |
#include "transcode.h"
|
28 |
#include "indexer.h"
|
28 |
#include "indexer.h"
|
29 |
#include "rclmain_w.h"
|
29 |
#include "rclmain_w.h"
|
30 |
#include "specialindex.h"
|
30 |
#include "specialindex.h"
|
|
|
31 |
#include "readfile.h"
|
31 |
|
32 |
|
32 |
using namespace std;
|
33 |
using namespace std;
|
33 |
|
34 |
|
34 |
void RclMain::updateIdxStatus()
|
35 |
void RclMain::updateIdxStatus()
|
35 |
{
|
36 |
{
|
|
... |
|
... |
87 |
if (m_idxproc) {
|
88 |
if (m_idxproc) {
|
88 |
// An indexing process was launched. If its' done, see status.
|
89 |
// An indexing process was launched. If its' done, see status.
|
89 |
int status;
|
90 |
int status;
|
90 |
bool exited = m_idxproc->maybereap(&status);
|
91 |
bool exited = m_idxproc->maybereap(&status);
|
91 |
if (exited) {
|
92 |
if (exited) {
|
|
|
93 |
QString reasonmsg;
|
|
|
94 |
if (m_idxreasontmp) {
|
|
|
95 |
string reasons;
|
|
|
96 |
file_to_string(m_idxreasontmp->filename(), reasons);
|
|
|
97 |
if (!reasons.empty()) {
|
|
|
98 |
ConfSimple rsn(reasons);
|
|
|
99 |
vector<string> sects = rsn.getNames("");
|
|
|
100 |
for (const auto& nm : sects) {
|
|
|
101 |
string val;
|
|
|
102 |
if (rsn.get(nm, val)) {
|
|
|
103 |
reasonmsg.append(u8s2qs(string("<br>") +
|
|
|
104 |
nm + " : " + val));
|
|
|
105 |
}
|
|
|
106 |
}
|
|
|
107 |
}
|
|
|
108 |
}
|
92 |
deleteZ(m_idxproc);
|
109 |
deleteZ(m_idxproc);
|
93 |
if (status) {
|
110 |
if (status) {
|
94 |
if (m_idxkilled) {
|
111 |
if (m_idxkilled) {
|
95 |
QMessageBox::warning(0, "Recoll",
|
112 |
QMessageBox::warning(0, "Recoll",
|
96 |
tr("Indexing interrupted"));
|
113 |
tr("Indexing interrupted"));
|
97 |
m_idxkilled = false;
|
114 |
m_idxkilled = false;
|
98 |
} else {
|
115 |
} else {
|
|
|
116 |
QString msg(tr("Indexing failed"));
|
|
|
117 |
if (!reasonmsg.isEmpty()) {
|
|
|
118 |
msg.append(tr(" with additional message: "));
|
|
|
119 |
msg.append(reasonmsg);
|
|
|
120 |
}
|
99 |
QMessageBox::warning(0, "Recoll",
|
121 |
QMessageBox::warning(0, "Recoll", msg);
|
100 |
tr("Indexing failed"));
|
|
|
101 |
}
|
122 |
}
|
102 |
} else {
|
123 |
} else {
|
103 |
// On the first run, show missing helpers. We only do this once
|
124 |
// On the first run, show missing helpers. We only do this once
|
104 |
if (m_firstIndexing)
|
125 |
if (m_firstIndexing)
|
105 |
showMissingHelpers();
|
126 |
showMissingHelpers();
|
|
|
127 |
if (!reasonmsg.isEmpty()) {
|
|
|
128 |
QString msg = tr("Non-fatal indexing message: ");
|
|
|
129 |
msg.append(reasonmsg);
|
|
|
130 |
QMessageBox::warning(0, "Recoll", msg);
|
|
|
131 |
}
|
106 |
}
|
132 |
}
|
107 |
string reason;
|
133 |
string reason;
|
108 |
maybeOpenDb(reason, 1);
|
134 |
maybeOpenDb(reason, 1);
|
109 |
} else {
|
135 |
} else {
|
110 |
// update/show status even if the status file did not
|
136 |
// update/show status even if the status file did not
|
|
... |
|
... |
196 |
// This gets called when the "update index" action is activated. It executes
|
222 |
// This gets called when the "update index" action is activated. It executes
|
197 |
// the requested action, and disables the menu entry. This will be
|
223 |
// the requested action, and disables the menu entry. This will be
|
198 |
// re-enabled by the indexing status check
|
224 |
// re-enabled by the indexing status check
|
199 |
void RclMain::toggleIndexing()
|
225 |
void RclMain::toggleIndexing()
|
200 |
{
|
226 |
{
|
|
|
227 |
if (!m_idxreasontmp) {
|
|
|
228 |
// We just store the pointer and let the tempfile cleaner deal
|
|
|
229 |
// with delete on exiting
|
|
|
230 |
m_idxreasontmp = new TempFileInternal(".txt");
|
|
|
231 |
rememberTempFile(TempFile(m_idxreasontmp));
|
|
|
232 |
}
|
|
|
233 |
|
201 |
switch (m_indexerState) {
|
234 |
switch (m_indexerState) {
|
202 |
case IXST_RUNNINGMINE:
|
235 |
case IXST_RUNNINGMINE:
|
203 |
if (m_idxproc) {
|
236 |
if (m_idxproc) {
|
204 |
// Indexing was in progress, request stop. Let the periodic
|
237 |
// Indexing was in progress, request stop. Let the periodic
|
205 |
// routine check for the results.
|
238 |
// routine check for the results.
|
|
... |
|
... |
243 |
|
276 |
|
244 |
if (!checkIdxPaths()) {
|
277 |
if (!checkIdxPaths()) {
|
245 |
return;
|
278 |
return;
|
246 |
}
|
279 |
}
|
247 |
vector<string> args{"-c", theconfig->getConfDir()};
|
280 |
vector<string> args{"-c", theconfig->getConfDir()};
|
|
|
281 |
if (m_idxreasontmp) {
|
|
|
282 |
args.push_back("-R");
|
|
|
283 |
args.push_back(m_idxreasontmp->filename());
|
|
|
284 |
}
|
248 |
m_idxproc = new ExecCmd;
|
285 |
m_idxproc = new ExecCmd;
|
249 |
m_idxproc->startExec("recollindex", args, false, false);
|
286 |
m_idxproc->startExec("recollindex", args, false, false);
|
250 |
}
|
287 |
}
|
251 |
break;
|
288 |
break;
|
252 |
case IXST_UNKNOWN:
|
289 |
case IXST_UNKNOWN:
|
|
... |
|
... |
292 |
if (!checkIdxPaths()) {
|
329 |
if (!checkIdxPaths()) {
|
293 |
return;
|
330 |
return;
|
294 |
}
|
331 |
}
|
295 |
|
332 |
|
296 |
vector<string> args{"-c", theconfig->getConfDir(), "-z"};
|
333 |
vector<string> args{"-c", theconfig->getConfDir(), "-z"};
|
|
|
334 |
if (m_idxreasontmp) {
|
|
|
335 |
args.push_back("-R");
|
|
|
336 |
args.push_back(m_idxreasontmp->filename());
|
|
|
337 |
}
|
297 |
m_idxproc = new ExecCmd;
|
338 |
m_idxproc = new ExecCmd;
|
298 |
m_idxproc->startExec("recollindex", args, false, false);
|
339 |
m_idxproc->startExec("recollindex", args, false, false);
|
299 |
}
|
340 |
}
|
300 |
}
|
341 |
}
|
301 |
break;
|
342 |
break;
|
|
... |
|
... |
369 |
}
|
410 |
}
|
370 |
if (!specidx) // ??
|
411 |
if (!specidx) // ??
|
371 |
return;
|
412 |
return;
|
372 |
|
413 |
|
373 |
vector<string> args{"-c", theconfig->getConfDir()};
|
414 |
vector<string> args{"-c", theconfig->getConfDir()};
|
|
|
415 |
if (m_idxreasontmp) {
|
|
|
416 |
args.push_back("-R");
|
|
|
417 |
args.push_back(m_idxreasontmp->filename());
|
|
|
418 |
}
|
374 |
|
419 |
|
375 |
string top = specidx->toptarg();
|
420 |
string top = specidx->toptarg();
|
376 |
if (!top.empty()) {
|
421 |
if (!top.empty()) {
|
377 |
args.push_back("-r");
|
422 |
args.push_back("-r");
|
378 |
}
|
423 |
}
|
|
... |
|
... |
428 |
}
|
473 |
}
|
429 |
|
474 |
|
430 |
vector<string> paths;
|
475 |
vector<string> paths;
|
431 |
if (Rcl::docsToPaths(docs, paths)) {
|
476 |
if (Rcl::docsToPaths(docs, paths)) {
|
432 |
vector<string> args{"-c", theconfig->getConfDir(), "-e", "-i"};
|
477 |
vector<string> args{"-c", theconfig->getConfDir(), "-e", "-i"};
|
|
|
478 |
if (m_idxreasontmp) {
|
|
|
479 |
args.push_back("-R");
|
|
|
480 |
args.push_back(m_idxreasontmp->filename());
|
|
|
481 |
}
|
433 |
args.insert(args.end(), paths.begin(), paths.end());
|
482 |
args.insert(args.end(), paths.begin(), paths.end());
|
434 |
m_idxproc = new ExecCmd;
|
483 |
m_idxproc = new ExecCmd;
|
435 |
m_idxproc->startExec("recollindex", args, false, false);
|
484 |
m_idxproc->startExec("recollindex", args, false, false);
|
436 |
fileToggleIndexingAction->setText(tr("Stop &Indexing"));
|
485 |
fileToggleIndexingAction->setText(tr("Stop &Indexing"));
|
437 |
}
|
486 |
}
|