From ccdfe9710657e7aec8fb534eb7bfe2e129587a6d Mon Sep 17 00:00:00 2001 From: dockes Date: Tue, 16 Dec 2008 17:28:10 +0000 Subject: [PATCH] updated kioslave for small changes in reslistpager after main i/f integration. + javascript to search page --- src/kde/kioslave/recoll/data/searchable.html | 42 ++++++++++++++++++++ src/kde/kioslave/recoll/data/welcome.html | 1 + src/kde/kioslave/recoll/htmlif.cpp | 18 +++++---- src/kde/kioslave/recoll/kio_recoll.cpp | 4 +- src/kde/kioslave/recoll/kio_recoll.h | 4 +- 5 files changed, 59 insertions(+), 10 deletions(-) create mode 100644 src/kde/kioslave/recoll/data/searchable.html diff --git a/src/kde/kioslave/recoll/data/searchable.html b/src/kde/kioslave/recoll/data/searchable.html new file mode 100644 index 00000000..0c662839 --- /dev/null +++ b/src/kde/kioslave/recoll/data/searchable.html @@ -0,0 +1,42 @@ + + + Recoll searchable HTML + + + + + + +

A Recoll-searchable HTML page

+ +

This is a text sample in which links have been inserted for + words, such as system installation, + which can be searched for in the whole document set by + using recoll

+ +

Also a little bit of javascript magic can make + all words searchable (try double-clicking any word).

+ + + diff --git a/src/kde/kioslave/recoll/data/welcome.html b/src/kde/kioslave/recoll/data/welcome.html index fcad712a..385e7911 100644 --- a/src/kde/kioslave/recoll/data/welcome.html +++ b/src/kde/kioslave/recoll/data/welcome.html @@ -18,6 +18,7 @@ Enter search string: + %C diff --git a/src/kde/kioslave/recoll/htmlif.cpp b/src/kde/kioslave/recoll/htmlif.cpp index 478c54a7..930f89ef 100644 --- a/src/kde/kioslave/recoll/htmlif.cpp +++ b/src/kde/kioslave/recoll/htmlif.cpp @@ -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 "

" - "New Search" + string pt = "

m_query.query.toUtf8())); + pt += "\">New Search"; + 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 (you may need to reload the page)" #endif - "

"; } string RecollKioPager::nextUrl() @@ -178,7 +179,7 @@ void RecollProtocol::searchPage() string tmp; map 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 otextlist; HiliteData hdata; if (!m_source.isNull()) diff --git a/src/kde/kioslave/recoll/kio_recoll.cpp b/src/kde/kioslave/recoll/kio_recoll.cpp index ee735fd2..9c42f94f 100644 --- a/src/kde/kioslave/recoll/kio_recoll.cpp +++ b/src/kde/kioslave/recoll/kio_recoll.cpp @@ -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; diff --git a/src/kde/kioslave/recoll/kio_recoll.h b/src/kde/kioslave/recoll/kio_recoll.h index 73f1f210..2b40d3e0 100644 --- a/src/kde/kioslave/recoll/kio_recoll.h +++ b/src/kde/kioslave/recoll/kio_recoll.h @@ -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();