|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef NMUIVIEWIDS_H_ |
|
19 #define NMUIVIEWIDS_H_ |
|
20 |
|
21 #include <qalgorithms.h> // For qDeleteAll(). |
|
22 #include <QStringList> |
|
23 #include "nmcommon.h" |
|
24 #include "nmaddress.h" |
|
25 |
|
26 |
|
27 enum NmUiViewId |
|
28 { |
|
29 NmUiViewNone = 0, // Used to reset view stack |
|
30 NmUiViewMailboxList, // Mailbox list view |
|
31 NmUiViewMessageList, // Message list view of a folder |
|
32 NmUiViewMessageSearchList, // Message search list view |
|
33 NmUiViewMessageViewer, // Message view of an email message |
|
34 NmUiViewMessageEditor // Message editor |
|
35 }; |
|
36 |
|
37 enum NmUiEditorStartMode |
|
38 { |
|
39 NmUiEditorCreateNew = 0, |
|
40 NmUiEditorReply, |
|
41 NmUiEditorReplyAll, |
|
42 NmUiEditorForward, |
|
43 NmUiEditorMailto, |
|
44 NmUiEditorFromDrafts |
|
45 }; |
|
46 |
|
47 |
|
48 /*! |
|
49 \class NmUiStartParam |
|
50 \brief NmUi start parameter class, contains general info about view. |
|
51 |
|
52 Use this class to start different views of the application. |
|
53 Mailbox list activation: Use default values. |
|
54 Message list activation: NmUiViewMessageList + mailboxId + folderId |
|
55 Message viewer activation: NmUiViewMessageViewer + mailboxId + folderId + messageId |
|
56 Message editor activation: NmUiViewMessageEditor + mailboxId + messageId + editorStartMode |
|
57 |
|
58 For new message to mailto addresses startup, use NmUiEditorMailto and set |
|
59 address list ownership of mailto address list is transferred to |
|
60 NmUiStartParam object |
|
61 */ |
|
62 class NmUiStartParam |
|
63 { |
|
64 public: |
|
65 |
|
66 inline explicit NmUiStartParam(NmUiViewId viewId = NmUiViewMailboxList, |
|
67 NmId mailboxId = 0, |
|
68 NmId folderId = 0, |
|
69 NmId messageId = 0, |
|
70 NmUiEditorStartMode editorStartMode = NmUiEditorCreateNew, |
|
71 QList<NmAddress*> *mailtoAddresses = NULL, |
|
72 QStringList *attachmentList = NULL, |
|
73 bool service = false, |
|
74 QString *subject = NULL, |
|
75 QList<NmAddress*> *ccAddressList = NULL, |
|
76 QList<NmAddress*> *bccAddressList = NULL) |
|
77 { |
|
78 mViewId = viewId; |
|
79 mMailboxId = mailboxId; |
|
80 mFolderId = folderId; |
|
81 mMessageId = messageId; |
|
82 mEditorStartMode = editorStartMode; |
|
83 mMailtoAddressList = mailtoAddresses; |
|
84 mAttachmentList = attachmentList; |
|
85 mService = service; |
|
86 mSubject = subject; |
|
87 mCcAddressList = ccAddressList; |
|
88 mBccAddressList = bccAddressList; |
|
89 } |
|
90 |
|
91 inline ~NmUiStartParam() |
|
92 { |
|
93 if (mMailtoAddressList) { |
|
94 qDeleteAll(*mMailtoAddressList); |
|
95 delete mMailtoAddressList; |
|
96 } |
|
97 |
|
98 if (mAttachmentList) { |
|
99 delete mAttachmentList; |
|
100 } |
|
101 |
|
102 if (mSubject) { |
|
103 delete mSubject; |
|
104 } |
|
105 |
|
106 if (mCcAddressList) { |
|
107 qDeleteAll(*mCcAddressList); |
|
108 delete mCcAddressList; |
|
109 } |
|
110 |
|
111 if (mBccAddressList) { |
|
112 qDeleteAll(*mBccAddressList); |
|
113 delete mBccAddressList; |
|
114 } |
|
115 } |
|
116 |
|
117 inline NmUiViewId viewId() |
|
118 { |
|
119 return mViewId; |
|
120 } |
|
121 |
|
122 inline NmId mailboxId() |
|
123 { |
|
124 return mMailboxId; |
|
125 } |
|
126 |
|
127 inline NmId folderId() |
|
128 { |
|
129 return mFolderId; |
|
130 } |
|
131 |
|
132 inline NmId messageId() |
|
133 { |
|
134 return mMessageId; |
|
135 } |
|
136 |
|
137 inline NmUiEditorStartMode editorStartMode() |
|
138 { |
|
139 return mEditorStartMode; |
|
140 } |
|
141 |
|
142 inline QList<NmAddress*> &mailtoAddressList() |
|
143 { |
|
144 if (!mMailtoAddressList) { |
|
145 mMailtoAddressList = new QList<NmAddress*>(); |
|
146 } |
|
147 |
|
148 return *mMailtoAddressList; |
|
149 } |
|
150 |
|
151 inline QStringList *attachmentList() |
|
152 { |
|
153 return mAttachmentList; |
|
154 } |
|
155 |
|
156 inline bool service() |
|
157 { |
|
158 return mService; |
|
159 } |
|
160 |
|
161 inline QString *subject() |
|
162 { |
|
163 return mSubject; |
|
164 } |
|
165 |
|
166 inline QList<NmAddress*> &ccAddressList() |
|
167 { |
|
168 if (!mCcAddressList) { |
|
169 mCcAddressList = new QList<NmAddress*>(); |
|
170 } |
|
171 |
|
172 return *mCcAddressList; |
|
173 } |
|
174 |
|
175 inline QList<NmAddress*> &bccAddressList() |
|
176 { |
|
177 if (!mBccAddressList) { |
|
178 mBccAddressList = new QList<NmAddress*>(); |
|
179 } |
|
180 |
|
181 return *mBccAddressList; |
|
182 } |
|
183 |
|
184 inline void setMailboxId(NmId mailboxId) |
|
185 { |
|
186 mMailboxId = mailboxId; |
|
187 } |
|
188 |
|
189 inline void setFolderId(NmId folderId) |
|
190 { |
|
191 mFolderId = folderId; |
|
192 } |
|
193 |
|
194 inline void setMessageId(NmId messageId) |
|
195 { |
|
196 mMessageId = messageId; |
|
197 } |
|
198 |
|
199 private: // Data |
|
200 |
|
201 NmUiViewId mViewId; |
|
202 NmId mMailboxId; |
|
203 NmId mFolderId; |
|
204 NmId mMessageId; |
|
205 NmUiEditorStartMode mEditorStartMode; |
|
206 QList<NmAddress*> *mMailtoAddressList; // owned |
|
207 QStringList *mAttachmentList; // owned |
|
208 bool mService; |
|
209 QString *mSubject; // owned |
|
210 QList<NmAddress*> *mCcAddressList; // owned |
|
211 QList<NmAddress*> *mBccAddressList; // owned |
|
212 }; |
|
213 |
|
214 |
|
215 #endif /* NMUIVIEWIDS_H_ */ |
|
216 |
|
217 // End of file. |