|
1 /* |
|
2 * Copyright (c) 2006 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: IMSSettingsDialog.cpp |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32base.h> |
|
22 #include <avkon.hrh> |
|
23 #include <muiuflagger.h> |
|
24 #include <ImumUtils.rsg> |
|
25 #include <miutset.h> // CImBaseEmailSettings |
|
26 #include <smtpset.h> // CImSmtpSettings |
|
27 #include <pop3set.h> // CImPop3Settings |
|
28 #include <imapset.h> // CImImap4Settings |
|
29 #include <iapprefs.h> // CImIAPPreferences |
|
30 #include <AknQueryDialog.h> // CAknMultiLineDataQueryDialog |
|
31 #include <charconv.h> // CCnvCharacterSetConverter |
|
32 #include <aknradiobuttonsettingpage.h> // CAknRadioButtonSettingPage |
|
33 #include <muiu_internal.rsg> |
|
34 #include <AknUtils.h> //AknTextUtils |
|
35 #include "ComDbUtl.h" |
|
36 |
|
37 #include <cmapplicationsettingsui.h> |
|
38 |
|
39 #include "ImumInternalApiImpl.h" |
|
40 #include "ImumMboxSymbianDataConverter.h" |
|
41 #include "ImumMboxInternalDataConverter.h" |
|
42 #include "EmailFeatureUtils.h" |
|
43 #include "Imas.hrh" |
|
44 #include "ImumInSettingsData.h" |
|
45 #include "IMSSettingsDialog.h" |
|
46 #include "IMSSettingsNoteUi.h" |
|
47 #include "IMSFolderSubscription.h" |
|
48 #include "ImumUtilsLogging.h" |
|
49 #include <csxhelp/mbxs.hlp.hrh> |
|
50 #include "ImumPanic.h" |
|
51 #include "ImumInSettingsData.h" |
|
52 #include "ImumConstants.h" |
|
53 |
|
54 // EXTERNAL DATA STRUCTURES |
|
55 // EXTERNAL FUNCTION PROTOTYPES |
|
56 // CONSTANTS |
|
57 const TInt KIMASEveryDayMask = 0x7f; |
|
58 const TInt KIMSDefaultSizeKB = 1; |
|
59 const TInt KIMSMaxNumValue = 999; |
|
60 |
|
61 enum TIMSRetrieveLimit |
|
62 { |
|
63 EIMSLimitFetchAll = 0, |
|
64 EIMSLimitUserDefined |
|
65 }; |
|
66 |
|
67 // MACROS |
|
68 #define DFILLBUF( a, b ) buffer.Copy( a.Left( b ) ) |
|
69 #define DITEM( a ) ( *array )[a].iItem |
|
70 |
|
71 // LOCAL CONSTANTS AND MACROS |
|
72 // MODULE DATA STRUCTURES |
|
73 typedef CCnvCharacterSetConverter::SCharacterSet CIMACharConvItem; |
|
74 typedef CArrayFix<CIMACharConvItem> CIMACharConvList; |
|
75 |
|
76 // LOCAL FUNCTION PROTOTYPES |
|
77 // FORWARD DECLARATIONS |
|
78 |
|
79 // ============================ MEMBER FUNCTIONS =============================== |
|
80 |
|
81 /****************************************************************************** |
|
82 |
|
83 Constructors & Destructor |
|
84 |
|
85 ******************************************************************************/ |
|
86 |
|
87 // ---------------------------------------------------------------------------- |
|
88 // CIMSSettingsDialog::CIMSSettingsDialog() |
|
89 // ---------------------------------------------------------------------------- |
|
90 CIMSSettingsDialog::CIMSSettingsDialog( |
|
91 CIMSSettingsUi& aDialog, |
|
92 CImumInternalApiImpl& aMailboxApi, |
|
93 CEikFormattedCellListBox& aListBox, |
|
94 CAknTitlePane& aTitlePane, |
|
95 CMuiuFlags& aFlags ) |
|
96 : |
|
97 CIMSSettingsBaseUI( |
|
98 aDialog, aMailboxApi, aListBox, |
|
99 aTitlePane, aFlags ), |
|
100 iInitArray( NULL ), |
|
101 iInitSetFlag( EDialogLastFlag ), |
|
102 iInitCurrentIndex( KErrNotFound ), |
|
103 iInitResource( 0 ) |
|
104 { |
|
105 IMUM_CONTEXT( CIMSSettingsDialog::CIMSSettingsDialog, 0, KLogUi ); |
|
106 |
|
107 } |
|
108 |
|
109 // ---------------------------------------------------------------------------- |
|
110 // CIMSSettingsDialog::ConstructL() |
|
111 // ---------------------------------------------------------------------------- |
|
112 // |
|
113 void CIMSSettingsDialog::ConstructL( |
|
114 CEikButtonGroupContainer& aSoftkeys, |
|
115 CImumInSettingsData& aMailboxSettings ) |
|
116 { |
|
117 IMUM_CONTEXT( CIMSSettingsDialog::ConstructL, 0, KLogUi ); |
|
118 |
|
119 iIdle = CIdle::NewL( CActive::EPriorityHigh ); |
|
120 |
|
121 // Add the complete menu tree to settings |
|
122 BaseUiConstructL( aSoftkeys, R_IMAS_MAIN_MENU, ETrue ); |
|
123 |
|
124 // Clear the flags |
|
125 for ( TInt flag = EDialogLastFlag; --flag >= 0; ) |
|
126 { |
|
127 Flag( flag ); |
|
128 } |
|
129 |
|
130 // Create default data set |
|
131 iAccountSettings = |
|
132 CImumMboxSymbianDataConverter::ConvertToSymbianMboxDataLC( |
|
133 iMailboxApi, aMailboxSettings ); |
|
134 CleanupStack::Pop( iAccountSettings ); |
|
135 |
|
136 // Set always online flag |
|
137 ChangeFlag( EDialogAlwaysOnlineOn, |
|
138 iAccountSettings->iExtendedSettings->AlwaysOnlineState() != |
|
139 EMailAoOff ); |
|
140 |
|
141 // Set mail message notification flag |
|
142 ChangeFlag( EDialogOmaEmnOn, |
|
143 iAccountSettings->iExtendedSettings->EmailNotificationState() != |
|
144 EMailEmnOff ); |
|
145 |
|
146 // Prepare the init arrays |
|
147 iInitTreeArray = |
|
148 new ( ELeave ) CMuiuDynInitItemIdArray( KMuiuDynArrayGranularity ); |
|
149 iInitIdArray = |
|
150 new ( ELeave ) CMuiuDynInitItemIdArray( KMuiuDynArrayGranularity ); |
|
151 iInitValueArray = |
|
152 new ( ELeave ) CMuiuDynInitItemValueArray( |
|
153 KMuiuDynArrayGranularity ); |
|
154 iInitTextArray = |
|
155 new ( ELeave ) CMuiuDynInitItemTextArray( |
|
156 KMuiuDynArrayGranularity ); |
|
157 iInitInfoArray = |
|
158 new ( ELeave ) CMuiuDynInitInfoArray( KMuiuDynArrayGranularity ); |
|
159 |
|
160 // The main menu is about to open, so initialize it |
|
161 InitializeArrayMainMenu(); |
|
162 |
|
163 // Set the titlepane text |
|
164 SetTitlePaneTextL( iAccountSettings->iName, ETrue ); |
|
165 } |
|
166 |
|
167 // ---------------------------------------------------------------------------- |
|
168 // CIMSSettingsDialog::~CIMSSettingsDialog() |
|
169 // ---------------------------------------------------------------------------- |
|
170 // |
|
171 CIMSSettingsDialog::~CIMSSettingsDialog() |
|
172 { |
|
173 IMUM_CONTEXT( CIMSSettingsDialog::~CIMSSettingsDialog, 0, KLogUi ); |
|
174 |
|
175 delete iItemApprover; |
|
176 iItemApprover = NULL; |
|
177 delete iInitArray; |
|
178 iInitArray = NULL; |
|
179 delete iTempText; |
|
180 iTempText = NULL; |
|
181 delete iInitTreeArray; |
|
182 iInitTreeArray = NULL; |
|
183 delete iInitIdArray; |
|
184 iInitIdArray = NULL; |
|
185 delete iInitValueArray; |
|
186 iInitValueArray = NULL; |
|
187 delete iInitInfoArray; |
|
188 iInitInfoArray = NULL; |
|
189 |
|
190 if ( iInitTextArray ) |
|
191 { |
|
192 iInitTextArray->ResetAndDestroy(); |
|
193 } |
|
194 |
|
195 delete iInitTextArray; |
|
196 iInitTextArray = NULL; |
|
197 delete iAccountSettings; |
|
198 iAccountSettings = NULL; |
|
199 delete iIdle; |
|
200 } |
|
201 |
|
202 // ---------------------------------------------------------------------------- |
|
203 // CIMSSettingsDialog::NewL() |
|
204 // ---------------------------------------------------------------------------- |
|
205 // |
|
206 CIMSSettingsDialog* CIMSSettingsDialog::NewL( |
|
207 CIMSSettingsUi& aDialog, |
|
208 CImumInternalApiImpl& aMailboxApi, |
|
209 CEikFormattedCellListBox& aListBox, |
|
210 CAknTitlePane& aTitlePane, |
|
211 CEikButtonGroupContainer& aButtons, |
|
212 CMuiuFlags& aFlags, |
|
213 CImumInSettingsData& aMailboxSettings ) |
|
214 { |
|
215 IMUM_STATIC_CONTEXT( CIMSSettingsDialog::NewL, 0, utils, KLogUi ); |
|
216 |
|
217 CIMSSettingsDialog* self = NewLC( |
|
218 aDialog, aMailboxApi, aListBox, |
|
219 aTitlePane, aButtons, aFlags, aMailboxSettings ); |
|
220 CleanupStack::Pop( self ); |
|
221 |
|
222 return self; |
|
223 } |
|
224 |
|
225 // ---------------------------------------------------------------------------- |
|
226 // CIMSSettingsDialog::NewLC() |
|
227 // ---------------------------------------------------------------------------- |
|
228 // |
|
229 CIMSSettingsDialog* CIMSSettingsDialog::NewLC( |
|
230 CIMSSettingsUi& aDialog, |
|
231 CImumInternalApiImpl& aMailboxApi, |
|
232 CEikFormattedCellListBox& aListBox, |
|
233 CAknTitlePane& aTitlePane, |
|
234 CEikButtonGroupContainer& aButtons, |
|
235 CMuiuFlags& aFlags, |
|
236 CImumInSettingsData& aMailboxSettings ) |
|
237 { |
|
238 IMUM_STATIC_CONTEXT( CIMSSettingsDialog::NewLC, 0, utils, KLogUi ); |
|
239 |
|
240 CIMSSettingsDialog* self = |
|
241 new ( ELeave ) CIMSSettingsDialog( |
|
242 aDialog, aMailboxApi, aListBox, |
|
243 aTitlePane, aFlags ); |
|
244 CleanupStack::PushL( self ); |
|
245 self->ConstructL( aButtons, aMailboxSettings ); |
|
246 |
|
247 return self; |
|
248 } |
|
249 |
|
250 /****************************************************************************** |
|
251 |
|
252 Event and keypress handling |
|
253 |
|
254 ******************************************************************************/ |
|
255 |
|
256 // ---------------------------------------------------------------------------- |
|
257 // CIMSSettingsDialog::OkToExitL() |
|
258 // ---------------------------------------------------------------------------- |
|
259 // |
|
260 TBool CIMSSettingsDialog::OkToExitL( const TInt /* aButtonId */ ) |
|
261 { |
|
262 IMUM_CONTEXT( CIMSSettingsDialog::OkToExitL, 0, KLogUi ); |
|
263 |
|
264 // Show query for exit |
|
265 SetEmailSettingsState(); |
|
266 |
|
267 return ETrue; |
|
268 } |
|
269 |
|
270 // ---------------------------------------------------------------------------- |
|
271 // CIMSSettingsDialog::KeyPressSoftkey() |
|
272 // ---------------------------------------------------------------------------- |
|
273 // |
|
274 TBool CIMSSettingsDialog::KeyPressSoftkey( |
|
275 const TInt aButton ) |
|
276 { |
|
277 IMUM_CONTEXT( CIMSSettingsDialog::KeyPressSoftkey, 0, KLogUi ); |
|
278 |
|
279 if ( aButton == EAknSoftkeyBack ) |
|
280 { |
|
281 if ( Flag( EDialogMainMenu ) ) |
|
282 { |
|
283 SetFlag( EImumSettingShouldClose ); |
|
284 SetPreviousTitlePaneText(); |
|
285 } |
|
286 else |
|
287 { |
|
288 // Go backwards to previous setting page |
|
289 // Panic if any error |
|
290 TRAPD( error, HandleStackBackwardL() ); |
|
291 |
|
292 if ( error != KErrNone ) |
|
293 { |
|
294 __ASSERT_DEBUG( EFalse, |
|
295 User::Panic( KIMSSettingsDialogPanic, error ) ); |
|
296 } |
|
297 //Not crucial, should not leave |
|
298 TRAP_IGNORE( UpdateMskL() ); |
|
299 } |
|
300 } |
|
301 |
|
302 return ETrue; |
|
303 } |
|
304 |
|
305 // ---------------------------------------------------------------------------- |
|
306 // CIMSSettingsDialog::KeyPressOKButtonL() |
|
307 // ---------------------------------------------------------------------------- |
|
308 // |
|
309 TBool CIMSSettingsDialog::KeyPressOKButtonL( const TInt aButton ) |
|
310 { |
|
311 IMUM_CONTEXT( CIMSSettingsDialog::KeyPressOKButtonL, 0, KLogUi ); |
|
312 |
|
313 // Get the currently selected item |
|
314 CMuiuSettingBase* base = CurrentItem(); |
|
315 __ASSERT_DEBUG( base != NULL, |
|
316 User::Panic( KIMSSettingsDialogPanic, KErrNotFound ) ); |
|
317 |
|
318 // When Options->Change is selected, then the menu should |
|
319 // be opened, no matter what |
|
320 base->iItemFlags.ChangeFlag( EMuiuDynItemOneTimeForceViewOpen, |
|
321 aButton == EAknSoftkeySelect ); |
|
322 |
|
323 TMuiuPageResult result = OpenSettingPageL( *base ); |
|
324 |
|
325 // Continue opening the page, until the setting is approved |
|
326 if ( result == EMuiuPageResultOk ) |
|
327 { |
|
328 SetStoreFlags( ETrue, GetStorerFlag( *base ) ); |
|
329 } |
|
330 // For read only items, show special error note |
|
331 else if ( result == EMuiuPageResultReadOnly ) |
|
332 { |
|
333 TMuiuSettingsText empty; |
|
334 iNoteUi->ShowDialog( *base, EIMSItemInvalid, empty ); |
|
335 } |
|
336 else if ( result == EMuiuPageResultPageLocked ) |
|
337 { |
|
338 CIMSSettingsNoteUi::ShowNoteL( |
|
339 R_QTN_SELEC_PROTECTED_SETTING, |
|
340 EIMSInformationNote ); |
|
341 } |
|
342 else |
|
343 { |
|
344 // other cases can be skipped |
|
345 } |
|
346 |
|
347 return ETrue; |
|
348 } |
|
349 |
|
350 // ---------------------------------------------------------------------------- |
|
351 // CIMSSettingsDialog::EventSubArrayChangeL |
|
352 // ---------------------------------------------------------------------------- |
|
353 // |
|
354 TInt CIMSSettingsDialog::EventSubArrayChangeL( |
|
355 CMuiuSettingBase& aBaseItem ) |
|
356 { |
|
357 IMUM_CONTEXT( CIMSSettingsDialog::EventSubArrayChangeL, 0, KLogUi ); |
|
358 |
|
359 // Set the flag to indicate main menu is active/inactive |
|
360 ChangeFlag( EDialogMainMenu, |
|
361 aBaseItem.iItemResourceId == R_IMAS_MAIN_MENU ); |
|
362 |
|
363 // In case new item is provided, do settings open |
|
364 HandleSubMenuOpenL( aBaseItem ); |
|
365 |
|
366 return KErrNone; |
|
367 } |
|
368 |
|
369 // ---------------------------------------------------------------------------- |
|
370 // CIMSSettingsDialog::EventItemEditStartsL |
|
371 // ---------------------------------------------------------------------------- |
|
372 // |
|
373 TMuiuPageEventResult CIMSSettingsDialog::EventItemEditStartsL( |
|
374 CMuiuSettingBase& aBaseItem ) |
|
375 { |
|
376 IMUM_CONTEXT( CIMSSettingsDialog::EventItemEditStartsL, 0, KLogUi ); |
|
377 |
|
378 TMuiuPageEventResult result = EMuiuPageEventResultDisapproved; |
|
379 |
|
380 switch ( aBaseItem.iItemId.iUid ) |
|
381 { |
|
382 case EIMASIncomingIap: |
|
383 case EIMASOutgoingIap: |
|
384 LaunchIapPageL( aBaseItem ); |
|
385 break; |
|
386 |
|
387 case EIMASUserFolderSubscription: |
|
388 SubscribeFoldersL(); |
|
389 break; |
|
390 |
|
391 case EIMASIncomingPort: |
|
392 case EIMASOutgoingPort: |
|
393 // Set port setting dialog resource |
|
394 SetSettingPageResource( |
|
395 EIPRNumber, |
|
396 R_IMAS_SETTINGS_DIALOG_FIVE_DIGITS ); |
|
397 result = EMuiuPageEventResultApproved; |
|
398 break; |
|
399 |
|
400 case EIMASIncomingMailboxName: |
|
401 case EIMASIncomingMailServer: |
|
402 case EIMASIncomingUserName: |
|
403 case EIMASOutgoingEmailAddress: |
|
404 case EIMASOutgoingMailServer: |
|
405 case EIMASOutgoingUserName: |
|
406 case EIMASUserReplyTo: |
|
407 // Set text dialog to lower case (abc) when needed |
|
408 SetSettingPageResource( EIPRText, R_IMAS_SETTINGS_DIALOG_TEXT ); |
|
409 result = EMuiuPageEventResultApproved; |
|
410 break; |
|
411 |
|
412 default: |
|
413 result = EMuiuPageEventResultApproved; |
|
414 break; |
|
415 } |
|
416 |
|
417 return result; |
|
418 } |
|
419 |
|
420 // ---------------------------------------------------------------------------- |
|
421 // CIMSSettingsDialog::EventItemEditEndsL |
|
422 // ---------------------------------------------------------------------------- |
|
423 // |
|
424 TInt CIMSSettingsDialog::EventItemEditEndsL( |
|
425 CMuiuSettingBase& aBaseItem ) |
|
426 { |
|
427 IMUM_CONTEXT( CIMSSettingsDialog::EventItemEditEndsL, 0, KLogUi ); |
|
428 |
|
429 switch ( aBaseItem.iItemId.iUid ) |
|
430 { |
|
431 // After the editing of the access point item has finished, |
|
432 // update the setting item |
|
433 case EIMASIncomingIap: |
|
434 case EIMASOutgoingIap: |
|
435 UpdateAccessPointItem( aBaseItem ); |
|
436 UpdateAOIntervalsL(); |
|
437 break; |
|
438 |
|
439 case EIMASDownloadRetrievedParts: |
|
440 IncludePartialFetchString( aBaseItem ); |
|
441 break; |
|
442 |
|
443 case EIMASLimitInbox: |
|
444 case EIMASLimitFolders: |
|
445 UpdateItemText( aBaseItem.iItemId ); |
|
446 break; |
|
447 |
|
448 case EIMASIncomingPort: |
|
449 case EIMASOutgoingPort: |
|
450 UpdateItemText( aBaseItem.iItemId ); |
|
451 break; |
|
452 |
|
453 // Make sure that port setting item is updated, if user has selected |
|
454 // default, otherwise it will be overwritten when exiting settings. |
|
455 case EIMASIncomingSecurity: |
|
456 CheckPort( *GetItem( ToUid( EIMASIncomingPort ) ), ETrue ); |
|
457 break; |
|
458 |
|
459 // Make sure that port setting item is updated, if user has selected |
|
460 // default, otherwise it will be overwritten when exiting settings. |
|
461 case EIMASOutgoingSecurity: |
|
462 CheckPort( *GetItem( ToUid( EIMASOutgoingPort ) ), EFalse ); |
|
463 break; |
|
464 |
|
465 // After editing the always online setting, the hidden items in the |
|
466 // array has to be revealed for editing; or they need to be hidden |
|
467 // if the Always Online is turned off |
|
468 case EIMASAORolling: |
|
469 EventUpdateAlwaysOnline( aBaseItem.Value() ); |
|
470 break; |
|
471 |
|
472 // After the Always Online days setting item is closed, check the |
|
473 // settings and update the setting text according to new value |
|
474 case EIMASAODays: |
|
475 EventUpdateAoDays( aBaseItem ); |
|
476 break; |
|
477 |
|
478 case EIMASMailNotifications: |
|
479 EventUpdateMailNotifications( aBaseItem.Value() ); |
|
480 break; |
|
481 |
|
482 // if user have selected deletion phone only settings |
|
483 // we should tell user that email headers will stay on phone |
|
484 case EIMASUserMailDeletion: |
|
485 if ( aBaseItem.Value() == EIMASMailDeletionPhone ) |
|
486 { |
|
487 CIMSSettingsNoteUi::ShowNoteL( |
|
488 R_IMUM_HEADER_WILL_REMAIN_PHONE, |
|
489 EIMSInformationNote, ETrue ); |
|
490 } |
|
491 break; |
|
492 case EIMASIncomingMailboxName: |
|
493 SetTitlePaneTextL( *aBaseItem.Text(), EFalse ); |
|
494 |
|
495 break; |
|
496 default: |
|
497 break; |
|
498 } |
|
499 |
|
500 return KErrNone; |
|
501 } |
|
502 |
|
503 // ---------------------------------------------------------------------------- |
|
504 // CIMSSettingsDialog::EventItemEvaluateText() |
|
505 // ---------------------------------------------------------------------------- |
|
506 // |
|
507 TMuiuPageEventResult CIMSSettingsDialog::EventItemEvaluateText( |
|
508 const CMuiuSettingBase& aBaseItem, |
|
509 TDes& aNewText ) |
|
510 { |
|
511 IMUM_CONTEXT( CIMSSettingsDialog::EventItemEvaluateText, 0, KLogUi ); |
|
512 |
|
513 // Evaluate the item on fly |
|
514 TIMSApproverEvent event; |
|
515 TMuiuPageEventResult result = |
|
516 iItemApprover->EvaluateText( event, aBaseItem, aNewText ); |
|
517 |
|
518 if ( result == EMuiuPageEventResultApproved ) |
|
519 { |
|
520 // Handle possible events |
|
521 EventHandleApproverEvent( event ); |
|
522 } |
|
523 |
|
524 return result; |
|
525 } |
|
526 |
|
527 // ---------------------------------------------------------------------------- |
|
528 // CIMSSettingsDialog::EventItemEvaluateRadioButton() |
|
529 // ---------------------------------------------------------------------------- |
|
530 // |
|
531 TMuiuPageEventResult CIMSSettingsDialog::EventItemEvaluateRadioButton( |
|
532 const CMuiuSettingBase& aBaseItem, |
|
533 TInt& aNewValue ) |
|
534 { |
|
535 IMUM_CONTEXT( CIMSSettingsDialog::EventItemEvaluateRadioButton, 0, KLogUi ); |
|
536 |
|
537 // Evaluate the item on fly |
|
538 TIMSApproverEvent event; |
|
539 TMuiuPageEventResult result = |
|
540 iItemApprover->EvaluateValue( event, aBaseItem, aNewValue ); |
|
541 |
|
542 if ( result == EMuiuPageEventResultApproved ) |
|
543 { |
|
544 // Handle possible events |
|
545 EventHandleApproverEvent( event ); |
|
546 } |
|
547 |
|
548 return result; |
|
549 } |
|
550 |
|
551 |
|
552 // ---------------------------------------------------------------------------- |
|
553 // CIMSSettingsDialog::IncludePartialFetchString() |
|
554 // ---------------------------------------------------------------------------- |
|
555 // |
|
556 void CIMSSettingsDialog::IncludePartialFetchString( |
|
557 CMuiuSettingBase& aRetrievedParts ) |
|
558 { |
|
559 IMUM_CONTEXT( CIMSSettingsDialog::IncludePartialFetchString, 0, KLogUi ); |
|
560 |
|
561 TInt index = KErrNotFound; |
|
562 TUid id; |
|
563 CMuiuSettingsLinkExtended* retrievedParts = |
|
564 static_cast<CMuiuSettingsLinkExtended*>( &aRetrievedParts ); |
|
565 |
|
566 // Check if partial fetch is selected |
|
567 if ( FindCheckedRadiobutton( *retrievedParts, id, index ) == KErrNone && |
|
568 id.iUid == EIMASBtnRetrieveLimit ) |
|
569 { |
|
570 CMuiuSettingBase* subItem = SettingFindEditor( *retrievedParts, id ); |
|
571 |
|
572 // Finally, set the text accoding to item |
|
573 TMuiuSettingsText settingText; |
|
574 CIMSSettingsNoteUi::MakeString( settingText, |
|
575 R_IMAS_SETTINGS_MAIL_FETCH_LESS_VALUE, subItem->Value() ); |
|
576 |
|
577 retrievedParts->iItemSettingText->Copy( settingText ); |
|
578 } |
|
579 |
|
580 Refresh(); |
|
581 } |
|
582 |
|
583 /****************************************************************************** |
|
584 |
|
585 Array initialization |
|
586 |
|
587 ******************************************************************************/ |
|
588 |
|
589 // ---------------------------------------------------------------------------- |
|
590 // CIMSSettingsDialog::GetUninitializedItem() |
|
591 // ---------------------------------------------------------------------------- |
|
592 // |
|
593 CMuiuSettingBase* CIMSSettingsDialog::GetUninitializedItem( |
|
594 const TUid& aId ) |
|
595 { |
|
596 IMUM_CONTEXT( CIMSSettingsDialog::GetUninitializedItem, 0, KLogUi ); |
|
597 |
|
598 // At first, find the item and get its resource id, then |
|
599 // use the resource id to initialize the actual array. |
|
600 CMuiuSettingBase* base = GetItem( aId ); |
|
601 |
|
602 if ( base ) |
|
603 { |
|
604 TRAP_IGNORE( InitializeArrayL( base->iItemResourceId ) ); |
|
605 } |
|
606 |
|
607 // After item initialization is done, the item can be returned |
|
608 return base; |
|
609 } |
|
610 |
|
611 // ---------------------------------------------------------------------------- |
|
612 // CIMSSettingsDialog::HandleSubMenuOpenL() |
|
613 // ---------------------------------------------------------------------------- |
|
614 // |
|
615 void CIMSSettingsDialog::HandleSubMenuOpenL( |
|
616 CMuiuSettingBase& aBaseItem ) |
|
617 { |
|
618 IMUM_CONTEXT( CIMSSettingsDialog::HandleSubMenuOpenL, 0, KLogUi ); |
|
619 |
|
620 InitializeArrayL( aBaseItem.iItemResourceId ); |
|
621 } |
|
622 |
|
623 // ---------------------------------------------------------------------------- |
|
624 // CIMSSettingsDialog::InitializeArray() |
|
625 // ---------------------------------------------------------------------------- |
|
626 // |
|
627 void CIMSSettingsDialog::InitializeArrayL( const TInt aResource ) |
|
628 { |
|
629 IMUM_CONTEXT( CIMSSettingsDialog::InitializeArrayL, 0, KLogUi ); |
|
630 |
|
631 iInitResource = aResource; |
|
632 |
|
633 switch ( iInitResource ) |
|
634 { |
|
635 case R_IMAS_MAIN_MENU: |
|
636 InitializeArrayMainMenu(); |
|
637 break; |
|
638 |
|
639 case R_IMAS_INCOMING_SETTINGS: |
|
640 InitializeArrayIncomingL(); |
|
641 break; |
|
642 |
|
643 case R_IMAS_OUTGOING_SETTINGS: |
|
644 InitializeArrayOutgoingL(); |
|
645 break; |
|
646 |
|
647 case R_IMAS_USER_PREFERENCES: |
|
648 InitializeArrayUserPrefL(); |
|
649 break; |
|
650 |
|
651 case R_IMAS_RETRIEVAL_LIMIT: |
|
652 InitializeArrayRetLimitL(); |
|
653 break; |
|
654 |
|
655 case R_IMAS_DOWNLOAD_SETTINGS: |
|
656 InitializeArrayDownloadL(); |
|
657 break; |
|
658 |
|
659 case R_IMAS_ALWAYSONLINE_SETTINGS: |
|
660 InitializeArrayAlwaysOnlineL(); |
|
661 break; |
|
662 |
|
663 case R_IMAS_MAILBOX_MENU: |
|
664 default: |
|
665 // Buttons are not needed to be initialized separately |
|
666 break; |
|
667 } |
|
668 } |
|
669 |
|
670 |
|
671 // ---------------------------------------------------------------------------- |
|
672 // CIMSSettingsDialog::InitializeNewResourceL() |
|
673 // ---------------------------------------------------------------------------- |
|
674 // |
|
675 void CIMSSettingsDialog::InitializeNewResourceL() |
|
676 { |
|
677 IMUM_CONTEXT( CIMSSettingsDialog::InitializeNewResourceL, 0, KLogUi ); |
|
678 |
|
679 // Delete the previous item before acquiring the new one |
|
680 delete iInitArray; |
|
681 iInitArray = NULL; |
|
682 |
|
683 iInitArray = GetResourceLC( iInitResource, EFalse ); |
|
684 CleanupStack::Pop( iInitArray ); |
|
685 } |
|
686 |
|
687 // ---------------------------------------------------------------------------- |
|
688 // CIMSSettingsDialog::InitializeItem() |
|
689 // ---------------------------------------------------------------------------- |
|
690 // |
|
691 void CIMSSettingsDialog::InitializeItem( |
|
692 CMuiuDynFinderItemArray& aArray, |
|
693 const TInt aIndex, |
|
694 const TInt aValue, |
|
695 const TMuiuSettingsText* aText ) |
|
696 { |
|
697 IMUM_CONTEXT( CIMSSettingsDialog::InitializeItem, 0, KLogUi ); |
|
698 |
|
699 // Try initilizing the item |
|
700 if ( aIndex >= 0 && aIndex < aArray.Count() ) |
|
701 { |
|
702 TInt error = InitAnyItem( |
|
703 *aArray.At( aIndex ).iItem, aValue, aText ); |
|
704 |
|
705 // Set Initialize flags |
|
706 SetInitializeFlags( error ); |
|
707 } |
|
708 else |
|
709 { |
|
710 __ASSERT_DEBUG( EFalse, User::Panic( |
|
711 KIMSSettingsDialogPanic, KErrUnknown ) ); |
|
712 } |
|
713 } |
|
714 |
|
715 // ---------------------------------------------------------------------------- |
|
716 // CIMSSettingsDialog::InitializeItem() |
|
717 // ---------------------------------------------------------------------------- |
|
718 // |
|
719 void CIMSSettingsDialog::InitializeItem( |
|
720 CMuiuSettingBase& aBaseItem, |
|
721 const TInt aValue, |
|
722 const TMuiuSettingsText* aText ) |
|
723 { |
|
724 // Try initilizing the item |
|
725 TInt error = InitAnyItem( aBaseItem, aValue, aText ); |
|
726 |
|
727 // If initializing has failed, it means the item needs to be saved again |
|
728 SetInitializeFlags( error ); |
|
729 } |
|
730 |
|
731 // ---------------------------------------------------------------------------- |
|
732 // CIMSSettingsDialog::InitializeNext() |
|
733 // ---------------------------------------------------------------------------- |
|
734 // |
|
735 void CIMSSettingsDialog::InitializeNext( |
|
736 const TUid& aItemId, |
|
737 const TMuiuSettingsText& aText ) |
|
738 { |
|
739 IMUM_CONTEXT( CIMSSettingsDialog::InitializeNext, 0, KLogUi ); |
|
740 |
|
741 // Fetch next item |
|
742 CMuiuSettingBase* base = NextItemSearch( aItemId ); |
|
743 |
|
744 // Validate the item |
|
745 TInt error = KErrNone; |
|
746 |
|
747 // Finish item |
|
748 error = InitAnyItem( *base, KErrNotFound, &aText ); |
|
749 |
|
750 // If initializing has failed, it means the item needs to be saved again |
|
751 SetInitializeFlags( error ); |
|
752 } |
|
753 |
|
754 // ---------------------------------------------------------------------------- |
|
755 // CIMSSettingsDialog::InitializeNext() |
|
756 // ---------------------------------------------------------------------------- |
|
757 // |
|
758 void CIMSSettingsDialog::InitializeNext( |
|
759 const TUid& aItemId, |
|
760 const TInt aValue, |
|
761 const TMuiuSettingsText& aText ) |
|
762 { |
|
763 IMUM_CONTEXT( CIMSSettingsDialog::InitializeNext, 0, KLogUi ); |
|
764 |
|
765 // Validate the item |
|
766 TInt error = InitAnyItem( |
|
767 *NextItemSearch( aItemId ), aValue, &aText ); |
|
768 |
|
769 // If initializing has failed, it means the item needs to be saved again |
|
770 SetInitializeFlags( error ); |
|
771 } |
|
772 |
|
773 // ---------------------------------------------------------------------------- |
|
774 // CIMSSettingsDialog::InitializeNext() |
|
775 // ---------------------------------------------------------------------------- |
|
776 // |
|
777 void CIMSSettingsDialog::InitializeNext( |
|
778 const TUid& aItemId, |
|
779 const TPtrC8& aText ) |
|
780 { |
|
781 IMUM_CONTEXT( CIMSSettingsDialog::InitializeNext, 0, KLogUi ); |
|
782 |
|
783 TMuiuSettingsText buffer; |
|
784 buffer.Copy( aText ); |
|
785 |
|
786 // Set next item |
|
787 InitializeNext( aItemId, buffer ); |
|
788 } |
|
789 |
|
790 // ---------------------------------------------------------------------------- |
|
791 // CIMSSettingsDialog::InitializeNext() |
|
792 // ---------------------------------------------------------------------------- |
|
793 // |
|
794 void CIMSSettingsDialog::InitializeNext( |
|
795 const TUid& aItemId, |
|
796 const TInt aValue ) |
|
797 { |
|
798 IMUM_CONTEXT( CIMSSettingsDialog::InitializeNext, 0, KLogUi ); |
|
799 |
|
800 // Fetch next item |
|
801 CMuiuSettingBase* base = NextItemSearch( aItemId ); |
|
802 |
|
803 // Validate the item |
|
804 TInt error = InitAnyItem( *base, aValue, NULL ); |
|
805 |
|
806 // If initializing has failed, it means the item needs to be saved again |
|
807 SetInitializeFlags( error ); |
|
808 } |
|
809 |
|
810 // ---------------------------------------------------------------------------- |
|
811 // CIMSSettingsDialog::InitializeResetArrays() |
|
812 // ---------------------------------------------------------------------------- |
|
813 // |
|
814 void CIMSSettingsDialog::InitializeResetArrays() |
|
815 { |
|
816 IMUM_CONTEXT( CIMSSettingsDialog::InitializeResetArrays, 0, KLogUi ); |
|
817 |
|
818 iInitTreeArray->Reset(); |
|
819 iInitIdArray->Reset(); |
|
820 iInitValueArray->Reset(); |
|
821 iInitInfoArray->Reset(); |
|
822 iInitTextArray->ResetAndDestroy(); |
|
823 } |
|
824 |
|
825 // ---------------------------------------------------------------------------- |
|
826 // CIMSSettingsDialog::InitializeArrayMainMenu() |
|
827 // ---------------------------------------------------------------------------- |
|
828 // |
|
829 void CIMSSettingsDialog::InitializeArrayMainMenu() |
|
830 { |
|
831 IMUM_CONTEXT( CIMSSettingsDialog::InitializeArrayMainMenu, 0, KLogUi ); |
|
832 |
|
833 if ( Flag( EDialogMainMenuInitialized ) ) |
|
834 { |
|
835 return; |
|
836 } |
|
837 |
|
838 // Set flags |
|
839 SetFlag( EDialogMainMenuInitialized ); |
|
840 SetFlag( EDialogMainMenu ); |
|
841 |
|
842 // Hide items that can be hidden |
|
843 HideItemsPermanently(); |
|
844 } |
|
845 |
|
846 // ---------------------------------------------------------------------------- |
|
847 // CIMSSettingsDialog::InitializeArrayIncomingL() |
|
848 // ---------------------------------------------------------------------------- |
|
849 // |
|
850 void CIMSSettingsDialog::InitializeArrayIncomingL() |
|
851 { |
|
852 IMUM_CONTEXT( CIMSSettingsDialog::InitializeArrayIncomingL, 0, KLogUi ); |
|
853 |
|
854 // Check if the item is already initialized |
|
855 if ( Flag( EDialogIncomingInitialized ) ) |
|
856 { |
|
857 return; |
|
858 } |
|
859 |
|
860 // Set flag |
|
861 SetFlag( EDialogIncomingInitialized ); |
|
862 |
|
863 // The settings for imap4 and pop3 differs |
|
864 if ( iAccountSettings->iIsImap4 ) |
|
865 { |
|
866 InitializeArrayIncomingImap4L(); |
|
867 } |
|
868 else |
|
869 { |
|
870 InitializeArrayIncomingPop3L(); |
|
871 } |
|
872 } |
|
873 |
|
874 // ---------------------------------------------------------------------------- |
|
875 // CIMSSettingsDialog::InitializeArrayIncomingImap4L() |
|
876 // ---------------------------------------------------------------------------- |
|
877 // |
|
878 void CIMSSettingsDialog::InitializeArrayIncomingImap4L() |
|
879 { |
|
880 IMUM_CONTEXT( CIMSSettingsDialog::InitializeArrayIncomingImap4L, 0, KLogUi ); |
|
881 |
|
882 // Prepare for initialize |
|
883 InitializeNewResourceL(); |
|
884 iInitSetFlag = EDialogIncomingChanged; |
|
885 iInitCurrentIndex = KErrNotFound; |
|
886 |
|
887 // User name |
|
888 InitializeUsername( ToUid( EIMASIncomingUserName ), |
|
889 iAccountSettings->iImap4Settings->LoginName() ); |
|
890 |
|
891 // User password |
|
892 InitializePassword( ToUid( EIMASIncomingUserPwd ), |
|
893 iAccountSettings->iImap4Settings->Password(), |
|
894 EIMASStatusTempRcvPassword ); |
|
895 |
|
896 // Used mail server |
|
897 InitializeNext( ToUid( EIMASIncomingMailServer ), |
|
898 iAccountSettings->iImap4Settings->ServerAddress() ); |
|
899 |
|
900 // Access point in use |
|
901 TInt error = InitializeIap( ToUid( EIMASIncomingIap ) ); |
|
902 SetFlags( error, EDialogIncomingIapNotOk ); |
|
903 |
|
904 // Mailbox name |
|
905 InitializeNext( ToUid( EIMASIncomingMailboxName ), |
|
906 iAccountSettings->iName ); |
|
907 |
|
908 // Mailbox type (Read only) |
|
909 InitializeNext( ToUid( EIMASIncomingProtocol ), |
|
910 iAccountSettings->iIsImap4 ); |
|
911 |
|
912 // Security & Port |
|
913 InitializeSecuritySettings( ToUid( EIMASIncomingSecurity ) ); |
|
914 } |
|
915 |
|
916 // ---------------------------------------------------------------------------- |
|
917 // CIMSSettingsDialog::InitializeArrayIncomingPop3L() |
|
918 // ---------------------------------------------------------------------------- |
|
919 // |
|
920 void CIMSSettingsDialog::InitializeArrayIncomingPop3L() |
|
921 { |
|
922 IMUM_CONTEXT( CIMSSettingsDialog::InitializeArrayIncomingPop3L, 0, KLogUi ); |
|
923 |
|
924 // Prepare for initialize |
|
925 InitializeNewResourceL(); |
|
926 iInitSetFlag = EDialogIncomingChanged; |
|
927 iInitCurrentIndex = KErrNotFound; |
|
928 |
|
929 // User name |
|
930 InitializeUsername( ToUid( EIMASIncomingUserName ), |
|
931 iAccountSettings->iPop3Settings->LoginName() ); |
|
932 |
|
933 // User password |
|
934 InitializePassword( ToUid( EIMASIncomingUserPwd ), |
|
935 iAccountSettings->iPop3Settings->Password(), |
|
936 EIMASStatusTempRcvPassword ); |
|
937 |
|
938 // Used mail server |
|
939 InitializeNext( ToUid( EIMASIncomingMailServer ), |
|
940 iAccountSettings->iPop3Settings->ServerAddress() ); |
|
941 |
|
942 // Access point in use |
|
943 TInt error = InitializeIap( ToUid( EIMASIncomingIap ) ); |
|
944 SetFlags( error, EDialogIncomingIapNotOk ); |
|
945 |
|
946 // Mailbox name |
|
947 InitializeNext( ToUid( EIMASIncomingMailboxName ), |
|
948 iAccountSettings->iName ); |
|
949 |
|
950 // Mailbox type (Read only) |
|
951 InitializeNext( ToUid( EIMASIncomingProtocol ), |
|
952 iAccountSettings->iIsImap4 ); |
|
953 |
|
954 // Security & Port |
|
955 InitializeSecuritySettings( ToUid( EIMASIncomingSecurity ) ); |
|
956 |
|
957 // APOP secure login |
|
958 InitializeNext( ToUid( EIMASIncomingAPop ), |
|
959 iAccountSettings->iPop3Settings->Apop() ? |
|
960 EIMASOn : EIMASOff ); |
|
961 } |
|
962 |
|
963 // ---------------------------------------------------------------------------- |
|
964 // CIMSSettingsDialog::InitializeArrayOutgoingL() |
|
965 // ---------------------------------------------------------------------------- |
|
966 // |
|
967 void CIMSSettingsDialog::InitializeArrayOutgoingL() |
|
968 { |
|
969 IMUM_CONTEXT( CIMSSettingsDialog::InitializeArrayOutgoingL, 0, KLogUi ); |
|
970 |
|
971 // Check if the item is already initialized |
|
972 if ( Flag( EDialogOutgoingInitialized ) ) |
|
973 { |
|
974 return; |
|
975 } |
|
976 |
|
977 // Set flag |
|
978 SetFlag( EDialogOutgoingInitialized ); |
|
979 |
|
980 // initialize |
|
981 InitializeNewResourceL(); |
|
982 iInitSetFlag = EDialogOutgoingChanged; |
|
983 iInitCurrentIndex = KErrNotFound; |
|
984 |
|
985 // Email address |
|
986 InitializeNext( ToUid( EIMASOutgoingEmailAddress ), |
|
987 iAccountSettings->iSmtpSettings->EmailAddress() ); |
|
988 |
|
989 // User name |
|
990 InitializeUsername( ToUid( EIMASOutgoingUserName ), |
|
991 iAccountSettings->iSmtpSettings->LoginName() ); |
|
992 |
|
993 // User password |
|
994 InitializePassword( ToUid( EIMASOutgoingUserPwd ), |
|
995 iAccountSettings->iSmtpSettings->Password(), |
|
996 EIMASStatusTempSndPassword ); |
|
997 |
|
998 // Used mail server |
|
999 InitializeNext( ToUid( EIMASOutgoingMailServer ), |
|
1000 iAccountSettings->iSmtpSettings->ServerAddress() ); |
|
1001 |
|
1002 // Access point in use |
|
1003 TInt error = InitializeIap( ToUid( EIMASOutgoingIap ) ); |
|
1004 SetFlags( error, EDialogOutgoingIapNotOk ); |
|
1005 |
|
1006 // Security & Port |
|
1007 InitializeSecuritySettings( ToUid( EIMASOutgoingSecurity ) ); |
|
1008 } |
|
1009 |
|
1010 // ---------------------------------------------------------------------------- |
|
1011 // CIMSSettingsDialog::InitializeArrayUserPrefL() |
|
1012 // ---------------------------------------------------------------------------- |
|
1013 // |
|
1014 void CIMSSettingsDialog::InitializeArrayUserPrefL() |
|
1015 { |
|
1016 IMUM_CONTEXT( CIMSSettingsDialog::InitializeArrayUserPrefL, 0, KLogUi ); |
|
1017 |
|
1018 // Check if the item is already initialized |
|
1019 if ( Flag( EDialogUserPrefInitialized ) ) |
|
1020 { |
|
1021 return; |
|
1022 } |
|
1023 |
|
1024 // Set flag |
|
1025 SetFlag( EDialogUserPrefInitialized ); |
|
1026 |
|
1027 // Prepare for initialize |
|
1028 InitializeNewResourceL(); |
|
1029 iInitSetFlag = EDialogUserPrefChanged; |
|
1030 iInitCurrentIndex = KErrNotFound; |
|
1031 |
|
1032 // Own Name |
|
1033 InitializeNext( ToUid( EIMASUserOwnName ), |
|
1034 iAccountSettings->iSmtpSettings->EmailAlias() ); |
|
1035 |
|
1036 // Send Message |
|
1037 InitializeNext( ToUid( EIMASUserSendMsg ), |
|
1038 iAccountSettings->iSmtpSettings->SendMessageOption() == |
|
1039 ESendMessageImmediately ? EImmediately : EOnNextConnection ); |
|
1040 |
|
1041 // Send copy to self |
|
1042 InitializeNext( ToUid( EIMASUserSendCopy ), |
|
1043 iAccountSettings->iSmtpSettings->SendCopyToSelf() == ESendNoCopy ); |
|
1044 |
|
1045 // Include Signature |
|
1046 InitializeSignature(); |
|
1047 |
|
1048 // Show HTML mails |
|
1049 InitializeNext( ToUid( EIMASUserShowHtml ), |
|
1050 iAccountSettings->iExtendedSettings->OpenHtmlMail() ? |
|
1051 EIMASYes : EIMASNo ); |
|
1052 |
|
1053 // New mail indicators |
|
1054 InitializeNext( ToUid( EIMASUserNewMailInd ), |
|
1055 iAccountSettings->iExtendedSettings->NewMailIndicators() ? |
|
1056 EIMASYes : EIMASNo ); |
|
1057 |
|
1058 // Mail Deletion setting |
|
1059 InitializeNext( ToUid ( EIMASUserMailDeletion ), |
|
1060 iAccountSettings->iExtendedSettings->MailDeletion() ) ; |
|
1061 |
|
1062 // Reply-to Address |
|
1063 InitializeNext( ToUid( EIMASUserReplyTo ), |
|
1064 iAccountSettings->iSmtpSettings->ReplyToAddress() ); |
|
1065 |
|
1066 // Default encoding |
|
1067 InitializeNext( ToUid( EIMASUserEncoding ), |
|
1068 iAccountSettings->iSmtpSettings->DefaultMsgCharSet().iUid ); |
|
1069 } |
|
1070 |
|
1071 // ---------------------------------------------------------------------------- |
|
1072 // CIMSSettingsDialog::InitializeRetrieveLimitL() |
|
1073 // ---------------------------------------------------------------------------- |
|
1074 // |
|
1075 void CIMSSettingsDialog::InitializeRetrieveLimitL( |
|
1076 const TInt aLimit, |
|
1077 const TInt aId ) |
|
1078 { |
|
1079 IMUM_CONTEXT( CIMSSettingsDialog::InitializeRetrieveLimitL, 0, KLogUi ); |
|
1080 |
|
1081 // Reset before initializing |
|
1082 InitializeResetArrays(); |
|
1083 |
|
1084 // Add id's to tree |
|
1085 iInitTreeArray->AppendL( ToUid( EIMASMainDownloadCtrl ) ); |
|
1086 iInitTreeArray->AppendL( ToUid( EIMASDownloadRetrievalLimit ) ); |
|
1087 iInitTreeArray->AppendL( ToUid( EIMASBtnRetrieveLimit ) ); |
|
1088 iInitIdArray->AppendL( ToUid( aId ) ); |
|
1089 iInitIdArray->AppendL( ToUid( EIMASBtnFetchUserDefined ) ); |
|
1090 iInitValueArray->AppendL( aLimit == KErrNotFound ? |
|
1091 EIMSLimitFetchAll : EIMSLimitUserDefined ); |
|
1092 iInitValueArray->AppendL( aLimit == KErrNotFound ? |
|
1093 KImumMboxDefaultInboxUpdateLimit : aLimit ); |
|
1094 |
|
1095 InitAnyMultiItem( NULL, *iInitIdArray, iInitValueArray, iInitTextArray ); |
|
1096 } |
|
1097 |
|
1098 |
|
1099 // ---------------------------------------------------------------------------- |
|
1100 // CIMSSettingsDialog::InitializeArrayRetLimitL() |
|
1101 // ---------------------------------------------------------------------------- |
|
1102 // |
|
1103 void CIMSSettingsDialog::InitializeArrayRetLimitL() |
|
1104 { |
|
1105 IMUM_CONTEXT( CIMSSettingsDialog::InitializeArrayRetLimitL, 0, KLogUi ); |
|
1106 |
|
1107 // Check if the item is already initialized |
|
1108 if ( Flag( EDialogRetLimitInitialized ) ) |
|
1109 { |
|
1110 if ( Flag( EDialogDownloadChanged ) ) |
|
1111 { |
|
1112 // This should really be done after subscribe dialog is closed |
|
1113 CheckSubscribedFolderStateL(); |
|
1114 } |
|
1115 return; |
|
1116 } |
|
1117 |
|
1118 // Set flag |
|
1119 SetFlag( EDialogRetLimitInitialized ); |
|
1120 |
|
1121 // Prepare for initialize |
|
1122 InitializeNewResourceL(); |
|
1123 iInitSetFlag = EDialogRetLimitChanged; |
|
1124 iInitCurrentIndex = KErrNotFound; |
|
1125 |
|
1126 // Individual handling for each protocol |
|
1127 if ( iAccountSettings->iIsImap4 ) |
|
1128 { |
|
1129 // Inbox limit |
|
1130 InitializeRetrieveLimitL( |
|
1131 iAccountSettings->iImap4Settings->InboxSynchronisationLimit(), |
|
1132 EIMASLimitInbox ); |
|
1133 |
|
1134 // Subscribed folders limit |
|
1135 InitializeRetrieveLimitL( |
|
1136 iAccountSettings->iImap4Settings->MailboxSynchronisationLimit(), |
|
1137 EIMASLimitFolders ); |
|
1138 |
|
1139 CheckSubscribedFolderStateL(); |
|
1140 } |
|
1141 else |
|
1142 { |
|
1143 // Inbox limit |
|
1144 InitializeRetrieveLimitL( |
|
1145 iAccountSettings->iPop3Settings->InboxSynchronisationLimit(), |
|
1146 EIMASLimitInbox ); |
|
1147 } |
|
1148 |
|
1149 // When always online is set, these settings can only be read |
|
1150 UpdateFetchLimitSetting(); |
|
1151 } |
|
1152 |
|
1153 // ---------------------------------------------------------------------------- |
|
1154 // CIMSSettingsDialog::InitializeArrayDownloadL() |
|
1155 // ---------------------------------------------------------------------------- |
|
1156 // |
|
1157 void CIMSSettingsDialog::InitializeArrayDownloadL() |
|
1158 { |
|
1159 IMUM_CONTEXT( CIMSSettingsDialog::InitializeArrayDownloadL, 0, KLogUi ); |
|
1160 |
|
1161 // Check if the item is already initialized |
|
1162 if ( Flag( EDialogDownloadInitialized ) ) |
|
1163 { |
|
1164 return; |
|
1165 } |
|
1166 |
|
1167 // Set flag |
|
1168 SetFlag( EDialogDownloadInitialized ); |
|
1169 |
|
1170 // Prepare for initialize |
|
1171 InitializeNewResourceL(); |
|
1172 iInitSetFlag = EDialogDownloadChanged; |
|
1173 iInitCurrentIndex = KErrNotFound; |
|
1174 |
|
1175 // Retrieved parts |
|
1176 InitializeRetrievedParts(); |
|
1177 |
|
1178 // Retrieval limit |
|
1179 ++iInitCurrentIndex; |
|
1180 |
|
1181 // Imap4 folder path |
|
1182 InitializeFolderPath(); |
|
1183 |
|
1184 // Folder subscriptions |
|
1185 ++iInitCurrentIndex; |
|
1186 |
|
1187 // Del. msgs. over limit |
|
1188 InitializeNext( ToUid( EIMASDownloadMsgsOverLimit ), |
|
1189 iAccountSettings->iExtendedSettings->HideMsgs() ? |
|
1190 EIMASYes : EIMASNo ); |
|
1191 } |
|
1192 |
|
1193 // ---------------------------------------------------------------------------- |
|
1194 // CIMSSettingsDialog::InitializeArrayAlwaysOnlineL() |
|
1195 // ---------------------------------------------------------------------------- |
|
1196 // |
|
1197 void CIMSSettingsDialog::InitializeArrayAlwaysOnlineL() |
|
1198 { |
|
1199 IMUM_CONTEXT( CIMSSettingsDialog::InitializeArrayAlwaysOnlineL, 0, KLogUi ); |
|
1200 |
|
1201 // Check if the item is already initialized |
|
1202 if ( Flag( EDialogAlOnlineInitialized ) ) |
|
1203 { |
|
1204 return; |
|
1205 } |
|
1206 |
|
1207 // Set flag |
|
1208 SetFlag( EDialogAlOnlineInitialized ); |
|
1209 |
|
1210 // EDialogCsdAccessPoint flag needed when showing AO intervals. |
|
1211 UpdateCSDFlagL(); |
|
1212 |
|
1213 // Prepare for initialize |
|
1214 iInitResource = R_IMAS_ALWAYSONLINE_SETTINGS; |
|
1215 InitializeNewResourceL(); |
|
1216 iInitSetFlag = EDialogAlOnlineChanged; |
|
1217 iInitCurrentIndex = KErrNotFound; |
|
1218 |
|
1219 // Mail message notifications |
|
1220 InitializeNext( ToUid( EIMASMailNotifications ), |
|
1221 iAccountSettings->iExtendedSettings->EmailNotificationState() ); |
|
1222 |
|
1223 // Automatic Retrieval |
|
1224 InitializeNext( ToUid( EIMASAORolling ), |
|
1225 iAccountSettings->iExtendedSettings->AlwaysOnlineState() ); |
|
1226 |
|
1227 // Retrieval Days |
|
1228 InitializeAoDays(); |
|
1229 |
|
1230 // Retrieval hours |
|
1231 InitializeAoHoursL(); |
|
1232 |
|
1233 // Retrieval interval |
|
1234 InitializeAoInterval(); |
|
1235 |
|
1236 InitializeAlwaysOnlineState(); |
|
1237 } |
|
1238 |
|
1239 // ---------------------------------------------------------------------------- |
|
1240 // CIMSSettingsDialog::InitializeAlwaysOnlineState() |
|
1241 // ---------------------------------------------------------------------------- |
|
1242 // |
|
1243 void CIMSSettingsDialog::InitializeAlwaysOnlineState() |
|
1244 { |
|
1245 IMUM_CONTEXT( CIMSSettingsDialog::InitializeAlwaysOnlineState, 0, KLogUi ); |
|
1246 |
|
1247 TBool hide = !Flag( EDialogAlwaysOnlineOn ); |
|
1248 |
|
1249 SetHideItem( hide, ToUid( EIMASAODays ) ); |
|
1250 SetHideItem( hide, ToUid( EIMASAOHours ) ); |
|
1251 SetHideItem( hide, ToUid( EIMASAOInterval ), ETrue ); |
|
1252 UpdateFetchLimitSetting(); |
|
1253 } |
|
1254 |
|
1255 // ---------------------------------------------------------------------------- |
|
1256 // CIMSSettingsDialog::InitializeUsername() |
|
1257 // ---------------------------------------------------------------------------- |
|
1258 // |
|
1259 void CIMSSettingsDialog::InitializeUsername( |
|
1260 const TUid& aItemId, |
|
1261 const TPtrC8& aUsername ) |
|
1262 { |
|
1263 IMUM_CONTEXT( CIMSSettingsDialog::InitializeUsername, 0, KLogUi ); |
|
1264 |
|
1265 TMuiuSettingsText login; |
|
1266 login.Copy( aUsername ); |
|
1267 |
|
1268 InitializeNext( aItemId, login ); |
|
1269 } |
|
1270 |
|
1271 // ---------------------------------------------------------------------------- |
|
1272 // CIMSSettingsDialog::InitializePassword() |
|
1273 // ---------------------------------------------------------------------------- |
|
1274 // |
|
1275 void CIMSSettingsDialog::InitializePassword( |
|
1276 const TUid& aItemId, |
|
1277 const TPtrC8& aPassword, |
|
1278 const TInt aFlag ) |
|
1279 { |
|
1280 IMUM_CONTEXT( CIMSSettingsDialog::InitializePassword, 0, KLogUi ); |
|
1281 |
|
1282 TMuiuSettingsText login; |
|
1283 login.Copy( aPassword ); |
|
1284 TMuiuFlags flags = iAccountSettings->iExtendedSettings->StatusFlags(); |
|
1285 |
|
1286 if ( flags.Flag( aFlag ) ) |
|
1287 { |
|
1288 login.Zero(); |
|
1289 SetInitializeFlags( KErrArgument ); |
|
1290 } |
|
1291 |
|
1292 InitializeNext( aItemId, login ); |
|
1293 } |
|
1294 |
|
1295 // ---------------------------------------------------------------------------- |
|
1296 // CIMSSettingsDialog::InitializeSignature() |
|
1297 // ---------------------------------------------------------------------------- |
|
1298 // |
|
1299 TInt CIMSSettingsDialog::InitializeSignature() |
|
1300 { |
|
1301 IMUM_CONTEXT( CIMSSettingsDialog::InitializeSignature, 0, KLogUi ); |
|
1302 |
|
1303 TRAPD( error, InitializeSignatureL() ); |
|
1304 |
|
1305 return error; |
|
1306 } |
|
1307 |
|
1308 // ---------------------------------------------------------------------------- |
|
1309 // CIMSSettingsDialog::InitializeSignatureL() |
|
1310 // ---------------------------------------------------------------------------- |
|
1311 // |
|
1312 void CIMSSettingsDialog::InitializeSignatureL() |
|
1313 { |
|
1314 IMUM_CONTEXT( CIMSSettingsDialog::InitializeSignatureL, 0, KLogUi ); |
|
1315 |
|
1316 // Reset the arrays |
|
1317 InitializeResetArrays(); |
|
1318 |
|
1319 // Determine the button |
|
1320 TInt button = iAccountSettings->iSmtpSettings->AddSignatureToEmail() ? |
|
1321 EIMASYes : EIMASNo; |
|
1322 |
|
1323 // Fetch next item |
|
1324 CMuiuSettingBase* base = NextItemSearch( |
|
1325 ToUid( EIMASUserIncludeSignature ) ); |
|
1326 |
|
1327 // Add the id to array and the value |
|
1328 iInitInfoArray->AppendL( EMuiuDynInitInfoValue ); |
|
1329 iInitInfoArray->AppendL( EMuiuDynInitInfoText ); |
|
1330 iInitIdArray->AppendL( base->iItemId ); |
|
1331 iInitIdArray->AppendL( ToUid( EIMASBtnSignatureYes ) ); |
|
1332 iInitValueArray->AppendL( button ); |
|
1333 |
|
1334 TMuiuSettingsText text; |
|
1335 iAccountSettings->iSignature->iRichText->Extract( |
|
1336 text, 0, KImasImailSignatureLength ); |
|
1337 iInitTextArray->AppendL( &text ); |
|
1338 |
|
1339 InitAnyMultiItem( |
|
1340 NULL, *iInitIdArray, iInitValueArray, iInitTextArray, iInitInfoArray ); |
|
1341 iInitTextArray->Reset(); |
|
1342 } |
|
1343 |
|
1344 // ---------------------------------------------------------------------------- |
|
1345 // CIMSSettingsDialog::InitializeIap() |
|
1346 // ---------------------------------------------------------------------------- |
|
1347 // |
|
1348 TInt CIMSSettingsDialog::InitializeIap( const TUid& aIapItemId ) |
|
1349 { |
|
1350 IMUM_CONTEXT( CIMSSettingsDialog::InitializeIap, 0, KLogUi ); |
|
1351 |
|
1352 CIMSSettingsAccessPointItem* apItem = |
|
1353 static_cast<CIMSSettingsAccessPointItem*>( |
|
1354 NextItemSearch( aIapItemId ) ); |
|
1355 |
|
1356 if ( aIapItemId.iUid == EIMASIncomingIap ) |
|
1357 { |
|
1358 apItem->iIap.iId = iAccountSettings->iIncomingIap; |
|
1359 } |
|
1360 else |
|
1361 { |
|
1362 apItem->iIap.iId = iAccountSettings->iOutgoingIap; |
|
1363 } |
|
1364 |
|
1365 TRAPD( err, iMailboxApi.CommDbUtilsL(). |
|
1366 InitItemAccessPointL( *apItem, EFalse ) ); |
|
1367 |
|
1368 // Initialize the items and prepare the setting item |
|
1369 SetInitializeFlags( err ); |
|
1370 |
|
1371 return err; |
|
1372 } |
|
1373 |
|
1374 // ---------------------------------------------------------------------------- |
|
1375 // CIMSSettingsDialog::InitializeRetrievedParts() |
|
1376 // ---------------------------------------------------------------------------- |
|
1377 // |
|
1378 TInt CIMSSettingsDialog::InitializeRetrievedParts() |
|
1379 { |
|
1380 IMUM_CONTEXT( CIMSSettingsDialog::InitializeRetrievedParts, 0, KLogUi ); |
|
1381 |
|
1382 TRAPD( error, InitializeRetrievedPartsL() ); |
|
1383 |
|
1384 return error; |
|
1385 } |
|
1386 |
|
1387 // ---------------------------------------------------------------------------- |
|
1388 // CIMSSettingsDialog::InitializeRetrievedPartsL() |
|
1389 // ---------------------------------------------------------------------------- |
|
1390 // |
|
1391 void CIMSSettingsDialog::InitializeRetrievedPartsL() |
|
1392 { |
|
1393 IMUM_CONTEXT( CIMSSettingsDialog::InitializeRetrievedPartsL, 0, KLogUi ); |
|
1394 |
|
1395 // Reset the arrays |
|
1396 InitializeResetArrays(); |
|
1397 |
|
1398 // Fetch next item |
|
1399 CMuiuSettingsLinkExtended* radioArray = |
|
1400 static_cast<CMuiuSettingsLinkExtended*>( |
|
1401 NextItemSearch( ToUid( EIMASDownloadRetrievedParts ) ) ); |
|
1402 |
|
1403 // Add id's to tree |
|
1404 TInt button = 0; |
|
1405 TInt sizeFilter = KIMSDefaultSizeKB; |
|
1406 iInitTreeArray->AppendL( ToUid( EIMASMainDownloadCtrl ) ); |
|
1407 iInitIdArray->AppendL( ToUid( EIMASDownloadRetrievedParts ) ); |
|
1408 iInitIdArray->AppendL( ToUid( EIMASBtnRetrieveLimit ) ); |
|
1409 |
|
1410 // Handle each protocol individually |
|
1411 if ( iAccountSettings->iIsImap4 ) |
|
1412 { |
|
1413 // Get the settings |
|
1414 TImImap4PartialMailOptions partial = |
|
1415 iAccountSettings->iImap4Settings->PartialMailOptions(); |
|
1416 TImap4GetMailOptions options = |
|
1417 iAccountSettings->iImap4Settings->GetMailOptions(); |
|
1418 |
|
1419 // Define button from setting |
|
1420 // Setting can be only header, keep it so |
|
1421 button = 0; |
|
1422 } |
|
1423 else |
|
1424 { |
|
1425 sizeFilter = iAccountSettings->iPop3Settings->PopulationLimit(); |
|
1426 |
|
1427 // Check the headers only button |
|
1428 if ( sizeFilter == EIMASMapHeadersOnly ) |
|
1429 { |
|
1430 button = GetSubItemIndex( |
|
1431 *radioArray, ToUid( EIMASBtnRetrieveHeader ), EFalse ); |
|
1432 } |
|
1433 // Body and attachment |
|
1434 else if ( sizeFilter == EIMASMapFullBody ) |
|
1435 { |
|
1436 button = GetSubItemIndex( |
|
1437 *radioArray, ToUid( EIMASBtnRetrieveBodyAtt ), EFalse ); |
|
1438 } |
|
1439 // User defined |
|
1440 else |
|
1441 { |
|
1442 button = GetSubItemIndex( |
|
1443 *radioArray, ToUid( EIMASBtnRetrieveLimit ), EFalse ); |
|
1444 } |
|
1445 } |
|
1446 |
|
1447 // Initialize the items and prepare the setting item |
|
1448 sizeFilter = sizeFilter < 0 ? KIMSDefaultSizeKB : sizeFilter; |
|
1449 sizeFilter = sizeFilter > KIMSMaxNumValue ? |
|
1450 KIMSDefaultSizeKB : sizeFilter; |
|
1451 |
|
1452 iInitValueArray->AppendL( button ); |
|
1453 iInitValueArray->AppendL( sizeFilter ); |
|
1454 InitAnyMultiItem( iInitTreeArray, *iInitIdArray, iInitValueArray ); |
|
1455 |
|
1456 IncludePartialFetchString( *radioArray ); |
|
1457 } |
|
1458 |
|
1459 // ---------------------------------------------------------------------------- |
|
1460 // CIMSSettingsDialog::InitializeAoHoursL() |
|
1461 // ---------------------------------------------------------------------------- |
|
1462 // |
|
1463 TInt CIMSSettingsDialog::InitializeAoHoursL() |
|
1464 { |
|
1465 IMUM_CONTEXT( CIMSSettingsDialog::InitializeAoHoursL, 0, KLogUi ); |
|
1466 |
|
1467 TInt error = KErrNone; |
|
1468 |
|
1469 // Fetch next item and its subitems |
|
1470 CMuiuSettingsLinkExtended* radioArray = |
|
1471 static_cast<CMuiuSettingsLinkExtended*>( |
|
1472 NextItemSearch( ToUid( EIMASAOHours ) ) ); |
|
1473 CMuiuSettingsEditValue* sub1 = NULL; |
|
1474 CMuiuSettingsEditValue* sub2 = NULL; |
|
1475 FindMultilineEditorL( ToUid( EIMASEditAoHoursEditor ), sub1, sub2 ); |
|
1476 __ASSERT_DEBUG( sub1 && sub2, User::Panic( |
|
1477 KIMSSettingsDialogPanic, KErrNotFound ) ); |
|
1478 |
|
1479 sub1->SetValue( |
|
1480 iAccountSettings->iExtendedSettings->SelectedTimeStart().Int64() ); |
|
1481 sub2->SetValue( |
|
1482 iAccountSettings->iExtendedSettings->SelectedTimeStop().Int64() ); |
|
1483 |
|
1484 // Update the status |
|
1485 if ( sub1->Value() == sub2->Value() ) |
|
1486 { |
|
1487 radioArray->SetValue( EIMASAoHoursAll ); |
|
1488 CheckRadioButton( *radioArray, EIMASAoHoursAll ); |
|
1489 |
|
1490 TRAP( error, |
|
1491 UpdateItemDefaultSettingTextL( *radioArray ) ); |
|
1492 } |
|
1493 else |
|
1494 { |
|
1495 radioArray->SetValue( EIMASAoHoursUserDefined ); |
|
1496 CheckRadioButton( *radioArray, EIMASAoHoursUserDefined ); |
|
1497 |
|
1498 TRAP( error, |
|
1499 UpdateItemCustomSettingTextL( *radioArray, *sub1, *sub2 ) ); |
|
1500 } |
|
1501 |
|
1502 radioArray = NULL; |
|
1503 sub1 = NULL; |
|
1504 sub2 = NULL; |
|
1505 |
|
1506 return error; |
|
1507 } |
|
1508 |
|
1509 // ---------------------------------------------------------------------------- |
|
1510 // CIMSSettingsDialog::InitializeSecuritySettings() |
|
1511 // ---------------------------------------------------------------------------- |
|
1512 // |
|
1513 void CIMSSettingsDialog::InitializeSecuritySettings( |
|
1514 const TUid& aSecurityItemId ) |
|
1515 { |
|
1516 IMUM_CONTEXT( CIMSSettingsDialog::InitializeSecuritySettings, 0, KLogUi ); |
|
1517 |
|
1518 // Security |
|
1519 TIMASMailSecurity security = InitializeSecurity( aSecurityItemId ); |
|
1520 InitializeNext( aSecurityItemId, security ); |
|
1521 |
|
1522 // Port |
|
1523 InitializePort( security, aSecurityItemId.iUid == EIMASIncomingSecurity ); |
|
1524 } |
|
1525 |
|
1526 // ---------------------------------------------------------------------------- |
|
1527 // CIMSSettingsDialog::InitializeSecurity() |
|
1528 // ---------------------------------------------------------------------------- |
|
1529 // |
|
1530 TIMASMailSecurity CIMSSettingsDialog::InitializeSecurity( |
|
1531 const TUid& aSecurityItemId ) |
|
1532 { |
|
1533 IMUM_CONTEXT( CIMSSettingsDialog::InitializeSecurity, 0, KLogUi ); |
|
1534 |
|
1535 CImBaseEmailSettings* base = NULL; |
|
1536 |
|
1537 // Get the mailbox type |
|
1538 if ( aSecurityItemId.iUid == EIMASIncomingSecurity ) |
|
1539 { |
|
1540 if ( iAccountSettings->iIsImap4 ) |
|
1541 { |
|
1542 base = iAccountSettings->iImap4Settings; |
|
1543 } |
|
1544 else |
|
1545 { |
|
1546 base = iAccountSettings->iPop3Settings; |
|
1547 } |
|
1548 } |
|
1549 else |
|
1550 { |
|
1551 base = iAccountSettings->iSmtpSettings; |
|
1552 } |
|
1553 |
|
1554 TIMASMailSecurity security( EImumSecurityOff ); |
|
1555 |
|
1556 // Security: TLS |
|
1557 if( base->SecureSockets() ) |
|
1558 { |
|
1559 security = EImumSecurityOn; |
|
1560 } |
|
1561 // Security: MS |
|
1562 else if( base->SSLWrapper() ) |
|
1563 { |
|
1564 security = EImumSecurityMs; |
|
1565 } |
|
1566 // Security Off |
|
1567 else |
|
1568 { |
|
1569 security = EImumSecurityOff; |
|
1570 } |
|
1571 |
|
1572 return security; |
|
1573 } |
|
1574 |
|
1575 // ---------------------------------------------------------------------------- |
|
1576 // CIMSSettingsDialog::InitializePort() |
|
1577 // ---------------------------------------------------------------------------- |
|
1578 // |
|
1579 TInt CIMSSettingsDialog::InitializePort( |
|
1580 const TIMASMailSecurity aSecurity, |
|
1581 const TBool aIncoming ) |
|
1582 { |
|
1583 IMUM_CONTEXT( CIMSSettingsDialog::InitializePort, 0, KLogUi ); |
|
1584 |
|
1585 TRAPD( error, InitializePortL( aSecurity, aIncoming ) ); |
|
1586 |
|
1587 return error; |
|
1588 } |
|
1589 |
|
1590 // ---------------------------------------------------------------------------- |
|
1591 // CIMSSettingsDialog::InitializePortL() |
|
1592 // ---------------------------------------------------------------------------- |
|
1593 // |
|
1594 void CIMSSettingsDialog::InitializePortL( |
|
1595 const TIMASMailSecurity aSecurity, |
|
1596 const TBool aIncoming ) |
|
1597 { |
|
1598 IMUM_CONTEXT( CIMSSettingsDialog::InitializePortL, 0, KLogUi ); |
|
1599 |
|
1600 // Get next item in the array |
|
1601 InitializeResetArrays(); |
|
1602 |
|
1603 // Add id's to list |
|
1604 TInt button = KErrNotFound; |
|
1605 TInt port = 0; |
|
1606 |
|
1607 TUint32 defaultPort = MsvEmailMtmUiUtils::GetDefaultSecurityPort( |
|
1608 aSecurity, aIncoming, iAccountSettings->iIsImap4 ); |
|
1609 |
|
1610 // Make the first check between incoming and outgoing protocol |
|
1611 if ( aIncoming ) |
|
1612 { |
|
1613 // Add id's to tree |
|
1614 iInitTreeArray->AppendL( ToUid( EIMASMailboxIncoming ) ); |
|
1615 iInitIdArray->AppendL( ToUid( EIMASIncomingPort ) ); |
|
1616 iInitIdArray->AppendL( ToUid( EIMASBtnPortUserDefined ) ); |
|
1617 |
|
1618 // Another check, this time between receiving protocol |
|
1619 if ( iAccountSettings->iIsImap4 ) |
|
1620 { |
|
1621 port = iAccountSettings->iImap4Settings->Port(); |
|
1622 } |
|
1623 else |
|
1624 { |
|
1625 port = iAccountSettings->iPop3Settings->Port(); |
|
1626 } |
|
1627 } |
|
1628 else |
|
1629 { |
|
1630 // Add id's to tree and to id array |
|
1631 iInitTreeArray->AppendL( ToUid( EIMASMailboxOutgoing ) ); |
|
1632 iInitIdArray->AppendL( ToUid( EIMASOutgoingPort ) ); |
|
1633 iInitIdArray->AppendL( ToUid( EIMASBtnPortUserDefined ) ); |
|
1634 |
|
1635 port = iAccountSettings->iSmtpSettings->Port(); |
|
1636 } |
|
1637 |
|
1638 button = ( port == defaultPort ) ? EIMASPortDefault : EIMASPortUserDefined; |
|
1639 iInitValueArray->AppendL( button ); |
|
1640 iInitValueArray->AppendL( port ); |
|
1641 InitAnyMultiItem( iInitTreeArray, *iInitIdArray, iInitValueArray ); |
|
1642 |
|
1643 UpdateItemText( ToUid( EIMASIncomingPort ) ); |
|
1644 UpdateItemText( ToUid( EIMASOutgoingPort ) ); |
|
1645 } |
|
1646 |
|
1647 // ---------------------------------------------------------------------------- |
|
1648 // CIMSSettingsDialog::InitializeFolderPath() |
|
1649 // ---------------------------------------------------------------------------- |
|
1650 // |
|
1651 TInt CIMSSettingsDialog::InitializeFolderPath() |
|
1652 { |
|
1653 IMUM_CONTEXT( CIMSSettingsDialog::InitializeFolderPath, 0, KLogUi ); |
|
1654 |
|
1655 TInt error = KErrNone; |
|
1656 |
|
1657 // Folder path is only for IMAP4 |
|
1658 if ( iAccountSettings->iIsImap4 ) |
|
1659 { |
|
1660 TMuiuSettingsText buffer; |
|
1661 buffer.Copy( iAccountSettings->iImap4Settings->FolderPath() ); |
|
1662 |
|
1663 // In case path is not set, show default value |
|
1664 if ( !buffer.Length() ) |
|
1665 { |
|
1666 HBufC* text = NULL; |
|
1667 error = SafeStringLoad( R_IMUM_SETTINGS_UNIX_PATH, text ); |
|
1668 |
|
1669 if ( error == KErrNone ) |
|
1670 { |
|
1671 buffer.Copy( *text ); |
|
1672 } |
|
1673 |
|
1674 delete text; |
|
1675 text = NULL; |
|
1676 } |
|
1677 |
|
1678 InitializeNext( ToUid( EIMASUserUnixPath ), buffer ); |
|
1679 } |
|
1680 |
|
1681 return error; |
|
1682 } |
|
1683 |
|
1684 // ---------------------------------------------------------------------------- |
|
1685 // CIMSSettingsDialog::InitializeAoDays() |
|
1686 // ---------------------------------------------------------------------------- |
|
1687 // |
|
1688 TInt CIMSSettingsDialog::InitializeAoDays() |
|
1689 { |
|
1690 IMUM_CONTEXT( CIMSSettingsDialog::InitializeAoDays, 0, KLogUi ); |
|
1691 |
|
1692 // Fetch the days from settings |
|
1693 TInt error = KErrNone; |
|
1694 TInt selectedDays = |
|
1695 iAccountSettings->iExtendedSettings->SelectedWeekDays(); |
|
1696 |
|
1697 // Make sure that all the checkbox are checked, |
|
1698 // if none of the buttons are checked |
|
1699 if ( !selectedDays ) |
|
1700 { |
|
1701 selectedDays = KIMASEveryDayMask; |
|
1702 } |
|
1703 |
|
1704 HBufC* text = NULL; |
|
1705 error = SafeStringLoad( ( ( selectedDays == KIMASEveryDayMask ) ? |
|
1706 R_IMAS_SETTINGS_DIALOG_DAY_LIST_ALL : |
|
1707 R_IMAS_SETTINGS_DIALOG_DAY_LIST_USERDEFINED ), text ); |
|
1708 |
|
1709 // Initialize item |
|
1710 InitializeNext( ToUid( EIMASAODays ), selectedDays, *text ); |
|
1711 |
|
1712 delete text; |
|
1713 text = NULL; |
|
1714 |
|
1715 return error; |
|
1716 } |
|
1717 |
|
1718 // ---------------------------------------------------------------------------- |
|
1719 // CIMSSettingsDialog::InitializeAoIntervalButtons() |
|
1720 // ---------------------------------------------------------------------------- |
|
1721 // |
|
1722 void CIMSSettingsDialog::InitializeAoIntervalButtons( |
|
1723 TInt& aInterval ) |
|
1724 { |
|
1725 IMUM_CONTEXT( CIMSSettingsDialog::InitializeAoIntervalButtons, 0, KLogUi ); |
|
1726 |
|
1727 TBool csd = Flag( EDialogCsdAccessPoint ); |
|
1728 |
|
1729 TBool hide5and15minutes(EFalse); |
|
1730 TBool hide60minutes(EFalse); |
|
1731 |
|
1732 //5 and 15 minute intervals hidden for CSD |
|
1733 SetHideItem( csd, ToUid( EIMASBtnAo5Min ) ); |
|
1734 SetHideItem( csd, ToUid( EIMASBtnAo15Min ) ); |
|
1735 hide5and15minutes = csd; |
|
1736 |
|
1737 SetStoreFlags( ETrue, EIMASAOInterval ); |
|
1738 |
|
1739 // interval is 0 only when account is first created |
|
1740 // if interval is one of the hidden values it is changed to default. |
|
1741 if ( aInterval == 0 || ( hide5and15minutes & ( |
|
1742 ( aInterval == KIMASAoInterval5Min ) || |
|
1743 ( aInterval == KIMASAoInterval15Min ) ) ) || |
|
1744 ( hide60minutes & (aInterval == KIMASAoInterval1Hour ) ) ) |
|
1745 { |
|
1746 //with default connection feature, we use 1 hour |
|
1747 //default for both imap and pop. |
|
1748 aInterval = KIMASAoInterval1Hour; |
|
1749 } |
|
1750 } |
|
1751 |
|
1752 |
|
1753 // ---------------------------------------------------------------------------- |
|
1754 // CIMSSettingsDialog::InitializeAoIntervalEditor() |
|
1755 // ---------------------------------------------------------------------------- |
|
1756 // |
|
1757 void CIMSSettingsDialog::InitializeAoIntervalEditor( |
|
1758 TInt& aInterval, |
|
1759 HBufC*& aText ) |
|
1760 { |
|
1761 IMUM_CONTEXT( CIMSSettingsDialog::InitializeAoIntervalEditor, 0, KLogUi ); |
|
1762 |
|
1763 TInt intervalResource = 0; |
|
1764 InitializeAoIntervalButtons( aInterval ); |
|
1765 |
|
1766 switch ( aInterval ) |
|
1767 { |
|
1768 case KIMASAoInterval5Min: |
|
1769 aInterval = EIMASAoInterval5Min; |
|
1770 intervalResource = R_IMAS_SETTINGS_DIALOG_INTERVALS_FIRST; |
|
1771 break; |
|
1772 |
|
1773 case KIMASAoInterval15Min: |
|
1774 aInterval = EIMASAoInterval15Min; |
|
1775 intervalResource = R_IMAS_SETTINGS_DIALOG_INTERVALS_SECOND; |
|
1776 break; |
|
1777 |
|
1778 case KIMASAoInterval30Min: |
|
1779 aInterval = EIMASAoInterval30Min; |
|
1780 intervalResource = R_IMAS_SETTINGS_DIALOG_INTERVALS_THIRD; |
|
1781 break; |
|
1782 |
|
1783 case KIMASAoInterval1Hour: |
|
1784 aInterval = EIMASAoInterval1Hour; |
|
1785 intervalResource = R_IMAS_SETTINGS_DIALOG_INTERVALS_FOURTH; |
|
1786 break; |
|
1787 |
|
1788 default: |
|
1789 case KIMASAoInterval2Hours: |
|
1790 aInterval = EIMASAoInterval2Hours; |
|
1791 intervalResource = R_IMAS_SETTINGS_DIALOG_INTERVALS_FIFTH; |
|
1792 break; |
|
1793 |
|
1794 case KIMASAoInterval4Hours: |
|
1795 aInterval = EIMASAoInterval4Hours; |
|
1796 intervalResource = R_IMAS_SETTINGS_DIALOG_INTERVALS_SIXTH; |
|
1797 break; |
|
1798 |
|
1799 case KIMASAoInterval6Hours: |
|
1800 aInterval = EIMASAoInterval6Hours; |
|
1801 intervalResource = R_IMAS_SETTINGS_DIALOG_INTERVALS_SEVENTH; |
|
1802 break; |
|
1803 } |
|
1804 |
|
1805 SafeStringLoad( intervalResource, aText ); |
|
1806 |
|
1807 __ASSERT_DEBUG( aText != NULL, User::Panic( |
|
1808 KIMSSettingsDialogPanic, KErrNotFound ) ); |
|
1809 } |
|
1810 |
|
1811 |
|
1812 // ---------------------------------------------------------------------------- |
|
1813 // CIMSSettingsDialog::InitializeAoInterval() |
|
1814 // ---------------------------------------------------------------------------- |
|
1815 // |
|
1816 void CIMSSettingsDialog::InitializeAoInterval() |
|
1817 { |
|
1818 IMUM_CONTEXT( CIMSSettingsDialog::InitializeAoInterval, 0, KLogUi ); |
|
1819 |
|
1820 TInt interval = iAccountSettings->iExtendedSettings->InboxRefreshTime(); |
|
1821 HBufC* text = NULL; |
|
1822 |
|
1823 InitializeAoIntervalEditor( interval, text ); |
|
1824 |
|
1825 // If the text can't be fetched |
|
1826 if ( text ) |
|
1827 { |
|
1828 InitializeNext( ToUid( EIMASAOInterval ), interval, *text ); |
|
1829 delete text; |
|
1830 text = NULL; |
|
1831 } |
|
1832 else |
|
1833 { |
|
1834 InitializeNext( ToUid( EIMASAOInterval ), interval ); |
|
1835 } |
|
1836 } |
|
1837 |
|
1838 |
|
1839 /****************************************************************************** |
|
1840 |
|
1841 Setting validating |
|
1842 |
|
1843 ******************************************************************************/ |
|
1844 |
|
1845 // ---------------------------------------------------------------------------- |
|
1846 // CIMSSettingsDialog::StoreSettingsToAccountL() |
|
1847 // ---------------------------------------------------------------------------- |
|
1848 // |
|
1849 void CIMSSettingsDialog::StoreSettingsToAccountL( |
|
1850 CImumInSettingsData& aSettings ) |
|
1851 { |
|
1852 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsToAccountL, 0, KLogUi ); |
|
1853 |
|
1854 // This function is called, when user is about to exit the mailbox |
|
1855 // settings. This function checks if changes are made for any settings |
|
1856 // and stores the changed settings. |
|
1857 |
|
1858 TInt error = KErrNone; |
|
1859 // Incoming settings |
|
1860 if ( Flag( EDialogIncomingChanged ) ) |
|
1861 { |
|
1862 TRAP( error, StoreSettingsIncomingL() ); |
|
1863 __ASSERT_DEBUG( !error, User::Panic( KIMSSettingsDialogPanic, error ) ); |
|
1864 } |
|
1865 |
|
1866 // Outgoing settings |
|
1867 if ( Flag( EDialogOutgoingChanged ) ) |
|
1868 { |
|
1869 TRAP( error, StoreSettingsOutgoingL() ); |
|
1870 __ASSERT_DEBUG( !error, User::Panic( KIMSSettingsDialogPanic, error ) ); |
|
1871 } |
|
1872 |
|
1873 // User preferences |
|
1874 if ( Flag( EDialogUserPrefChanged ) ) |
|
1875 { |
|
1876 TRAP( error, StoreSettingsUserPrefL() ); |
|
1877 __ASSERT_DEBUG( !error, User::Panic( KIMSSettingsDialogPanic, error ) ); |
|
1878 } |
|
1879 |
|
1880 // Retrieval limit |
|
1881 if ( Flag( EDialogRetLimitChanged ) ) |
|
1882 { |
|
1883 TRAP( error, StoreSettingsRetLimitL() ); |
|
1884 __ASSERT_DEBUG( !error, User::Panic( KIMSSettingsDialogPanic, error ) ); |
|
1885 } |
|
1886 |
|
1887 // Download preferences |
|
1888 if ( Flag( EDialogDownloadChanged ) ) |
|
1889 { |
|
1890 TRAP( error, StoreSettingsDownloadL() ); |
|
1891 __ASSERT_DEBUG( !error, User::Panic( KIMSSettingsDialogPanic, error ) ); |
|
1892 } |
|
1893 |
|
1894 // Always Online settings |
|
1895 if ( Flag( EDialogAlOnlineChanged ) ) |
|
1896 { |
|
1897 TRAP( error, StoreSettingsAlwaysOnlineL() ); |
|
1898 __ASSERT_DEBUG( !error, User::Panic( KIMSSettingsDialogPanic, error ) ); |
|
1899 } |
|
1900 |
|
1901 User::LeaveIfError( error ); |
|
1902 CImumMboxInternalDataConverter::ConvertToInternalMboxDataL( |
|
1903 iMailboxApi, *iAccountSettings, aSettings ); |
|
1904 } |
|
1905 |
|
1906 // ---------------------------------------------------------------------------- |
|
1907 // CIMSSettingsDialog::StoreSettingsIncomingL() |
|
1908 // ---------------------------------------------------------------------------- |
|
1909 // |
|
1910 void CIMSSettingsDialog::StoreSettingsIncomingL() |
|
1911 { |
|
1912 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsIncomingL, 0, KLogUi ); |
|
1913 |
|
1914 // Prepare for initialize |
|
1915 iInitResource = R_IMAS_INCOMING_SETTINGS; |
|
1916 InitializeNewResourceL(); |
|
1917 iInitSetFlag = EDialogAlOnlineChanged; |
|
1918 iInitCurrentIndex = KErrNotFound; |
|
1919 |
|
1920 // Get the protocol and store it |
|
1921 if ( iAccountSettings->iIsImap4 ) |
|
1922 { |
|
1923 StoreSettingsIncomingImap4L(); |
|
1924 } |
|
1925 else |
|
1926 { |
|
1927 StoreSettingsIncomingPop3L(); |
|
1928 } |
|
1929 |
|
1930 // clear last retrieval status |
|
1931 TAOInfo emptyInfo = iAccountSettings->iExtendedSettings->LastUpdateInfo(); |
|
1932 emptyInfo.iUpdateSuccessfulWithCurSettings = EFalse; |
|
1933 iAccountSettings->iExtendedSettings->SetLastUpdateInfo( |
|
1934 emptyInfo ); |
|
1935 |
|
1936 } |
|
1937 |
|
1938 // ---------------------------------------------------------------------------- |
|
1939 // CIMSSettingsDialog::StoreSettingsIncomingImap4L() |
|
1940 // ---------------------------------------------------------------------------- |
|
1941 // |
|
1942 void CIMSSettingsDialog::StoreSettingsIncomingImap4L() |
|
1943 { |
|
1944 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsIncomingImap4L, 0, KLogUi ); |
|
1945 |
|
1946 // Prepare for initialize |
|
1947 iInitResource = R_IMAS_INCOMING_SETTINGS; |
|
1948 InitializeNewResourceL(); |
|
1949 iInitSetFlag = EDialogAlOnlineChanged; |
|
1950 iInitCurrentIndex = KErrNotFound; |
|
1951 |
|
1952 // User name |
|
1953 iAccountSettings->iImap4Settings->SetLoginNameL( |
|
1954 StoreUsername( *StoreGetNextText( |
|
1955 ToUid( EIMASIncomingUserName ) ) ) ); |
|
1956 |
|
1957 // User password |
|
1958 iAccountSettings->iImap4Settings->SetPasswordL( |
|
1959 StorePassword( *StoreGetNextText( ToUid( EIMASIncomingUserPwd ) ), |
|
1960 EIMASStatusTempRcvPassword ) ); |
|
1961 |
|
1962 // Used mail server |
|
1963 iAccountSettings->iImap4Settings->SetServerAddressL( |
|
1964 *StoreGetNextText( ToUid( EIMASIncomingMailServer ) ) ); |
|
1965 |
|
1966 // Access point in use |
|
1967 StoreSettingsIapL( ETrue ); |
|
1968 |
|
1969 // Mailbox name |
|
1970 iAccountSettings->iName.Copy( |
|
1971 *StoreGetNextText( ToUid( EIMASIncomingMailboxName ) ) ); |
|
1972 |
|
1973 // Mailbox type (Readonly) |
|
1974 ++iInitCurrentIndex; |
|
1975 |
|
1976 // Security |
|
1977 StoreSettingsSecurityL( ETrue ); |
|
1978 |
|
1979 // Port |
|
1980 StorePortL( ETrue ); |
|
1981 } |
|
1982 |
|
1983 // ---------------------------------------------------------------------------- |
|
1984 // CIMSSettingsDialog::StoreSettingsIncomingPop3L() |
|
1985 // ---------------------------------------------------------------------------- |
|
1986 // |
|
1987 void CIMSSettingsDialog::StoreSettingsIncomingPop3L() |
|
1988 { |
|
1989 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsIncomingPop3L, 0, KLogUi ); |
|
1990 |
|
1991 // Prepare for initialize |
|
1992 iInitResource = R_IMAS_INCOMING_SETTINGS; |
|
1993 InitializeNewResourceL(); |
|
1994 iInitSetFlag = EDialogAlOnlineChanged; |
|
1995 iInitCurrentIndex = KErrNotFound; |
|
1996 |
|
1997 // User name |
|
1998 iAccountSettings->iPop3Settings->SetLoginNameL( |
|
1999 StoreUsername( *StoreGetNextText( |
|
2000 ToUid( EIMASIncomingUserName ) ) ) ); |
|
2001 |
|
2002 // User password |
|
2003 iAccountSettings->iPop3Settings->SetPasswordL( |
|
2004 StorePassword( *StoreGetNextText( ToUid( EIMASIncomingUserPwd ) ), |
|
2005 EIMASStatusTempRcvPassword ) ); |
|
2006 |
|
2007 // Used mail server |
|
2008 iAccountSettings->iPop3Settings->SetServerAddressL( |
|
2009 *StoreGetNextText( ToUid( EIMASIncomingMailServer ) ) ); |
|
2010 |
|
2011 // Access point in use |
|
2012 StoreSettingsIapL( ETrue ); |
|
2013 |
|
2014 // Mailbox name |
|
2015 iAccountSettings->iName.Copy( *StoreGetNextText( |
|
2016 ToUid( EIMASIncomingMailboxName ) ) ); |
|
2017 |
|
2018 // Mailbox type (Readonly) |
|
2019 ++iInitCurrentIndex; |
|
2020 |
|
2021 // Security |
|
2022 StoreSettingsSecurityL( ETrue ); |
|
2023 |
|
2024 // Port |
|
2025 StorePortL( ETrue ); |
|
2026 |
|
2027 // APOP secure login |
|
2028 iAccountSettings->iPop3Settings->SetApop( |
|
2029 StoreGetNextBoolean( ToUid( EIMASIncomingAPop ) ) == EIMASOn ? |
|
2030 ETrue : EFalse ); |
|
2031 } |
|
2032 |
|
2033 // ---------------------------------------------------------------------------- |
|
2034 // CIMSSettingsDialog::StoreSettingsOutgoingL() |
|
2035 // ---------------------------------------------------------------------------- |
|
2036 // |
|
2037 void CIMSSettingsDialog::StoreSettingsOutgoingL() |
|
2038 { |
|
2039 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsOutgoingL, 0, KLogUi ); |
|
2040 |
|
2041 // Prepare for initialize |
|
2042 iInitResource = R_IMAS_OUTGOING_SETTINGS; |
|
2043 InitializeNewResourceL(); |
|
2044 iInitSetFlag = EDialogAlOnlineChanged; |
|
2045 iInitCurrentIndex = KErrNotFound; |
|
2046 |
|
2047 const TDesC& emailAddress = *StoreGetNextText( |
|
2048 ToUid( EIMASOutgoingEmailAddress ) ); |
|
2049 |
|
2050 // Email address |
|
2051 iAccountSettings->iSmtpSettings->SetEmailAddressL( emailAddress ); |
|
2052 |
|
2053 // Email address must be updated also to extended settings |
|
2054 iAccountSettings->iExtendedSettings->SetEmailAddress( emailAddress ); |
|
2055 |
|
2056 // User name |
|
2057 iAccountSettings->iSmtpSettings->SetLoginNameL( |
|
2058 StoreUsername( *StoreGetNextText( |
|
2059 ToUid( EIMASOutgoingUserName ) ) ) ); |
|
2060 |
|
2061 // User password |
|
2062 iAccountSettings->iSmtpSettings->SetPasswordL( |
|
2063 StorePassword( *StoreGetNextText( ToUid( EIMASOutgoingUserPwd ) ), |
|
2064 EIMASStatusTempSndPassword ) ); |
|
2065 |
|
2066 // Used mail server |
|
2067 iAccountSettings->iSmtpSettings->SetServerAddressL( |
|
2068 *StoreGetNextText( ToUid( EIMASOutgoingMailServer ) ) ); |
|
2069 |
|
2070 // Access point in use |
|
2071 StoreSettingsIapL( EFalse ); |
|
2072 |
|
2073 // Security |
|
2074 StoreSettingsSecurityL( EFalse ); |
|
2075 |
|
2076 // Port |
|
2077 StorePortL( EFalse ); |
|
2078 } |
|
2079 |
|
2080 // ---------------------------------------------------------------------------- |
|
2081 // CIMSSettingsDialog::StoreSettingsUserPrefL() |
|
2082 // ---------------------------------------------------------------------------- |
|
2083 // |
|
2084 void CIMSSettingsDialog::StoreSettingsUserPrefL() |
|
2085 { |
|
2086 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsUserPrefL, 0, KLogUi ); |
|
2087 |
|
2088 // Prepare for initialize |
|
2089 iInitResource = R_IMAS_USER_PREFERENCES; |
|
2090 InitializeNewResourceL(); |
|
2091 iInitSetFlag = EDialogAlOnlineChanged; |
|
2092 iInitCurrentIndex = KErrNotFound; |
|
2093 |
|
2094 // Own Name |
|
2095 iAccountSettings->iSmtpSettings->SetEmailAliasL( |
|
2096 *StoreGetNextText( ToUid( EIMASUserOwnName ) ) ); |
|
2097 |
|
2098 // Send Message |
|
2099 iAccountSettings->iSmtpSettings->SetSendMessageOption( |
|
2100 StoreGetNextBoolean( ToUid( EIMASUserSendMsg ) ) ? |
|
2101 ESendMessageOnNextConnection : ESendMessageImmediately ); |
|
2102 |
|
2103 TImSMTPSendCopyToSelf sendCopy = StoreGetNextBoolean( ToUid( EIMASUserSendCopy ) ) ? |
|
2104 ESendNoCopy : ESendCopyAsCcRecipient; |
|
2105 // Send copy to self |
|
2106 iAccountSettings->iSmtpSettings->SetSendCopyToSelf(sendCopy); |
|
2107 |
|
2108 if(sendCopy == ESendCopyAsCcRecipient) |
|
2109 { |
|
2110 iAccountSettings->iSmtpSettings->SetReceiptAddressL(iAccountSettings->iSmtpSettings->EmailAddress()); |
|
2111 } |
|
2112 else |
|
2113 { |
|
2114 iAccountSettings->iSmtpSettings->SetReceiptAddressL(KNullDesC); |
|
2115 } |
|
2116 |
|
2117 |
|
2118 // Include Signature |
|
2119 StoreSettingsSignature(); |
|
2120 |
|
2121 // Show HTML mails |
|
2122 iAccountSettings->iExtendedSettings->SetOpenHtmlMail( |
|
2123 StoreGetNextBoolean( ToUid( EIMASUserShowHtml ) ) == EIMASYes ? |
|
2124 ETrue : EFalse ); |
|
2125 |
|
2126 // New mail indicators |
|
2127 iAccountSettings->iExtendedSettings->SetNewMailIndicators( |
|
2128 StoreGetNextBoolean( ToUid( EIMASUserNewMailInd ) ) == EIMASYes ? |
|
2129 ETrue : EFalse ); |
|
2130 |
|
2131 // Mail deletion |
|
2132 iAccountSettings->iExtendedSettings->SetMailDeletion( |
|
2133 static_cast< TIMASMailDeletionMode >( |
|
2134 StoreGetNextValue( ToUid( EIMASUserMailDeletion ) ) ) ); |
|
2135 |
|
2136 // Reply-to Address |
|
2137 const TDesC& replyToAddress = *StoreGetNextText( |
|
2138 ToUid( EIMASUserReplyTo ) ); |
|
2139 iAccountSettings->iSmtpSettings->SetReplyToAddressL( replyToAddress ); |
|
2140 |
|
2141 // Default encoding |
|
2142 iAccountSettings->iSmtpSettings->SetDefaultMsgCharSet( |
|
2143 TUid::Uid( StoreGetNextValue( ToUid( EIMASUserEncoding ) ) ) ); |
|
2144 } |
|
2145 |
|
2146 // ---------------------------------------------------------------------------- |
|
2147 // CIMSSettingsDialog::StoreSettingsSignature() |
|
2148 // ---------------------------------------------------------------------------- |
|
2149 // |
|
2150 void CIMSSettingsDialog::StoreSettingsSignature() |
|
2151 { |
|
2152 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsSignature, 0, KLogUi ); |
|
2153 |
|
2154 // First get the radio button value |
|
2155 CMuiuSettingBase* baseItem = GetItem( ToUid( EIMASUserIncludeSignature ) ); |
|
2156 iAccountSettings->iSmtpSettings->SetAddSignatureToEmail( |
|
2157 baseItem->Value() == EIMASYes ? ETrue : EFalse ); |
|
2158 |
|
2159 // Second get the signature text |
|
2160 baseItem = SettingFindEditor( *baseItem, ToUid( EIMASBtnSignatureYes ) ); |
|
2161 iAccountSettings->iSignature->iRichText->Reset(); |
|
2162 TRAP_IGNORE( iAccountSettings->iSignature->iRichText->InsertL( |
|
2163 0, *baseItem->Text() ) ); |
|
2164 } |
|
2165 |
|
2166 // ---------------------------------------------------------------------------- |
|
2167 // CIMSSettingsDialog::StoreSettingsRetLimitL() |
|
2168 // ---------------------------------------------------------------------------- |
|
2169 // |
|
2170 void CIMSSettingsDialog::StoreSettingsRetLimitL() |
|
2171 { |
|
2172 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsRetLimitL, 0, KLogUi ); |
|
2173 |
|
2174 // Prepare for initialize |
|
2175 iInitResource = R_IMAS_RETRIEVAL_LIMIT; |
|
2176 InitializeNewResourceL(); |
|
2177 iInitSetFlag = EDialogAlOnlineChanged; |
|
2178 iInitCurrentIndex = KErrNotFound; |
|
2179 |
|
2180 CMuiuSettingsLinkExtended* radioEditor = |
|
2181 static_cast<CMuiuSettingsLinkExtended*>( |
|
2182 GetItem( TUid::Uid( EIMASLimitInbox ) ) ); |
|
2183 CMuiuSettingsEditValue* editor = |
|
2184 static_cast<CMuiuSettingsEditValue*>( |
|
2185 SettingFindEditor( *radioEditor, ToUid( |
|
2186 EIMASBtnFetchUserDefined ) ) ); |
|
2187 |
|
2188 // Imap4 |
|
2189 if ( iAccountSettings->iIsImap4 ) |
|
2190 { |
|
2191 // 1. Inbox limit |
|
2192 iAccountSettings->iImap4Settings->SetInboxSynchronisationLimit( |
|
2193 radioEditor->Value() == EIMSLimitFetchAll ? |
|
2194 KErrNotFound : editor->Value() ); |
|
2195 |
|
2196 // 2. Subscribed folders limit EIMASLimitFolders |
|
2197 radioEditor = static_cast<CMuiuSettingsLinkExtended*>( |
|
2198 GetItem( TUid::Uid( EIMASLimitFolders ) ) ); |
|
2199 CMuiuSettingsLinkExtended* editor = |
|
2200 static_cast<CMuiuSettingsLinkExtended*>( |
|
2201 SettingFindEditor( *radioEditor, ToUid( |
|
2202 EIMASBtnFetchUserDefined ), EFalse ) ); |
|
2203 |
|
2204 iAccountSettings->iImap4Settings->SetMailboxSynchronisationLimit( |
|
2205 radioEditor->Value() == EIMSLimitFetchAll ? |
|
2206 KErrNotFound : editor->Value() ); |
|
2207 } |
|
2208 // Pop3 |
|
2209 else |
|
2210 { |
|
2211 // 1. Inbox limit |
|
2212 iAccountSettings->iPop3Settings->SetInboxSynchronisationLimit( |
|
2213 radioEditor->Value() == EIMSLimitFetchAll ? |
|
2214 KErrNotFound : editor->Value() ); |
|
2215 } |
|
2216 } |
|
2217 |
|
2218 // ---------------------------------------------------------------------------- |
|
2219 // CIMSSettingsDialog::StoreSettingsDownloadL() |
|
2220 // ---------------------------------------------------------------------------- |
|
2221 // |
|
2222 void CIMSSettingsDialog::StoreSettingsDownloadL() |
|
2223 { |
|
2224 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsDownloadL, 0, KLogUi ); |
|
2225 |
|
2226 // Prepare for initialize |
|
2227 iInitResource = R_IMAS_DOWNLOAD_SETTINGS; |
|
2228 InitializeNewResourceL(); |
|
2229 iInitSetFlag = EDialogAlOnlineChanged; |
|
2230 iInitCurrentIndex = KErrNotFound; |
|
2231 |
|
2232 // Retrieved parts |
|
2233 StoreRetrievedPartsL(); |
|
2234 |
|
2235 // Retrieval limit |
|
2236 ++iInitCurrentIndex; |
|
2237 |
|
2238 // Imap4 folder path |
|
2239 StoreFolderPathL(); |
|
2240 |
|
2241 // Folder subscriptions |
|
2242 ++iInitCurrentIndex; |
|
2243 |
|
2244 // Del. msgs. over limit |
|
2245 iAccountSettings->iExtendedSettings->SetHideMsgs( |
|
2246 StoreGetNextBoolean( ToUid( |
|
2247 EIMASDownloadMsgsOverLimit ) ) == EIMASYes ); |
|
2248 } |
|
2249 |
|
2250 // ---------------------------------------------------------------------------- |
|
2251 // CIMSSettingsDialog::StoreSettingsAlwaysOnlineL() |
|
2252 // ---------------------------------------------------------------------------- |
|
2253 // |
|
2254 void CIMSSettingsDialog::StoreSettingsAlwaysOnlineL() |
|
2255 { |
|
2256 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsAlwaysOnlineL, 0, KLogUi ); |
|
2257 |
|
2258 // Prepare for initialize |
|
2259 iInitResource = R_IMAS_ALWAYSONLINE_SETTINGS; |
|
2260 InitializeNewResourceL(); |
|
2261 iInitSetFlag = EDialogAlOnlineChanged; |
|
2262 iInitCurrentIndex = KErrNotFound; |
|
2263 |
|
2264 // Mail Message Notifications |
|
2265 iAccountSettings->iExtendedSettings->SetEmailNotificationState( |
|
2266 static_cast<TMailEmnStates>( StoreGetNextValue( |
|
2267 ToUid( EIMASMailNotifications ) ) ) ); |
|
2268 |
|
2269 TMailAoStates aoNewState = static_cast<TMailAoStates>( |
|
2270 StoreGetNextValue( ToUid( EIMASAORolling ) ) ); |
|
2271 |
|
2272 IMUM1( 0, "aoNewState = %d", aoNewState ); |
|
2273 |
|
2274 // Retrieval amount have to set "all" value, when always online is |
|
2275 // set on. There is also dynamic feature variation flag do always |
|
2276 // online fetch all or specific amount of headers |
|
2277 |
|
2278 TBool doFetchAllVariation = MsvEmailMtmUiFeatureUtils::LocalFeatureL( |
|
2279 KCRUidMuiuVariation, KMuiuEmailConfigFlags, |
|
2280 KEmailFeatureIdAlwaysonlineHeaders ); |
|
2281 |
|
2282 IMUM1( 0, "doFetchAllVariation = %d", doFetchAllVariation); |
|
2283 |
|
2284 // if user sets always online on, current state is OFF and new is ON |
|
2285 if( iAccountSettings->iExtendedSettings->AlwaysOnlineState() == EMailAoOff && |
|
2286 aoNewState != EMailAoOff && |
|
2287 doFetchAllVariation ) |
|
2288 { |
|
2289 if ( iAccountSettings->iIsImap4 ) |
|
2290 { |
|
2291 iAccountSettings->iImap4Settings->SetInboxSynchronisationLimit( |
|
2292 KErrNotFound ); |
|
2293 } |
|
2294 else |
|
2295 { |
|
2296 iAccountSettings->iPop3Settings->SetInboxSynchronisationLimit( |
|
2297 KErrNotFound ); |
|
2298 } |
|
2299 |
|
2300 IMUM0( 0, "SetInboxSynchronisationLimit = ALL" ); |
|
2301 } |
|
2302 // user sets ao OFF, change retrieval amount back to default |
|
2303 // we don't remember old retrieval amout value |
|
2304 else if( iAccountSettings->iExtendedSettings->AlwaysOnlineState() != EMailAoOff && |
|
2305 aoNewState == EMailAoOff && |
|
2306 doFetchAllVariation ) |
|
2307 { |
|
2308 if ( iAccountSettings->iIsImap4 ) |
|
2309 { |
|
2310 iAccountSettings->iImap4Settings->SetInboxSynchronisationLimit( |
|
2311 KImumMboxDefaultInboxUpdateLimit ); |
|
2312 } |
|
2313 else |
|
2314 { |
|
2315 iAccountSettings->iPop3Settings->SetInboxSynchronisationLimit( |
|
2316 KImumMboxDefaultInboxUpdateLimit ); |
|
2317 } |
|
2318 IMUM0( 0, "SetInboxSynchronisationLimit = KImumMboxDefaultInboxUpdateLimit" ); |
|
2319 } |
|
2320 |
|
2321 // Automatic Retrieval |
|
2322 iAccountSettings->iExtendedSettings->SetAlwaysOnlineState( aoNewState ); |
|
2323 |
|
2324 // Retrieval Days |
|
2325 iAccountSettings->iExtendedSettings->SetSelectedWeekDays( |
|
2326 StoreGetNextValue( ToUid( EIMASAODays ) ) ); |
|
2327 |
|
2328 // Retrieval hours |
|
2329 StoreAoHoursL(); |
|
2330 |
|
2331 // Retrieval interval |
|
2332 StoreAoInterval(); |
|
2333 } |
|
2334 |
|
2335 // ---------------------------------------------------------------------------- |
|
2336 // CIMSSettingsDialog::StoreSettingsIapL() |
|
2337 // ---------------------------------------------------------------------------- |
|
2338 // |
|
2339 void CIMSSettingsDialog::StoreSettingsIapL( const TBool aIsIncoming ) |
|
2340 { |
|
2341 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsIapL, 0, KLogUi ); |
|
2342 |
|
2343 // Fetch next item |
|
2344 TUid id = ToUid( aIsIncoming ? EIMASIncomingIap : EIMASOutgoingIap ); |
|
2345 CMuiuSettingBase* base = NextItemSearch( id ); |
|
2346 CIMSSettingsAccessPointItem* iapItem = |
|
2347 static_cast<CIMSSettingsAccessPointItem*>( base ); |
|
2348 |
|
2349 // Change the state depending on the protocol |
|
2350 // The item validator sets the states for the item itself, while storing |
|
2351 // needs only to copy the value into the settings |
|
2352 if ( aIsIncoming ) |
|
2353 { |
|
2354 // Incoming settings |
|
2355 if( iapItem->iIap.iResult == CMManager::EAlwaysAsk ) |
|
2356 { |
|
2357 // Set to Default connection, always ask is handled that way |
|
2358 iAccountSettings->iIncomingIap = 0; |
|
2359 } |
|
2360 else |
|
2361 { |
|
2362 iAccountSettings->iIncomingIap = iapItem->iIap.iId; |
|
2363 } |
|
2364 |
|
2365 if ( iAccountSettings->iIsImap4 ) |
|
2366 { |
|
2367 iAccountSettings->iImap4Settings->SetFetchSizeL( |
|
2368 iMailboxApi.CommDbUtilsL().DetermineImap4BufferSize( |
|
2369 iAccountSettings->iIncomingIap, *iDefaultData ) ); |
|
2370 } |
|
2371 } |
|
2372 else |
|
2373 { |
|
2374 // Outgoing settings |
|
2375 if( iapItem->iIap.iResult == CMManager::EAlwaysAsk ) |
|
2376 { |
|
2377 // Set to Default connection, always ask is handled that way |
|
2378 iAccountSettings->iOutgoingIap = 0; |
|
2379 } |
|
2380 else |
|
2381 { |
|
2382 iAccountSettings->iOutgoingIap = iapItem->iIap.iId; |
|
2383 } |
|
2384 } |
|
2385 } |
|
2386 |
|
2387 // ---------------------------------------------------------------------------- |
|
2388 // CIMSSettingsDialog::StoreSettingsSecurityL() |
|
2389 // ---------------------------------------------------------------------------- |
|
2390 // |
|
2391 void CIMSSettingsDialog::StoreSettingsSecurityL( const TBool aIsIncoming ) |
|
2392 { |
|
2393 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsSecurityL, 0, KLogUi ); |
|
2394 |
|
2395 // Make a protocol check |
|
2396 if ( aIsIncoming ) |
|
2397 { |
|
2398 TIMASMailSecurity security = |
|
2399 static_cast<TIMASMailSecurity>( StoreGetNextValue( |
|
2400 ToUid( EIMASIncomingSecurity ) ) ); |
|
2401 |
|
2402 |
|
2403 if ( iAccountSettings->iIsImap4 ) |
|
2404 { |
|
2405 // Imap4 settings |
|
2406 MsvEmailMtmUiUtils::StoreSecuritySettings( |
|
2407 *iAccountSettings->iImap4Settings, security ); |
|
2408 } |
|
2409 else |
|
2410 { |
|
2411 // Pop3 settings |
|
2412 MsvEmailMtmUiUtils::StoreSecuritySettings( |
|
2413 *iAccountSettings->iPop3Settings, security ); |
|
2414 } |
|
2415 |
|
2416 } |
|
2417 else |
|
2418 { |
|
2419 TIMASMailSecurity security = |
|
2420 static_cast<TIMASMailSecurity>( StoreGetNextValue( |
|
2421 ToUid( EIMASOutgoingSecurity ) ) ); |
|
2422 // Smtp settings |
|
2423 MsvEmailMtmUiUtils::StoreSecuritySettings( |
|
2424 *iAccountSettings->iSmtpSettings, security ); |
|
2425 } |
|
2426 } |
|
2427 |
|
2428 // ---------------------------------------------------------------------------- |
|
2429 // CIMSSettingsDialog::StoreSettingsRetrievedPartsImap4L() |
|
2430 // ---------------------------------------------------------------------------- |
|
2431 // |
|
2432 void CIMSSettingsDialog::StoreSettingsRetrievedPartsImap4L( |
|
2433 const TImap4GetMailOptions aOptions, |
|
2434 const TImImap4PartialMailOptions aPartial ) |
|
2435 { |
|
2436 IMUM_CONTEXT( CIMSSettingsDialog::StoreSettingsRetrievedPartsImap4L, 0, KLogUi ); |
|
2437 |
|
2438 // Set mail fetching options |
|
2439 iAccountSettings->iImap4Settings->SetGetMailOptions( aOptions ); |
|
2440 |
|
2441 // Set partial options |
|
2442 iAccountSettings->iImap4Settings->SetPartialMailOptionsL( aPartial ); |
|
2443 } |
|
2444 |
|
2445 // ---------------------------------------------------------------------------- |
|
2446 // CIMSSettingsDialog::StoreRetrievedValuesImap4L() |
|
2447 // ---------------------------------------------------------------------------- |
|
2448 // |
|
2449 void CIMSSettingsDialog::StoreRetrievedValuesImap4L( const TInt32 aSize ) |
|
2450 { |
|
2451 IMUM_CONTEXT( CIMSSettingsDialog::StoreRetrievedValuesImap4L, 0, KLogUi ); |
|
2452 |
|
2453 iAccountSettings->iImap4Settings->SetBodyTextSizeLimitL( aSize ); |
|
2454 iAccountSettings->iImap4Settings->SetAttachmentSizeLimitL( aSize ); |
|
2455 } |
|
2456 |
|
2457 // ---------------------------------------------------------------------------- |
|
2458 // CIMSSettingsDialog::StoreRetrievedPartsL() |
|
2459 // ---------------------------------------------------------------------------- |
|
2460 // |
|
2461 void CIMSSettingsDialog::StoreRetrievedPartsL() |
|
2462 { |
|
2463 IMUM_CONTEXT( CIMSSettingsDialog::StoreRetrievedPartsL, 0, KLogUi ); |
|
2464 |
|
2465 // Get the selected button |
|
2466 CMuiuSettingBase* base = |
|
2467 NextItemSearch( ToUid( EIMASDownloadRetrievedParts ) ); |
|
2468 CMuiuSettingsLinkExtended* radioArray = |
|
2469 static_cast<CMuiuSettingsLinkExtended*>( base ); |
|
2470 |
|
2471 TUid id = ToUid( 0 ); |
|
2472 TInt index = 0; |
|
2473 FindCheckedRadiobutton( *radioArray, id, index ); |
|
2474 |
|
2475 // Individual handling for imap4 and pop3 protocols |
|
2476 if ( iAccountSettings->iIsImap4 ) |
|
2477 { |
|
2478 // Only headers are fetched during the sync |
|
2479 StoreSettingsRetrievedPartsImap4L( EGetImap4EmailHeaders ); |
|
2480 StoreRetrievedValuesImap4L(); |
|
2481 } |
|
2482 else |
|
2483 { |
|
2484 switch ( id.iUid ) |
|
2485 { |
|
2486 case EIMASBtnRetrieveBodyAtt: |
|
2487 iAccountSettings->iPop3Settings->SetPopulationLimitL( |
|
2488 EIMASMapFullBody ); |
|
2489 break; |
|
2490 |
|
2491 case EIMASBtnRetrieveHeader: |
|
2492 iAccountSettings->iPop3Settings->SetPopulationLimitL( |
|
2493 EIMASMapHeadersOnly ); |
|
2494 break; |
|
2495 |
|
2496 case EIMASBtnRetrieveLimit: |
|
2497 { |
|
2498 // Get the value from item |
|
2499 base = SettingFindEditor( *base, id ); |
|
2500 iAccountSettings->iPop3Settings->SetPopulationLimitL( |
|
2501 base->Value() ); |
|
2502 } |
|
2503 break; |
|
2504 |
|
2505 default: |
|
2506 __ASSERT_DEBUG( EFalse, User::Panic( |
|
2507 KIMSSettingsDialogPanic, KErrUnknown ) ); |
|
2508 break; |
|
2509 } |
|
2510 } |
|
2511 } |
|
2512 |
|
2513 // ---------------------------------------------------------------------------- |
|
2514 // CIMSSettingsDialog::StoreFolderPathL() |
|
2515 // ---------------------------------------------------------------------------- |
|
2516 // |
|
2517 void CIMSSettingsDialog::StoreFolderPathL() |
|
2518 { |
|
2519 IMUM_CONTEXT( CIMSSettingsDialog::StoreFolderPathL, 0, KLogUi ); |
|
2520 |
|
2521 // Only possible with Imap4 |
|
2522 if ( iAccountSettings->iIsImap4 ) |
|
2523 { |
|
2524 // Fetch the text from the setting |
|
2525 TMuiuSettingsText buf16 = |
|
2526 *StoreGetNextText( ToUid( EIMASUserUnixPath ) ); |
|
2527 |
|
2528 HBufC* text = StringLoader::LoadLC( |
|
2529 R_IMUM_SETTINGS_UNIX_PATH ); |
|
2530 |
|
2531 // If the text matches with the default text clean the text field |
|
2532 if ( !text->CompareC( buf16 ) ) |
|
2533 { |
|
2534 buf16.Zero(); |
|
2535 } |
|
2536 |
|
2537 CleanupStack::PopAndDestroy( text ); |
|
2538 text = NULL; |
|
2539 |
|
2540 TBuf8<KMuiuDynMaxSettingsTextLength> buf8; |
|
2541 buf8.Copy( buf16.Left( KMuiuDynMaxSettingsTextLength ) ); |
|
2542 |
|
2543 iAccountSettings->iImap4Settings->SetFolderPathL( buf8 ); |
|
2544 } |
|
2545 } |
|
2546 |
|
2547 // ---------------------------------------------------------------------------- |
|
2548 // CIMSSettingsDialog::StoreUsername() |
|
2549 // ---------------------------------------------------------------------------- |
|
2550 // |
|
2551 const TBuf8<KMuiuDynMaxSettingsTextLength> CIMSSettingsDialog::StoreUsername( |
|
2552 const TDesC& aUsername ) |
|
2553 { |
|
2554 IMUM_CONTEXT( CIMSSettingsDialog::StoreUsername, 0, KLogUi ); |
|
2555 |
|
2556 TBuf8<KMuiuDynMaxSettingsTextLength> buffer; |
|
2557 buffer.Copy( aUsername ); |
|
2558 |
|
2559 return buffer; |
|
2560 } |
|
2561 |
|
2562 // ---------------------------------------------------------------------------- |
|
2563 // CIMSSettingsDialog::StorePassword() |
|
2564 // ---------------------------------------------------------------------------- |
|
2565 // |
|
2566 const TBuf8<KMuiuDynMaxSettingsTextLength> CIMSSettingsDialog::StorePassword( |
|
2567 const TDesC& aPassword, |
|
2568 const TInt aFlag ) |
|
2569 { |
|
2570 IMUM_CONTEXT( CIMSSettingsDialog::StorePassword, 0, KLogUi ); |
|
2571 |
|
2572 TBuf8<KMuiuDynMaxSettingsTextLength> buffer; |
|
2573 buffer.Copy( aPassword ); |
|
2574 |
|
2575 // Clear the flag, as it is valid now |
|
2576 TMuiuFlags flags = iAccountSettings->iExtendedSettings->StatusFlags(); |
|
2577 flags.ClearFlag( aFlag ); |
|
2578 iAccountSettings->iExtendedSettings->SetStatusFlags( flags ); |
|
2579 |
|
2580 return buffer; |
|
2581 } |
|
2582 |
|
2583 // ---------------------------------------------------------------------------- |
|
2584 // CIMSSettingsDialog::StoreSignatureL() |
|
2585 // ---------------------------------------------------------------------------- |
|
2586 // |
|
2587 void CIMSSettingsDialog::StoreSignatureL() |
|
2588 { |
|
2589 IMUM_CONTEXT( CIMSSettingsDialog::StoreSignatureL, 0, KLogUi ); |
|
2590 |
|
2591 iAccountSettings->iSmtpSettings->SetAddSignatureToEmail( |
|
2592 StoreGetNextValue( ToUid( EIMASUserIncludeSignature ) ) > 0 ); |
|
2593 } |
|
2594 |
|
2595 // ---------------------------------------------------------------------------- |
|
2596 // CIMSSettingsDialog::StorePortL() |
|
2597 // ---------------------------------------------------------------------------- |
|
2598 // |
|
2599 void CIMSSettingsDialog::StorePortL( const TBool aIncoming ) |
|
2600 { |
|
2601 IMUM_CONTEXT( CIMSSettingsDialog::StorePortL, 0, KLogUi ); |
|
2602 |
|
2603 // Fetch next item |
|
2604 TInt id = aIncoming ? EIMASIncomingPort : EIMASOutgoingPort; |
|
2605 CMuiuSettingBase* base = NextItemSearch( ToUid( id ) ); |
|
2606 |
|
2607 CMuiuSettingsEditValue* valueEditor = |
|
2608 static_cast<CMuiuSettingsEditValue*>( |
|
2609 SettingFindEditor( *base, ToUid( EIMASBtnPortUserDefined ) ) ); |
|
2610 |
|
2611 CheckPort( *base, aIncoming ); |
|
2612 |
|
2613 __ASSERT_DEBUG( valueEditor->Value() >= 0, User::Panic( |
|
2614 KIMSSettingsDialogPanic, KErrUnknown ) ); |
|
2615 |
|
2616 // Check incoming&outgoing |
|
2617 if ( aIncoming ) |
|
2618 { |
|
2619 // Check imap4&pop3 |
|
2620 if ( iAccountSettings->iIsImap4 ) |
|
2621 { |
|
2622 iAccountSettings->iImap4Settings->SetPort( |
|
2623 valueEditor->Value() ); |
|
2624 } |
|
2625 else |
|
2626 { |
|
2627 iAccountSettings->iPop3Settings->SetPort( |
|
2628 valueEditor->Value() ); |
|
2629 } |
|
2630 } |
|
2631 else |
|
2632 { |
|
2633 iAccountSettings->iSmtpSettings->SetPort( |
|
2634 valueEditor->Value() ); |
|
2635 } |
|
2636 } |
|
2637 |
|
2638 // ---------------------------------------------------------------------------- |
|
2639 // CIMSSettingsDialog::StoreAoHoursL() |
|
2640 // ---------------------------------------------------------------------------- |
|
2641 // |
|
2642 void CIMSSettingsDialog::StoreAoHoursL() |
|
2643 { |
|
2644 IMUM_CONTEXT( CIMSSettingsDialog::StoreAoHoursL, 0, KLogUi ); |
|
2645 |
|
2646 // Hours are stored into two seperate settings, which needs to be combined |
|
2647 CMuiuSettingBase* aoHours = |
|
2648 NextItemSearch( ToUid( EIMASAOHours ) ); |
|
2649 |
|
2650 // Define default times |
|
2651 TTime thisTime = 0; |
|
2652 TTime nextTime = 0; |
|
2653 TInt radiobutton = aoHours->Value(); |
|
2654 |
|
2655 // When user has defined the hours, get them manually |
|
2656 if ( radiobutton ) |
|
2657 { |
|
2658 CMuiuSettingsEditValue* userdef = |
|
2659 static_cast<CMuiuSettingsEditValue*>( |
|
2660 GetSubItem( *aoHours, radiobutton ) ); |
|
2661 CMuiuSettingsEditValue* sub1 = NULL; |
|
2662 CMuiuSettingsEditValue* sub2 = NULL; |
|
2663 FindMultilineEditorL( ToUid( EIMASEditAoHoursEditor ), sub1, sub2 ); |
|
2664 __ASSERT_DEBUG( sub1 && sub2, User::Panic( |
|
2665 KIMSSettingsDialogPanic, KErrNotFound ) ); |
|
2666 |
|
2667 // Take times |
|
2668 thisTime = sub1->Value(); |
|
2669 nextTime = sub2->Value(); |
|
2670 |
|
2671 userdef = NULL; |
|
2672 sub1 = NULL; |
|
2673 sub2 = NULL; |
|
2674 } |
|
2675 |
|
2676 // Store the values |
|
2677 iAccountSettings->iExtendedSettings->SetSelectedTimeStart( thisTime ); |
|
2678 iAccountSettings->iExtendedSettings->SetSelectedTimeStop( nextTime ); |
|
2679 } |
|
2680 |
|
2681 // ---------------------------------------------------------------------------- |
|
2682 // CIMSSettingsDialog::StoreAoInterval() |
|
2683 // ---------------------------------------------------------------------------- |
|
2684 // |
|
2685 void CIMSSettingsDialog::StoreAoInterval() |
|
2686 { |
|
2687 IMUM_CONTEXT( CIMSSettingsDialog::StoreAoInterval, 0, KLogUi ); |
|
2688 |
|
2689 TInt interval = GetAoIntervalTimeInMinutes(); |
|
2690 iAccountSettings->iExtendedSettings->SetInboxRefreshTime( interval ); |
|
2691 } |
|
2692 |
|
2693 // ---------------------------------------------------------------------------- |
|
2694 // CIMSSettingsDialog::GetAoIntervalTimeInMinutes() |
|
2695 // ---------------------------------------------------------------------------- |
|
2696 // |
|
2697 TInt CIMSSettingsDialog::GetAoIntervalTimeInMinutes() |
|
2698 { |
|
2699 IMUM_CONTEXT( CIMSSettingsDialog::GetAoIntervalTimeInMinutes, 0, KLogUi ); |
|
2700 |
|
2701 TInt ret; |
|
2702 |
|
2703 CMuiuSettingsLinkExtended* radioButtons = |
|
2704 static_cast<CMuiuSettingsLinkExtended*>( |
|
2705 GetItem( TUid::Uid( EIMASAOInterval ) ) ); |
|
2706 |
|
2707 TUid id = ToUid( 0 ); |
|
2708 TInt index = 0; |
|
2709 FindCheckedRadiobutton( *radioButtons, id, index ); |
|
2710 |
|
2711 // Set the correct amount of minutes to setting |
|
2712 switch ( id.iUid ) |
|
2713 { |
|
2714 case EIMASBtnAo5Min: |
|
2715 ret = KIMASAoInterval5Min; |
|
2716 break; |
|
2717 |
|
2718 case EIMASBtnAo15Min: |
|
2719 ret = KIMASAoInterval15Min; |
|
2720 break; |
|
2721 |
|
2722 case EIMASBtnAo30Min: |
|
2723 ret = KIMASAoInterval30Min; |
|
2724 break; |
|
2725 |
|
2726 case EIMASBtnAo60Min: |
|
2727 ret = KIMASAoInterval1Hour; |
|
2728 break; |
|
2729 |
|
2730 default: |
|
2731 case EIMASBtnAo2Hours: |
|
2732 ret = KIMASAoInterval2Hours; |
|
2733 break; |
|
2734 |
|
2735 case EIMASBtnAo4Hours: |
|
2736 ret = KIMASAoInterval4Hours; |
|
2737 break; |
|
2738 |
|
2739 case EIMASBtnAo6Hours: |
|
2740 ret = KIMASAoInterval6Hours; |
|
2741 break; |
|
2742 } |
|
2743 |
|
2744 return ret; |
|
2745 } |
|
2746 |
|
2747 // ---------------------------------------------------------------------------- |
|
2748 // CIMSSettingsDialog::StoreGetNextText() |
|
2749 // ---------------------------------------------------------------------------- |
|
2750 // |
|
2751 const TMuiuSettingsText* CIMSSettingsDialog::StoreGetNextText( |
|
2752 const TUid& aItemId ) |
|
2753 { |
|
2754 IMUM_CONTEXT( CIMSSettingsDialog::StoreGetNextText, 0, KLogUi ); |
|
2755 |
|
2756 // Fetch next item |
|
2757 CMuiuSettingBase* base = NextItemSearch( aItemId ); |
|
2758 |
|
2759 return base->Text(); |
|
2760 } |
|
2761 |
|
2762 // ---------------------------------------------------------------------------- |
|
2763 // CIMSSettingsDialog::StoreGetNextValue() |
|
2764 // ---------------------------------------------------------------------------- |
|
2765 // |
|
2766 TInt CIMSSettingsDialog::StoreGetNextValue( |
|
2767 const TUid& aItemId ) |
|
2768 { |
|
2769 IMUM_CONTEXT( CIMSSettingsDialog::StoreGetNextValue, 0, KLogUi ); |
|
2770 |
|
2771 // Fetch next item |
|
2772 CMuiuSettingBase* base = NextItemSearch( aItemId ); |
|
2773 |
|
2774 return base->Value(); |
|
2775 } |
|
2776 |
|
2777 // ---------------------------------------------------------------------------- |
|
2778 // CIMSSettingsDialog::StoreGetNextBoolean() |
|
2779 // ---------------------------------------------------------------------------- |
|
2780 // |
|
2781 TBool CIMSSettingsDialog::StoreGetNextBoolean( |
|
2782 const TUid& aItemId ) |
|
2783 { |
|
2784 IMUM_CONTEXT( CIMSSettingsDialog::StoreGetNextBoolean, 0, KLogUi ); |
|
2785 |
|
2786 // Fetch next item |
|
2787 CMuiuSettingBase* base = NextItemSearch( aItemId ); |
|
2788 |
|
2789 return base->Value() != 0; |
|
2790 } |
|
2791 |
|
2792 // ---------------------------------------------------------------------------- |
|
2793 // CIMSSettingsDialog::StoreGetLoginInformation() |
|
2794 // ---------------------------------------------------------------------------- |
|
2795 // |
|
2796 void CIMSSettingsDialog::StoreGetLoginInformation( TDes8& aUserName, |
|
2797 TDes8& aPassword ) |
|
2798 { |
|
2799 IMUM_CONTEXT( CIMSSettingsDialog::StoreGetLoginInformation, 0, KLogUi ); |
|
2800 IMUM_IN(); |
|
2801 |
|
2802 iInitResource = R_IMAS_INCOMING_SETTINGS; |
|
2803 TRAPD( err, InitializeNewResourceL() ); |
|
2804 if( err != KErrNone ) |
|
2805 { |
|
2806 IMUM2( 0, "InitializeNewResourceL(res = 0x%x) leaved with code %d", R_IMAS_INCOMING_SETTINGS, err); |
|
2807 return; |
|
2808 } |
|
2809 |
|
2810 aUserName.Copy( *StoreGetNextText( ToUid( EIMASIncomingUserName ) ) ); |
|
2811 aPassword.Copy( *StoreGetNextText( ToUid( EIMASIncomingUserPwd ) ) ); |
|
2812 |
|
2813 IMUM_OUT(); |
|
2814 } |
|
2815 |
|
2816 // ---------------------------------------------------------------------------- |
|
2817 // CIMSSettingsDialog::StoreSetLoginInformation() |
|
2818 // ---------------------------------------------------------------------------- |
|
2819 // |
|
2820 void CIMSSettingsDialog::StoreSetLoginInformation( const TDesC8& aUserName, |
|
2821 const TDesC8& aPassword ) |
|
2822 { |
|
2823 IMUM_CONTEXT( CIMSSettingsDialog::StoreSetLoginInformation, 0, KLogUi ); |
|
2824 IMUM_IN(); |
|
2825 |
|
2826 iInitResource = R_IMAS_INCOMING_SETTINGS; |
|
2827 TRAPD( err, InitializeNewResourceL() ); |
|
2828 if( err != KErrNone ) |
|
2829 { |
|
2830 IMUM2( 0, "InitializeNewResourceL(res = 0x%x) leaved with code %d", R_IMAS_INCOMING_SETTINGS, err); |
|
2831 return; |
|
2832 } |
|
2833 |
|
2834 TMuiuSettingsText text; |
|
2835 text.Copy( aUserName ); |
|
2836 NextItemSearch( ToUid( EIMASIncomingUserName ) )->SetText( &text ); |
|
2837 text.Copy( aPassword ); |
|
2838 NextItemSearch( ToUid( EIMASIncomingUserPwd ) )->SetText( &text ); |
|
2839 |
|
2840 IMUM_OUT(); |
|
2841 } |
|
2842 |
|
2843 /****************************************************************************** |
|
2844 |
|
2845 Brand new itemcheck code |
|
2846 |
|
2847 ******************************************************************************/ |
|
2848 |
|
2849 // ---------------------------------------------------------------------------- |
|
2850 // CIMSSettingsDialog::EventHandleApproverEvent() |
|
2851 // ---------------------------------------------------------------------------- |
|
2852 // |
|
2853 void CIMSSettingsDialog::EventHandleApproverEvent( |
|
2854 const TIMSApproverEvent aEvent ) |
|
2855 { |
|
2856 IMUM_CONTEXT( CIMSSettingsDialog::EventHandleApproverEvent, 0, KLogUi ); |
|
2857 |
|
2858 switch ( aEvent ) |
|
2859 { |
|
2860 case EIMSApproverRemoveOmaEmn: |
|
2861 EventEMNForceTurnOff(); |
|
2862 break; |
|
2863 |
|
2864 // Always online has to be removed |
|
2865 case EIMSApproverRemoveAlwaysOnline: |
|
2866 EventAOForceTurnOff(); |
|
2867 break; |
|
2868 |
|
2869 default: |
|
2870 break; |
|
2871 } |
|
2872 } |
|
2873 |
|
2874 /****************************************************************************** |
|
2875 |
|
2876 Aquire custom pages |
|
2877 |
|
2878 ******************************************************************************/ |
|
2879 |
|
2880 // ---------------------------------------------------------------------------- |
|
2881 // CIMSSettingsDialog::AcquireCustomSettingPageL() |
|
2882 // ---------------------------------------------------------------------------- |
|
2883 // |
|
2884 void CIMSSettingsDialog::AcquireCustomSettingPageL( |
|
2885 CAknSettingPage*& aReturnPage, |
|
2886 TMuiuDynSetUpdateMode& aReturnUpdateMode, |
|
2887 TInt& aReturnSettingValue, |
|
2888 TMuiuSettingsText& /* aReturnSettingText */, |
|
2889 CDesCArrayFlat& aReturnRadioButtonArray, |
|
2890 CMuiuSettingBase& aParamBaseItem ) |
|
2891 { |
|
2892 IMUM_CONTEXT( CIMSSettingsDialog::AcquireCustomSettingPageL, 0, KLogUi ); |
|
2893 |
|
2894 switch ( aParamBaseItem.iItemId.iUid ) |
|
2895 { |
|
2896 // Handle encoding |
|
2897 case EIMASUserEncoding: |
|
2898 aReturnPage = AcquireCustomEncodingPageL( |
|
2899 aReturnUpdateMode, aReturnSettingValue, |
|
2900 aReturnRadioButtonArray, aParamBaseItem ); |
|
2901 break; |
|
2902 |
|
2903 default: |
|
2904 break; |
|
2905 } |
|
2906 } |
|
2907 |
|
2908 // ---------------------------------------------------------------------------- |
|
2909 // CIMSSettingsDialog::AcquireCustomEncodingPageL() |
|
2910 // ---------------------------------------------------------------------------- |
|
2911 // |
|
2912 CAknSettingPage* CIMSSettingsDialog::AcquireCustomEncodingPageL( |
|
2913 TMuiuDynSetUpdateMode& aReturnUpdateMode, |
|
2914 TInt& aReturnSettingValue, |
|
2915 CDesCArrayFlat& aReturnRadioButtonArray, |
|
2916 CMuiuSettingBase& aParamBaseItem ) |
|
2917 { |
|
2918 IMUM_CONTEXT( CIMSSettingsDialog::AcquireCustomEncodingPageL, 0, KLogUi ); |
|
2919 |
|
2920 // Create radiobutton array of all existing character converters |
|
2921 AcquireCustomEncodingButtonArrayL( aReturnRadioButtonArray ); |
|
2922 |
|
2923 // Create the radiobutton page |
|
2924 CAknRadioButtonSettingPage* encodingPage = |
|
2925 new ( ELeave ) CAknRadioButtonSettingPage( |
|
2926 SettingPageResource( EIPRRadioButton ), |
|
2927 aReturnSettingValue, &aReturnRadioButtonArray ); |
|
2928 CleanupStack::PushL( encodingPage ); |
|
2929 |
|
2930 // Define the page properties |
|
2931 encodingPage->SetSettingTextL( *aParamBaseItem.iItemLabel ); |
|
2932 |
|
2933 // Set updatemode to accept setting only when the setting is |
|
2934 // accepted |
|
2935 aReturnUpdateMode = CAknSettingPage::EUpdateWhenAccepted; |
|
2936 |
|
2937 // Pop and return |
|
2938 CleanupStack::Pop( encodingPage ); |
|
2939 return encodingPage; |
|
2940 } |
|
2941 |
|
2942 // ---------------------------------------------------------------------------- |
|
2943 // CIMSSettingsDialog::AcquireCustomEncodingButtonArrayL() |
|
2944 // ---------------------------------------------------------------------------- |
|
2945 // |
|
2946 void CIMSSettingsDialog::AcquireCustomEncodingButtonArrayL( |
|
2947 CDesCArrayFlat& aButtons ) |
|
2948 { |
|
2949 IMUM_CONTEXT( CIMSSettingsDialog::AcquireCustomEncodingButtonArrayL, 0, KLogUi ); |
|
2950 |
|
2951 RFs& fs = CCoeEnv::Static()->FsSession(); |
|
2952 |
|
2953 // Create character converter object and the array of available converters |
|
2954 CCnvCharacterSetConverter* charConv = CCnvCharacterSetConverter::NewLC(); |
|
2955 CIMACharConvList* converters = |
|
2956 CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC( fs ); |
|
2957 const TInt count = converters->Count(); |
|
2958 |
|
2959 // Append items to array |
|
2960 for ( TInt converter = 0; converter < count; converter++ ) |
|
2961 { |
|
2962 HBufC8* encoderName = |
|
2963 charConv->ConvertCharacterSetIdentifierToStandardNameL( |
|
2964 ( *converters )[converter].Identifier(), fs ); |
|
2965 |
|
2966 if ( encoderName ) |
|
2967 { |
|
2968 CleanupStack::PushL( encoderName ); |
|
2969 |
|
2970 TMuiuSettingsText temp; |
|
2971 temp.Copy( *encoderName ); |
|
2972 aButtons.AppendL( temp ); |
|
2973 |
|
2974 CleanupStack::PopAndDestroy( encoderName ); |
|
2975 encoderName = NULL; |
|
2976 } |
|
2977 } |
|
2978 |
|
2979 // Remove the objects |
|
2980 CleanupStack::PopAndDestroy( converters ); |
|
2981 converters = NULL; |
|
2982 CleanupStack::PopAndDestroy( charConv ); |
|
2983 charConv = NULL; |
|
2984 } |
|
2985 |
|
2986 /****************************************************************************** |
|
2987 |
|
2988 Misc functions |
|
2989 |
|
2990 ******************************************************************************/ |
|
2991 |
|
2992 // ---------------------------------------------------------------------------- |
|
2993 // CIMSSettingsDialog::NextItemSearch() |
|
2994 // ---------------------------------------------------------------------------- |
|
2995 // |
|
2996 CMuiuSettingBase* CIMSSettingsDialog::NextItemSearch( |
|
2997 const TUid& aExpectedId ) |
|
2998 { |
|
2999 IMUM_CONTEXT( CIMSSettingsDialog::NextItemSearch, 0, KLogUi ); |
|
3000 |
|
3001 // Try with cumulative search. It's highly likely that the next item |
|
3002 // will be the item that is needed |
|
3003 TInt count = iInitArray->Count(); |
|
3004 TInt previousIndex = iInitCurrentIndex; |
|
3005 |
|
3006 // First start the searching from the previous index |
|
3007 CMuiuSettingBase* base = NextItemDoSearch( count, aExpectedId ); |
|
3008 |
|
3009 if ( !base ) |
|
3010 { |
|
3011 // Set the current index to 0 and continue from the beginning to |
|
3012 // where the previous search started |
|
3013 iInitCurrentIndex = KErrNotFound; |
|
3014 base = NextItemDoSearch( ++previousIndex, aExpectedId ); |
|
3015 |
|
3016 // Item can't be found at all, no means to continue, panic |
|
3017 __ASSERT_DEBUG( base != NULL, |
|
3018 User::Panic( KIMSSettingsDialogPanic, KErrNotFound ) ); |
|
3019 } |
|
3020 |
|
3021 return base; |
|
3022 } |
|
3023 |
|
3024 // ---------------------------------------------------------------------------- |
|
3025 // CIMSSettingsDialog::NextItemDoSearch() |
|
3026 // ---------------------------------------------------------------------------- |
|
3027 // |
|
3028 CMuiuSettingBase* CIMSSettingsDialog::NextItemDoSearch( |
|
3029 const TInt aLastItem, |
|
3030 const TUid& aExpectedId ) |
|
3031 { |
|
3032 IMUM_CONTEXT( CIMSSettingsDialog::NextItemDoSearch, 0, KLogUi ); |
|
3033 |
|
3034 CMuiuSettingBase* base = NULL; |
|
3035 |
|
3036 // Continue search until the item is found |
|
3037 while ( !base && ++iInitCurrentIndex < aLastItem ) |
|
3038 { |
|
3039 base = iInitArray->At( iInitCurrentIndex ).iItem; |
|
3040 base = ( base->iItemId == aExpectedId ) ? base : NULL; |
|
3041 } |
|
3042 |
|
3043 return base; |
|
3044 } |
|
3045 |
|
3046 // ---------------------------------------------------------------------------- |
|
3047 // CIMSSettingsDialog::SetInitializeFlags() |
|
3048 // ---------------------------------------------------------------------------- |
|
3049 // |
|
3050 void CIMSSettingsDialog::SetInitializeFlags( |
|
3051 const TInt aError ) |
|
3052 { |
|
3053 IMUM_CONTEXT( CIMSSettingsDialog::SetInitializeFlags, 0, KLogUi ); |
|
3054 |
|
3055 SetFlags( aError, iInitSetFlag ); |
|
3056 } |
|
3057 |
|
3058 // ---------------------------------------------------------------------------- |
|
3059 // CIMSSettingsDialog::SetFlags() |
|
3060 // ---------------------------------------------------------------------------- |
|
3061 // |
|
3062 void CIMSSettingsDialog::SetFlags( |
|
3063 const TInt aError, |
|
3064 const TInt aFlag ) |
|
3065 { |
|
3066 IMUM_CONTEXT( CIMSSettingsDialog::SetFlags, 0, KLogUi ); |
|
3067 |
|
3068 ChangeFlag( aFlag, ( aError != KErrNone || Flag( aFlag ) ) ); |
|
3069 } |
|
3070 |
|
3071 // ---------------------------------------------------------------------------- |
|
3072 // CIMSSettingsDialog::SetStoreFlags() |
|
3073 // ---------------------------------------------------------------------------- |
|
3074 // |
|
3075 void CIMSSettingsDialog::SetStoreFlags( |
|
3076 const TBool aState, |
|
3077 const TInt aFlag ) |
|
3078 { |
|
3079 IMUM_CONTEXT( CIMSSettingsDialog::SetStoreFlags, 0, KLogUi ); |
|
3080 |
|
3081 ChangeFlag( aFlag, ( aState || Flag( aFlag ) ) ); |
|
3082 } |
|
3083 |
|
3084 // ---------------------------------------------------------------------------- |
|
3085 // CIMSSettingsDialog::SetEmailSettingsState() |
|
3086 // ---------------------------------------------------------------------------- |
|
3087 // |
|
3088 void CIMSSettingsDialog::SetEmailSettingsState() |
|
3089 { |
|
3090 IMUM_CONTEXT( CIMSSettingsDialog::SetEmailSettingsState, 0, KLogUi ); |
|
3091 |
|
3092 TBool save = EFalse; |
|
3093 |
|
3094 // Check if any item in the array has changed |
|
3095 for ( TInt flag = EDialogMainMenu; |
|
3096 --flag >= EDialogIncomingChanged && !save; ) |
|
3097 { |
|
3098 // Check if any setting has changed |
|
3099 save = Flag( flag ); |
|
3100 } |
|
3101 |
|
3102 // Set the save status |
|
3103 ChangeFlag( EImumSettingSave, save ); |
|
3104 } |
|
3105 |
|
3106 // ---------------------------------------------------------------------------- |
|
3107 // CIMSSettingsDialog::GetStorerFlag() |
|
3108 // ---------------------------------------------------------------------------- |
|
3109 // |
|
3110 TInt CIMSSettingsDialog::GetStorerFlag( |
|
3111 const CMuiuSettingBase& aBaseItem ) |
|
3112 { |
|
3113 IMUM_CONTEXT( CIMSSettingsDialog::GetStorerFlag, 0, KLogUi ); |
|
3114 |
|
3115 switch ( aBaseItem.iItemResourceId ) |
|
3116 { |
|
3117 case R_IMAS_INCOMING_SETTINGS: |
|
3118 return EDialogIncomingChanged; |
|
3119 |
|
3120 case R_IMAS_OUTGOING_SETTINGS: |
|
3121 return EDialogOutgoingChanged; |
|
3122 |
|
3123 case R_IMAS_USER_PREFERENCES: |
|
3124 return EDialogUserPrefChanged; |
|
3125 |
|
3126 case R_IMAS_RETRIEVAL_LIMIT: |
|
3127 return EDialogRetLimitChanged; |
|
3128 |
|
3129 case R_IMAS_DOWNLOAD_SETTINGS: |
|
3130 return EDialogDownloadChanged; |
|
3131 |
|
3132 case R_IMAS_ALWAYSONLINE_SETTINGS: |
|
3133 return EDialogAlOnlineChanged; |
|
3134 |
|
3135 default: |
|
3136 break; |
|
3137 } |
|
3138 |
|
3139 return KErrNotFound; |
|
3140 } |
|
3141 |
|
3142 // ---------------------------------------------------------------------------- |
|
3143 // CIMSSettingsDialog::SubscribeFoldersL() |
|
3144 // ---------------------------------------------------------------------------- |
|
3145 // |
|
3146 void CIMSSettingsDialog::SubscribeFoldersL() |
|
3147 { |
|
3148 IMUM_CONTEXT( CIMSSettingsDialog::SubscribeFoldersL, 0, KLogUi ); |
|
3149 |
|
3150 TMsvId service; |
|
3151 TMsvEntry tEntry; |
|
3152 User::LeaveIfError( iMailboxApi.MsvSession().GetEntry( |
|
3153 iAccountSettings->iMailboxId, service, tEntry ) ); |
|
3154 |
|
3155 |
|
3156 // Flag whether username/password may have changed |
|
3157 TBool logingInfoChanged = EFalse; |
|
3158 TBuf8<KImasLoginLength> userName; |
|
3159 TBuf8<KImasPasswordLength> password; |
|
3160 |
|
3161 if ( Flag( EDialogIncomingChanged ) ) |
|
3162 { |
|
3163 // Username/password may have changed. They need to be pushed back |
|
3164 // into settings database by CImapSubscriptionDialog if it tries to |
|
3165 // log into email server to refresh folder list. |
|
3166 logingInfoChanged = ETrue; |
|
3167 StoreGetLoginInformation( userName, password ); |
|
3168 } |
|
3169 |
|
3170 // Run the dialog |
|
3171 CImapSubscriptionDialog* subDlg = |
|
3172 CImapSubscriptionDialog::NewL( |
|
3173 iBaseUiFlags, tEntry.iRelatedId, CurrentMailboxId(), |
|
3174 logingInfoChanged, userName, password, iMailboxApi ); |
|
3175 |
|
3176 subDlg->PrepareLC( R_IMUM_FOLDER_SUBSRCIPTION_DIALOG ); |
|
3177 subDlg->RunLD(); |
|
3178 |
|
3179 // We need to delay the CIMSSettingsDialog exit so that dialogs beneath it |
|
3180 // has time to close properly |
|
3181 if ( !iIdle->IsActive() ) |
|
3182 { |
|
3183 iIdle->Start( TCallBack( &CIMSSettingsDialog::DelayedExecFlags, this)); |
|
3184 } |
|
3185 |
|
3186 // If username/password are not defined or are wrong and subscription |
|
3187 // dialog logged into IMAP server, login dialog is presented to user |
|
3188 // and login info may have changed . |
|
3189 // Note: logingInfoChanged is in/out parameter to subscription dialog. |
|
3190 // On return it is true if the dialog logged into IMAP server. |
|
3191 if ( logingInfoChanged ) |
|
3192 { |
|
3193 TBool isPasswordTemporary; |
|
3194 GetLoginInformationL( userName, password, isPasswordTemporary ); |
|
3195 if ( isPasswordTemporary ) |
|
3196 { |
|
3197 password.Zero(); |
|
3198 } |
|
3199 if ( Flag( EDialogIncomingChanged ) ) |
|
3200 { |
|
3201 // Store into changed values |
|
3202 StoreSetLoginInformation( userName, password ); |
|
3203 } |
|
3204 else |
|
3205 { |
|
3206 // Update login info into our copy of settings |
|
3207 iAccountSettings->iImap4Settings->SetLoginNameL( userName ); |
|
3208 iAccountSettings->iImap4Settings->SetPasswordL( password ); |
|
3209 } |
|
3210 } |
|
3211 } |
|
3212 |
|
3213 // ---------------------------------------------------------------------------- |
|
3214 // CIMSSettingsDialog::CheckSubscribedFolderStateL() |
|
3215 // ---------------------------------------------------------------------------- |
|
3216 // |
|
3217 void CIMSSettingsDialog::CheckSubscribedFolderStateL() |
|
3218 { |
|
3219 IMUM_CONTEXT( CIMSSettingsDialog::CheckSubscribedFolderStateL, 0, KLogUi ); |
|
3220 |
|
3221 TMsvId mailboxId = ( iAccountSettings->iIsImap4 ) ? |
|
3222 iAccountSettings->iImap4AccountId.iImapService : |
|
3223 iAccountSettings->iPop3AccountId.iPopService; |
|
3224 TBool hasFolders = |
|
3225 iMailboxApi.MailboxUtilitiesL().HasSubscribedFoldersL( mailboxId ); |
|
3226 SetHideItem( !hasFolders, ToUid( EIMASLimitFolders ), ETrue ); |
|
3227 } |
|
3228 |
|
3229 // ---------------------------------------------------------------------------- |
|
3230 // CIMSSettingsDialog::LaunchIapPageL() |
|
3231 // ---------------------------------------------------------------------------- |
|
3232 // |
|
3233 void CIMSSettingsDialog::LaunchIapPageL( |
|
3234 CMuiuSettingBase& aBaseItem ) |
|
3235 { |
|
3236 IMUM_CONTEXT( CIMSSettingsDialog::LaunchIapPageL, 0, KLogUi ); |
|
3237 |
|
3238 CIMSSettingsAccessPointItem* iapItem = |
|
3239 static_cast<CIMSSettingsAccessPointItem*>( &aBaseItem ); |
|
3240 |
|
3241 TInt result = iMailboxApi.CommDbUtilsL().LaunchIapPageL( *iapItem ); |
|
3242 |
|
3243 // Finalize the accesspoint item, after the setting is successfully set |
|
3244 switch ( result ) |
|
3245 { |
|
3246 case KErrNone: |
|
3247 SetItemIapItemL( *iapItem ); |
|
3248 break; |
|
3249 // Quit immediately |
|
3250 case KErrAbort: |
|
3251 SetFlag( EImumSettingShouldExit ); |
|
3252 break; |
|
3253 case KErrCancel: |
|
3254 default: |
|
3255 break; |
|
3256 } |
|
3257 } |
|
3258 |
|
3259 // ---------------------------------------------------------------------------- |
|
3260 // CIMSSettingsDialog::FindMultilineEditorL() |
|
3261 // ---------------------------------------------------------------------------- |
|
3262 // |
|
3263 void CIMSSettingsDialog::FindMultilineEditorL( |
|
3264 const TUid& aId, |
|
3265 CMuiuSettingsEditValue*& aTopEditor, |
|
3266 CMuiuSettingsEditValue*& aBottomEditor ) |
|
3267 { |
|
3268 IMUM_CONTEXT( CIMSSettingsDialog::FindMultilineEditorL, 0, KLogUi ); |
|
3269 |
|
3270 CMuiuSettingBase* baseItem = GetItem( aId ); |
|
3271 |
|
3272 if ( baseItem ) |
|
3273 { |
|
3274 CMuiuSettingsEditValue* top = |
|
3275 static_cast<CMuiuSettingsEditValue*>( GetSubItem( *baseItem, 0 ) ); |
|
3276 aTopEditor = top; |
|
3277 CMuiuSettingsEditValue* bottom = |
|
3278 static_cast<CMuiuSettingsEditValue*>( GetSubItem( *baseItem, 1 ) ); |
|
3279 aBottomEditor = bottom; |
|
3280 top = NULL; |
|
3281 bottom = NULL; |
|
3282 } |
|
3283 |
|
3284 User::LeaveIfNull( baseItem ); |
|
3285 } |
|
3286 |
|
3287 // ---------------------------------------------------------------------------- |
|
3288 // CIMSSettingsDialog::SettingLaunchMultilineEditorL() |
|
3289 // ---------------------------------------------------------------------------- |
|
3290 // |
|
3291 TMuiuPageEventResult CIMSSettingsDialog::SettingLaunchMultilineEditorL( |
|
3292 CMuiuSettingBase& /* aBaseItem */, |
|
3293 TMuiuDynSetUpdateMode& /* aUpdateMode */ ) |
|
3294 { |
|
3295 IMUM_CONTEXT( CIMSSettingsDialog::SettingLaunchMultilineEditorL, 0, KLogUi ); |
|
3296 |
|
3297 // Launches Always Online multiline editor, although this function |
|
3298 // is meant to be generic function. |
|
3299 |
|
3300 CMuiuSettingsEditValue* sub1 = NULL; |
|
3301 CMuiuSettingsEditValue* sub2 = NULL; |
|
3302 FindMultilineEditorL( ToUid( EIMASEditAoHoursEditor ), sub1, sub2 ); |
|
3303 __ASSERT_DEBUG( sub1 && sub2, User::Panic( |
|
3304 KIMSSettingsDialogPanic, KErrNotFound ) ); |
|
3305 |
|
3306 // Take times |
|
3307 TTime thisTime = sub1->Value(); |
|
3308 TTime nextTime = sub2->Value(); |
|
3309 |
|
3310 |
|
3311 CAknMultiLineDataQueryDialog* multiLineDlg = |
|
3312 CAknMultiLineDataQueryDialog::NewL( thisTime, nextTime ); |
|
3313 |
|
3314 CAknLocalScreenClearer* localScreenClearer = CAknLocalScreenClearer::NewLC( EFalse ); |
|
3315 |
|
3316 |
|
3317 // Execute the dialog |
|
3318 if ( multiLineDlg->ExecuteLD( R_IMAS_SETTINGS_DIALOG_HOURS_QUERY ) ) |
|
3319 { |
|
3320 CleanupStack::PopAndDestroy(localScreenClearer); |
|
3321 |
|
3322 // Save the values |
|
3323 sub1->SetValue( thisTime.Int64() ); |
|
3324 sub2->SetValue( nextTime.Int64() ); |
|
3325 |
|
3326 // Update the setting text |
|
3327 CMuiuSettingsLinkExtended* linkItem = |
|
3328 static_cast<CMuiuSettingsLinkExtended*>( |
|
3329 GetItem( ToUid( EIMASAOHours ) ) ); |
|
3330 |
|
3331 // Check if the times are the same, which means the system should be |
|
3332 // on for next 24 hours |
|
3333 if ( thisTime == nextTime ) |
|
3334 { |
|
3335 UpdateItemDefaultSettingTextL( *linkItem ); |
|
3336 } |
|
3337 else |
|
3338 { |
|
3339 UpdateItemCustomSettingTextL( *linkItem, *sub1, *sub2 ); |
|
3340 } |
|
3341 |
|
3342 linkItem = NULL; |
|
3343 sub1 = NULL; |
|
3344 sub2 = NULL; |
|
3345 |
|
3346 return EMuiuPageEventResultApproved; |
|
3347 } |
|
3348 else |
|
3349 { |
|
3350 CleanupStack::PopAndDestroy(localScreenClearer); |
|
3351 |
|
3352 sub1 = NULL; |
|
3353 sub2 = NULL; |
|
3354 |
|
3355 return EMuiuPageEventResultCancel; |
|
3356 } |
|
3357 } |
|
3358 // ---------------------------------------------------------------------------- |
|
3359 // CIMSSettingsDialog::UpdateItemDefaultSettingTextL() |
|
3360 // ---------------------------------------------------------------------------- |
|
3361 // |
|
3362 void CIMSSettingsDialog::UpdateItemDefaultSettingTextL( |
|
3363 CMuiuSettingsLinkExtended& aLinkItem ) const |
|
3364 { |
|
3365 IMUM_CONTEXT( CIMSSettingsDialog::UpdateItemDefaultSettingTextL, 0, KLogUi ); |
|
3366 |
|
3367 HBufC* format = StringLoader::LoadLC( |
|
3368 R_IMAS_SETTINGS_DIALOG_ALWAYS_ALLHOURS ); |
|
3369 |
|
3370 aLinkItem.iItemSettingText->Copy( *format ); |
|
3371 aLinkItem.SetValue( 0 ); |
|
3372 |
|
3373 CleanupStack::PopAndDestroy( format ); |
|
3374 format = NULL; |
|
3375 } |
|
3376 |
|
3377 // ---------------------------------------------------------------------------- |
|
3378 // CIMSSettingsDialog::UpdateItemCustomSettingTextL() |
|
3379 // ---------------------------------------------------------------------------- |
|
3380 // |
|
3381 void CIMSSettingsDialog::UpdateItemCustomSettingTextL( |
|
3382 CMuiuSettingsLinkExtended& aLinkItem, |
|
3383 CMuiuSettingsEditValue& aItemFrom, |
|
3384 CMuiuSettingsEditValue& aItemTo ) const |
|
3385 { |
|
3386 IMUM_CONTEXT( CIMSSettingsDialog::UpdateItemCustomSettingTextL, 0, KLogUi ); |
|
3387 |
|
3388 // Define variables for time |
|
3389 TTime thisTime = aItemFrom.Value(); |
|
3390 TTime nextTime = aItemTo.Value(); |
|
3391 |
|
3392 HBufC* format = StringLoader::LoadLC( |
|
3393 R_QTN_TIME_USUAL_WITH_ZERO ); |
|
3394 |
|
3395 // Copy the time to text |
|
3396 RBuf timeText1; |
|
3397 RBuf timeText2; |
|
3398 timeText1.CreateMaxL( KMuiuDynMaxSettingsLongTextLength ); |
|
3399 timeText2.CreateMaxL( KMuiuDynMaxSettingsLongTextLength ); |
|
3400 |
|
3401 thisTime.FormatL( timeText1, *format ); |
|
3402 nextTime.FormatL( timeText2, *format ); |
|
3403 CleanupStack::PopAndDestroy( format ); |
|
3404 format = NULL; |
|
3405 |
|
3406 RBuf tempText1; |
|
3407 RBuf tempText2; |
|
3408 tempText1.CreateMaxL( KMuiuDynMaxSettingsLongTextLength ); |
|
3409 tempText2.CreateMaxL( KMuiuDynMaxSettingsLongTextLength ); |
|
3410 |
|
3411 // Load the template |
|
3412 StringLoader::Load( |
|
3413 tempText1, R_IMAS_SETTINGS_DIALOG_BETWEEN_FORMAT ); |
|
3414 |
|
3415 // Fetch the times |
|
3416 StringLoader::Format( tempText2, tempText1, 0, timeText1 ); |
|
3417 StringLoader::Format( tempText1, tempText2, 1, timeText2 ); |
|
3418 |
|
3419 AknTextUtils::LanguageSpecificNumberConversion( tempText1 ); |
|
3420 |
|
3421 // Finally copy the text to item |
|
3422 aLinkItem.iItemSettingText->Copy( tempText1 ); |
|
3423 aLinkItem.SetValue( 1 ); |
|
3424 |
|
3425 timeText1.Close(); |
|
3426 timeText2.Close(); |
|
3427 tempText1.Close(); |
|
3428 tempText2.Close(); |
|
3429 } |
|
3430 |
|
3431 // ---------------------------------------------------------------------------- |
|
3432 // CIMSSettingsDialog::UpdateItemText() |
|
3433 // ---------------------------------------------------------------------------- |
|
3434 // |
|
3435 void CIMSSettingsDialog::UpdateItemText( |
|
3436 const TUid& aItemId ) |
|
3437 { |
|
3438 IMUM_CONTEXT( CIMSSettingsDialog::UpdateItemText, 0, KLogUi ); |
|
3439 |
|
3440 CMuiuSettingsLinkExtended* radioEditor = |
|
3441 static_cast<CMuiuSettingsLinkExtended*>( |
|
3442 GetItem( aItemId ) ); |
|
3443 |
|
3444 CMuiuSettingsEditValue* editor = |
|
3445 static_cast<CMuiuSettingsEditValue*>( |
|
3446 SettingFindEditor( *radioEditor, radioEditor->Value(), EFalse ) ); |
|
3447 |
|
3448 if ( editor ) |
|
3449 { |
|
3450 SetItemText( *radioEditor, *editor->iItemSettingText ); |
|
3451 } |
|
3452 else |
|
3453 { |
|
3454 CMuiuSettingBase* base = GetSubItem( *radioEditor, |
|
3455 radioEditor->Value() ); |
|
3456 |
|
3457 if ( base ) |
|
3458 { |
|
3459 SetItemText( *radioEditor, *base->iItemLabel ); |
|
3460 } |
|
3461 base = NULL; |
|
3462 } |
|
3463 } |
|
3464 |
|
3465 // ---------------------------------------------------------------------------- |
|
3466 // CIMSSettingsDialog::UpdateFetchLimitSetting() |
|
3467 // ---------------------------------------------------------------------------- |
|
3468 // |
|
3469 void CIMSSettingsDialog::UpdateFetchLimitSetting() |
|
3470 { |
|
3471 IMUM_CONTEXT( CIMSSettingsDialog::UpdateFetchLimitSetting, 0, KLogUi ); |
|
3472 |
|
3473 TUid inboxId = ToUid( EIMASLimitInbox ); |
|
3474 TUid folderId = ToUid( EIMASLimitFolders ); |
|
3475 |
|
3476 // Always Online is turned on |
|
3477 if ( Flag( EDialogAlwaysOnlineOn ) ) |
|
3478 { |
|
3479 SetReadOnly( inboxId, ETrue ); |
|
3480 SetReadOnly( folderId, ETrue ); |
|
3481 |
|
3482 TMuiuSettingsText fetchAllText; |
|
3483 StringLoader::Load( |
|
3484 fetchAllText, R_IMAS_SETTINGS_DIALOG_FETCH_HEADERS_ALL ); |
|
3485 SetItemText( *GetItem( inboxId ), fetchAllText ); |
|
3486 SetItemText( *GetItem( folderId ), fetchAllText ); |
|
3487 } |
|
3488 else |
|
3489 { |
|
3490 SetReadOnly( inboxId, EFalse ); |
|
3491 SetReadOnly( folderId, EFalse ); |
|
3492 |
|
3493 // Update the setting text for the items |
|
3494 UpdateItemText( ToUid( EIMASLimitInbox ) ); |
|
3495 UpdateItemText( ToUid( EIMASLimitFolders ) ); |
|
3496 } |
|
3497 } |
|
3498 |
|
3499 // ---------------------------------------------------------------------------- |
|
3500 // CIMSSettingsDialog::EventUpdateAlwaysOnline() |
|
3501 // ---------------------------------------------------------------------------- |
|
3502 // |
|
3503 void CIMSSettingsDialog::EventUpdateAlwaysOnline( |
|
3504 const TInt aNewState ) |
|
3505 { |
|
3506 IMUM_CONTEXT( CIMSSettingsDialog::EventUpdateAlwaysOnline, 0, KLogUi ); |
|
3507 |
|
3508 // Turn always online off? |
|
3509 if ( aNewState == EMailAoOff ) |
|
3510 { |
|
3511 ClearFlag( EDialogAlwaysOnlineOn ); |
|
3512 } |
|
3513 // Turn it on instead |
|
3514 else |
|
3515 { |
|
3516 // show warning about increasing costs if always online switched on. |
|
3517 // Warning on / warning off is variated by operators so we have |
|
3518 // to check feature from central repository |
|
3519 TBool doNotShowNote = EFalse; |
|
3520 TRAP_IGNORE( doNotShowNote = MsvEmailMtmUiFeatureUtils::LocalFeatureL( |
|
3521 KCRUidMuiuVariation, KMuiuEmailConfigFlags, |
|
3522 KEmailFeatureIdSuppressBillingNote ) ); |
|
3523 // if LocalFeatureL should leave, doNotShowNote == EFalse |
|
3524 |
|
3525 if ( !doNotShowNote && !Flag( EDialogAlwaysOnlineOn ) ) |
|
3526 { |
|
3527 TRAP_IGNORE( CIMSSettingsNoteUi::ShowNoteL( |
|
3528 R_MCE_SETTINGS_MAIL_ENABLING_COST, |
|
3529 EIMSInformationNote, ETrue ) ); |
|
3530 } |
|
3531 |
|
3532 SetFlag( EDialogAlwaysOnlineOn ); |
|
3533 } |
|
3534 |
|
3535 InitializeAlwaysOnlineState(); |
|
3536 } |
|
3537 |
|
3538 // ---------------------------------------------------------------------------- |
|
3539 // CIMSSettingsDialog::EventUpdateMailNotifications() |
|
3540 // ---------------------------------------------------------------------------- |
|
3541 // |
|
3542 void CIMSSettingsDialog::EventUpdateMailNotifications( |
|
3543 const TInt aNewState ) |
|
3544 { |
|
3545 IMUM_CONTEXT( CIMSSettingsDialog::EventUpdateMailNotifications, 0, KLogUi ); |
|
3546 |
|
3547 ChangeFlag( EDialogOmaEmnOn, aNewState != EMailEmnOff ); |
|
3548 |
|
3549 } |
|
3550 |
|
3551 // ---------------------------------------------------------------------------- |
|
3552 // CIMSSettingsDialog::EventAOForceTurnOff() |
|
3553 // ---------------------------------------------------------------------------- |
|
3554 // |
|
3555 void CIMSSettingsDialog::EventAOForceTurnOff() |
|
3556 { |
|
3557 IMUM_CONTEXT( CIMSSettingsDialog::EventAOForceTurnOff, 0, KLogUi ); |
|
3558 |
|
3559 CMuiuSettingsLinkExtended* alwaysOnline = |
|
3560 static_cast<CMuiuSettingsLinkExtended*>( |
|
3561 GetUninitializedItem( TUid::Uid( EIMASAORolling ) ) ); |
|
3562 |
|
3563 // In case we exit Settings view new state must be store |
|
3564 SetFlag( EDialogAlOnlineChanged ); |
|
3565 |
|
3566 InitAnyItem( *alwaysOnline, EMailAoOff, NULL ); |
|
3567 ClearFlag( EDialogAlwaysOnlineOn ); |
|
3568 InitializeAlwaysOnlineState(); |
|
3569 } |
|
3570 |
|
3571 // ---------------------------------------------------------------------------- |
|
3572 // CIMSSettingsDialog::EventEMNForceTurnOff() |
|
3573 // ---------------------------------------------------------------------------- |
|
3574 // |
|
3575 void CIMSSettingsDialog::EventEMNForceTurnOff() |
|
3576 { |
|
3577 IMUM_CONTEXT( CIMSSettingsDialog::EventEMNForceTurnOff, 0, KLogUi ); |
|
3578 |
|
3579 CMuiuSettingsLinkExtended* emn = |
|
3580 static_cast<CMuiuSettingsLinkExtended*>( |
|
3581 GetItem( TUid::Uid( EIMASMailNotifications ) ) ); |
|
3582 |
|
3583 InitAnyItem( *emn, EMailEmnOff, NULL ); |
|
3584 ClearFlag( EDialogOmaEmnOn ); |
|
3585 } |
|
3586 |
|
3587 // ---------------------------------------------------------------------------- |
|
3588 // CIMSSettingsDialog::EventUpdateAoDays() |
|
3589 // ---------------------------------------------------------------------------- |
|
3590 // |
|
3591 void CIMSSettingsDialog::EventUpdateAoDays( |
|
3592 CMuiuSettingBase& aBaseItem ) |
|
3593 { |
|
3594 IMUM_CONTEXT( CIMSSettingsDialog::EventUpdateAoDays, 0, KLogUi ); |
|
3595 IMUM_IN(); |
|
3596 |
|
3597 TInt resource = 0; |
|
3598 |
|
3599 if ( aBaseItem.Value() == KIMASEveryDayMask ) |
|
3600 { |
|
3601 resource = R_IMAS_SETTINGS_DIALOG_DAY_LIST_ALL; |
|
3602 } |
|
3603 else |
|
3604 { |
|
3605 resource = R_IMAS_SETTINGS_DIALOG_DAY_LIST_USERDEFINED; |
|
3606 } |
|
3607 |
|
3608 RBuf text; |
|
3609 TRAP_IGNORE( text.Assign( StringLoader::LoadL( resource ) ) ); |
|
3610 SetItemText( ToUid( EIMASAODays), text, ETrue ); |
|
3611 text.Close(); |
|
3612 |
|
3613 IMUM_OUT(); |
|
3614 } |
|
3615 |
|
3616 // ---------------------------------------------------------------------------- |
|
3617 // CIMSSettingsDialog::HideItemsPermanently() |
|
3618 // ---------------------------------------------------------------------------- |
|
3619 // |
|
3620 void CIMSSettingsDialog::HideItemsPermanently() |
|
3621 { |
|
3622 IMUM_CONTEXT( CIMSSettingsDialog::HideItemsPermanently, 0, KLogUi ); |
|
3623 |
|
3624 // The HidePermanently functions contain build in refresh |
|
3625 // system, so prevent refreshing to limit needless function |
|
3626 // calls from the listbox |
|
3627 TBool isImap = iAccountSettings->iIsImap4; |
|
3628 iArrayFlags.ClearFlag( EMuiuDynArrayAllowRefresh ); |
|
3629 |
|
3630 // In case Always Online is not supported, |
|
3631 // hide the menuitem from the array |
|
3632 HidePermanently( |
|
3633 ToUid( EIMASMainAlwaysOnline ), |
|
3634 !iBaseUiFlags.GF( EMailFeatureAlwaysOnlineEmail ) ); |
|
3635 |
|
3636 HidePermanently( |
|
3637 ToUid( EIMASMailNotifications ), |
|
3638 !iBaseUiFlags.GF( EMailFeatureOmaEmn ) ); |
|
3639 |
|
3640 // POP3 Protocol |
|
3641 |
|
3642 // Download Control: Unix path |
|
3643 HidePermanently( ToUid( EIMASUserUnixPath ), !isImap ); |
|
3644 |
|
3645 // Download Control: Retrieval Limit: Suscribed Folders |
|
3646 HidePermanently( ToUid( EIMASLimitFolders ), !isImap ); |
|
3647 |
|
3648 // Download Control: Folder subscription |
|
3649 HidePermanently( ToUid( EIMASUserFolderSubscription ), !isImap ); |
|
3650 |
|
3651 // Download Control: Retrieved parts: Total mailbody radio button |
|
3652 HidePermanently( ToUid( EIMASBtnRetrieveBody ), ETrue ); |
|
3653 |
|
3654 // IMAP4 Protocol |
|
3655 |
|
3656 // Download Control: Retrieved parts |
|
3657 HidePermanently( ToUid( EIMASBtnRetrieveLimit ), isImap ); |
|
3658 HidePermanently( ToUid( EIMASBtnRetrieveBodyAtt ), isImap ); |
|
3659 |
|
3660 // Incoming Settings: APOP |
|
3661 iArrayFlags.SetFlag( EMuiuDynArrayAllowRefresh ); |
|
3662 HidePermanently( ToUid( EIMASIncomingAPop ), isImap ); |
|
3663 } |
|
3664 |
|
3665 // ---------------------------------------------------------------------------- |
|
3666 // CIMSSettingsDialog::CheckPort() |
|
3667 // ---------------------------------------------------------------------------- |
|
3668 // |
|
3669 void CIMSSettingsDialog::CheckPort( |
|
3670 CMuiuSettingBase& aBaseItemPort, |
|
3671 const TBool aIncoming ) |
|
3672 { |
|
3673 IMUM_CONTEXT( CIMSSettingsDialog::CheckPort, 0, KLogUi ); |
|
3674 |
|
3675 // Check whether port is user defined or not. If user define, do nothing |
|
3676 // otherwise set default port based on security setting. |
|
3677 TInt id = aIncoming ? EIMASIncomingSecurity : EIMASOutgoingSecurity; |
|
3678 CMuiuSettingBase* base = GetItem( ToUid( id ) ); |
|
3679 |
|
3680 // Get value of security setting. |
|
3681 TIMASMailSecurity security = |
|
3682 static_cast<TIMASMailSecurity>( base->Value() ); |
|
3683 |
|
3684 // Check whether port setting is default or user defined |
|
3685 if ( !aBaseItemPort.Value() ) // Default |
|
3686 { |
|
3687 TUint32 defaultPort( MsvEmailMtmUiUtils::GetDefaultSecurityPort( |
|
3688 security, aIncoming, iAccountSettings->iIsImap4 ) ); |
|
3689 |
|
3690 CMuiuSettingsEditValue* portValueEditor = |
|
3691 static_cast<CMuiuSettingsEditValue*>( |
|
3692 SettingFindEditor( |
|
3693 aBaseItemPort, |
|
3694 ToUid( EIMASBtnPortUserDefined ) ) ); |
|
3695 |
|
3696 InitAnyItem( *portValueEditor, defaultPort, NULL ); |
|
3697 } |
|
3698 } |
|
3699 |
|
3700 // ---------------------------------------------------------------------------- |
|
3701 // CIMSSettingsDialog::ClosePortDialog() |
|
3702 // ---------------------------------------------------------------------------- |
|
3703 // |
|
3704 void CIMSSettingsDialog::ClosePortDialog( |
|
3705 CMuiuSettingBase& aBaseItem ) |
|
3706 { |
|
3707 IMUM_CONTEXT( CIMSSettingsDialog::ClosePortDialog, 0, KLogUi ); |
|
3708 |
|
3709 CheckPort( aBaseItem, aBaseItem.iItemId.iUid == EIMASIncomingPort ); |
|
3710 UpdateItemText( aBaseItem.iItemId ); |
|
3711 |
|
3712 // Set setting dialog resource back to normal |
|
3713 SetSettingPageResource( |
|
3714 EIPRNumber, |
|
3715 R_MUIU_SETTINGS_DIALOG_NUMBER ); |
|
3716 } |
|
3717 |
|
3718 // ---------------------------------------------------------------------------- |
|
3719 // CIMSSettingsDialog::UpdateCSDFlagL() |
|
3720 // ---------------------------------------------------------------------------- |
|
3721 // |
|
3722 void CIMSSettingsDialog::UpdateCSDFlagL() |
|
3723 { |
|
3724 IMUM_CONTEXT( CIMSSettingsDialog::UpdateCSDFlagL, 0, KLogUi ); |
|
3725 |
|
3726 CIMSSettingsAccessPointItem* iapItem = NULL; |
|
3727 TInt error = FindItem( iapItem, TUid::Uid( EIMASIncomingIap ) ); |
|
3728 if ( ( error == KErrNone ) && ( iapItem->iIap.iResult == CMManager::EDestination ) ) |
|
3729 { |
|
3730 iMailboxApi.CommDbUtilsL().IsApBearerCircuitSwitchedL( iapItem->iIap.iId ) ? |
|
3731 SetFlag( EDialogCsdAccessPoint ) : |
|
3732 ClearFlag( EDialogCsdAccessPoint ); |
|
3733 } |
|
3734 else |
|
3735 { |
|
3736 ClearFlag( EDialogCsdAccessPoint ); |
|
3737 } |
|
3738 } |
|
3739 |
|
3740 // ---------------------------------------------------------------------------- |
|
3741 // CIMSSettingsDialog::UpdateAOIntervalsL() |
|
3742 // ---------------------------------------------------------------------------- |
|
3743 // |
|
3744 void CIMSSettingsDialog::UpdateAOIntervalsL() |
|
3745 { |
|
3746 IMUM_CONTEXT( CIMSSettingsDialog::UpdateAOIntervalsL, 0, KLogUi ); |
|
3747 UpdateCSDFlagL(); |
|
3748 CMuiuSettingBase* aoIntervals = GetItem( ToUid( EIMASAOInterval ) ); |
|
3749 if ( aoIntervals ) |
|
3750 { |
|
3751 HBufC* text = NULL; |
|
3752 TMuiuSettingsText* muiuText = new (ELeave) TMuiuSettingsText; |
|
3753 TInt valueInMinutes = GetAoIntervalTimeInMinutes(); |
|
3754 |
|
3755 // After InitializeAoIntervalEditor function call, valueInMinutes |
|
3756 // contains the index of the radio button in UI. |
|
3757 InitializeAoIntervalEditor( valueInMinutes, text ); |
|
3758 |
|
3759 muiuText->Copy( *text ); |
|
3760 InitAnyItem( *aoIntervals, valueInMinutes, muiuText ); |
|
3761 delete muiuText; |
|
3762 delete text; |
|
3763 text = NULL; |
|
3764 } |
|
3765 } |
|
3766 |
|
3767 // ---------------------------------------------------------------------------- |
|
3768 // CIMSSettingsDialog::GetHelpContext() |
|
3769 // ---------------------------------------------------------------------------- |
|
3770 // |
|
3771 void CIMSSettingsDialog::GetHelpContext( TCoeHelpContext& aContext ) const |
|
3772 { |
|
3773 IMUM_CONTEXT( CIMSSettingsDialog::GetHelpContext, 0, KLogUi ); |
|
3774 |
|
3775 CMuiuSettingBase* baseItem = CurrentItem(); |
|
3776 |
|
3777 switch ( baseItem->iItemResourceId ) |
|
3778 { |
|
3779 case R_IMAS_MAIN_MENU: |
|
3780 aContext.iContext = KMCE_HLP_SETT_EMAILMAIN; |
|
3781 break; |
|
3782 |
|
3783 case R_IMAS_INCOMING_SETTINGS: |
|
3784 aContext.iContext = KMBXS_HLP_SETT_MBX_IN; |
|
3785 break; |
|
3786 |
|
3787 case R_IMAS_OUTGOING_SETTINGS: |
|
3788 aContext.iContext = KMBXS_HLP_SETT_MBX_OUT; |
|
3789 break; |
|
3790 |
|
3791 case R_IMAS_USER_PREFERENCES: |
|
3792 aContext.iContext = KMCE_HLP_SETT_MAIL_USER; |
|
3793 break; |
|
3794 |
|
3795 case R_IMAS_RETRIEVAL_LIMIT: |
|
3796 aContext.iContext = KMBXS_HLP_SETT_DOWNL_RETR; |
|
3797 break; |
|
3798 |
|
3799 case R_IMAS_DOWNLOAD_SETTINGS: |
|
3800 aContext.iContext = KMBXS_HLP_SETT_DOWNL_CTRL; |
|
3801 break; |
|
3802 |
|
3803 case R_IMAS_ALWAYSONLINE_SETTINGS: |
|
3804 aContext.iContext = KMCE_HLP_SETT_MAIL_ONLI; |
|
3805 break; |
|
3806 |
|
3807 case R_IMAS_MAILBOX_MENU: |
|
3808 aContext.iContext = KMBXS_HLP_SETT_MBX_IN_OUT; |
|
3809 break; |
|
3810 |
|
3811 default: |
|
3812 break; |
|
3813 } |
|
3814 |
|
3815 aContext.iMajor = KImumUid; |
|
3816 } |
|
3817 |
|
3818 // --------------------------------------------------------------------------- |
|
3819 // CIMSSettingsDialog::CurrentMailboxId() |
|
3820 // --------------------------------------------------------------------------- |
|
3821 // |
|
3822 TMsvId CIMSSettingsDialog::CurrentMailboxId() |
|
3823 { |
|
3824 IMUM_CONTEXT( CIMSSettingsDialog::CurrentMailboxId, 0, KLogUi ); |
|
3825 |
|
3826 return iAccountSettings->iMailboxId; |
|
3827 } |
|
3828 |
|
3829 // --------------------------------------------------------------------------- |
|
3830 // CIMSSettingsDialog::HandleListBoxEventL() |
|
3831 // --------------------------------------------------------------------------- |
|
3832 // |
|
3833 void CIMSSettingsDialog::HandleListBoxEventL( CEikListBox* aListBox, |
|
3834 TListBoxEvent aEventType ) |
|
3835 { |
|
3836 // CMuiuDynamicSettingsDialog::HandleListBoxEventL() is overriden |
|
3837 // in order to handle opening of settings item |
|
3838 switch ( aEventType ) |
|
3839 { |
|
3840 case EEventEnterKeyPressed: |
|
3841 case EEventItemDoubleClicked: |
|
3842 case EEventItemActioned: |
|
3843 // Tapping on focused list box item has same effect as pressing msk |
|
3844 KeyPressOKButtonL( MskCommand() ); |
|
3845 break; |
|
3846 default: |
|
3847 // CMuiuDynamicSettingsDialog takes care of changing middle |
|
3848 // sotkey |
|
3849 CMuiuDynamicSettingsDialog::HandleListBoxEventL( aListBox, |
|
3850 aEventType ); |
|
3851 break; |
|
3852 } |
|
3853 } |
|
3854 |
|
3855 // --------------------------------------------------------------------------- |
|
3856 // CIMSSettingsDialog::DelayedExecFlags() |
|
3857 // --------------------------------------------------------------------------- |
|
3858 // |
|
3859 TInt CIMSSettingsDialog::DelayedExecFlags( TAny* aPtr ) |
|
3860 { |
|
3861 static_cast<CIMSSettingsDialog*>(aPtr)->iDialog.ExecFlags(); |
|
3862 return EFalse; |
|
3863 } |
|
3864 |
|
3865 |
|
3866 // --------------------------------------------------------------------------- |
|
3867 // CIMSSettingsDialog::GetLoginInformationL() |
|
3868 // --------------------------------------------------------------------------- |
|
3869 // |
|
3870 void CIMSSettingsDialog::GetLoginInformationL( |
|
3871 TDes8& aUserName, |
|
3872 TDes8& aPassword, |
|
3873 TBool& aPasswordTemporary ) |
|
3874 { |
|
3875 // Retrieve the settings of the mailbox |
|
3876 const MImumInMailboxUtilities& utils = iMailboxApi.MailboxUtilitiesL(); |
|
3877 TMsvId mboxId = CurrentMailboxId(); |
|
3878 TMsvEntry entry = utils.GetMailboxEntryL( mboxId ); |
|
3879 CImumInSettingsData* accountsettings = |
|
3880 iMailboxApi.MailboxServicesL().LoadMailboxSettingsL( mboxId ); |
|
3881 CleanupStack::PushL( accountsettings ); |
|
3882 // Incoming settings |
|
3883 MImumInSettingsDataCollection* connection = &accountsettings->GetInSetL( 0 ); |
|
3884 |
|
3885 // Read the data |
|
3886 User::LeaveIfError( connection->GetAttr( |
|
3887 TImumDaSettings::EKeyUsername, aUserName ) ); |
|
3888 User::LeaveIfError( connection->GetAttr( |
|
3889 TImumDaSettings::EKeyPassword, aPassword ) ); |
|
3890 User::LeaveIfError( connection->GetAttr( |
|
3891 TImumInSettings::EKeyTemporaryPassword, aPasswordTemporary ) ); |
|
3892 |
|
3893 // Prepare the ending |
|
3894 CleanupStack::PopAndDestroy( accountsettings ); |
|
3895 } |
|
3896 |
|
3897 // End of File |