cleared out errant tabs
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<li><b>Html interface</b>, close to a simplified QT Recoll
|
||||
interface.</li>
|
||||
<li><b>File manager interface</b>, <em>Only with KDE 4.1 and
|
||||
newer</em>, which presents results as directory entries</li>
|
||||
newer</em>, which presents results as directory entries</li>
|
||||
</ul>
|
||||
|
||||
<p>The module is still in its infancy. You will undoubtedly obtain
|
||||
@@ -67,8 +67,8 @@
|
||||
|
||||
<li>Using an URL ending with a '/', ie:
|
||||
<blockquote>
|
||||
<a href="recoll:/red apples ext:html/">
|
||||
recoll:/red apples ext:html/</a>
|
||||
<a href="recoll:/red apples ext:html/">
|
||||
recoll:/red apples ext:html/</a>
|
||||
</blockquote>
|
||||
</li>
|
||||
<li>Users who will want to use the file manager view most of the
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<input type="submit" value="Search">
|
||||
|
||||
<!-- This resets to the preset value. We'd like a real clear
|
||||
<input type="reset" value="Clear"> -->
|
||||
<input type="reset" value="Clear"> -->
|
||||
|
||||
</form>
|
||||
</p>
|
||||
|
||||
@@ -49,7 +49,7 @@ using namespace KIO;
|
||||
bool RecollKioPager::append(const string& data)
|
||||
{
|
||||
if (!m_parent)
|
||||
return false;
|
||||
return false;
|
||||
m_parent->data(QByteArray(data.c_str()));
|
||||
return true;
|
||||
}
|
||||
@@ -58,20 +58,20 @@ string RecollProtocol::makeQueryUrl(int page, bool isdet)
|
||||
{
|
||||
ostringstream str;
|
||||
str << "recoll://search/query?q=" <<
|
||||
url_encode((const char*)m_query.query.toUtf8()) <<
|
||||
"&qtp=" << (const char*)m_query.opt.toUtf8();
|
||||
url_encode((const char*)m_query.query.toUtf8()) <<
|
||||
"&qtp=" << (const char*)m_query.opt.toUtf8();
|
||||
if (page >= 0)
|
||||
str << "&p=" << page;
|
||||
str << "&p=" << page;
|
||||
if (isdet)
|
||||
str << "&det=1";
|
||||
str << "&det=1";
|
||||
return str.str();
|
||||
}
|
||||
|
||||
string RecollKioPager::detailsLink()
|
||||
{
|
||||
string chunk = string("<a href=\"") +
|
||||
m_parent->makeQueryUrl(m_parent->m_pager.pageNumber(), true) + "\">"
|
||||
+ "(show query)" + "</a>";
|
||||
m_parent->makeQueryUrl(m_parent->m_pager.pageNumber(), true) + "\">"
|
||||
+ "(show query)" + "</a>";
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@@ -81,24 +81,24 @@ const string& RecollKioPager::parFormat()
|
||||
// Need to escape the % inside the query url
|
||||
string qurl = m_parent->makeQueryUrl(-1, false), escurl;
|
||||
for (string::size_type pos = 0; pos < qurl.length(); pos++) {
|
||||
switch(qurl.at(pos)) {
|
||||
case '%':
|
||||
escurl += "%%";
|
||||
break;
|
||||
default:
|
||||
escurl += qurl.at(pos);
|
||||
}
|
||||
switch(qurl.at(pos)) {
|
||||
case '%':
|
||||
escurl += "%%";
|
||||
break;
|
||||
default:
|
||||
escurl += qurl.at(pos);
|
||||
}
|
||||
}
|
||||
|
||||
ostringstream str;
|
||||
str <<
|
||||
"<a href=\"%U\"><img src=\"%I\" align=\"left\"></a>"
|
||||
"%R %S "
|
||||
"<a href=\"" << escurl << "&cmd=pv&dn=%N\">Preview</a> " <<
|
||||
"<a href=\"%U\">Open</a> " <<
|
||||
"<b>%T</b><br>"
|
||||
"%M %D <i>%U</i> %i<br>"
|
||||
"%A %K";
|
||||
"<a href=\"%U\"><img src=\"%I\" align=\"left\"></a>"
|
||||
"%R %S "
|
||||
"<a href=\"" << escurl << "&cmd=pv&dn=%N\">Preview</a> " <<
|
||||
"<a href=\"%U\">Open</a> " <<
|
||||
"<b>%T</b><br>"
|
||||
"%M %D <i>%U</i> %i<br>"
|
||||
"%A %K";
|
||||
return parformat = str.str();
|
||||
}
|
||||
|
||||
@@ -111,9 +111,9 @@ string RecollKioPager::pageTop()
|
||||
// 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)
|
||||
" <a href=\"recoll:///" +
|
||||
url_encode(string(m_parent->m_query.query.toUtf8())) +
|
||||
"/\">Directory view</a> (you may need to reload the page)"
|
||||
" <a href=\"recoll:///" +
|
||||
url_encode(string(m_parent->m_query.query.toUtf8())) +
|
||||
"/\">Directory view</a> (you may need to reload the page)"
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -121,9 +121,9 @@ string RecollKioPager::nextUrl()
|
||||
{
|
||||
int pagenum = pageNumber();
|
||||
if (pagenum < 0)
|
||||
pagenum = 0;
|
||||
pagenum = 0;
|
||||
else
|
||||
pagenum++;
|
||||
pagenum++;
|
||||
return m_parent->makeQueryUrl(pagenum);
|
||||
}
|
||||
|
||||
@@ -131,9 +131,9 @@ string RecollKioPager::prevUrl()
|
||||
{
|
||||
int pagenum = pageNumber();
|
||||
if (pagenum <= 0)
|
||||
pagenum = 0;
|
||||
pagenum = 0;
|
||||
else
|
||||
pagenum--;
|
||||
pagenum--;
|
||||
return m_parent->makeQueryUrl(pagenum);
|
||||
}
|
||||
|
||||
@@ -143,17 +143,17 @@ void RecollProtocol::searchPage()
|
||||
{
|
||||
mimeType("text/html");
|
||||
if (welcomedata.empty()) {
|
||||
QString location =
|
||||
KStandardDirs::locate("data", "kio_recoll/welcome.html");
|
||||
string reason;
|
||||
if (location.isEmpty() ||
|
||||
!file_to_string((const char *)location.toUtf8(),
|
||||
welcomedata, &reason)) {
|
||||
welcomedata = "<html><head><title>Recoll Error</title></head>"
|
||||
"<body><p>Could not locate Recoll welcome.html file: ";
|
||||
welcomedata += reason;
|
||||
welcomedata += "</p></body></html>";
|
||||
}
|
||||
QString location =
|
||||
KStandardDirs::locate("data", "kio_recoll/welcome.html");
|
||||
string reason;
|
||||
if (location.isEmpty() ||
|
||||
!file_to_string((const char *)location.toUtf8(),
|
||||
welcomedata, &reason)) {
|
||||
welcomedata = "<html><head><title>Recoll Error</title></head>"
|
||||
"<body><p>Could not locate Recoll welcome.html file: ";
|
||||
welcomedata += reason;
|
||||
welcomedata += "</p></body></html>";
|
||||
}
|
||||
}
|
||||
|
||||
string catgq;
|
||||
@@ -164,12 +164,12 @@ void RecollProtocol::searchPage()
|
||||
// language, but not too useful in this case, so scrap it for now.
|
||||
list<string> cats;
|
||||
if (o_rclconfig->getMimeCategories(cats) && !cats.empty()) {
|
||||
catgq = "<p>Filter on types: "
|
||||
"<input type=\"radio\" name=\"ct\" value=\"All\" checked>All";
|
||||
for (list<string>::iterator it = cats.begin(); it != cats.end();it++) {
|
||||
catgq += "\n<input type=\"radio\" name=\"ct\" value=\"" +
|
||||
*it + "\">" + *it ;
|
||||
}
|
||||
catgq = "<p>Filter on types: "
|
||||
"<input type=\"radio\" name=\"ct\" value=\"All\" checked>All";
|
||||
for (list<string>::iterator it = cats.begin(); it != cats.end();it++) {
|
||||
catgq += "\n<input type=\"radio\" name=\"ct\" value=\"" +
|
||||
*it + "\">" + *it ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -190,13 +190,13 @@ void RecollProtocol::queryDetails()
|
||||
|
||||
os << "<html><head>" << endl;
|
||||
os << "<meta http-equiv=\"Content-Type\" content=\"text/html;"
|
||||
"charset=utf-8\">" << endl;
|
||||
"charset=utf-8\">" << endl;
|
||||
os << "<title>" << "Recoll query details" << "</title>\n" << endl;
|
||||
os << "</head>" << endl;
|
||||
os << "<body><h3>Query details:</h3>" << endl;
|
||||
os << "<p>" << m_pager.queryDescription().c_str() <<"</p>"<< endl;
|
||||
os << "<p><a href=\"" << makeQueryUrl(m_pager.pageNumber()).c_str() <<
|
||||
"\">Return to results</a>" << endl;
|
||||
"\">Return to results</a>" << endl;
|
||||
os << "</body></html>" << endl;
|
||||
data(array);
|
||||
}
|
||||
@@ -209,25 +209,25 @@ public:
|
||||
}
|
||||
|
||||
virtual string header() {
|
||||
if (m_inputhtml) {
|
||||
return cstr_null;
|
||||
} else {
|
||||
return string("<html><head>"
|
||||
"<META http-equiv=\"Content-Type\""
|
||||
"content=\"text/html;charset=UTF-8\"><title>").
|
||||
append(m_name).
|
||||
append("</title></head><body><pre>");
|
||||
}
|
||||
if (m_inputhtml) {
|
||||
return cstr_null;
|
||||
} else {
|
||||
return string("<html><head>"
|
||||
"<META http-equiv=\"Content-Type\""
|
||||
"content=\"text/html;charset=UTF-8\"><title>").
|
||||
append(m_name).
|
||||
append("</title></head><body><pre>");
|
||||
}
|
||||
}
|
||||
|
||||
virtual string startMatch(unsigned int)
|
||||
{
|
||||
return string("<font color=\"blue\">");
|
||||
return string("<font color=\"blue\">");
|
||||
}
|
||||
|
||||
virtual string endMatch()
|
||||
{
|
||||
return string("</font>");
|
||||
return string("</font>");
|
||||
}
|
||||
|
||||
const string &m_name;
|
||||
@@ -239,12 +239,12 @@ void RecollProtocol::showPreview(const Rcl::Doc& idoc)
|
||||
Rcl::Doc fdoc;
|
||||
string ipath = idoc.ipath;
|
||||
if (!interner.internfile(fdoc, ipath)) {
|
||||
error(KIO::ERR_SLAVE_DEFINED, "Cannot convert file to internal format");
|
||||
return;
|
||||
error(KIO::ERR_SLAVE_DEFINED, "Cannot convert file to internal format");
|
||||
return;
|
||||
}
|
||||
if (!interner.get_html().empty()) {
|
||||
fdoc.text = interner.get_html();
|
||||
fdoc.mimetype = "text/html";
|
||||
fdoc.text = interner.get_html();
|
||||
fdoc.mimetype = "text/html";
|
||||
}
|
||||
|
||||
mimeType("text/html");
|
||||
@@ -255,14 +255,14 @@ void RecollProtocol::showPreview(const Rcl::Doc& idoc)
|
||||
list<string> otextlist;
|
||||
HighlightData hdata;
|
||||
if (m_source)
|
||||
m_source->getTerms(hdata);
|
||||
m_source->getTerms(hdata);
|
||||
ptr.plaintorich(fdoc.text, otextlist, hdata);
|
||||
|
||||
QByteArray array;
|
||||
QTextStream os(&array, QIODevice::WriteOnly);
|
||||
for (list<string>::iterator it = otextlist.begin();
|
||||
it != otextlist.end(); it++) {
|
||||
os << (*it).c_str();
|
||||
it != otextlist.end(); it++) {
|
||||
os << (*it).c_str();
|
||||
}
|
||||
os << "</body></html>" << endl;
|
||||
data(array);
|
||||
@@ -271,30 +271,30 @@ void RecollProtocol::showPreview(const Rcl::Doc& idoc)
|
||||
void RecollProtocol::htmlDoSearch(const QueryDesc& qd)
|
||||
{
|
||||
kDebug() << "q" << qd.query << "option" << qd.opt << "page" << qd.page <<
|
||||
"isdet" << qd.isDetReq << endl;
|
||||
"isdet" << qd.isDetReq << endl;
|
||||
|
||||
mimeType("text/html");
|
||||
|
||||
if (!syncSearch(qd))
|
||||
return;
|
||||
return;
|
||||
// syncSearch/doSearch do the setDocSource when needed
|
||||
if (m_pager.pageNumber() < 0) {
|
||||
m_pager.resultPageNext();
|
||||
m_pager.resultPageNext();
|
||||
}
|
||||
if (qd.isDetReq) {
|
||||
queryDetails();
|
||||
return;
|
||||
queryDetails();
|
||||
return;
|
||||
}
|
||||
|
||||
// Check / adjust page number
|
||||
if (qd.page > m_pager.pageNumber()) {
|
||||
int npages = qd.page - m_pager.pageNumber();
|
||||
for (int i = 0; i < npages; i++)
|
||||
m_pager.resultPageNext();
|
||||
int npages = qd.page - m_pager.pageNumber();
|
||||
for (int i = 0; i < npages; i++)
|
||||
m_pager.resultPageNext();
|
||||
} else if (qd.page < m_pager.pageNumber()) {
|
||||
int npages = m_pager.pageNumber() - qd.page;
|
||||
for (int i = 0; i < npages; i++)
|
||||
m_pager.resultPageBack();
|
||||
int npages = m_pager.pageNumber() - qd.page;
|
||||
for (int i = 0; i < npages; i++)
|
||||
m_pager.resultPageBack();
|
||||
}
|
||||
// Display
|
||||
m_pager.displayPage(o_rclconfig);
|
||||
|
||||
@@ -55,25 +55,25 @@ RecollProtocol::RecollProtocol(const QByteArray &pool, const QByteArray &app)
|
||||
{
|
||||
kDebug() << endl;
|
||||
if (o_rclconfig == 0) {
|
||||
o_rclconfig = recollinit(0, 0, 0, m_reason);
|
||||
if (!o_rclconfig || !o_rclconfig->ok()) {
|
||||
m_reason = string("Configuration problem: ") + m_reason;
|
||||
return;
|
||||
}
|
||||
o_rclconfig = recollinit(0, 0, 0, m_reason);
|
||||
if (!o_rclconfig || !o_rclconfig->ok()) {
|
||||
m_reason = string("Configuration problem: ") + m_reason;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (o_rclconfig->getDbDir().empty()) {
|
||||
// Note: this will have to be replaced by a call to a
|
||||
// configuration building dialog for initial configuration? Or
|
||||
// do we assume that the QT GUO is always used for this ?
|
||||
m_reason = "No db directory in configuration ??";
|
||||
return;
|
||||
// Note: this will have to be replaced by a call to a
|
||||
// configuration building dialog for initial configuration? Or
|
||||
// do we assume that the QT GUO is always used for this ?
|
||||
m_reason = "No db directory in configuration ??";
|
||||
return;
|
||||
}
|
||||
rwSettings(false);
|
||||
|
||||
m_rcldb = std::shared_ptr<Rcl::Db>(new Rcl::Db(o_rclconfig));
|
||||
if (!m_rcldb) {
|
||||
m_reason = "Could not build database object. (out of memory ?)";
|
||||
return;
|
||||
m_reason = "Could not build database object. (out of memory ?)";
|
||||
return;
|
||||
}
|
||||
|
||||
// Decide if we allow switching between html and file manager
|
||||
@@ -81,9 +81,9 @@ RecollProtocol::RecollProtocol(const QByteArray &pool, const QByteArray &app)
|
||||
// by switching proto names.
|
||||
const char *cp = getenv("RECOLL_KIO_ALWAYS_DIR");
|
||||
if (cp) {
|
||||
m_alwaysdir = stringToBool(cp);
|
||||
m_alwaysdir = stringToBool(cp);
|
||||
} else {
|
||||
o_rclconfig->getConfParam("kio_always_dir", &m_alwaysdir);
|
||||
o_rclconfig->getConfParam("kio_always_dir", &m_alwaysdir);
|
||||
}
|
||||
|
||||
cp = getenv("RECOLL_KIO_STEMLANG");
|
||||
@@ -107,12 +107,12 @@ RecollProtocol::~RecollProtocol()
|
||||
bool RecollProtocol::maybeOpenDb(string &reason)
|
||||
{
|
||||
if (!m_rcldb) {
|
||||
reason = "Internal error: initialization error";
|
||||
return false;
|
||||
reason = "Internal error: initialization error";
|
||||
return false;
|
||||
}
|
||||
if (!m_rcldb->isopen() && !m_rcldb->open(Rcl::Db::DbRO)) {
|
||||
reason = "Could not open database in " + o_rclconfig->getDbDir();
|
||||
return false;
|
||||
reason = "Could not open database in " + o_rclconfig->getDbDir();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -133,75 +133,75 @@ UrlIngester::UrlIngester(RecollProtocol *p, const KUrl& url)
|
||||
m_alwaysdir = !url.protocol().compare("recollf");
|
||||
QString path = url.path();
|
||||
if (url.host().isEmpty()) {
|
||||
if (path.isEmpty() || !path.compare("/")) {
|
||||
m_type = UIMT_ROOTENTRY;
|
||||
m_retType = UIRET_ROOT;
|
||||
return;
|
||||
} else if (!path.compare("/help.html")) {
|
||||
m_type = UIMT_ROOTENTRY;
|
||||
m_retType = UIRET_HELP;
|
||||
return;
|
||||
} 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;
|
||||
m_query.opt = "l";
|
||||
m_query.page = 0;
|
||||
} else {
|
||||
// Have to think this is some search string
|
||||
m_type = UIMT_QUERY;
|
||||
m_query.query = url.path();
|
||||
m_query.opt = "l";
|
||||
m_query.page = 0;
|
||||
}
|
||||
if (path.isEmpty() || !path.compare("/")) {
|
||||
m_type = UIMT_ROOTENTRY;
|
||||
m_retType = UIRET_ROOT;
|
||||
return;
|
||||
} else if (!path.compare("/help.html")) {
|
||||
m_type = UIMT_ROOTENTRY;
|
||||
m_retType = UIRET_HELP;
|
||||
return;
|
||||
} 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;
|
||||
m_query.opt = "l";
|
||||
m_query.page = 0;
|
||||
} else {
|
||||
// Non empty host, url must be something like :
|
||||
// //search/query?q=query¶m=value...
|
||||
kDebug() << "host" << url.host() << "path" << url.path();
|
||||
if (url.host().compare("search") || url.path().compare("/query")) {
|
||||
return;
|
||||
}
|
||||
m_type = UIMT_QUERY;
|
||||
// Decode the forms' arguments
|
||||
m_query.query = url.queryItem("q");
|
||||
// Have to think this is some search string
|
||||
m_type = UIMT_QUERY;
|
||||
m_query.query = url.path();
|
||||
m_query.opt = "l";
|
||||
m_query.page = 0;
|
||||
}
|
||||
} else {
|
||||
// Non empty host, url must be something like :
|
||||
// //search/query?q=query¶m=value...
|
||||
kDebug() << "host" << url.host() << "path" << url.path();
|
||||
if (url.host().compare("search") || url.path().compare("/query")) {
|
||||
return;
|
||||
}
|
||||
m_type = UIMT_QUERY;
|
||||
// Decode the forms' arguments
|
||||
m_query.query = url.queryItem("q");
|
||||
|
||||
m_query.opt = url.queryItem("qtp");
|
||||
if (m_query.opt.isEmpty()) {
|
||||
m_query.opt = "l";
|
||||
}
|
||||
QString p = url.queryItem("p");
|
||||
if (p.isEmpty()) {
|
||||
m_query.page = 0;
|
||||
} else {
|
||||
sscanf(p.toAscii(), "%d", &m_query.page);
|
||||
}
|
||||
p = url.queryItem("det");
|
||||
m_query.isDetReq = !p.isEmpty();
|
||||
|
||||
p = url.queryItem("cmd");
|
||||
if (!p.isEmpty() && !p.compare("pv")) {
|
||||
p = url.queryItem("dn");
|
||||
if (!p.isEmpty()) {
|
||||
// Preview and no docnum ??
|
||||
m_resnum = atoi((const char *)p.toUtf8());
|
||||
// Result in page is 1+
|
||||
m_resnum--;
|
||||
m_type = UIMT_PREVIEW;
|
||||
}
|
||||
}
|
||||
m_query.opt = url.queryItem("qtp");
|
||||
if (m_query.opt.isEmpty()) {
|
||||
m_query.opt = "l";
|
||||
}
|
||||
QString p = url.queryItem("p");
|
||||
if (p.isEmpty()) {
|
||||
m_query.page = 0;
|
||||
} else {
|
||||
sscanf(p.toAscii(), "%d", &m_query.page);
|
||||
}
|
||||
p = url.queryItem("det");
|
||||
m_query.isDetReq = !p.isEmpty();
|
||||
|
||||
p = url.queryItem("cmd");
|
||||
if (!p.isEmpty() && !p.compare("pv")) {
|
||||
p = url.queryItem("dn");
|
||||
if (!p.isEmpty()) {
|
||||
// Preview and no docnum ??
|
||||
m_resnum = atoi((const char *)p.toUtf8());
|
||||
// Result in page is 1+
|
||||
m_resnum--;
|
||||
m_type = UIMT_PREVIEW;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_query.query.startsWith("/"))
|
||||
m_query.query.remove(0,1);
|
||||
m_query.query.remove(0,1);
|
||||
if (m_query.query.endsWith("/")) {
|
||||
kDebug() << "Ends with /";
|
||||
m_slashend = true;
|
||||
m_query.query.chop(1);
|
||||
kDebug() << "Ends with /";
|
||||
m_slashend = true;
|
||||
m_query.query.chop(1);
|
||||
} else {
|
||||
m_slashend = false;
|
||||
m_slashend = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -210,12 +210,12 @@ bool RecollProtocol::syncSearch(const QueryDesc &qd)
|
||||
{
|
||||
kDebug();
|
||||
if (!m_initok || !maybeOpenDb(m_reason)) {
|
||||
string reason = "RecollProtocol::listDir: Init error:" + m_reason;
|
||||
error(KIO::ERR_SLAVE_DEFINED, reason.c_str());
|
||||
return false;
|
||||
string reason = "RecollProtocol::listDir: Init error:" + m_reason;
|
||||
error(KIO::ERR_SLAVE_DEFINED, reason.c_str());
|
||||
return false;
|
||||
}
|
||||
if (qd.sameQuery(m_query)) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
// doSearch() calls error() if appropriate.
|
||||
return doSearch(qd);
|
||||
@@ -229,9 +229,9 @@ void RecollProtocol::get(const KUrl& url)
|
||||
kDebug() << url << endl;
|
||||
|
||||
if (!m_initok || !maybeOpenDb(m_reason)) {
|
||||
string reason = "Recoll: init error: " + m_reason;
|
||||
error(KIO::ERR_SLAVE_DEFINED, reason.c_str());
|
||||
return;
|
||||
string reason = "Recoll: init error: " + m_reason;
|
||||
error(KIO::ERR_SLAVE_DEFINED, reason.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
UrlIngester ingest(this, url);
|
||||
@@ -239,61 +239,61 @@ void RecollProtocol::get(const KUrl& url)
|
||||
QueryDesc qd;
|
||||
int resnum;
|
||||
if (ingest.isRootEntry(&rettp)) {
|
||||
switch(rettp) {
|
||||
case UrlIngester::UIRET_HELP:
|
||||
{
|
||||
QString location =
|
||||
KStandardDirs::locate("data", "kio_recoll/help.html");
|
||||
redirection(location);
|
||||
}
|
||||
goto out;
|
||||
default:
|
||||
searchPage();
|
||||
goto out;
|
||||
}
|
||||
switch(rettp) {
|
||||
case UrlIngester::UIRET_HELP:
|
||||
{
|
||||
QString location =
|
||||
KStandardDirs::locate("data", "kio_recoll/help.html");
|
||||
redirection(location);
|
||||
}
|
||||
goto out;
|
||||
default:
|
||||
searchPage();
|
||||
goto out;
|
||||
}
|
||||
} else if (ingest.isResult(&qd, &resnum)) {
|
||||
// Url matched one generated by konqueror/Dolphin out of a
|
||||
// search directory listing: ie:
|
||||
// Url matched one generated by konqueror/Dolphin out of a
|
||||
// search directory listing: ie:
|
||||
// recoll:/some search string/recollResultxx
|
||||
//
|
||||
// This happens when the user drags/drop the result to another
|
||||
// app, or with the "open-with" right-click. Does not happen
|
||||
// if the entry itself is clicked (the UDS_URL is apparently
|
||||
// used in this case
|
||||
//
|
||||
// Redirect to the result document URL
|
||||
if (!syncSearch(qd)) {
|
||||
return;
|
||||
}
|
||||
Rcl::Doc doc;
|
||||
if (resnum >= 0 && m_source && m_source->getDoc(resnum, doc)) {
|
||||
mimeType(doc.mimetype.c_str());
|
||||
redirection(KUrl::fromLocalFile((const char *)(doc.url.c_str()+7)));
|
||||
goto out;
|
||||
}
|
||||
//
|
||||
// This happens when the user drags/drop the result to another
|
||||
// app, or with the "open-with" right-click. Does not happen
|
||||
// if the entry itself is clicked (the UDS_URL is apparently
|
||||
// used in this case
|
||||
//
|
||||
// Redirect to the result document URL
|
||||
if (!syncSearch(qd)) {
|
||||
return;
|
||||
}
|
||||
Rcl::Doc doc;
|
||||
if (resnum >= 0 && m_source && m_source->getDoc(resnum, doc)) {
|
||||
mimeType(doc.mimetype.c_str());
|
||||
redirection(KUrl::fromLocalFile((const char *)(doc.url.c_str()+7)));
|
||||
goto out;
|
||||
}
|
||||
} else if (ingest.isPreview(&qd, &resnum)) {
|
||||
if (!syncSearch(qd)) {
|
||||
return;
|
||||
}
|
||||
Rcl::Doc doc;
|
||||
if (resnum >= 0 && m_source && m_source->getDoc(resnum, doc)) {
|
||||
showPreview(doc);
|
||||
goto out;
|
||||
}
|
||||
if (!syncSearch(qd)) {
|
||||
return;
|
||||
}
|
||||
Rcl::Doc doc;
|
||||
if (resnum >= 0 && m_source && m_source->getDoc(resnum, doc)) {
|
||||
showPreview(doc);
|
||||
goto out;
|
||||
}
|
||||
} else if (ingest.isQuery(&qd)) {
|
||||
#if 0
|
||||
// Do we need this ?
|
||||
if (host.isEmpty()) {
|
||||
char cpage[20];sprintf(cpage, "%d", page);
|
||||
QString nurl = QString::fromAscii("recoll://search/query?q=") +
|
||||
query + "&qtp=" + opt + "&p=" + cpage;
|
||||
redirection(KUrl(nurl));
|
||||
goto out;
|
||||
}
|
||||
if (host.isEmpty()) {
|
||||
char cpage[20];sprintf(cpage, "%d", page);
|
||||
QString nurl = QString::fromAscii("recoll://search/query?q=") +
|
||||
query + "&qtp=" + opt + "&p=" + cpage;
|
||||
redirection(KUrl(nurl));
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
// htmlDoSearch does the search syncing (needs to know about changes).
|
||||
htmlDoSearch(qd);
|
||||
goto out;
|
||||
// htmlDoSearch does the search syncing (needs to know about changes).
|
||||
htmlDoSearch(qd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
error(KIO::ERR_SLAVE_DEFINED, "Unrecognized URL or internal error");
|
||||
@@ -311,40 +311,40 @@ bool RecollProtocol::doSearch(const QueryDesc& qd)
|
||||
string qs = (const char *)qd.query.toUtf8();
|
||||
Rcl::SearchData *sd = 0;
|
||||
if (opt != 'l') {
|
||||
Rcl::SearchDataClause *clp = 0;
|
||||
if (opt == 'f') {
|
||||
clp = new Rcl::SearchDataClauseFilename(qs);
|
||||
} else {
|
||||
Rcl::SearchDataClause *clp = 0;
|
||||
if (opt == 'f') {
|
||||
clp = new Rcl::SearchDataClauseFilename(qs);
|
||||
} else {
|
||||
clp = new Rcl::SearchDataClauseSimple(opt == 'o' ? Rcl::SCLT_OR :
|
||||
Rcl::SCLT_AND, qs);
|
||||
}
|
||||
sd = new Rcl::SearchData(Rcl::SCLT_OR, m_stemlang);
|
||||
if (sd && clp)
|
||||
sd->addClause(clp);
|
||||
}
|
||||
sd = new Rcl::SearchData(Rcl::SCLT_OR, m_stemlang);
|
||||
if (sd && clp)
|
||||
sd->addClause(clp);
|
||||
} else {
|
||||
sd = wasaStringToRcl(o_rclconfig, m_stemlang, qs, m_reason);
|
||||
sd = wasaStringToRcl(o_rclconfig, m_stemlang, qs, m_reason);
|
||||
}
|
||||
if (!sd) {
|
||||
m_reason = "Internal Error: cant build search";
|
||||
error(KIO::ERR_SLAVE_DEFINED, m_reason.c_str());
|
||||
return false;
|
||||
m_reason = "Internal Error: cant build search";
|
||||
error(KIO::ERR_SLAVE_DEFINED, m_reason.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<Rcl::SearchData> sdata(sd);
|
||||
std::shared_ptr<Rcl::Query>query(new Rcl::Query(m_rcldb.get()));
|
||||
query->setCollapseDuplicates(prefs.collapseDuplicates);
|
||||
if (!query->setQuery(sdata)) {
|
||||
m_reason = "Query execute failed. Invalid query or syntax error?";
|
||||
error(KIO::ERR_SLAVE_DEFINED, m_reason.c_str());
|
||||
return false;
|
||||
m_reason = "Query execute failed. Invalid query or syntax error?";
|
||||
error(KIO::ERR_SLAVE_DEFINED, m_reason.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
DocSequenceDb *src =
|
||||
new DocSequenceDb(m_rcldb, std::shared_ptr<Rcl::Query>(query),
|
||||
new DocSequenceDb(m_rcldb, std::shared_ptr<Rcl::Query>(query),
|
||||
"Query results", sdata);
|
||||
if (src == 0) {
|
||||
error(KIO::ERR_SLAVE_DEFINED, "Can't build result sequence");
|
||||
return false;
|
||||
error(KIO::ERR_SLAVE_DEFINED, "Can't build result sequence");
|
||||
return false;
|
||||
}
|
||||
m_source = std::shared_ptr<DocSequence>(src);
|
||||
// Reset pager in all cases. Costs nothing, stays at page -1 initially
|
||||
@@ -368,8 +368,8 @@ int kdemain(int argc, char **argv)
|
||||
kDebug() << "*** starting kio_recoll " << endl;
|
||||
|
||||
if (argc != 4) {
|
||||
kDebug() << "Usage: kio_recoll proto dom-socket1 dom-socket2\n" << endl;
|
||||
exit(-1);
|
||||
kDebug() << "Usage: kio_recoll proto dom-socket1 dom-socket2\n" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
RecollProtocol slave(argv[2], argv[3]);
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
int page;
|
||||
bool isDetReq;
|
||||
bool sameQuery(const QueryDesc& o) const {
|
||||
return !opt.compare(o.opt) && !query.compare(o.query);
|
||||
return !opt.compare(o.opt) && !query.compare(o.query);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -74,26 +74,26 @@ public:
|
||||
UrlIngester(RecollProtocol *p, const KUrl& url);
|
||||
enum RootEntryType {UIRET_NONE, UIRET_ROOT, UIRET_HELP, UIRET_SEARCH};
|
||||
bool isRootEntry(RootEntryType *tp) {
|
||||
if (m_type != UIMT_ROOTENTRY) return false;
|
||||
*tp = m_retType;
|
||||
return true;
|
||||
if (m_type != UIMT_ROOTENTRY) return false;
|
||||
*tp = m_retType;
|
||||
return true;
|
||||
}
|
||||
bool isQuery(QueryDesc *q) {
|
||||
if (m_type != UIMT_QUERY) return false;
|
||||
*q = m_query;
|
||||
return true;
|
||||
if (m_type != UIMT_QUERY) return false;
|
||||
*q = m_query;
|
||||
return true;
|
||||
}
|
||||
bool isResult(QueryDesc *q, int *num) {
|
||||
if (m_type != UIMT_QUERYRESULT) return false;
|
||||
*q = m_query;
|
||||
*num = m_resnum;
|
||||
return true;
|
||||
if (m_type != UIMT_QUERYRESULT) return false;
|
||||
*q = m_query;
|
||||
*num = m_resnum;
|
||||
return true;
|
||||
}
|
||||
bool isPreview(QueryDesc *q, int *num) {
|
||||
if (m_type != UIMT_PREVIEW) return false;
|
||||
*q = m_query;
|
||||
*num = m_resnum;
|
||||
return true;
|
||||
if (m_type != UIMT_PREVIEW) return false;
|
||||
*q = m_query;
|
||||
*num = m_resnum;
|
||||
return true;
|
||||
}
|
||||
bool endSlashQuery() {return m_slashend;}
|
||||
bool alwaysDir() {return m_alwaysdir;}
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
RootEntryType m_retType;
|
||||
int m_resnum;
|
||||
enum MyType {UIMT_NONE, UIMT_ROOTENTRY, UIMT_QUERY, UIMT_QUERYRESULT,
|
||||
UIMT_PREVIEW};
|
||||
UIMT_PREVIEW};
|
||||
MyType m_type;
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<li><b>Html interface</b>, close to a simplified QT Recoll
|
||||
interface.</li>
|
||||
<li><b>File manager interface</b>, <em>Only with KDE 4.1 and
|
||||
newer</em>, which presents results as directory entries</li>
|
||||
newer</em>, which presents results as directory entries</li>
|
||||
</ul>
|
||||
|
||||
<p>With recent KDE versions (now: 2016), the file manager
|
||||
@@ -74,8 +74,8 @@
|
||||
|
||||
<li>Using an URL ending with a '/', ie:
|
||||
<blockquote>
|
||||
<a href="recoll:/red apples ext:html/">
|
||||
recoll:/red apples ext:html/</a>
|
||||
<a href="recoll:/red apples ext:html/">
|
||||
recoll:/red apples ext:html/</a>
|
||||
</blockquote>
|
||||
</li>
|
||||
<li>If you would like to use the file manager view most of the
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<input type="submit" value="Search">
|
||||
|
||||
<!-- This resets to the preset value. We'd like a real clear
|
||||
<input type="reset" value="Clear"> -->
|
||||
<input type="reset" value="Clear"> -->
|
||||
|
||||
</form>
|
||||
</p>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
all:
|
||||
@echo "This Makefile is only for the CVS repository"
|
||||
@echo "This will be deleted before making the distribution"
|
||||
@echo ""
|
||||
$(MAKE) -f admin/Makefile.common cvs
|
||||
@echo "This Makefile is only for the CVS repository"
|
||||
@echo "This will be deleted before making the distribution"
|
||||
@echo ""
|
||||
$(MAKE) -f admin/Makefile.common cvs
|
||||
|
||||
dist:
|
||||
$(MAKE) -f admin/Makefile.common dist
|
||||
$(MAKE) -f admin/Makefile.common dist
|
||||
|
||||
.SILENT:
|
||||
|
||||
@@ -7,25 +7,25 @@
|
||||
SHELL=/bin/sh
|
||||
|
||||
cvs dist configure configure.in configure.files subdirs package-messages package-merge Makefile.am acinclude.m4 extract-messages:
|
||||
@admindir=$(admindir); \
|
||||
if test "x$$admindir" = x; then \
|
||||
admindir=.; until test -f $$admindir/admin/cvs.sh; do \
|
||||
admindir=$$admindir/..; \
|
||||
if test `cd $$admindir && pwd` = / ; then break; fi; \
|
||||
done; \
|
||||
admindir=$$admindir/admin; \
|
||||
if test -f $$admindir/cvs.sh; then :; else \
|
||||
echo "Can't find the admin/ directory in any parent of the"; \
|
||||
echo "current directory. Please set it with admindir=..."; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
if test "$@" = "package-merge"; then \
|
||||
MAKE="$(MAKE)" POFILES="$(POFILES)" PACKAGE="$(PACKAGE)" \
|
||||
$(SHELL) $$admindir/cvs.sh package-merge ;\
|
||||
else \
|
||||
MAKE="$(MAKE)" $(SHELL) $$admindir/cvs.sh $@ ;\
|
||||
fi
|
||||
@admindir=$(admindir); \
|
||||
if test "x$$admindir" = x; then \
|
||||
admindir=.; until test -f $$admindir/admin/cvs.sh; do \
|
||||
admindir=$$admindir/..; \
|
||||
if test `cd $$admindir && pwd` = / ; then break; fi; \
|
||||
done; \
|
||||
admindir=$$admindir/admin; \
|
||||
if test -f $$admindir/cvs.sh; then :; else \
|
||||
echo "Can't find the admin/ directory in any parent of the"; \
|
||||
echo "current directory. Please set it with admindir=..."; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
if test "$@" = "package-merge"; then \
|
||||
MAKE="$(MAKE)" POFILES="$(POFILES)" PACKAGE="$(PACKAGE)" \
|
||||
$(SHELL) $$admindir/cvs.sh package-merge ;\
|
||||
else \
|
||||
MAKE="$(MAKE)" $(SHELL) $$admindir/cvs.sh $@ ;\
|
||||
fi
|
||||
|
||||
configure.in: configure.files subdirs
|
||||
configure.files: subdirs
|
||||
|
||||
@@ -51,30 +51,30 @@ while (<>) {
|
||||
# in later autoconf (2.14.1) there is no CONFIG_FILES= line,
|
||||
# but instead the (2) directly follow (1)
|
||||
if (/^\s*ac_max_sed_([a-z]+).*=\s*([0-9]+)/ ) {
|
||||
$flag = 1;
|
||||
if ($1 eq 'lines') {
|
||||
$flag = 1;
|
||||
if ($1 eq 'lines') {
|
||||
# lets hope its different with 2141,
|
||||
# wasn't able to verify that
|
||||
if ($2 eq '48') {
|
||||
$ac_version = 250;
|
||||
}
|
||||
else {
|
||||
$ac_version = 2141;
|
||||
$ac_version = 2141;
|
||||
}
|
||||
} elsif ($1 eq 'cmds') {
|
||||
$ac_version = 213;
|
||||
}
|
||||
# hmm, we don't know the autoconf version, but we try anyway
|
||||
} else {
|
||||
print;
|
||||
}
|
||||
} elsif ($1 eq 'cmds') {
|
||||
$ac_version = 213;
|
||||
}
|
||||
# hmm, we don't know the autoconf version, but we try anyway
|
||||
} else {
|
||||
print;
|
||||
}
|
||||
} elsif ($flag == 1) {
|
||||
if (/^\s*CONFIG_FILES=/ && ($ac_version != 250)) {
|
||||
print;
|
||||
$flag = 2;
|
||||
} elsif (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) {
|
||||
$flag = 3;
|
||||
}
|
||||
print;
|
||||
$flag = 2;
|
||||
} elsif (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) {
|
||||
$flag = 3;
|
||||
}
|
||||
} elsif ($flag == 2) {
|
||||
# 2. begins with: "for ac_file in.*CONFIG_FILES" (the next 'for' after (1))
|
||||
# end with: "rm -f conftest.s\*"
|
||||
@@ -84,22 +84,22 @@ while (<>) {
|
||||
# stop there and insert a new loop to honor the case/esac.
|
||||
# (pattern: /^\s+#\sRun the commands associated with the file./)
|
||||
|
||||
if (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) {
|
||||
$flag = 3;
|
||||
} else {
|
||||
print;
|
||||
}
|
||||
if (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) {
|
||||
$flag = 3;
|
||||
} else {
|
||||
print;
|
||||
}
|
||||
} elsif ($flag == 3) {
|
||||
if (/^\s*rm\s+-f\s+conftest/ ) {
|
||||
$flag = 4;
|
||||
&insert_main_loop();
|
||||
} elsif (/^\s*rm\s+-f\s+.*ac_cs_root/ ) {
|
||||
$flag = 4;
|
||||
&insert_main_loop();
|
||||
#die "hhhhhhh";
|
||||
if ($ac_version != 2141) {
|
||||
print STDERR "hmm, don't know autoconf version\n";
|
||||
}
|
||||
$flag = 4;
|
||||
&insert_main_loop();
|
||||
} elsif (/^\s*rm\s+-f\s+.*ac_cs_root/ ) {
|
||||
$flag = 4;
|
||||
&insert_main_loop();
|
||||
#die "hhhhhhh";
|
||||
if ($ac_version != 2141) {
|
||||
print STDERR "hmm, don't know autoconf version\n";
|
||||
}
|
||||
} elsif (/^\#\s*CONFIG_(HEADER|COMMANDS) section.*|^\s+#\s(Run) the commands associated/) {
|
||||
$flag = 4;
|
||||
my $commands = defined $2;
|
||||
@@ -108,9 +108,9 @@ while (<>) {
|
||||
if($ac_version != 250) {
|
||||
print STDERR "hmm, something went wrong :-(\n";
|
||||
}
|
||||
} elsif (/VPATH/ ) {
|
||||
$vpath_seen = 1;
|
||||
}
|
||||
} elsif (/VPATH/ ) {
|
||||
$vpath_seen = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ EOF
|
||||
if ($vpath_seen) {
|
||||
print <<EOF;
|
||||
# VPATH subst was seen in original config.status main loop
|
||||
echo '/^[ ]*VPATH[ ]*=[^:]*\$/d' >>\$tmp/subs.sed
|
||||
echo '/^[ ]*VPATH[ ]*=[^:]*\$/d' >>\$tmp/subs.sed
|
||||
EOF
|
||||
}
|
||||
print <<EOF;
|
||||
@@ -165,7 +165,7 @@ EOF
|
||||
if ($vpath_seen) {
|
||||
print <<EOF;
|
||||
# VPATH subst was seen in original config.status main loop
|
||||
echo '/^[ ]*VPATH[ ]*=[^:]*\$/d' >> \$ac_cs_root.subs
|
||||
echo '/^[ ]*VPATH[ ]*=[^:]*\$/d' >> \$ac_cs_root.subs
|
||||
EOF
|
||||
}
|
||||
print <<EOF;
|
||||
|
||||
Reference in New Issue
Block a user