|
a/src/qtgui/rclm_idx.cpp |
|
b/src/qtgui/rclm_idx.cpp |
|
... |
|
... |
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
16 |
*/
|
16 |
*/
|
17 |
#include "autoconfig.h"
|
17 |
#include "autoconfig.h"
|
18 |
|
18 |
|
19 |
#include <signal.h>
|
19 |
#include <signal.h>
|
|
|
20 |
#include "safeunistd.h"
|
20 |
|
21 |
|
21 |
#include <QMessageBox>
|
22 |
#include <QMessageBox>
|
22 |
#include <QTimer>
|
23 |
#include <QTimer>
|
23 |
|
24 |
|
24 |
#include "execmd.h"
|
25 |
#include "execmd.h"
|
|
... |
|
... |
28 |
#include "rclmain_w.h"
|
29 |
#include "rclmain_w.h"
|
29 |
#include "specialindex.h"
|
30 |
#include "specialindex.h"
|
30 |
|
31 |
|
31 |
using namespace std;
|
32 |
using namespace std;
|
32 |
|
33 |
|
33 |
void RclMain::idxStatus()
|
34 |
void RclMain::updateIdxStatus()
|
34 |
{
|
35 |
{
|
35 |
ConfSimple cs(theconfig->getIdxStatusFile().c_str(), 1);
|
36 |
ConfSimple cs(theconfig->getIdxStatusFile().c_str(), 1);
|
36 |
QString msg = tr("Indexing in progress: ");
|
37 |
QString msg = tr("Indexing in progress: ");
|
37 |
DbIxStatus status;
|
38 |
DbIxStatus status;
|
38 |
string val;
|
39 |
string val;
|
|
... |
|
... |
107 |
maybeOpenDb(reason, 1);
|
108 |
maybeOpenDb(reason, 1);
|
108 |
} else {
|
109 |
} else {
|
109 |
// update/show status even if the status file did not
|
110 |
// update/show status even if the status file did not
|
110 |
// change (else the status line goes blank during
|
111 |
// change (else the status line goes blank during
|
111 |
// lengthy operations).
|
112 |
// lengthy operations).
|
112 |
idxStatus();
|
113 |
updateIdxStatus();
|
113 |
}
|
114 |
}
|
114 |
}
|
115 |
}
|
115 |
// Update the "start/stop indexing" menu entry, can't be done from
|
116 |
// Update the "start/stop indexing" menu entry, can't be done from
|
116 |
// the "start/stop indexing" slot itself
|
117 |
// the "start/stop indexing" slot itself
|
117 |
IndexerState prevstate = m_indexerState;
|
118 |
IndexerState prevstate = m_indexerState;
|
|
... |
|
... |
122 |
fileRebuildIndexAction->setEnabled(false);
|
123 |
fileRebuildIndexAction->setEnabled(false);
|
123 |
actionSpecial_Indexing->setEnabled(false);
|
124 |
actionSpecial_Indexing->setEnabled(false);
|
124 |
periodictimer->setInterval(200);
|
125 |
periodictimer->setInterval(200);
|
125 |
} else {
|
126 |
} else {
|
126 |
Pidfile pidfile(theconfig->getPidfile());
|
127 |
Pidfile pidfile(theconfig->getPidfile());
|
127 |
if (pidfile.open() == 0) {
|
128 |
pid_t pid = pidfile.open();
|
|
|
129 |
if (pid == getpid()) {
|
|
|
130 |
// Locked by me
|
|
|
131 |
m_indexerState = IXST_NOTRUNNING;
|
|
|
132 |
fileToggleIndexingAction->setText(tr("Index locked"));
|
|
|
133 |
fileToggleIndexingAction->setEnabled(false);
|
|
|
134 |
fileRebuildIndexAction->setEnabled(false);
|
|
|
135 |
actionSpecial_Indexing->setEnabled(false);
|
|
|
136 |
periodictimer->setInterval(1000);
|
|
|
137 |
} else if (pid == 0) {
|
128 |
m_indexerState = IXST_NOTRUNNING;
|
138 |
m_indexerState = IXST_NOTRUNNING;
|
129 |
fileToggleIndexingAction->setText(tr("Update &Index"));
|
139 |
fileToggleIndexingAction->setText(tr("Update &Index"));
|
130 |
fileToggleIndexingAction->setEnabled(true);
|
140 |
fileToggleIndexingAction->setEnabled(true);
|
131 |
fileRebuildIndexAction->setEnabled(true);
|
141 |
fileRebuildIndexAction->setEnabled(true);
|
132 |
actionSpecial_Indexing->setEnabled(true);
|
142 |
actionSpecial_Indexing->setEnabled(true);
|