From f7ad8cb799d1d2b74bef7955d0846909e50256ff Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Tue, 23 Apr 2013 10:08:26 +0200 Subject: [PATCH] Cache icon and text for Inbox item. --- src/sourcetree/items/InboxItem.cpp | 9 ++++++--- src/sourcetree/items/InboxItem.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/sourcetree/items/InboxItem.cpp b/src/sourcetree/items/InboxItem.cpp index 652d5a97f..3e73cf4a6 100644 --- a/src/sourcetree/items/InboxItem.cpp +++ b/src/sourcetree/items/InboxItem.cpp @@ -31,7 +31,10 @@ InboxItem::InboxItem( SourcesModel* model, SourceTreeItem* parent ) : SourceTreeItem( model, parent, SourcesModel::Inbox ) , m_sortValue( -150 ) -{} +{ + m_text = tr( "Inbox" ); + m_icon = ImageRegistry::instance()->icon( RESPATH "images/inbox.svg" ); +} InboxItem::~InboxItem() @@ -41,14 +44,14 @@ InboxItem::~InboxItem() QString InboxItem::text() const { - return tr( "Inbox" ); + return m_text; } QIcon InboxItem::icon() const { - return ImageRegistry::instance()->icon( RESPATH "images/inbox.svg" ); + return m_icon; } diff --git a/src/sourcetree/items/InboxItem.h b/src/sourcetree/items/InboxItem.h index 81efa6e12..39a2782b5 100644 --- a/src/sourcetree/items/InboxItem.h +++ b/src/sourcetree/items/InboxItem.h @@ -41,6 +41,8 @@ public slots: private: int m_sortValue; + QIcon m_icon; + QString m_text; }; #endif // INBOXITEM_H