64
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2008 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: Freestyle Email header file
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef FSSETTINGSSYNCLIST_H
|
|
19 |
#define FSSETTINGSSYNCLIST_H
|
|
20 |
|
|
21 |
// SYSTEM INCLUDES
|
|
22 |
#include <coecntrl.h>
|
|
23 |
#include <e32cmn.h>
|
|
24 |
#include "mfsmailrequestobserver.h"
|
|
25 |
#include <AknWaitDialog.h>
|
|
26 |
#include <aknlongtapdetector.h>
|
|
27 |
|
|
28 |
// FORWARD DECLARATIONS
|
|
29 |
class CFSMailClient;
|
|
30 |
class CAknSingleGraphicStyleListBox;
|
|
31 |
class CEikTextListBox;
|
|
32 |
class TFSMailMsgId;
|
|
33 |
class CFSMailBox;
|
|
34 |
class CFreestyleEmailUiAppUi;
|
|
35 |
|
|
36 |
typedef CAknSingleGraphicStyleListBox CSettingsListType;
|
|
37 |
|
|
38 |
|
|
39 |
/**
|
|
40 |
* Container class for CFsEmailSettingsList
|
|
41 |
*
|
|
42 |
* @class CFsEmailSettingsList
|
|
43 |
*/
|
|
44 |
class CFsEmailSettingsList :
|
|
45 |
public CCoeControl,
|
|
46 |
public MEikListBoxObserver,
|
|
47 |
public MFSMailRequestObserver,
|
|
48 |
public MProgressDialogCallback,
|
|
49 |
public MAknLongTapDetectorCallBack
|
|
50 |
{
|
|
51 |
public: // Constructors and destructor.
|
|
52 |
|
|
53 |
static CFsEmailSettingsList* NewL(
|
|
54 |
const TRect& aRect,
|
|
55 |
const CCoeControl* aParent,
|
|
56 |
CFreestyleEmailUiAppUi& aAppUi,
|
|
57 |
CFSMailClient& aMailClient,
|
|
58 |
CFsEmailSettingsListView& aView );
|
|
59 |
|
|
60 |
static CFsEmailSettingsList* NewLC(
|
|
61 |
const TRect& aRect,
|
|
62 |
const CCoeControl* aParent,
|
|
63 |
CFreestyleEmailUiAppUi& aAppUi,
|
|
64 |
CFSMailClient& aMailClient,
|
|
65 |
CFsEmailSettingsListView& aView );
|
|
66 |
|
|
67 |
virtual ~CFsEmailSettingsList();
|
|
68 |
|
|
69 |
|
|
70 |
private: // Construction.
|
|
71 |
|
|
72 |
void ConstructL( const TRect& aRect, const CCoeControl* aParent);
|
|
73 |
|
|
74 |
CFsEmailSettingsList( CFreestyleEmailUiAppUi& aAppUi,
|
|
75 |
CFSMailClient& aMailClient,
|
|
76 |
CFsEmailSettingsListView& aView );
|
|
77 |
|
|
78 |
|
|
79 |
public: // From base class CCoeControl.
|
|
80 |
|
|
81 |
TInt CountComponentControls() const;
|
|
82 |
|
|
83 |
CCoeControl* ComponentControl( TInt aIndex ) const;
|
|
84 |
|
|
85 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
|
|
86 |
TEventCode aType );
|
|
87 |
|
|
88 |
void HandleResourceChange( TInt aType );
|
|
89 |
|
|
90 |
void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
|
91 |
|
|
92 |
void AddAccountL();
|
|
93 |
|
|
94 |
/**
|
|
95 |
* If confirmed by the user, will delete a mailbox.
|
|
96 |
* @return True if a mailbox was deleted, false otherwise.
|
|
97 |
*/
|
|
98 |
TBool RemoveAccountL();
|
|
99 |
|
|
100 |
void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
|
|
101 |
|
|
102 |
TBool PIMSyncItemVisible();
|
|
103 |
|
|
104 |
|
|
105 |
public: // From MAknLongTapDetectorCallBack.
|
|
106 |
|
|
107 |
void HandleLongTapEventL( const TPoint& aPenEventLocation,
|
|
108 |
const TPoint& aPenEventScreenLocation );
|
|
109 |
|
|
110 |
|
|
111 |
public: // New methods.
|
|
112 |
|
|
113 |
CSettingsListType* ListBox();
|
|
114 |
|
|
115 |
static HBufC* CreateListBoxItemLC(
|
|
116 |
const TDesC& aMainText );
|
|
117 |
|
|
118 |
static HBufC* CreateListBoxItemLC(
|
|
119 |
const TDesC& aMainText,
|
|
120 |
TInt aIconNum );
|
|
121 |
|
|
122 |
// insert needed icons to list box
|
|
123 |
void SetupListBoxIconsL();
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Fills list with mailbox names given by fs mail client
|
|
127 |
*/
|
|
128 |
void CreateAccountListL();
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Displays mailbox create query if needed
|
|
132 |
*/
|
|
133 |
void DisplayCreateMailboxNoteIfNeededL();
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Fills list with captions given by settings plugin
|
|
137 |
*/
|
|
138 |
void CreatePluginSubviewListL( const TUid& aPluginId );
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Fills list with captions given by settings plugin
|
|
142 |
*/
|
|
143 |
void CreatePluginPIMListL( const TUid& aPluginId );
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Sets specific mailbox protocol icon by given id
|
|
147 |
*/
|
|
148 |
void ProtocolBrandingIconL( TFSMailMsgId aMailBoxId );
|
|
149 |
|
|
150 |
// list content commands
|
|
151 |
void ClearListL();
|
|
152 |
void AppendItemL( TDesC& aListItem );
|
|
153 |
TInt Count();
|
|
154 |
|
|
155 |
/**
|
|
156 |
* list content will be drawn with captions
|
|
157 |
* received from settings plugin or
|
|
158 |
* mailboxes received from mailclient
|
|
159 |
*
|
|
160 |
* returns True if captions list
|
|
161 |
* return False if mailbox list
|
|
162 |
*/
|
|
163 |
TBool Get2ndLevelListIndicator();
|
|
164 |
|
|
165 |
// handle user navigation
|
|
166 |
void HandleUserSelectionsL();
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Retuns specific mailbox by given index
|
|
170 |
* Ownership tranferred
|
|
171 |
*/
|
|
172 |
CFSMailBox* GetMailboxByIndexLC( const TInt& aIndex ) const;
|
|
173 |
|
|
174 |
// get count of mailboxes in fs mailclient
|
|
175 |
TInt GetMailboxCountL() const;
|
|
176 |
|
|
177 |
/**
|
|
178 |
* Retuns specific mailbox by given id
|
|
179 |
* Ownership tranferred or NULL
|
|
180 |
*/
|
|
181 |
CFSMailBox* GetMailBoxByIdL( const TUint& aMailboxId ) const;
|
|
182 |
|
|
183 |
// set account info member data from selected mailbox
|
|
184 |
void SetSelectedAccountInfo( const TFSMailMsgId& aAccountInfo );
|
|
185 |
|
|
186 |
// set private settings plugin Uid to given value
|
|
187 |
void SetPluginSettingsUid( const TUid& aPluginId );
|
|
188 |
|
|
189 |
// activate selected sub view from plugin
|
|
190 |
void ActivateMailSettingsPluginSubViewL( TInt aSubViewId );
|
|
191 |
|
|
192 |
// open dialog with PIM service items
|
|
193 |
void OpenPIMServiceDialogL();
|
|
194 |
|
|
195 |
/**
|
|
196 |
* returns needed settings plugin instance from view stack
|
|
197 |
* or creates new one add it to view stack and return pointer
|
|
198 |
* Ownership is not transferred
|
|
199 |
*/
|
|
200 |
CESMailSettingsPlugin* GetSettingsPluginL( TUid aUid );
|
|
201 |
|
|
202 |
// set subview list index to given value
|
|
203 |
void SetSelectedSubListIndex( TInt aIndex );
|
|
204 |
|
|
205 |
// set main list index in parent
|
|
206 |
void SetSelectedMainListIndex( TInt aIndex );
|
|
207 |
|
|
208 |
// get main list index from parent
|
|
209 |
TInt GetSelectedMainListIndex() const;
|
|
210 |
|
|
211 |
// This sets the flag that informs that we are in the personal information management subview
|
|
212 |
void SetPimListActivation(TBool aActivation);
|
|
213 |
|
|
214 |
// Creates and passes ownership of title pane text appropriate for the current view
|
|
215 |
HBufC* CreateTitlePaneTextLC() const;
|
|
216 |
|
|
217 |
void GoToTop();
|
|
218 |
void GoToBottom();
|
|
219 |
|
|
220 |
void PageUp();
|
|
221 |
void PageDown();
|
|
222 |
|
|
223 |
/**
|
|
224 |
* Used to check if the currently selected item is a mailbox.
|
|
225 |
* @param True if the selected item is a mailbox. False otherwise.
|
|
226 |
*/
|
|
227 |
TBool SelectedItemIsMailbox() const;
|
|
228 |
|
|
229 |
/**
|
|
230 |
* Removes the focus.
|
|
231 |
*/
|
|
232 |
void ClearFocus();
|
|
233 |
|
|
234 |
|
|
235 |
public:
|
|
236 |
|
|
237 |
enum TControls
|
|
238 |
{
|
|
239 |
EListBox,
|
|
240 |
ELastControl
|
|
241 |
};
|
|
242 |
enum TListBoxImages
|
|
243 |
{
|
|
244 |
EListBoxFirstUserImageIndex
|
|
245 |
};
|
|
246 |
|
|
247 |
|
|
248 |
protected: // From base class CCoeControl.
|
|
249 |
|
|
250 |
void SizeChanged();
|
|
251 |
|
|
252 |
|
|
253 |
protected: // From MProgressDialogCallback.
|
|
254 |
|
|
255 |
void DialogDismissedL( TInt aButtonId );
|
|
256 |
|
|
257 |
|
|
258 |
private: // From base class CCoeControl.
|
|
259 |
|
|
260 |
void Draw( const TRect& aRect ) const;
|
|
261 |
|
|
262 |
|
|
263 |
private:
|
|
264 |
|
|
265 |
void HandleListBoxEventL( CEikListBox *aListBox, TListBoxEvent aEventType );
|
|
266 |
void InitializeControlsL();
|
|
267 |
void LayoutControls();
|
|
268 |
void LoadAccountsToListL();
|
|
269 |
void SetDefaultPIMAccountL();
|
|
270 |
TPtrC GetMailBoxNameL( const CFSMailBox& aMailBox ) const;
|
|
271 |
|
|
272 |
|
|
273 |
private: // Data.
|
|
274 |
|
|
275 |
enum TFsEmailSettingsSubViewType
|
|
276 |
{
|
|
277 |
EFsEmailSettingsMainListView,
|
|
278 |
EFsEmailSettingsMailboxView,
|
|
279 |
EFsEmailSettingsPimView
|
|
280 |
};
|
|
281 |
|
|
282 |
TFsEmailSettingsSubViewType iCurrentSubView;
|
|
283 |
CSettingsListType* iListBox;
|
|
284 |
CFreestyleEmailUiAppUi& iAppUi;
|
|
285 |
CCoeControl* iFocusControl;
|
|
286 |
CAknLongTapDetector* iLongTapDetector;
|
|
287 |
CFSMailClient& iMailClient;
|
|
288 |
TFSMailMsgId iSelectedAccountInfo;
|
|
289 |
TUid iSelectedPluginSettings;
|
|
290 |
TInt iPIMSyncMailboxIndex;
|
|
291 |
TBool iPIMListActivation;
|
|
292 |
TBool iPIMServiceSettingsSelection;
|
|
293 |
CAknWaitDialog* iWaitDialog;
|
|
294 |
TInt iMailboxCount;
|
|
295 |
TInt iDeleteMailboxId;
|
|
296 |
TInt iDeletedIndex;
|
|
297 |
TInt iPIMSyncCount;
|
|
298 |
TInt iSelectedSubListIndex;
|
|
299 |
CFsEmailSettingsListView& iView;
|
|
300 |
TBool iLongTapEventConsumed;
|
|
301 |
|
|
302 |
// Used to properly handle taps. First tap highlights an item on the
|
|
303 |
// settings list, second tap selects the item.
|
|
304 |
TInt iPrevSelected;
|
|
305 |
};
|
|
306 |
|
|
307 |
|
|
308 |
#endif // FSSETTINGSSYNCLIST_H
|