diff --git a/searchcontext.cpp b/searchcontext.cpp index 1179203af..98b75e793 100644 --- a/searchcontext.cpp +++ b/searchcontext.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -158,27 +159,28 @@ void SearchContext::determineType() { d->lockForWrite(); QString term = d->term; + QString path = KShell::tildeExpand(term); int space = term.indexOf(' '); if (space > 0) { - if (!KStandardDirs::findExe(term.left(space)).isEmpty()) { + if (!KStandardDirs::findExe(path.left(space)).isEmpty()) { d->type = ShellCommand; } - } else if (!KStandardDirs::findExe(term.left(space)).isEmpty()) { + } else if (!KStandardDirs::findExe(path.left(space)).isEmpty()) { d->type = Executable; } else { KUrl url(term); if (!url.protocol().isEmpty() && !url.host().isEmpty()) { d->type = NetworkLocation; - } else if (QFile::exists(term)) { - QFileInfo info(term); + } else if (QFile::exists(path)) { + QFileInfo info(path); if (info.isDir()) { d->type = Directory; d->mimetype = "inode/folder"; } else { d->type = File; - KMimeType::Ptr mimetype = KMimeType::findByPath(term); + KMimeType::Ptr mimetype = KMimeType::findByPath(path); if (mimetype) { d->mimetype = mimetype->name(); }