emailuis/nmailui/inc/nmeditorview.h
branchRCL_3
changeset 63 d189ee25cf9d
equal deleted inserted replaced
61:dcf0eedfc1a3 63:d189ee25cf9d
       
     1 /*
       
     2 * Copyright (c) 2009 - 2010 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: Message editor view
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef NMEDITORVIEW_H_
       
    19 #define NMEDITORVIEW_H_
       
    20 
       
    21 #include <QPointer>
       
    22 
       
    23 #include "nmbaseview.h"
       
    24 #include "nmactionobserver.h"
       
    25 #include "nmactionresponse.h"
       
    26 #include "nmattachmentfetchobserver.h"
       
    27 
       
    28 class HbTextEdit;
       
    29 class HbDocumentLoader;
       
    30 class HbProgressDialog;
       
    31 class HbWidget;
       
    32 class NmBaseViewScrollArea;
       
    33 class NmApplication;
       
    34 class NmUiEngine;
       
    35 class NmUiStartParam;
       
    36 class NmMessage;
       
    37 class NmEditorContent;
       
    38 class NmEditorTextEdit;
       
    39 class NmEditorHeader;
       
    40 class NmAction;
       
    41 class NmOperation;
       
    42 class NmMessageCreationOperation;
       
    43 class NmAddAttachmentsOperation;
       
    44 class NmAttachmentPicker;
       
    45 class HbMessageBox;
       
    46 class NmAttachmentManager;
       
    47 class HbVkbHost;
       
    48 class HbListWidget;
       
    49 
       
    50 class NmEditorView : public NmBaseView,
       
    51                      public NmActionObserver,
       
    52                      public NmAttachmentFetchObserver
       
    53 {
       
    54     Q_OBJECT
       
    55 
       
    56 public:
       
    57     NmEditorView(NmApplication &application,
       
    58                  NmUiStartParam *startParam,
       
    59                  NmUiEngine &uiEngine,
       
    60                  NmAttachmentManager &attaManager,
       
    61                  QGraphicsItem *parent = 0);
       
    62     ~NmEditorView();
       
    63 
       
    64 
       
    65 public:
       
    66     void reloadViewContents(NmUiStartParam* startParam);
       
    67     NmUiViewId nmailViewId() const;
       
    68     HbWidget* scrollAreaContents();
       
    69     void okToExitView();
       
    70     void aboutToExitView();
       
    71     void viewReady();
       
    72     void handleActionCommand(NmActionResponse &menuResponse);
       
    73     void progressChanged(int value);
       
    74     void fetchCompleted(int result);
       
    75     
       
    76 public slots:
       
    77     void orientationChanged(Qt::Orientation orientation);
       
    78     void createOptionsMenu();
       
    79     void setButtonsDimming(bool enabled);
       
    80     void attachmentLongPressed(NmId attachmentPartId, QPointF point);
       
    81     void invalidAddressQuery(HbAction* action);
       
    82     void okToExitQuery(HbAction* action);
       
    83     void sendProgressDialogCancelled();
       
    84     void safeToDraft();
       
    85     
       
    86 protected:
       
    87     void resizeEvent(QGraphicsSceneResizeEvent *event);
       
    88 
       
    89 private slots:
       
    90     void messageCreated(int result);
       
    91     void oneAttachmentAdded(const QString &fileName,
       
    92                             const NmId &msgPartId,
       
    93                             int result);
       
    94     void allAttachmentsAdded(int result);
       
    95     void attachmentRemoved(int result);
       
    96     void removeAttachmentTriggered();
       
    97     void handleSendOperationCompleted();
       
    98     void openAttachmentTriggered( NmId attachmentId );  
       
    99     void onAttachmentReqCompleted(const QVariant &value);
       
   100     void onAttachmentsFetchError(int errorCode, const QString& errorMessage);
       
   101     void switchCcBccFieldVisibility();
       
   102 	void fetchProgressDialogCancelled();
       
   103 	void vkbOpened();
       
   104 	void vkbClosed();
       
   105 
       
   106 private:
       
   107     void loadViewLayout();
       
   108     void setMailboxName();
       
   109     void fetchProgressDialogShow();
       
   110     void fetchMessageIfNeeded(NmUiStartParam &startParam);
       
   111     void startMessageCreation(NmUiStartParam &startParam);
       
   112     void startSending();
       
   113     void finalizeSending();
       
   114     void createToolBar();
       
   115     void updateMessageWithEditorContents();
       
   116     void fillEditorWithMessageContents();
       
   117     void initializeVKB();
       
   118     QString addSubjectPrefix(NmUiEditorStartMode startMode, const QString &subject);
       
   119     void addAttachments(const QStringList &fileNames);
       
   120     void setPriority(NmActionResponseCommand priority);
       
   121     QString addressListToString(const QList<NmAddress*> &list) const;
       
   122     QString addressListToString(const QList<NmAddress> &list) const;
       
   123     void enableToolBarAttach(bool enable);
       
   124     void showChrome(bool show);
       
   125 
       
   126 signals:
       
   127     void sizeChanged();
       
   128     
       
   129 private: // Data
       
   130     NmApplication &mApplication;
       
   131     NmUiEngine &mUiEngine;
       
   132     NmAttachmentManager  &mAttaManager;
       
   133     HbDocumentLoader *mDocumentLoader;  // Owned
       
   134     QObjectList mWidgetList;            // Owned
       
   135     NmEditorHeader *mHeaderWidget;      // Not owned
       
   136     NmMessage *mMessage;                // Owned
       
   137     NmEditorContent *mContent;          // Not owned
       
   138     HbMenu *mPrioritySubMenu;           // Owned
       
   139     HbMenu *mAttachmentListContextMenu; // Owned
       
   140     NmId mSelectedAttachment;
       
   141     HbVkbHost *mVkbHost;                // Not owned
       
   142     QPointer<NmMessageCreationOperation> mMessageCreationOperation;  // Not owned
       
   143     QPointer<NmAddAttachmentsOperation> mAddAttachmentOperation;     // Not owned 
       
   144     QPointer<NmOperation> mRemoveAttachmentOperation;                // Not owned 
       
   145     HbProgressDialog *mWaitDialog;         // Owned.    
       
   146     HbMessageBox* mQueryDialog;            // Owned
       
   147     NmAttachmentPicker* mAttachmentPicker; // Owned    
       
   148     bool mCcBccFieldVisible;
       
   149     QPointer<HbProgressDialog> mServiceSendingDialog; // Owned.
       
   150     HbListWidget *mTBExtnContentWidget;		// Owned
       
   151     QString mHiddenPriorityName;
       
   152 };
       
   153 
       
   154 
       
   155 #endif /* NMEDITORVIEW_H_ */