messagingapp/msgui/unifiededitor/inc/msgunieditormonitor.h
changeset 76 60a8a215b0ec
parent 37 518b245aa84c
equal deleted inserted replaced
73:ecf6a73a9186 76:60a8a215b0ec
    18 #ifndef MSG_UNIFIED_EDITOR_MONITOR_H
    18 #ifndef MSG_UNIFIED_EDITOR_MONITOR_H
    19 #define MSG_UNIFIED_EDITOR_MONITOR_H
    19 #define MSG_UNIFIED_EDITOR_MONITOR_H
    20 
    20 
    21 #include <QObject>
    21 #include <QObject>
    22 #include "convergedmessage.h"
    22 #include "convergedmessage.h"
       
    23 
    23 class MsgUnifiedEditorView;
    24 class MsgUnifiedEditorView;
    24 class HbWidget;
    25 class HbWidget;
    25 class UniEditorGenUtils;
    26 class UniEditorGenUtils;
    26 
    27 
    27 /**
    28 /**
    46 
    47 
    47     /**
    48     /**
    48      * Set to skip showing note for first time
    49      * Set to skip showing note for first time
    49      * @param skip true/false
    50      * @param skip true/false
    50      */
    51      */
    51     inline void setSkipNote(bool skip = true);
    52     inline void setSkipNote(bool skip = true)
       
    53     {
       
    54         mSkipNote = skip;
       
    55     }
    52     
    56     
    53     /**
    57     /**
    54      * Seeker method to access current message type
    58      * Seeker method to access current message type
    55      */
    59      */
    56     static inline ConvergedMessage::MessageType messageType();
    60     static inline ConvergedMessage::MessageType messageType()
       
    61     {
       
    62         return mMessageType;
       
    63     }
    57 
    64 
    58     /**
    65     /**
    59      * seeker function to get current msg size in bytes
    66      * seeker function to get current msg size in bytes
    60      */
    67      */
    61     static inline int messageSize();
    68     static inline int messageSize()
       
    69     {
       
    70         return mBodyContentSize + mContainerSize + mSubjectSize;
       
    71     }
    62 
    72 
    63     /**
    73     /**
    64      * seeker function to get current msg's body size 
    74      * seeker function to get current msg's body size 
    65      * in bytes
    75      * in bytes
    66      */
    76      */
    67     static inline int bodySize();
    77     static inline int bodySize()
       
    78     {
       
    79         return mBodyContentSize;
       
    80     }
    68 
    81 
    69     /**
    82     /**
    70      * seeker function to get current msg's attachment
    83      * seeker function to get current msg's attachment
    71      * container size in bytes
    84      * container size in bytes
    72      */
    85      */
    73     static inline int containerSize();
    86     static inline int containerSize()
       
    87     {
       
    88         return mContainerSize;
       
    89     }
    74 
    90 
    75     /**
    91     /**
    76      * seeker function to get current msg's subject
    92      * seeker function to get current msg's subject
    77      * size in bytes
    93      * size in bytes
    78      */
    94      */
    79     static inline int subjectSize();
    95     static inline int subjectSize()
       
    96     {
       
    97         return mSubjectSize;
       
    98     }
    80 
    99 
    81     /**
   100     /**
    82      * seeker function to get max possible mms size
   101      * seeker function to get max possible mms size
    83      * in bytes
   102      * in bytes
    84      */
   103      */
    85     static inline int maxMmsSize();
   104     static inline int maxMmsSize()
       
   105     {
       
   106         return mMaxMmsSize;
       
   107     }
    86     
   108     
    87     /**
   109     /**
    88      * seeker funtion to get max recipient count for sms
   110      * seeker funtion to get max recipient count for sms
    89      */
   111      */
    90     static inline int maxSmsRecipients();
   112     static inline int maxSmsRecipients()
       
   113     {
       
   114         return mMaxSmsRecipients;
       
   115     }
    91 
   116 
    92     /**
   117     /**
    93      * seeker funtion to get max recipient count for mms
   118      * seeker funtion to get max recipient count for mms
    94      */
   119      */
    95     static inline int maxMmsRecipients();
   120     static inline int maxMmsRecipients()
       
   121     {
       
   122         return mMaxMmsRecipients;
       
   123     }
    96     
   124     
    97     /**
   125     /**
    98      * get total address count in To, Cc & Bcc fields
   126      * get total address count in To, Cc & Bcc fields
    99      */
   127      */
   100     static inline int msgAddressCount();
   128     static inline int msgAddressCount()
       
   129     {
       
   130         return  mToAddressCount + mCcAddressCount + mBccAddressCount;
       
   131     }
       
   132     
       
   133     /**
       
   134      * tells if message is ready for send.
       
   135      */
       
   136     static inline bool readyForSend()
       
   137     {
       
   138         return mReadyForSend;
       
   139     }
   101 
   140 
   102 public slots:
   141 public slots:
   103     /**
   142     /**
   104      * slot to handle content change in any editor component
   143      * slot to handle content change in any editor component
   105      */
   144      */
   106     void handleContentChange();
   145     void handleContentsChanged(const QVariant& data);
   107 
   146 
   108 signals:
   147 signals:
   109     /**
   148     /**
   110      * Emitted when composed message can be sent.
   149      * Emitted when composed message can be sent.
   111      * @param enable true if send is possible else false.
   150      * @param enable true if send is possible else false.
   112      */
   151      */
   113     void enableSend(bool enable);
   152     void enableSend(bool enable);
       
   153     
       
   154     /**
       
   155      * Emitte when contents are changed, to set drafts flag.
       
   156      */
       
   157     void contentsChanged();
   114 
   158 
   115 private:
   159 private:
   116     /**
   160     /**
   117      * setter method to initialize content
   161      * setter method to initialize content
   118      */
   162      */
   122      * Determine the projected msg type due to change in editor content
   166      * Determine the projected msg type due to change in editor content
   123      */
   167      */
   124     ConvergedMessage::MessageType projectedMsgType();
   168     ConvergedMessage::MessageType projectedMsgType();
   125 
   169 
   126     /**
   170     /**
   127      * update various msg info changes during editing
       
   128      * @param senderWidget, Editor widget which triggered 
       
   129      * content change slot
       
   130      */
       
   131     void updateMsgInfo(HbWidget* senderWidget);
       
   132     
       
   133     /**
       
   134      * show type change discreet note
   171      * show type change discreet note
   135      */
   172      */
   136     void showPopup(const QString& text);
   173     void showPopup(const QString& text);
   137     
   174     
   138     /**
   175   
   139      * accessor for view
       
   140      */
       
   141     MsgUnifiedEditorView* view();
       
   142     
       
   143     /**
   176     /**
   144      * check editor body for MMS content
   177      * check editor body for MMS content
   145      * @return true if MMS content is present
   178      * @return true if MMS content is present
   146      */
   179      */
   147     bool bodyHasMMSContent();
   180     bool bodyHasMMSContent();
   166 
   199 
   167     /**
   200     /**
   168      * Checks if composed message can be sent and emits a signal.
   201      * Checks if composed message can be sent and emits a signal.
   169      */
   202      */
   170     void updateSend();
   203     void updateSend();
       
   204     
       
   205     /**
       
   206      * Updates body content size.
       
   207      */
       
   208     void updateBodyContentSize();
       
   209     
       
   210     /**
       
   211      * resets value of static member variables.
       
   212      */
       
   213     void reset();
   171 
   214 
   172 private:
   215 private:
   173 
   216 
   174     /**
   217     /**
   175      * Flag to skip showing the type change popup.
   218      * Flag to skip showing the type change popup.
   176      * Note need to be skipped when an mms is opened from draft.
   219      * Note need to be skipped when an mms is opened from draft.
   177      */
   220      */
   178     bool mSkipNote;
   221     bool mSkipNote;
       
   222     
       
   223     /**
       
   224      * Flag to keep information, if attachment container has mms content.
       
   225      */
       
   226     bool mContainerHasMmsContent;
       
   227     
       
   228     /**
       
   229      * Priority.
       
   230      */
       
   231     ConvergedMessage::Priority mPriority;
       
   232     
       
   233     /**
       
   234      * Email id is present in to field or not.
       
   235      */
       
   236     bool mEmailPresent;
       
   237     
       
   238     /**
       
   239      * Body text has uni code char(s).
       
   240      */
       
   241     bool mUniCode;
       
   242     
       
   243     /**
       
   244      * Flag to hold state of image resizing
       
   245      */
       
   246     bool mImageResizing;
   179 
   247 
   180     /**
   248     /**
   181      * Type of msg under composition in the editor 
   249      * Type of msg under composition in the editor 
   182      */
   250      */
   183     static ConvergedMessage::MessageType mMessageType;
   251     static ConvergedMessage::MessageType mMessageType;
   186      * msg body size in bytes
   254      * msg body size in bytes
   187      */
   255      */
   188     static int mBodySize;
   256     static int mBodySize;
   189     
   257     
   190     /**
   258     /**
       
   259      * msg body text size in bytes
       
   260      */
       
   261     static int mBodyTextSize;
       
   262     
       
   263     /**
       
   264      * msg body content (mBodySize + mBodyTextSize + mime headers) size in bytes.
       
   265      */
       
   266     static int mBodyContentSize;
       
   267     
       
   268     /**
   191      * msg container size in bytes
   269      * msg container size in bytes
   192      */
   270      */
   193     static int mContainerSize;
   271     static int mContainerSize;
   194     
   272     
   195     /**
   273     /**
   211      * max recipient count in an sms
   289      * max recipient count in an sms
   212      */
   290      */
   213     static int mMaxMmsRecipients;
   291     static int mMaxMmsRecipients;
   214     
   292     
   215     /**
   293     /**
   216      * current msg address count (to + cc + bcc)
   294      * Address count in various fields.
   217      */
   295      */
   218     static int mMsgCurrAddressCount;
   296     static int mToAddressCount;
       
   297     static int mCcAddressCount;
       
   298     static int mBccAddressCount;
       
   299     
       
   300     /**
       
   301      * flag to check if message is ready for send.
       
   302      */
       
   303     static bool mReadyForSend;
   219 
   304 
   220     /**
   305     /**
   221      * UniEditorGenUtils object
   306      * UniEditorGenUtils object
   222      * Owned
   307      * Owned
   223      */
   308      */
   224     UniEditorGenUtils* mUniEditorGenUtils;
   309     UniEditorGenUtils* mUniEditorGenUtils;
       
   310 #ifdef UNIEDITOR_UNIT_TEST
       
   311     /**
       
   312      * Unit Testing
       
   313      */
       
   314     friend class TestMsgUnifiedEditorView;
       
   315     friend class TestMsgUnifiedEditorMonitor;
       
   316 #endif
   225     };
   317     };
   226 
   318 
   227 #include "msgunieditormonitor.inl"
       
   228 
       
   229 #endif //MSG_UNIFIED_EDITOR_MONITOR_H
   319 #endif //MSG_UNIFIED_EDITOR_MONITOR_H