use the (should be renamed) history file to store external databases lists
This commit is contained in:
+13
-25
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.13 2006-09-08 09:02:47 dockes Exp $ (C) 2005 Jean-Francois Dockes";
|
||||
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.14 2006-09-11 09:08:44 dockes Exp $ (C) 2005 Jean-Francois Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -162,32 +162,26 @@ void rwSettings(bool writing)
|
||||
// known dbs and active (searched) ones.
|
||||
// When starting up, we also add from the RECOLL_EXTRA_DBS environment
|
||||
// variable.
|
||||
QStringList qsl;
|
||||
// This are stored inside the dynamic configuration file (aka: history),
|
||||
// as they are likely to depend on RECOLL_CONFDIR.
|
||||
const string allEdbsSk = "allExtDbs";
|
||||
const string actEdbsSk = "actExtDbs";
|
||||
if (writing) {
|
||||
LOGDEB(("settings: writing to dynconf\n"));
|
||||
g_dynconf->eraseAll(allEdbsSk);
|
||||
for (list<string>::const_iterator it = prefs.allExtraDbs.begin();
|
||||
it != prefs.allExtraDbs.end(); it++) {
|
||||
string b64;
|
||||
base64_encode(*it, b64);
|
||||
qsl.push_back(QString::fromAscii(b64.c_str()));
|
||||
g_dynconf->enterString(allEdbsSk, *it);
|
||||
}
|
||||
settings.writeEntry("/Recoll/prefs/query/allExtraDbs", qsl);
|
||||
|
||||
qsl.clear();
|
||||
g_dynconf->eraseAll(actEdbsSk);
|
||||
for (list<string>::const_iterator it = prefs.activeExtraDbs.begin();
|
||||
it != prefs.activeExtraDbs.end(); it++) {
|
||||
string b64;
|
||||
base64_encode(*it, b64);
|
||||
qsl.push_back(QString::fromAscii(b64.c_str()));
|
||||
g_dynconf->enterString(actEdbsSk, *it);
|
||||
|
||||
}
|
||||
settings.writeEntry("/Recoll/prefs/query/activeExtraDbs", qsl);
|
||||
} else {
|
||||
qsl = settings.readListEntry("/Recoll/prefs/query/allExtraDbs");
|
||||
prefs.allExtraDbs.clear();
|
||||
for (QStringList::iterator it = qsl.begin(); it != qsl.end(); it++) {
|
||||
string dec;
|
||||
base64_decode((*it).ascii(), dec);
|
||||
prefs.allExtraDbs.push_back(dec);
|
||||
}
|
||||
prefs.allExtraDbs = g_dynconf->getStringList(allEdbsSk);
|
||||
const char *cp;
|
||||
if ((cp = getenv("RECOLL_EXTRA_DBS")) != 0) {
|
||||
list<string> dbl;
|
||||
@@ -207,13 +201,7 @@ void rwSettings(bool writing)
|
||||
prefs.allExtraDbs.push_back(dbdir);
|
||||
}
|
||||
}
|
||||
qsl = settings.readListEntry("/Recoll/prefs/query/activeExtraDbs");
|
||||
prefs.activeExtraDbs.clear();
|
||||
for (QStringList::iterator it = qsl.begin(); it != qsl.end(); it++) {
|
||||
string dec;
|
||||
base64_decode((*it).ascii(), dec);
|
||||
prefs.activeExtraDbs.push_back(dec);
|
||||
}
|
||||
prefs.activeExtraDbs = g_dynconf->getStringList(actEdbsSk);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
+14
-2
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.46 2006-09-08 09:02:47 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.47 2006-09-11 09:08:44 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -68,6 +68,8 @@ const string recoll_datadir = RECOLL_DATADIR;
|
||||
|
||||
RclConfig *rclconfig;
|
||||
Rcl::Db *rcldb;
|
||||
|
||||
RclHistory *g_dynconf;
|
||||
int recollNeedsExit;
|
||||
static string dbdir;
|
||||
static RclMain *mainWindow;
|
||||
@@ -194,7 +196,6 @@ int main(int argc, char **argv)
|
||||
translatdir.c_str() );
|
||||
app.installTranslator( &translator );
|
||||
|
||||
rwSettings(false);
|
||||
|
||||
string reason;
|
||||
rclconfig = recollinit(recollCleanup, sigcleanup, reason, &a_config);
|
||||
@@ -205,6 +206,17 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
string historyfile = path_cat(rclconfig->getConfDir(), "history");
|
||||
g_dynconf = new RclHistory(historyfile);
|
||||
if (!g_dynconf || !g_dynconf->ok()) {
|
||||
QString msg = app.translate("Main", "Configuration problem (dynconf");
|
||||
QMessageBox::critical(0, "Recoll", msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
rwSettings(false);
|
||||
|
||||
|
||||
// Create main window and set its size to previous session's
|
||||
#ifdef WITH_KDE
|
||||
#if 0
|
||||
|
||||
+6
-10
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.28 2006-09-04 15:13:01 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.29 2006-09-11 09:08:44 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -91,8 +91,6 @@ void RclMain::init()
|
||||
QFont nfont(prefs.reslistfontfamily, prefs.reslistfontsize);
|
||||
resList->setFont(nfont);
|
||||
}
|
||||
string historyfile = path_cat(rclconfig->getConfDir(), "history");
|
||||
m_history = new RclDHistory(historyfile);
|
||||
connect(sSearch, SIGNAL(startSearch(Rcl::AdvSearchData)),
|
||||
this, SLOT(startAdvSearch(Rcl::AdvSearchData)));
|
||||
|
||||
@@ -352,7 +350,6 @@ void RclMain::showAdvSearchDialog()
|
||||
asearchform = new AdvSearch(0, tr("Advanced search"), FALSE,
|
||||
WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu);
|
||||
asearchform->setSizeGripEnabled(FALSE);
|
||||
connect(asearchform, SIGNAL(startSearch(Rcl::AdvSearchData)),
|
||||
this, SLOT(startAdvSearch(Rcl::AdvSearchData)));
|
||||
asearchform->show();
|
||||
@@ -369,7 +366,6 @@ void RclMain::showSortDialog()
|
||||
sortform = new SortForm(0, tr("Sort criteria"), FALSE,
|
||||
WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu);
|
||||
sortform->setSizeGripEnabled(FALSE);
|
||||
connect(sortform, SIGNAL(sortDataChanged(RclSortSpec)),
|
||||
this, SLOT(sortDataChanged(RclSortSpec)));
|
||||
sortform->show();
|
||||
@@ -387,7 +383,6 @@ void RclMain::showUIPrefs()
|
||||
uiprefs = new UIPrefsDialog(0, tr("User interface preferences"), FALSE,
|
||||
WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu);
|
||||
uiprefs->setSizeGripEnabled(FALSE);
|
||||
connect(uiprefs, SIGNAL(uiprefsDone()), this, SLOT(setUIPrefs()));
|
||||
uiprefs->show();
|
||||
} else {
|
||||
@@ -458,7 +453,7 @@ void RclMain::startPreview(int docnum)
|
||||
}
|
||||
(void)curPreview->addEditorTab();
|
||||
}
|
||||
m_history->enterDocument(fn, doc.ipath);
|
||||
g_dynconf->enterDoc(fn, doc.ipath);
|
||||
if (!curPreview->loadFileInCurrentTab(fn, st.st_size, doc))
|
||||
curPreview->closeCurrentTab();
|
||||
}
|
||||
@@ -544,7 +539,7 @@ void RclMain::startNativeViewer(int docnum)
|
||||
QString::fromUtf8(prcmd.c_str()) + "]";
|
||||
stb->message(msg, 5000);
|
||||
}
|
||||
m_history->enterDocument(fn, doc.ipath);
|
||||
g_dynconf->enterDoc(fn, doc.ipath);
|
||||
system(ncmd.c_str());
|
||||
}
|
||||
|
||||
@@ -601,11 +596,12 @@ void RclMain::showDocHistory()
|
||||
|
||||
DocSequence *docsource;
|
||||
if (sortspecs.sortwidth > 0) {
|
||||
DocSequenceHistory myseq(rcldb, m_history, string(tr("Document history").utf8()));
|
||||
DocSequenceHistory myseq(rcldb, g_dynconf,
|
||||
string(tr("Document history").utf8()));
|
||||
docsource = new DocSeqSorted(myseq, sortspecs,
|
||||
string(tr("Document history (sorted)").utf8()));
|
||||
} else {
|
||||
docsource = new DocSequenceHistory(rcldb, m_history,
|
||||
docsource = new DocSequenceHistory(rcldb, g_dynconf,
|
||||
string(tr("Document history").utf8()));
|
||||
}
|
||||
Rcl::AdvSearchData sdata;
|
||||
|
||||
@@ -71,7 +71,6 @@ private:
|
||||
SortForm *sortform;
|
||||
UIPrefsDialog *uiprefs;
|
||||
RclSortSpec sortspecs;
|
||||
RclDHistory *m_history;
|
||||
virtual void init();
|
||||
};
|
||||
|
||||
|
||||
+3
-1
@@ -16,12 +16,13 @@
|
||||
*/
|
||||
#ifndef _RECOLL_H_INCLUDED_
|
||||
#define _RECOLL_H_INCLUDED_
|
||||
/* @(#$Id: recoll.h,v 1.15 2006-01-31 11:39:12 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
/* @(#$Id: recoll.h,v 1.16 2006-09-11 09:08:44 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
#include <string>
|
||||
|
||||
#include "rclconfig.h"
|
||||
#include "rcldb.h"
|
||||
#include "idxthread.h"
|
||||
#include "history.h"
|
||||
|
||||
// Misc declarations in need of sharing between the UI files
|
||||
|
||||
@@ -32,5 +33,6 @@ extern RclConfig *rclconfig;
|
||||
extern Rcl::Db *rcldb;
|
||||
extern int recollNeedsExit;
|
||||
extern const std::string recoll_datadir;
|
||||
extern RclHistory *g_dynconf;
|
||||
|
||||
#endif /* _RECOLL_H_INCLUDED_ */
|
||||
|
||||
@@ -276,7 +276,7 @@ May be slow for big documents.</string>
|
||||
<cstring>ExtraDb</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Extra Databases</string>
|
||||
<string>External Databases</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
@@ -352,10 +352,10 @@ May be slow for big documents.</string>
|
||||
<cstring>textLabel2_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>All extra databases</string>
|
||||
<string>All databases</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>All known extra databases</string>
|
||||
<string>Databases currently not used</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListBox">
|
||||
@@ -456,10 +456,10 @@ May be slow for big documents.</string>
|
||||
<cstring>textLabel3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Active extra databases</string>
|
||||
<string>Active databases</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Extra databases that will be searched in addition to the main one</string>
|
||||
<string>Databases that will be searched in addition to the main one</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListBox">
|
||||
|
||||
Reference in New Issue
Block a user