messagingapp/msgui/appengine/inc/conversationsmodel.h
changeset 37 518b245aa84c
parent 25 84d9eb65b26f
child 48 4f501b74aeb1
equal deleted inserted replaced
25:84d9eb65b26f 37:518b245aa84c
    20 
    20 
    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>
       
    26 #include <QCache>
       
    27 #include <HbIcon>
    25 
    28 
    26 // FORWARD DECLARATIONS
    29 // FORWARD DECLARATIONS
    27 class CCsConversationEntry;
    30 class CCsConversationEntry;
    28 class ConversationMsgStoreHandler;
    31 class ConversationMsgStoreHandler;
    29 class UniDataModelLoader;
    32 class UniDataModelLoader;
    73     /**
    76     /**
    74      * Delete a row from conversations model.
    77      * Delete a row from conversations model.
    75      * @param msgId, Message Id
    78      * @param msgId, Message Id
    76      */
    79      */
    77     void deleteRow(int msgId);
    80     void deleteRow(int msgId);
       
    81     
       
    82     /*
       
    83      * Get SQL DB handle
       
    84      * @param isOpen, set to true if open, check this before using the handle
       
    85      */
       
    86     RSqlDatabase& getDBHandle(TBool& isOpen);
       
    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);
    78 
   110 
    79 private:
   111 private:
    80 
   112 
    81     /**
   113     /**
    82      * Populate an item in model from CCsConversationEntry.
   114      * Populate an item in model from CCsConversationEntry.
   114      * @param entry, CCsConversationEntry
   146      * @param entry, CCsConversationEntry
   115      */
   147      */
   116     void handleBioMessages(QStandardItem& item, 
   148     void handleBioMessages(QStandardItem& item, 
   117         const CCsConversationEntry& entry);
   149         const CCsConversationEntry& entry);
   118 
   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 
   119 private:
   176 private:
   120 
   177 
   121     /**
   178     /**
   122      * Msg Store Handler
   179      * Msg Store Handler
   123      * Not Own
   180      * Not Own
   139     /**
   196     /**
   140      * BioMsg Data model plugin interface
   197      * BioMsg Data model plugin interface
   141      * Not Own
   198      * Not Own
   142      */
   199      */
   143     UniDataModelPluginInterface* iBioMsgPlugin;
   200     UniDataModelPluginInterface* iBioMsgPlugin;
       
   201     
       
   202     /*
       
   203      * SQL DB handle
       
   204      */
       
   205     RSqlDatabase iSqlDb;
       
   206 
       
   207     /*
       
   208      * DB open.
       
   209      */
       
   210     TBool iSqlDbOpen;
       
   211 
       
   212     /*
       
   213      *  preview-icon cache
       
   214      */
       
   215     QCache<int, HbIcon> previewIconCache;
   144 };
   216 };
   145 
   217 
   146 #endif // CONVERSATIONS_MODEL_H
   218 #endif // CONVERSATIONS_MODEL_H