emailuis/nmailui/inc/nmeditorview.h
changeset 30 759dc5235cdb
parent 27 9ba4404ef423
child 44 c2d07d913565
equal deleted inserted replaced
27:9ba4404ef423 30:759dc5235cdb
    21 #include <QPointer>
    21 #include <QPointer>
    22 
    22 
    23 #include "nmbaseview.h"
    23 #include "nmbaseview.h"
    24 #include "nmactionobserver.h"
    24 #include "nmactionobserver.h"
    25 #include "nmactionresponse.h"
    25 #include "nmactionresponse.h"
       
    26 #include "nmattachmentfetchobserver.h"
    26 
    27 
    27 class QGraphicsLinearLayout;
    28 class QGraphicsLinearLayout;
    28 class HbTextEdit;
    29 class HbTextEdit;
    29 class HbDocumentLoader;
    30 class HbDocumentLoader;
    30 class HbProgressDialog;
    31 class HbProgressDialog;
    39 class NmEditorHeader;
    40 class NmEditorHeader;
    40 class NmAction;
    41 class NmAction;
    41 class NmOperation;
    42 class NmOperation;
    42 class NmMessageCreationOperation;
    43 class NmMessageCreationOperation;
    43 class NmAddAttachmentsOperation;
    44 class NmAddAttachmentsOperation;
    44 class NmCheckOutboxOperation;
       
    45 class NmAttachmentPicker;
    45 class NmAttachmentPicker;
    46 class HbMessageBox;
    46 class HbMessageBox;
       
    47 class NmAttachmentManager;
    47 
    48 
    48 class NmEditorView : public NmBaseView, public NmActionObserver
    49 
       
    50 class NmEditorView : public NmBaseView,
       
    51                      public NmActionObserver,
       
    52                      public NmAttachmentFetchObserver
    49 {
    53 {
    50     Q_OBJECT
    54     Q_OBJECT
    51 
    55 
    52 public:
    56 public:
    53 
    57 
    54     NmEditorView(NmApplication &application,
    58     NmEditorView(NmApplication &application,
    55                  NmUiStartParam* startParam,
    59                  NmUiStartParam* startParam,
    56                  NmUiEngine &uiEngine,
    60                  NmUiEngine &uiEngine,
       
    61                  NmAttachmentManager &attaManager,
    57                  QGraphicsItem *parent = 0);
    62                  QGraphicsItem *parent = 0);
    58     ~NmEditorView();
    63     ~NmEditorView();
    59 
    64 
    60 
    65 
    61 public:
    66 public:
    78 
    83 
    79 public: // From NmActionObserver
    84 public: // From NmActionObserver
    80 
    85 
    81     void handleActionCommand(NmActionResponse &menuResponse);
    86     void handleActionCommand(NmActionResponse &menuResponse);
    82 
    87 
       
    88 public: // From NmAttachmentFetchObserver
       
    89     void progressChanged(int value);
       
    90     void fetchCompleted(int result);
    83 
    91 
    84 private slots:
    92 private slots:
    85 
    93 
    86     void messageCreated(int result);
    94     void messageCreated(int result);
    87     void adjustViewDimensions();
    95     void adjustViewDimensions();
    89                             const NmId &msgPartId,
    97                             const NmId &msgPartId,
    90                             int result);
    98                             int result);
    91 
    99 
    92     void allAttachmentsAdded(int result);
   100     void allAttachmentsAdded(int result);
    93     void attachmentRemoved(int result);
   101     void attachmentRemoved(int result);
    94     void outboxChecked(int result);
       
    95     void removeAttachmentTriggered();
   102     void removeAttachmentTriggered();
    96     void handleSendOperationCompleted();
   103     void handleSendOperationCompleted();
    97     void openAttachmentTriggered();  
   104     void openAttachmentTriggered();  
    98     void onAttachmentReqCompleted(const QVariant &value);
   105     void onAttachmentReqCompleted(const QVariant &value);
       
   106     void onAttachmentsFetchError(int errorCode, const QString& errorMessage);
    99     void switchCcBccFieldVisibility();
   107     void switchCcBccFieldVisibility();
       
   108 	void fetchProgressDialogCancelled();
   100 
   109 
   101 private:
   110 private:
   102 
   111 
   103     void loadViewLayout();
   112     void loadViewLayout();
   104     void setMailboxName();
   113     void setMailboxName();
   105     void setMessageData();
   114     void fetchProgressDialogShow();
       
   115     void fetchMessageIfNeeded();
   106     void startMessageCreation(NmUiEditorStartMode startMode);
   116     void startMessageCreation(NmUiEditorStartMode startMode);
   107     void startSending();
   117     void startSending();
   108     void finalizeSending();
   118     void finalizeSending();
   109     void createToolBar();
   119     void createToolBar();
   110     QPointF viewCoordinateToEditCoordinate(QPointF orgPoint);
       
   111     void updateMessageWithEditorContents();
   120     void updateMessageWithEditorContents();
   112     void fillEditorWithMessageContents();
   121     void fillEditorWithMessageContents();
   113     void initializeVKB();
   122     void initializeVKB();
   114     QString addSubjectPrefix(NmUiEditorStartMode startMode, const QString &subject);
   123     QString addSubjectPrefix(NmUiEditorStartMode startMode, const QString &subject);
   115     void addAttachments(const QStringList &fileNames);
   124     void addAttachments(const QStringList &fileNames);
   116     void setPriority(NmActionResponseCommand priority);
   125     void setPriority(NmActionResponseCommand priority);
   117     QString addressListToString(const QList<NmAddress*> &list) const;
   126     QString addressListToString(const QList<NmAddress*> &list) const;
   118     QString addressListToString(const QList<NmAddress> &list) const;
   127     QString addressListToString(const QList<NmAddress> &list) const;
   119     void enableToolBarAttach(bool enable);
   128     void enableToolBarAttach(bool enable);
   120 
   129 
   121 
       
   122 public slots:
   130 public slots:
   123 
   131 
   124     void sendMousePressEventToScroll(QGraphicsSceneMouseEvent *event);
   132     void sendProgressDialogCancelled();
   125     void sendMouseReleaseEventToScroll(QGraphicsSceneMouseEvent *event);
       
   126     void sendMouseMoveEventToScroll(QGraphicsSceneMouseEvent *event);
       
   127     void sendLongPressGesture(const QPointF &point);
       
   128 
   133 
   129 private: // Data
   134 private: // Data
   130 
   135 
   131     NmApplication &mApplication;
   136     NmApplication &mApplication;
   132     NmUiEngine &mUiEngine;
   137     NmUiEngine &mUiEngine;
       
   138     NmAttachmentManager  &mAttaManager;
   133     HbDocumentLoader *mDocumentLoader;  // Owned
   139     HbDocumentLoader *mDocumentLoader;  // Owned
   134     QObjectList mWidgetList;            // Owned
   140     QObjectList mWidgetList;            // Owned
   135     NmBaseViewScrollArea *mScrollArea;  // Not owned
   141     NmBaseViewScrollArea *mScrollArea;  // Not owned
   136     HbWidget *mScrollAreaContents;      // Not owned
   142     HbWidget *mScrollAreaContents;      // Not owned
   137     NmEditorTextEdit *mEditWidget;      // Not owned
   143     NmEditorTextEdit *mEditWidget;      // Not owned
   144     NmId mSelectedAttachment;
   150     NmId mSelectedAttachment;
   145 
   151 
   146     QPointer<NmMessageCreationOperation> mMessageCreationOperation;  // Not owned
   152     QPointer<NmMessageCreationOperation> mMessageCreationOperation;  // Not owned
   147     QPointer<NmAddAttachmentsOperation> mAddAttachmentOperation;     // Not owned 
   153     QPointer<NmAddAttachmentsOperation> mAddAttachmentOperation;     // Not owned 
   148     QPointer<NmOperation> mRemoveAttachmentOperation;                // Not owned 
   154     QPointer<NmOperation> mRemoveAttachmentOperation;                // Not owned 
   149     QPointer<NmCheckOutboxOperation> mCheckOutboxOperation;          // Not owned 
       
   150 
   155 
   151     HbProgressDialog *mWaitDialog;         // Owned.    
   156     HbProgressDialog *mWaitDialog;         // Owned.    
   152     HbMessageBox* mQueryDialog;            // Owned
   157     HbMessageBox* mQueryDialog;            // Owned
   153     NmAttachmentPicker* mAttachmentPicker; // Owned    
   158     NmAttachmentPicker* mAttachmentPicker; // Owned    
   154     bool mCcBccFieldVisible;
   159     bool mCcBccFieldVisible;
       
   160     QPointer<HbProgressDialog> mServiceSendingDialog; // Owned.
   155 };
   161 };
   156 
   162 
   157 
   163 
   158 #endif /* NMEDITORVIEW_H_ */
   164 #endif /* NMEDITORVIEW_H_ */