summaryrefslogtreecommitdiffstats
path: root/api/gui/icons/MMCIcon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'api/gui/icons/MMCIcon.cpp')
-rw-r--r--api/gui/icons/MMCIcon.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/api/gui/icons/MMCIcon.cpp b/api/gui/icons/MMCIcon.cpp
index f71281d0..11ad93e2 100644
--- a/api/gui/icons/MMCIcon.cpp
+++ b/api/gui/icons/MMCIcon.cpp
@@ -15,6 +15,7 @@
#include "MMCIcon.h"
#include <QFileInfo>
+#include <xdgicon.h>
IconType operator--(IconType &t, int)
{
@@ -58,7 +59,11 @@ QIcon MMCIcon::icon() const
{
if (m_current_type == IconType::ToBeDeleted)
return QIcon();
- return m_images[m_current_type].icon;
+ auto & icon = m_images[m_current_type].icon;
+ if(!icon.isNull())
+ return icon;
+ // FIXME: inject this.
+ return XdgIcon::fromTheme(m_images[m_current_type].key);
}
void MMCIcon::remove(IconType rm_type)
@@ -78,12 +83,22 @@ void MMCIcon::remove(IconType rm_type)
void MMCIcon::replace(IconType new_type, QIcon icon, QString path)
{
- QFileInfo foo(path);
if (new_type > m_current_type || m_current_type == IconType::ToBeDeleted)
{
m_current_type = new_type;
}
m_images[new_type].icon = icon;
- m_images[new_type].changed = foo.lastModified();
m_images[new_type].filename = path;
+ m_images[new_type].key = QString();
+}
+
+void MMCIcon::replace(IconType new_type, const QString& key)
+{
+ if (new_type > m_current_type || m_current_type == IconType::ToBeDeleted)
+ {
+ m_current_type = new_type;
+ }
+ m_images[new_type].icon = QIcon();
+ m_images[new_type].filename = QString();
+ m_images[new_type].key = key;
}