diff options
Diffstat (limited to 'launcher/icons')
-rw-r--r-- | launcher/icons/IconList.cpp | 19 | ||||
-rw-r--r-- | launcher/icons/IconList.h | 1 |
2 files changed, 12 insertions, 8 deletions
diff --git a/launcher/icons/IconList.cpp b/launcher/icons/IconList.cpp index 01043ad2..5080d3f8 100644 --- a/launcher/icons/IconList.cpp +++ b/launcher/icons/IconList.cpp @@ -354,15 +354,18 @@ const MMCIcon *IconList::icon(const QString &key) const bool IconList::deleteIcon(const QString &key) { - int iconIdx = getIconIndex(key); - if (iconIdx == -1) + if (!iconFileExists(key)) return false; - auto &iconEntry = icons[iconIdx]; - if (iconEntry.has(IconType::FileBased)) - { - return QFile::remove(iconEntry.m_images[IconType::FileBased].filename); - } - return false; + + return QFile::remove(icon(key)->m_images[IconType::FileBased].filename); +} + +bool IconList::trashIcon(const QString &key) +{ + if (!iconFileExists(key)) + return false; + + return FS::trash(icon(key)->m_images[IconType::FileBased].filename, nullptr); } bool IconList::addThemeIcon(const QString& key) diff --git a/launcher/icons/IconList.h b/launcher/icons/IconList.h index f9f49e7f..97141e4a 100644 --- a/launcher/icons/IconList.h +++ b/launcher/icons/IconList.h @@ -52,6 +52,7 @@ public: bool addIcon(const QString &key, const QString &name, const QString &path, const IconType type); void saveIcon(const QString &key, const QString &path, const char * format) const; bool deleteIcon(const QString &key); + bool trashIcon(const QString &key); bool iconFileExists(const QString &key) const; void installIcons(const QStringList &iconFiles); |