aboutsummaryrefslogtreecommitdiff
path: root/launcher/icons/IconList.cpp
diff options
context:
space:
mode:
authorleo78913 <leo3758@riseup.net>2022-12-06 20:25:42 -0300
committerleo78913 <leo3758@riseup.net>2022-12-06 20:25:42 -0300
commit8c99edd3c5545db06df2b043c85d10b00438d143 (patch)
tree19ac669779ae5b2753ed4f6c4ed15d8c2af55113 /launcher/icons/IconList.cpp
parent8036272e87d62e292e78999f4095bf3d5ca89aa9 (diff)
downloadPrismLauncher-8c99edd3c5545db06df2b043c85d10b00438d143.tar.gz
PrismLauncher-8c99edd3c5545db06df2b043c85d10b00438d143.tar.bz2
PrismLauncher-8c99edd3c5545db06df2b043c85d10b00438d143.zip
feat+refactor: trash instance icons
also refactor IconList::deleteIcon Signed-off-by: leo78913 <leo3758@riseup.net>
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..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)