messagingapp/msgui/appengine/inc/conversationsmodel.h
changeset 34 84197e66a4bd
parent 31 ebfee66fde93
child 43 35b64624a9e7
equal deleted inserted replaced
31:ebfee66fde93 34:84197e66a4bd
    21 // INCLUDES
    21 // INCLUDES
    22 #include <QObject>
    22 #include <QObject>
    23 #include <QStandardItemModel>
    23 #include <QStandardItemModel>
    24 #include <ccsdefs.h>
    24 #include <ccsdefs.h>
    25 #include <sqldb.h>
    25 #include <sqldb.h>
       
    26 #include <QCache>
       
    27 #include <HbIcon>
    26 
    28 
    27 // FORWARD DECLARATIONS
    29 // FORWARD DECLARATIONS
    28 class CCsConversationEntry;
    30 class CCsConversationEntry;
    29 class ConversationMsgStoreHandler;
    31 class ConversationMsgStoreHandler;
    30 class UniDataModelLoader;
    32 class UniDataModelLoader;
    81      * Get SQL DB handle
    83      * Get SQL DB handle
    82      * @param isOpen, set to true if open, check this before using the handle
    84      * @param isOpen, set to true if open, check this before using the handle
    83      */
    85      */
    84     RSqlDatabase& getDBHandle(TBool& isOpen);
    86     RSqlDatabase& getDBHandle(TBool& isOpen);
    85 
    87 
       
    88     /*
       
    89      * Clears the pixmap cache & model
       
    90      */
       
    91     void clearModel();
       
    92 
       
    93 signals:
       
    94 
       
    95     /*
       
    96      * Signal emitted to retrieve the pixmap icon
       
    97      */
       
    98     void retrievePreviewIcon(int msgId, QString& filepath) const;
       
    99 
       
   100 private slots:
       
   101 
       
   102     /*
       
   103      * Slot which handles retrievePreviewIcon signal
       
   104      */
       
   105     void updatePreviewIcon(int msgId, QString& filePath);
       
   106 
    86 private:
   107 private:
    87 
   108 
    88     /**
   109     /**
    89      * Populate an item in model from CCsConversationEntry.
   110      * Populate an item in model from CCsConversationEntry.
    90      * @param item, QStandardItem
   111      * @param item, QStandardItem
   121      * @param entry, CCsConversationEntry
   142      * @param entry, CCsConversationEntry
   122      */
   143      */
   123     void handleBioMessages(QStandardItem& item, 
   144     void handleBioMessages(QStandardItem& item, 
   124         const CCsConversationEntry& entry);
   145         const CCsConversationEntry& entry);
   125 
   146 
       
   147     /**
       
   148      * Populates preview icon into the previewicon cache
       
   149      * @param pixmap, QPixmap
       
   150      * @param filePath, filepath to be used if icon is not in Db
       
   151      * @param msgId, key to pixmap in previewicon cache
       
   152      * @param inDb, indicates if icon was available in Db (or) not
       
   153      */    
       
   154     void setPreviewIcon(QPixmap& pixmap, QString& filePath, int msgId,
       
   155         bool inDb);
       
   156 
       
   157     /**
       
   158      * Get the preview icon item if available in pixmap cache / create
       
   159      * and return the preview icon
       
   160      * @param msgId, key to pixmap in previewicon cache
       
   161      * @param filePath, filepath to be used if icon is not in cache
       
   162      */
       
   163     HbIcon* getPreviewIconItem(int msgId, QString& filepath) const;
       
   164 
   126 private:
   165 private:
   127 
   166 
   128     /**
   167     /**
   129      * Msg Store Handler
   168      * Msg Store Handler
   130      * Not Own
   169      * Not Own
   156 
   195 
   157     /*
   196     /*
   158      * DB open.
   197      * DB open.
   159      */
   198      */
   160     TBool iSqlDbOpen;
   199     TBool iSqlDbOpen;
       
   200 
       
   201     /*
       
   202      *  preview-icon cache
       
   203      */
       
   204     QCache<int, HbIcon> previewIconCache;
   161 };
   205 };
   162 
   206 
   163 #endif // CONVERSATIONS_MODEL_H
   207 #endif // CONVERSATIONS_MODEL_H