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:
parent
d3159348b4
commit
72b4cf55ff
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user