messagingapp/msgui/unifiededitor/inc/msgmonitor.h
branchGCC_SURGE
changeset 47 5b14749788d7
parent 35 a32b19fb291e
parent 44 36f374c67aa8
equal deleted inserted replaced
35:a32b19fb291e 47:5b14749788d7
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: Helper class to monitor msg construction in unified editor
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef MSG_MONITOR_H
       
    19 #define MSG_MONITOR_H
       
    20 
       
    21 #include <QObject>
       
    22 #include "convergedmessage.h"
       
    23 class MsgUnifiedEditorView;
       
    24 class HbWidget;
       
    25 class UniEditorGenUtils;
       
    26 
       
    27 /**
       
    28  * Helper class to monitor message's contruction in unified editor.
       
    29  * This class is for only reading editor's content to run its logic.
       
    30  * This class is NOT a place for content editing inside editor.
       
    31  */
       
    32 class MsgMonitor : public QObject
       
    33     {
       
    34     Q_OBJECT
       
    35 
       
    36 public:
       
    37     /**
       
    38      * Constructor
       
    39      */
       
    40     MsgMonitor(QObject* parent=0);
       
    41 
       
    42     /**
       
    43      * Destructor
       
    44      */
       
    45     ~MsgMonitor();
       
    46 
       
    47     /**
       
    48      * Set to skip showing note for first time
       
    49      * @param skip true/false
       
    50      */
       
    51     inline void setSkipNote(bool skip = true);
       
    52     
       
    53     /**
       
    54      * Seeker method to access current message type
       
    55      */
       
    56     static inline ConvergedMessage::MessageType messageType();
       
    57 
       
    58     /**
       
    59      * seeker function to get current msg size in bytes
       
    60      */
       
    61     static inline int messageSize();
       
    62 
       
    63     /**
       
    64      * seeker function to get current msg's body size 
       
    65      * in bytes
       
    66      */
       
    67     static inline int bodySize();
       
    68 
       
    69     /**
       
    70      * seeker function to get current msg's attachment
       
    71      * container size in bytes
       
    72      */
       
    73     static inline int containerSize();
       
    74 
       
    75     /**
       
    76      * seeker function to get current msg's subject
       
    77      * size in bytes
       
    78      */
       
    79     static inline int subjectSize();
       
    80 
       
    81     /**
       
    82      * seeker function to get max possible mms size
       
    83      * in bytes
       
    84      */
       
    85     static inline int maxMmsSize();
       
    86     
       
    87     /**
       
    88      * seeker funtion to get max recipient count for sms
       
    89      */
       
    90     static inline int maxSmsRecipients();
       
    91 
       
    92     /**
       
    93      * seeker funtion to get max recipient count for mms
       
    94      */
       
    95     static inline int maxMmsRecipients();
       
    96     
       
    97     /**
       
    98      * get total address count in To, Cc & Bcc fields
       
    99      */
       
   100     static inline int msgAddressCount();
       
   101 
       
   102 public slots:
       
   103     /**
       
   104      * slot to handle content change in any editor component
       
   105      */
       
   106     void handleContentChange();
       
   107 
       
   108 private:
       
   109     /**
       
   110      * setter method to initialize content
       
   111      */
       
   112     void init();
       
   113 
       
   114     /**
       
   115      * Determine the projected msg type due to change in editor content
       
   116      */
       
   117     ConvergedMessage::MessageType projectedMsgType();
       
   118 
       
   119     /**
       
   120      * update various msg info changes during editing
       
   121      * @param senderWidget, Editor widget which triggered 
       
   122      * content change slot
       
   123      */
       
   124     void updateMsgInfo(HbWidget* senderWidget);
       
   125     
       
   126     /**
       
   127      * show type change discreet note
       
   128      */
       
   129     void showPopup(const QString& text);
       
   130     
       
   131     /**
       
   132      * accessor for view
       
   133      */
       
   134     MsgUnifiedEditorView* view();
       
   135     
       
   136     /**
       
   137      * check editor body for MMS content
       
   138      * @return true if MMS content is present
       
   139      */
       
   140     bool bodyHasMMSContent();
       
   141     
       
   142     /**
       
   143      * check editor subject for MMS content
       
   144      * @return true if MMS content is present
       
   145      */
       
   146     bool subjectHasMMSContent();
       
   147     
       
   148     /**
       
   149      * check editor attachment container for MMS content
       
   150      * @return true if MMS content is present
       
   151      */
       
   152     bool containerHasMMSContent();
       
   153     
       
   154     /**
       
   155      * check for other MMS content criteria
       
   156      * @return true if MMS criteria is met
       
   157      */
       
   158     bool otherMMSCriteriaMet();
       
   159 
       
   160 private:
       
   161 
       
   162     /**
       
   163      * Flag to skip showing the type change popup.
       
   164      * Note need to be skipped when an mms is opened from draft.
       
   165      */
       
   166     bool mSkipNote;
       
   167 
       
   168     /**
       
   169      * Type of msg under composition in the editor 
       
   170      */
       
   171     static ConvergedMessage::MessageType mMessageType;
       
   172     
       
   173     /**
       
   174      * msg body size in bytes
       
   175      */
       
   176     static int mBodySize;
       
   177     
       
   178     /**
       
   179      * msg container size in bytes
       
   180      */
       
   181     static int mContainerSize;
       
   182     
       
   183     /**
       
   184      * msg subject size in bytes
       
   185      */
       
   186     static int mSubjectSize;
       
   187 
       
   188     /**
       
   189      * max mms size in bytes
       
   190      */
       
   191     static int mMaxMmsSize;
       
   192     
       
   193     /**
       
   194      * max recipient count in an sms
       
   195      */
       
   196     static int mMaxSmsRecipients;
       
   197 
       
   198     /**
       
   199      * max recipient count in an sms
       
   200      */
       
   201     static int mMaxMmsRecipients;
       
   202     
       
   203     /**
       
   204      * current msg address count (to + cc + bcc)
       
   205      */
       
   206     static int mMsgCurrAddressCount;
       
   207 
       
   208     /**
       
   209      * UniEditorGenUtils object
       
   210      * Owned
       
   211      */
       
   212     UniEditorGenUtils* mUniEditorGenUtils;
       
   213     };
       
   214 
       
   215 #include "msgmonitor.inl"
       
   216 
       
   217 #endif //MSG_MONITOR_H