take the space location from the cleaned up path, not the original term

BUG:154395

svn path=/trunk/KDE/kdelibs/; revision=895431
This commit is contained in:
Aaron J. Seigo 2008-12-10 18:15:47 +00:00
parent c51d9d7d9b
commit fda8cf20d7

View File

@ -80,13 +80,12 @@ class RunnerContextPrivate : public QSharedData
type = RunnerContext::UnknownType;
QString path = QDir::cleanPath(KShell::tildeExpand(term));
int space = term.indexOf(' ');
if (space > 0) {
int space = path.indexOf(' ');
if (!KStandardDirs::findExe(path.left(space)).isEmpty()) {
type = RunnerContext::ShellCommand;
}
} else if (!KStandardDirs::findExe(path.left(space)).isEmpty()) {
type = RunnerContext::Executable;
// it's a shell command if there's a space because that implies
// that it has arguments!
type = (space > 0) ? RunnerContext::ShellCommand :
RunnerContext::Executable;
} else {
KUrl url(term);
if (!url.protocol().isEmpty() && !url.isLocalFile()) {