updated kioslave for small changes in reslistpager after main i/f integration. + javascript to search page
This commit is contained in:
parent
42a745f384
commit
ccdfe97106
42
src/kde/kioslave/recoll/data/searchable.html
Normal file
42
src/kde/kioslave/recoll/data/searchable.html
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Recoll searchable HTML</title>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body ondblclick="dictionary()">
|
||||||
|
|
||||||
|
<script language="JavaScript">
|
||||||
|
function dictionary() {
|
||||||
|
if (navigator.appName != 'Microsoft Internet Explorer') {
|
||||||
|
var t = document.getSelection();
|
||||||
|
recoll(t);
|
||||||
|
} else {
|
||||||
|
var t = document.selection.createRange();
|
||||||
|
if (document.selection.type == 'Text' && t.text > '') {
|
||||||
|
document.selection.empty();
|
||||||
|
recoll(t.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function recoll(t) {
|
||||||
|
if (t) {
|
||||||
|
window.location.href =
|
||||||
|
'recoll://search/query?qtp=a&p=0&q=' +
|
||||||
|
encodeURIComponent(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h2>A <b>Recoll</b>-searchable HTML page </h2>
|
||||||
|
|
||||||
|
<p>This is a text sample in which links have been inserted for
|
||||||
|
words, such as <a href="recoll:/system installation">system installation</a>,
|
||||||
|
which can be searched for in the whole document set by
|
||||||
|
using <a href="recoll:/recoll">recoll</a></p>
|
||||||
|
|
||||||
|
<p>Also a little bit of javascript magic can make
|
||||||
|
all words searchable (try double-clicking any word).</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -18,6 +18,7 @@
|
|||||||
<input type="hidden" name="p" value="0">
|
<input type="hidden" name="p" value="0">
|
||||||
Enter search string: <input type="text" name="q" size="40" value="%Q">
|
Enter search string: <input type="text" name="q" size="40" value="%Q">
|
||||||
<input type="submit" value="Search">
|
<input type="submit" value="Search">
|
||||||
|
<input type="reset" value="Clear">
|
||||||
|
|
||||||
%C
|
%C
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: htmlif.cpp,v 1.10 2008-12-15 15:04:53 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: htmlif.cpp,v 1.11 2008-12-16 17:28:10 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -107,8 +107,10 @@ const string& RecollKioPager::parFormat()
|
|||||||
|
|
||||||
string RecollKioPager::pageTop()
|
string RecollKioPager::pageTop()
|
||||||
{
|
{
|
||||||
return "<p align=\"center\">"
|
string pt = "<p align=\"center\"> <a href=\"recoll:///search.html?q=";
|
||||||
"<a href=\"recoll:///search.html\">New Search</a>"
|
pt += url_encode(string(m_parent->m_query.query.toUtf8()));
|
||||||
|
pt += "\">New Search</a>";
|
||||||
|
return pt;
|
||||||
// Would be nice to have but doesnt work because the query may be executed
|
// Would be nice to have but doesnt work because the query may be executed
|
||||||
// by another kio instance which has no idea of the current page o
|
// by another kio instance which has no idea of the current page o
|
||||||
#if 0 && KDE_IS_VERSION(4,1,0)
|
#if 0 && KDE_IS_VERSION(4,1,0)
|
||||||
@ -116,7 +118,6 @@ string RecollKioPager::pageTop()
|
|||||||
url_encode(string(m_parent->m_query.query.toUtf8())) +
|
url_encode(string(m_parent->m_query.query.toUtf8())) +
|
||||||
"/\">Directory view</a> (you may need to reload the page)"
|
"/\">Directory view</a> (you may need to reload the page)"
|
||||||
#endif
|
#endif
|
||||||
"</p>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string RecollKioPager::nextUrl()
|
string RecollKioPager::nextUrl()
|
||||||
@ -178,7 +179,7 @@ void RecollProtocol::searchPage()
|
|||||||
|
|
||||||
string tmp;
|
string tmp;
|
||||||
map<char, string> subs;
|
map<char, string> subs;
|
||||||
subs['Q'] = "";
|
subs['Q'] = (const char *)m_query.query.toUtf8();
|
||||||
subs['C'] = catgq;
|
subs['C'] = catgq;
|
||||||
subs['S'] = "";
|
subs['S'] = "";
|
||||||
pcSubst(welcomedata, tmp, subs);
|
pcSubst(welcomedata, tmp, subs);
|
||||||
@ -208,8 +209,8 @@ void RecollProtocol::queryDetails()
|
|||||||
|
|
||||||
class PlainToRichKio : public PlainToRich {
|
class PlainToRichKio : public PlainToRich {
|
||||||
public:
|
public:
|
||||||
PlainToRichKio(const string& nm, bool inputhtml = false)
|
PlainToRichKio(const string& nm)
|
||||||
: PlainToRich(inputhtml) , m_name(nm)
|
: PlainToRich() , m_name(nm)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~PlainToRichKio() {}
|
virtual ~PlainToRichKio() {}
|
||||||
@ -268,7 +269,8 @@ void RecollProtocol::showPreview(const Rcl::Doc& doc)
|
|||||||
mimeType("text/html");
|
mimeType("text/html");
|
||||||
|
|
||||||
string fname = path_getsimple(doc.url).c_str();
|
string fname = path_getsimple(doc.url).c_str();
|
||||||
PlainToRichKio ptr(fname, !fdoc.mimetype.compare("text/html"));
|
PlainToRichKio ptr(fname);
|
||||||
|
ptr.set_inputhtml(!fdoc.mimetype.compare("text/html"));
|
||||||
list<string> otextlist;
|
list<string> otextlist;
|
||||||
HiliteData hdata;
|
HiliteData hdata;
|
||||||
if (!m_source.isNull())
|
if (!m_source.isNull())
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.24 2008-12-08 14:34:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.25 2008-12-16 17:28:10 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -151,6 +151,8 @@ UrlIngester::UrlIngester(RecollProtocol *p, const KUrl& url)
|
|||||||
} else if (!path.compare("/search.html")) {
|
} else if (!path.compare("/search.html")) {
|
||||||
m_type = UIMT_ROOTENTRY;
|
m_type = UIMT_ROOTENTRY;
|
||||||
m_retType = UIRET_SEARCH;
|
m_retType = UIRET_SEARCH;
|
||||||
|
// Retrieve the query value for preloading the form
|
||||||
|
m_query.query = url.queryItem("q");
|
||||||
return;
|
return;
|
||||||
} else if (m_parent->isRecollResult(url, &m_resnum, &m_query.query)) {
|
} else if (m_parent->isRecollResult(url, &m_resnum, &m_query.query)) {
|
||||||
m_type = UIMT_QUERYRESULT;
|
m_type = UIMT_QUERYRESULT;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef _RECOLL_H
|
#ifndef _RECOLL_H
|
||||||
/* @(#$Id: kio_recoll.h,v 1.14 2008-12-08 14:34:50 dockes Exp $ (C) 2005 J.F.Dockes */
|
/* @(#$Id: kio_recoll.h,v 1.15 2008-12-16 17:28:10 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||||
#define _RECOLL_H
|
#define _RECOLL_H
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -44,6 +44,8 @@ public:
|
|||||||
void setParent(RecollProtocol *proto) {m_parent = proto;}
|
void setParent(RecollProtocol *proto) {m_parent = proto;}
|
||||||
|
|
||||||
virtual bool append(const string& data);
|
virtual bool append(const string& data);
|
||||||
|
virtual bool append(const string& data, int, const Rcl::Doc&)
|
||||||
|
{return append(data);}
|
||||||
virtual string detailsLink();
|
virtual string detailsLink();
|
||||||
virtual const string &parFormat();
|
virtual const string &parFormat();
|
||||||
virtual string nextUrl();
|
virtual string nextUrl();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user