mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Plugins: Allow to specify icon path relative to metadata directory
This commit is contained in:
parent
83f1e9c329
commit
71615c675f
|
@ -108,7 +108,12 @@ PluginSpec Plugins::createSpec(const DesktopFile &metaData)
|
|||
if (QFileInfo::exists(iconName)) {
|
||||
spec.icon = QIcon(iconName).pixmap(32);
|
||||
} else {
|
||||
spec.icon = QIcon::fromTheme(iconName).pixmap(32);
|
||||
const QString relativeFile = QFileInfo(metaData.fileName()).dir().absoluteFilePath(iconName);
|
||||
if (QFileInfo::exists(relativeFile)) {
|
||||
spec.icon = QIcon(relativeFile).pixmap(32);
|
||||
} else {
|
||||
spec.icon = QIcon::fromTheme(iconName).pixmap(32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,13 +23,18 @@ DesktopFile::DesktopFile()
|
|||
{
|
||||
}
|
||||
|
||||
DesktopFile::DesktopFile(const QString &filePath)
|
||||
DesktopFile::DesktopFile(const QString &fileName)
|
||||
{
|
||||
m_settings.reset(new QSettings(filePath, QSettings::IniFormat));
|
||||
m_settings.reset(new QSettings(fileName, QSettings::IniFormat));
|
||||
m_settings->setIniCodec("UTF-8");
|
||||
m_settings->beginGroup(QSL("Desktop Entry"));
|
||||
}
|
||||
|
||||
QString DesktopFile::fileName() const
|
||||
{
|
||||
return m_settings ? m_settings->fileName() : QString();
|
||||
}
|
||||
|
||||
QString DesktopFile::name() const
|
||||
{
|
||||
return value(QSL("Name"), true).toString();
|
||||
|
|
|
@ -27,7 +27,9 @@ class FALKON_EXPORT DesktopFile
|
|||
{
|
||||
public:
|
||||
explicit DesktopFile();
|
||||
explicit DesktopFile(const QString &filePath);
|
||||
explicit DesktopFile(const QString &fileName);
|
||||
|
||||
QString fileName() const;
|
||||
|
||||
QString name() const;
|
||||
QString comment() const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user