diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp
index b968f2a7..c1c50ec9 100644
--- a/src/common/rclconfig.cpp
+++ b/src/common/rclconfig.cpp
@@ -218,7 +218,7 @@ RclConfig::RclConfig(const string *argcnf)
if (!readFieldsConfig(cnferrloc))
return;
- m_ptrans = new ConfSimple(path_cat(m_confdir, "ptrans").c_str(), 1);
+ m_ptrans = new ConfSimple(path_cat(m_confdir, "ptrans").c_str());
m_ok = true;
setKeyDir(cstr_null);
diff --git a/src/common/rclconfig.h b/src/common/rclconfig.h
index f53d1a92..750f2c87 100644
--- a/src/common/rclconfig.h
+++ b/src/common/rclconfig.h
@@ -152,7 +152,10 @@ class RclConfig {
string getIdxStatusFile() const;
/** Do path translation according to the ptrans table */
void urlrewrite(const string& dbdir, string& url) const;
-
+ ConfSimple *getPTrans()
+ {
+ return m_ptrans;
+ }
/** Get Web Queue directory name */
string getWebQueueDir() const;
diff --git a/src/doc/user/usermanual.sgml b/src/doc/user/usermanual.sgml
index cae8004c..ff7f04b4 100644
--- a/src/doc/user/usermanual.sgml
+++ b/src/doc/user/usermanual.sgml
@@ -1767,7 +1767,7 @@ fvwm
Index selection is performed in two phases. A set of all
usable indexes must first be defined, and then the subset of
- indexes to be used for searching. Of course, these parameters
+ indexes to be used for searching. These parameters
are retained across program executions (there are kept
separately for each &RCL; configuration). The set of all indexes
is usually quite stable, while the active ones might typically
@@ -1778,6 +1778,11 @@ fvwm
undesirable, you can set up your base configuration to index
an empty directory.
+ When adding a new index to the set, you can select either
+ a &RCL; configuration directory, or directly a &XAP; index
+ directory. In the first case, the &XAP; index directory will
+ be obtained from the selected configuration.
+
As building the set of all indexes can be a little tedious
when done through the user interface, you can use the
RECOLL_EXTRA_DBS environment
diff --git a/src/qtgui/confgui/confguiindex.cpp b/src/qtgui/confgui/confguiindex.cpp
index c61e4bb3..8f80e814 100644
--- a/src/qtgui/confgui/confguiindex.cpp
+++ b/src/qtgui/confgui/confguiindex.cpp
@@ -82,7 +82,6 @@ void ConfIndexW::acceptChanges()
delete m_conf;
m_conf = 0;
m_rclconf->updateMainConfig();
- snapshotConfig();
hide();
}
diff --git a/src/qtgui/main.cpp b/src/qtgui/main.cpp
index d5ba8a44..36fe7d07 100644
--- a/src/qtgui/main.cpp
+++ b/src/qtgui/main.cpp
@@ -51,20 +51,12 @@
#include "recollq.h"
extern RclConfig *theconfig;
-RclConfig *thestableconfig;
-PTMutexInit thestableconfiglock;
// To avoid writing settings if we stopped before reading them (else
// some kinds of errors would reset the qt/recoll settings to
// defaults)
static bool havereadsettings;
-void snapshotConfig()
-{
- PTMutexLocker locker(thestableconfiglock);
- thestableconfig = new RclConfig(*theconfig);
-}
-
PTMutexInit thetempfileslock;
static vector o_tempfiles;
/* Keep an array of temporary files for deletion at exit. It happens that we
@@ -156,7 +148,6 @@ static void recollCleanup()
LOGDEB2(("recollCleanup: closing database\n"));
deleteZ(rcldb);
deleteZ(theconfig);
-// deleteZ(thestableconfig);
PTMutexLocker locker(thetempfileslock);
o_tempfiles.clear();
@@ -308,7 +299,6 @@ int main(int argc, char **argv)
exit(1);
}
// fprintf(stderr, "recollinit done\n");
- snapshotConfig();
// Translations for Qt standard widgets
QString slang = QLocale::system().name().left(2);
diff --git a/src/qtgui/ptrans.ui b/src/qtgui/ptrans.ui
new file mode 100644
index 00000000..610eac48
--- /dev/null
+++ b/src/qtgui/ptrans.ui
@@ -0,0 +1,142 @@
+
+
+ EditTransBase
+
+
+
+ 0
+ 0
+ 649
+ 362
+
+
+
+ Path Translations
+
+
+ -
+
+
-
+
+
+ Setting path translations for
+
+
+ false
+
+
+
+ -
+
+
+ Select one or several file types, then use the controls in the frame below to change how they are processed
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Sunken
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+ QAbstractItemView::ExtendedSelection
+
+
+ QAbstractItemView::SelectRows
+
+
+ true
+
+
+ true
+
+
+ 2
+
+
+ true
+
+
+ false
+
+
+ 300
+
+
+ 20
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+
+
+
+ -
+
+
-
+
+
+ Add
+
+
+
+ -
+
+
+ false
+
+
+ Delete
+
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Cancel
+
+
+
+ -
+
+
+ Save
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/qtgui/ptrans_w.cpp b/src/qtgui/ptrans_w.cpp
new file mode 100644
index 00000000..c1338f2a
--- /dev/null
+++ b/src/qtgui/ptrans_w.cpp
@@ -0,0 +1,134 @@
+/* Copyright (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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include
+
+#include
+#include
+#include
+
+using namespace std;
+
+#include
+#include
+
+#include
+
+#include
+#include
+#include
+
+#include "recoll.h"
+#include "debuglog.h"
+#include "guiutils.h"
+#include "conftree.h"
+
+#include "ptrans_w.h"
+
+void EditTrans::init(const string& dbdir)
+{
+ m_dbdir = path_canon(dbdir);
+ connect(transTW, SIGNAL(itemDoubleClicked(QTableWidgetItem *)),
+ this, SLOT(onItemDoubleClicked(QTableWidgetItem *)));
+ connect(cancelPB, SIGNAL(clicked()), this, SLOT(close()));
+
+ QString lab = whatIdxLA->text();
+ lab.append(QString::fromLocal8Bit(m_dbdir.c_str()));
+ whatIdxLA->setText(lab);
+
+ QStringList labels(tr("Source path"));
+ labels.push_back(tr("Local path"));
+ transTW->setHorizontalHeaderLabels(labels);
+
+ ConfSimple *conftrans = theconfig->getPTrans();
+ if (!conftrans)
+ return;
+
+ int row = 0;
+ vector opaths = conftrans->getNames(m_dbdir);
+ for (vector::const_iterator it = opaths.begin();
+ it != opaths.end(); it++) {
+ transTW->setRowCount(row+1);
+ transTW->setItem(row, 0, new QTableWidgetItem(
+ QString::fromLocal8Bit(it->c_str())));
+ string npath;
+ conftrans->get(*it, npath, m_dbdir);
+ transTW->setItem(row, 1, new QTableWidgetItem(
+ QString::fromLocal8Bit(npath.c_str())));
+ row++;
+ }
+
+ resize(QSize(640, 300).expandedTo(minimumSizeHint()));
+}
+
+void EditTrans::onItemDoubleClicked(QTableWidgetItem *item)
+{
+ transTW->editItem(item);
+}
+
+void EditTrans::on_savePB_clicked()
+{
+ ConfSimple *conftrans = theconfig->getPTrans();
+ if (!conftrans) {
+ QMessageBox::warning(0, "Recoll", tr("Config error"));
+ return;
+ }
+ conftrans->holdWrites(true);
+ conftrans->eraseKey(m_dbdir);
+
+ for (int row = 0; row < transTW->rowCount(); row++) {
+ QTableWidgetItem *item0 = transTW->item(row, 0);
+ string from = path_canon((const char *)item0->text().toLocal8Bit());
+ QTableWidgetItem *item1 = transTW->item(row, 1);
+ string to = path_canon((const char*)item1->text().toLocal8Bit());
+ conftrans->set(from, to, m_dbdir);
+ }
+ conftrans->holdWrites(false);
+ close();
+}
+
+void EditTrans::on_addPB_clicked()
+{
+ transTW->setRowCount(transTW->rowCount()+1);
+ int row = transTW->rowCount()-1;
+ transTW->setItem(row, 0, new QTableWidgetItem(tr("Original path")));
+ transTW->setItem(row, 1, new QTableWidgetItem(tr("Local path")));
+ transTW->editItem(transTW->item(row, 0));
+}
+
+void EditTrans::on_delPB_clicked()
+{
+ QModelIndexList indexes = transTW->selectionModel()->selectedIndexes();
+ vector rows;
+ for (int i = 0; i < indexes.size(); i++) {
+ rows.push_back(indexes.at(i).row());
+ }
+ sort(rows.begin(), rows.end());
+ rows.resize(unique(rows.begin(), rows.end()) - rows.begin());
+ for (int i = rows.size()-1; i >= 0; i--) {
+ transTW->removeRow(rows[i]);
+ }
+}
+
+void EditTrans::on_transTW_itemSelectionChanged()
+{
+ QModelIndexList indexes = transTW->selectionModel()->selectedIndexes();
+ if(indexes.size() < 1)
+ delPB->setEnabled(0);
+ else
+ delPB->setEnabled(1);
+}
diff --git a/src/qtgui/ptrans_w.h b/src/qtgui/ptrans_w.h
new file mode 100644
index 00000000..64fbdb74
--- /dev/null
+++ b/src/qtgui/ptrans_w.h
@@ -0,0 +1,52 @@
+/* Copyright (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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef _PTRANS_W_H_INCLUDED_
+#define _PTRANS_W_H_INCLUDED_
+
+#include
+
+#include
+#include
+
+#include "ui_ptrans.h"
+
+class QTableWidgetItem;
+
+class EditTrans : public QDialog, public Ui::EditTransBase
+{
+ Q_OBJECT
+
+public:
+ EditTrans(const std::string& dbdir, QWidget* parent = 0)
+ : QDialog(parent)
+ {
+ setupUi(this);
+ init(dbdir);
+ }
+
+public slots:
+ virtual void onItemDoubleClicked(QTableWidgetItem *);
+ virtual void on_savePB_clicked();
+ virtual void on_addPB_clicked();
+ virtual void on_delPB_clicked();
+ virtual void on_transTW_itemSelectionChanged();
+private:
+ virtual void init(const std::string& dbdir);
+ std::string m_dbdir;
+};
+
+#endif /* _PTRANS_W_H_INCLUDED_ */
diff --git a/src/qtgui/recoll.h b/src/qtgui/recoll.h
index 5e882ab7..429dab88 100644
--- a/src/qtgui/recoll.h
+++ b/src/qtgui/recoll.h
@@ -35,9 +35,7 @@ extern bool maybeOpenDb(std::string &reason, bool force = true,
bool getStemLangs(vector& langs);
extern RclConfig *theconfig;
-extern RclConfig *thestableconfig;
-extern PTMutexInit thestableconfiglock;
-extern void snapshotConfig();
+
extern void rememberTempFile(TempFile);
extern void forgetTempFile(string &fn);
diff --git a/src/qtgui/recoll.pro.in b/src/qtgui/recoll.pro.in
index b0e2d2ed..4017158d 100644
--- a/src/qtgui/recoll.pro.in
+++ b/src/qtgui/recoll.pro.in
@@ -22,6 +22,7 @@ HEADERS += \
idxsched.h \
listdialog.h \
preview_w.h \
+ ptrans_w.h \
rclhelp.h \
rclmain_w.h \
reslist.h \
@@ -34,7 +35,6 @@ HEADERS += \
uiprefs_w.h \
viewaction_w.h \
-
SOURCES += \
advsearch_w.cpp \
advshist.cpp \
@@ -44,6 +44,7 @@ SOURCES += \
guiutils.cpp \
main.cpp \
preview_w.cpp \
+ ptrans_w.cpp \
rclhelp.cpp \
rclmain_w.cpp \
rclzg.cpp \
@@ -65,6 +66,7 @@ FORMS = \
firstidx.ui \
idxsched.ui \
listdialog.ui \
+ ptrans.ui \
rclmain.ui \
restable.ui \
rtitool.ui \
diff --git a/src/qtgui/spell_w.cpp b/src/qtgui/spell_w.cpp
index 51a221eb..fa51bd36 100644
--- a/src/qtgui/spell_w.cpp
+++ b/src/qtgui/spell_w.cpp
@@ -306,14 +306,14 @@ void SpellW::showStats()
resTW->setItem(row++, 1, new QTableWidgetItem(
QString::number(res.maxdoclen)));
- if (!thestableconfig)
+ if (!theconfig)
return;
ExecCmd cmd;
vector args;
int status;
args.push_back("-sk");
- args.push_back(thestableconfig->getDbDir());
+ args.push_back(theconfig->getDbDir());
string output;
status = cmd.doexec("du", args, 0, &output);
int dbkbytes = 0;
@@ -327,14 +327,13 @@ void SpellW::showStats()
QString::fromUtf8(
displayableBytes(dbkbytes*1024).c_str())));
- vector allmimetypes = thestableconfig->getAllMimeTypes();
+ vector allmimetypes = theconfig->getAllMimeTypes();
multimap mtbycnt;
for (vector::const_iterator it = allmimetypes.begin();
it != allmimetypes.end(); it++) {
string reason;
string q = string("mime:") + *it;
- Rcl::SearchData *sd =
- wasaStringToRcl(thestableconfig, "", q, reason);
+ Rcl::SearchData *sd = wasaStringToRcl(theconfig, "", q, reason);
RefCntr rq(sd);
Rcl::Query query(rcldb);
if (!query.setQuery(rq)) {
diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui
index 3d80bb86..bc2c9573 100644
--- a/src/qtgui/uiprefs.ui
+++ b/src/qtgui/uiprefs.ui
@@ -7,7 +7,7 @@
0
0
531
- 422
+ 427
@@ -22,7 +22,7 @@
-
- 0
+ 3
@@ -133,39 +133,39 @@
-
-
-
-
-
-
- Plain text to HTML line style
-
-
- Lines in PRE text are not folded. Using BR loses some indentation. PRE + Wrap style may be what you want.
-
-
-
- -
-
-
- <BR>
-
-
-
- -
-
-
- <PRE>
-
-
-
- -
-
-
- <PRE> + wrap
-
-
-
-
+
+ -
+
+
+ Lines in PRE text are not folded. Using BR loses some indentation. PRE + Wrap style may be what you want.
+
+
+ Plain text to HTML line style
+
+
+
+ -
+
+
+ <BR>
+
+
+
+ -
+
+
+ <PRE>
+
+
+
+ -
+
+
+ <PRE> + wrap
+
+
+
+
-
@@ -715,6 +715,13 @@ May be slow for big documents.
+ -
+
+
+ Paths translations
+
+
+
-
@@ -761,7 +768,7 @@ May be slow for big documents.
true
- Click to add another index directory to the list
+ Click to add another index directory to the list. You can select either a Recoll configuration directory or a Xapian index.
Add index
diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp
index f7de447f..75595bf8 100644
--- a/src/qtgui/uiprefs_w.cpp
+++ b/src/qtgui/uiprefs_w.cpp
@@ -53,6 +53,7 @@
#include "debuglog.h"
#include "editdialog.h"
#include "rclmain_w.h"
+#include "ptrans_w.h"
void UIPrefsDialog::init()
{
@@ -64,6 +65,10 @@ void UIPrefsDialog::init()
connect(stylesheetPB, SIGNAL(clicked()), this, SLOT(showStylesheetDialog()));
connect(resetSSPB, SIGNAL(clicked()), this, SLOT(resetStylesheet()));
+ connect(idxLV, SIGNAL(itemSelectionChanged()),
+ this, SLOT(extradDbSelectChanged()));
+ connect(ptransPB, SIGNAL(clicked()),
+ this, SLOT(extraDbEditPtrans()));
connect(addExtraDbPB, SIGNAL(clicked()),
this, SLOT(addExtraDbPB_clicked()));
connect(delExtraDbPB, SIGNAL(clicked()),
@@ -397,6 +402,33 @@ void UIPrefsDialog::showViewAction(const QString& mt)
////////////////////////////////////////////
// External / extra search indexes setup
+void UIPrefsDialog::extradDbSelectChanged()
+{
+ if (idxLV->selectedItems().size() <= 1)
+ ptransPB->setEnabled(true);
+ else
+ ptransPB->setEnabled(false);
+}
+
+void UIPrefsDialog::extraDbEditPtrans()
+{
+ string dbdir;
+ if (idxLV->selectedItems().size() == 0) {
+ dbdir = theconfig->getDbDir();
+ } else if (idxLV->selectedItems().size() == 1) {
+ QListWidgetItem *item = idxLV->selectedItems()[0];
+ QString qd = item->data(Qt::DisplayRole).toString();
+ dbdir = (const char *)qd.toLocal8Bit();
+ } else {
+ QMessageBox::warning(
+ 0, "Recoll", tr("At most one index should be selected"));
+ return;
+ }
+ dbdir = path_canon(dbdir);
+ EditTrans *etrans = new EditTrans(dbdir, this);
+ etrans->show();
+}
+
void UIPrefsDialog::togExtraDbPB_clicked()
{
for (int i = 0; i < idxLV->count(); i++) {
diff --git a/src/qtgui/uiprefs_w.h b/src/qtgui/uiprefs_w.h
index 502af636..7433b2e6 100644
--- a/src/qtgui/uiprefs_w.h
+++ b/src/qtgui/uiprefs_w.h
@@ -59,6 +59,8 @@ public slots:
virtual void setStemLang(const QString& lang);
virtual void editParaFormat();
virtual void editHeaderText();
+ virtual void extradDbSelectChanged();
+ virtual void extraDbEditPtrans();
signals:
void uiprefsDone();
diff --git a/src/sampleconf/mimeconf b/src/sampleconf/mimeconf
index 1066efd8..0e54adf1 100644
--- a/src/sampleconf/mimeconf
+++ b/src/sampleconf/mimeconf
@@ -322,9 +322,14 @@ media = \
image/x-xcf \
image/bmp \
image/x-xpmi \
+ video/3gpp \
video/mp2p \
video/mp2t \
video/mp4 \
+ video/mpeg \
+ video/quicktime \
+ video/x-matroska \
+ video/x-ms-asf \
video/x-msvideo \
message = message/rfc822 \