messagingapp/msgui/appengine/inc/conversationsmodel.h
changeset 37 518b245aa84c
parent 25 84d9eb65b26f
child 48 4f501b74aeb1
--- a/messagingapp/msgui/appengine/inc/conversationsmodel.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationsmodel.h	Fri Jun 25 15:47:40 2010 +0530
@@ -22,6 +22,9 @@
 #include <QObject>
 #include <QStandardItemModel>
 #include <ccsdefs.h>
+#include <sqldb.h>
+#include <QCache>
+#include <HbIcon>
 
 // FORWARD DECLARATIONS
 class CCsConversationEntry;
@@ -75,6 +78,35 @@
      * @param msgId, Message Id
      */
     void deleteRow(int msgId);
+    
+    /*
+     * Get SQL DB handle
+     * @param isOpen, set to true if open, check this before using the handle
+     */
+    RSqlDatabase& getDBHandle(TBool& isOpen);
+
+    /*
+     * Clears the pixmap cache & model
+     */
+    void clearModel();
+    
+    void emitConversationViewEmpty();
+
+signals:
+
+    /*
+     * Signal emitted to retrieve the pixmap icon
+     */
+    void retrievePreviewIcon(int msgId, QString& filepath) const;
+    
+    void conversationViewEmpty();
+
+private slots:
+
+    /*
+     * Slot which handles retrievePreviewIcon signal
+     */
+    void updatePreviewIcon(int msgId, QString& filePath);
 
 private:
 
@@ -116,6 +148,31 @@
     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;
+    
+    /**
+     * Check if a MMS is forwardable or not
+     * @param messageId, message id
+     * @return true/false
+     */
+    bool validateMsgForForward(qint32 messageId);
+
 private:
 
     /**
@@ -141,6 +198,21 @@
      * Not Own
      */
     UniDataModelPluginInterface* iBioMsgPlugin;
+    
+    /*
+     * SQL DB handle
+     */
+    RSqlDatabase iSqlDb;
+
+    /*
+     * DB open.
+     */
+    TBool iSqlDbOpen;
+
+    /*
+     *  preview-icon cache
+     */
+    QCache<int, HbIcon> previewIconCache;
 };
 
 #endif // CONVERSATIONS_MODEL_H