|
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 "nmbaseview.h" |
|
22 #include "nmactionobserver.h" |
|
23 #include "nmactionresponse.h" |
|
24 |
|
25 class QGraphicsLinearLayout; |
|
26 class HbTextEdit; |
|
27 class HbDocumentLoader; |
|
28 class HbWidget; |
|
29 class NmBaseViewScrollArea; |
|
30 class NmApplication; |
|
31 class NmUiEngine; |
|
32 class NmUiStartParam; |
|
33 class NmMessage; |
|
34 class NmEditorContent; |
|
35 class NmEditorTextEdit; |
|
36 class NmEditorHeader; |
|
37 class NmAction; |
|
38 class NmOperation; |
|
39 class NmMessageCreationOperation; |
|
40 class NmAddAttachmentsOperation; |
|
41 class NmCheckOutboxOperation; |
|
42 |
|
43 |
|
44 class NmEditorView : public NmBaseView, public NmActionObserver |
|
45 { |
|
46 Q_OBJECT |
|
47 |
|
48 public: |
|
49 |
|
50 NmEditorView(NmApplication &application, |
|
51 NmUiStartParam* startParam, |
|
52 NmUiEngine &uiEngine, |
|
53 QGraphicsItem *parent = 0); |
|
54 ~NmEditorView(); |
|
55 |
|
56 |
|
57 public: |
|
58 |
|
59 void reloadViewContents(NmUiStartParam* startParam); |
|
60 NmUiViewId nmailViewId() const; |
|
61 HbWidget* scrollAreaContents(); |
|
62 bool okToExitView(); |
|
63 void aboutToExitView(); |
|
64 |
|
65 |
|
66 public slots: |
|
67 |
|
68 void orientationChanged(Qt::Orientation orientation); |
|
69 void createOptionsMenu(); |
|
70 void setButtonsDimming(bool enabled); |
|
71 |
|
72 |
|
73 public: // From NmActionObserver |
|
74 |
|
75 void handleActionCommand(NmActionResponse &menuResponse); |
|
76 |
|
77 |
|
78 private slots: |
|
79 |
|
80 void messageCreated(int result); |
|
81 void adjustViewDimensions(); |
|
82 void oneAttachmentAdded(const QString &fileName, |
|
83 const NmId &msgPartId, |
|
84 int result); |
|
85 |
|
86 void allAttachmentsAdded(int result); |
|
87 void outboxChecked(int result); |
|
88 void removeAttachment(const NmId attachmentPartId); |
|
89 |
|
90 #ifdef Q_OS_SYMBIAN |
|
91 void onAttachmentReqCompleted(const QVariant &value); |
|
92 void attachImage(); |
|
93 #endif |
|
94 |
|
95 |
|
96 private: |
|
97 |
|
98 void loadViewLayout(); |
|
99 void setMailboxName(); |
|
100 void setMessageData(); |
|
101 void startMessageCreation(NmUiEditorStartMode startMode); |
|
102 void startSending(); |
|
103 void createToolBar(); |
|
104 QPointF viewCoordinateToEditCoordinate(QPointF orgPoint); |
|
105 void updateMessageWithEditorContents(); |
|
106 void fillEditorWithMessageContents(); |
|
107 void initializeVKB(); |
|
108 QString addSubjectPrefix(NmUiEditorStartMode startMode, const QString &subject); |
|
109 void addAttachments(const QStringList &fileNames); |
|
110 void setPriority(NmActionResponseCommand priority); |
|
111 QString addressListToString(const QList<NmAddress*> &list) const; |
|
112 QString addressListToString(const QList<NmAddress> &list) const; |
|
113 |
|
114 |
|
115 public slots: |
|
116 |
|
117 void sendMousePressEventToScroll(QGraphicsSceneMouseEvent *event); |
|
118 void sendMouseReleaseEventToScroll(QGraphicsSceneMouseEvent *event); |
|
119 void sendMouseMoveEventToScroll(QGraphicsSceneMouseEvent *event); |
|
120 void sendLongPressGesture(const QPointF &point); |
|
121 |
|
122 |
|
123 private: // Data |
|
124 |
|
125 NmApplication &mApplication; |
|
126 NmUiEngine &mUiEngine; |
|
127 HbDocumentLoader *mDocumentLoader; // Owned |
|
128 QObjectList mWidgetList; // Owned |
|
129 NmBaseViewScrollArea *mScrollArea; // Not owned |
|
130 HbWidget *mScrollAreaContents; // Not owned |
|
131 NmEditorTextEdit *mEditWidget; // Not owned |
|
132 NmEditorHeader *mHeaderWidget; // Not owned |
|
133 NmMessage *mMessage; // Owned |
|
134 NmEditorContent *mContentWidget; // Owned |
|
135 HbMenu *mPrioritySubMenu; // Owned |
|
136 HbMenu *mAttachContextMenu; // Owned |
|
137 |
|
138 NmMessageCreationOperation *mMessageCreationOperation; // Owned |
|
139 NmAddAttachmentsOperation *mAddAttachmentOperation; // Owned |
|
140 NmOperation *mRemoveAttachmentOperation; // Owned |
|
141 NmCheckOutboxOperation *mCheckOutboxOperation; // Owned |
|
142 }; |
|
143 |
|
144 |
|
145 #endif /* NMEDITORVIEW_H_ */ |