aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-01-17 15:43:48 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2020-01-17 15:43:48 +0200
commitbfa620630eb1c45cbec740ff05d7655991eca777 (patch)
treebb5f2dab0a5b9384b3d692b32b3b655f0477a50d /lib
parentMerge branch 'firefox-bookmarks-json-importer' (diff)
downloadsmolbote-bfa620630eb1c45cbec740ff05d7655991eca777.tar.xz
Add bookmarks subcommand
Diffstat (limited to 'lib')
-rw-r--r--lib/bookmarks/bookmarkitem.cpp14
-rw-r--r--lib/bookmarks/bookmarkitem.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/bookmarks/bookmarkitem.cpp b/lib/bookmarks/bookmarkitem.cpp
index 21d034f..d361e26 100644
--- a/lib/bookmarks/bookmarkitem.cpp
+++ b/lib/bookmarks/bookmarkitem.cpp
@@ -13,13 +13,7 @@
BookmarkItem::BookmarkItem(const QVector<QVariant> &data, Type type, BookmarkItem *parent)
{
m_parentItem = parent;
-
m_type = type;
- if(m_type == Folder) {
- m_icon.addPixmap(qApp->style()->standardPixmap(QStyle::SP_DirClosedIcon), QIcon::Normal, QIcon::Off);
- m_icon.addPixmap(qApp->style()->standardPixmap(QStyle::SP_DirOpenIcon), QIcon::Normal, QIcon::On);
- } else if(m_type == Bookmark)
- m_icon.addPixmap(qApp->style()->standardPixmap(QStyle::SP_FileIcon));
m_data.resize(FieldCount);
for(int i = 0; i < FieldCount; ++i) {
@@ -104,8 +98,14 @@ bool BookmarkItem::setData(Fields column, const QVariant &data)
return true;
}
-QIcon BookmarkItem::icon() const
+QIcon BookmarkItem::icon()
{
+ if(m_icon.isNull() && m_type == Folder) {
+ m_icon.addPixmap(qApp->style()->standardPixmap(QStyle::SP_DirClosedIcon), QIcon::Normal, QIcon::Off);
+ m_icon.addPixmap(qApp->style()->standardPixmap(QStyle::SP_DirOpenIcon), QIcon::Normal, QIcon::On);
+ } else if(m_icon.isNull() && m_type == Bookmark)
+ m_icon.addPixmap(qApp->style()->standardPixmap(QStyle::SP_FileIcon));
+
return m_icon;
}
diff --git a/lib/bookmarks/bookmarkitem.h b/lib/bookmarks/bookmarkitem.h
index 6751526..97d3e89 100644
--- a/lib/bookmarks/bookmarkitem.h
+++ b/lib/bookmarks/bookmarkitem.h
@@ -48,7 +48,7 @@ public:
QVariant data(Fields column) const;
bool setData(Fields column, const QVariant &data);
- QIcon icon() const;
+ QIcon icon();
bool isExpanded() const;
void setExpanded(bool expanded);