add menu entry to start browser on html doc

This commit is contained in:
dockes 2006-01-04 11:33:44 +00:00
parent 9955e5b1b0
commit 1aff860984
11 changed files with 380 additions and 25 deletions

View File

@ -1 +1 @@
1.0.14
1.1.0

View File

@ -1,6 +1,6 @@
#ifndef _RCLCONFIG_H_INCLUDED_
#define _RCLCONFIG_H_INCLUDED_
/* @(#$Id: rclconfig.h,v 1.9 2005-11-25 09:13:07 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: rclconfig.h,v 1.10 2006-01-04 11:33:44 dockes Exp $ (C) 2004 J.F.Dockes */
#include <list>
@ -62,7 +62,6 @@ class RclConfig {
*/
string getMimeIconName(const string &mtype);
const string &getDefCharset() {return defcharset;}
const string &getDefLang() {return deflang;}
bool getGuessCharset() {return guesscharset;}

View File

@ -1,6 +1,8 @@
#!/bin/sh
# @(#$Id: makesrcdist.sh,v 1.7 2006-01-04 11:33:44 dockes Exp $ (C) 2005 J.F.Dockes
# A shell-script to make a recoll source distribution
#set -x
# A shell-script to make a recoll distribution:
TAR=/usr/bin/tar
@ -26,27 +28,30 @@ else
fi
fi
################################### Documentation
###### Html doc
RECOLLDOC=${RECOLLDOC:=doc/user}
(cd $RECOLLDOC;make) || exit 1
###### Text Doc
chmod +w README INSTALL
cat <<EOF > README
A more complete version of this document can be found at http://www.recoll.org
More documentation can be found in the doc/ directory or at http://www.recoll.org
EOF
cat <<EOF > INSTALL
A more complete version of this document can be found at http://www.recoll.org
More documentation can be found in the doc/ directory or at http://www.recoll.org
EOF
echo "Dumping html documentation to text files"
RECOLLDOC=${RECOLLDOC:=$HOME/projets/lesbonscomptes/recoll}
links -dump ${RECOLLDOC}/index.html >> README
links -dump ${RECOLLDOC}/credits.html >> README
links -dump ${RECOLLDOC}/usermanual.html >> README
links -dump ${RECOLLDOC}/installation.html >> INSTALL
links -dump ${RECOLLDOC}/rcl.install.html >> INSTALL
cvs commit -m '' README INSTALL
# Clean up this dir and copy the dist-specific files

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: main.cpp,v 1.27 2005-12-16 10:06:56 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: main.cpp,v 1.28 2006-01-04 11:33:44 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
#include <unistd.h>
@ -26,6 +26,7 @@ using Rcl::AdvSearchData;
#include "wipedir.h"
#include "rclinit.h"
#include "history.h"
#include "debuglog.h"
#include "recollmain.h"
@ -39,6 +40,7 @@ string iconsdir;
RclDHistory *history;
static string dbdir;
static RecollMain *mainWindow;
static string recollsharedir;
/////////////////////////
// Global variables for user preferences. These are set in the user preference
@ -51,6 +53,7 @@ QString prefs_queryStemLang;
int prefs_mainwidth;
int prefs_mainheight;
bool prefs_ssall;
QString prefs_htmlBrowser;
#define SETTING_RW(var, nm, tp, def) \
if (writing) { \
@ -134,7 +137,7 @@ int main( int argc, char ** argv )
a.installTranslator( &qt );
// Translations for Recoll
string recollsharedir = path_cat(recollprefix, "share");
recollsharedir = path_cat(recollprefix, "share/recoll");
string translatdir = path_cat(recollsharedir, "translations");
QTranslator translator( 0 );
// QTextCodec::locale() returns $LANG
@ -220,3 +223,69 @@ int main( int argc, char ** argv )
w.show();
return a.exec();
}
const static char *htmlbrowserlist =
"opera konqueror firefox mozilla netscape";
// Search for and launch an html browser for the documentation. If the
// user has set a preference, we use it directly instead of guessing.
bool startHelpBrowser(const string &iurl)
{
string url;
if (iurl.empty()) {
url = path_cat(recollsharedir, "doc");
url = path_cat(url, "usermanual.html");
url = string("file://") + url;
} else
url = iurl;
// If the user set a preference with an absolute path then things are
// simple
if (!prefs_htmlBrowser.isEmpty() && prefs_htmlBrowser.find('/') != -1) {
if (access(prefs_htmlBrowser.ascii(), X_OK) != 0) {
LOGERR(("startHelpBrowser: %s not found or not executable\n",
prefs_htmlBrowser.ascii()));
}
string cmd = string(prefs_htmlBrowser.ascii()) + " " + url + "&";
if (system(cmd.c_str()) == 0)
return true;
else
return false;
}
string searched;
if (prefs_htmlBrowser.isEmpty()) {
searched = htmlbrowserlist;
} else {
searched = prefs_htmlBrowser.ascii();
}
list<string> blist;
stringToTokens(searched, blist, " ");
const char *path = getenv("PATH");
if (path == 0)
path = "/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin";
list<string> pathl;
stringToTokens(path, pathl, ":");
// For each browser name, search path and exec/stop if found
for (list<string>::const_iterator bit = blist.begin();
bit != blist.end(); bit++) {
for (list<string>::const_iterator pit = pathl.begin();
pit != pathl.end(); pit++) {
string exefile = path_cat(*pit, *bit);
LOGDEB1(("startHelpBrowser: trying %s\n", exefile.c_str()));
if (access(exefile.c_str(), X_OK) == 0) {
string cmd = exefile + " " + url + "&";
if (system(cmd.c_str()) == 0) {
return true;
}
}
}
}
LOGERR(("startHelpBrowser: no html browser found. Looked for: %s\n",
searched.c_str()));
return false;
}

View File

@ -1,6 +1,6 @@
#ifndef _RECOLL_H_INCLUDED_
#define _RECOLL_H_INCLUDED_
/* @(#$Id: recoll.h,v 1.9 2005-12-15 14:39:57 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: recoll.h,v 1.10 2006-01-04 11:33:44 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include <list>
@ -13,6 +13,7 @@
// Misc declarations in need of sharing between the UI files
extern void recollCleanup();
extern bool maybeOpenDb(std::string &reason);
extern bool startHelpBrowser(const string& url = "");
extern RclConfig *rclconfig;
extern Rcl::Db *rcldb;

View File

@ -19,7 +19,12 @@
</message>
<message>
<source>. Starting indexation</source>
<translation>. Démarrage de l&apos;indexation</translation>
<translation type="obsolete">. Démarrage de l&apos;indexation</translation>
</message>
<message>
<source>.
Click Cancel if you want to edit the configuration file before indexation starts, or Ok to let it proceed.</source>
<translation>Cliquer Annuler pour pouvoir editer le fichier de configuration avant que l&apos;indexation ne demarre, ou Ok pour continuer.</translation>
</message>
</context>
<context>
@ -85,7 +90,7 @@
<name>RecollMain</name>
<message>
<source>recoll</source>
<translation>recoll</translation>
<translation type="obsolete">recoll</translation>
</message>
<message>
<source>Search</source>
@ -145,11 +150,11 @@
</message>
<message>
<source>Ctrl+Q</source>
<translation>Ctrl+Q</translation>
<translation type="obsolete">Ctrl+Q</translation>
</message>
<message>
<source>Doc History</source>
<translation>Historique documents</translation>
<translation type="obsolete">Historique documents</translation>
</message>
<message>
<source>Indexing in progress</source>
@ -165,7 +170,7 @@
</message>
<message>
<source>&lt;b&gt;Displaying results starting at index %1 (maximum set size %2)&lt;/b&gt;&lt;/p&gt;</source>
<translation>&lt;b&gt;Affichage des résultats à partir de l&apos;indice %1 (taille maximum estimée %2)&lt;/b&gt;&lt;/p&gt;</translation>
<translation type="obsolete">&lt;b&gt;Affichage des résultats à partir de l&apos;indice %1 (taille maximum estimée %2)&lt;/b&gt;&lt;/p&gt;</translation>
</message>
<message>
<source>Cannot retrieve document info from database</source>
@ -187,6 +192,214 @@
<source>Can&apos;t create preview window</source>
<translation>Impossible de créer la fenetre de visualisation</translation>
</message>
<message>
<source>Recoll</source>
<translation></translation>
</message>
<message>
<source>Erase search entry</source>
<translation>Effacer l&apos;entrée</translation>
</message>
<message>
<source>Start query</source>
<translation>Démarrer la recherche</translation>
</message>
<message>
<source>&amp;All terms</source>
<translation>&amp;Tous </translation>
</message>
<message>
<source>Alt+A</source>
<translation>Alt+T</translation>
</message>
<message>
<source>Do documents have to contain all terms in query?</source>
<translation>Est-ce que tous les termes doivent se trouver dans chaque document ?</translation>
</message>
<message>
<source>If this is set, each returned document will contain all the terms in the query. Else documents will be ordered by relevance, but may not contain all the terms.</source>
<translation>Détermine si les documents doivent chacun contenir tous les termes, ou si ils seront simplement triés par pertinence, avec possibilité d&apos;absence de certains termes.</translation>
</message>
<message>
<source>Enter search terms here</source>
<translation>Entrer les termes à chercher</translation>
</message>
<message>
<source>&amp;Preferences</source>
<translation>&amp;Preferences</translation>
</message>
<message>
<source>Search tools</source>
<translation>Outils de recherche</translation>
</message>
<message>
<source>Result list</source>
<translation>Liste de résultats</translation>
</message>
<message>
<source>Toolbar_2</source>
<translation>Toolbar_2</translation>
</message>
<message>
<source>Start &amp;Indexing</source>
<translation>Démarrer l&apos;&amp;Indexation</translation>
</message>
<message>
<source>&amp;About Recoll</source>
<translation>&amp;A propos de Recoll</translation>
</message>
<message>
<source>Document &amp;History</source>
<translation>&amp;Historique des documents</translation>
</message>
<message>
<source>Document History</source>
<translation>Historique des documents</translation>
</message>
<message>
<source>Advanced Search</source>
<translation>Recherche avancée</translation>
</message>
<message>
<source>&amp;Advanced Search</source>
<translation>Recherche &amp;Avancée</translation>
</message>
<message>
<source>Advanced/complex Search</source>
<translation>Recherche Avancée</translation>
</message>
<message>
<source>&amp;Sort parameters</source>
<translation>Paramètres pour le &amp;tri</translation>
</message>
<message>
<source>Sort parameters</source>
<translation>Paramètres pour le tri</translation>
</message>
<message>
<source>Next page of results</source>
<translation>Page suivante</translation>
</message>
<message>
<source>Previous page of results</source>
<translation>Page précédente</translation>
</message>
<message>
<source>&amp;Query configuration</source>
<translation>Configuration pour la &amp;recherche</translation>
</message>
<message>
<source>&lt;b&gt;Displaying results starting at index %1 (maximum set size %2)&lt;/b&gt;&lt;/p&gt;
</source>
<translation>&lt;b&gt;Affichage des résultats à partir de l&apos;index %1 (nombre maximum %2)&lt;/b&gt;&lt;/p&gt;
</translation>
</message>
<message>
<source>Sort criteria</source>
<translation>Critères de tri</translation>
</message>
<message>
<source>User interface preferences</source>
<translation>Préférences pour l&apos;interface utilisateur</translation>
</message>
<message>
<source>User manual</source>
<translation>Manuel</translation>
</message>
<message>
<source>&amp;User manual</source>
<translation>&amp;Manuel</translation>
</message>
</context>
<context>
<name>SortForm</name>
<message>
<source>Sort Criteria</source>
<translation>Critères de tri</translation>
</message>
<message>
<source>Sort the</source>
<translation>Trier les</translation>
</message>
<message>
<source>most relevant results by:</source>
<translation>résultats les plus pertinents en fonction de:</translation>
</message>
<message>
<source>Descending</source>
<translation>Décroissant</translation>
</message>
<message>
<source>Reset</source>
<translation>Réinitialiser</translation>
</message>
<message>
<source>Close</source>
<translation>Fermer</translation>
</message>
</context>
<context>
<name>UIPrefsDialog</name>
<message>
<source>MyDialog</source>
<translation></translation>
</message>
<message>
<source>User interface</source>
<translation>Interface utilisateur</translation>
</message>
<message>
<source>Number of entries in a result page</source>
<translation>Nombre de résultats par page</translation>
</message>
<message>
<source>Result list font</source>
<translation>Fonte pour la liste de résultats</translation>
</message>
<message>
<source>Helvetica-10</source>
<translation>Helvetica-10</translation>
</message>
<message>
<source>Opens a dialog to select the result list font</source>
<translation>Ouvre une fenetre permettant de changer la fonte</translation>
</message>
<message>
<source>Show document type icons in result list</source>
<translation>Afficher les icones dans la liste de résultats</translation>
</message>
<message>
<source>Reset</source>
<translation>Réinitialiser</translation>
</message>
<message>
<source>Resets the result list font to the system default</source>
<translation>Réinitialiser la fonte à la valeur par défaut</translation>
</message>
<message>
<source>Search parameters</source>
<translation>Paramètres pour la recherche</translation>
</message>
<message>
<source>Stemming language</source>
<translation>Langue pour l&apos;expansion des termes</translation>
</message>
<message>
<source>&amp;OK</source>
<translation>&amp;OK</translation>
</message>
<message>
<source>Apply changes</source>
<translation>Appliquer les modifications</translation>
</message>
<message>
<source>&amp;Cancel</source>
<translation>&amp;Annuler</translation>
</message>
<message>
<source>Discard changes</source>
<translation>Abandonner les modifications</translation>
</message>
</context>
<context>
<name>advsearch</name>
@ -224,11 +437,11 @@
</message>
<message>
<source>--------&gt;</source>
<translation>--------&gt;</translation>
<translation type="obsolete">--------&gt;</translation>
</message>
<message>
<source>&lt;---------</source>
<translation>&lt;---------</translation>
<translation type="obsolete">&lt;---------</translation>
</message>
<message>
<source>Ignored file types</source>
@ -250,5 +463,21 @@
<source>Dismiss</source>
<translation>Annuler</translation>
</message>
<message>
<source>All ----&gt;</source>
<translation>Tout ----&gt;</translation>
</message>
<message>
<source>Sel -----&gt;</source>
<translation>Sel -----&gt;</translation>
</message>
<message>
<source>&lt;----- Sel</source>
<translation>&lt;----- Sel</translation>
</message>
<message>
<source>&lt;----- All</source>
<translation>&lt;----- Tout</translation>
</message>
</context>
</TS>

View File

@ -158,7 +158,6 @@
<cstring>MenuBar</cstring>
</property>
<item text="&amp;File" name="fileMenu">
<separator/>
<action name="fileStart_IndexingAction"/>
<separator/>
<action name="fileExitAction"/>
@ -173,6 +172,7 @@
</item>
<separator/>
<item text="&amp;Help" name="Help">
<action name="userManualAction"/>
<separator/>
<action name="helpAbout_RecollAction"/>
</item>
@ -242,6 +242,17 @@
<string>&amp;About Recoll</string>
</property>
</action>
<action>
<property name="name">
<cstring>userManualAction</cstring>
</property>
<property name="text">
<string>User manual</string>
</property>
<property name="menuText">
<string>&amp;User manual</string>
</property>
</action>
<action>
<property name="name">
<cstring>toolsDoc_HistoryAction</cstring>
@ -382,6 +393,12 @@
<receiver>RecollMain</receiver>
<slot>showAboutDialog()</slot>
</connection>
<connection>
<sender>userManualAction</sender>
<signal>activated()</signal>
<receiver>RecollMain</receiver>
<slot>startManual()</slot>
</connection>
<connection>
<sender>toolsDoc_HistoryAction</sender>
<signal>activated()</signal>
@ -474,6 +491,7 @@
<slot>showAdvSearchDialog()</slot>
<slot>showSortDialog()</slot>
<slot>showAboutDialog()</slot>
<slot>startManual()</slot>
<slot>showDocHistory()</slot>
<slot>searchTextChanged( const QString &amp; text )</slot>
<slot>sortDataChanged( int cnt, RclSortSpec spec )</slot>

View File

@ -776,6 +776,11 @@ void RecollMain::showAboutDialog()
QMessageBox::information(this, tr("About Recoll"), vstring.c_str());
}
void RecollMain::startManual()
{
startHelpBrowser();
}
void RecollMain::showDocHistory()
{

View File

@ -31,6 +31,7 @@ for d in ${PREFIX} \
${PREFIX}/bin \
${PREFIX}/share \
${PREFIX}/share/recoll \
${PREFIX}/share/recoll/doc \
${PREFIX}/share/recoll/examples \
${PREFIX}/share/recoll/filters \
${PREFIX}/share/recoll/images \
@ -39,6 +40,8 @@ do
test -d $d || mkdir $d || exit 1
done
${INSTALL} doc/usermanual.html doc/docbook.css ${PREFIX}/share/recoll/doc
${INSTALL} qtgui/recoll index/recollindex $PREFIX/bin || exit 1
${STRIP} $PREFIX/bin/recoll $PREFIX/bin/recollindex

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.11 2005-12-13 12:43:00 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.12 2006-01-04 11:33:44 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#ifndef TEST_SMALLUT
#include <string>
@ -265,6 +265,25 @@ bool stringToStrings(const string &s, std::list<string> &tokens)
return true;
}
void stringToTokens(const string& str, list<string>& tokens,
const string& delims)
{
string::size_type startPos, pos;
for (pos = 0;;) {
// Skip initial delims, break if this eats all.
if ((startPos = str.find_first_not_of(delims, pos)) == string::npos)
break;
// Find next delimiter or end of string (end of token)
pos = str.find_first_of(delims, startPos);
// Add token to the vector. Note: token cant be empty here
if (pos == string::npos)
tokens.push_back(str.substr(startPos));
else
tokens.push_back(str.substr(startPos, pos - startPos));
}
}
bool stringToBool(const string &s)
{
if (s.empty())

View File

@ -1,6 +1,6 @@
#ifndef _SMALLUT_H_INCLUDED_
#define _SMALLUT_H_INCLUDED_
/* @(#$Id: smallut.h,v 1.10 2005-11-25 14:36:46 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: smallut.h,v 1.11 2006-01-04 11:33:44 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include <list>
@ -20,13 +20,20 @@ extern bool maketmpdir(string& tdir);
extern string stringlistdisp(const list<string>& strs);
/**
* Parse input stream into list of strings.
* Parse input string into list of strings.
*
* Token delimiter is " \t" except inside dquotes. dquote inside
* dquotes can be escaped with \ etc...
*/
extern bool stringToStrings(const string &s, std::list<string> &tokens);
/**
* Split input string. No handling of quoting
*/
extern void stringToTokens(const string &s, std::list<string> &tokens,
const string &delims = " \t");
/** Convert string to boolean */
extern bool stringToBool(const string &s);
/** Remove instances of characters belonging to set (default {space,