|
1 /* |
|
2 * Copyright (c) 2003 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: Dialog for setting server settings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CWVSettingsUIDialogImp.h" |
|
21 #include "CWVSettingsUI.hrh" |
|
22 #include "CWVSettingsUIDefs.h" |
|
23 #include "CWVSettingsUITlsHolder.h" |
|
24 #include "CWVSettingsUIDefineNewServerDialog.h" |
|
25 #include "CWVSettingsUIServerListDialog.h" |
|
26 #include "CWVSettingsUIServerSelector.h" |
|
27 #include "WVSettingsSharedDataNG.h" |
|
28 #include "WVSettingsUIPanics.h" |
|
29 #include "CWVSettingsUIDialogTitlePaneHandler.h" |
|
30 #include "CWVSettingsUISettingItemCreator.h" |
|
31 #include "CWVSettingsUISettingItemEditor.h" |
|
32 |
|
33 #include "CIMPSSharedDataFactory.h" |
|
34 #include "MIMPSSharedData.h" |
|
35 #include "IMPSServiceSettingsUINGInternalCRKeys.h" |
|
36 #include "IMPSUIDDefs.h" |
|
37 #include "MWVSettingsCASettingsNG.h" |
|
38 #include "impscommonuidebugprint.h" |
|
39 #include "ChatNGCommonUIDs.h" |
|
40 #include <csxhelp/imng.hlp.hrh> |
|
41 |
|
42 #include <aknlists.h> |
|
43 #include <aknsettingitemlist.h> |
|
44 #include <aknsettingpage.h> |
|
45 #include <akntextsettingpage.h> |
|
46 #include <akntitle.h> |
|
47 #include <aknquerydialog.h> |
|
48 #include <cimpssapsettingsstore.h> |
|
49 #include <cimpssapsettings.h> |
|
50 #include <cwvsettingsUIng.rsg> |
|
51 #include <coemain.h> |
|
52 #include <bautils.h> |
|
53 #include <stringloader.h> |
|
54 #include <aknnotewrappers.h> // branding |
|
55 #include <hlplch.h> |
|
56 #include <featmgr.h> |
|
57 #include <cimpspresenceconnectionuing.h> |
|
58 #include <impspresenceconnectionuiconstsng.h> |
|
59 #include <AknCheckBoxSettingPage.h> |
|
60 #include <avkon.rsg> |
|
61 #include <CIMPSSAPSettingsList.h> |
|
62 //#include <shareddatakeysvariant.h> |
|
63 #include <data_caging_path_literals.hrh> |
|
64 #include <AknIconArray.h> |
|
65 #include <avkon.mbg> |
|
66 #include <PathInfo.h> |
|
67 #include <alwaysonlinemanagerclient.h> |
|
68 #include <cpengnwsessionslotid2.h> |
|
69 #include <centralrepository.h> |
|
70 #include <aknmessagequerydialog.h> |
|
71 #include <CAVariationNG.rsg> |
|
72 |
|
73 #include "CAExternalInterface.h" |
|
74 |
|
75 // The Settings have been moved to Cenrep (also retained in the Resource file), |
|
76 // so the enums for keys and central repository header is added here |
|
77 |
|
78 #include "VariantKeys.h" |
|
79 #include <centralrepository.h> |
|
80 |
|
81 |
|
82 #ifdef RD_MULTIPLE_DRIVE |
|
83 |
|
84 #include <akncommondialogsdynmem.h> |
|
85 #include <caknmemoryselectiondialogmultidrive.h> |
|
86 #include <driveinfo.h> |
|
87 const TInt KMaxLengthOfDriveInformation = 100; |
|
88 |
|
89 #endif // RD_MULTIPLE_DRIVE |
|
90 |
|
91 |
|
92 const TInt KIMFeatHighlightLoggedInServer = 32; |
|
93 |
|
94 // ================= MEMBER FUNCTIONS ======================= |
|
95 |
|
96 // C++ default constructor can NOT contain any code, that |
|
97 // might leave. |
|
98 // |
|
99 CWVSettingsUIDialogImp::CWVSettingsUIDialogImp() |
|
100 : iServerInUsePtr( NULL, 0 ), |
|
101 iImLoginTypeEdited ( EFalse ), |
|
102 iImLoginType ( KWVSettingsDefaultIMLoginType ), |
|
103 iConnDaysIMPtr( NULL, 0 ), |
|
104 iConnHoursIMPtr( NULL, 0 ), |
|
105 iConnStartIMPtr( NULL, 0 ), |
|
106 iConnEndIMPtr( NULL, 0 ), |
|
107 iSchedulingSupported ( EFalse ), |
|
108 iForcedLoginMade( EFalse ), |
|
109 iServListDialog( NULL ) |
|
110 #ifdef RD_MULTIPLE_DRIVE |
|
111 , iMemorySelectionPtr( NULL, 0 ) |
|
112 #endif // RD_MULTIPLE_DRIVE |
|
113 , iIsOpenedTargettDlg( EFalse ) |
|
114 { |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CWVSettingsUIDialogImp::NewL |
|
119 // Two-phased constructor. |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 CWVSettingsUIDialogImp* CWVSettingsUIDialogImp::NewL() |
|
123 { |
|
124 CWVSettingsUIDialogImp* self = new ( ELeave ) CWVSettingsUIDialogImp(); |
|
125 return self; |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CWVSettingsUIDialogImp::RunDialogLD |
|
130 // |
|
131 // (other items were commented in a header). |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 TWVSettingsDialogReturnValue CWVSettingsUIDialogImp::RunDialogLD( |
|
135 CIMPSSAPSettingsStore& aSAPSettingsStore, |
|
136 MWVSettingsObserver* aObserver, |
|
137 const TDesC& aResourceFile, |
|
138 const TDesC& aResourceVariationFile, |
|
139 TInt& aExitReason, |
|
140 MWVSettingsCASettings* aCAServerSettings, |
|
141 CWVSettingsUIDialog** aSelfPtr, |
|
142 TBool aForcedLaunch, /*= EFalse */ |
|
143 TWVSettingsDialogType aDialogType ) |
|
144 { |
|
145 iSAPSettingsStore = &aSAPSettingsStore; |
|
146 iObserver = aObserver; |
|
147 iSelfPtr = aSelfPtr; |
|
148 iCAServerSettings = aCAServerSettings; |
|
149 iSettingItemEditor = new ( ELeave ) CWVSettingsUISettingItemEditor(); |
|
150 iForcedLaunch = aForcedLaunch; |
|
151 |
|
152 TFileName path = aResourceFile; |
|
153 TFileName pathVariation = aResourceVariationFile; |
|
154 |
|
155 if ( path.Length() == 0 ) |
|
156 { |
|
157 Dll::FileName( path ); |
|
158 Dll::FileName( pathVariation ); |
|
159 |
|
160 IMPSCUI_DP( D_IMPSCUI_LIT( "CWVSettingsUIDialogImp::RunDialogL - got path %S" ), &path ); |
|
161 |
|
162 TDriveName drive( TParsePtrC( path ).Drive( ) ); |
|
163 path.Zero(); |
|
164 path.Append( drive ); |
|
165 path.Append( KDC_RESOURCE_FILES_DIR() ); |
|
166 path.Append( KResourceName ); |
|
167 |
|
168 TDriveName driveVar( TParsePtrC( pathVariation ).Drive( ) ); |
|
169 pathVariation.Zero(); |
|
170 pathVariation.Append( driveVar ); |
|
171 pathVariation.Append( KDC_RESOURCE_FILES_DIR() ); |
|
172 pathVariation.Append( KIMCUVariationResourceName ); |
|
173 |
|
174 IMPSCUI_DP( D_IMPSCUI_LIT( "CWVSettingsUIDialogImp::RunDialogL - Constructed path %S" ), &path ); |
|
175 } |
|
176 |
|
177 iTlsHolder = CWVSettingsUITlsHolder::InstanceL(); |
|
178 |
|
179 if ( !( iTlsHolder->ResourceIsLoaded() ) ) |
|
180 { |
|
181 // the resource is not loaded |
|
182 RFs& fs = iCoeEnv->FsSession(); |
|
183 |
|
184 if ( path.Length() > 0 ) |
|
185 { |
|
186 // when baflutils gets an empty string, it returns "C:", |
|
187 // which breaks things |
|
188 BaflUtils::NearestLanguageFile( fs, path ); |
|
189 } |
|
190 if ( pathVariation.Length() > 0 ) |
|
191 { |
|
192 // when baflutils gets an empty string, it returns "C:", |
|
193 // which breaks things |
|
194 BaflUtils::NearestLanguageFile( fs, pathVariation ); |
|
195 |
|
196 } |
|
197 iResourceFileOffset = CEikonEnv::Static()->AddResourceFileL( path ); |
|
198 iResourceVariationFileOffset = CEikonEnv::Static()->AddResourceFileL( pathVariation ); |
|
199 |
|
200 iTlsHolder->ResourceLoaded(); |
|
201 } |
|
202 |
|
203 TInt returnValue ( 0 ); |
|
204 switch ( aDialogType ) |
|
205 { |
|
206 case EWVSettingsNormal: |
|
207 { |
|
208 iTitlePaneHandler = new ( ELeave ) CWVSettingsUIDialogTitlePaneHandler(); |
|
209 // add the correct menubar |
|
210 this->ConstructL( R_WVSETTINGSVIEW_SERVSETTINGS_MENUBAR ); |
|
211 // store the titlepane text |
|
212 iTitlePaneHandler->StoreTitlePaneTextL(); |
|
213 // create an instance of connection UI |
|
214 iConnectionUI = CIMPSPresenceConnectionUi::NewL( EIMPSConnClientIM, iSAPSettingsStore ); |
|
215 |
|
216 returnValue = this->ExecuteLD( R_WVSETTINGSVIEW_SERVSETTINGS_DLG ); |
|
217 break; |
|
218 } |
|
219 case EWVSettingsDefineServer: |
|
220 { |
|
221 HBufC* text = CEikonEnv::Static()->AllocReadResourceLC( |
|
222 R_WVSETTINGSVIEW_SERVERINUSE_NOSERV ); |
|
223 CAknQueryDialog* dlg = new ( ELeave ) CAknQueryDialog( |
|
224 CAknQueryDialog::ENoTone ); |
|
225 CleanupStack::PushL( dlg ); |
|
226 dlg->SetPromptL( *text ); |
|
227 CleanupStack::Pop( dlg ); |
|
228 CleanupStack::PopAndDestroy( text ); |
|
229 TInt ret( dlg->ExecuteLD( R_DELETE_CONFIRMATION_QUERY ) ); |
|
230 |
|
231 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
232 { |
|
233 // user accepted |
|
234 CWVSettingsUIDialogTitlePaneHandler* titlePaneHandler = |
|
235 new ( ELeave ) CWVSettingsUIDialogTitlePaneHandler(); |
|
236 CleanupStack::PushL( titlePaneHandler ); |
|
237 // store the titlepane text |
|
238 titlePaneHandler->StoreTitlePaneTextL(); |
|
239 returnValue = LaunchDefineNewServerDialogL( aSAPSettingsStore, |
|
240 *aObserver, |
|
241 *titlePaneHandler, |
|
242 aExitReason ); |
|
243 // restore the titlepane text |
|
244 titlePaneHandler->RestoreTitlePaneText(); |
|
245 CleanupStack::PopAndDestroy( titlePaneHandler ); |
|
246 } |
|
247 else |
|
248 { |
|
249 aExitReason = ENotSaved; |
|
250 } |
|
251 |
|
252 if ( iTlsHolder->OkToUnloadResource() ) |
|
253 { |
|
254 CEikonEnv* eikonEnv = CEikonEnv::Static(); |
|
255 eikonEnv->DeleteResourceFile( iResourceFileOffset ); |
|
256 eikonEnv->DeleteResourceFile( iResourceVariationFileOffset ); |
|
257 iTlsHolder->ResourceUnLoaded(); |
|
258 } |
|
259 delete this; |
|
260 break; |
|
261 } |
|
262 default: |
|
263 { |
|
264 User::Leave( KErrNotSupported ); |
|
265 break; |
|
266 } |
|
267 } |
|
268 |
|
269 if ( returnValue == EWVSettingsViewCmdExit ) |
|
270 { |
|
271 return EWVSettingsViewExitCalled; |
|
272 } |
|
273 else |
|
274 { |
|
275 if ( returnValue == EAknSoftkeyExit && iForcedLoginMade ) |
|
276 { |
|
277 // Dialog is shutdown by framework during login |
|
278 // procedure when activating refresh view |
|
279 aExitReason = EForcedExit; |
|
280 } |
|
281 return EWVSettingsViewOk; |
|
282 } |
|
283 } |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
|
286 // CWVSettingsUIDialogImp::LaunchDefineNewServerDialogL |
|
287 // |
|
288 // (other items were commented in a header). |
|
289 // ----------------------------------------------------------------------------- |
|
290 // |
|
291 TInt CWVSettingsUIDialogImp::LaunchDefineNewServerDialogL ( |
|
292 CIMPSSAPSettingsStore& aSAPSettingsStore, |
|
293 MWVSettingsObserver& aObserver, |
|
294 CWVSettingsUIDialogTitlePaneHandler& aTitlePaneHandler, |
|
295 TInt& aExitReason ) const |
|
296 { |
|
297 TUint32 newUid( 0 ); |
|
298 CWVSettingsUIDefineNewServerDialog* defineNewServerDialog = new ( ELeave ) |
|
299 CWVSettingsUIDefineNewServerDialog( |
|
300 aExitReason, |
|
301 aSAPSettingsStore, |
|
302 CWVSettingsUIDefineNewServerDialog::ENewServer, |
|
303 aObserver, |
|
304 aTitlePaneHandler, |
|
305 NULL, |
|
306 newUid, |
|
307 iConnectionUI ); |
|
308 CleanupStack::PushL( defineNewServerDialog ); |
|
309 |
|
310 defineNewServerDialog->ConstructL( R_WVSETTINGSVIEW_DEFNEWSERVER_MENUBAR ); |
|
311 CleanupStack::Pop( defineNewServerDialog ); |
|
312 TInt returnValue = defineNewServerDialog->ExecuteLD( R_WVSETTINGSVIEW_DEFNEWSERVER_DLG ); |
|
313 return returnValue; |
|
314 } |
|
315 |
|
316 // Destructor |
|
317 CWVSettingsUIDialogImp::~CWVSettingsUIDialogImp() |
|
318 { |
|
319 delete iSharedData; |
|
320 delete iSettingsChangeNotifier; |
|
321 |
|
322 if ( iSAPSettingsStore ) |
|
323 { |
|
324 iSAPSettingsStore->RemoveObserver( this ); |
|
325 } |
|
326 |
|
327 if ( iSettingItemArray ) |
|
328 { |
|
329 iSettingItemArray->ResetAndDestroy(); |
|
330 } |
|
331 |
|
332 delete iSettingItemArray; |
|
333 delete iServerInUse; |
|
334 delete iTitle; |
|
335 if ( iTitlePaneHandler ) |
|
336 { |
|
337 // restore the titlepane text |
|
338 iTitlePaneHandler->RestoreTitlePaneText(); |
|
339 delete iTitlePaneHandler; |
|
340 } |
|
341 |
|
342 if ( iConnectionUI ) |
|
343 { |
|
344 TBool loggedIn = EFalse; |
|
345 TRAP_IGNORE( loggedIn = iConnectionUI->LoggedInL( EIMPSConnClientIM ) ); |
|
346 |
|
347 if ( iForcedLoginMade || loggedIn ) |
|
348 { |
|
349 // Keep connection open |
|
350 TRAPD( err, |
|
351 { |
|
352 CPEngNWSessionSlotID2* sessionSlotID = |
|
353 iConnectionUI->GetActiveNWSessionSlotIDL( EIMPSConnClientIM ); |
|
354 CleanupStack::PushL( sessionSlotID ); |
|
355 iConnectionUI->HandleApplicationExitL( EIMPSConnClientIM, |
|
356 EIMPSLeaveSessionOpenExit, |
|
357 *sessionSlotID ); |
|
358 CleanupStack::PopAndDestroy( sessionSlotID ); |
|
359 } ); // TRAPD |
|
360 |
|
361 if ( err != KErrNone ) |
|
362 { |
|
363 CActiveScheduler::Current()->Error( err ); |
|
364 } |
|
365 } |
|
366 } |
|
367 |
|
368 delete iConnectionUI; |
|
369 delete iSettingItemEditor; |
|
370 |
|
371 delete iConnDaysIM; |
|
372 delete iConnHoursIM; |
|
373 delete iConnStartIM; |
|
374 delete iConnEndIM; |
|
375 |
|
376 if ( iSelectedDaysIM ) |
|
377 { |
|
378 iSelectedDaysIM->ResetAndDestroy(); |
|
379 delete iSelectedDaysIM; |
|
380 } |
|
381 |
|
382 |
|
383 if ( iTlsHolder ) |
|
384 { |
|
385 if ( iTlsHolder->OkToUnloadResource() ) |
|
386 { |
|
387 // if we leave in changeresourcefileL we have set 0 to offset |
|
388 // and we should not try to unload the resource again |
|
389 if ( iResourceFileOffset ) |
|
390 { |
|
391 CEikonEnv::Static()->DeleteResourceFile( iResourceFileOffset ); |
|
392 } |
|
393 |
|
394 if ( iResourceVariationFileOffset ) |
|
395 { |
|
396 CEikonEnv::Static()->DeleteResourceFile( iResourceVariationFileOffset ); |
|
397 } |
|
398 iTlsHolder->ResourceUnLoaded(); |
|
399 } |
|
400 iTlsHolder->DestroySingletonsAndHolder(); |
|
401 } |
|
402 |
|
403 delete iIconArray; |
|
404 if ( iDlgLauncher && iDlgLauncher->IsActive() ) |
|
405 { |
|
406 iDlgLauncher->Cancel(); |
|
407 } |
|
408 delete iDlgLauncher; |
|
409 |
|
410 #ifdef RD_MULTIPLE_DRIVE |
|
411 delete iMemorySelection; |
|
412 #endif |
|
413 // to cancel all request when dialog closed |
|
414 CCoeEnv* env = CCoeEnv::Static(); |
|
415 if ( env->IsActive() ) |
|
416 { |
|
417 env->Cancel(); |
|
418 } |
|
419 } |
|
420 |
|
421 // ----------------------------------------------------------------------------- |
|
422 // CWVSettingsUIDialogImp::UpdateServerInUseItemL |
|
423 // |
|
424 // (other items were commented in a header). |
|
425 // ----------------------------------------------------------------------------- |
|
426 // |
|
427 void CWVSettingsUIDialogImp::UpdateServerInUseItemL() |
|
428 { |
|
429 HBufC* name = CurrentServerNameL(); |
|
430 |
|
431 // CurrentServerNameL returns NULL if there is no default SAP |
|
432 if ( name ) |
|
433 { |
|
434 CleanupStack::PushL( name ); |
|
435 |
|
436 // check if the server name has changed |
|
437 if ( name->Compare( *iServerInUse ) ) |
|
438 { |
|
439 if ( iObserver ) |
|
440 { |
|
441 iObserver->ServerChangedL ( *name, ETrue ); |
|
442 } |
|
443 iServerInUsePtr.Copy( name->Left( iServerInUsePtr.MaxLength() ) ); |
|
444 ChangeLoginTypeToManualL(); |
|
445 } |
|
446 CleanupStack::PopAndDestroy( ); // name |
|
447 } |
|
448 else |
|
449 { |
|
450 iServerInUsePtr.Copy( KEmptyDesC ); |
|
451 // No default SAP, make sure that login type |
|
452 // setting is set to manual connection |
|
453 ChangeLoginTypeToManualL(); |
|
454 } |
|
455 |
|
456 TInt index( EWVSettingsServerInUse ); |
|
457 if ( !iCAServerSettings ) |
|
458 { |
|
459 // if we don't show CA settings item, we have 1 item less |
|
460 // in the listbox -> thus -1 to the item to be loaded |
|
461 index--; |
|
462 } |
|
463 iSettingItemArray->At( index )->LoadL(); |
|
464 iSettingItemArray->At( index )->UpdateListBoxTextL(); |
|
465 DrawNow(); |
|
466 } |
|
467 |
|
468 |
|
469 // ----------------------------------------------------------------------------- |
|
470 // CWVSettingsUIDialogImp::ChangeLoginTypeToManualL |
|
471 // |
|
472 // (other items were commented in a header). |
|
473 // ----------------------------------------------------------------------------- |
|
474 // |
|
475 void CWVSettingsUIDialogImp::ChangeLoginTypeToManualL() |
|
476 { |
|
477 TBool refresh( EFalse ); |
|
478 if ( ( iImLoginType == EWVSettingsChatLoginAutoAlways ) |
|
479 || ( iImLoginType == EWVSettingsChatLoginAutoInHomeNW ) ) |
|
480 { |
|
481 iImLoginTypeEdited = ETrue; |
|
482 iImLoginType = EWVSettingsChatLoginManual; |
|
483 // save this straight away, since default server is also saved straight away |
|
484 StoreSettingValueL( iImLoginType, EIMPSSharedKeysIMLogin ); |
|
485 refresh = ETrue; |
|
486 } |
|
487 if ( refresh ) |
|
488 { |
|
489 // Init to EFalse |
|
490 iForcedLoginMade = EFalse; |
|
491 |
|
492 // Show note about manual mode activation |
|
493 HBufC* text = CEikonEnv::Static()->AllocReadResourceLC( |
|
494 R_WVSETTINGSVIEW_MANUAL_ACTIVATED ); |
|
495 |
|
496 CAknInformationNote* note = new ( ELeave ) CAknInformationNote(); |
|
497 note->ExecuteLD( *text ); |
|
498 |
|
499 CleanupStack::PopAndDestroy( text ); |
|
500 RefreshDialogL(); |
|
501 } |
|
502 } |
|
503 |
|
504 // ----------------------------------------------------------------------------- |
|
505 // CWVSettingsUIDialogImp::QueryNewServerL |
|
506 // |
|
507 // (other items were commented in a header). |
|
508 // ----------------------------------------------------------------------------- |
|
509 // |
|
510 void CWVSettingsUIDialogImp::QueryNewServerL( TBool * aExitReason /*=NULL*/ ) |
|
511 { |
|
512 |
|
513 HBufC* text = CEikonEnv::Static()->AllocReadResourceLC( |
|
514 R_WVSETTINGSVIEW_SERVERINUSE_NOSERV ); |
|
515 |
|
516 CAknQueryDialog* dlg = new ( ELeave ) CAknQueryDialog( |
|
517 CAknQueryDialog::ENoTone ); |
|
518 |
|
519 CleanupStack::PushL( dlg ); |
|
520 dlg->SetPromptL( *text ); |
|
521 CleanupStack::Pop( dlg ); |
|
522 CleanupStack::PopAndDestroy( text ); |
|
523 |
|
524 TInt ret( dlg->ExecuteLD( R_DELETE_CONFIRMATION_QUERY ) ); |
|
525 |
|
526 TWVSettingsDialogReturnValue returnValue = EWVSettingsViewOk; |
|
527 |
|
528 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
529 { |
|
530 TInt exitReason( 0 ); |
|
531 TUint32 newUid( 0 ); |
|
532 CWVSettingsUIDefineNewServerDialog* dlg = new ( ELeave ) |
|
533 CWVSettingsUIDefineNewServerDialog( |
|
534 exitReason, |
|
535 *iSAPSettingsStore, |
|
536 CWVSettingsUIDefineNewServerDialog::ENewServer, |
|
537 *iObserver, |
|
538 *iTitlePaneHandler, |
|
539 this, |
|
540 newUid, |
|
541 iConnectionUI ); |
|
542 |
|
543 CleanupStack::PushL( dlg ); |
|
544 dlg->ConstructL( R_WVSETTINGSVIEW_DEFNEWSERVER_MENUBAR ); |
|
545 CleanupStack::Pop( dlg ); |
|
546 |
|
547 dlg->ExecuteLD( R_WVSETTINGSVIEW_DEFNEWSERVER_DLG ); |
|
548 |
|
549 |
|
550 //if exitReason = EApplicationExit, then exit from IM application. |
|
551 if ( exitReason == EApplicationExit ) |
|
552 { |
|
553 *aExitReason = EFalse; |
|
554 ProcessCommandL( EWVSettingsViewCmdExit ); |
|
555 } |
|
556 |
|
557 |
|
558 if ( !exitReason ) |
|
559 { |
|
560 returnValue = ExecuteServerListDialogL(); |
|
561 } |
|
562 } |
|
563 |
|
564 if ( returnValue == EWVSettingsViewExitCalled ) |
|
565 { |
|
566 ProcessCommandL ( EWVSettingsViewCmdExit ); |
|
567 } |
|
568 } |
|
569 |
|
570 // ----------------------------------------------------------------------------- |
|
571 // CWVSettingsUIDialogImp::ExecuteServerListDialogL |
|
572 // |
|
573 // (other items were commented in a header). |
|
574 // ----------------------------------------------------------------------------- |
|
575 // |
|
576 TWVSettingsDialogReturnValue CWVSettingsUIDialogImp::ExecuteServerListDialogL() |
|
577 { |
|
578 CWVSettingsUIServerListDialog* serverListDialog = new ( ELeave ) CWVSettingsUIServerListDialog( |
|
579 *iSAPSettingsStore, |
|
580 *iObserver, |
|
581 *iTitlePaneHandler, |
|
582 *this, |
|
583 iConnectionUI ); |
|
584 |
|
585 CleanupStack::PushL( serverListDialog ); |
|
586 serverListDialog->ConstructL( R_WVSETTINGSVIEW_SERVERLIST_MENUBAR ); |
|
587 CleanupStack::Pop( serverListDialog ); |
|
588 |
|
589 iServListDialog = serverListDialog; |
|
590 TInt returnValue = 0; |
|
591 // Trapped to make sure iServListDialog gets |
|
592 // nullified in case of leave |
|
593 TRAPD( err, returnValue = serverListDialog->ExecuteLD( R_WVSETTINGSVIEW_SERVER_LIST_DLG ) ); |
|
594 iServListDialog = NULL; |
|
595 User::LeaveIfError( err ); |
|
596 |
|
597 // this is customized return code to detect dialog shutter |
|
598 if ( returnValue == EEikBidCancel ) |
|
599 { |
|
600 // Dialog shutter forced the dialogs to close and dialogs are already deleted. |
|
601 // quickly exit the dialog code. |
|
602 return EWVSettingsViewForceExit; |
|
603 } |
|
604 |
|
605 UpdateServerInUseItemL(); |
|
606 RefreshTitleL(); |
|
607 |
|
608 if ( returnValue == EWVSettingsViewCmdExit ) |
|
609 { |
|
610 return EWVSettingsViewExitCalled; |
|
611 } |
|
612 return EWVSettingsViewOk; |
|
613 } |
|
614 |
|
615 // ----------------------------------------------------------------------------- |
|
616 // CWVSettingsUIDialogImp::UpdateLoginTypesL |
|
617 // |
|
618 // (other items were commented in a header). |
|
619 // ----------------------------------------------------------------------------- |
|
620 // |
|
621 void CWVSettingsUIDialogImp::UpdateLoginTypesL () |
|
622 { |
|
623 // initialize as max integer, so that we know if something went wrong |
|
624 // LoadSettingValue will return 0 if it cannot load the key |
|
625 TInt loadedValue ( KMaxTInt ); |
|
626 |
|
627 LoadSettingValueL( loadedValue, EIMPSSharedKeysIMLogin ); |
|
628 |
|
629 SetIMLoginTypeL( loadedValue ); |
|
630 |
|
631 iSettingItemArray->At( EWVSettingsIMLoginType )->LoadL(); |
|
632 iSettingItemArray->At( EWVSettingsIMLoginType )->UpdateListBoxTextL(); |
|
633 } |
|
634 |
|
635 |
|
636 // ----------------------------------------------------------------------------- |
|
637 // CWVSettingsUIDialogImp::UpdateListboxL() |
|
638 // |
|
639 // (other items were commented in a header). |
|
640 // ----------------------------------------------------------------------------- |
|
641 // |
|
642 void CWVSettingsUIDialogImp::UpdateListboxL() |
|
643 { |
|
644 if ( iSettingItemArray ) |
|
645 { |
|
646 TInt count ( iSettingItemArray->Count() ); |
|
647 for ( TInt i = 0; i < count; i++ ) |
|
648 { |
|
649 iSettingItemArray->At( i )->LoadL(); |
|
650 iSettingItemArray->At( i )->UpdateListBoxTextL(); |
|
651 } |
|
652 } |
|
653 DrawNow(); |
|
654 } |
|
655 |
|
656 |
|
657 // ----------------------------------------------------------------------------- |
|
658 // CWVSettingsUIDialogImp::SetIMLoginTypeL() |
|
659 // |
|
660 // (other items were commented in a header). |
|
661 // ----------------------------------------------------------------------------- |
|
662 // |
|
663 void CWVSettingsUIDialogImp::SetIMLoginTypeL( TInt aLoadedValue ) |
|
664 { |
|
665 if ( ( aLoadedValue > EWVSettingsChatMinLoginType ) |
|
666 && ( aLoadedValue < EWVSettingsChatMaxLoginType ) ) |
|
667 { |
|
668 iImLoginType = aLoadedValue; |
|
669 } |
|
670 } |
|
671 |
|
672 // ----------------------------------------------------------------------------- |
|
673 // CWVSettingsUIDialogImp::SetConnectionDaysL( TInt aLoadedValue ) |
|
674 // |
|
675 // (other items were commented in a header). |
|
676 // ----------------------------------------------------------------------------- |
|
677 // |
|
678 void CWVSettingsUIDialogImp::SetConnectionDaysL( TInt aLoadedValue, |
|
679 CSelectionItemList& aSelectionItemList ) |
|
680 { |
|
681 TInt index ( 0 ); |
|
682 |
|
683 if ( iStartDayOfWeek == ESunday ) |
|
684 { |
|
685 // normally in the array monday is first, but |
|
686 // |
|
687 // index of the days in the array |
|
688 index++; |
|
689 } |
|
690 if ( aLoadedValue & EWVSettingsMonday ) |
|
691 { |
|
692 aSelectionItemList.At( index )->SetSelectionStatus( ETrue ); |
|
693 } |
|
694 else |
|
695 { |
|
696 aSelectionItemList.At( index )->SetSelectionStatus( EFalse ); |
|
697 } |
|
698 index++; |
|
699 |
|
700 if ( aLoadedValue & EWVSettingsTuesday ) |
|
701 { |
|
702 aSelectionItemList.At( index )->SetSelectionStatus( ETrue ); |
|
703 } |
|
704 else |
|
705 { |
|
706 aSelectionItemList.At( index )->SetSelectionStatus( EFalse ); |
|
707 } |
|
708 index++; |
|
709 |
|
710 if ( aLoadedValue & EWVSettingsWednesday ) |
|
711 { |
|
712 aSelectionItemList.At( index )->SetSelectionStatus( ETrue ); |
|
713 } |
|
714 else |
|
715 { |
|
716 aSelectionItemList.At( index )->SetSelectionStatus( EFalse ); |
|
717 } |
|
718 index++; |
|
719 |
|
720 if ( aLoadedValue & EWVSettingsThursday ) |
|
721 { |
|
722 aSelectionItemList.At( index )->SetSelectionStatus( ETrue ); |
|
723 } |
|
724 else |
|
725 { |
|
726 aSelectionItemList.At( index )->SetSelectionStatus( EFalse ); |
|
727 } |
|
728 index++; |
|
729 |
|
730 if ( aLoadedValue & EWVSettingsFriday ) |
|
731 { |
|
732 aSelectionItemList.At( index )->SetSelectionStatus( ETrue ); |
|
733 } |
|
734 else |
|
735 { |
|
736 aSelectionItemList.At( index )->SetSelectionStatus( EFalse ); |
|
737 } |
|
738 index++; |
|
739 |
|
740 if ( aLoadedValue & EWVSettingsSaturday ) |
|
741 { |
|
742 aSelectionItemList.At( index )->SetSelectionStatus( ETrue ); |
|
743 } |
|
744 else |
|
745 { |
|
746 aSelectionItemList.At( index )->SetSelectionStatus( EFalse ); |
|
747 } |
|
748 index++; |
|
749 |
|
750 if ( aLoadedValue & EWVSettingsSunday ) |
|
751 { |
|
752 if ( iStartDayOfWeek == ESunday ) |
|
753 { |
|
754 |
|
755 aSelectionItemList.At( 0 )->SetSelectionStatus( ETrue ); |
|
756 } |
|
757 else |
|
758 { |
|
759 |
|
760 aSelectionItemList.At( index )->SetSelectionStatus( ETrue ); |
|
761 } |
|
762 } |
|
763 else |
|
764 { |
|
765 if ( iStartDayOfWeek == ESunday ) |
|
766 { |
|
767 |
|
768 aSelectionItemList.At( 0 )->SetSelectionStatus( EFalse ); |
|
769 } |
|
770 else |
|
771 { |
|
772 |
|
773 aSelectionItemList.At( index )->SetSelectionStatus( EFalse ); |
|
774 } |
|
775 } |
|
776 |
|
777 UpdateConnectionDaysL( *iSelectedDaysIM ); |
|
778 } |
|
779 |
|
780 // ----------------------------------------------------------------------------- |
|
781 // CWVSettingsUIDialogImp::GetConnectionDaysL( CSelectionItemList& aSelectionItemList ) |
|
782 // |
|
783 // (other items were commented in a header). |
|
784 // ----------------------------------------------------------------------------- |
|
785 // |
|
786 TInt CWVSettingsUIDialogImp::GetConnectionDaysL( CSelectionItemList& aSelectionItemList ) |
|
787 { |
|
788 TInt index ( 0 ); |
|
789 |
|
790 if ( iStartDayOfWeek == ESunday ) |
|
791 { |
|
792 // normally in the array monday is first, but |
|
793 // |
|
794 // index of the days in the array |
|
795 index++; |
|
796 } |
|
797 |
|
798 TInt returnValue ( 0 ); |
|
799 |
|
800 if ( aSelectionItemList.At( index )->SelectionStatus() ) |
|
801 { |
|
802 returnValue |= EWVSettingsMonday; |
|
803 } |
|
804 index++; |
|
805 |
|
806 if ( aSelectionItemList.At( index )->SelectionStatus() ) |
|
807 { |
|
808 returnValue |= EWVSettingsTuesday; |
|
809 } |
|
810 index++; |
|
811 |
|
812 if ( aSelectionItemList.At( index )->SelectionStatus() ) |
|
813 { |
|
814 returnValue |= EWVSettingsWednesday; |
|
815 } |
|
816 index++; |
|
817 |
|
818 if ( aSelectionItemList.At( index )->SelectionStatus() ) |
|
819 { |
|
820 returnValue |= EWVSettingsThursday; |
|
821 } |
|
822 index++; |
|
823 |
|
824 if ( aSelectionItemList.At( index )->SelectionStatus() ) |
|
825 { |
|
826 returnValue |= EWVSettingsFriday; |
|
827 } |
|
828 index++; |
|
829 |
|
830 if ( aSelectionItemList.At( index )->SelectionStatus() ) |
|
831 { |
|
832 returnValue |= EWVSettingsSaturday; |
|
833 } |
|
834 index++; |
|
835 |
|
836 if ( iStartDayOfWeek == ESunday ) |
|
837 { |
|
838 |
|
839 if ( ( &aSelectionItemList )->At( 0 )->SelectionStatus() ) |
|
840 { |
|
841 returnValue |= EWVSettingsSunday; |
|
842 } |
|
843 } |
|
844 else |
|
845 { |
|
846 if ( aSelectionItemList.At( index )->SelectionStatus() ) |
|
847 { |
|
848 |
|
849 returnValue |= EWVSettingsSunday; |
|
850 } |
|
851 } |
|
852 |
|
853 return returnValue; |
|
854 } |
|
855 |
|
856 // ----------------------------------------------------------------------------- |
|
857 // CWVSettingsUIDialogImp::UpdateConnectionDaysL( CSelectionItemList& aSelectionItemList, TInt aItem ) |
|
858 // |
|
859 // (other items were commented in a header). |
|
860 // ----------------------------------------------------------------------------- |
|
861 // |
|
862 void CWVSettingsUIDialogImp::UpdateConnectionDaysL( CSelectionItemList& aSelectionItemList ) |
|
863 { |
|
864 if ( iSelectedDaysIM ) |
|
865 { |
|
866 TBool allSelected ( ETrue ); |
|
867 |
|
868 TInt count = ( &aSelectionItemList )->Count(); |
|
869 // check if all days are selected |
|
870 for ( TInt i = 0; i < count; i++ ) |
|
871 { |
|
872 if ( !( &aSelectionItemList )->At( i )->SelectionStatus() ) |
|
873 { |
|
874 allSelected = EFalse; |
|
875 } |
|
876 } |
|
877 |
|
878 HBufC* text = NULL; |
|
879 |
|
880 if ( allSelected ) |
|
881 { |
|
882 text = StringLoader::LoadLC( R_WVSETTINGSVIEW_SETTING_PEC_CONN_ALLDAYS ); |
|
883 } |
|
884 else |
|
885 { |
|
886 text = StringLoader::LoadLC( R_WVSETTINGSVIEW_SETTING_PEC_CONN_SELDAYS ); |
|
887 } |
|
888 |
|
889 if ( text ) |
|
890 { |
|
891 iConnDaysIMPtr.Copy( text->Left( iConnDaysIMPtr.MaxLength() ) ); |
|
892 CleanupStack::PopAndDestroy( text ); |
|
893 } |
|
894 } |
|
895 } |
|
896 |
|
897 // ----------------------------------------------------------------------------- |
|
898 // CWVSettingsUIDialogImp::UpdateConnectionHoursTextL( TInt aItem, TBool aAllDay ) |
|
899 // |
|
900 // (other items were commented in a header). |
|
901 // ----------------------------------------------------------------------------- |
|
902 // |
|
903 void CWVSettingsUIDialogImp::UpdateConnectionHoursTextL( TBool aAllDay ) |
|
904 { |
|
905 HBufC* text = NULL; |
|
906 if ( aAllDay ) |
|
907 { |
|
908 text = StringLoader::LoadLC( R_WVSETTINGSVIEW_SETTING_PEC_CONN_ALLHOURS ); |
|
909 iConnHoursIMInt = EWVSettingsAllDay; |
|
910 iConnHoursIMPtr.Copy( text->Left( iConnHoursIMPtr.MaxLength() ) ); |
|
911 CleanupStack::PopAndDestroy( text ); |
|
912 } |
|
913 else |
|
914 { |
|
915 // array granularity = 2 since there are 2 items |
|
916 CDesCArray* noteTexts = new( ELeave ) CDesCArrayFlat( 2 ); |
|
917 CleanupStack::PushL( noteTexts ); |
|
918 |
|
919 // Arabic & Hebrew conversion if needed. |
|
920 HBufC* startBuf = iConnStartIM->AllocLC(); |
|
921 HBufC* endBuf = iConnEndIM->AllocLC(); |
|
922 |
|
923 TPtr startPtr( startBuf->Des() ); |
|
924 TPtr endPtr( endBuf->Des() ); |
|
925 |
|
926 AknTextUtils::LanguageSpecificNumberConversion( startPtr ); |
|
927 AknTextUtils::LanguageSpecificNumberConversion( endPtr ); |
|
928 |
|
929 noteTexts->AppendL( startPtr ); |
|
930 noteTexts->AppendL( endPtr ); |
|
931 |
|
932 text = StringLoader::LoadLC( R_WVSETTINGSVIEW_SETTING_PEC_CONN_SELECTED_HOURS, *noteTexts ); |
|
933 iConnHoursIMInt = EWVSettingsBetweenHours; |
|
934 iConnHoursIMPtr.Copy( text->Left( iConnHoursIMPtr.MaxLength() ) ); |
|
935 CleanupStack::PopAndDestroy( text ); |
|
936 CleanupStack::PopAndDestroy( 2 ); // startBuf, endBuf |
|
937 CleanupStack::PopAndDestroy( noteTexts ); |
|
938 } |
|
939 } |
|
940 |
|
941 // ----------------------------------------------------------------------------- |
|
942 // CWVSettingsUIDialogImp::QueryConnectionHoursL |
|
943 // |
|
944 // (other items were commented in a header). |
|
945 // ----------------------------------------------------------------------------- |
|
946 // |
|
947 void CWVSettingsUIDialogImp::QueryConnectionHoursL() |
|
948 { |
|
949 TTime startTime; |
|
950 TTime endTime; |
|
951 // set the current time |
|
952 startTime.HomeTime(); |
|
953 endTime.HomeTime(); |
|
954 |
|
955 TDateTime dateTime = startTime.DateTime(); |
|
956 |
|
957 // we can ignore the error, since if the Parse fails startTime remains in hometime |
|
958 // get the start time for IM |
|
959 // read the hour part of the time |
|
960 dateTime.SetHour( iConnStartHourIM ); |
|
961 // read the minute part of the time |
|
962 dateTime.SetMinute( iConnStartMinuteIM ); |
|
963 // set the start time |
|
964 startTime = dateTime; |
|
965 |
|
966 // get the end time for IM |
|
967 // read the hour part |
|
968 dateTime.SetHour( iConnEndHourIM ); |
|
969 // read the minute part |
|
970 dateTime.SetMinute( iConnEndMinuteIM ); |
|
971 // set the end time |
|
972 endTime = dateTime; |
|
973 |
|
974 CAknMultiLineDataQueryDialog* dlg = CAknMultiLineDataQueryDialog::NewL( startTime, endTime ); |
|
975 TInt ret( dlg->ExecuteLD( R_WVSETTINGSVIEW_CONN_HOURS_QUERY ) ); |
|
976 |
|
977 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
978 { |
|
979 // get and format the time/date string |
|
980 HBufC* tFormat = CCoeEnv::Static()->AllocReadResourceLC( |
|
981 R_QTN_TIME_USUAL_WITH_ZERO ); |
|
982 |
|
983 // user entered text |
|
984 startTime.FormatL( iConnStartIMPtr, *tFormat ); |
|
985 endTime.FormatL( iConnEndIMPtr, *tFormat ); |
|
986 dateTime = startTime.DateTime(); |
|
987 iConnStartHourIM = dateTime.Hour(); |
|
988 iConnStartMinuteIM = dateTime.Minute(); |
|
989 dateTime = endTime.DateTime(); |
|
990 iConnEndHourIM = dateTime.Hour(); |
|
991 iConnEndMinuteIM = dateTime.Minute(); |
|
992 CleanupStack::PopAndDestroy( tFormat ); |
|
993 } |
|
994 } |
|
995 |
|
996 // ----------------------------------------------------------------------------- |
|
997 // CWVSettingsUIDialogImp::RefreshTitleL |
|
998 // |
|
999 // (other items were commented in a header). |
|
1000 // ----------------------------------------------------------------------------- |
|
1001 // |
|
1002 void CWVSettingsUIDialogImp::RefreshTitleL() |
|
1003 { |
|
1004 HBufC* tempTitle = iEikonEnv->AllocReadResourceL( RSC_WVSETTINGSVIEW_SETT_NEW_SERVER ); |
|
1005 delete iTitle; |
|
1006 iTitle = NULL; |
|
1007 iTitle = tempTitle; |
|
1008 |
|
1009 if ( iServListDialog ) |
|
1010 { |
|
1011 // Server list dialog is active, refresh title in there |
|
1012 iServListDialog->RefreshTitleL(); |
|
1013 } |
|
1014 else |
|
1015 { |
|
1016 iTitlePaneHandler->SetTitlePaneTextL( *iTitle ); |
|
1017 } |
|
1018 } |
|
1019 |
|
1020 |
|
1021 // --------------------------------------------------------- |
|
1022 // CWVSettingsUIDialogImp::ProcessCommandL() |
|
1023 // |
|
1024 // (other items were commented in a header). |
|
1025 // --------------------------------------------------------- |
|
1026 // |
|
1027 void CWVSettingsUIDialogImp::ProcessCommandL( TInt aCommand ) |
|
1028 { |
|
1029 HideMenu(); |
|
1030 |
|
1031 switch ( aCommand ) |
|
1032 { |
|
1033 |
|
1034 |
|
1035 case EWVSettingsViewCmdHelp: |
|
1036 { |
|
1037 HlpLauncher::LaunchHelpApplicationL( CEikonEnv::Static()->WsSession(), |
|
1038 ( CCoeEnv::Static()->AppUi() )->AppHelpContextL () ); |
|
1039 |
|
1040 break; |
|
1041 } |
|
1042 |
|
1043 case EWVSettingsViewCmdExit: |
|
1044 { |
|
1045 TryExitL( EWVSettingsViewCmdExit ); |
|
1046 break; |
|
1047 } |
|
1048 |
|
1049 // Flow-through |
|
1050 case EAknSoftkeyOpen: // MSK command |
|
1051 case EAknSoftkeyEdit: // Flowthrough, MSK command |
|
1052 case EWVSettingsViewServSetChange: |
|
1053 case EWVSettingsViewServSetOpen: |
|
1054 case EWVSettingsViewSettingsEdit: |
|
1055 { |
|
1056 LaunchCorrectDialog(); |
|
1057 break; |
|
1058 } |
|
1059 |
|
1060 default: |
|
1061 { |
|
1062 CEikonEnv::Static()->EikAppUi()->HandleCommandL( aCommand ); |
|
1063 break; |
|
1064 } |
|
1065 } |
|
1066 } |
|
1067 |
|
1068 // --------------------------------------------------------- |
|
1069 // CWVSettingsUIDialogImp::DynInitMenuPaneL() |
|
1070 // |
|
1071 // (other items were commented in a header). |
|
1072 // --------------------------------------------------------- |
|
1073 // |
|
1074 void CWVSettingsUIDialogImp::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
1075 { |
|
1076 |
|
1077 // if we're displaying general menu and help feature is not supported.. |
|
1078 if ( aResourceId == R_WVSETTINGSVIEW_GENERAL_MENU && |
|
1079 !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
1080 { |
|
1081 // dimm the help menu item |
|
1082 aMenuPane->SetItemDimmed( EWVSettingsViewCmdHelp, ETrue ); |
|
1083 } |
|
1084 |
|
1085 if ( aResourceId == R_WVSETTINGSVIEW_SERVSETTINGS_MENUPANE ) |
|
1086 { |
|
1087 TInt index = iListbox->CurrentItemIndex(); |
|
1088 if ( !iCAServerSettings ) |
|
1089 { |
|
1090 // if we don't show CA settings item, we have 1 item less |
|
1091 // in the listbox -> thus +1 to the index |
|
1092 index++; |
|
1093 } |
|
1094 switch ( index ) |
|
1095 { |
|
1096 case EWVSettingsCASettings: |
|
1097 { |
|
1098 aMenuPane->DeleteMenuItem( EWVSettingsViewServSetChange ); |
|
1099 aMenuPane->DeleteMenuItem( EWVSettingsViewSettingsEdit ); |
|
1100 break; |
|
1101 } |
|
1102 case EWVSettingsServers: |
|
1103 { |
|
1104 aMenuPane->DeleteMenuItem( EWVSettingsViewServSetChange ); |
|
1105 aMenuPane->DeleteMenuItem( EWVSettingsViewSettingsEdit ); |
|
1106 break; |
|
1107 } |
|
1108 case EWVSettingsServerInUse: |
|
1109 { |
|
1110 aMenuPane->DeleteMenuItem( EWVSettingsViewServSetOpen ); |
|
1111 aMenuPane->DeleteMenuItem( EWVSettingsViewSettingsEdit ); |
|
1112 break; |
|
1113 } |
|
1114 case EWVSettingsIMLoginType: |
|
1115 case EWVSettingsIMConnDays: |
|
1116 case EWVSettingsIMConnHours: |
|
1117 { |
|
1118 aMenuPane->DeleteMenuItem( EWVSettingsViewServSetOpen ); |
|
1119 aMenuPane->DeleteMenuItem( EWVSettingsViewServSetChange ); |
|
1120 break; |
|
1121 } |
|
1122 #ifdef RD_MULTIPLE_DRIVE |
|
1123 case EWVSettingsSaveChatsTo: |
|
1124 { |
|
1125 aMenuPane->DeleteMenuItem( EWVSettingsViewServSetOpen ); |
|
1126 aMenuPane->DeleteMenuItem( EWVSettingsViewServSetChange ); |
|
1127 break; |
|
1128 } |
|
1129 #endif |
|
1130 default: |
|
1131 { |
|
1132 // Nothing to do if neither indexes were correct |
|
1133 User::Leave ( EIncorrectListBoxItemIndex ); |
|
1134 break; |
|
1135 } |
|
1136 } |
|
1137 } |
|
1138 } |
|
1139 |
|
1140 // --------------------------------------------------------- |
|
1141 // CWVSettingsUIDialogImp::PreLayoutDynInitL() |
|
1142 // |
|
1143 // (other items were commented in a header). |
|
1144 // --------------------------------------------------------- |
|
1145 // |
|
1146 void CWVSettingsUIDialogImp::PreLayoutDynInitL() |
|
1147 { |
|
1148 RefreshTitleL(); |
|
1149 |
|
1150 if ( iSAPSettingsStore ) |
|
1151 { |
|
1152 iSAPSettingsStore->AddObserverL( this, EIMPSIMAccessGroup ); |
|
1153 } |
|
1154 |
|
1155 iSharedData = CIMPSSharedDataFactory::CreatePermanentKeyHandlerL( this, KIMPSServSettUid ); |
|
1156 |
|
1157 iSettingsChangeNotifier = |
|
1158 CIMPSSharedDataFactory::CreateTemporaryKeyHandlerL( this, KIMPSServSettNotifyUid ); |
|
1159 |
|
1160 // check if scheduling is supported |
|
1161 iSchedulingSupported = CWVSettingsUISettingItemCreator::SchedulingSupported(); |
|
1162 if ( iSchedulingSupported ) |
|
1163 { |
|
1164 TLocale* locale = new ( ELeave ) TLocale; |
|
1165 iStartDayOfWeek = locale->StartOfWeek(); |
|
1166 delete locale; |
|
1167 // create an array of selected days for scheduling |
|
1168 |
|
1169 // create an array of selected days. Granularity 7 since there are 7 days in a week |
|
1170 iSelectedDaysIM = new ( ELeave ) CSelectionItemList( 7 ); |
|
1171 CreateSelectedDaysArrayL( *iSelectedDaysIM ); |
|
1172 |
|
1173 iConnDaysIM = HBufC::NewL( KWVSettingsConnDaysTextMaxLength ); |
|
1174 iConnDaysIMPtr.Set( iConnDaysIM->Des() ); |
|
1175 |
|
1176 iConnHoursIM = HBufC::NewL( KWVSettingsConnHoursTextMaxLength ); |
|
1177 iConnHoursIMPtr.Set( iConnHoursIM->Des() ); |
|
1178 iConnHoursIMInt = EWVSettingsBetweenHours; |
|
1179 } |
|
1180 |
|
1181 #ifdef RD_MULTIPLE_DRIVE |
|
1182 |
|
1183 //qtn_chat_setting_chatlogin and wvsettingsview_setting_memory_selection_type |
|
1184 iMemorySelection = HBufC::NewL( KMaxLengthOfDriveInformation ); |
|
1185 |
|
1186 iMemorySelectionPtr.Set( iMemorySelection->Des() ); |
|
1187 |
|
1188 #endif // RD_MULTIPLE_DRIVE |
|
1189 |
|
1190 LoadSettingsL(); //load settings from shared data and presence engine |
|
1191 |
|
1192 iDlgLauncher = new ( ELeave ) CAsyncCallBack( TCallBack( LaunchDlgCallback, this ), |
|
1193 CActive::EPriorityStandard ); |
|
1194 |
|
1195 iServerInUse = HBufC::NewL( KWVSettingsServerNameMaxLength ); |
|
1196 iServerInUsePtr.Set( iServerInUse->Des() ); |
|
1197 |
|
1198 HBufC* name = CurrentServerNameL(); |
|
1199 |
|
1200 if ( name ) |
|
1201 { |
|
1202 iServerInUsePtr.Copy( ( *name ).Left( iServerInUsePtr.MaxLength() ) ); |
|
1203 delete name; |
|
1204 } |
|
1205 else |
|
1206 { |
|
1207 iServerInUsePtr.Copy( KEmptyDesC ); |
|
1208 } |
|
1209 |
|
1210 User::LeaveIfError( |
|
1211 iSharedData->SubscribeChange( KIMPSServSettUid, EIMPSSharedKeysIMLogin ) ); |
|
1212 if ( iSchedulingSupported ) |
|
1213 { |
|
1214 User::LeaveIfError( |
|
1215 iSharedData->SubscribeChange( KIMPSServSettUid, EIMPSSharedKeysIMConnDays ) ); |
|
1216 User::LeaveIfError( |
|
1217 iSharedData->SubscribeChange( KIMPSServSettUid, EIMPSSharedKeysIMConnStart ) ); |
|
1218 User::LeaveIfError( |
|
1219 iSharedData->SubscribeChange( KIMPSServSettUid, EIMPSSharedKeysIMConnEnd ) ); |
|
1220 } |
|
1221 |
|
1222 iListbox = |
|
1223 static_cast< CAknSettingStyleListBox* >( Control( EWVSettingsViewControlIdServSettings ) ); |
|
1224 |
|
1225 TBool caSettings( EFalse ); |
|
1226 if ( iCAServerSettings ) |
|
1227 { |
|
1228 caSettings = ETrue; |
|
1229 } |
|
1230 iSettingItemArray = |
|
1231 CWVSettingsUISettingItemCreator::CreateSettingItemListL( |
|
1232 caSettings, |
|
1233 iServerInUsePtr, |
|
1234 iImLoginType, |
|
1235 #ifdef RD_MULTIPLE_DRIVE |
|
1236 iMemorySelectionPtr, |
|
1237 #endif |
|
1238 iConnDaysIMPtr, |
|
1239 iConnHoursIMPtr ); |
|
1240 |
|
1241 CTextListBoxModel* model = iListbox->Model(); |
|
1242 model->SetItemTextArray( iSettingItemArray ); |
|
1243 model->SetOwnershipType( ELbmDoesNotOwnItemArray ); // Ownership retained by us |
|
1244 |
|
1245 iSettingItemArray->RecalculateVisibleIndicesL(); |
|
1246 iListbox->CreateScrollBarFrameL( ETrue ); |
|
1247 iListbox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
1248 CEikScrollBarFrame::EOff, |
|
1249 CEikScrollBarFrame::EAuto ); |
|
1250 iListbox->HandleItemAdditionL(); |
|
1251 iListbox->UpdateScrollBarsL(); |
|
1252 iListbox->SetListBoxObserver( this ); |
|
1253 |
|
1254 if ( iForcedLaunch ) |
|
1255 { |
|
1256 // Set index to login type item |
|
1257 TInt index = EWVSettingsIMLoginType; |
|
1258 if ( !iCAServerSettings ) |
|
1259 { |
|
1260 // if CA setting item is not present, |
|
1261 // index needs to be decremented by one |
|
1262 index--; |
|
1263 } |
|
1264 iListbox->SetCurrentItemIndex( index ); |
|
1265 } |
|
1266 UpdateCbaL(); |
|
1267 } |
|
1268 |
|
1269 // --------------------------------------------------------- |
|
1270 // CWVSettingsUIDialogImp::CreateSelectedDaysArrayL( CSelectionItemList& aSelectionItemList ) |
|
1271 // |
|
1272 // (other items were commented in a header). |
|
1273 // --------------------------------------------------------- |
|
1274 // |
|
1275 void CWVSettingsUIDialogImp::CreateSelectedDaysArrayL( CSelectionItemList& aSelectionItemList ) |
|
1276 { |
|
1277 // create a selectable item for each week day and append it into the array |
|
1278 CSelectableItem* selectableItem = NULL; |
|
1279 |
|
1280 if ( iStartDayOfWeek == ESunday ) |
|
1281 { |
|
1282 selectableItem = CreateSelectableItemLC( R_QTN_WEEK_LONG_SUNDAY ); |
|
1283 ( &aSelectionItemList )->AppendL( selectableItem ); |
|
1284 CleanupStack::Pop( selectableItem ); |
|
1285 } |
|
1286 |
|
1287 selectableItem = CreateSelectableItemLC( R_QTN_WEEK_LONG_MONDAY ); |
|
1288 ( &aSelectionItemList )->AppendL( selectableItem ); |
|
1289 CleanupStack::Pop( selectableItem ); |
|
1290 |
|
1291 selectableItem = CreateSelectableItemLC( R_QTN_WEEK_LONG_TUESDAY ); |
|
1292 ( &aSelectionItemList )->AppendL( selectableItem ); |
|
1293 CleanupStack::Pop( selectableItem ); |
|
1294 |
|
1295 selectableItem = CreateSelectableItemLC( R_QTN_WEEK_LONG_WEDNESDAY ); |
|
1296 ( &aSelectionItemList )->AppendL( selectableItem ); |
|
1297 CleanupStack::Pop( selectableItem ); |
|
1298 |
|
1299 selectableItem = CreateSelectableItemLC( R_QTN_WEEK_LONG_THURSDAY ); |
|
1300 ( &aSelectionItemList )->AppendL( selectableItem ); |
|
1301 CleanupStack::Pop( selectableItem ); |
|
1302 |
|
1303 selectableItem = CreateSelectableItemLC( R_QTN_WEEK_LONG_FRIDAY ); |
|
1304 ( &aSelectionItemList )->AppendL( selectableItem ); |
|
1305 CleanupStack::Pop( selectableItem ); |
|
1306 |
|
1307 selectableItem = CreateSelectableItemLC( R_QTN_WEEK_LONG_SATURDAY ); |
|
1308 ( &aSelectionItemList )->AppendL( selectableItem ); |
|
1309 CleanupStack::Pop( selectableItem ); |
|
1310 |
|
1311 if ( iStartDayOfWeek != ESunday ) |
|
1312 { |
|
1313 selectableItem = CreateSelectableItemLC( R_QTN_WEEK_LONG_SUNDAY ); |
|
1314 ( &aSelectionItemList )->AppendL( selectableItem ); |
|
1315 CleanupStack::Pop( selectableItem ); |
|
1316 } |
|
1317 |
|
1318 } |
|
1319 |
|
1320 // --------------------------------------------------------- |
|
1321 // CWVSettingsUIDialogImp::CreateSelectableItemLC() |
|
1322 // |
|
1323 // (other items were commented in a header). |
|
1324 // --------------------------------------------------------- |
|
1325 CSelectableItem* CWVSettingsUIDialogImp::CreateSelectableItemLC( TInt aResourceId ) |
|
1326 { |
|
1327 // get the text for the item |
|
1328 HBufC* text = CEikonEnv::Static()->AllocReadResourceLC( aResourceId ); |
|
1329 |
|
1330 // create a selectable item, which is selected by default |
|
1331 CSelectableItem* selectableItem = new( ELeave ) CSelectableItem( *text, ETrue ); |
|
1332 CleanupStack::PushL( selectableItem ); |
|
1333 selectableItem->ConstructL(); |
|
1334 // pop the selectable item, so that we can destory text |
|
1335 CleanupStack::Pop( selectableItem ); |
|
1336 CleanupStack::PopAndDestroy( text ); |
|
1337 |
|
1338 // push selectableItem back into the cleanup stack |
|
1339 CleanupStack::PushL( selectableItem ); |
|
1340 |
|
1341 return selectableItem; |
|
1342 } |
|
1343 |
|
1344 // --------------------------------------------------------- |
|
1345 // CWVSettingsUIDialogImp::CurrentServerNameL() |
|
1346 // |
|
1347 // (other items were commented in a header). |
|
1348 // --------------------------------------------------------- |
|
1349 // |
|
1350 HBufC* CWVSettingsUIDialogImp::CurrentServerNameL() |
|
1351 { |
|
1352 HBufC* serverName = NULL; |
|
1353 |
|
1354 CIMPSSAPSettings* sapSettings = CIMPSSAPSettings::NewLC(); |
|
1355 TRAPD( err, iSAPSettingsStore->GetDefaultL( sapSettings, EIMPSIMAccessGroup ) ); |
|
1356 |
|
1357 if ( err == KErrNone ) |
|
1358 { |
|
1359 // Code scanner warning neglected to put variable on cleanup stack (Id: 35) |
|
1360 // There is no possibility to leave in this method after this line |
|
1361 serverName = sapSettings->SAPName().AllocL(); // CSI: 35 # See above |
|
1362 } |
|
1363 else if ( err == KErrNotFound ) |
|
1364 { |
|
1365 // we don't want to leave if there is no default sap |
|
1366 } |
|
1367 else |
|
1368 { |
|
1369 User::Leave( err ); |
|
1370 } |
|
1371 |
|
1372 CleanupStack::PopAndDestroy( sapSettings ); |
|
1373 |
|
1374 return serverName; |
|
1375 } |
|
1376 |
|
1377 // --------------------------------------------------------- |
|
1378 // CWVSettingsUIDialogImp::RefreshDialogL() |
|
1379 // |
|
1380 // (other items were commented in a header). |
|
1381 // --------------------------------------------------------- |
|
1382 // |
|
1383 void CWVSettingsUIDialogImp::RefreshDialogL() |
|
1384 { |
|
1385 // refresh title |
|
1386 RefreshTitleL(); |
|
1387 |
|
1388 TBool caSettings( EFalse ); |
|
1389 if ( iCAServerSettings ) |
|
1390 { |
|
1391 caSettings = ETrue; |
|
1392 } |
|
1393 |
|
1394 |
|
1395 TBuf<KMaxLengthOfDriveInformation> drive( KWVSettingsDefaultMemoryDrive ); |
|
1396 |
|
1397 if ( iMemorySelectionPtr.Find( drive.Left( 2 ) ) != KErrNotFound ) |
|
1398 { |
|
1399 HBufC* phoneMemoryInfo = StringLoader::LoadLC( R_QTN_CHAT_SETTINGS_PHONE_MEMORY, |
|
1400 iMemorySelectionPtr.Left( 2 ) ); |
|
1401 iMemorySelectionPtr.Copy( phoneMemoryInfo->Des() ); |
|
1402 CleanupStack::PopAndDestroy( phoneMemoryInfo ); |
|
1403 } |
|
1404 |
|
1405 // create a new setting item list |
|
1406 CAknSettingItemArray* tempSettingItemList = |
|
1407 CWVSettingsUISettingItemCreator::CreateSettingItemListL( |
|
1408 caSettings, |
|
1409 iServerInUsePtr, |
|
1410 iImLoginType, |
|
1411 #ifdef RD_MULTIPLE_DRIVE |
|
1412 iMemorySelectionPtr, |
|
1413 #endif |
|
1414 iConnDaysIMPtr, |
|
1415 iConnHoursIMPtr ); |
|
1416 |
|
1417 // delete the setting item array |
|
1418 if ( iSettingItemArray ) |
|
1419 { |
|
1420 iSettingItemArray->ResetAndDestroy(); |
|
1421 } |
|
1422 delete iSettingItemArray; |
|
1423 iSettingItemArray = tempSettingItemList; |
|
1424 |
|
1425 CTextListBoxModel* model = iListbox->Model(); |
|
1426 |
|
1427 model->SetItemTextArray( iSettingItemArray ); |
|
1428 model->SetOwnershipType( ELbmDoesNotOwnItemArray ); // Ownership retained by us |
|
1429 |
|
1430 iSettingItemArray->RecalculateVisibleIndicesL(); |
|
1431 iListbox->CreateScrollBarFrameL( ETrue ); |
|
1432 iListbox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
1433 CEikScrollBarFrame::EOff, |
|
1434 CEikScrollBarFrame::EAuto ); |
|
1435 iListbox->HandleItemAdditionL(); |
|
1436 iListbox->UpdateScrollBarsL(); |
|
1437 } |
|
1438 |
|
1439 // --------------------------------------------------------- |
|
1440 // CWVSettingsUIDialogImp::OfferKeyEventL() |
|
1441 // |
|
1442 // (other items were commented in a header). |
|
1443 // --------------------------------------------------------- |
|
1444 // |
|
1445 TKeyResponse CWVSettingsUIDialogImp::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
1446 { |
|
1447 |
|
1448 if ( aType == EEventKey && |
|
1449 ( aKeyEvent.iCode == EKeyEnter || aKeyEvent.iCode == EKeyOK ) ) |
|
1450 { |
|
1451 LaunchCorrectDialog(); |
|
1452 return EKeyWasConsumed; |
|
1453 } |
|
1454 |
|
1455 else if ( aKeyEvent.iCode == EKeyEscape ) |
|
1456 { |
|
1457 TryExitL( EAknSoftkeyExit ); |
|
1458 return EKeyWasConsumed; |
|
1459 } |
|
1460 |
|
1461 |
|
1462 else if ( aKeyEvent.iCode == EKeyPhoneSend ) |
|
1463 { |
|
1464 return EKeyWasConsumed; |
|
1465 } |
|
1466 |
|
1467 TKeyResponse res = iListbox->OfferKeyEventL( aKeyEvent, aType ); |
|
1468 if ( res == EKeyWasConsumed ) |
|
1469 { |
|
1470 UpdateCbaL(); |
|
1471 } |
|
1472 |
|
1473 return res; |
|
1474 } |
|
1475 |
|
1476 // --------------------------------------------------------- |
|
1477 // CWVSettingsUIDialogImp::CopySelectedDaysArrayL() |
|
1478 // |
|
1479 // (other items were commented in a header). |
|
1480 // --------------------------------------------------------- |
|
1481 // |
|
1482 CSelectionItemList* CWVSettingsUIDialogImp::CopySelectedDaysArrayL( |
|
1483 CSelectionItemList* aSelectedDaysArray ) |
|
1484 { |
|
1485 CSelectionItemList* newSelectedDaysArray = new ( ELeave ) CSelectionItemList( 7 ); |
|
1486 CleanupStack::PushL( newSelectedDaysArray ); |
|
1487 CreateSelectedDaysArrayL( *newSelectedDaysArray ); |
|
1488 CleanupStack::Pop( newSelectedDaysArray ); |
|
1489 |
|
1490 TInt count = aSelectedDaysArray->Count(); |
|
1491 for ( TInt index( 0 ); index < count; index++ ) |
|
1492 { |
|
1493 newSelectedDaysArray->At( index )->SetSelectionStatus( |
|
1494 aSelectedDaysArray->At( index )->SelectionStatus() ); |
|
1495 } |
|
1496 |
|
1497 return newSelectedDaysArray; |
|
1498 } |
|
1499 |
|
1500 // --------------------------------------------------------- |
|
1501 // CWVSettingsUIDialogImp::LaunchCorrectDialogL() |
|
1502 // |
|
1503 // (other items were commented in a header). |
|
1504 // --------------------------------------------------------- |
|
1505 // |
|
1506 void CWVSettingsUIDialogImp::LaunchCorrectDialogL() |
|
1507 { |
|
1508 |
|
1509 // check if we have servers |
|
1510 if ( !CheckAnyStoredServers() ) |
|
1511 return; |
|
1512 |
|
1513 |
|
1514 TInt index = iListbox->CurrentItemIndex(); |
|
1515 if ( !iCAServerSettings ) |
|
1516 { |
|
1517 // if we don't show CA settings item, we have 1 item less |
|
1518 // in the listbox -> thus +1 to the index |
|
1519 index++; |
|
1520 } |
|
1521 switch ( index ) |
|
1522 { |
|
1523 case EWVSettingsCASettings: |
|
1524 { |
|
1525 LaunchCASettingsL(); |
|
1526 break; |
|
1527 } |
|
1528 case EWVSettingsServers: // edit server |
|
1529 { |
|
1530 TWVSettingsDialogReturnValue returnValue = ExecuteServerListDialogL(); |
|
1531 if ( returnValue == EWVSettingsViewExitCalled ) |
|
1532 { |
|
1533 TryExitL( EWVSettingsViewCmdExit ); |
|
1534 } |
|
1535 else if ( returnValue != EWVSettingsViewForceExit ) |
|
1536 { |
|
1537 DrawNow(); |
|
1538 } |
|
1539 else |
|
1540 { |
|
1541 TryExitL( EAknSoftkeyCancel ); |
|
1542 } |
|
1543 break; |
|
1544 } |
|
1545 case EWVSettingsServerInUse: // select server |
|
1546 { |
|
1547 |
|
1548 TBool loggedIn( iConnectionUI->LoggedInL( EIMPSConnClientIM ) ); |
|
1549 |
|
1550 HBufC* buffer = NULL; |
|
1551 TIMPSConnectionOperation connOperation ( iConnectionUI->CurrentConnectionOperationL( buffer ) ); |
|
1552 CleanupStack::PushL( buffer ); |
|
1553 |
|
1554 if ( loggedIn ) |
|
1555 { |
|
1556 // connection active, we cannot edit this setting |
|
1557 // ask confirmation about logging out |
|
1558 CAknQueryDialog* dlg = new ( ELeave ) CAknQueryDialog( CAknQueryDialog::ENoTone ); |
|
1559 CleanupStack::PushL( dlg ); |
|
1560 // Set prompt |
|
1561 HBufC* text = CEikonEnv::Static()->AllocReadResourceLC( |
|
1562 R_WVSETTINGSVIEW_ERROR_ID_ACTIVE_CONNECTION ); |
|
1563 dlg->SetPromptL( *text ); |
|
1564 CleanupStack::PopAndDestroy( text ); |
|
1565 CleanupStack::Pop( dlg ); |
|
1566 TInt ret( dlg->ExecuteLD( R_ACTIVE_CONNECTION_CONFIRMATION_QUERY ) ); |
|
1567 |
|
1568 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
1569 { |
|
1570 // user confirmed logout -> logout all open connections |
|
1571 CPEngNWSessionSlotID2* sessionSlotID = |
|
1572 iConnectionUI->GetActiveNWSessionSlotIDL( EIMPSConnClientIM ); |
|
1573 |
|
1574 CleanupStack::PushL( sessionSlotID ); |
|
1575 User::LeaveIfError( iConnectionUI->LogoutL( *sessionSlotID ) ); |
|
1576 CleanupStack::PopAndDestroy( sessionSlotID ); |
|
1577 iForcedLoginMade = EFalse; |
|
1578 |
|
1579 CWVSettingsUIServerSelector::ExecuteSelectionQueryLD( *iSAPSettingsStore, *this ); |
|
1580 UpdateServerInUseItemL(); |
|
1581 } |
|
1582 } |
|
1583 else if ( connOperation == EIMPSConnOppClientLogin ) |
|
1584 { |
|
1585 // a login operation is ongoing, we cannot let the user edit the settings |
|
1586 HBufC* prompt = StringLoader::LoadLC( R_QTN_CHAT_LOGIN_ONGOING_NOTE, *buffer, iCoeEnv ); |
|
1587 CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue ); |
|
1588 dlg->ExecuteLD( *prompt ); |
|
1589 CleanupStack::PopAndDestroy( prompt ); |
|
1590 } |
|
1591 else |
|
1592 { |
|
1593 // there is no active connection, we can edit the setting |
|
1594 CWVSettingsUIServerSelector::ExecuteSelectionQueryLD( *iSAPSettingsStore, *this ); |
|
1595 UpdateServerInUseItemL(); |
|
1596 } |
|
1597 CleanupStack::PopAndDestroy( buffer ); |
|
1598 break; |
|
1599 } |
|
1600 case EWVSettingsIMLoginType: // IM settings |
|
1601 { |
|
1602 // handle editing |
|
1603 iSettingItemArray->At( index )->EditItemL( ETrue ); |
|
1604 iListbox->DrawItem( index ); |
|
1605 DrawNow(); |
|
1606 break; |
|
1607 } |
|
1608 #ifdef RD_MULTIPLE_DRIVE |
|
1609 case EWVSettingsSaveChatsTo: // select server |
|
1610 { |
|
1611 // launch memory selection drive dialog box... |
|
1612 |
|
1613 // prompt the user to save into a different drive....... |
|
1614 |
|
1615 CAknMemorySelectionDialogMultiDrive* dlg = CAknMemorySelectionDialogMultiDrive::NewL( |
|
1616 ECFDDialogTypeSave, |
|
1617 0 ,//default resource id |
|
1618 EFalse, |
|
1619 AknCommonDialogsDynMem::EMemoryTypePhone | |
|
1620 AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage | |
|
1621 AknCommonDialogsDynMem::EMemoryTypeMMCExternal ); |
|
1622 |
|
1623 |
|
1624 |
|
1625 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1626 |
|
1627 // Read texts from resources |
|
1628 HBufC* lskTextOk = coeEnv->AllocReadResourceLC( R_QTN_CHAT_MULTIDRIVE_OK ); |
|
1629 |
|
1630 dlg->SetLeftSoftkeyL( *lskTextOk ); |
|
1631 |
|
1632 CleanupStack::PopAndDestroy( lskTextOk ); |
|
1633 |
|
1634 |
|
1635 |
|
1636 TInt driveNo = 0; |
|
1637 TInt err = RFs::CharToDrive( iMemorySelectionPtr[0], driveNo );//converting drive letter to drive No. |
|
1638 TDriveNumber driveNumber = TDriveNumber( driveNo ); |
|
1639 |
|
1640 CleanupStack::PushL( dlg ); |
|
1641 |
|
1642 TBool ret( dlg->ExecuteL( driveNumber, NULL, NULL ) ); |
|
1643 |
|
1644 if ( ret ) |
|
1645 { |
|
1646 TInt memoryIndex = dlg->FindIndexByDrive( driveNumber );//getting memory index corresponding to drive No. from dialog. |
|
1647 |
|
1648 if ( memoryIndex >= 0 )//if drive not found, we get index -1 and GetItem throws exception. |
|
1649 { |
|
1650 dlg->GetItem( memoryIndex, iMemorySelectionPtr );//collecting drive name in iMemorySelectionPtr. |
|
1651 } |
|
1652 |
|
1653 RefreshDialogL(); |
|
1654 |
|
1655 |
|
1656 // update selecte memory drive here... |
|
1657 #ifdef RD_MULTIPLE_DRIVE |
|
1658 User::LeaveIfError( iSharedData->SetStringKey( EIMPSSharedKeysMemoryDrive, iMemorySelectionPtr ) ); |
|
1659 #endif |
|
1660 } |
|
1661 |
|
1662 CleanupStack::PopAndDestroy( dlg ); |
|
1663 |
|
1664 break; |
|
1665 } |
|
1666 #endif |
|
1667 default: |
|
1668 { |
|
1669 // Nothing to do if neither indexes were correct |
|
1670 User::Leave( EIncorrectListBoxItemIndex ); |
|
1671 break; |
|
1672 } |
|
1673 } |
|
1674 } |
|
1675 |
|
1676 |
|
1677 // --------------------------------------------------------- |
|
1678 // CWVSettingsUIDialogImp::HandlePermanentKeyNotifyL() |
|
1679 // |
|
1680 // (other items were commented in a header). |
|
1681 // --------------------------------------------------------- |
|
1682 // |
|
1683 void CWVSettingsUIDialogImp::HandlePermanentKeyNotifyL( const TUid aUid, |
|
1684 const TIMPSSharedKeys aKey ) |
|
1685 { |
|
1686 if ( ( aUid == KIMPSServSettUid ) && |
|
1687 ( aKey == EIMPSSharedKeysIMLogin ) ) |
|
1688 { |
|
1689 UpdateLoginTypesL(); |
|
1690 } |
|
1691 |
|
1692 else if ( aUid == KIMPSServSettUid && |
|
1693 ( aKey == EIMPSSharedKeysIMConnStart ) ) |
|
1694 { |
|
1695 LoadConnectionHoursSettingValuesL(); |
|
1696 } |
|
1697 #ifdef RD_MULTIPLE_DRIVE |
|
1698 else if ( aUid == KIMPSServSettUid && |
|
1699 ( aKey == EIMPSSharedKeysMemoryDrive ) ) |
|
1700 { |
|
1701 LoadMemoryDriveSettingValueL(); |
|
1702 } |
|
1703 #endif |
|
1704 else if ( aUid == KIMPSServSettUid && |
|
1705 ( aKey == EIMPSSharedKeysIMConnDays ) ) |
|
1706 { |
|
1707 TInt loadedValue( KWVSettingsConnDaysAllSelected ); |
|
1708 LoadSettingValueL( loadedValue, EIMPSSharedKeysIMConnDays ); |
|
1709 SetConnectionDaysL( loadedValue, *iSelectedDaysIM ); |
|
1710 UpdateConnectionDaysL( *iSelectedDaysIM ); |
|
1711 } |
|
1712 UpdateListboxL(); |
|
1713 |
|
1714 } |
|
1715 |
|
1716 // --------------------------------------------------------- |
|
1717 // CWVSettingsUIDialogImp::HandleTemporaryKeyNotifyL() |
|
1718 // |
|
1719 // (other items were commented in a header). |
|
1720 // --------------------------------------------------------- |
|
1721 // |
|
1722 void CWVSettingsUIDialogImp::HandleTemporaryKeyNotifyL( const TUid /* aUid */, |
|
1723 const TIMPSSharedKeys /* aKey */ ) |
|
1724 { |
|
1725 |
|
1726 } |
|
1727 |
|
1728 // --------------------------------------------------------- |
|
1729 // CWVSettingsUIDialogImp::LoadSettingsL() |
|
1730 // |
|
1731 // (other items were commented in a header). |
|
1732 // --------------------------------------------------------- |
|
1733 // |
|
1734 void CWVSettingsUIDialogImp::LoadSettingsL() |
|
1735 { |
|
1736 // load the pec and chat login values |
|
1737 // we don't need the return value here, since |
|
1738 |
|
1739 // set this to max integer so we know that we get some data |
|
1740 TInt loadedValue ( KMaxTInt ); |
|
1741 |
|
1742 LoadSettingValueL( loadedValue, EIMPSSharedKeysIMLogin ); |
|
1743 SetIMLoginTypeL( loadedValue ); |
|
1744 |
|
1745 if ( iSchedulingSupported ) |
|
1746 { |
|
1747 // load the connection days setting value |
|
1748 loadedValue = KWVSettingsConnDaysAllSelected; |
|
1749 LoadSettingValueL( loadedValue, EIMPSSharedKeysIMConnDays ); |
|
1750 SetConnectionDaysL( loadedValue, *iSelectedDaysIM ); |
|
1751 |
|
1752 LoadConnectionHoursSettingValuesL(); |
|
1753 } |
|
1754 #ifdef RD_MULTIPLE_DRIVE |
|
1755 LoadMemoryDriveSettingValueL(); |
|
1756 #endif |
|
1757 } |
|
1758 |
|
1759 #ifdef RD_MULTIPLE_DRIVE |
|
1760 |
|
1761 // --------------------------------------------------------- |
|
1762 // CWVSettingsUIDialogImp::LoadMemoryDriveSettingValueL() |
|
1763 // |
|
1764 // (other items were commented in a header). |
|
1765 // --------------------------------------------------------- |
|
1766 // |
|
1767 void CWVSettingsUIDialogImp::LoadMemoryDriveSettingValueL() |
|
1768 { |
|
1769 TInt err( iSharedData->GetStringKey( EIMPSSharedKeysMemoryDrive, iMemorySelectionPtr ) ); |
|
1770 |
|
1771 TInt driveNo = 0; |
|
1772 RFs::CharToDrive(iMemorySelectionPtr[0], driveNo );//converting drive letter to drive No. |
|
1773 TDriveNumber driveNumber = TDriveNumber(driveNo); |
|
1774 RFs iFs; |
|
1775 User::LeaveIfError( iFs.Connect() ); |
|
1776 if ( (err == KErrNotFound ) || ( err == KErrTooBig ) || (!iFs.IsValidDrive(driveNumber))) |
|
1777 { |
|
1778 iMemorySelectionPtr.Copy( KWVSettingsDefaultMemoryDrive ); |
|
1779 } |
|
1780 else |
|
1781 { |
|
1782 User::LeaveIfError( err ); |
|
1783 TUint driveStatus( 0 ); |
|
1784 TBool massStorage = EFalse; |
|
1785 User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, driveNumber, driveStatus ) ); |
|
1786 if ( ( driveStatus & DriveInfo::EDriveInternal ) && |
|
1787 ( driveStatus & DriveInfo::EDriveExternallyMountable ) ) |
|
1788 { |
|
1789 massStorage = ETrue; |
|
1790 } |
|
1791 if ( !massStorage ) |
|
1792 { |
|
1793 TVolumeInfo volInfo; |
|
1794 TInt ret( iFs.Volume( volInfo, driveNumber ) ); |
|
1795 if ( ret == KErrNone ) |
|
1796 { |
|
1797 int length = iMemorySelectionPtr.Length() - 3; // The lengthe of drive name and space is 3. |
|
1798 if ( iMemorySelectionPtr.Mid(3, length).Compare(volInfo.iName) ) // Check that if the labels area the same. |
|
1799 { |
|
1800 iMemorySelectionPtr.Replace(3, length, volInfo.iName); |
|
1801 User::LeaveIfError( iSharedData->SetStringKey( EIMPSSharedKeysMemoryDrive, iMemorySelectionPtr ) ); |
|
1802 } |
|
1803 } |
|
1804 } |
|
1805 } |
|
1806 iFs.Close(); |
|
1807 TBuf<KMaxLengthOfDriveInformation> drive( KWVSettingsDefaultMemoryDrive ); |
|
1808 |
|
1809 if ( iMemorySelectionPtr.Find( drive.Left( 2 ) ) != KErrNotFound ) |
|
1810 { |
|
1811 HBufC* phoneMemoryInfo = StringLoader::LoadLC( R_QTN_CHAT_SETTINGS_PHONE_MEMORY, |
|
1812 iMemorySelectionPtr.Left( 2 ) ); |
|
1813 iMemorySelectionPtr.Copy( phoneMemoryInfo->Des() ); |
|
1814 CleanupStack::PopAndDestroy( phoneMemoryInfo ); |
|
1815 } |
|
1816 |
|
1817 } |
|
1818 #endif |
|
1819 |
|
1820 // --------------------------------------------------------- |
|
1821 // CWVSettingsUIDialogImp::LoadSettingValueL() |
|
1822 // |
|
1823 // (other items were commented in a header). |
|
1824 // --------------------------------------------------------- |
|
1825 // |
|
1826 void CWVSettingsUIDialogImp::LoadSettingValueL( TInt& aSettingValueToLoad, |
|
1827 const TIMPSSharedKeys aNameKey ) |
|
1828 { |
|
1829 TInt readValue ( 0 ); |
|
1830 |
|
1831 TInt err( iSharedData->GetIntKey( aNameKey, readValue ) ); |
|
1832 // if one of these errors occur, the value passed is not changed |
|
1833 // so we can just return |
|
1834 if ( ( err == KErrNotFound ) || |
|
1835 ( err == KErrGeneral ) || |
|
1836 ( err == KErrOverflow ) ) |
|
1837 { |
|
1838 //load failed, let value be as it was |
|
1839 return; |
|
1840 } |
|
1841 |
|
1842 //Handle other shared data reading erros by leaving |
|
1843 User::LeaveIfError( err ); |
|
1844 |
|
1845 aSettingValueToLoad = readValue; |
|
1846 } |
|
1847 |
|
1848 // --------------------------------------------------------- |
|
1849 // CWVSettingsUIDialogImp::LoadConnectionHoursSettingValuesL) |
|
1850 // |
|
1851 // (other items were commented in a header). |
|
1852 // --------------------------------------------------------- |
|
1853 // |
|
1854 void CWVSettingsUIDialogImp::LoadConnectionHoursSettingValuesL() |
|
1855 { |
|
1856 // get and format the time/date string |
|
1857 HBufC* tFormat = CCoeEnv::Static()->AllocReadResourceLC( |
|
1858 R_QTN_TIME_USUAL_WITH_ZERO ); |
|
1859 // IM scheduling settings |
|
1860 HBufC* tempBuf = LoadStringSettingValueL ( EIMPSSharedKeysIMConnStart, EWVSettingsConnStart ); |
|
1861 delete iConnStartIM; |
|
1862 iConnStartIM = tempBuf; |
|
1863 iConnStartIMPtr.Set( iConnStartIM->Des() ); |
|
1864 |
|
1865 tempBuf = LoadStringSettingValueL ( EIMPSSharedKeysIMConnEnd, EWVSettingsConnEnd ); |
|
1866 delete iConnEndIM; |
|
1867 iConnEndIM = tempBuf; |
|
1868 iConnEndIMPtr.Set( iConnEndIM->Des() ); |
|
1869 |
|
1870 // get the start time for IM |
|
1871 // read the hour part of the time |
|
1872 iConnStartHourIM = Hour( iConnStartIMPtr, KDefaultStartHour ); |
|
1873 TDateTime dateTime; |
|
1874 dateTime.SetHour( iConnStartHourIM ); |
|
1875 // read the minute part of the time |
|
1876 iConnStartMinuteIM = Minute( iConnStartIMPtr, KDefaultMinute ); |
|
1877 dateTime.SetMinute( iConnStartMinuteIM ); |
|
1878 // set the start time |
|
1879 TTime startTime = dateTime; |
|
1880 |
|
1881 // get the end time for IM |
|
1882 // read the hour part |
|
1883 iConnEndHourIM = Hour( iConnEndIMPtr, KDefaultEndHour ); |
|
1884 dateTime.SetHour( iConnEndHourIM ); |
|
1885 // read the minute part |
|
1886 iConnEndMinuteIM = Minute( iConnEndIMPtr, KDefaultMinute ); |
|
1887 dateTime.SetMinute( iConnEndMinuteIM ); |
|
1888 // set the end time |
|
1889 TTime endTime = dateTime; |
|
1890 |
|
1891 // user entered text |
|
1892 startTime.FormatL( iConnStartIMPtr, *tFormat ); |
|
1893 endTime.FormatL( iConnEndIMPtr, *tFormat ); |
|
1894 |
|
1895 CleanupStack::PopAndDestroy( tFormat ); |
|
1896 |
|
1897 // update IM connection hours text in the listbox |
|
1898 if ( iConnStartIM && iConnEndIM ) |
|
1899 { |
|
1900 if ( ( iConnHoursIMInt == EWVSettingsAllDay ) || |
|
1901 ( !iConnStartIM->Compare( iConnEndIM->Des() ) ) ) |
|
1902 { |
|
1903 UpdateConnectionHoursTextL( ETrue ); |
|
1904 } |
|
1905 else |
|
1906 { |
|
1907 UpdateConnectionHoursTextL( EFalse ); |
|
1908 } |
|
1909 } |
|
1910 } |
|
1911 |
|
1912 // --------------------------------------------------------- |
|
1913 // CWVSettingsUIDialogImp::Hour() |
|
1914 // |
|
1915 // (other items were commented in a header). |
|
1916 // --------------------------------------------------------- |
|
1917 // |
|
1918 TInt CWVSettingsUIDialogImp::Hour( const TDesC& aTime, TInt aDefault ) |
|
1919 { |
|
1920 TPtrC hourPtr = aTime.Left( KTimeValueLength ); |
|
1921 |
|
1922 TLex lex( hourPtr ); |
|
1923 TInt hourInt ( aDefault ); |
|
1924 // we can ignore the error, if it fails we set the default |
|
1925 lex.Val( hourInt ); |
|
1926 return hourInt; |
|
1927 } |
|
1928 |
|
1929 // --------------------------------------------------------- |
|
1930 // CWVSettingsUIDialogImp::Minute() |
|
1931 // |
|
1932 // (other items were commented in a header). |
|
1933 // --------------------------------------------------------- |
|
1934 TInt CWVSettingsUIDialogImp::Minute( const TDesC& aTime, TInt aDefault ) |
|
1935 { |
|
1936 TPtrC minPtr = aTime.Right( KTimeValueLength ); |
|
1937 TLex lex( minPtr ); |
|
1938 TInt minuteInt ( aDefault ); |
|
1939 // we can ignore the error, if it fails we set the default |
|
1940 lex.Val( minuteInt ); |
|
1941 return minuteInt; |
|
1942 } |
|
1943 |
|
1944 // --------------------------------------------------------- |
|
1945 // CWVSettingsUIDialogImp::LoadStringSettingValueL() |
|
1946 // |
|
1947 // (other items were commented in a header). |
|
1948 // --------------------------------------------------------- |
|
1949 // |
|
1950 HBufC* CWVSettingsUIDialogImp::LoadStringSettingValueL( |
|
1951 const TIMPSSharedKeys aNameKey, |
|
1952 TConnHoursSetting aSetting ) |
|
1953 { |
|
1954 HBufC* buffer = HBufC::NewLC( KWVSettingsConnHoursTextMaxLength ); |
|
1955 |
|
1956 TPtr bufferPtr ( buffer->Des() ); |
|
1957 |
|
1958 TInt err( iSharedData->GetStringKey( aNameKey, bufferPtr ) ); |
|
1959 |
|
1960 // if one of these errors occur, the value passed is not changed |
|
1961 // so we can just return |
|
1962 if ( ( err == KErrNotFound ) || |
|
1963 ( err == KErrTooBig ) ) |
|
1964 { |
|
1965 // put the default time in the buffer |
|
1966 if ( aSetting == EWVSettingsConnStart ) |
|
1967 { |
|
1968 bufferPtr.Copy( KWVSettingsDefaultConnStart ); |
|
1969 } |
|
1970 else |
|
1971 { |
|
1972 bufferPtr.Copy( KWVSettingsDefaultConnEnd ); |
|
1973 } |
|
1974 //load failed, let value be as it was |
|
1975 CleanupStack::Pop( buffer ); |
|
1976 return buffer; |
|
1977 } |
|
1978 |
|
1979 //Handle other shared data reading erros by leaving |
|
1980 User::LeaveIfError( err ); |
|
1981 |
|
1982 CleanupStack::Pop( buffer ); |
|
1983 return buffer; |
|
1984 } |
|
1985 |
|
1986 // --------------------------------------------------------- |
|
1987 // CWVSettingsUIDialogImp::OkToExitL() |
|
1988 // |
|
1989 // (other items were commented in a header). |
|
1990 // --------------------------------------------------------- |
|
1991 // |
|
1992 TBool CWVSettingsUIDialogImp::OkToExitL( TInt aKeycode ) |
|
1993 { |
|
1994 if ( iIsOpenedTargettDlg ) |
|
1995 { |
|
1996 return EFalse; |
|
1997 } |
|
1998 if ( aKeycode == EAknSoftkeyOptions ) |
|
1999 { |
|
2000 DisplayMenuL(); |
|
2001 return EFalse; |
|
2002 } |
|
2003 |
|
2004 //Direct exit request causes silent exit. |
|
2005 //In this case edited settings are discarded. |
|
2006 else if ( aKeycode == EAknSoftkeyExit ) |
|
2007 { |
|
2008 return ETrue; |
|
2009 } |
|
2010 else if ( aKeycode == EAknSoftkeyOpen || aKeycode == EAknSoftkeyEdit ) |
|
2011 { |
|
2012 // Don't allow exit with MSK commands |
|
2013 ProcessCommandL( aKeycode ); |
|
2014 return EFalse; |
|
2015 } |
|
2016 |
|
2017 SaveSettingsL(); |
|
2018 return ETrue; |
|
2019 } |
|
2020 |
|
2021 |
|
2022 // --------------------------------------------------------- |
|
2023 // CWVSettingsUIDialogImp::SaveSettingsL() |
|
2024 // |
|
2025 // (other items were commented in a header). |
|
2026 // --------------------------------------------------------- |
|
2027 // |
|
2028 void CWVSettingsUIDialogImp::SaveSettingsL() |
|
2029 { |
|
2030 //get data from editors |
|
2031 TInt count( iSettingItemArray->Count() ); |
|
2032 for ( TInt i( 0 ); i < count; ++i ) |
|
2033 { |
|
2034 iSettingItemArray->At( i )->StoreL(); |
|
2035 } |
|
2036 |
|
2037 if ( iSchedulingSupported ) |
|
2038 { |
|
2039 // IM Login type settings |
|
2040 StoreSettingValueL( GetConnectionDaysL( *iSelectedDaysIM ), EIMPSSharedKeysIMConnDays ); |
|
2041 |
|
2042 // format the times correctly for saving (HH:MM) |
|
2043 iConnStartIMPtr.Format( KTimeFormat, iConnStartHourIM, iConnStartMinuteIM ); |
|
2044 |
|
2045 iConnEndIMPtr.Format( KTimeFormat, iConnEndHourIM, iConnEndMinuteIM ); |
|
2046 |
|
2047 StoreStringSettingValueL( *iConnStartIM, EIMPSSharedKeysIMConnStart ); |
|
2048 StoreStringSettingValueL( *iConnEndIM, EIMPSSharedKeysIMConnEnd ); |
|
2049 |
|
2050 // set the notifier keys for schedules |
|
2051 iSettingsChangeNotifier->SetIntKey( EIMPSSharedKeysServSettScheduleChangedPEC, 0 ); |
|
2052 iSettingsChangeNotifier->SetIntKey( EIMPSSharedKeysServSettScheduleChangedIM, 0 ); |
|
2053 } |
|
2054 |
|
2055 if ( iImLoginTypeEdited ) |
|
2056 { |
|
2057 // save the IM login type |
|
2058 StoreSettingValueL( iImLoginType, EIMPSSharedKeysIMLogin ); |
|
2059 |
|
2060 // Start AO plugin. |
|
2061 RAlwaysOnlineClientSession session; |
|
2062 |
|
2063 User::LeaveIfError( session.Connect() ); |
|
2064 |
|
2065 TUid uid = { KIMPSALWAYSONLINEUID3 }; |
|
2066 TPckgBuf< TUid > param = uid; |
|
2067 |
|
2068 if ( iImLoginType == EWVSettingsChatLoginAutoAlways || |
|
2069 iImLoginType == EWVSettingsChatLoginAutoInHomeNW ) |
|
2070 { |
|
2071 session.RelayCommandL( EServerAPIBaseCommandStart, param ); |
|
2072 } |
|
2073 // Handle situation where login is ongoing and we are |
|
2074 // stopping plugin. |
|
2075 /*else |
|
2076 { |
|
2077 session.RelayCommandL( EServerAPIBaseCommandStop, param ); |
|
2078 }*/ |
|
2079 session.Close(); |
|
2080 |
|
2081 // set the notifier key for login type |
|
2082 iSettingsChangeNotifier->SetIntKey( EIMPSSharedKeysServSettLoginTypeChangedIM, 0 ); |
|
2083 } |
|
2084 |
|
2085 // update selecte memory drive here... |
|
2086 #ifdef RD_MULTIPLE_DRIVE |
|
2087 User::LeaveIfError( iSharedData->SetStringKey( EIMPSSharedKeysMemoryDrive, iMemorySelectionPtr ) ); |
|
2088 #endif |
|
2089 |
|
2090 } |
|
2091 |
|
2092 |
|
2093 // --------------------------------------------------------- |
|
2094 // CWVSettingsUIDialogImp::StoreSettingValueL() |
|
2095 // |
|
2096 // (other items were commented in a header). |
|
2097 // --------------------------------------------------------- |
|
2098 // |
|
2099 void CWVSettingsUIDialogImp::StoreSettingValueL( TInt aSettingValueToStore, |
|
2100 const TIMPSSharedKeys aNameKey ) |
|
2101 { |
|
2102 __ASSERT_DEBUG( ( aSettingValueToStore != KMaxTInt ), Panic( EWVSettingsViewPanicStoreValue ) ); |
|
2103 |
|
2104 iSharedData->SetIntKey( aNameKey, aSettingValueToStore ); |
|
2105 } |
|
2106 |
|
2107 // --------------------------------------------------------- |
|
2108 // CWVSettingsUIDialogImp::StoreStringSettingValueL() |
|
2109 // |
|
2110 // (other items were commented in a header). |
|
2111 // --------------------------------------------------------- |
|
2112 // |
|
2113 void CWVSettingsUIDialogImp::StoreStringSettingValueL( const TDesC& aSettingValueToStore, |
|
2114 const TIMPSSharedKeys aNameKey ) |
|
2115 { |
|
2116 User::LeaveIfError( iSharedData->SetStringKey( aNameKey, aSettingValueToStore ) ); |
|
2117 } |
|
2118 |
|
2119 |
|
2120 // --------------------------------------------------------- |
|
2121 // CWVSettingsUIDialogImp::HandleListBoxEventL() |
|
2122 // |
|
2123 // (other items were commented in a header). |
|
2124 // --------------------------------------------------------- |
|
2125 // |
|
2126 void CWVSettingsUIDialogImp::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
2127 TListBoxEvent aEventType ) |
|
2128 { |
|
2129 switch ( aEventType ) |
|
2130 { |
|
2131 case EEventEnterKeyPressed: // Fall through |
|
2132 case EEventEditingStarted: |
|
2133 case EEventItemDoubleClicked: |
|
2134 { |
|
2135 LaunchCorrectDialog(); |
|
2136 break; |
|
2137 } |
|
2138 default: |
|
2139 { |
|
2140 break; |
|
2141 } |
|
2142 } |
|
2143 } |
|
2144 |
|
2145 |
|
2146 // --------------------------------------------------------- |
|
2147 // CWVSettingsUIDialogImp::ChangeResourceFileL() |
|
2148 // |
|
2149 // (other items were commented in a header). |
|
2150 // --------------------------------------------------------- |
|
2151 // |
|
2152 void CWVSettingsUIDialogImp::ChangeResourceFileL ( const TDesC& aResourceFileName, |
|
2153 const TDesC& aResourceVariationFile ) |
|
2154 { |
|
2155 |
|
2156 TFileName path = aResourceFileName; |
|
2157 TFileName pathVariation = aResourceVariationFile; |
|
2158 |
|
2159 TFileName connUiResFile = KNullDesC(); |
|
2160 CEikonEnv* eikonEnv = CEikonEnv::Static(); |
|
2161 if ( path.Length() == 0 ) |
|
2162 { |
|
2163 Dll::FileName( path ); |
|
2164 Dll::FileName( pathVariation ); |
|
2165 TDriveName drive( TParsePtrC( path ).Drive( ) ); |
|
2166 path.Zero(); |
|
2167 path.Append( drive ); |
|
2168 path.Append( KDC_RESOURCE_FILES_DIR() ); |
|
2169 path.Append( KResourceName ); |
|
2170 BaflUtils::NearestLanguageFile( eikonEnv->FsSession(), path ); |
|
2171 |
|
2172 TDriveName driveVar( TParsePtrC( pathVariation ).Drive( ) ); |
|
2173 pathVariation.Zero(); |
|
2174 pathVariation.Append( driveVar ); |
|
2175 pathVariation.Append( KDC_RESOURCE_FILES_DIR() ); |
|
2176 pathVariation.Append( KIMCUVariationResourceName ); |
|
2177 BaflUtils::NearestLanguageFile( eikonEnv->FsSession(), pathVariation ); |
|
2178 } |
|
2179 else |
|
2180 { |
|
2181 TChar backSlash( KBackSlash ); |
|
2182 // Locate first backslash starting from the end of |
|
2183 // the path |
|
2184 TInt pos = path.LocateReverse( backSlash ); |
|
2185 if ( pos != KErrNotFound ) |
|
2186 { |
|
2187 connUiResFile.Append( path.Left( pos ) ); |
|
2188 connUiResFile.Append( KDirSeparator ); |
|
2189 connUiResFile.Append( KConnUiResourceName ); |
|
2190 BaflUtils::NearestLanguageFile( eikonEnv->FsSession(), connUiResFile ); |
|
2191 } |
|
2192 } |
|
2193 |
|
2194 // test if we have enough memory to add the resource file |
|
2195 // this like this, since AddResourceFileL does |
|
2196 // not add a resourcefile with same signature twice. |
|
2197 // so we have to first delete the old one and then add the new one |
|
2198 // With this check we atleast test if there is some amount of memory |
|
2199 // for loading the resource. If we leave from AddResourceFileL the |
|
2200 // application will panic, since we have no resource file loaded at all. |
|
2201 TEntry entry; |
|
2202 User::LeaveIfError( eikonEnv->FsSession().Entry( path, entry ) ); |
|
2203 TInt fileSize( entry.iSize ); |
|
2204 // test if there's enough heap available, this one leaves if not and resources won't get changed |
|
2205 HBufC8* allocTest = HBufC8::NewL( fileSize ); |
|
2206 delete allocTest; |
|
2207 |
|
2208 // delete the current resource file |
|
2209 eikonEnv->DeleteResourceFile( iResourceFileOffset ); |
|
2210 eikonEnv->DeleteResourceFile( iResourceVariationFileOffset ); |
|
2211 |
|
2212 // load the new resource file |
|
2213 iResourceFileOffset = 0; |
|
2214 iResourceVariationFileOffset = 0; |
|
2215 |
|
2216 iResourceFileOffset = eikonEnv->AddResourceFileL( path ); |
|
2217 iResourceVariationFileOffset = eikonEnv->AddResourceFileL( pathVariation ); |
|
2218 |
|
2219 // Change branding in iConnectionUI |
|
2220 User::LeaveIfError( RProperty::Set( KBrandingUid, KBrandingResourceKey, connUiResFile ) ); |
|
2221 |
|
2222 // refresh the setting items |
|
2223 LoadSettingsL(); |
|
2224 RefreshDialogL(); |
|
2225 } |
|
2226 |
|
2227 // --------------------------------------------------------- |
|
2228 // CWVSettingsUIDialogImp::GetChatLoginType() |
|
2229 // |
|
2230 // (other items were commented in a header). |
|
2231 // --------------------------------------------------------- |
|
2232 // |
|
2233 TInt CWVSettingsUIDialogImp::GetChatLoginType() const |
|
2234 { |
|
2235 return iImLoginType; |
|
2236 } |
|
2237 |
|
2238 |
|
2239 // --------------------------------------------------------- |
|
2240 // CWVSettingsUIDialogImp::HandleActiveDbEvent() |
|
2241 // (other items were commented in a header). |
|
2242 // --------------------------------------------------------- |
|
2243 // |
|
2244 void CWVSettingsUIDialogImp::HandleSAPEvent( TSAPEvent aEvent ) |
|
2245 { |
|
2246 if ( aEvent == ESAPSettingChanged ) |
|
2247 { |
|
2248 // we cannot leave here, if updating fails, only wrong name shown |
|
2249 TInt ignore; |
|
2250 TRAP( ignore, UpdateServerInUseItemL() ); |
|
2251 } |
|
2252 } |
|
2253 |
|
2254 |
|
2255 // ----------------------------------------------------------------------------- |
|
2256 // CWVSettingsUIDialogImp::ServerListLC() |
|
2257 // SAP loading |
|
2258 // ----------------------------------------------------------------------------- |
|
2259 // |
|
2260 CIMPSSAPSettingsList* CWVSettingsUIDialogImp::ServerListLC( TInt& aIndexToHighlight ) |
|
2261 { |
|
2262 CIMPSSAPSettingsList* sapList = CIMPSSAPSettingsList::NewLC(); |
|
2263 |
|
2264 TIMPSConnectionClient client( EIMPSConnClientIM ); |
|
2265 TIMPSAccessGroup accessGroup; |
|
2266 if ( client == EIMPSConnClientIM ) |
|
2267 { |
|
2268 accessGroup = EIMPSIMAccessGroup; |
|
2269 } |
|
2270 else |
|
2271 { |
|
2272 accessGroup = EIMPSPECAccessGroup; |
|
2273 } |
|
2274 iSAPSettingsStore->PopulateSAPSettingsListL( *sapList, accessGroup ); |
|
2275 |
|
2276 // Check CR variation |
|
2277 TInt val( 0 ); |
|
2278 |
|
2279 TRAPD( err, |
|
2280 CRepository* rep = CRepository::NewL( KCRUidIMVariation ); |
|
2281 rep->Get( KIMVariationKey, val ); |
|
2282 delete rep; |
|
2283 ); |
|
2284 |
|
2285 if ( err != KErrNotFound && err != KErrPathNotFound ) |
|
2286 { |
|
2287 // "Not found" errors are ignored, because it's ok to |
|
2288 // return zero if key is not found |
|
2289 User::LeaveIfError( err ); |
|
2290 } |
|
2291 |
|
2292 TBool highlightDefaultServ = ETrue; |
|
2293 TBool highlightLoggedInServ = val & KIMFeatHighlightLoggedInServer; |
|
2294 |
|
2295 if ( highlightLoggedInServ ) |
|
2296 { |
|
2297 highlightDefaultServ = EFalse; |
|
2298 |
|
2299 CIMPSSAPSettings* sap = CIMPSSAPSettings::NewLC(); |
|
2300 |
|
2301 TBool isLoggedIn( EFalse ); |
|
2302 if ( iConnectionUI ) |
|
2303 { |
|
2304 TInt err; |
|
2305 TRAP( err, isLoggedIn = |
|
2306 iConnectionUI->LoggedInL( EIMPSConnClientIM ) ); |
|
2307 } |
|
2308 |
|
2309 if ( isLoggedIn ) |
|
2310 { |
|
2311 CPEngNWSessionSlotID2* sessionSlotId = |
|
2312 iConnectionUI->GetActiveNWSessionSlotIDL( EIMPSConnClientIM ); |
|
2313 CleanupStack::PushL( sessionSlotId ); |
|
2314 iConnectionUI->GetLoggedInSapL( *sessionSlotId, *sap ); |
|
2315 |
|
2316 // and find our sap.. because logged in SAP has UID of zero, we must |
|
2317 // find the correct UID manually from list |
|
2318 TInt index( KErrNotFound ); |
|
2319 TPtrC name( sap->SAPName() ); |
|
2320 sapList->FindNameL( name, index ); |
|
2321 |
|
2322 if ( index != KErrNotFound ) |
|
2323 { |
|
2324 // found it, update the correct sap |
|
2325 CIMPSSAPSettings* storedSap = CIMPSSAPSettings::NewLC(); |
|
2326 iSAPSettingsStore->GetSAPL( sapList->UidForIndex( index ), |
|
2327 storedSap ); |
|
2328 |
|
2329 // we are logged in a server, and it's index was found |
|
2330 // -> highlight it |
|
2331 aIndexToHighlight = sapList->IndexForUid( storedSap->Uid() ); |
|
2332 |
|
2333 CleanupStack::PopAndDestroy( 3, sap ); // storedSap, |
|
2334 // sessionslot,sap |
|
2335 } |
|
2336 else |
|
2337 { |
|
2338 highlightDefaultServ = ETrue; |
|
2339 // Could not find the logged in server |
|
2340 CleanupStack::PopAndDestroy( 2, sap ); |
|
2341 //,sessionSlotId, sap |
|
2342 } |
|
2343 } |
|
2344 else |
|
2345 { |
|
2346 highlightDefaultServ = ETrue; |
|
2347 CleanupStack::PopAndDestroy( sap ); |
|
2348 } |
|
2349 } |
|
2350 |
|
2351 if ( highlightDefaultServ ) |
|
2352 { |
|
2353 //get the default server index |
|
2354 TUint32 defaultUid( KIMPSSettingsNullUid ); |
|
2355 |
|
2356 TRAPD( err, iSAPSettingsStore->GetDefaultL( defaultUid, accessGroup ) ); |
|
2357 if ( err == KErrNone ) |
|
2358 { |
|
2359 //default was defined and could retrieve a UID for it |
|
2360 //==>report its index |
|
2361 aIndexToHighlight = sapList->IndexForUid( defaultUid ); |
|
2362 } |
|
2363 |
|
2364 else if ( err == KErrNotFound ) |
|
2365 { |
|
2366 //if there wasn't a default sap defined for some reason, |
|
2367 //return the index as KErrNotFound |
|
2368 aIndexToHighlight = KErrNotFound; |
|
2369 err = KErrNone; |
|
2370 } |
|
2371 |
|
2372 //Handle other errors by leaving |
|
2373 User::LeaveIfError( err ); |
|
2374 } |
|
2375 |
|
2376 return sapList; //returns the ownership of sapList |
|
2377 } |
|
2378 |
|
2379 |
|
2380 // ----------------------------------------------------------------------------- |
|
2381 // CWVSettingsUIDialogImp::LoadSapByServerListL() |
|
2382 // SAP loading |
|
2383 // ----------------------------------------------------------------------------- |
|
2384 // |
|
2385 void CWVSettingsUIDialogImp::LoadSapByServerListL( const CIMPSSAPSettingsList& aList, |
|
2386 TInt aIndexOfSelectedServer, |
|
2387 CIMPSSAPSettings& aSap ) |
|
2388 { |
|
2389 if ( ( aIndexOfSelectedServer < 0 ) || |
|
2390 ( aIndexOfSelectedServer > aList.Count() ) ) |
|
2391 { |
|
2392 User::Leave( KErrArgument ); |
|
2393 } |
|
2394 |
|
2395 TUint32 uid = aList.UidForIndex( aIndexOfSelectedServer ); |
|
2396 |
|
2397 iSAPSettingsStore->GetSAPL( uid, &aSap ); |
|
2398 } |
|
2399 |
|
2400 |
|
2401 // ----------------------------------------------------------------------------- |
|
2402 // CWVSettingsUIDialogImp::ServerToUseQueryL() |
|
2403 // ----------------------------------------------------------------------------- |
|
2404 // |
|
2405 TBool CWVSettingsUIDialogImp::ServerToUseQueryL( MDesCArray& aServers, |
|
2406 TInt aIndexToHighlight, |
|
2407 TInt& aSelectedIndex ) |
|
2408 { |
|
2409 if ( aServers.MdcaCount() == 0 || aServers.MdcaCount() == 1 ) |
|
2410 { |
|
2411 User::Leave( KErrNotSupported ); |
|
2412 } |
|
2413 |
|
2414 TRAPD( err, LoadServerIconsL( aServers ) ); |
|
2415 if ( err != KErrNone ) |
|
2416 { |
|
2417 // didn't manage to load bitmaps, try to show the list without them |
|
2418 delete iIconArray; |
|
2419 iIconArray = NULL; |
|
2420 } |
|
2421 |
|
2422 TInt selection( -1 ); |
|
2423 TInt retVal( -1 ); |
|
2424 // Code scanner warning neglected to put variable on cleanup stack (Id: 35) |
|
2425 // CAknIconArray::AppendL takes ownership of the icon |
|
2426 CAknListQueryDialog* listQuery = |
|
2427 new ( ELeave ) CAknListQueryDialog( &selection ); // CSI: 35 # See above |
|
2428 |
|
2429 if ( iIconArray ) |
|
2430 { |
|
2431 // icon array exists, construct the query with icons |
|
2432 listQuery->PrepareLC( R_SERVER_TO_LOGIN_LISTQUERY_GRAPHIC ); |
|
2433 listQuery->SetIconArrayL( iIconArray ); |
|
2434 iIconArray = NULL; // listbox has the ownership of icon array |
|
2435 |
|
2436 // construct formatted text array |
|
2437 TInt count( aServers.MdcaCount() ); |
|
2438 CDesCArray* items = new( ELeave )CDesCArrayFlat( count ); |
|
2439 CleanupStack::PushL( items ); |
|
2440 for ( TInt i( 0 ); i < count; i++ ) |
|
2441 { |
|
2442 TPtrC item( aServers.MdcaPoint( i ) ); |
|
2443 |
|
2444 // 5 is more than enough for formatted number in front of server list |
|
2445 HBufC* temp = HBufC::NewLC( item.Length() + KTabulator().Length() + 5 ); |
|
2446 TPtr tempPtr( temp->Des() ); |
|
2447 tempPtr.Num( i ); |
|
2448 tempPtr.Append( KTabulator ); |
|
2449 tempPtr.Append( item ); |
|
2450 |
|
2451 items->AppendL( tempPtr ); |
|
2452 CleanupStack::PopAndDestroy( temp ); |
|
2453 } |
|
2454 |
|
2455 listQuery->SetItemTextArray( items ); |
|
2456 listQuery->SetOwnershipType( ELbmOwnsItemArray ); |
|
2457 CleanupStack::Pop( items ); // listbox model owns the item array |
|
2458 } |
|
2459 else |
|
2460 { |
|
2461 // icon array doesn't exist, construct the query without icons |
|
2462 listQuery->PrepareLC( R_SERVER_TO_LOGIN_LISTQUERY ); |
|
2463 |
|
2464 listQuery->SetItemTextArray( &aServers ); |
|
2465 listQuery->SetOwnershipType( ELbmDoesNotOwnItemArray ); // listbox model doesn't own the item array |
|
2466 } |
|
2467 |
|
2468 //check is the index to highlight on the range... |
|
2469 if ( ( aIndexToHighlight > 0 ) && ( aIndexToHighlight < aServers.MdcaCount() ) ) |
|
2470 { |
|
2471 listQuery->ListBox()->SetCurrentItemIndex( aIndexToHighlight ); |
|
2472 } |
|
2473 |
|
2474 retVal = listQuery->RunLD(); //execute the selection |
|
2475 |
|
2476 |
|
2477 // if selection made and not cancelled |
|
2478 if ( ( selection >= 0 ) && ( retVal != 0 ) ) |
|
2479 { |
|
2480 aSelectedIndex = selection; |
|
2481 return ETrue; |
|
2482 } |
|
2483 |
|
2484 |
|
2485 return EFalse; |
|
2486 } |
|
2487 |
|
2488 |
|
2489 // ----------------------------------------------------------------------------- |
|
2490 // CWVSettingsUIDialogImp::LoadServerIconsL() |
|
2491 // ----------------------------------------------------------------------------- |
|
2492 // |
|
2493 void CWVSettingsUIDialogImp::LoadServerIconsL( MDesCArray& aServers ) |
|
2494 { |
|
2495 TInt count( aServers.MdcaCount() ); |
|
2496 __ASSERT_DEBUG( count > 0, User::Panic( KIMPSConnUi_PanicCat, KErrGeneral ) ); |
|
2497 iIconArray = new( ELeave )CAknIconArray( count ); |
|
2498 |
|
2499 // load icons |
|
2500 TBool allEmpty( ETrue ); |
|
2501 HBufC* pathBuf = HBufC::NewLC( KMaxFileName ); |
|
2502 TPtr path( pathBuf->Des() ); |
|
2503 |
|
2504 CFbsBitmap* bitmap = NULL; |
|
2505 CFbsBitmap* mask = NULL; |
|
2506 |
|
2507 for ( TInt i( 0 ); i < count; i++ ) |
|
2508 { |
|
2509 if ( !ConstructCompletePathAndCheck( path, KModuleId, |
|
2510 aServers.MdcaPoint( i ), KBitmapFileServerList ) ) |
|
2511 { |
|
2512 // not found, use empty |
|
2513 AknIconUtils::CreateIconLC( bitmap, mask, AknIconUtils::AvkonIconFileName(), |
|
2514 EMbmAvkonQgn_prop_empty, EMbmAvkonQgn_prop_empty_mask ); |
|
2515 CleanupStack::Pop( 2 ); // bitmap, mask |
|
2516 // Code scanner warning neglected to put variable on cleanup stack (Id: 35) |
|
2517 // CAknIconArray::AppendL takes ownership of the icon |
|
2518 CGulIcon* gulIcon = CGulIcon::NewL( bitmap, mask ); // CSI: 35 # See above |
|
2519 iIconArray->AppendL( gulIcon ); |
|
2520 } |
|
2521 else |
|
2522 { |
|
2523 // load the icon that was found |
|
2524 AknIconUtils::CreateIconLC( bitmap, mask, path, 0, 1 ); |
|
2525 CleanupStack::Pop( 2 ); // bitmap, mask |
|
2526 // Code scanner warning neglected to put variable on cleanup stack (Id: 35) |
|
2527 // CAknIconArray::AppendL takes ownership of the icon |
|
2528 CGulIcon* gulIcon = CGulIcon::NewL( bitmap, mask ); // CSI: 35 # See above |
|
2529 iIconArray->AppendL( gulIcon ); |
|
2530 allEmpty = EFalse; |
|
2531 } |
|
2532 } |
|
2533 CleanupStack::PopAndDestroy( pathBuf ); |
|
2534 |
|
2535 if ( allEmpty ) |
|
2536 { |
|
2537 // every icon is empty, delete whole array and show list without icons |
|
2538 delete iIconArray; |
|
2539 iIconArray = NULL; |
|
2540 } |
|
2541 } |
|
2542 |
|
2543 |
|
2544 // ----------------------------------------------------------------------------- |
|
2545 // CWVSettingsUIDialogImp::ConstructCompletePathAndCheck |
|
2546 // ----------------------------------------------------------------------------- |
|
2547 // |
|
2548 TBool CWVSettingsUIDialogImp::ConstructCompletePathAndCheck( TDes& aResult, |
|
2549 const TDesC& aModuleId, |
|
2550 const TDesC& aAlternative, |
|
2551 const TDesC& aFileName ) |
|
2552 { |
|
2553 // Construct full path for wanted resource |
|
2554 // MMC drive letter must be here to make sure that TFindFile searches first |
|
2555 // MMC for the correct brand |
|
2556 MMCDrive( aResult ); |
|
2557 aResult.Append( KRelativeBrandPath() ); |
|
2558 aResult.Append( aModuleId ); |
|
2559 aResult.Append( KDirSeparator ); |
|
2560 aResult.Append( aAlternative ); |
|
2561 aResult.Append( KDirSeparator ); |
|
2562 aResult.Append( aFileName ); |
|
2563 |
|
2564 // Find the actual file |
|
2565 TFindFile fileFinder( CEikonEnv::Static()->FsSession() ); |
|
2566 TInt err( fileFinder.FindByDir( aFileName, aResult ) ); |
|
2567 |
|
2568 // If file was found, then take the first appearance of it |
|
2569 // (order is correct aready) |
|
2570 if ( err == KErrNone ) |
|
2571 { |
|
2572 aResult.Zero(); |
|
2573 aResult.Append( fileFinder.File() ); |
|
2574 } |
|
2575 |
|
2576 #ifdef _DEBUG |
|
2577 RDebug::Print( _L( "ConstructCompletePathAndCheck, TFindFile returned %d for %S" ), err, &aResult ); |
|
2578 #endif |
|
2579 |
|
2580 // return was the file found or not |
|
2581 return err == KErrNone; |
|
2582 } |
|
2583 |
|
2584 // ----------------------------------------------------------------------------- |
|
2585 // CWVSettingsUIDialogImp::MMCDrive |
|
2586 // ----------------------------------------------------------------------------- |
|
2587 // |
|
2588 void CWVSettingsUIDialogImp::MMCDrive( TDes& aDrive ) const |
|
2589 { |
|
2590 TParsePtrC mmc( PathInfo::MemoryCardRootPath() ); |
|
2591 aDrive.Zero(); |
|
2592 aDrive.Append( mmc.Drive() ); |
|
2593 } |
|
2594 |
|
2595 // ----------------------------------------------------------------------------- |
|
2596 // CWVSettingsUIDialogImp::UpdateCbaL |
|
2597 // ----------------------------------------------------------------------------- |
|
2598 // |
|
2599 void CWVSettingsUIDialogImp::UpdateCbaL() |
|
2600 { |
|
2601 TInt index = iListbox->CurrentItemIndex(); |
|
2602 |
|
2603 if ( !iCAServerSettings ) |
|
2604 { |
|
2605 // If we don't show CA settings item, we have 1 item less |
|
2606 // in the listbox -> thus +1 to the index |
|
2607 index++; |
|
2608 } |
|
2609 |
|
2610 TInt cbaRes = R_WVSETTINGSVIEW_SOFTKEYS_OPTIONS_BACK__CHANGE; |
|
2611 switch ( index ) |
|
2612 { |
|
2613 case EWVSettingsCASettings: // Flowthrough |
|
2614 case EWVSettingsServers: |
|
2615 { |
|
2616 cbaRes = R_WVSETTINGSVIEW_SOFTKEYS_OPTIONS_BACK__OPEN; |
|
2617 break; |
|
2618 } |
|
2619 case EWVSettingsServerInUse: |
|
2620 { |
|
2621 // Needs cmd id open |
|
2622 cbaRes = R_WVSETTINGSVIEW_SOFTKEYS_OPTIONS_BACK__CHANGE2; |
|
2623 break; |
|
2624 } |
|
2625 default: |
|
2626 { |
|
2627 break; |
|
2628 } |
|
2629 } |
|
2630 |
|
2631 ButtonGroupContainer().SetCommandSetL( cbaRes ); |
|
2632 ButtonGroupContainer().DrawNow(); |
|
2633 } |
|
2634 |
|
2635 // --------------------------------------------------------- |
|
2636 // CWVSettingsUIDialogImp::LaunchCASettingsL() |
|
2637 // |
|
2638 // (other items were commented in a header). |
|
2639 // --------------------------------------------------------- |
|
2640 // |
|
2641 void CWVSettingsUIDialogImp::LaunchCASettingsL() |
|
2642 { |
|
2643 |
|
2644 // check if we have servers |
|
2645 if ( !CheckAnyStoredServers() ) |
|
2646 return; |
|
2647 |
|
2648 |
|
2649 CIMPSSAPSettings* sapSettings = CIMPSSAPSettings::NewLC(); |
|
2650 |
|
2651 TInt indexToHiglight = KErrNotFound; //UI handles this by higlighting the first |
|
2652 TInt selection = KErrNotFound; |
|
2653 TInt retStatus = KErrNone; |
|
2654 |
|
2655 CIMPSSAPSettingsList* servers = ServerListLC( indexToHiglight ); |
|
2656 if ( servers->MdcaCount() == 0 ) |
|
2657 { |
|
2658 //No SAPs at all |
|
2659 retStatus = KErrArgument; |
|
2660 } |
|
2661 |
|
2662 else if ( servers->MdcaCount() == 1 ) |
|
2663 { |
|
2664 //one SAP -> use it |
|
2665 LoadSapByServerListL( *servers, 0, *sapSettings ); //one SAP --> its index is zero |
|
2666 retStatus = KErrNone; |
|
2667 } |
|
2668 |
|
2669 else |
|
2670 { |
|
2671 if ( ServerToUseQueryL( *servers, |
|
2672 indexToHiglight, |
|
2673 selection ) ) |
|
2674 { |
|
2675 //load sap according the user selection |
|
2676 LoadSapByServerListL( *servers, selection, *sapSettings ); |
|
2677 retStatus = KErrNone; |
|
2678 } |
|
2679 |
|
2680 else |
|
2681 { |
|
2682 //User declined the query |
|
2683 retStatus = KErrCancel; |
|
2684 } |
|
2685 } |
|
2686 |
|
2687 CleanupStack::PopAndDestroy( servers ); //servers |
|
2688 if ( retStatus == KErrNone ) |
|
2689 { |
|
2690 HBufC* oldServer = NULL; |
|
2691 MWVSettingsObserver* observer = iObserver; |
|
2692 if ( iObserver ) |
|
2693 { |
|
2694 // iObserver might not exist if we didn't get here through application settings |
|
2695 // update previous server name |
|
2696 oldServer = iObserver->CurrentServerNameLC(); |
|
2697 // load resource branding for this server (settings contain branded items) |
|
2698 HBufC* newServer = sapSettings->SAPName().AllocLC(); |
|
2699 iObserver->ServerChangedL( *newServer ); |
|
2700 CleanupStack::PopAndDestroy( newServer ); |
|
2701 } |
|
2702 CWVSettingsUIDialog** selfPtr = iSelfPtr; |
|
2703 |
|
2704 TInt retVal = iCAServerSettings->LaunchSettingsL( *sapSettings ); |
|
2705 |
|
2706 if ( retVal == EAknSoftkeyExit && selfPtr ) |
|
2707 { |
|
2708 *selfPtr = NULL; |
|
2709 } |
|
2710 if ( observer ) |
|
2711 { |
|
2712 observer->ServerChangedL( *oldServer ); |
|
2713 CleanupStack::PopAndDestroy( oldServer ); |
|
2714 } |
|
2715 |
|
2716 if ( retVal != EAknSoftkeyExit ) |
|
2717 { |
|
2718 RefreshTitleL(); |
|
2719 } |
|
2720 } |
|
2721 CleanupStack::PopAndDestroy( sapSettings ); |
|
2722 } |
|
2723 |
|
2724 // --------------------------------------------------------- |
|
2725 // CWVSettingsUIDialogImp::ActivateCurrentItemL() |
|
2726 // |
|
2727 // (other items were commented in a header). |
|
2728 // --------------------------------------------------------- |
|
2729 // |
|
2730 void CWVSettingsUIDialogImp::ActivateCurrentItemL() |
|
2731 { |
|
2732 TInt index = iListbox->CurrentItemIndex(); |
|
2733 TInt settingItem = index; |
|
2734 TInt oldLoginType = iImLoginType; |
|
2735 if ( !iCAServerSettings ) |
|
2736 { |
|
2737 // if we don't show CA settings item, we have 1 item less |
|
2738 // in the listbox -> thus +1 to the index |
|
2739 settingItem++; |
|
2740 } |
|
2741 switch ( settingItem ) |
|
2742 { |
|
2743 case EWVSettingsCASettings: |
|
2744 { |
|
2745 LaunchCASettingsL(); |
|
2746 break; |
|
2747 } |
|
2748 case EWVSettingsServers: // Fall through |
|
2749 case EWVSettingsServerInUse: |
|
2750 #ifdef RD_MULTIPLE_DRIVE |
|
2751 case EWVSettingsSaveChatsTo: |
|
2752 #endif |
|
2753 { |
|
2754 LaunchCorrectDialogL(); |
|
2755 break; |
|
2756 } |
|
2757 default: |
|
2758 { |
|
2759 |
|
2760 // check if we have servers |
|
2761 if ( !CheckAnyStoredServers() ) |
|
2762 return; |
|
2763 |
|
2764 TBool cancelled ( ETrue ); |
|
2765 TBool connHoursIMEdited( EFalse ); |
|
2766 |
|
2767 // copy the selected days arrays |
|
2768 CSelectionItemList* newSelectedDaysIM = CopySelectedDaysArrayL( iSelectedDaysIM ); |
|
2769 CleanupStack::PushL( newSelectedDaysIM ); |
|
2770 iSettingItemEditor->EditSettingItemL( ETrue, |
|
2771 index, |
|
2772 *iSettingItemArray, |
|
2773 *iSAPSettingsStore, |
|
2774 iImLoginType, |
|
2775 iImLoginTypeEdited, |
|
2776 newSelectedDaysIM, |
|
2777 iConnHoursIMInt, |
|
2778 connHoursIMEdited, |
|
2779 cancelled, |
|
2780 settingItem, |
|
2781 iConnectionUI, |
|
2782 &iForcedLoginMade ); |
|
2783 CleanupStack::Pop( newSelectedDaysIM ); |
|
2784 |
|
2785 if ( iImLoginTypeEdited ) |
|
2786 { |
|
2787 // Save IM login type right away to avoid always online queries |
|
2788 // to be shown in chat ui side and to keep value correct if user |
|
2789 // decides to do something that causes ChangeResourceFileL to be called |
|
2790 // before exiting settings dialog. |
|
2791 StoreSettingValueL( iImLoginType, EIMPSSharedKeysIMLogin ); |
|
2792 } |
|
2793 if ( iForcedLoginMade ) |
|
2794 { |
|
2795 // Set P&S flag to indicate forced login done |
|
2796 TInt err = RProperty::Define( KBrandingUid, |
|
2797 KForcedLoginKey, |
|
2798 RProperty::EInt, |
|
2799 KIMPSPubSubReadPolicy, KIMPSPubSubWritePolicy ); |
|
2800 if ( err != KErrAlreadyExists ) |
|
2801 { |
|
2802 // Ignore KErrAlreadyExists errors |
|
2803 User::LeaveIfError( err ); |
|
2804 } |
|
2805 err = RProperty::Set( KBrandingUid, KForcedLoginKey, ETrue ); |
|
2806 User::LeaveIfError( err ); |
|
2807 } |
|
2808 else |
|
2809 { |
|
2810 // Clear flag just to be sure |
|
2811 TInt err = RProperty::Set( KBrandingUid, KForcedLoginKey, EFalse ); |
|
2812 if ( err != KErrNotFound ) |
|
2813 { |
|
2814 // Ignore KErrNotFound |
|
2815 User::LeaveIfError( err ); |
|
2816 } |
|
2817 } |
|
2818 |
|
2819 if ( iSchedulingSupported ) |
|
2820 { |
|
2821 if ( !cancelled ) |
|
2822 { |
|
2823 // not cancelled -> take the new selected days arrays into use |
|
2824 iSelectedDaysIM->ResetAndDestroy(); |
|
2825 delete iSelectedDaysIM; |
|
2826 iSelectedDaysIM = newSelectedDaysIM; |
|
2827 newSelectedDaysIM = NULL; |
|
2828 |
|
2829 UpdateConnectionDaysL( *iSelectedDaysIM ); |
|
2830 |
|
2831 if ( connHoursIMEdited ) |
|
2832 { |
|
2833 // the IM connection hours item has been edited |
|
2834 QueryConnectionHoursL(); |
|
2835 } |
|
2836 |
|
2837 // update IM connection hours text in the listbox |
|
2838 if ( iConnStartIM && iConnEndIM ) |
|
2839 { |
|
2840 if ( ( iConnHoursIMInt == EWVSettingsAllDay ) |
|
2841 || ( !iConnStartIM->Compare( iConnEndIM->Des() ) ) ) |
|
2842 { |
|
2843 UpdateConnectionHoursTextL( ETrue ); |
|
2844 } |
|
2845 else |
|
2846 { |
|
2847 UpdateConnectionHoursTextL( EFalse ); |
|
2848 } |
|
2849 } |
|
2850 } |
|
2851 } |
|
2852 |
|
2853 if ( newSelectedDaysIM ) |
|
2854 { |
|
2855 newSelectedDaysIM->ResetAndDestroy(); |
|
2856 delete newSelectedDaysIM; |
|
2857 } |
|
2858 |
|
2859 iSettingItemArray->At( index )->LoadL(); |
|
2860 iSettingItemArray->At( index )->UpdateListBoxTextL(); |
|
2861 |
|
2862 if ( iImLoginTypeEdited ) |
|
2863 { |
|
2864 // If changed to something else than manual |
|
2865 // show warning if variated so |
|
2866 if ( iImLoginType != EWVSettingsChatLoginManual && |
|
2867 ( oldLoginType != iImLoginType ) ) |
|
2868 { |
|
2869 // Check variation about password saving warning |
|
2870 TBool showWarning = IntResourceValueL( RSC_CHAT_VARIATION_IMPSCU_SAVE_PW_WARNING ); |
|
2871 |
|
2872 if ( showWarning ) |
|
2873 { |
|
2874 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
2875 |
|
2876 // Read texts from resources |
|
2877 HBufC* warningText = coeEnv->AllocReadResourceLC( |
|
2878 R_CHAT_SAVE_PW_WARNING ); |
|
2879 HBufC* warningHeading = coeEnv->AllocReadResourceLC( |
|
2880 R_CHAT_SAVE_PW_WARNING_HEADING ); |
|
2881 |
|
2882 // Show warning with message query dialog |
|
2883 // CodeScanner warning ignored because CS does not |
|
2884 // notice that PrepareLC puts the dialog to cleanupstack |
|
2885 CAknMessageQueryDialog* dlg = new ( ELeave ) CAknMessageQueryDialog(); // CSI: 35 # See comment above |
|
2886 dlg->PrepareLC( R_WVSETTINGSVIEW_MESSAGE_QUERY_DIALOG ); |
|
2887 dlg->QueryHeading()->SetTextL( *warningHeading ); |
|
2888 dlg->SetMessageTextL( *warningText ); |
|
2889 dlg->RunLD(); |
|
2890 |
|
2891 CleanupStack::PopAndDestroy( 2, warningText ); |
|
2892 } |
|
2893 } |
|
2894 RefreshDialogL(); |
|
2895 } |
|
2896 |
|
2897 DrawNow(); |
|
2898 break; |
|
2899 } |
|
2900 } |
|
2901 } |
|
2902 |
|
2903 // --------------------------------------------------------- |
|
2904 // CWVSettingsUIDialogImp::LaunchDlgCallback() |
|
2905 // (other items were commented in a header). |
|
2906 // --------------------------------------------------------- |
|
2907 // |
|
2908 TInt CWVSettingsUIDialogImp::LaunchDlgCallback( TAny* aDlg ) |
|
2909 { |
|
2910 CWVSettingsUIDialogImp* dlg = static_cast<CWVSettingsUIDialogImp*>( aDlg ); |
|
2911 |
|
2912 dlg->SetTargetDlgFlag( ETrue ); |
|
2913 TRAP_IGNORE( dlg->ActivateCurrentItemL() ); |
|
2914 dlg->SetTargetDlgFlag( EFalse ); |
|
2915 return EFalse; |
|
2916 } |
|
2917 |
|
2918 // --------------------------------------------------------- |
|
2919 // CWVSettingsUIDialogImp::LaunchCorrectDialog() |
|
2920 // (other items were commented in a header). |
|
2921 // --------------------------------------------------------- |
|
2922 // |
|
2923 void CWVSettingsUIDialogImp::LaunchCorrectDialog() |
|
2924 { |
|
2925 |
|
2926 if ( GetTargetDlgFlag() ) |
|
2927 { |
|
2928 return; |
|
2929 } |
|
2930 |
|
2931 if ( !iDlgLauncher->IsActive() ) |
|
2932 { |
|
2933 iDlgLauncher->Call(); |
|
2934 } |
|
2935 } |
|
2936 |
|
2937 |
|
2938 // --------------------------------------------------------- |
|
2939 // CWVSettingsUIDialogImp::SetTargetDlgFlag() |
|
2940 // (other items were commented in a header). |
|
2941 // --------------------------------------------------------- |
|
2942 // |
|
2943 void CWVSettingsUIDialogImp::SetTargetDlgFlag( TBool aFlag ) |
|
2944 { |
|
2945 iIsOpenedTargettDlg = aFlag; |
|
2946 } |
|
2947 |
|
2948 |
|
2949 // --------------------------------------------------------- |
|
2950 // CWVSettingsUIDialogImp::SetTargetDlgFlag() |
|
2951 // (other items were commented in a header). |
|
2952 // --------------------------------------------------------- |
|
2953 // |
|
2954 TBool CWVSettingsUIDialogImp::GetTargetDlgFlag() |
|
2955 { |
|
2956 return iIsOpenedTargettDlg; |
|
2957 } |
|
2958 |
|
2959 |
|
2960 // --------------------------------------------------------- |
|
2961 // CWVSettingsUIDialogImp::CheckAnyStoredServers() |
|
2962 // (other items were commented in a header). |
|
2963 // --------------------------------------------------------- |
|
2964 // |
|
2965 TBool CWVSettingsUIDialogImp::CheckAnyStoredServers() |
|
2966 { |
|
2967 if ( iSAPSettingsStore->SAPCountL( EIMPSIMAccessGroup ) == 0 ) |
|
2968 { |
|
2969 |
|
2970 //exitReason indicate UpdateServerInUseItemL() is required to call or not. |
|
2971 TBool exitReason = ETrue; |
|
2972 QueryNewServerL( &exitReason ); |
|
2973 if ( exitReason ) |
|
2974 { |
|
2975 UpdateServerInUseItemL(); |
|
2976 } |
|
2977 |
|
2978 return EFalse; |
|
2979 } |
|
2980 else |
|
2981 return ETrue; |
|
2982 } |
|
2983 // ----------------------------------------------------------------------------- |
|
2984 // CWVSettingsUIDialogImp::IntResourceValueL() |
|
2985 // ----------------------------------------------------------------------------- |
|
2986 // |
|
2987 TInt CWVSettingsUIDialogImp::IntResourceValueL( TInt aResourceId ) |
|
2988 { |
|
2989 |
|
2990 TInt val( 0 ); |
|
2991 TInt err ( KErrNone ); |
|
2992 CRepository* rep = 0; |
|
2993 |
|
2994 TRAP( err, rep = CRepository::NewL( KCRUidIMNG ) ); |
|
2995 |
|
2996 if ( err == KErrNone ) |
|
2997 { |
|
2998 TInt key = aResourceId + KIMCUStartVariationID; |
|
2999 |
|
3000 err = rep->Get( key, val ); |
|
3001 |
|
3002 delete rep; |
|
3003 } |
|
3004 |
|
3005 if ( err != KErrNone ) |
|
3006 { |
|
3007 |
|
3008 TResourceReader reader; |
|
3009 |
|
3010 aResourceId = aResourceId + RSC_CRRSS_CHAT_VARIATION_IMPSCU_START_ID; |
|
3011 |
|
3012 CCoeEnv::Static()->CreateResourceReaderLC( |
|
3013 reader, |
|
3014 aResourceId ); |
|
3015 val = reader.ReadInt32(); |
|
3016 CleanupStack::PopAndDestroy(); // reader |
|
3017 |
|
3018 } |
|
3019 |
|
3020 return val; |
|
3021 |
|
3022 } |
|
3023 |
|
3024 |
|
3025 /** |
|
3026 * CWVSettingsUI panic handler |
|
3027 * @param aReason The reason for panic. |
|
3028 */ |
|
3029 GLDEF_C void Panic( TWVSettingsViewPanicReason aReason ) |
|
3030 { |
|
3031 User::Panic( KPanicText, aReason ); |
|
3032 } |
|
3033 |
|
3034 |
|
3035 /** |
|
3036 * Help key support - GetHelpContext is called by the framework on |
|
3037 * event EAknCmdHelp |
|
3038 * -------------------------------------------------------------------------------- |
|
3039 * CWVSettingsUIDefineNewServerDialog::GetHelpContext |
|
3040 * @param aContext The context dependent on the current view is passed by the framework. |
|
3041 */ |
|
3042 void CWVSettingsUIDialogImp::GetHelpContext( TCoeHelpContext& aContext ) const |
|
3043 { |
|
3044 aContext.iMajor = KUidChatClient; |
|
3045 aContext.iContext = KIMNG_HLP_SETTINGS ; |
|
3046 } |
|
3047 void CWVSettingsUIDialogImp::ChangeToManualL() |
|
3048 { |
|
3049 ChangeLoginTypeToManualL(); |
|
3050 } |
|
3051 // End of File |