better stat
This commit is contained in:
parent
b9dd90790f
commit
8b164381d2
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: dirif.cpp,v 1.7 2008-12-02 13:41:35 dockes Exp $ (C) 2008 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: dirif.cpp,v 1.8 2008-12-03 10:02:20 dockes Exp $ (C) 2008 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
|
||||||
@ -177,24 +177,44 @@ void RecollProtocol::stat(const KUrl & url)
|
|||||||
kDebug() << url << endl ;
|
kDebug() << url << endl ;
|
||||||
int num = -1;
|
int num = -1;
|
||||||
QString path = url.path();
|
QString path = url.path();
|
||||||
|
QString host = url.host();
|
||||||
KIO::UDSEntry entry;
|
KIO::UDSEntry entry;
|
||||||
if (!path.compare("/")) {
|
if (!host.isEmpty()) {
|
||||||
|
// Do nothing probably coming from the html form, if we return a
|
||||||
|
// directory here, we crash konqueror
|
||||||
|
kDebug() << "HOST NOT EMPTY:" << host;
|
||||||
|
} else if (!path.compare("/")) {
|
||||||
createRootEntry(entry);
|
createRootEntry(entry);
|
||||||
} else if (!path.compare("/help")) {
|
} else if (!path.compare("/help")) {
|
||||||
createGoHelpEntry(entry);
|
createGoHelpEntry(entry);
|
||||||
} else if (!path.compare("/search")) {
|
} else if (!path.compare("/search")) {
|
||||||
createGoHomeEntry(entry);
|
createGoHomeEntry(entry);
|
||||||
|
// } else if (!path.compare("/welcome")) {
|
||||||
} else if (isRecollResult(url, &num)) {
|
} else if (isRecollResult(url, &num)) {
|
||||||
// If this url starts with the current search url appended with a
|
// Let's stat said result.
|
||||||
// result name appended, let's stat said result.
|
|
||||||
Rcl::Doc doc;
|
Rcl::Doc doc;
|
||||||
if (num >= 0 && !m_source.isNull() && m_source->getDoc(num, doc)) {
|
if (num >= 0 && !m_source.isNull() && m_source->getDoc(num, doc)) {
|
||||||
entry = resultToUDSEntry(doc, num);
|
entry = resultToUDSEntry(doc, num);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Don't return an error here, we get stat() on yet unperformed searches
|
// ie "recoll:/some string" or "recoll:/some string/"
|
||||||
// ie stat("recoll:/some search string")
|
//
|
||||||
// Would have to perform the search, better to return bogus ok
|
// We have a problem here. We'd like to let the user enter
|
||||||
|
// either form and get an html or a dir contents result,
|
||||||
|
// depending on the ending /. Otoh this makes the name space
|
||||||
|
// inconsistent, because /toto can't be a file (the html
|
||||||
|
// result page) while /toto/ would be a directory ? or can it
|
||||||
|
//
|
||||||
|
// Another approach would be to use different protocol names
|
||||||
|
// to avoid any possibility of mixups
|
||||||
|
if (path.endsWith("/")) {
|
||||||
|
QString q, opt;
|
||||||
|
URLToQuery(url, q, opt);
|
||||||
|
entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
|
||||||
|
entry.insert( KIO::UDSEntry::UDS_ACCESS, 0700);
|
||||||
|
entry.insert( KIO::UDSEntry::UDS_MIME_TYPE, "inode/directory");
|
||||||
|
entry.insert(KIO::UDSEntry::UDS_NAME, q);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.insert(KIO::UDSEntry::UDS_TARGET_URL, url.url());
|
entry.insert(KIO::UDSEntry::UDS_TARGET_URL, url.url());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user