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">
|
||||
Enter search string: <input type="text" name="q" size="40" value="%Q">
|
||||
<input type="submit" value="Search">
|
||||
<input type="reset" value="Clear">
|
||||
|
||||
%C
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#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
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -107,8 +107,10 @@ const string& RecollKioPager::parFormat()
|
||||
|
||||
string RecollKioPager::pageTop()
|
||||
{
|
||||
return "<p align=\"center\">"
|
||||
"<a href=\"recoll:///search.html\">New Search</a>"
|
||||
string pt = "<p align=\"center\"> <a href=\"recoll:///search.html?q=";
|
||||
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
|
||||
// by another kio instance which has no idea of the current page o
|
||||
#if 0 && KDE_IS_VERSION(4,1,0)
|
||||
@ -116,7 +118,6 @@ string RecollKioPager::pageTop()
|
||||
url_encode(string(m_parent->m_query.query.toUtf8())) +
|
||||
"/\">Directory view</a> (you may need to reload the page)"
|
||||
#endif
|
||||
"</p>";
|
||||
}
|
||||
|
||||
string RecollKioPager::nextUrl()
|
||||
@ -178,7 +179,7 @@ void RecollProtocol::searchPage()
|
||||
|
||||
string tmp;
|
||||
map<char, string> subs;
|
||||
subs['Q'] = "";
|
||||
subs['Q'] = (const char *)m_query.query.toUtf8();
|
||||
subs['C'] = catgq;
|
||||
subs['S'] = "";
|
||||
pcSubst(welcomedata, tmp, subs);
|
||||
@ -208,8 +209,8 @@ void RecollProtocol::queryDetails()
|
||||
|
||||
class PlainToRichKio : public PlainToRich {
|
||||
public:
|
||||
PlainToRichKio(const string& nm, bool inputhtml = false)
|
||||
: PlainToRich(inputhtml) , m_name(nm)
|
||||
PlainToRichKio(const string& nm)
|
||||
: PlainToRich() , m_name(nm)
|
||||
{
|
||||
}
|
||||
virtual ~PlainToRichKio() {}
|
||||
@ -268,7 +269,8 @@ void RecollProtocol::showPreview(const Rcl::Doc& doc)
|
||||
mimeType("text/html");
|
||||
|
||||
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;
|
||||
HiliteData hdata;
|
||||
if (!m_source.isNull())
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#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
|
||||
/*
|
||||
* 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")) {
|
||||
m_type = UIMT_ROOTENTRY;
|
||||
m_retType = UIRET_SEARCH;
|
||||
// Retrieve the query value for preloading the form
|
||||
m_query.query = url.queryItem("q");
|
||||
return;
|
||||
} else if (m_parent->isRecollResult(url, &m_resnum, &m_query.query)) {
|
||||
m_type = UIMT_QUERYRESULT;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#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
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -44,6 +44,8 @@ public:
|
||||
void setParent(RecollProtocol *proto) {m_parent = proto;}
|
||||
|
||||
virtual bool append(const string& data);
|
||||
virtual bool append(const string& data, int, const Rcl::Doc&)
|
||||
{return append(data);}
|
||||
virtual string detailsLink();
|
||||
virtual const string &parFormat();
|
||||
virtual string nextUrl();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user