Switch to unified view

a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.5 2006-09-13 15:31:07 dockes Exp $ (C) 2005 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.6 2006-09-15 16:49:27 dockes Exp $ (C) 2005 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
103
    if (!prefs.queryBuildAbstract) {
103
    if (!prefs.queryBuildAbstract) {
104
    replAbsCB->setEnabled(false);
104
    replAbsCB->setEnabled(false);
105
    }
105
    }
106
    replAbsCB->setChecked(prefs.queryReplaceAbstract);
106
    replAbsCB->setChecked(prefs.queryReplaceAbstract);
107
107
108
    // Initialize the extra databases listboxes
108
    // Initialize the extra indexes listboxes
109
    QStringList ql;
109
    QStringList ql;
110
    for (list<string>::iterator it = prefs.allExtraDbs.begin(); 
110
    for (list<string>::iterator it = prefs.allExtraDbs.begin(); 
111
     it != prefs.allExtraDbs.end(); it++) {
111
     it != prefs.allExtraDbs.end(); it++) {
112
    ql.append(QString::fromLocal8Bit(it->c_str()));
112
    ql.append(QString::fromLocal8Bit(it->c_str()));
113
    }
113
    }
...
...
231
    if (s) 
231
    if (s) 
232
    helpBrowserLE->setText(s);
232
    helpBrowserLE->setText(s);
233
}
233
}
234
234
235
////////////////////////////////////////////
235
////////////////////////////////////////////
236
// External / extra search databases setup
236
// External / extra search indexes setup
237
// TBD: a way to remove entry from 'all' list (del button?)
237
// TBD: a way to remove entry from 'all' list (del button?)
238
238
239
void UIPrefsDialog::extraDbTextChanged(const QString &text)
239
void UIPrefsDialog::extraDbTextChanged(const QString &text)
240
{
240
{
241
    if (text.isEmpty()) {
241
    if (text.isEmpty()) {
...
...
290
    actDbsLB->removeItem(*ii);
290
    actDbsLB->removeItem(*ii);
291
    }
291
    }
292
}
292
}
293
293
294
/**
294
/**
295
 * Remove all extra search databases from the active list
295
 * Remove all extra search indexes from the active list
296
 */
296
 */
297
void UIPrefsDialog::delAADbPB_clicked()
297
void UIPrefsDialog::delAADbPB_clicked()
298
{
298
{
299
    for (unsigned int i = 0; i < actDbsLB->count(); i++) {
299
    for (unsigned int i = 0; i < actDbsLB->count(); i++) {
300
    actDbsLB->setSelected(i, true);
300
    actDbsLB->setSelected(i, true);
...
...
311
{
311
{
312
    string dbdir = (const char *)extraDbLE->text().local8Bit();
312
    string dbdir = (const char *)extraDbLE->text().local8Bit();
313
    path_catslash(dbdir);
313
    path_catslash(dbdir);
314
    if (!Rcl::Db::testDbDir(dbdir)) {
314
    if (!Rcl::Db::testDbDir(dbdir)) {
315
    QMessageBox::warning(0, "Recoll", 
315
    QMessageBox::warning(0, "Recoll", 
316
        tr("The selected directory does not appear to be a Xapian database"));
316
        tr("The selected directory does not appear to be a Xapian index"));
317
    return;
317
    return;
318
    }
318
    }
319
    struct stat st1, st2;
319
    struct stat st1, st2;
320
    stat(dbdir.c_str(), &st1);
320
    stat(dbdir.c_str(), &st1);
321
    string rcldbdir;
321
    string rcldbdir;
...
...
324
    stat(rcldbdir.c_str(), &st2);
324
    stat(rcldbdir.c_str(), &st2);
325
    path_catslash(rcldbdir);
325
    path_catslash(rcldbdir);
326
    fprintf(stderr, "rcldbdir: [%s]\n", rcldbdir.c_str());
326
    fprintf(stderr, "rcldbdir: [%s]\n", rcldbdir.c_str());
327
    if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino) {
327
    if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino) {
328
    QMessageBox::warning(0, "Recoll", 
328
    QMessageBox::warning(0, "Recoll", 
329
                 tr("This is the main/local database!"));
329
                 tr("This is the main/local index!"));
330
    return;
330
    return;
331
    }
331
    }
332
    if (allDbsLB->findItem(extraDbLE->text(), 
332
    if (allDbsLB->findItem(extraDbLE->text(), 
333
                Qt::CaseSensitive|Qt::ExactMatch)) {
333
                Qt::CaseSensitive|Qt::ExactMatch)) {
334
    QMessageBox::warning(0, "Recoll", 
334
    QMessageBox::warning(0, "Recoll", 
335
         tr("The selected directory is already in the database list"));
335
         tr("The selected directory is already in the index list"));
336
    return;
336
    return;
337
    }
337
    }
338
    allDbsLB->insertItem(extraDbLE->text());
338
    allDbsLB->insertItem(extraDbLE->text());
339
    allDbsLB->sort();
339
    allDbsLB->sort();
340
}
340
}
...
...
343
{
343
{
344
    QFileDialog fdia;
344
    QFileDialog fdia;
345
    bool savedh = fdia.showHiddenFiles();
345
    bool savedh = fdia.showHiddenFiles();
346
    fdia.setShowHiddenFiles(true);
346
    fdia.setShowHiddenFiles(true);
347
    QString s = QFileDialog::getExistingDirectory("", this, 0, 
347
    QString s = QFileDialog::getExistingDirectory("", this, 0, 
348
tr("Select directory holding xapian database (ie: /home/someone/.recoll/xapiandb)"));
348
       tr("Select xapian index directory (ie: /home/buddy/.recoll/xapiandb)"));
349
349
350
    fdia.setShowHiddenFiles(savedh);
350
    fdia.setShowHiddenFiles(savedh);
351
    if (s) 
351
    if (s) 
352
    extraDbLE->setText(s);
352
    extraDbLE->setText(s);
353
}
353
}