feat+refactor: trash instance icons
also refactor IconList::deleteIcon Signed-off-by: leo78913 <leo3758@riseup.net>
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user