[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.4/kdelibs/plasma
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2010-01-31 23:26:46
Message-ID: 1264980406.354384.18000.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1083284 by aseigo:
http://, man:/, file:/// and file:// all work as expected
M +42 -29 runnercontext.cpp
--- branches/KDE/4.4/kdelibs/plasma/runnercontext.cpp #1083283:1083284
@@ -116,7 +116,7 @@
// path components
QStringList components = QString(path).split(QDir::separator());
- if (components.size() < 2) {
+ if (components.size() < 1) {
return false;
}
@@ -124,12 +124,11 @@
//kDebug() << "Components are" << components;
- QString correctPath;
-
- if (components.back().isEmpty()) {
+ if (mustBeDir) {
components.pop_back();
}
+ QString correctPath;
const unsigned initialComponents = components.size();
for (unsigned i = 0; i < initialComponents - 1; i ++) {
const QString tmp = components[0] + QDir::separator() + components[1];
@@ -174,6 +173,7 @@
/**
* Determines type of query
+ &&
*/
void determineType()
{
@@ -191,38 +191,51 @@
RunnerContext::Executable;
} else {
KUrl url(term);
- QString correctCasePath;
// check for a normal URL first
- if (KProtocolInfo::protocolClass(url.protocol()) == ":internet" &&
- url.hasHost()) {
+ //kDebug() << url << KProtocolInfo::protocolClass(url.protocol()) << \
url.hasHost() << + // url.host() << url.isLocalFile() << path << \
path.indexOf('/'); + const bool hasProtocol = \
!url.protocol().isEmpty(); + const bool isLocalProtocol = \
KProtocolInfo::protocolClass(url.protocol()) == ":local"; + if \
(hasProtocol && + ((!isLocalProtocol && url.hasHost()) ||
+ (isLocalProtocol && url.protocol() != "file"))) {
+ // we either have a network protocol with a host, so we can show \
matches for it + // or we have a non-file url that may be local so \
a host isn't required type = RunnerContext::NetworkLocation;
- // check if we have a local network location first, otherwise assume \
a path,
- // but if a path doesn't have any slashes is a single word or
- // sentence: it's too ambiguous to be sure we're in a filesystem \
context
- } else if (KProtocolInfo::protocolClass(url.protocol()) == ":local" \
&&
- !url.isLocalFile()) {
- type = RunnerContext::NetworkLocation;
- } else if ((path.indexOf('/') != -1 || path.indexOf('\\') != -1) &&
- correctPathCase(path, correctCasePath)) {
- path = correctCasePath;
- QFileInfo info(path);
+ } else if (isLocalProtocol) {
+ // at this point in the game, we assume we have a path,
+ // but if a path doesn't have any slashes
+ // it's too ambiguous to be sure we're in a filesystem context
+ path = QDir::cleanPath(url.toLocalFile());
+ //kDebug( )<< "slash check" << path;
+ if (hasProtocol || ((path.indexOf('/') != -1 || \
path.indexOf('\\') != -1))) { + QString correctCasePath;
+ if (correctPathCase(path, correctCasePath)) {
+ path = correctCasePath;
+ QFileInfo info(path);
+ //kDebug( )<< "correct cas epath is" << correctCasePath \
<< info.isSymLink() << + // info.isDir() << \
info.isFile();
- if (info.isSymLink()) {
- path = info.canonicalFilePath();
- info = QFileInfo(path);
- }
- if (info.isDir()) {
- type = RunnerContext::Directory;
- mimeType = "inode/folder";
- } else if (info.isFile()) {
- type = RunnerContext::File;
- KMimeType::Ptr mimeTypePtr = KMimeType::findByPath(path);
- if (mimeTypePtr) {
- mimeType = mimeTypePtr->name();
+ if (info.isSymLink()) {
+ path = info.canonicalFilePath();
+ info = QFileInfo(path);
+ }
+ if (info.isDir()) {
+ type = RunnerContext::Directory;
+ mimeType = "inode/folder";
+ } else if (info.isFile()) {
+ type = RunnerContext::File;
+ KMimeType::Ptr mimeTypePtr = \
KMimeType::findByPath(path); + if (mimeTypePtr) {
+ mimeType = mimeTypePtr->name();
+ }
+ }
}
}
}
}
+
+ //kDebug() << "term2type" << term << type;
}
void invalidate()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic