From 8cd418cd6a25ff7998809daf76c8b9418c7cf7e5 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 20 Feb 2016 16:39:26 +0200 Subject: [PATCH] kdecore: cleanup Desktop file handler Signed-off-by: Ivailo Monev --- kdecore/config/kdesktopfile.cpp | 34 ++++----------------------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/kdecore/config/kdesktopfile.cpp b/kdecore/config/kdesktopfile.cpp index c2c80345..d32e27ce 100644 --- a/kdecore/config/kdesktopfile.cpp +++ b/kdecore/config/kdesktopfile.cpp @@ -255,40 +255,14 @@ bool KDesktopFile::tryExec() const QString te = d->desktopGroup.readEntry("TryExec", QString()); if (!te.isEmpty()) { - if (!QDir::isRelativePath(te)) { - if (KDE::access(te, X_OK)) - return false; - } else { - // !!! Sergey A. Sukiyazov !!! - // Environment PATH may contain filenames in 8bit locale specified - // encoding (Like a filenames). - const QStringList dirs = QFile::decodeName(qgetenv("PATH")) - .split(QLatin1Char(KPATH_SEPARATOR), QString::SkipEmptyParts); - QStringList::ConstIterator it(dirs.begin()); - bool match = false; - for (; it != dirs.end(); ++it) { - QString fName = *it + QLatin1Char(KDIR_SEPARATOR) + te; - if (KDE::access(fName, X_OK) == 0) - { - match = true; - break; - } - } - // didn't match at all - if (!match) + if(KGlobal::dirs()->findExe(te).isEmpty()) { return false; } } const QStringList list = d->desktopGroup.readEntry("X-KDE-AuthorizeAction", QStringList()); - if (!list.isEmpty()) - { - for(QStringList::ConstIterator it = list.begin(); - it != list.end(); - ++it) - { - if (!KAuthorized::authorize((*it).trimmed())) - return false; - } + foreach (const QString it, list) { + if (!KAuthorized::authorize(it.trimmed())) + return false; } // See also KService::username()