1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

DesktopFile: Add tryExec

This commit is contained in:
David Rosca 2018-03-03 12:29:35 +01:00
parent d3159348b4
commit 72b4cf55ff
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 13 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include "desktopfile.h"
#include <QSettings>
#include <QStandardPaths>
DesktopFile::DesktopFile()
{
@ -80,3 +81,13 @@ QVariant DesktopFile::value(const QString &key, bool localized) const
}
return m_settings->value(key);
}
bool DesktopFile::tryExec() const
{
if (!m_settings) {
return false;
}
const QString exec = m_settings->value(QSL("TryExec")).toString();
return exec.isEmpty() || !QStandardPaths::findExecutable(exec).isEmpty();
}

View File

@ -37,6 +37,8 @@ public:
QString icon() const;
QVariant value(const QString &key, bool localized = false) const;
bool tryExec() const;
private:
QSharedPointer<QSettings> m_settings;
};