|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: UI Session Manager - does the UI related things like branding |
|
15 * setting status pane icon etc during login, logout, etc. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "CAExternalInterface.h" |
|
23 #include "CCAUISessionManager.h" |
|
24 #include "ChatDebugPrint.h" |
|
25 #include "ChatDebugAssert.h" |
|
26 #include "CCAStatusPaneHandler.h" |
|
27 #include "CCAAppUI.h" |
|
28 #include "CCAApp.h" |
|
29 #include "MCASkinVariant.h" |
|
30 #include "CCAVariantFactory.h" |
|
31 #include "IMDialogUtils.h" |
|
32 #include "IMNoteMapper.h" |
|
33 #include "MCAOpBrandVariant.h" |
|
34 #include "chatngclient.hrh" |
|
35 #include "MCAViewSwitcher.h" |
|
36 #include "IMUtils.h" |
|
37 #include "CCAIdleWait.h" |
|
38 #include "ImpsCSPAllErrors.h" |
|
39 #include "CAViewCreator.h" |
|
40 #include "cacontexticonmapping.h" |
|
41 #include "impsbuilddefinitions.h" |
|
42 #include "CCACommandManagerFactory.h" |
|
43 #include "CCACommandManager.h" |
|
44 #include "MCALoginPC.h" |
|
45 #include "MCAProcessManager.h" |
|
46 #include "MCASettingsPC.h" |
|
47 #include "CCAReactiveAuthorization.h" |
|
48 #include "CAPresenceManager.h" |
|
49 #include "MCAReactiveAuthPC.h" |
|
50 #include "MCAMainViewArrayPC.h" |
|
51 |
|
52 #include <bautils.h> |
|
53 #include <chatNG.rsg> |
|
54 #include <gulicon.h> |
|
55 #include <CIMPSSAPSettingsStore.h> |
|
56 #include <CIMPSSAPSettings.h> |
|
57 #include <CIMPSSAPSettingsList.h> |
|
58 #include <CWVSettingsUINGDialog.h> |
|
59 #include <ImpsServices.h> |
|
60 #include <bldvariant.hrh> |
|
61 #include <centralrepository.h> |
|
62 #include <IMPSServiceSettingsUINGInternalCRKeys.h> |
|
63 #include <aknenv.h> |
|
64 #include <StringLoader.h> |
|
65 #include <barsread.h> |
|
66 #include <mimpsconnprocessobserverng.h> |
|
67 #include <MProfileEngine.h> |
|
68 #include <MProfile.h> |
|
69 #include <Profile.hrh> |
|
70 #include <CPEngNWSessionSlotID2.h> |
|
71 #include <CPEngNWSessionSlot2.h> |
|
72 #include <LayoutMetaData.cdl.h> |
|
73 #include <AknLayoutScalable_Avkon.cdl.h> |
|
74 #include <AknIconUtils.h> |
|
75 #include <e32property.h> |
|
76 #include <alwaysonlinemanagerclient.h> |
|
77 #include <AknDlgShut.h> |
|
78 |
|
79 // The Settings have been moved to Cenrep (also retained in the Resource file), |
|
80 // so the enums for keys and central repository header is added here |
|
81 #include "VariantKeys.h" |
|
82 |
|
83 |
|
84 // CONSTANTS |
|
85 |
|
86 // default always online connection times |
|
87 // when we set the always online we have to set it |
|
88 // really on always, thus start and end time are the same here |
|
89 _LIT( KDefaultScheduleStartTime, "12:00" ); |
|
90 _LIT( KDefaultScheduleEndTime, "12:00" ); |
|
91 _LIT( KIMConnUiResourceFile, "IMPSConnectionUiNG.rsc" ); |
|
92 _LIT( KIMPasswordSaved, "IMPasswordSaved" ); |
|
93 |
|
94 // ============================ MEMBER FUNCTIONS =============================== |
|
95 |
|
96 //Removed the ownership of iConnUI from this file and made it a reference |
|
97 //APPUI owns this connection UI instance and shares the same with this component. |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CCAUISessionManager::CCAUISessionManager |
|
101 // C++ default constructor can NOT contain any code, that |
|
102 // might leave. |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 CCAUISessionManager::CCAUISessionManager( |
|
106 CIMPSPresenceConnectionUi& aConnUI, |
|
107 MCASkinVariant* aSkin, |
|
108 MCAOpBrandVariant* aBrand, |
|
109 MEikCommandObserver* aCommandObserver, |
|
110 MCAViewSwitcher* aViewSwitcher, |
|
111 CCAStatusPaneHandler* aStatusPane, |
|
112 TDes* aBrandMbmFullPath ) |
|
113 |
|
114 : iConnUI( aConnUI ), |
|
115 iCommandObserver( aCommandObserver ), iSkin( aSkin ), iBrand( aBrand ), |
|
116 iStatusPane( aStatusPane ), iBrandMbmFullPath( aBrandMbmFullPath ), |
|
117 iViewSwitcher( aViewSwitcher ), iAliasDes( NULL, 0 ), |
|
118 iCancelLogin( EFalse ) |
|
119 { |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CCAUISessionManager::ConstructL |
|
124 // Symbian 2nd phase constructor can leave. |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void CCAUISessionManager::ConstructL() |
|
128 { |
|
129 |
|
130 iProfileApi = CreateProfileEngineL(); |
|
131 |
|
132 CCAAppUi* appUi = static_cast<CCAAppUi*>( |
|
133 CCoeEnv::Static()->AppUi() ); |
|
134 |
|
135 |
|
136 // reactive authorization |
|
137 MCAReactiveAuthPC* reactiveAuthPC = appUi->GetProcessManager().GetReactiveAuthInterface(); |
|
138 |
|
139 if ( reactiveAuthPC ) |
|
140 { |
|
141 iReactiveAuth = CCAReactiveAuthorization::NewL( *appUi, reactiveAuthPC ); |
|
142 reactiveAuthPC->AddReactiveAuthObserver( iReactiveAuth ); |
|
143 } |
|
144 |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CCAUISessionManager::NewL |
|
149 // Two-phased constructor. |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 CCAUISessionManager* CCAUISessionManager::NewL( CIMPSPresenceConnectionUi& aConnUI, |
|
153 MCASkinVariant* aSkin, |
|
154 MCAOpBrandVariant* aBrand, |
|
155 MEikCommandObserver* aCommandObserver, |
|
156 MCAViewSwitcher* aViewSwitcher, |
|
157 CCAStatusPaneHandler* aStatusPane, |
|
158 TDes* aBrandMbmFullPath ) |
|
159 { |
|
160 CCAUISessionManager* self = new( ELeave ) CCAUISessionManager( aConnUI, aSkin, |
|
161 aBrand, |
|
162 aCommandObserver, |
|
163 aViewSwitcher, |
|
164 aStatusPane, |
|
165 aBrandMbmFullPath ); |
|
166 |
|
167 CleanupStack::PushL( self ); |
|
168 self->ConstructL(); |
|
169 CleanupStack::Pop( self ); |
|
170 return self; |
|
171 } |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // CCAUISessionManager::LoginL |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 TBool CCAUISessionManager::LoginL( MCAUiLoginCmdCB::TLoginParams aLoginParams ) |
|
178 |
|
179 { |
|
180 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
181 appUi->SetFSWExitFlag( EFalse ); |
|
182 |
|
183 if ( aLoginParams == MCAUiLoginCmdCB::ELogin ) |
|
184 { |
|
185 if ( IsLoggedIn() ) |
|
186 { |
|
187 return ETrue; // already logged in |
|
188 } |
|
189 } |
|
190 |
|
191 if ( aLoginParams == MCAUiLoginCmdCB::ELogout ) |
|
192 { |
|
193 if ( !IsLoggedIn() ) |
|
194 { |
|
195 return ETrue; // not logged in |
|
196 } |
|
197 } |
|
198 |
|
199 //CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
200 CCACommandManager* commandManager = CCACommandManagerFactory::InstanceL()->GetCommandManager(); |
|
201 |
|
202 MCACommand* loginCommand = static_cast<MCACommand*>( commandManager->NewCommandLC( EChatClientMainViewCmdLogin, |
|
203 appUi->GetProcessManager(), *this ) ); |
|
204 iLoginParams = aLoginParams; |
|
205 loginCommand->ExecuteCommandL(); |
|
206 CleanupStack::PopAndDestroy(); //loginCommand |
|
207 |
|
208 return IsLoggedIn(); |
|
209 |
|
210 } |
|
211 |
|
212 |
|
213 // Destructor |
|
214 CCAUISessionManager::~CCAUISessionManager() |
|
215 { |
|
216 if ( iProfileApi ) |
|
217 { |
|
218 iProfileApi->Release(); |
|
219 } |
|
220 delete iSessionSlotID; |
|
221 delete iAlias; |
|
222 |
|
223 |
|
224 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
225 MCAReactiveAuthPC* reactiveAuthPC = appUi->GetProcessManager().GetReactiveAuthInterface(); |
|
226 if ( reactiveAuthPC ) |
|
227 { |
|
228 reactiveAuthPC->RemoveReactiveAuthObserver( ); |
|
229 } |
|
230 |
|
231 delete iReactiveAuth; |
|
232 |
|
233 } |
|
234 |
|
235 // ----------------------------------------------------------------------------- |
|
236 // CCAUISessionManager::IsLoggedIn |
|
237 // (other items were commented in a header). |
|
238 // ----------------------------------------------------------------------------- |
|
239 // |
|
240 TBool CCAUISessionManager::IsLoggedIn() const |
|
241 { |
|
242 TBool returnValue( EFalse ); |
|
243 |
|
244 |
|
245 if ( IsOfflineProfileOn() ) |
|
246 { |
|
247 CHAT_DP( D_CHAT_LIT( |
|
248 "CCAUISessionManager::IsLoggedIn, offline profile is ON, returning %d" ), |
|
249 returnValue ); |
|
250 return returnValue; |
|
251 } |
|
252 |
|
253 |
|
254 TRAPD( err, returnValue = iConnUI.LoggedInL( EIMPSConnClientIM ) ); |
|
255 |
|
256 if ( err ) |
|
257 { |
|
258 returnValue = EFalse; |
|
259 } |
|
260 |
|
261 CHAT_DP( D_CHAT_LIT( "CCAUISessionManager::IsLoggedIn returning %d" ), |
|
262 returnValue ); |
|
263 |
|
264 // if there are no slots in the system then we get KErrNotFound |
|
265 // and we don't show it to the user |
|
266 if ( ( err != KErrNone ) && ( err != KErrNotFound ) ) |
|
267 { |
|
268 CActiveScheduler::Current()->Error( err ); |
|
269 } |
|
270 |
|
271 |
|
272 return returnValue; |
|
273 } |
|
274 // ----------------------------------------------------------------------------- |
|
275 // CCAUISessionManager::ShowProcessingNoteLC |
|
276 // (other items were commented in a header). |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 void CCAUISessionManager::ShowProcessingNoteLC() |
|
280 { |
|
281 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
282 appUi->ShowWaitDialogLC( R_QTN_GEN_NOTE_PROCESSING, ETrue ); |
|
283 } |
|
284 |
|
285 |
|
286 |
|
287 // --------------------------------------------------------- |
|
288 // CCAUISessionManager::SetStatusPaneIconsL() |
|
289 // (other items were commented in a header). |
|
290 // --------------------------------------------------------- |
|
291 // |
|
292 void CCAUISessionManager::SetStatusPaneIconsL( TBool aLandscapeOnly /*= EFalse*/ ) |
|
293 { |
|
294 TBool landscape( Layout_Meta_Data::IsLandscapeOrientation() ); |
|
295 if ( !landscape && aLandscapeOnly ) |
|
296 { |
|
297 // do nothing if we're not in landscape mode and update |
|
298 // was requested only for landscape |
|
299 return; |
|
300 } |
|
301 |
|
302 // If client has not gave handle to statuspane or skin then do nothing |
|
303 if ( !iStatusPane || !iSkin ) |
|
304 { |
|
305 return; |
|
306 } |
|
307 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
308 CAknTitlePane* title = static_cast< CAknTitlePane* > |
|
309 ( CEikonEnv::Static()->AppUiFactory()->StatusPane()->ControlL( |
|
310 TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
311 // get the visibility of context pane |
|
312 CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()-> |
|
313 StatusPane(); |
|
314 CAknContextPane* contextPane = static_cast<CAknContextPane*>( statusPane->ControlL( |
|
315 TUid::Uid( EEikStatusPaneUidContext ) ) ); |
|
316 TBool cpVisible( contextPane ? contextPane->IsVisible() : EFalse ); |
|
317 |
|
318 TBool useTitle( !cpVisible || landscape ); |
|
319 |
|
320 // Load online-icon |
|
321 TInt32 iconId( useTitle ? EMenu_im_off_title : EMenu_im_off ); |
|
322 TInt32 iconMaskId( useTitle ? EMenu_im_off_title_mask : EMenu_im_off_mask ); |
|
323 |
|
324 |
|
325 TBool alreadyLoggedOut( EFalse ); |
|
326 CCACommandManager* commandManager = CCACommandManagerFactory::InstanceL()->GetCommandManager(); |
|
327 MCASessionHandlerCmd* sessHandlerCmd = commandManager->GetSessionHandlerCmd() ; |
|
328 if ( sessHandlerCmd ) |
|
329 { |
|
330 alreadyLoggedOut = sessHandlerCmd->IsAlreadyLoggedOut(); |
|
331 } |
|
332 |
|
333 if ( IsLoggedIn() && !alreadyLoggedOut ) |
|
334 { |
|
335 //CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
336 MCAMainViewArrayPC* mainViewArrayPC = appUi->GetProcessManager().GetArrayInterface(); |
|
337 |
|
338 // Resolve icon by own status & screen orientation |
|
339 switch ( mainViewArrayPC->StatusL() ) |
|
340 { |
|
341 case TEnumsPC::EOffline: |
|
342 { |
|
343 if ( useTitle ) |
|
344 { |
|
345 iconId = EMenu_im_invisible_title; |
|
346 iconMaskId = EMenu_im_invisible_title_mask; |
|
347 } |
|
348 else // portrait |
|
349 { |
|
350 iconId = EMenu_im_invisible; |
|
351 iconMaskId = EMenu_im_invisible_mask; |
|
352 } |
|
353 break; |
|
354 } |
|
355 case TEnumsPC::EAway: |
|
356 { |
|
357 if ( useTitle ) |
|
358 { |
|
359 iconId = EMenu_im_away_title; |
|
360 iconMaskId = EMenu_im_away_title_mask; |
|
361 } |
|
362 else // portrait |
|
363 { |
|
364 iconId = EMenu_im_away; |
|
365 iconMaskId = EMenu_im_away_mask; |
|
366 } |
|
367 break; |
|
368 } |
|
369 case TEnumsPC::EBusy: |
|
370 { |
|
371 if ( useTitle ) |
|
372 { |
|
373 iconId = EMenu_im_busy_title; |
|
374 iconMaskId = EMenu_im_busy_title_mask; |
|
375 } |
|
376 else // portrait |
|
377 { |
|
378 iconId = EMenu_im_busy; |
|
379 iconMaskId = EMenu_im_busy_mask; |
|
380 } |
|
381 break; |
|
382 } |
|
383 case TEnumsPC::EOnline: // Flowthrough |
|
384 default: |
|
385 { |
|
386 if ( useTitle ) |
|
387 { |
|
388 iconId = EMenu_im_on_title; |
|
389 iconMaskId = EMenu_im_on_title_mask; |
|
390 } |
|
391 else // portrait |
|
392 { |
|
393 iconId = EMenu_im_on; |
|
394 iconMaskId = EMenu_im_on_mask; |
|
395 } |
|
396 break; |
|
397 } |
|
398 } |
|
399 |
|
400 } |
|
401 |
|
402 |
|
403 CGulIcon* connStatusIcon = iSkin->LoadBitmapL( iconId, |
|
404 iconMaskId, |
|
405 *iBrandMbmFullPath ); |
|
406 connStatusIcon->SetBitmapsOwnedExternally( EFalse ); |
|
407 CleanupStack::PushL( connStatusIcon ); |
|
408 |
|
409 |
|
410 // get the visibility of context pane |
|
411 |
|
412 if ( useTitle ) |
|
413 { |
|
414 //Icon is not required in Settings |
|
415 if ( appUi->IsSettingsDialogActive() ) |
|
416 { |
|
417 title->SetSmallPicture( NULL, NULL, EFalse ); |
|
418 } |
|
419 else |
|
420 { |
|
421 // with thin status pane we are setting the status icon to title pane |
|
422 title->SetSmallPicture( connStatusIcon->Bitmap(), connStatusIcon->Mask(), ETrue ); |
|
423 // ownership was transferred |
|
424 connStatusIcon->SetBitmapsOwnedExternally( ETrue ); |
|
425 } |
|
426 |
|
427 } |
|
428 else |
|
429 { |
|
430 //Icon is not required in Settings |
|
431 if ( appUi->IsSettingsDialogActive() ) |
|
432 { |
|
433 iStatusPane->SetPicture( NULL, NULL ); |
|
434 } |
|
435 else |
|
436 { |
|
437 // in portrait mode we are setting the status icon to status pane |
|
438 iStatusPane->SetPicture( connStatusIcon->Bitmap(), connStatusIcon->Mask() ); |
|
439 // ownership was transferred |
|
440 connStatusIcon->SetBitmapsOwnedExternally( ETrue ); |
|
441 } |
|
442 |
|
443 |
|
444 |
|
445 if ( title ) |
|
446 { |
|
447 // and title pane icon must be cleared |
|
448 title->SetSmallPicture( NULL, NULL, EFalse ); |
|
449 } |
|
450 } |
|
451 |
|
452 CleanupStack::PopAndDestroy( connStatusIcon ); |
|
453 } |
|
454 |
|
455 |
|
456 |
|
457 // --------------------------------------------------------- |
|
458 // CCAUISessionManager::CheckCurrentServerDataL |
|
459 // (other items were commented in a header). |
|
460 // --------------------------------------------------------- |
|
461 // |
|
462 TBool CCAUISessionManager::CheckCurrentServerDataL( |
|
463 TBool /*aShowNote*/ /*= ETrue*/ ) |
|
464 { |
|
465 // SAP settings store |
|
466 CIMPSSAPSettingsStore* sapSettingsStore = CIMPSSAPSettingsStore::NewLC(); |
|
467 TInt exitReason( 0 ); |
|
468 |
|
469 if ( sapSettingsStore->SAPCountL( EIMPSIMAccessGroup ) == 0 ) |
|
470 { |
|
471 |
|
472 TUid activeView( TUid::Null() ); |
|
473 if ( iStatusPane && iViewSwitcher ) |
|
474 { |
|
475 iStatusPane->ClearNaviPaneL(); |
|
476 //iStatusPane->ProhibitTabGroup(); //For Later Ref. |
|
477 activeView = iViewSwitcher->ActiveViewId(); |
|
478 } |
|
479 |
|
480 CWVSettingsUIDialog* dlg = CWVSettingsUIDialog::NewL(); |
|
481 CleanupStack::PushL( dlg ); |
|
482 |
|
483 TPtrC empty( KNullDesC ); |
|
484 |
|
485 // The fourth argument is newly added, that is for aResourceVariationFile, which is passed as empty |
|
486 TInt retVal( dlg->RunDialogLD( *sapSettingsStore, |
|
487 NULL, |
|
488 empty, |
|
489 empty, |
|
490 exitReason, |
|
491 NULL, |
|
492 &dlg, |
|
493 EFalse, |
|
494 EWVSettingsDefineServer ) ); |
|
495 CleanupStack::Pop(); // dlg |
|
496 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
497 |
|
498 appUi->GetProcessManager().GetArrayInterface()->ResetArray( ETrue ); |
|
499 |
|
500 if ( iStatusPane && iViewSwitcher ) |
|
501 { |
|
502 //iStatusPane->ProhibitTabGroup( EFalse ); //For Later Ref. |
|
503 iStatusPane->ShowTabGroupL( activeView ); |
|
504 } |
|
505 |
|
506 if ( retVal == EWVSettingsViewExitCalled && iCommandObserver ) |
|
507 { |
|
508 iCommandObserver->ProcessCommandL( EChatClientCmdExit ); |
|
509 } |
|
510 |
|
511 if ( exitReason == EServerSaved ) |
|
512 { |
|
513 // update branding |
|
514 BrandUIL(); |
|
515 |
|
516 } |
|
517 else |
|
518 { |
|
519 // If user didn't create any servers, he/she must be able |
|
520 // to use other views also (eg. settings) so let's finalize the |
|
521 // construction |
|
522 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
523 appUi->FinalizeChatConstructionL(); |
|
524 } |
|
525 } |
|
526 CleanupStack::PopAndDestroy( sapSettingsStore ); |
|
527 |
|
528 return exitReason == EServerSaved; // return "did user save server" |
|
529 } |
|
530 // --------------------------------------------------------- |
|
531 // CCAUISessionManager::HandleSapAccessEventEventL |
|
532 // (other items were commented in a header). |
|
533 // --------------------------------------------------------- |
|
534 // |
|
535 void CCAUISessionManager::HandleSapAccessEventEventL( const TDesC& aServerName, |
|
536 const TDesC& /*aServerURL*/, |
|
537 MIMPSConnProcessUi* aConnProcessUi ) |
|
538 { |
|
539 // If no branding support available |
|
540 if ( !iBrand ) |
|
541 { |
|
542 return; |
|
543 } |
|
544 |
|
545 TFileName brandedResource; |
|
546 TPtrC resId( KIMConnUiResourceFile() ); |
|
547 TPtrC server( aServerName ); |
|
548 |
|
549 iBrand->CurrentResourceFileL( server, resId, brandedResource ); |
|
550 |
|
551 if ( brandedResource.Length() != 0 ) |
|
552 { |
|
553 BaflUtils::NearestLanguageFile( CEikonEnv::Static()->FsSession(), |
|
554 brandedResource ); |
|
555 } |
|
556 |
|
557 #ifdef _DEBUG |
|
558 |
|
559 TPtrC ptr( brandedResource ); |
|
560 CHAT_DP( D_CHAT_LIT( |
|
561 "CCAUISessionManagerCmd::HandleSapAccessEventEventL \ |
|
562 setting %S to be connUI resfile" ), |
|
563 &ptr ); |
|
564 #endif |
|
565 |
|
566 aConnProcessUi->UseResourceFileL( brandedResource ); |
|
567 |
|
568 TInt err = RProperty::Set( KBrandingUid, KBrandingResourceKey, brandedResource ); |
|
569 |
|
570 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
571 appUi->ChangeConnUiAgentResourceL( brandedResource ); |
|
572 } |
|
573 |
|
574 |
|
575 // --------------------------------------------------------- |
|
576 // CCAUISessionManager::ShowPostLoginNotesL |
|
577 // (other items were commented in a header). |
|
578 // --------------------------------------------------------- |
|
579 // |
|
580 void CCAUISessionManager::ShowPostLoginNotesL ( TBool aCurrentLoginIsFirst, |
|
581 TBool aManualLogin ) |
|
582 { |
|
583 |
|
584 iCurrentLoginIsFirst = aCurrentLoginIsFirst; |
|
585 |
|
586 |
|
587 // Show post-login notes if not always online case |
|
588 if ( aManualLogin ) |
|
589 { |
|
590 // make sure the order stays intact, otherwise |
|
591 // certain flags (iUidAndPasswordSaved and iCurrentLoginIsFirst) |
|
592 // will not be set correctly and behaviour will be buggy |
|
593 ShowWelcomeNoteL(); |
|
594 if ( !IsLoggedIn() ) |
|
595 { |
|
596 // Forced log out may happen while |
|
597 // note is being displayed, don't continue |
|
598 // with login |
|
599 return; |
|
600 } |
|
601 ShowPasswordQueriesL(); |
|
602 if ( !IsLoggedIn() ) |
|
603 { |
|
604 // Forced log out may happen while |
|
605 // queries are being displayed, don't continue |
|
606 // with login |
|
607 return; |
|
608 } |
|
609 ShowApplicationLaunchQueryL(); |
|
610 if ( !IsLoggedIn() ) |
|
611 { |
|
612 // Forced log out may happen while |
|
613 // query is being displayed, don't continue |
|
614 // with login |
|
615 return; |
|
616 } |
|
617 ShowAlwaysOnlineAfterFirstLoginL(); |
|
618 if ( !IsLoggedIn() ) |
|
619 { |
|
620 // Forced log out may happen while |
|
621 // query is being displayed, don't continue |
|
622 // with login |
|
623 return; |
|
624 } |
|
625 } |
|
626 |
|
627 |
|
628 // ask for own alias if it's not defined (if alias is supported) |
|
629 AskAliasL(); |
|
630 |
|
631 if ( !IsLoggedIn() ) |
|
632 { |
|
633 // Forced log out may happen while |
|
634 // query is being displayed, don't continue |
|
635 // with login |
|
636 return; |
|
637 } |
|
638 |
|
639 } |
|
640 // --------------------------------------------------------- |
|
641 // CCAUISessionManager::AskAliasL |
|
642 // (other items were commented in a header). |
|
643 // --------------------------------------------------------- |
|
644 // |
|
645 void CCAUISessionManager::AskAliasL() |
|
646 { |
|
647 iSupportAlias = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_HAVE_ALIAS ); |
|
648 if ( ! iSupportAlias ) |
|
649 { |
|
650 // no alias |
|
651 return; |
|
652 } |
|
653 |
|
654 TBool aliasMandatory = |
|
655 IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_ALIAS_MANDATORY ); |
|
656 |
|
657 // check if there's already an alias in the client |
|
658 |
|
659 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
660 |
|
661 HBufC* ownAlias = appUi->GetProcessManager().GetSettingsInterface()-> |
|
662 GetSapSettingValuePCL( TEnumsPC::EOwnAlias ); |
|
663 |
|
664 TBool aliasDefined = ( ownAlias != NULL ); // CSI: 64 # pointer -> boolean. |
|
665 |
|
666 CleanupStack::PushL( ownAlias ); |
|
667 if ( ! aliasDefined ) |
|
668 { |
|
669 // 1. Show "you need to define alias"-infonote with OK |
|
670 // - show only be shown when alias is mandatory |
|
671 if ( aliasMandatory ) |
|
672 { |
|
673 IMDialogUtils::DisplayQueryDialogL( R_QTN_CHAT_NO_ALIAS_DEF ); |
|
674 } |
|
675 |
|
676 if ( !IsLoggedIn() ) |
|
677 { |
|
678 // Forced log out may happen while |
|
679 // note is being displayed, don't continue |
|
680 // with text query |
|
681 CleanupStack::PopAndDestroy( ownAlias ); |
|
682 return; |
|
683 } |
|
684 |
|
685 |
|
686 // Show alias data query |
|
687 if ( iAlias ) |
|
688 { |
|
689 delete iAlias; |
|
690 iAlias = NULL; |
|
691 } |
|
692 |
|
693 iAlias = HBufC::NewL( KAliasMaxLength ); |
|
694 iAliasDes.Set( iAlias->Des() ); |
|
695 |
|
696 TInt result = IMDialogUtils::DisplayTextQueryDialogL( iAliasDes, |
|
697 R_QTN_CHAT_ALIAS_PROMPT, |
|
698 R_CHATCLIENT_LOGIN_ALIAS_QUERY, |
|
699 ETrue // T9 |
|
700 ); |
|
701 |
|
702 if ( !IsLoggedIn() ) |
|
703 { |
|
704 // Forced log out may happen while |
|
705 // query is being displayed, don't continue |
|
706 // with alias publishing |
|
707 CleanupStack::PopAndDestroy( ownAlias ); |
|
708 return; |
|
709 } |
|
710 |
|
711 if ( result == EAknSoftkeyDone || result == EAknSoftkeyOk ) |
|
712 { |
|
713 aliasDefined = ETrue; |
|
714 iCancelLogin = EFalse; |
|
715 } |
|
716 else |
|
717 { |
|
718 if ( aliasMandatory ) |
|
719 { |
|
720 // when the user cancels we must return to the |
|
721 // state before the alias query, |
|
722 // so try to cancel the login |
|
723 iCancelLogin = ETrue; |
|
724 } |
|
725 else |
|
726 { |
|
727 // continue login normally with empty alias |
|
728 iCancelLogin = EFalse; |
|
729 aliasDefined = EFalse; |
|
730 TRAP_IGNORE( appUi->GetProcessManager().GetSettingsInterface()-> |
|
731 SetSapSettingValuePCL ( TEnumsPC::EOwnAlias , KNullDesC ) ); |
|
732 } |
|
733 } |
|
734 |
|
735 CleanupStack::PopAndDestroy( ownAlias ); |
|
736 } |
|
737 else |
|
738 { |
|
739 // already have an alias defined |
|
740 delete iAlias; |
|
741 iAlias = ownAlias; |
|
742 iAliasDes.Set( iAlias->Des() ); |
|
743 CleanupStack::Pop( ownAlias ); |
|
744 } |
|
745 |
|
746 if ( aliasDefined ) |
|
747 { |
|
748 // publish and subscribe here all variated attributes. |
|
749 |
|
750 TBool exitLoop( EFalse ); |
|
751 while ( !exitLoop ) |
|
752 { |
|
753 // show saving alias name wait note |
|
754 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
755 appUi->ShowWaitDialogL( R_QTN_CHAT_SAVING_ALIAS, ETrue ); |
|
756 |
|
757 // store alias to settings: PUBLISH alias attribute in IM Presence |
|
758 // when it gets the settings changed event. |
|
759 |
|
760 |
|
761 TRAPD( err, appUi->GetProcessManager().GetSettingsInterface()-> |
|
762 SetSapSettingValuePCL ( TEnumsPC::EOwnAlias , iAliasDes ) ); |
|
763 |
|
764 TBool invalidAlias( EFalse ); |
|
765 |
|
766 if ( err == ECSPInvalidPresenceValue ) |
|
767 { |
|
768 // this means the alias is too long or invalid |
|
769 // we cannot show the note "in the normal" way since this |
|
770 // error requires a special note in this case |
|
771 // so now we give KErrNone to DismissWaitDialogL and show |
|
772 // the note here |
|
773 invalidAlias = ETrue; |
|
774 err = KErrNone; |
|
775 } |
|
776 // dismiss wait |
|
777 appUi->DismissWaitDialogL( err, EFalse, KNullDesC ); |
|
778 |
|
779 if ( invalidAlias ) |
|
780 { |
|
781 // show error note |
|
782 HBufC* text = StringLoader::LoadLC( R_QTN_CHAT_TOO_LONG_ALIAS_TEXT ); |
|
783 IMDialogUtils::DisplayErrorNoteL( *text ); |
|
784 CleanupStack::PopAndDestroy( text ); |
|
785 // return to editing |
|
786 TInt result = IMDialogUtils::DisplayTextQueryDialogL( iAliasDes, |
|
787 R_QTN_CHAT_ALIAS_PROMPT, |
|
788 R_CHATCLIENT_LOGIN_ALIAS_QUERY, |
|
789 ETrue // T9 |
|
790 ); |
|
791 if ( result == EAknSoftkeyDone || result == EAknSoftkeyOk ) |
|
792 { |
|
793 aliasDefined = ETrue; |
|
794 iCancelLogin = EFalse; |
|
795 } |
|
796 else |
|
797 { |
|
798 if ( aliasMandatory ) |
|
799 { |
|
800 // when the user cancels we must return to the |
|
801 // state before the alias query, |
|
802 // so try to cancel the login |
|
803 iCancelLogin = ETrue; |
|
804 } |
|
805 else |
|
806 { |
|
807 // continue login normally with empty alias |
|
808 iCancelLogin = EFalse; |
|
809 aliasDefined = ETrue; |
|
810 TRAP_IGNORE( appUi->GetProcessManager().GetSettingsInterface()-> |
|
811 SetSapSettingValuePCL ( TEnumsPC::EOwnAlias , KNullDesC ) ); |
|
812 } |
|
813 exitLoop = ETrue; |
|
814 } |
|
815 |
|
816 } |
|
817 else |
|
818 { |
|
819 // set the alias for own status item |
|
820 exitLoop = ETrue; |
|
821 MCALoginPC* loginPC = appUi->GetProcessManager().GetLogInInterface(); |
|
822 loginPC->SetAliasL( iAliasDes ); |
|
823 } |
|
824 } |
|
825 } |
|
826 |
|
827 } |
|
828 // --------------------------------------------------------- |
|
829 // CCAUISessionManager::ShowWelcomeNoteL |
|
830 // (other items were commented in a header). |
|
831 // --------------------------------------------------------- |
|
832 // |
|
833 void CCAUISessionManager::ShowWelcomeNoteL() |
|
834 { |
|
835 if ( ! IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_WELCOME_NOTE ) ) |
|
836 { |
|
837 // welcome note not enabled |
|
838 return; |
|
839 } |
|
840 |
|
841 if ( iCurrentLoginIsFirst ) |
|
842 { |
|
843 HBufC* welcomeTxt = |
|
844 CCoeEnv::Static()->AllocReadResourceLC( |
|
845 R_CHAT_WELCOME_NOTE ); |
|
846 |
|
847 HBufC* welcomeHeading = |
|
848 CCoeEnv::Static()->AllocReadResourceLC( |
|
849 R_CHAT_WELCOME_NOTE_HEADING ); |
|
850 |
|
851 if ( welcomeTxt->Length() > 0 ) |
|
852 { |
|
853 IMDialogUtils::DisplayMessageQueryDialogL( |
|
854 R_CHATCLIENT_WELCOME_NOTE_DIALOG, |
|
855 *welcomeTxt, *welcomeHeading, |
|
856 EFalse // T9 |
|
857 ); |
|
858 } |
|
859 |
|
860 CleanupStack::PopAndDestroy( 2, welcomeTxt ); |
|
861 } |
|
862 |
|
863 } |
|
864 // --------------------------------------------------------- |
|
865 // CCAUISessionManager::CancelLoginValue |
|
866 // --------------------------------------------------------- |
|
867 // |
|
868 TBool CCAUISessionManager::CancelLoginValue() |
|
869 { |
|
870 return iCancelLogin; |
|
871 } |
|
872 // --------------------------------------------------------- |
|
873 // CCAUISessionManager::IMUIPIConForcedClear |
|
874 // --------------------------------------------------------- |
|
875 // |
|
876 void CCAUISessionManager::IMUIPIConForcedClear() |
|
877 { |
|
878 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
879 appUi->IMUIPIConForcedClear(); |
|
880 } |
|
881 |
|
882 // --------------------------------------------------------- |
|
883 // CCAUISessionManager::IMUIPIConForcedClear |
|
884 // --------------------------------------------------------- |
|
885 // |
|
886 void CCAUISessionManager::ShutDialogsL() |
|
887 { |
|
888 CHAT_DP_FUNC_DP( "CCAUISessionManager", "ShutDialogsL..." ); |
|
889 AknDialogShutter::ShutDialogsL( *CEikonEnv::Static() ); |
|
890 } |
|
891 |
|
892 // --------------------------------------------------------- |
|
893 // CCAUISessionManager::CaptureEventsL |
|
894 // --------------------------------------------------------- |
|
895 // |
|
896 void CCAUISessionManager::CaptureEventsL() |
|
897 { |
|
898 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
899 appUi->CaptureEventsL(); |
|
900 } |
|
901 // --------------------------------------------------------- |
|
902 // CCAUISessionManager::ReleaseCapturingL |
|
903 // --------------------------------------------------------- |
|
904 // |
|
905 void CCAUISessionManager::ReleaseCapturingL() |
|
906 { |
|
907 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
908 appUi->ReleaseCapturingL(); |
|
909 } |
|
910 // --------------------------------------------------------- |
|
911 // CCAUISessionManager::RefreshViewAfterLoginL |
|
912 // --------------------------------------------------------- |
|
913 // |
|
914 void CCAUISessionManager::RefreshViewAfterLoginL() |
|
915 { |
|
916 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
917 CCAIdleWait::IdleWaitL( &( appUi->RefreshWaitFlag() ) ); |
|
918 } |
|
919 |
|
920 |
|
921 // --------------------------------------------------------- |
|
922 // CCAUISessionManager::ShowPasswordQueriesL |
|
923 // (other items were commented in a header). |
|
924 // --------------------------------------------------------- |
|
925 // |
|
926 void CCAUISessionManager::ShowPasswordQueriesL() |
|
927 { |
|
928 // Password save query logic |
|
929 // 1. if first login and id/pw not already saved, then ask to save pw |
|
930 // 2. if password has changed, then ask to save pw |
|
931 // 3. if uid has changed, then ask to save uid + pw |
|
932 |
|
933 iUidAndPasswordSaved = EFalse; |
|
934 |
|
935 TBool passwordQueries = |
|
936 IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SAVE_PW_QUERY ); |
|
937 |
|
938 if ( ! passwordQueries ) |
|
939 { |
|
940 // not enabled |
|
941 return; |
|
942 } |
|
943 |
|
944 CIMPSSAPSettings* currentSAP = CurrentSAPLC(); |
|
945 |
|
946 // get logged in SAP from IMPSCUI |
|
947 CIMPSSAPSettings* loggedInSap = CIMPSSAPSettings::NewLC(); |
|
948 iConnUI.GetLoggedInSapL( *iSessionSlotID, *loggedInSap ); |
|
949 |
|
950 // get current SAP from SSS |
|
951 CIMPSSAPSettingsStore* sapStore = CIMPSSAPSettingsStore::NewLC(); |
|
952 CIMPSSAPSettingsList* sapList = CIMPSSAPSettingsList::NewLC(); |
|
953 sapStore->PopulateSAPSettingsListL( *sapList, EIMPSIMAccessGroup ); |
|
954 TInt index = KErrNotFound; |
|
955 |
|
956 sapList->FindNameL( currentSAP->SAPName(), index ); |
|
957 if ( index == KErrNotFound ) |
|
958 { |
|
959 // something went wrong, didn't find it |
|
960 User::Leave( index ); |
|
961 } |
|
962 |
|
963 CIMPSSAPSettings* storedSap = CIMPSSAPSettings::NewLC(); |
|
964 TUint32 sapUid = sapList->UidForIndex( index ); |
|
965 sapStore->GetSAPL( sapUid, storedSap ); |
|
966 |
|
967 // now we have the logged in SAP and the SAP from SSS, |
|
968 // find out userid and passwords |
|
969 const TDesC& loggedInUid = loggedInSap->SAPUserId(); |
|
970 const TDesC& loggedInPassWd = loggedInSap->SAPUserPassword(); |
|
971 |
|
972 const TDesC& storedUid = storedSap->SAPUserId(); |
|
973 const TDesC& storedPassWd = storedSap->SAPUserPassword(); |
|
974 |
|
975 // find out any changes |
|
976 TBool uidSame = 0 == storedUid.Compare( loggedInUid ); |
|
977 TBool pwSame = 0 == storedPassWd.Compare( loggedInPassWd ); |
|
978 |
|
979 // Check if pw has been saved earlier |
|
980 TInt pwSaved = 0; |
|
981 TInt sapError = -1; |
|
982 sapError = storedSap->GetOpaqueInt( KIMPasswordSaved, pwSaved ); |
|
983 |
|
984 if ( sapError != KErrNotFound ) |
|
985 { |
|
986 User::LeaveIfError( sapError ); |
|
987 } |
|
988 |
|
989 if ( iCurrentLoginIsFirst && ( !pwSame || !uidSame ) ) |
|
990 { |
|
991 // first login to this server (without saved login data) |
|
992 TInt savePw = IMDialogUtils::DisplayYesNoConfirmationDialogL( R_QTN_CHAT_LOGIN_SAVE_PW ); |
|
993 if ( savePw ) |
|
994 { |
|
995 ShowPasswordSavingWarningL(); |
|
996 // save username + password to SAP settings |
|
997 storedSap->SetSAPUserIdL( loggedInUid ); |
|
998 storedSap->SetSAPUserPasswordL( loggedInPassWd ); |
|
999 // set password saved indication |
|
1000 storedSap->SetOpaqueInt( KIMPasswordSaved, ETrue ); |
|
1001 |
|
1002 // save directly to SSS |
|
1003 sapStore->UpdateOldSAPL( storedSap, sapUid ); |
|
1004 |
|
1005 iUidAndPasswordSaved = ETrue; |
|
1006 } |
|
1007 else |
|
1008 { |
|
1009 // save only the username to SAP settings |
|
1010 storedSap->SetSAPUserIdL( loggedInUid ); |
|
1011 |
|
1012 // save directly to SSS |
|
1013 sapStore->UpdateOldSAPL( storedSap, sapUid ); |
|
1014 } |
|
1015 } |
|
1016 else if ( pwSaved && !pwSame && uidSame && !iCurrentLoginIsFirst ) |
|
1017 { |
|
1018 // Not first login, saved password (not uid) has changed |
|
1019 TInt savePw = IMDialogUtils::DisplayYesNoConfirmationDialogL( R_QTN_CHAT_LOGIN_SAVE_PW ); |
|
1020 if ( savePw ) |
|
1021 { |
|
1022 ShowPasswordSavingWarningL(); |
|
1023 // save new password to SAP settings |
|
1024 storedSap->SetSAPUserPasswordL( loggedInPassWd ); |
|
1025 |
|
1026 // save directly to SSS |
|
1027 sapStore->UpdateOldSAPL( storedSap, sapUid ); |
|
1028 |
|
1029 iUidAndPasswordSaved = ETrue; |
|
1030 } |
|
1031 |
|
1032 } |
|
1033 else if ( !uidSame ) |
|
1034 { |
|
1035 // not first login and user id has changed |
|
1036 if ( IMDialogUtils::DisplayYesNoConfirmationDialogL( R_QTN_CHAT_LOGIN_SAVE_USERNAME_PW ) ) |
|
1037 { |
|
1038 ShowPasswordSavingWarningL(); |
|
1039 // user wants to save both uid and pw |
|
1040 storedSap->SetSAPUserIdL( loggedInUid ); |
|
1041 storedSap->SetSAPUserPasswordL( loggedInPassWd ); |
|
1042 |
|
1043 // save directly to SSS |
|
1044 sapStore->UpdateOldSAPL( storedSap, sapUid ); |
|
1045 |
|
1046 iUidAndPasswordSaved = ETrue; |
|
1047 } |
|
1048 } |
|
1049 else if ( iCurrentLoginIsFirst && pwSame && uidSame ) |
|
1050 { |
|
1051 // This is first login with already saved login data |
|
1052 iUidAndPasswordSaved = ETrue; |
|
1053 } |
|
1054 |
|
1055 CleanupStack::PopAndDestroy( 5, currentSAP ); // storedSap, sapList, sapStore, loggedInSap, currentSAP |
|
1056 } |
|
1057 |
|
1058 // --------------------------------------------------------- |
|
1059 // CCAUISessionManager::ApplicationLaunchQueryL |
|
1060 // (other items were commented in a header). |
|
1061 // --------------------------------------------------------- |
|
1062 // |
|
1063 void CCAUISessionManager::ShowApplicationLaunchQueryL() |
|
1064 { |
|
1065 TBool launchQuery = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_APP_LAUNCH_QUERY ); |
|
1066 |
|
1067 if ( ! launchQuery || ! iUidAndPasswordSaved ) |
|
1068 { |
|
1069 // not enabled or userid + password were not saved |
|
1070 return; |
|
1071 } |
|
1072 |
|
1073 TInt chatLoginType = IMUtils::WVSettingsChatLoginValue(); |
|
1074 TBool isDefault = CurrentServerIsDefaultL(); |
|
1075 |
|
1076 if ( chatLoginType == EWVSettingsChatLoginApplicationLaunch |
|
1077 && isDefault ) |
|
1078 { |
|
1079 // application launch active and this server is default server, so |
|
1080 // get out |
|
1081 return; |
|
1082 } |
|
1083 |
|
1084 TInt activate = IMDialogUtils::DisplayYesNoConfirmationDialogL( R_QTN_CHAT_LOGIN_ACTIVATE_APPLAUNCH ); |
|
1085 |
|
1086 if ( activate ) |
|
1087 { |
|
1088 ShowPasswordSavingWarningL(); |
|
1089 // change login type for Application Launch |
|
1090 SetLoginTypeL( EWVSettingsChatLoginApplicationLaunch ); |
|
1091 |
|
1092 // change default server to be the current one |
|
1093 SetCurrentServerAsDefaultL(); |
|
1094 } |
|
1095 else |
|
1096 { |
|
1097 // login type will become Manual |
|
1098 SetLoginTypeL( EWVSettingsChatLoginManual ); |
|
1099 } |
|
1100 |
|
1101 } |
|
1102 |
|
1103 // --------------------------------------------------------- |
|
1104 // CCAUISessionManager::ShowAlwaysOnlineAfterFirstLogin |
|
1105 // --------------------------------------------------------- |
|
1106 |
|
1107 void CCAUISessionManager::ShowAlwaysOnlineAfterFirstLoginL() |
|
1108 { |
|
1109 // check if login type need to be set as always online in home |
|
1110 // network according to variation |
|
1111 if ( ! IMUtils::IntResourceValueL( |
|
1112 RSC_CHAT_VARIATION_ALWAYSONLINE_AFTER_FIRST_LOGIN ) ) |
|
1113 { |
|
1114 return; |
|
1115 } |
|
1116 |
|
1117 if ( iCurrentLoginIsFirst ) |
|
1118 { |
|
1119 SetCurrentServerAsDefaultL(); |
|
1120 |
|
1121 if ( LoginType() == EIMPSManualLogin ) |
|
1122 { |
|
1123 TInt retVal( |
|
1124 IMDialogUtils::DisplayYesNoConfirmationDialogL( |
|
1125 R_QTN_CHAT_SET_AO_ON ) ); |
|
1126 |
|
1127 ShowPasswordSavingWarningL(); |
|
1128 |
|
1129 |
|
1130 if ( retVal == EAknSoftkeyOk || retVal == EAknSoftkeyYes ) |
|
1131 { |
|
1132 // change login type to always online in home network |
|
1133 SetLoginTypeL( EWVSettingsChatLoginAutoAlways ); |
|
1134 } |
|
1135 else |
|
1136 { |
|
1137 // change login type to application launch |
|
1138 SetLoginTypeL( EWVSettingsChatLoginApplicationLaunch ); |
|
1139 } |
|
1140 } |
|
1141 } |
|
1142 } |
|
1143 // --------------------------------------------------------- |
|
1144 // CCAUISessionManager::SetLoginTypeL |
|
1145 // (other items were commented in a header). |
|
1146 // --------------------------------------------------------- |
|
1147 // |
|
1148 void CCAUISessionManager::SetLoginTypeL( TWVSettingsChatLoginValues aLoginType ) |
|
1149 { |
|
1150 CRepository* repository = CRepository::NewLC( KWVSettingsCenRepUid ); |
|
1151 |
|
1152 if ( aLoginType == EWVSettingsChatLoginAutoAlways || |
|
1153 aLoginType == EWVSettingsChatLoginAutoInHomeNW ) |
|
1154 { |
|
1155 User::LeaveIfError( |
|
1156 repository->Set( KIMPSCRIMConnDays, EWVSettingsAll ) ); |
|
1157 User::LeaveIfError( |
|
1158 repository->Set( KIMPSCRIMConnStart, KDefaultScheduleStartTime ) ); |
|
1159 User::LeaveIfError( |
|
1160 repository->Set( KIMPSCRIMConnEnd, KDefaultScheduleEndTime ) ); |
|
1161 } |
|
1162 |
|
1163 User::LeaveIfError( repository->Set( KIMPSCRChatLogin, aLoginType ) ); |
|
1164 CleanupStack::PopAndDestroy( repository ); |
|
1165 #ifndef RD_30_COMPATIBILITY_MODE |
|
1166 |
|
1167 if ( aLoginType == EWVSettingsChatLoginAutoAlways || |
|
1168 aLoginType == EWVSettingsChatLoginAutoInHomeNW ) |
|
1169 { |
|
1170 // Start AO plugin. |
|
1171 RAlwaysOnlineClientSession session; |
|
1172 User::LeaveIfError( session.Connect() ); |
|
1173 |
|
1174 TUid uid = { KIMPSALWAYSONLINEUID3 }; |
|
1175 TPckgBuf< TUid > param = uid; |
|
1176 |
|
1177 session.RelayCommandL( EServerAPIBaseCommandStart, param ); |
|
1178 session.Close(); |
|
1179 #endif // RD_30_COMPATIBILITY_MODE |
|
1180 } |
|
1181 } |
|
1182 |
|
1183 // --------------------------------------------------------- |
|
1184 // CCAUISessionManager::LoginType |
|
1185 // Central repository version |
|
1186 // (other items were commented in a header). |
|
1187 // --------------------------------------------------------- |
|
1188 // |
|
1189 TIMPSLoginType CCAUISessionManager::LoginType() |
|
1190 { |
|
1191 CHAT_DP( D_CHAT_LIT( "CCAUISessionManager::LoginType" ) ); |
|
1192 |
|
1193 TInt readValue( KErrCouldNotConnect ); // initialize to an error value |
|
1194 |
|
1195 TIMPSLoginType loginType( EIMPSManualLogin ); |
|
1196 |
|
1197 CRepository* cenrep = NULL; |
|
1198 TRAPD( err, cenrep = CRepository::NewL( KWVSettingsCenRepUid ) ); |
|
1199 |
|
1200 if ( err != KErrNone ) |
|
1201 { |
|
1202 // creation of cenrep failed -> return |
|
1203 return loginType; |
|
1204 } |
|
1205 |
|
1206 TRAP( err, |
|
1207 CleanupStack::PushL( cenrep ); |
|
1208 err = cenrep->Get( KIMPSCRChatLogin, readValue ); |
|
1209 CleanupStack::PopAndDestroy( cenrep ); |
|
1210 ); // TRAP |
|
1211 cenrep = NULL; |
|
1212 |
|
1213 if ( err != KErrNone ) |
|
1214 { |
|
1215 // there was an error |
|
1216 return loginType; |
|
1217 } |
|
1218 |
|
1219 if ( ( readValue == EWVSettingsChatLoginAutoAlways ) || |
|
1220 ( readValue == EWVSettingsChatLoginAutoInHomeNW ) ) |
|
1221 { |
|
1222 return EIMPSAAConnectionStart; |
|
1223 } |
|
1224 else if ( readValue == EWVSettingsChatLoginApplicationLaunch ) |
|
1225 { |
|
1226 return EIMPSApplicationLaunch; |
|
1227 } |
|
1228 else |
|
1229 { |
|
1230 return EIMPSManualLogin; |
|
1231 } |
|
1232 } |
|
1233 |
|
1234 |
|
1235 // ----------------------------------------------------------------------------- |
|
1236 // CCAUISessionManager::BrandUIL |
|
1237 // (other items were commented in a header). |
|
1238 // ----------------------------------------------------------------------------- |
|
1239 // |
|
1240 TBool CCAUISessionManager::BrandUIL( TBool aRefreshView /*= ETrue */, |
|
1241 const TDesC& aServerName /*= KNullDesC*/ ) |
|
1242 { |
|
1243 // If needed handles are not given, then do not brand |
|
1244 if ( !iBrand || !iBrandMbmFullPath ) |
|
1245 { |
|
1246 return EFalse; |
|
1247 } |
|
1248 |
|
1249 CHAT_DP( D_CHAT_LIT( "CCAUISessionManager::BrandUIL( %d, %S )" ), |
|
1250 aRefreshView, &aServerName ); |
|
1251 TPtrC pName; |
|
1252 CIMPSSAPSettings* sap = NULL; |
|
1253 |
|
1254 if ( aServerName != KNullDesC ) |
|
1255 { |
|
1256 pName.Set( aServerName ); |
|
1257 } |
|
1258 else |
|
1259 { |
|
1260 // Get the name of logged in server |
|
1261 sap = CurrentSAPLC(); |
|
1262 pName.Set( sap->SAPName() ); |
|
1263 } |
|
1264 |
|
1265 CHAT_DP( D_CHAT_LIT( "CCAUISessionManager::BrandUIL activating brand for %S" ), |
|
1266 &pName ); |
|
1267 |
|
1268 // Activate branded UI based on servername |
|
1269 TFileName tempPath = *iBrandMbmFullPath; |
|
1270 iBrand->ActivateBrandL( pName, *iBrandMbmFullPath ); |
|
1271 TBool refreshNeeded( tempPath.Compare( *iBrandMbmFullPath ) != 0 ); |
|
1272 |
|
1273 // Set branding flag for connection UI |
|
1274 TFileName brandedResource; |
|
1275 TPtrC resId( KIMConnUiResourceFile() ); |
|
1276 |
|
1277 iBrand->CurrentResourceFileL( pName, resId, brandedResource ); |
|
1278 |
|
1279 if ( brandedResource.Length() > 0 ) |
|
1280 { |
|
1281 BaflUtils::NearestLanguageFile( CEikonEnv::Static()->FsSession(), |
|
1282 brandedResource ); |
|
1283 } |
|
1284 |
|
1285 TInt err = RProperty::Set( KBrandingUid, KBrandingResourceKey, brandedResource ); |
|
1286 |
|
1287 CHAT_DP( D_CHAT_LIT( |
|
1288 "CCAUISessionManager::BrandUIL activation result (need to refresh): %d" ), |
|
1289 refreshNeeded ); |
|
1290 |
|
1291 // Check if anything really changed to avoid unnecessary drawing |
|
1292 if ( aRefreshView || refreshNeeded ) |
|
1293 { |
|
1294 // Update status pane |
|
1295 SetStatusPaneIconsL(); |
|
1296 iRefresh = ETrue; |
|
1297 } |
|
1298 |
|
1299 if ( sap ) |
|
1300 { |
|
1301 CleanupStack::PopAndDestroy( sap ); |
|
1302 } |
|
1303 |
|
1304 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
1305 appUi->ReadBrandedResourcesL(); |
|
1306 |
|
1307 if ( refreshNeeded ) |
|
1308 { |
|
1309 // notify resource observers |
|
1310 appUi->NotifyResourceChangeL(); |
|
1311 } |
|
1312 |
|
1313 // Inform storage about the new "show nickname" value |
|
1314 TBool showNickname = IMUtils::IntResourceValueL( |
|
1315 RSC_CHAT_VARIATION_HAVE_NICKNAME ); |
|
1316 |
|
1317 MCALoginPC* loginPC = appUi->GetProcessManager().GetLogInInterface(); |
|
1318 loginPC->SetShowNicknameL( showNickname ); |
|
1319 |
|
1320 return refreshNeeded; |
|
1321 } |
|
1322 |
|
1323 // ----------------------------------------------------------------------------- |
|
1324 // CCAUISessionManager::CurrentSAPLC |
|
1325 // (other items were commented in a header). |
|
1326 // ----------------------------------------------------------------------------- |
|
1327 // |
|
1328 CIMPSSAPSettings* CCAUISessionManager::CurrentSAPLC() |
|
1329 { |
|
1330 CIMPSSAPSettings* sap = CIMPSSAPSettings::NewLC(); |
|
1331 |
|
1332 // If session is active, then current user-id should be retrieved from |
|
1333 // connection UI instead of SAP settings store |
|
1334 if ( IsLoggedIn() ) |
|
1335 { |
|
1336 CHAT_DP_TXT( |
|
1337 "CCAUISessionManager::CurrentSAPLC returning SAP based on ConnUI" ); |
|
1338 if ( !iSessionSlotID ) |
|
1339 { |
|
1340 iSessionSlotID = |
|
1341 iConnUI.GetActiveNWSessionSlotIDL( EIMPSConnClientIM ); |
|
1342 } |
|
1343 iConnUI.GetLoggedInSapL( *iSessionSlotID, *sap ); |
|
1344 } |
|
1345 else |
|
1346 { |
|
1347 CHAT_DP_TXT( |
|
1348 "CCAUISessionManager:: \ |
|
1349 CurrentSAPLC returning SAP based on SAPSettingsStore" ); |
|
1350 CIMPSSAPSettingsStore* sapStore = CIMPSSAPSettingsStore::NewLC(); |
|
1351 sapStore->GetDefaultL( sap, EIMPSIMAccessGroup ); |
|
1352 CleanupStack::PopAndDestroy( sapStore ); |
|
1353 } |
|
1354 |
|
1355 CHAT_DP( D_CHAT_LIT( "CCAUISessionManager::CurrentSAPLC sap uid %d" ), |
|
1356 sap->Uid() ); |
|
1357 return sap; |
|
1358 |
|
1359 } |
|
1360 |
|
1361 |
|
1362 // ----------------------------------------------------------------------------- |
|
1363 // CCAUISessionManager::RefreshCurrentViewL |
|
1364 // (other items were commented in a header). |
|
1365 // ----------------------------------------------------------------------------- |
|
1366 // |
|
1367 TInt CCAUISessionManager::RefreshCurrentViewL() |
|
1368 { |
|
1369 if ( iViewSwitcher && iRefresh ) |
|
1370 { |
|
1371 // this is for updating settings view |
|
1372 iViewSwitcher->SwitchViewL( KUidRefreshView ); |
|
1373 iRefresh = EFalse; |
|
1374 return ETrue; |
|
1375 } |
|
1376 return EFalse; |
|
1377 } |
|
1378 |
|
1379 |
|
1380 |
|
1381 // ----------------------------------------------------------------------------- |
|
1382 // CCAUISessionManager::SetIMPSServices() |
|
1383 // (other items were commented in a header). |
|
1384 // ----------------------------------------------------------------------------- |
|
1385 // |
|
1386 void CCAUISessionManager::SetIMPSServices( TPEngWVCspServicesTree2 aImpsServices, |
|
1387 TBool aBrandUIFlag, TBool aRefreshFlag ) |
|
1388 { |
|
1389 iImpsServices = aImpsServices; |
|
1390 if ( aBrandUIFlag ) |
|
1391 { |
|
1392 TRAP_IGNORE( BrandUIL( aRefreshFlag ) ); |
|
1393 } |
|
1394 } |
|
1395 |
|
1396 // ----------------------------------------------------------------------------- |
|
1397 // CCAUISessionManager::IsOfflineProfileOn |
|
1398 // (other items were commented in a header). |
|
1399 // ----------------------------------------------------------------------------- |
|
1400 // |
|
1401 TBool CCAUISessionManager::IsOfflineProfileOn() const |
|
1402 { |
|
1403 return ( EProfileOffLineId == iProfileApi->ActiveProfileId() ); |
|
1404 } |
|
1405 |
|
1406 |
|
1407 // --------------------------------------------------------- |
|
1408 // CCAUISessionManager::SetcurrentServerAsDefaultL |
|
1409 // (other items were commented in a header). |
|
1410 // --------------------------------------------------------- |
|
1411 // |
|
1412 void CCAUISessionManager::SetCurrentServerAsDefaultL() |
|
1413 { |
|
1414 CIMPSSAPSettings* currentSAP = CurrentSAPLC(); |
|
1415 |
|
1416 CIMPSSAPSettingsStore* sapStore = CIMPSSAPSettingsStore::NewLC(); |
|
1417 CIMPSSAPSettingsList* sapList = CIMPSSAPSettingsList::NewLC(); |
|
1418 sapStore->PopulateSAPSettingsListL( *sapList, EIMPSIMAccessGroup ); |
|
1419 |
|
1420 // find our sap.. because logged in SAP has UID of zero, we must |
|
1421 // find the correct UID manually from list |
|
1422 TInt index( KErrNotFound ); |
|
1423 sapList->FindNameL( currentSAP->SAPName(), index ); |
|
1424 if ( index == KErrNotFound ) |
|
1425 { |
|
1426 User::Leave( index ); |
|
1427 } |
|
1428 |
|
1429 CIMPSSAPSettings* defaultsap = CIMPSSAPSettings::NewLC(); |
|
1430 sapStore->GetDefaultL( defaultsap, EIMPSIMAccessGroup ); |
|
1431 |
|
1432 // check if current sap is default, compare to EXACT name. |
|
1433 if ( 0 != currentSAP->SAPName().Compare( defaultsap->SAPName() ) ) |
|
1434 { |
|
1435 // it's not, so change current sap as default sap |
|
1436 sapStore->SetToDefaultL( sapList->UidForIndex( index ), |
|
1437 EIMPSIMAccessGroup ); |
|
1438 } |
|
1439 |
|
1440 CleanupStack::PopAndDestroy( 4, currentSAP ); // defaultsap, saplist, sapStore, currentSAP |
|
1441 } |
|
1442 |
|
1443 // --------------------------------------------------------- |
|
1444 // CCAUISessionManager::CurrentServerIsDefaultL |
|
1445 // (other items were commented in a header). |
|
1446 // --------------------------------------------------------- |
|
1447 // |
|
1448 TBool CCAUISessionManager::CurrentServerIsDefaultL() |
|
1449 { |
|
1450 CIMPSSAPSettings* currentSAP = CurrentSAPLC(); |
|
1451 |
|
1452 CIMPSSAPSettingsStore* sapStore = CIMPSSAPSettingsStore::NewLC(); |
|
1453 CIMPSSAPSettingsList* sapList = CIMPSSAPSettingsList::NewLC(); |
|
1454 sapStore->PopulateSAPSettingsListL( *sapList, EIMPSIMAccessGroup ); |
|
1455 |
|
1456 // find our sap.. because logged in SAP has UID of zero, we must |
|
1457 // find the correct UID manually from list |
|
1458 TInt index( KErrNotFound ); |
|
1459 sapList->FindNameL( currentSAP->SAPName(), index ); |
|
1460 if ( index == KErrNotFound ) |
|
1461 { |
|
1462 User::Leave( index ); |
|
1463 } |
|
1464 |
|
1465 CIMPSSAPSettings* defaultsap = CIMPSSAPSettings::NewLC(); |
|
1466 sapStore->GetDefaultL( defaultsap, EIMPSIMAccessGroup ); |
|
1467 |
|
1468 // check if current sap is default, compare to EXACT name. |
|
1469 TBool isDefault = 0 == currentSAP->SAPName().Compare( defaultsap->SAPName() ); |
|
1470 CleanupStack::PopAndDestroy( 4, currentSAP ); // defaultsap, saplist, sapStore, currentSAP |
|
1471 |
|
1472 return isDefault; |
|
1473 } |
|
1474 // --------------------------------------------------------- |
|
1475 // CCAUISessionManager::DisplayDomainSelectionQueryL |
|
1476 // (other items were commented in a header). |
|
1477 // --------------------------------------------------------- |
|
1478 // |
|
1479 TInt CCAUISessionManager::DisplayDomainSelectionQueryL( TDes& aSelectedDomain ) |
|
1480 { |
|
1481 CIMPSSAPSettings* sap = CurrentSAPLC(); |
|
1482 TInt retVal = iConnUI.DisplayDomainSelectionQueryL( aSelectedDomain, sap ); |
|
1483 CleanupStack::PopAndDestroy( sap ); |
|
1484 return retVal; |
|
1485 } |
|
1486 |
|
1487 // --------------------------------------------------------- |
|
1488 // CCAUISessionManager::IsBackgroundTaskRunning |
|
1489 // (other items were commented in a header). |
|
1490 // --------------------------------------------------------- |
|
1491 // |
|
1492 TBool CCAUISessionManager::IsBackgroundTaskRunning() |
|
1493 { |
|
1494 CCACommandManager* commandManager = CCACommandManagerFactory::InstanceL()->GetCommandManager(); |
|
1495 MCASessionHandlerCmd* sessionHandlerCmd = commandManager->GetSessionHandlerCmd(); |
|
1496 return sessionHandlerCmd->IsBackgroundTaskRunning(); |
|
1497 } |
|
1498 |
|
1499 // --------------------------------------------------------- |
|
1500 // CCAUISessionManager::IsSupported |
|
1501 // (other items were commented in a header). |
|
1502 // --------------------------------------------------------- |
|
1503 // |
|
1504 TBool CCAUISessionManager::IsSupported( TSupportedFeature aFeature ) |
|
1505 { |
|
1506 switch ( aFeature ) |
|
1507 { |
|
1508 case EGroup : |
|
1509 { |
|
1510 return iImpsServices.iGroupFeat.FeatureSupported(); |
|
1511 } |
|
1512 case ESearch : |
|
1513 { |
|
1514 return iImpsServices.iFundamentalFeat.FunctionSupported( |
|
1515 KPEngFFSearchFunction ); |
|
1516 } |
|
1517 case EInvite : |
|
1518 { |
|
1519 return iImpsServices.iFundamentalFeat.FunctionSupported( |
|
1520 KPEngFFInviteFunction ); |
|
1521 } |
|
1522 case EBlock : |
|
1523 { |
|
1524 return iImpsServices.iIMFeat.FunctionSupported( |
|
1525 KPEngIMAuthorFunctions ); |
|
1526 } |
|
1527 case EAttrList : |
|
1528 { |
|
1529 return iImpsServices.iPresenceFeat.FunctionSupported( |
|
1530 KPEngWVAttrListFunction ); |
|
1531 } |
|
1532 case ECLIMod: |
|
1533 { |
|
1534 // contact list creation/deletion is possible only if |
|
1535 // both CCLI and DCLI are supported |
|
1536 TBool returnValue( ETrue ); |
|
1537 returnValue &= |
|
1538 iImpsServices.iPresenceFeat.SubFunctionSupported( KPEngWVSubFuncCCLI ); |
|
1539 returnValue &= |
|
1540 iImpsServices.iPresenceFeat.SubFunctionSupported( KPEngWVSubFuncDCLI ); |
|
1541 return returnValue; |
|
1542 } |
|
1543 case EGroupRejectList: |
|
1544 { |
|
1545 return iImpsServices.iGroupFeat.SubFunctionSupported( |
|
1546 KPEngGRSubFuncREJEC ); |
|
1547 } |
|
1548 default: |
|
1549 { |
|
1550 return EFalse; // Unknown features are not supported |
|
1551 } |
|
1552 } |
|
1553 } |
|
1554 |
|
1555 // --------------------------------------------------------- |
|
1556 // CCAUISessionManager::IsServerDefined |
|
1557 // (other items were commented in a header). |
|
1558 // --------------------------------------------------------- |
|
1559 // |
|
1560 |
|
1561 TBool CCAUISessionManager::IsServerDefined() |
|
1562 { |
|
1563 // SAP settings store |
|
1564 TInt count( 0 ); |
|
1565 TRAP_IGNORE( |
|
1566 CIMPSSAPSettingsStore* sapSettingsStore = CIMPSSAPSettingsStore::NewLC(); |
|
1567 count = sapSettingsStore->SAPCountL( EIMPSIMAccessGroup ); |
|
1568 CleanupStack::PopAndDestroy( sapSettingsStore ); |
|
1569 ); |
|
1570 if ( count == 0 ) |
|
1571 { |
|
1572 return EFalse; |
|
1573 } |
|
1574 else |
|
1575 { |
|
1576 return ETrue; |
|
1577 } |
|
1578 } |
|
1579 // --------------------------------------------------------- |
|
1580 // CCAUISessionManager::GetParameters |
|
1581 // (other items were commented in a header). |
|
1582 // --------------------------------------------------------- |
|
1583 // |
|
1584 void CCAUISessionManager::GetParameters( MCAUiLoginCmdCB::TLoginParams& aLoginParams ) |
|
1585 { |
|
1586 aLoginParams = iLoginParams; |
|
1587 } |
|
1588 |
|
1589 |
|
1590 // --------------------------------------------------------- |
|
1591 // CCAUISessionManager::FinalizeChatConstructionL |
|
1592 // (other items were commented in a header). |
|
1593 // --------------------------------------------------------- |
|
1594 // |
|
1595 |
|
1596 void CCAUISessionManager::FinalizeChatConstructionL() |
|
1597 { |
|
1598 // Construct views |
|
1599 CCAAppUi* appUi = static_cast<CCAAppUi*>( |
|
1600 CCoeEnv::Static()->AppUi() ); |
|
1601 appUi->FinalizeChatConstructionL(); |
|
1602 } |
|
1603 |
|
1604 |
|
1605 |
|
1606 // --------------------------------------------------------- |
|
1607 // CCAUISessionManager::ShowPasswordSavingWarningL |
|
1608 // (other items were commented in a header). |
|
1609 // --------------------------------------------------------- |
|
1610 // |
|
1611 void CCAUISessionManager::ShowPasswordSavingWarningL() const |
|
1612 { |
|
1613 if ( IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SAVE_PW_WARNING ) ) |
|
1614 { |
|
1615 HBufC* warningText = CCoeEnv::Static()->AllocReadResourceLC( |
|
1616 R_CHAT_SAVE_PW_WARNING ); |
|
1617 |
|
1618 HBufC* warningHeading = CCoeEnv::Static()->AllocReadResourceLC( |
|
1619 R_CHAT_SAVE_PW_WARNING_HEADING ); |
|
1620 |
|
1621 IMDialogUtils::DisplayMessageQueryDialogL( |
|
1622 R_CHATCLIENT_MESSAGE_QUERY_DIALOG, |
|
1623 *warningText, |
|
1624 *warningHeading |
|
1625 ); |
|
1626 |
|
1627 CleanupStack::PopAndDestroy( 2, warningText ); |
|
1628 } |
|
1629 } |
|
1630 // --------------------------------------------------------- |
|
1631 // CCAUISessionManager::DismissProcessingNoteL |
|
1632 // (other items were commented in a header). |
|
1633 // --------------------------------------------------------- |
|
1634 // |
|
1635 void CCAUISessionManager::DismissProcessingNoteL( TInt aError, TBool aValue ) |
|
1636 { |
|
1637 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
1638 appUi->DismissWaitDialogL( aError, aValue ); |
|
1639 } |
|
1640 |
|
1641 |
|
1642 |
|
1643 // End of File |
|
1644 |