aboutsummaryrefslogtreecommitdiff
path: root/launcher/icons/IconList.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-12-14 23:15:21 +0100
committerGitHub <noreply@github.com>2022-12-14 23:15:21 +0100
commitd193ed9eebb392b259edb88a227dce4cee773df6 (patch)
tree7daad65334e540fae9c9bea892503f24f6a259d4 /launcher/icons/IconList.cpp
parentb2285be5bcbf02da72e4912f6a1354d3763022c4 (diff)
parent2d5820e910476f7eab32ac5cd48cce18c0c5a1e5 (diff)
downloadPrismLauncher-d193ed9eebb392b259edb88a227dce4cee773df6.tar.gz
PrismLauncher-d193ed9eebb392b259edb88a227dce4cee773df6.tar.bz2
PrismLauncher-d193ed9eebb392b259edb88a227dce4cee773df6.zip
Merge pull request #561 from leo78913/iconpicker-stuff
closes https://github.com/PrismLauncher/PrismLauncher/issues/494
Diffstat (limited to 'launcher/icons/IconList.cpp')
-rw-r--r--launcher/icons/IconList.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/launcher/icons/IconList.cpp b/launcher/icons/IconList.cpp
index 01043ad2..1dfc6432 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)->getFilePath());
+}
+
+bool IconList::trashIcon(const QString &key)
+{
+ if (!iconFileExists(key))
+ return false;
+
+ return FS::trash(icon(key)->getFilePath(), nullptr);
}
bool IconList::addThemeIcon(const QString& key)