diff --git a/src/qtgui/rclmain.ui b/src/qtgui/rclmain.ui index e3cc36cb..e90abdc2 100644 --- a/src/qtgui/rclmain.ui +++ b/src/qtgui/rclmain.ui @@ -27,12 +27,12 @@ unnamed - - 4 - - - 2 - + + 4 + + + 2 + unnamed @@ -88,6 +88,7 @@ + @@ -151,7 +152,6 @@ 0 0 - image0 @@ -270,6 +270,17 @@ &Query configuration + + + extIdxAction + + + External index dialog + + + External index dialog + + diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index 923f405a..205d3afb 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.21 2007-01-08 10:11:53 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.22 2007-01-13 15:21:41 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -151,6 +151,7 @@ void RclMain::init() connect(preferencesQuery_PrefsAction, SIGNAL(activated()), this, SLOT(showUIPrefs())); + connect(extIdxAction, SIGNAL(activated()), this, SLOT(showExtIdxDialog())); #if (QT_VERSION < 0x040000) @@ -456,12 +457,24 @@ void RclMain::showUIPrefs() if (uiprefs == 0) { uiprefs = new UIPrefsDialog(0); connect(uiprefs, SIGNAL(uiprefsDone()), this, SLOT(setUIPrefs())); - uiprefs->show(); } else { // Close and reopen, in hope that makes us visible... uiprefs->close(); - uiprefs->show(); } + uiprefs->show(); +} + +void RclMain::showExtIdxDialog() +{ + if (uiprefs == 0) { + uiprefs = new UIPrefsDialog(0); + connect(uiprefs, SIGNAL(uiprefsDone()), this, SLOT(setUIPrefs())); + } else { + // Close and reopen, in hope that makes us visible... + uiprefs->close(); + } + uiprefs->tabWidget->setCurrentPage(2); + uiprefs->show(); } // If a preview (toplevel) window gets closed by the user, we need to diff --git a/src/qtgui/rclmain_w.h b/src/qtgui/rclmain_w.h index d3740854..a3416cc6 100644 --- a/src/qtgui/rclmain_w.h +++ b/src/qtgui/rclmain_w.h @@ -80,6 +80,7 @@ public slots: virtual void showAboutDialog(); virtual void startManual(); virtual void showDocHistory(); + virtual void showExtIdxDialog(); virtual void sortDataChanged(DocSeqSortSpec spec); virtual void showUIPrefs(); virtual void setUIPrefs(); diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index 4e99c2ef..14b60d0f 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -8,8 +8,8 @@ 0 0 - 558 - 534 + 523 + 530 @@ -24,7 +24,7 @@ - layout17 + layout16 @@ -32,7 +32,7 @@ - tabWidget2 + tabWidget @@ -41,13 +41,13 @@ User interface - + unnamed - layout20 + layout39 @@ -55,7 +55,7 @@ - layout1 + layout23 @@ -92,7 +92,7 @@ - layout4 + layout24 @@ -132,7 +132,7 @@ - layout18 + layout35 @@ -142,6 +142,14 @@ textLabel1_4 + + + 7 + 7 + 0 + 0 + + Result paragraph<br>format string @@ -156,17 +164,20 @@ 7 - 0 - 0 + 7 + 1 0 - 200 - 5 + 0 + 0 + + Manual + PlainText @@ -184,7 +195,7 @@ - layout9 + layout36 @@ -221,7 +232,7 @@ - layout18 + layout37 @@ -299,7 +310,7 @@ - + @@ -517,222 +528,172 @@ May be slow for big documents. - layout15 + layout16 - + unnamed - + + + + External indexes + + + true + + + true + + - addExtraDbPB + idxLV - - false + + Extended - - Add index - - - Select the xapiandb directory for the index you want to add, then click Add Index + + AllColumns - + - extraDbLE + layout15 - - - 200 - 0 - + + + unnamed + + + + togExtraDbPB + + + Toggle selected + + + + + actAllExtraDbPB + + + Activate All + + + + + unacAllExtraDbPB + + + Desactivate All + + + + + + + line2_2 - - Select the xapiandb directory for the index you want to add, then click Add Index + + HLine + + + Sunken + + + Horizontal - - - browseDbPB - - - Browse - - - Select the xapiandb directory for the index you want to add, then click Add Index - - - - - - - layout12 - - - - unnamed - layout13 - + unnamed - + - textLabel2_2 + delExtraDbPB - All indexes + Remove selected - Indexes currently not used + Remove from list. This has no effect on the disk index. - + - allDbsLB + spacer3 + + + Horizontal + + + Expanding + + + + 16 + 20 + + + + + + addExtraDbPB - true + false + + + Add index + + + Select the xapiandb directory for the index you want to add, then click Add Index + + + + + extraDbLE - 200 - 200 + 150 + 0 - - Extended - - - - - - - layout11 - - - - unnamed - - - - addAADbPB - - - true - - - All ----> - - - false - - - - - addADbPB - - - true - - - Sel -----> - - - false - - - - - delADbPB - - - true - - - <----- Sel - - - false - - - - - delAADbPB - - - true - - - <----- All - - - false - - - - - - - layout14 - - - - unnamed - - - - textLabel5 - - - Active indexes - - Indexes that will be searched in addition to the main one + Select the xapiandb directory for the index you want to add, then click Add Index - + - actDbsLB + browseDbPB - - true + + Browse - - - 200 - 200 - - - - Extended + + Select the xapiandb directory for the index you want to add, then click Add Index - + - + - Layout1 + layout38 unnamed - - 0 - - - 6 - Horizontal Spacing2 @@ -745,7 +706,7 @@ May be slow for big documents. - 20 + 210 20 diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index 9fac59d7..a1e77e97 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.13 2006-12-14 13:53:43 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.14 2007-01-13 15:21:41 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -37,13 +37,17 @@ static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.13 2006-12-14 13:53:43 dockes E #include #if QT_VERSION < 0x040000 #include +#include #include #else #include +#include #include -#define QListBox Q3ListBox -#define QListBoxItem Q3ListBoxItem +#include < +#define QListView Q3ListView +#define QCheckListItem Q3CheckListItem #define QFileDialog Q3FileDialog +#define QListViewItemIterator Q3ListViewItemIterator #endif #include #include @@ -67,16 +71,24 @@ void UIPrefsDialog::init() connect(resetFontPB, SIGNAL(clicked()), this, SLOT(resetReslistFont())); connect(extraDbLE,SIGNAL(textChanged(const QString&)), this, SLOT(extraDbTextChanged(const QString&))); - connect(addAADbPB, SIGNAL(clicked()), this, SLOT(addAADbPB_clicked())); - connect(addADbPB, SIGNAL(clicked()), this, SLOT(addADbPB_clicked())); - connect(delADbPB, SIGNAL(clicked()), this, SLOT(delADbPB_clicked())); - connect(delAADbPB, SIGNAL(clicked()), this, SLOT(delAADbPB_clicked())); - connect(addExtraDbPB, SIGNAL(clicked()), this, SLOT(addExtraDbPB_clicked())); + + connect(addExtraDbPB, SIGNAL(clicked()), + this, SLOT(addExtraDbPB_clicked())); + connect(delExtraDbPB, SIGNAL(clicked()), + this, SLOT(delExtraDbPB_clicked())); + connect(togExtraDbPB, SIGNAL(clicked()), + this, SLOT(togExtraDbPB_clicked())); + connect(actAllExtraDbPB, SIGNAL(clicked()), + this, SLOT(actAllExtraDbPB_clicked())); + connect(unacAllExtraDbPB, SIGNAL(clicked()), + this, SLOT(unacAllExtraDbPB_clicked())); + connect(browseDbPB, SIGNAL(clicked()), this, SLOT(browseDbPB_clicked())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buildAbsCB, SIGNAL(toggled(bool)), replAbsCB, SLOT(setEnabled(bool))); + setFromPrefs(); } @@ -138,21 +150,22 @@ void UIPrefsDialog::setFromPrefs() replAbsCB->setChecked(prefs.queryReplaceAbstract); // Initialize the extra indexes listboxes - QStringList ql; + idxLV->clear(); for (list::iterator it = prefs.allExtraDbs.begin(); it != prefs.allExtraDbs.end(); it++) { - ql.append(QString::fromLocal8Bit(it->c_str())); + QCheckListItem *item = + new QCheckListItem(idxLV, QString::fromLocal8Bit(it->c_str()), + QCheckListItem::CheckBox); + if (item) item->setOn(false); } - allDbsLB->clear(); - allDbsLB->insertStringList(ql); - ql.clear(); for (list::iterator it = prefs.activeExtraDbs.begin(); it != prefs.activeExtraDbs.end(); it++) { - ql.append(QString::fromLocal8Bit(it->c_str())); + QCheckListItem *item; + if ((item = (QCheckListItem *) + idxLV->findItem (QString::fromLocal8Bit(it->c_str()), 0))) { + item->setOn(true); + } } - actDbsLB->clear(); - actDbsLB->insertStringList(ql); - ql.clear(); } void UIPrefsDialog::accept() @@ -183,26 +196,26 @@ void UIPrefsDialog::accept() prefs.syntAbsLen = syntlenSB->value(); prefs.syntAbsCtx = syntctxSB->value(); - prefs.activeExtraDbs.clear(); - for (unsigned int i = 0; i < actDbsLB->count(); i++) { - QListBoxItem *item = actDbsLB->item(i); - if (item) - prefs.activeExtraDbs.push_back((const char *)item->text().local8Bit()); - } + QListViewItemIterator it(idxLV); prefs.allExtraDbs.clear(); - for (unsigned int i = 0; i < allDbsLB->count(); i++) { - QListBoxItem *item = allDbsLB->item(i); - if (item) - prefs.allExtraDbs.push_back((const char *)item->text().local8Bit()); + prefs.activeExtraDbs.clear(); + while (it.current()) { + QCheckListItem *item = (QCheckListItem *)it.current(); + prefs.allExtraDbs.push_back((const char *)item->text().local8Bit()); + if (item->isOn()) { + prefs.activeExtraDbs.push_back((const char *) + item->text().local8Bit()); + } + ++it; } - rwSettings(true); string reason; maybeOpenDb(reason, true); emit uiprefsDone(); QDialog::accept(); } + void UIPrefsDialog::reject() { setFromPrefs(); @@ -236,7 +249,6 @@ void UIPrefsDialog::showFontDialog() } } - void UIPrefsDialog::resetReslistFont() { reslistFontFamily = ""; @@ -272,75 +284,34 @@ void UIPrefsDialog::showViewAction() // External / extra search indexes setup // TBD: a way to remove entry from 'all' list (del button?) -void UIPrefsDialog::extraDbTextChanged(const QString &text) +void UIPrefsDialog::togExtraDbPB_clicked() { - if (text.isEmpty()) { - addExtraDbPB->setEnabled(false); - } else { - addExtraDbPB->setEnabled(true); - } -} - -/** - * Add the selected extra dbs to the active list - */ -void UIPrefsDialog::addADbPB_clicked() -{ - for (unsigned int i = 0; i < allDbsLB->count();i++) { - QListBoxItem *item = allDbsLB->item(i); - if (item && item->isSelected()) { - allDbsLB->setSelected(i, false); - if (!actDbsLB->findItem(item->text(), -#if QT_VERSION < 0x040000 - Qt::CaseSensitive|Qt::ExactMatch -#else - Q3ListBox::CaseSensitive|Q3ListBox::ExactMatch -#endif - )) { - actDbsLB->insertItem(item->text()); - } + QListViewItemIterator it(idxLV); + while (it.current()) { + QCheckListItem *item = (QCheckListItem *)it.current(); + if (item->isSelected()) { + item->setOn(!item->isOn()); } - } - actDbsLB->sort(); -} - -/** - * Make all extra dbs active - */ -void UIPrefsDialog::addAADbPB_clicked() -{ - for (unsigned int i = 0; i < allDbsLB->count();i++) { - allDbsLB->setSelected(i, true); - } - addADbPB_clicked(); -} - -/** - * Remove the selected entries from the list of active extra search dbs - */ -void UIPrefsDialog::delADbPB_clicked() -{ - list rmi; - for (unsigned int i = 0; i < actDbsLB->count(); i++) { - QListBoxItem *item = actDbsLB->item(i); - if (item && item->isSelected()) { - rmi.push_front(i); - } - } - for (list::iterator ii = rmi.begin(); ii != rmi.end(); ii++) { - actDbsLB->removeItem(*ii); + ++it; } } - -/** - * Remove all extra search indexes from the active list - */ -void UIPrefsDialog::delAADbPB_clicked() +void UIPrefsDialog::actAllExtraDbPB_clicked() { - for (unsigned int i = 0; i < actDbsLB->count(); i++) { - actDbsLB->setSelected(i, true); + QListViewItemIterator it(idxLV); + while (it.current()) { + QCheckListItem *item = (QCheckListItem *)it.current(); + item->setOn(true); + ++it; + } +} +void UIPrefsDialog::unacAllExtraDbPB_clicked() +{ + QListViewItemIterator it(idxLV); + while (it.current()) { + QCheckListItem *item = (QCheckListItem *)it.current(); + item->setOn(false); + ++it; } - delADbPB_clicked(); } /** @@ -370,19 +341,44 @@ void UIPrefsDialog::addExtraDbPB_clicked() tr("This is the main/local index!")); return; } - if (allDbsLB->findItem(extraDbLE->text(), + if (idxLV->findItem(extraDbLE->text(), #if QT_VERSION < 0x040000 Qt::CaseSensitive|Qt::ExactMatch #else - Q3ListBox::CaseSensitive|Q3ListBox::ExactMatch + Q3ListView::CaseSensitive|Q3ListView::ExactMatch #endif )) { QMessageBox::warning(0, "Recoll", tr("The selected directory is already in the index list")); return; } - allDbsLB->insertItem(extraDbLE->text()); - allDbsLB->sort(); + new QCheckListItem(idxLV, extraDbLE->text(), QCheckListItem::CheckBox); + idxLV->sort(); +} + +void UIPrefsDialog::delExtraDbPB_clicked() +{ + list dlt; + QListViewItemIterator it(idxLV); + while (it.current()) { + QCheckListItem *item = (QCheckListItem *)it.current(); + if (item->isSelected()) { + dlt.push_back(item); + } + ++it; + } + for (list::iterator it = dlt.begin(); + it != dlt.end(); it++) + delete *it; +} + +void UIPrefsDialog::extraDbTextChanged(const QString &text) +{ + if (text.isEmpty()) { + addExtraDbPB->setEnabled(false); + } else { + addExtraDbPB->setEnabled(true); + } } void UIPrefsDialog::browseDbPB_clicked() diff --git a/src/qtgui/uiprefs_w.h b/src/qtgui/uiprefs_w.h index 24ca9816..2a7ef6a2 100644 --- a/src/qtgui/uiprefs_w.h +++ b/src/qtgui/uiprefs_w.h @@ -1,4 +1,4 @@ -/* @(#$Id: uiprefs_w.h,v 1.6 2006-12-14 13:53:43 dockes Exp $ (C) 2006 J.F.Dockes */ +/* @(#$Id: uiprefs_w.h,v 1.7 2007-01-13 15:21:41 dockes Exp $ (C) 2006 J.F.Dockes */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ #ifndef _UIPREFS_W_H_INCLUDED_ #define _UIPREFS_W_H_INCLUDED_ -/* @(#$Id: uiprefs_w.h,v 1.6 2006-12-14 13:53:43 dockes Exp $ (C) 2005 J.F.Dockes */ +/* @(#$Id: uiprefs_w.h,v 1.7 2007-01-13 15:21:41 dockes Exp $ (C) 2005 J.F.Dockes */ #include #include @@ -69,12 +69,12 @@ public slots: virtual void resetReslistFont(); virtual void showBrowserDialog(); virtual void extraDbTextChanged( const QString & text ); - virtual void addAADbPB_clicked(); - virtual void addADbPB_clicked(); - virtual void delADbPB_clicked(); - virtual void delAADbPB_clicked(); virtual void addExtraDbPB_clicked(); + virtual void delExtraDbPB_clicked(); virtual void browseDbPB_clicked(); + virtual void togExtraDbPB_clicked(); + virtual void actAllExtraDbPB_clicked(); + virtual void unacAllExtraDbPB_clicked(); signals: void uiprefsDone();