messagingapp/msgui/appengine/inc/conversationsmodel.h
branchGCC_SURGE
changeset 47 5b14749788d7
parent 27 e4592d119491
parent 44 36f374c67aa8
equal deleted inserted replaced
35:a32b19fb291e 47:5b14749788d7
    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     void emitConversationViewEmpty();
       
    94 
       
    95 signals:
       
    96 
       
    97     /*
       
    98      * Signal emitted to retrieve the pixmap icon
       
    99      */
       
   100     void retrievePreviewIcon(int msgId, QString& filepath) const;
       
   101     
       
   102     void conversationViewEmpty();
       
   103 
       
   104 private slots:
       
   105 
       
   106     /*
       
   107      * Slot which handles retrievePreviewIcon signal
       
   108      */
       
   109     void updatePreviewIcon(int msgId, QString& filePath);
       
   110 
    86 private:
   111 private:
    87 
   112 
    88     /**
   113     /**
    89      * Populate an item in model from CCsConversationEntry.
   114      * Populate an item in model from CCsConversationEntry.
    90      * @param item, QStandardItem
   115      * @param item, QStandardItem
   121      * @param entry, CCsConversationEntry
   146      * @param entry, CCsConversationEntry
   122      */
   147      */
   123     void handleBioMessages(QStandardItem& item, 
   148     void handleBioMessages(QStandardItem& item, 
   124         const CCsConversationEntry& entry);
   149         const CCsConversationEntry& entry);
   125 
   150 
       
   151     /**
       
   152      * Populates preview icon into the previewicon cache
       
   153      * @param pixmap, QPixmap
       
   154      * @param filePath, filepath to be used if icon is not in Db
       
   155      * @param msgId, key to pixmap in previewicon cache
       
   156      * @param inDb, indicates if icon was available in Db (or) not
       
   157      */    
       
   158     void setPreviewIcon(QPixmap& pixmap, QString& filePath, int msgId,
       
   159         bool inDb);
       
   160 
       
   161     /**
       
   162      * Get the preview icon item if available in pixmap cache / create
       
   163      * and return the preview icon
       
   164      * @param msgId, key to pixmap in previewicon cache
       
   165      * @param filePath, filepath to be used if icon is not in cache
       
   166      */
       
   167     HbIcon* getPreviewIconItem(int msgId, QString& filepath) const;
       
   168     
       
   169     /**
       
   170      * Check if a MMS is forwardable or not
       
   171      * @param messageId, message id
       
   172      * @return true/false
       
   173      */
       
   174     bool validateMsgForForward(qint32 messageId);
       
   175 
   126 private:
   176 private:
   127 
   177 
   128     /**
   178     /**
   129      * Msg Store Handler
   179      * Msg Store Handler
   130      * Not Own
   180      * Not Own
   156 
   206 
   157     /*
   207     /*
   158      * DB open.
   208      * DB open.
   159      */
   209      */
   160     TBool iSqlDbOpen;
   210     TBool iSqlDbOpen;
       
   211 
       
   212     /*
       
   213      *  preview-icon cache
       
   214      */
       
   215     QCache<int, HbIcon> previewIconCache;
   161 };
   216 };
   162 
   217 
   163 #endif // CONVERSATIONS_MODEL_H
   218 #endif // CONVERSATIONS_MODEL_H