Windows: enable the firefox recent history indexer.

This commit is contained in:
Jean-Francois Dockes 2019-11-24 10:46:23 +01:00
parent 1ec082bdbc
commit 83e29a9b01
9 changed files with 68 additions and 54 deletions

View File

@ -1 +1 @@
1.26.2pre1
1.26.2

View File

@ -119,10 +119,10 @@ overriden in the c++ code by ifdefs _WIN32 anyway */
#define PACKAGE_NAME "Recoll"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "Recoll 1.26.1"
#define PACKAGE_STRING "Recoll 1.26.2"
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.26.1"
#define PACKAGE_VERSION "1.26.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "recoll"
@ -184,7 +184,7 @@ overriden in the c++ code by ifdefs _WIN32 anyway */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
#define DISABLE_WEB_INDEXER
// #define DISABLE_WEB_INDEXER
#include "conf_post.h"
#endif // already included

View File

@ -1526,8 +1526,13 @@ bool RclConfig::sourceChanged() const
string RclConfig::getWebQueueDir() const
{
string webqueuedir;
if (!getConfParam("webqueuedir", webqueuedir))
if (!getConfParam("webqueuedir", webqueuedir)) {
#ifdef _WIN32
webqueuedir = "~/AppData/Local/RecollWebQueue";
#else
webqueuedir = "~/.recollweb/ToIndex/";
#endif
}
webqueuedir = path_tildexpand(webqueuedir);
return webqueuedir;
}

View File

@ -42,6 +42,8 @@ try:
except:
import rclconfig
_mswindows = (sys.platform == "win32")
verbosity = 0
def logdeb(s):
if verbosity >= 4:
@ -114,7 +116,10 @@ if not os.path.isdir(mydir):
# Get target webqueue recoll directory from recoll configuration
webqueuedir = config.getConfParam("webqueuedir")
if not webqueuedir:
webqueuedir = "~/.recollweb/ToIndex"
if _mswindows:
webqueuedir = "~/AppData/Local/RecollWebQueue"
else:
webqueuedir = "~/.recollweb/ToIndex"
webqueuedir = os.path.expanduser(webqueuedir)
os.makedirs(webqueuedir, exist_ok = True)

View File

@ -32,6 +32,7 @@
#include "mimehandler.h"
#include "pathut.h"
#include "idxstatus.h"
#include "execmd.h"
#ifdef RCL_USE_ASPELL
#include "rclaspell.h"
@ -56,6 +57,56 @@ void addIdxReason(string who, string reason)
}
}
#ifndef DISABLE_WEB_INDEXER
bool runWebFilesMoverScript(RclConfig *config)
{
static string downloadsdir;
if (downloadsdir.empty()) {
if (!config->getConfParam("webdownloadsdir", downloadsdir)) {
downloadsdir = path_tildexpand("~/Downloads");
}
}
static string cmdpath;
vector<string> args;
#ifdef _WIN32
const static string cmdnm{"python"};
args.push_back(config->findFilter("recoll-we-move-files.py"));
#else
const static string cmdnm{"recoll-we-move-files.py"}:
#endif
if (cmdpath.empty()) {
cmdpath = config->findFilter(cmdnm);
if (cmdpath.empty()) {
LOGERR("runWFMoverScript: recoll-we-move-files.py not found\n");
return false;
}
}
/* Arrange to not actually run the script if the directory did not change */
static time_t dirmtime;
time_t ndirmtime = 0;
struct stat st;
if (path_fileprops(downloadsdir.c_str(), &st) == 0) {
ndirmtime = st.st_mtime;
}
/* If stat fails, presumably Downloads does not exist or is not
accessible, dirmtime and mdirmtime stay at 0, and we never
execute the script, which is the right thing. */
if (dirmtime != ndirmtime) {
/* The script is going to change the directory, so updating
dirmtime before it runs means that we are going to execute
it one time too many (it will run without doing anything),
but we can't set the mtime to after the run in case files
are created during the run. */
dirmtime = ndirmtime;
ExecCmd cmd;
int status = cmd.doexec(cmdpath, args);
return status == 0;
}
return true;
}
#endif
ConfIndexer::ConfIndexer(RclConfig *cnf, DbIxStatusUpdater *updfunc)
: m_config(cnf), m_db(cnf), m_fsindexer(0),
m_doweb(false), m_webindexer(0),

View File

@ -414,47 +414,6 @@ static bool checktopdirs(RclConfig *config, vector<string>& nonexist)
return true;
}
bool runWebFilesMoverScript(RclConfig *config)
{
static string downloadsdir;
if (downloadsdir.empty()) {
if (!config->getConfParam("webdownloadsdir", downloadsdir)) {
downloadsdir = path_tildexpand("~/Downloads");
}
}
static string cmdpath;
if (cmdpath.empty()) {
cmdpath = config->findFilter("recoll-we-move-files.py");
if (cmdpath.empty()) {
LOGERR("runWFMoverScript: recoll-we-move-files.py not found\n");
return false;
}
}
/* Arrange to not actually run the script if the directory did not change */
static time_t dirmtime;
time_t ndirmtime = 0;
struct stat st;
if (::stat(downloadsdir.c_str(), &st) == 0) {
ndirmtime = st.st_mtime;
}
/* If stat fails, presumably Downloads does not exist or is not
accessible, dirmtime and mdirmtime stay at 0, and we never
execute the script, which is the right thing. */
if (dirmtime != ndirmtime) {
/* The script is going to change the directory, so updating
dirmtime before it runs means that we are going to execute
it one time too many (it will run without doing anything),
but we can't set the mtime to after the run in case files
are created during the run. */
dirmtime = ndirmtime;
ExecCmd cmd;
int status = cmd.doexec(cmdpath, {});
return status == 0;
}
return true;
}
string thisprog;

View File

@ -219,10 +219,8 @@ void ConfIndexW::initPanels()
new ConfSubPanelW(m_w, &m_conf, m_rclconf),
tr("Local parameters"));
#ifndef _WIN32
idx = m_w->addPanel("Web history");
setupWebHistoryPanel(idx);
#endif
idx = m_w->addPanel(tr("Search parameters"));
setupSearchPanel(idx);

View File

@ -335,12 +335,8 @@ void RclMain::init()
this, SLOT(showAdvSearchDialog()));
connect(toolsSpellAction, SIGNAL(triggered()),
this, SLOT(showSpellDialog()));
#ifdef _WIN32
actionWebcache_Editor->setEnabled(false);
#else
connect(actionWebcache_Editor, SIGNAL(triggered()),
this, SLOT(showWebcacheDialog()));
#endif
connect(actionQuery_Fragments, SIGNAL(triggered()),
this, SLOT(showFragButs()));
connect(actionSpecial_Indexing, SIGNAL(triggered()),

View File

@ -25,7 +25,7 @@ xallexcepts = \
# Could not get the cmd-based ones to work (tried quoting "start %u" too)
#application/x-all = c:/Windows/System32/cmd /c start %u
#application/x-all = cmd /c start %u
application/x-all = rclstartw %f
application/x-all = rclstartw %u
####### Special ones
# Open the parent epub document for epub parts instead of opening them as