Switch to unified view

a/src/qtgui/main.cpp b/src/qtgui/main.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: main.cpp,v 1.17 2005-11-24 07:16:16 dockes Exp $ (C) 2005 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: main.cpp,v 1.18 2005-11-25 10:02:36 dockes Exp $ (C) 2005 J.F.Dockes";
3
#endif
3
#endif
4
4
5
#include <unistd.h>
5
#include <unistd.h>
6
6
7
#include <qapplication.h>
7
#include <qapplication.h>
...
...
22
#include "pathut.h"
22
#include "pathut.h"
23
#include "recoll.h"
23
#include "recoll.h"
24
#include "smallut.h"
24
#include "smallut.h"
25
#include "wipedir.h"
25
#include "wipedir.h"
26
#include "rclinit.h"
26
#include "rclinit.h"
27
#include "history.h"
27
28
28
#include "recollmain.h"
29
#include "recollmain.h"
29
30
30
RclConfig *rclconfig;
31
RclConfig *rclconfig;
31
Rcl::Db *rcldb;
32
Rcl::Db *rcldb;
32
int recollNeedsExit;
33
int recollNeedsExit;
33
string tmpdir;
34
string tmpdir;
34
bool showicons;
35
bool showicons;
35
string iconsdir;
36
string iconsdir;
37
RclQHistory *history;
36
38
37
void getQueryStemming(bool &dostem, std::string &stemlang)
39
void getQueryStemming(bool &dostem, std::string &stemlang)
38
{
40
{
39
    string param;
41
    string param;
40
    if (rclconfig->getConfParam("querystemming", param))
42
    if (rclconfig->getConfParam("querystemming", param))
41
    dostem = ConfTree::stringToBool(param);
43
    dostem = stringToBool(param);
42
    else
44
    else
43
    dostem = false;
45
    dostem = false;
44
    if (!rclconfig->getConfParam("querystemminglanguage", stemlang))
46
    if (!rclconfig->getConfParam("querystemminglanguage", stemlang))
45
    stemlang = "english";
47
    stemlang = "english";
46
}
48
}
...
...
119
    QSettings settings;
121
    QSettings settings;
120
    settings.setPath("Recoll.org", "Recoll");
122
    settings.setPath("Recoll.org", "Recoll");
121
    int width = settings.readNumEntry( "/Recoll/geometry/width", 590);
123
    int width = settings.readNumEntry( "/Recoll/geometry/width", 590);
122
    int height = settings.readNumEntry( "/Recoll/geometry/height", 810);
124
    int height = settings.readNumEntry( "/Recoll/geometry/height", 810);
123
    QSize s(width, height);
125
    QSize s(width, height);
124
126
    
125
    // Create main window and set its size to previous session's
127
    // Create main window and set its size to previous session's
126
    RecollMain w;
128
    RecollMain w;
127
    mainWindow = &w;
129
    mainWindow = &w;
128
    w.resize(s);
130
    w.resize(s);
129
131
130
    
132
    
131
#if 0    
132
    // Once tried to set a lighter background but this doesn;t seem to work
133
    // (no inheritance from buttons and popups)
134
    QPalette palette = w.palette();
135
    palette.setColor(QColorGroup::Background, QColor(239,239,239));
136
    w.setPalette(palette);
137
#endif
138
139
    // Connect exit handlers etc..
140
    a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
141
    QTimer *timer = new QTimer(&a);
142
    w.connect(timer, SIGNAL(timeout()), &w, SLOT(periodic100()));
143
    timer->start(100);
144
145
    string reason;
133
    string reason;
146
    rclconfig = recollinit(recollCleanup, sigcleanup, reason);
134
    rclconfig = recollinit(recollCleanup, sigcleanup, reason);
147
148
    if (!rclconfig || !rclconfig->ok()) {
135
    if (!rclconfig || !rclconfig->ok()) {
149
    QString msg = a.translate("Main", "Configuration problem: ");
136
    QString msg = a.translate("Main", "Configuration problem: ");
150
    msg += reason;
137
    msg += reason;
151
    QMessageBox::critical(0, "Recoll",  msg);
138
    QMessageBox::critical(0, "Recoll",  msg);
152
    exit(1);
139
    exit(1);
...
...
174
    QMessageBox::critical(0, "Recoll",
161
    QMessageBox::critical(0, "Recoll",
175
                  a.translate("Main", 
162
                  a.translate("Main", 
176
                     "Cannot create temporary directory"));
163
                     "Cannot create temporary directory"));
177
    exit(1);
164
    exit(1);
178
    }
165
    }
179
  
166
167
    string historyfile = rclconfig->getConfDir();
168
    path_cat(historyfile, "history");
169
    history = new RclQHistory(historyfile);
170
180
    dbdir = path_tildexpand(dbdir);
171
    dbdir = path_tildexpand(dbdir);
181
172
182
    rcldb = new Rcl::Db;
173
    rcldb = new Rcl::Db;
174
175
    // Connect exit handlers etc..
176
    a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
177
    QTimer *timer = new QTimer(&a);
178
    w.connect(timer, SIGNAL(timeout()), &w, SLOT(periodic100()));
179
    timer->start(100);
183
180
184
    if (!rcldb || !rcldb->open(dbdir, Rcl::Db::DbRO)) {
181
    if (!rcldb || !rcldb->open(dbdir, Rcl::Db::DbRO)) {
185
    startindexing = 1;
182
    startindexing = 1;
186
    QMessageBox::information(0, "Recoll",
183
    QMessageBox::information(0, "Recoll",
187
                 a.translate("Main", 
184
                 a.translate("Main",