messagingapp/msgui/appengine/inc/conversationsmodel.h
changeset 34 84197e66a4bd
parent 31 ebfee66fde93
child 43 35b64624a9e7
--- a/messagingapp/msgui/appengine/inc/conversationsmodel.h	Fri Jun 04 10:25:39 2010 +0100
+++ b/messagingapp/msgui/appengine/inc/conversationsmodel.h	Fri Jun 11 13:35:48 2010 +0300
@@ -23,6 +23,8 @@
 #include <QStandardItemModel>
 #include <ccsdefs.h>
 #include <sqldb.h>
+#include <QCache>
+#include <HbIcon>
 
 // FORWARD DECLARATIONS
 class CCsConversationEntry;
@@ -83,6 +85,25 @@
      */
     RSqlDatabase& getDBHandle(TBool& isOpen);
 
+    /*
+     * Clears the pixmap cache & model
+     */
+    void clearModel();
+
+signals:
+
+    /*
+     * Signal emitted to retrieve the pixmap icon
+     */
+    void retrievePreviewIcon(int msgId, QString& filepath) const;
+
+private slots:
+
+    /*
+     * Slot which handles retrievePreviewIcon signal
+     */
+    void updatePreviewIcon(int msgId, QString& filePath);
+
 private:
 
     /**
@@ -123,6 +144,24 @@
     void handleBioMessages(QStandardItem& item, 
         const CCsConversationEntry& entry);
 
+    /**
+     * Populates preview icon into the previewicon cache
+     * @param pixmap, QPixmap
+     * @param filePath, filepath to be used if icon is not in Db
+     * @param msgId, key to pixmap in previewicon cache
+     * @param inDb, indicates if icon was available in Db (or) not
+     */    
+    void setPreviewIcon(QPixmap& pixmap, QString& filePath, int msgId,
+        bool inDb);
+
+    /**
+     * Get the preview icon item if available in pixmap cache / create
+     * and return the preview icon
+     * @param msgId, key to pixmap in previewicon cache
+     * @param filePath, filepath to be used if icon is not in cache
+     */
+    HbIcon* getPreviewIconItem(int msgId, QString& filepath) const;
+
 private:
 
     /**
@@ -158,6 +197,11 @@
      * DB open.
      */
     TBool iSqlDbOpen;
+
+    /*
+     *  preview-icon cache
+     */
+    QCache<int, HbIcon> previewIconCache;
 };
 
 #endif // CONVERSATIONS_MODEL_H