|
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: AppUi class of application |
|
15 * Since : 3.2 |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <WVSettingsSharedDataNG.h> |
|
21 #include <cimpsconnectionuingagent.h> |
|
22 #include <PEngWVPresenceAttributes2.h> |
|
23 #include <cdlengine.h> |
|
24 #include "MCAGroupManagerInterface.h" |
|
25 |
|
26 /* A single usage of imps error base constant. |
|
27 * Hence not moved to the process component. |
|
28 */ |
|
29 #include "ImpsCSPAllErrors.h" |
|
30 |
|
31 #include "CCAEngine.h" // Model |
|
32 #include "CIMPSSAPSettings.h" |
|
33 #include "CIMPSSAPSettingsStore.h" |
|
34 |
|
35 #include "CCAAppUi.h" |
|
36 #include "CCAApp.h" |
|
37 #include "CAExternalInterface.h" // UIDs |
|
38 #include "ChatDefinitions.h" // Constant definitions |
|
39 #include "chatngclient.hrh" // resource header file |
|
40 #include "ChatDebugPrint.h" // For debug macros |
|
41 #include "IMNoteMapper.h" |
|
42 #include "IMDialogUtils.h" |
|
43 #include "IMUtils.h" |
|
44 #include "CAViewCreator.h" //View creator |
|
45 #include "CAUtils.h" |
|
46 #include "CAVersion.h" //Version info provider |
|
47 #include "CCAStatusPaneHandler.h" // For statuspane application wide handling |
|
48 #include "CCAAudioManager.h" |
|
49 #include "CCAVariantFactory.h" // for variation |
|
50 #include "CCAInputAbsorber.h" |
|
51 #include "CCAGroupUtils.h" |
|
52 #include "CCAUISessionManager.h" |
|
53 #include "CCAIconLoader.h" |
|
54 #include "CCAMessageExtensionsHandler.h" |
|
55 #include "CAArrayUtils.h" |
|
56 #include "CCAWaitNote.h" |
|
57 #include "MCASkinVariant.h" |
|
58 #include "MCAOpBrandVariant.h" |
|
59 #include "MCAAHVariant.h" |
|
60 #include "MCALayoutChangeObserver.h" |
|
61 #include "CANotifierFactory.h" |
|
62 #include "MCANotifierInterface.h" |
|
63 #include "CCAGlobalNoteHandler.h" |
|
64 #include "TCAChatListBoxLayout.h" |
|
65 #include "CCALayoutInfo.h" |
|
66 #include "mcaresourcechangeobserver.h" |
|
67 #include "CCAAppSettingsDialog.h" |
|
68 #include "CCAAppSettingsSAPExt.h" |
|
69 #include "chatdebugassert.h" |
|
70 #include "iminternalpskeys.h" |
|
71 #include "imnginternalcrkeys.h" |
|
72 #include "imprivatecrkeys.h" |
|
73 #include "imvariant.hrh" |
|
74 #include "mcaserverchangenotify.h" |
|
75 #include "CWVSettingsUINGDialog.h" |
|
76 |
|
77 #include "CCASplashScreen.h" |
|
78 //process component |
|
79 #include "CCACommandManagerFactory.h" |
|
80 #include "CCACommandManager.h" |
|
81 #include "MCALoginPC.h" |
|
82 #include "MCAProcessManager.h" |
|
83 #include "MCACommand.h" |
|
84 #include "MCAMainViewArrayPC.h" |
|
85 #include "MCAConversationPC.h" |
|
86 #include "MCAGroupPC.h" |
|
87 #include "MCASettingsPC.h" |
|
88 #include "MCARecordedChatsArrayPC.h" |
|
89 #include "CCAPCUtils.h" |
|
90 #include "MCAApplicationNGPC.h" |
|
91 #include "IMMessageUtilsPC.h" |
|
92 #include "MCAGlobalNotificationObserverPC.h" |
|
93 #include "MCAConversationMessage.h" |
|
94 #include "MCAInvitationPC.h" |
|
95 #include "MCASettingsPC.h" |
|
96 #include "MCABackgroundTaskObserver.h" |
|
97 |
|
98 |
|
99 #include <data_caging_path_literals.hrh> |
|
100 #include <hlplch.h> |
|
101 #include <aknenv.h> |
|
102 #include <ChatNG.rsg> |
|
103 #include <ChatNG.mbg> |
|
104 #include <CAVariationNG.rsg> |
|
105 #include <AknDlgShut.h> |
|
106 #include <AknSoftNotifier.h> |
|
107 #include <AknsUtils.h> |
|
108 #include <bautils.h> |
|
109 #include <FeatMgr.h> // feature manager |
|
110 #include <sysutil.h> |
|
111 #include <aknsconstants.h> |
|
112 |
|
113 #include <aknlistquerydialog.h> |
|
114 #include <StringLoader.h> |
|
115 |
|
116 #include <s32file.h> // File streams |
|
117 #include <s32mem.h> //CBufStore |
|
118 #include <s32stor.h> // CStreamStore |
|
119 #include <s32buf.h> // TStreamPos |
|
120 #include <aknnotewrappers.h> |
|
121 #include <akniconarray.h> |
|
122 #include <bldvariant.hrh> |
|
123 #include <akndef.h> |
|
124 |
|
125 #include <aknsconstants.h> |
|
126 #include <aknsconstants.hrh> |
|
127 #include <AknUtils.h> |
|
128 #include <eikdef.h> |
|
129 #include <COEAUI.H> |
|
130 #include <SkinLayout.cdl.h> |
|
131 #include <LayoutMetaData.cdl.h> |
|
132 #include <AknLayoutScalable_Avkon.cdl.h> |
|
133 #include <aknstatuspaneutils.h> |
|
134 #include <aknlayoutscalable_avkon.cdl.common.h> |
|
135 #include <errorui.h> |
|
136 #include <e32std.h> |
|
137 // The Settings have been moved to Cenrep (also retained in the Resource file), |
|
138 //so the enums for keys and central repository header is added here |
|
139 #include "VariantKeys.h" |
|
140 #include "MCABlocking.h" |
|
141 |
|
142 #ifdef RD_MULTIPLE_DRIVE |
|
143 #include <driveinfo.h> |
|
144 #include <rsfwmountman.h> |
|
145 #endif |
|
146 _LIT( KPrivateVersionFile, "IMVersion.txt" ); |
|
147 _LIT( KPublishedVersionFile, "\\System\\data\\IMVersion\\IMVersion.txt" ); |
|
148 _LIT( KFileName, "z:\\resource\\apps\\chatng.mif" ); |
|
149 |
|
150 const TUid KSDUidSysApLocal = {0x100058F3}; |
|
151 |
|
152 // For own status |
|
153 const TInt KAmountOfOwnStatusStates = 3; |
|
154 const TInt KOnlineIconIndex = 0; |
|
155 |
|
156 const TInt KMaxStatusMessageCount = 4; |
|
157 |
|
158 // This is used in IMPSCommonUi in CCnUiClientPluginIM.cpp |
|
159 // If this is changed, remember to change also in IMPSCommonUi side. |
|
160 const TInt KStatusMessageHeaderLength = 3; // length of status message header. |
|
161 // KStatusMessageHeaderLength must be used as amount of characters for format. |
|
162 _LIT( KStatusMessageHeaderFormat, "%3d" ); |
|
163 _LIT( KStatusMessageHeaderLengthFormat, "%d" ); // This is length of header. |
|
164 _LIT( KWVSettingsResFileName, "CWVSETTINGSUING.RSC" ); |
|
165 _LIT( KIMPSConnUIResFileName, "IMPSCONNECTIONUING.RSC" ); |
|
166 // The IM UI Settings are in the Resource file now. |
|
167 _LIT( KIMPSCUVariationResFileName, "IMConnectionUIVariationNG.RSC" ); |
|
168 |
|
169 // ================= MEMBER FUNCTIONS ======================= |
|
170 |
|
171 // C++ default constructor can NOT contain any code, that |
|
172 // might leave. |
|
173 // |
|
174 CCAAppUi::CCAAppUi( CCAEngine& aEngine, MCAProcessManager& aProcessManager ) |
|
175 : iEngine( aEngine ), |
|
176 iApplicationNGPC( *aProcessManager.GetApplicationNGPC() ), |
|
177 iIsAppForeground( ETrue ), |
|
178 iLayoutObservers( 1 ) /* usually just one observer */, |
|
179 iPlayOnce( EFalse ), |
|
180 iPendingDialogCounter( 0 ), |
|
181 iProcessManager( aProcessManager ) |
|
182 |
|
183 { |
|
184 CHAT_DP_FUNC_ENTER( "CCAAppUi" ); |
|
185 CHAT_DP_FUNC_DONE( "CCAAppUi" ); |
|
186 } |
|
187 |
|
188 // Destructor |
|
189 CCAAppUi::~CCAAppUi() |
|
190 { |
|
191 |
|
192 if ( iInfoPopup ) |
|
193 { |
|
194 iInfoPopup->HideInfoPopupNote(); |
|
195 delete iInfoPopup; |
|
196 } |
|
197 |
|
198 delete iPreviewMessageList; |
|
199 |
|
200 iDestructingFlag = ETrue; |
|
201 |
|
202 // Remove observers if they are already set |
|
203 if ( iEngineInitialized ) |
|
204 { |
|
205 |
|
206 MCAGlobalNotificationObserverPC& globalNotificationObserverPC ( *iProcessManager.GetGlobalNotificationInterface() ); |
|
207 |
|
208 globalNotificationObserverPC.RemoveGlobalObserver( this ); |
|
209 |
|
210 } |
|
211 |
|
212 FeatureManager::UnInitializeLib(); |
|
213 //delete splash screen |
|
214 delete iSplashScreen; |
|
215 iSplashScreen = NULL; |
|
216 |
|
217 delete iConnUIAgent; |
|
218 delete iIconLoader; |
|
219 delete iWaitDialog; |
|
220 delete iGroupUtils; |
|
221 delete iConnUI; |
|
222 delete iUISessionManager; |
|
223 delete iScreenName; |
|
224 delete iStatusPaneHandler; |
|
225 delete iAudioManager; |
|
226 // delete iInputAbsorber; |
|
227 delete iExitIdle; |
|
228 delete iForwardMessage; |
|
229 delete iMessageHandler; |
|
230 |
|
231 delete iNotifierAPI; |
|
232 |
|
233 iLayoutObservers.Close(); |
|
234 iResourceObservers.Close(); |
|
235 |
|
236 delete iCustomMessage; |
|
237 delete iLayoutInfo; |
|
238 |
|
239 delete iStatusMessage; |
|
240 |
|
241 iSwitchView.Close(); |
|
242 iSwitchMessage.Close(); |
|
243 iSwitchMessageContent.ResetAndDestroy(); |
|
244 iSwitchMessageContent.Close(); |
|
245 |
|
246 |
|
247 delete iSAPSettingsStore; |
|
248 delete iInputAbsorber; |
|
249 |
|
250 CCACommandManagerFactory::ReleaseResources(); |
|
251 // The Central repository instance needs to be deleted, as it would have been instantiated by InitializeLibL () at the beginning of AppUi |
|
252 //have been instantiated by InitializeLibL () at the beginning of AppUi |
|
253 IMUtils::UnInitializeLib(); |
|
254 |
|
255 CHAT_DP_TXT( "CCAAppUi::~CCAAppUi done" ); |
|
256 } |
|
257 |
|
258 |
|
259 // --------------------------------------------------------- |
|
260 // CCAAppUi::ConnectionUI |
|
261 // (other items were commented in a header). |
|
262 // --------------------------------------------------------- |
|
263 // |
|
264 CIMPSPresenceConnectionUi& CCAAppUi::ConnectionUI() |
|
265 { |
|
266 return *iConnUI; |
|
267 } |
|
268 |
|
269 // --------------------------------------------------------- |
|
270 // CCAAppUi::UISessionManager |
|
271 // (other items were commented in a header). |
|
272 // --------------------------------------------------------- |
|
273 // |
|
274 CCAUISessionManager& CCAAppUi::UISessionManager() |
|
275 { |
|
276 return *iUISessionManager; |
|
277 } |
|
278 |
|
279 // --------------------------------------------------------- |
|
280 // CCAAppUi::CAStatusPane() const |
|
281 // Fetches a handle to status pane handler |
|
282 // (other items were commented in a header). |
|
283 // --------------------------------------------------------- |
|
284 // |
|
285 CCAStatusPaneHandler* CCAAppUi::CAStatusPane() const |
|
286 { |
|
287 return iStatusPaneHandler; |
|
288 } |
|
289 |
|
290 // --------------------------------------------------------- |
|
291 // CCAAppUi::CAModel() const |
|
292 // Fetches a handle to application's engine |
|
293 // (other items were commented in a header). |
|
294 // --------------------------------------------------------- |
|
295 // |
|
296 //CCAEngine& CCAAppUi::CAModel() const |
|
297 // { |
|
298 // return iEngine; |
|
299 // } |
|
300 |
|
301 // --------------------------------------------------------- |
|
302 // CCAAppUi::GetProcessManager() const |
|
303 // Returns a reference to application's process manager |
|
304 // (other items were commented in a header). |
|
305 // --------------------------------------------------------- |
|
306 // |
|
307 MCAProcessManager& CCAAppUi::GetProcessManager() const |
|
308 { |
|
309 return iProcessManager; |
|
310 } |
|
311 |
|
312 |
|
313 // --------------------------------------------------------- |
|
314 // CCAAppUi::ScreenNamePtr |
|
315 // (other items were commented in a header). |
|
316 // --------------------------------------------------------- |
|
317 // |
|
318 HBufC* CCAAppUi::ScreenNamePtr() |
|
319 { |
|
320 MCASettingsPC* appSettingsPC = GetProcessManager().GetSettingsInterface(); |
|
321 TPtr screenNamePtr( iScreenName->Des() ); |
|
322 |
|
323 // check if there is default screen name specified in settings |
|
324 // and override the existing screen name with the settings value |
|
325 if ( appSettingsPC->GetBoolValuePC( TEnumsPC::EDefaultScreenNameInUse, NULL ) ) |
|
326 { |
|
327 HBufC* defaultScreenName = NULL; |
|
328 TRAPD( err, defaultScreenName = |
|
329 appSettingsPC->GetSapSettingValuePCL( TEnumsPC::EDefaultScreenName, NULL ) ); |
|
330 if ( err ) |
|
331 { |
|
332 CActiveScheduler::Current()->Error( err ); |
|
333 } |
|
334 |
|
335 if ( !defaultScreenName ) |
|
336 { |
|
337 return iScreenName; |
|
338 } |
|
339 |
|
340 TPtr defaultScreenNamePtr( defaultScreenName->Des() ); |
|
341 screenNamePtr.Copy( defaultScreenNamePtr.Left( screenNamePtr.MaxLength() ) ); |
|
342 delete defaultScreenName; |
|
343 } |
|
344 |
|
345 // otherwise just return the last used screen name |
|
346 return iScreenName; |
|
347 } |
|
348 |
|
349 // --------------------------------------------------------- |
|
350 // CCAAppUi::IMUIPIConForcedClear |
|
351 // (other items were commented in a header). |
|
352 // --------------------------------------------------------- |
|
353 // |
|
354 void CCAAppUi::IMUIPIConForcedClear() |
|
355 { |
|
356 TInt error( iNotifierAPI->SetInt( MCANotifierInterface::EUIPIndKey, EFalse ) ); |
|
357 if ( error ) |
|
358 { |
|
359 CActiveScheduler::Current()->Error( error ); |
|
360 } |
|
361 } |
|
362 |
|
363 // --------------------------------------------------------- |
|
364 // CCAAppUi::SetSoftNotificationCounter |
|
365 // (other items were commented in a header). |
|
366 // --------------------------------------------------------- |
|
367 // |
|
368 void CCAAppUi::SetSoftNotificationCounterL( TInt aCount ) const |
|
369 { |
|
370 CAknSoftNotifier* softNotifier = CAknSoftNotifier::NewLC(); |
|
371 softNotifier->SetNotificationCountL( EChatMessageNotification, aCount ); |
|
372 CleanupStack::PopAndDestroy( softNotifier ); |
|
373 } |
|
374 |
|
375 // --------------------------------------------------------- |
|
376 // CCAAppUi::PlayBeep |
|
377 // (other items were commented in a header). |
|
378 // --------------------------------------------------------- |
|
379 // |
|
380 void CCAAppUi::PlayBeep() |
|
381 { |
|
382 if ( !iPlayOnce ) |
|
383 { |
|
384 TRAP_IGNORE( iAudioManager->PlayL() ); |
|
385 } |
|
386 else |
|
387 { |
|
388 // Set beep to be played next time when PlayBeep |
|
389 // is called |
|
390 iPlayOnce = EFalse; |
|
391 } |
|
392 } |
|
393 |
|
394 // --------------------------------------------------------- |
|
395 // CCAAppUi::MbmFullPath |
|
396 // (other items were commented in a header). |
|
397 // --------------------------------------------------------- |
|
398 // |
|
399 TDes& CCAAppUi::MbmFullPath() |
|
400 { |
|
401 return iChatMbmFullPath; |
|
402 } |
|
403 |
|
404 // --------------------------------------------------------- |
|
405 // CCAAppUi::CaptureEventsL |
|
406 // (other items were commented in a header). |
|
407 // --------------------------------------------------------- |
|
408 // |
|
409 void CCAAppUi::CaptureEventsL() |
|
410 { |
|
411 if ( !AreEventsCaptured() ) |
|
412 { |
|
413 iInputAbsorber->CaptureEventsL(); |
|
414 } |
|
415 } |
|
416 |
|
417 // --------------------------------------------------------- |
|
418 // CCAAppUi::ReleaseCapturingL() |
|
419 // (other items were commented in a header). |
|
420 // --------------------------------------------------------- |
|
421 // |
|
422 void CCAAppUi::ReleaseCapturingL() |
|
423 { |
|
424 if ( AreEventsCaptured() ) |
|
425 { |
|
426 iInputAbsorber->Release(); |
|
427 } |
|
428 } |
|
429 |
|
430 // --------------------------------------------------------- |
|
431 // CCAAppUi::AreEventsCaptured |
|
432 // (other items were commented in a header). |
|
433 // --------------------------------------------------------- |
|
434 // |
|
435 TBool CCAAppUi::AreEventsCaptured() const |
|
436 { |
|
437 return iInputAbsorber->IsCaptured(); |
|
438 } |
|
439 |
|
440 // --------------------------------------------------------- |
|
441 // CCAAppUi::AddLayoutChangeObserver |
|
442 // (other items were commented in a header). |
|
443 // --------------------------------------------------------- |
|
444 // |
|
445 void CCAAppUi::AddLayoutChangeObserver( MCALayoutChangeObserver* aObserver ) |
|
446 { |
|
447 TInt err( iLayoutObservers.Append( aObserver ) ); |
|
448 if ( err ) |
|
449 { |
|
450 CActiveScheduler::Current()->Error( err ); |
|
451 } |
|
452 } |
|
453 |
|
454 // --------------------------------------------------------- |
|
455 // CCAAppUi::RemoveLayoutChangeObserver |
|
456 // (other items were commented in a header). |
|
457 // --------------------------------------------------------- |
|
458 // |
|
459 void CCAAppUi::RemoveLayoutChangeObserver( MCALayoutChangeObserver* aObserver ) |
|
460 { |
|
461 // remove from end first (LIFO) to avoid |
|
462 // tweaking the index while removing |
|
463 TInt count( iLayoutObservers.Count() ); |
|
464 for ( TInt i( count - 1 ); i >= 0; i-- ) |
|
465 { |
|
466 if ( iLayoutObservers[i] == aObserver ) |
|
467 { |
|
468 iLayoutObservers.Remove( i ); |
|
469 } |
|
470 } |
|
471 iLayoutObservers.Compress(); |
|
472 } |
|
473 |
|
474 // --------------------------------------------------------- |
|
475 // CCAAppUi::AddResourceChangeObserver |
|
476 // (other items were commented in a header). |
|
477 // --------------------------------------------------------- |
|
478 // |
|
479 void CCAAppUi::AddResourceChangeObserver( MCAResourceChangeObserver* aObserver ) |
|
480 { |
|
481 TInt err( iResourceObservers.Append( aObserver ) ); |
|
482 if ( err ) |
|
483 { |
|
484 CActiveScheduler::Current()->Error( err ); |
|
485 } |
|
486 } |
|
487 |
|
488 // --------------------------------------------------------- |
|
489 // CCAAppUi::RemoveResourceChangeObserver |
|
490 // (other items were commented in a header). |
|
491 // --------------------------------------------------------- |
|
492 // |
|
493 void CCAAppUi::RemoveResourceChangeObserver( MCAResourceChangeObserver* aObserver ) |
|
494 { |
|
495 // remove from end first (LIFO) to avoid |
|
496 // tweaking the index while removing |
|
497 TInt count( iResourceObservers.Count() ); |
|
498 for ( TInt i( count - 1 ); i >= 0; i-- ) |
|
499 { |
|
500 if ( iResourceObservers[i] == aObserver ) |
|
501 { |
|
502 iResourceObservers.Remove( i ); |
|
503 } |
|
504 } |
|
505 iResourceObservers.Compress(); |
|
506 } |
|
507 |
|
508 // --------------------------------------------------------- |
|
509 // CCAAppUi::NotifyResourceChange |
|
510 // (other items were commented in a header). |
|
511 // --------------------------------------------------------- |
|
512 // |
|
513 void CCAAppUi::NotifyResourceChangeL() |
|
514 { |
|
515 TInt count( iResourceObservers.Count() ); |
|
516 TInt err = KErrNone; |
|
517 for ( TInt i( 0 ); i < count; ++i ) |
|
518 { |
|
519 // Notify every observer (even in case of leave) |
|
520 TRAPD( error, iResourceObservers[i]->ResourceChangedL() ); |
|
521 |
|
522 // store last error |
|
523 if ( error != KErrNone ) |
|
524 { |
|
525 err = error; |
|
526 } |
|
527 } |
|
528 |
|
529 // Show that something went wrong (only last error) |
|
530 if ( err ) |
|
531 { |
|
532 CActiveScheduler::Current()->Error( err ); |
|
533 } |
|
534 } |
|
535 |
|
536 // --------------------------------------------------------- |
|
537 // CCAAppUi::HandleInvitation |
|
538 // handle an incoming invitation |
|
539 // (other items were commented in a header). |
|
540 // --------------------------------------------------------- |
|
541 // |
|
542 void CCAAppUi::HandleInvitationEventL( TEnumsPC::TInviteType aInviteType, |
|
543 const TDesC& aUserID, |
|
544 const TDesC& aMessage ) |
|
545 { |
|
546 CHAT_DP_TXT( "CCAAppUi::HandleInvitation, Invitation received." ); |
|
547 |
|
548 if ( aInviteType == TEnumsPC::ENewInvite ) |
|
549 { |
|
550 AddToPreviewListL( aUserID, aMessage ); |
|
551 |
|
552 if ( !iInfoNoteShowing ) |
|
553 { |
|
554 ShowInfoPopupL(); |
|
555 } |
|
556 PlayBeep(); |
|
557 } |
|
558 else if ( aInviteType != TEnumsPC::EInviteRead ) |
|
559 { |
|
560 return; |
|
561 } |
|
562 UpdateIMUIPIcon(); |
|
563 } |
|
564 |
|
565 // --------------------------------------------------------- |
|
566 // CCAAppUi::HandleInvitationResponse |
|
567 // (other items were commented in a header). |
|
568 // --------------------------------------------------------- |
|
569 // |
|
570 void CCAAppUi::HandleInvitationResponse( TBool aAcceptance, |
|
571 const TDesC& aUserId, |
|
572 const TDesC& aGroupName, |
|
573 const TDesC& aResponse ) |
|
574 { |
|
575 CHAT_DP_TXT( "CCAAppUi::HandleInvitationResponse" ); |
|
576 PlayBeep(); |
|
577 |
|
578 TRAPD( err, DoHandleInvitationResponseL( |
|
579 aAcceptance, aUserId, aGroupName, aResponse ) ); |
|
580 if ( err ) |
|
581 { |
|
582 CActiveScheduler::Current()->Error( err ); |
|
583 } |
|
584 } |
|
585 |
|
586 // ----------------------------------------------------------------------------- |
|
587 // CCAAppUi::HandleWsEventL |
|
588 // (other items were commented in a header). |
|
589 // ----------------------------------------------------------------------------- |
|
590 // |
|
591 void CCAAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ) |
|
592 { |
|
593 if (aEvent.Key()->iCode == EKeyEscape && iGroupUtils) |
|
594 { |
|
595 if (iGroupUtils->GetJoinGroupID() .Compare(KEmptyDesC) != KErrNone) |
|
596 { |
|
597 iGroupManagerInterface = iEngine.GetGroupInterface(); |
|
598 iGroupManagerInterface->CancelGroupOperationL(iGroupUtils->GetJoinGroupID()); |
|
599 } |
|
600 } |
|
601 |
|
602 if (aEvent.Key()->iCode == EKeyEscape) |
|
603 { |
|
604 iIsFSWExit = ETrue; |
|
605 } |
|
606 |
|
607 switch ( aEvent.Type() ) |
|
608 { |
|
609 case KAknUidValueEndKeyCloseEvent: |
|
610 { |
|
611 // Chat goes to background only, does not close the app because |
|
612 // we'd have to show a query; not possible when pressing end key |
|
613 // a long time |
|
614 TVwsViewId idleViewid; |
|
615 TInt res = AknDef::GetPhoneIdleViewId( idleViewid ); |
|
616 if ( res != KErrNone ) //go to application shell if no idle available |
|
617 { |
|
618 /*ActivateViewL( KAknApplicationShellViewId );*/ |
|
619 TApaTaskList taskList(CCoeEnv::Static()->WsSession()); |
|
620 TApaTask chatng = taskList.FindApp( KUidChatClient ); |
|
621 |
|
622 // Send the IM to background |
|
623 chatng.SendToBackground(); |
|
624 } |
|
625 else |
|
626 { |
|
627 ActivateViewL( idleViewid ); |
|
628 } |
|
629 break; |
|
630 } |
|
631 default: |
|
632 { |
|
633 CAknViewAppUi::HandleWsEventL( aEvent, aDestination ); |
|
634 break; |
|
635 } |
|
636 } |
|
637 } |
|
638 |
|
639 |
|
640 // --------------------------------------------------------- |
|
641 // CCAAppUi::HandleCommandL(TInt aCommand) |
|
642 // From CEikAppUi, takes care of command handling. |
|
643 // (other items were commented in a header). |
|
644 // --------------------------------------------------------- |
|
645 // |
|
646 void CCAAppUi::HandleCommandL( TInt aCommand ) |
|
647 { |
|
648 CHAT_DP( D_CHAT_LIT( "AppUI received command: %d" ), aCommand ); |
|
649 CHAT_DP( D_CHAT_LIT( "--EEikCmdExit is %d" ), ( TInt )EEikCmdExit ); |
|
650 CHAT_DP( D_CHAT_LIT( "--EAknCmdExit is %d" ), ( TInt )EAknCmdExit ); |
|
651 CHAT_DP( D_CHAT_LIT( "--EAknSoftkeyExit is %d" ), ( TInt )EAknSoftkeyExit ); |
|
652 CHAT_DP( D_CHAT_LIT( "--EChatClientCmdExit is %d" ), |
|
653 ( TInt )EChatClientCmdExit ); |
|
654 |
|
655 switch ( aCommand ) |
|
656 { |
|
657 case EAknCmdExit: // fall-through, handled similarily |
|
658 case EEikCmdExit: // fall-through, handled similarily |
|
659 case EAknSoftkeyExit: // fall-through, handled similarily |
|
660 case EChatClientCmdExit: |
|
661 { |
|
662 if ( IsBackgroundTaskPendingL() ) |
|
663 { |
|
664 iIsFSDExitNeeded = ETrue; |
|
665 break; |
|
666 } |
|
667 else |
|
668 { |
|
669 iStopUpdateCba = EFalse; |
|
670 } |
|
671 |
|
672 CHAT_DP_FUNC_DP( "HandleCommandL", "exit command" ); |
|
673 // exit softkey: EAknSoftkeyExit |
|
674 // exit from menu: EChatClientCmdExit |
|
675 // forced exit (oom): EEikCmdExit |
|
676 // forced exit (fastswap): EEikCmdExit |
|
677 |
|
678 TInt ret( EAknSoftkeyOk ); |
|
679 TInt chatLoginType( IMUtils::WVSettingsChatLoginValue() ); |
|
680 |
|
681 if ( ( aCommand != EEikCmdExit ) && |
|
682 ( chatLoginType != EWVSettingsChatLoginAutoAlways ) && |
|
683 ( chatLoginType != EWVSettingsChatLoginAutoInHomeNW ) ) |
|
684 { |
|
685 // don't show query if user is not logged in or if this |
|
686 // is a forced exit |
|
687 // checking login status only when needed, ie. no need |
|
688 // check if forced exit or login type is always online |
|
689 if ( iUISessionManager->IsLoggedIn() ) |
|
690 { |
|
691 CCAGlobalNoteHandler* note = CCAGlobalNoteHandler::NewL(); |
|
692 CleanupStack::PushL( note ); |
|
693 |
|
694 ret = note->ShowNoteL( R_QTN_CHAT_CLOSE_CONN_APP_CONV ); |
|
695 CleanupStack::PopAndDestroy( note ); |
|
696 ReleaseCapturingL(); |
|
697 } |
|
698 } |
|
699 else if ( aCommand != EEikCmdExit ) |
|
700 { |
|
701 iUISessionManager->LoginL( MCAUiLoginCmdCB::EExit ); |
|
702 } |
|
703 |
|
704 // Check what the user responded |
|
705 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
706 { |
|
707 iEngine.GetBlockingInterface()->SetAppUiExitFlag( ETrue ); |
|
708 iQueryAccepted = ETrue; |
|
709 CHAT_DP_FUNC_DP( "HandleCommandL", "Dismissing wait dialog..." ); |
|
710 DismissWaitDialogL( KErrNone ); |
|
711 CHAT_DP_FUNC_DP( "HandleCommandL", "done" ); |
|
712 CHAT_DP_FUNC_DP( "HandleCommandL", "ShutDialogsL..." ); |
|
713 AknDialogShutter::ShutDialogsL( *iEikonEnv ); |
|
714 CHAT_DP_FUNC_DP( "HandleCommandL", "done." ); |
|
715 CHAT_DP_FUNC_DP( "HandleCommandL", "IMUIPIconForcedClear..." ); |
|
716 IMUIPIConForcedClear(); |
|
717 CHAT_DP_FUNC_DP( "HandleCommandL", "done" ); |
|
718 CHAT_DP_FUNC_DP( "HandleCommandL", "CancelAllRequests..." ); |
|
719 iProcessManager.GetLogInInterface()->CancelAllRequests(); |
|
720 CHAT_DP_FUNC_DP( "HandleCommandL", "done" ); |
|
721 // Reset soft notification counter so that |
|
722 // the note does not pop up after exit. |
|
723 CHAT_DP_FUNC_DP( "HandleCommandL", "Reset SoftNotif count.." ); |
|
724 TRAPD( err, SetSoftNotificationCounterL( 0 ) ); |
|
725 |
|
726 if ( err ) |
|
727 { |
|
728 CActiveScheduler::Current()->Error( err ); |
|
729 } |
|
730 if ( ( chatLoginType != EWVSettingsChatLoginAutoAlways ) && |
|
731 ( chatLoginType != EWVSettingsChatLoginAutoInHomeNW ) ) |
|
732 { |
|
733 CHAT_DP_FUNC_DP( "HandleCommandL", "LogoutL..." ); |
|
734 TRAP( err, iUISessionManager->LoginL( MCAUiLoginCmdCB::ELogout ) ); |
|
735 if ( err ) |
|
736 { |
|
737 CActiveScheduler::Current()->Error( err ); |
|
738 } |
|
739 CHAT_DP_FUNC_DP( "HandleCommandL", "done..." ); |
|
740 |
|
741 } |
|
742 |
|
743 // If we have some asynchronously launched dialogs, we need |
|
744 // to give them time to return. |
|
745 if ( iProcessManager.GetLogInInterface()->ReadyForShutdown() && iPendingDialogCounter <= 0 ) |
|
746 { |
|
747 TInt level = LevelOfActiveScheduler(); |
|
748 if( level > 1 ) |
|
749 { |
|
750 CActiveScheduler::Current()->Stop(); |
|
751 } |
|
752 CHAT_DP_FUNC_DP( "HandleCommandL", |
|
753 "Engine is ready for shutdown & no async dialogs pending" ); |
|
754 Exit(); |
|
755 } |
|
756 else |
|
757 { |
|
758 CHAT_DP_FUNC_DP( "HandleCommandL", |
|
759 "Engine is NOT ready for shutdown or async dialogs pending" ); |
|
760 CHAT_DP_FUNC_DP( "HandleCommandL", "Starting exitIdle." ); |
|
761 if ( !iExitIdle->IsActive() ) |
|
762 { |
|
763 iExitIdle->Start( TCallBack( ExitCallback, this ) ); |
|
764 } |
|
765 } |
|
766 } |
|
767 else |
|
768 { |
|
769 // Connection and application is not closed. |
|
770 // Go to application shell. |
|
771 /*ActivateViewL( KAknApplicationShellViewId );*/ |
|
772 TApaTaskList taskList(CCoeEnv::Static()->WsSession()); |
|
773 TApaTask chatng = taskList.FindApp( KUidChatClient ); |
|
774 |
|
775 // Send the IM to background |
|
776 chatng.SendToBackground(); |
|
777 } |
|
778 |
|
779 break; |
|
780 } |
|
781 case EChatClientMainViewCmdLogin: |
|
782 { |
|
783 TBool loginDone = EFalse; |
|
784 TRAPD( err, loginDone = iUISessionManager->LoginL( MCAUiLoginCmdCB::ELogin ) ); |
|
785 if ( err != KErrNone || ! loginDone ) |
|
786 { |
|
787 // got some error, build the views before passing leave code |
|
788 // forward |
|
789 FinalizeChatConstructionL(); |
|
790 if ( err != KErrNone ) |
|
791 { |
|
792 // IMPS Common UI has shown the error notes |
|
793 User::Leave( err ); |
|
794 } |
|
795 } |
|
796 |
|
797 break; |
|
798 } |
|
799 case EChatClientMainViewCmdLogout: |
|
800 { |
|
801 iProcessManager.GetLogInInterface()->CancelAllRequests(); |
|
802 iUISessionManager->LoginL( MCAUiLoginCmdCB::ELogout ); |
|
803 break; |
|
804 } |
|
805 case EChatPrivateListCmdSettings: // fall-through, handled similarily |
|
806 case EChatClientMainViewSettings: // fall-through, handled similarily |
|
807 case EChatClientChatListSettings: |
|
808 { |
|
809 if ( !IsBackgroundTaskPendingL() ) |
|
810 { |
|
811 // check for backgroundtask complete or not |
|
812 #ifdef RD_SETTINGS_FACELIFT |
|
813 LaunchServerSettingsDialogL(); |
|
814 #else |
|
815 SwitchViewL( KUidSettingsView ); |
|
816 #endif |
|
817 |
|
818 // When the settings dialog exit, set it back |
|
819 iStopUpdateCba = EFalse; |
|
820 } |
|
821 break; |
|
822 } |
|
823 case EChatClientChatListViewCmdJoin: |
|
824 { |
|
825 SwitchViewL( KUidChatView ); |
|
826 break; |
|
827 } |
|
828 case EChatClientMainViewCmdChangeStatus: |
|
829 { |
|
830 ChangeStatusProcessL(); |
|
831 break; |
|
832 } |
|
833 case EChatClientCmdStatusMessage: |
|
834 { |
|
835 |
|
836 MCAMainViewArrayPC* mainViewArrayPC = iProcessManager.GetArrayInterface(); |
|
837 TInt topIndex( 0 ) ; |
|
838 if ( mainViewArrayPC->GetType( topIndex ) == TEnumsPC::EOwnStatusItem ) |
|
839 { |
|
840 AskStatusMessageL( mainViewArrayPC->GetOnlineStatus( topIndex ), ETrue ); |
|
841 } |
|
842 break; |
|
843 } |
|
844 case EAknCmdHelp: |
|
845 { |
|
846 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
847 AppHelpContextL() ); |
|
848 break; |
|
849 } |
|
850 |
|
851 default: |
|
852 { |
|
853 break; |
|
854 } |
|
855 } |
|
856 } |
|
857 |
|
858 // --------------------------------------------------------- |
|
859 // CCAAppUi::DoHandleInvitationResponseL |
|
860 // (other items were commented in a header). |
|
861 // --------------------------------------------------------- |
|
862 // |
|
863 void CCAAppUi::DoHandleInvitationResponseL( TBool aAcceptance, |
|
864 const TDesC& aUserId, |
|
865 const TDesC& aGroupName, |
|
866 const TDesC& aResponse ) |
|
867 { |
|
868 // load the title texts |
|
869 HBufC* title = iEikonEnv->AllocReadResourceLC( R_QTN_CHAT_INVITE_RESPONSE ); |
|
870 |
|
871 TInt resourceId = R_QTN_CHAT_INVITE_REJECTED; |
|
872 if ( aAcceptance ) |
|
873 { |
|
874 resourceId = R_QTN_CHAT_INVITE_ACCEPT; |
|
875 } |
|
876 |
|
877 HBufC* acceptreject = iEikonEnv->AllocReadResourceLC( resourceId ); |
|
878 |
|
879 HBufC* group = iEikonEnv->AllocReadResourceLC( R_QTN_CHAT_INVITE_GROUP ); |
|
880 HBufC* message = iEikonEnv->AllocReadResourceLC( R_QTN_CHAT_INVITE_MESSAGE ); |
|
881 |
|
882 // find the identification for contact |
|
883 TPtrC identification( DisplayId( aUserId ) ); |
|
884 identification.Set( iApplicationNGPC.Identification( aUserId ) ); |
|
885 |
|
886 // calculate the length of the buffer |
|
887 TInt lfLength( KLineFeed().Length() ); |
|
888 TInt length( |
|
889 message->Length() + lfLength + |
|
890 aResponse.Length() + lfLength + |
|
891 |
|
892 acceptreject->Length() + lfLength + |
|
893 identification.Length() + lfLength + |
|
894 group->Length() + lfLength + |
|
895 aGroupName.Length() |
|
896 ); |
|
897 |
|
898 HBufC* msgBuf = HBufC::NewLC( length ); |
|
899 TPtr msg( msgBuf->Des() ); |
|
900 msg.Zero(); |
|
901 |
|
902 if ( !aAcceptance && ( aResponse.Length() > 0 ) ) |
|
903 { |
|
904 // rejected response has the reason also |
|
905 msg.Append( message->Des() ); |
|
906 msg.Append( KLineFeed ); |
|
907 msg.Append( aResponse ); |
|
908 msg.Append( KLineFeed ); |
|
909 } |
|
910 |
|
911 // accepted response (and the end of rejected response) |
|
912 msg.Append( acceptreject->Des() ); |
|
913 msg.Append( KLineFeed ); |
|
914 msg.Append( identification ); |
|
915 msg.Append( KLineFeed ); |
|
916 msg.Append( group->Des() ); |
|
917 msg.Append( KLineFeed ); |
|
918 msg.Append( CCAPCUtils::DisplayId( aGroupName ) ); |
|
919 |
|
920 IMDialogUtils::DisplayMessageQueryDialogL( |
|
921 R_CHATCLIENT_INVITE_RESPONSE_DIALOG, |
|
922 msg, title->Des(), |
|
923 ETrue // T9 |
|
924 ); |
|
925 |
|
926 CleanupStack::PopAndDestroy( 5, title ); // msgBuf, message, group, acceptreject, title |
|
927 } |
|
928 |
|
929 // --------------------------------------------------------- |
|
930 // CCAAppUi::ReceivedMsgs |
|
931 // (other items were commented in a header). |
|
932 // --------------------------------------------------------- |
|
933 // |
|
934 TInt CCAAppUi::ReceivedInvites() const |
|
935 { |
|
936 return iProcessManager.GetInvitationsInterface()->UnreadInvitesCount(); |
|
937 } |
|
938 |
|
939 // --------------------------------------------------------- |
|
940 // CCAAppUi::GroupUtils |
|
941 // (other items were commented in a header). |
|
942 // --------------------------------------------------------- |
|
943 // |
|
944 CCAGroupUtils* CCAAppUi::GroupUtils() |
|
945 { |
|
946 return iGroupUtils; |
|
947 } |
|
948 |
|
949 // --------------------------------------------------------- |
|
950 // CCAAppUi::SetForwardMessageL |
|
951 // (other items were commented in a header). |
|
952 // --------------------------------------------------------- |
|
953 // |
|
954 void CCAAppUi::SetForwardMessageL( const MCAConversationMessage* aFwdMessage ) |
|
955 { |
|
956 // if NULL |
|
957 if ( !aFwdMessage ) |
|
958 { |
|
959 delete iForwardMessage; |
|
960 iForwardMessage = NULL; |
|
961 } |
|
962 // if not the same message |
|
963 else if ( iForwardMessage != aFwdMessage ) |
|
964 { |
|
965 delete iForwardMessage; |
|
966 iForwardMessage = NULL; |
|
967 iForwardMessage = IMMessageUtilsPC::CloneMessageL( *aFwdMessage ); |
|
968 } |
|
969 } |
|
970 |
|
971 // --------------------------------------------------------- |
|
972 // CCAAppUi::ForwardMessage |
|
973 // (other items were commented in a header). |
|
974 // --------------------------------------------------------- |
|
975 // |
|
976 const MCAConversationMessage* CCAAppUi::ForwardMessage() |
|
977 { |
|
978 return iForwardMessage; |
|
979 } |
|
980 |
|
981 // --------------------------------------------------------- |
|
982 // CCAAppUi::ShowWaitDialogL |
|
983 // (other items were commented in a header). |
|
984 // --------------------------------------------------------- |
|
985 // |
|
986 void CCAAppUi::ShowWaitDialogL( const TDesC& aText, |
|
987 TBool aShowImmediately /*= EFalse*/ ) |
|
988 { |
|
989 if ( iWaitDialog ) |
|
990 { |
|
991 // hide the previous dialog and wait for it to really disappear |
|
992 DismissWaitDialogL( KErrNone, ETrue ); |
|
993 } |
|
994 |
|
995 // start capturing the events |
|
996 CaptureEventsL(); |
|
997 // show the dialog |
|
998 iWaitDialogDismissed = EFalse; |
|
999 iWaitDialog = new( ELeave )CAknWaitDialog( ( CEikDialog** )&iWaitDialog, |
|
1000 aShowImmediately ); |
|
1001 iWaitDialog->PrepareLC( R_CHAT_WAIT_NOTE_TEMPLATE ); |
|
1002 iWaitDialog->SetTone( CAknNoteDialog::ENoTone ); |
|
1003 iWaitDialog->SetTextL( aText ); |
|
1004 iWaitDialog->SetCallback( this ); |
|
1005 iWaitDialog->RunLD(); // CSI: 50 # iWaitDialog is not owned by us |
|
1006 } |
|
1007 |
|
1008 // --------------------------------------------------------- |
|
1009 // CCAAppUi::ShowWaitDialogLC |
|
1010 // (other items were commented in a header). |
|
1011 // --------------------------------------------------------- |
|
1012 // |
|
1013 void CCAAppUi::ShowWaitDialogLC( const TDesC& aText, |
|
1014 TBool aShowImmediately /* = EFalse */ ) |
|
1015 { |
|
1016 ShowWaitDialogL( aText, aShowImmediately ); |
|
1017 CleanupStack::PushL( TCleanupItem( CCAAppUi::CloseDialog, this ) ); |
|
1018 } |
|
1019 |
|
1020 // --------------------------------------------------------- |
|
1021 // CCAAppUi::ShowWaitDialogL |
|
1022 // (other items were commented in a header). |
|
1023 // --------------------------------------------------------- |
|
1024 // |
|
1025 void CCAAppUi::ShowWaitDialogL( TInt aTextResource, |
|
1026 TBool aShowImmediately /*= EFalse*/ ) |
|
1027 { |
|
1028 HBufC* text = iEikonEnv->AllocReadResourceLC( aTextResource ); |
|
1029 ShowWaitDialogL( *text, aShowImmediately ); |
|
1030 CleanupStack::PopAndDestroy( text ); |
|
1031 } |
|
1032 |
|
1033 // --------------------------------------------------------- |
|
1034 // CCAAppUi::ShowWaitDialogLC |
|
1035 // (other items were commented in a header). |
|
1036 // --------------------------------------------------------- |
|
1037 // |
|
1038 void CCAAppUi::ShowWaitDialogLC( TInt aTextResource, |
|
1039 TBool aShowImmediately /*= EFalse*/ ) |
|
1040 { |
|
1041 ShowWaitDialogL( aTextResource, aShowImmediately ); |
|
1042 CleanupStack::PushL( TCleanupItem( CCAAppUi::CloseDialog, this ) ); |
|
1043 } |
|
1044 |
|
1045 // --------------------------------------------------------- |
|
1046 // CCAAppUi::DismissWaitDialogL |
|
1047 // (other items were commented in a header). |
|
1048 // --------------------------------------------------------- |
|
1049 // |
|
1050 void CCAAppUi::DismissWaitDialogL( TInt aErrorCode, |
|
1051 TBool aWaitUntilDismissed /*= EFalse*/, |
|
1052 const TDesC& aAdditionalData ) |
|
1053 { |
|
1054 if ( iWaitDialog ) |
|
1055 { |
|
1056 TRAPD( err, iWaitDialog->ProcessFinishedL() ); |
|
1057 if ( err != KErrNone ) |
|
1058 { |
|
1059 // don't know for sure that ProcessFinishedL deletes the dialog |
|
1060 // in all cases, so let's delete it |
|
1061 delete iWaitDialog; |
|
1062 iWaitDialog = NULL; |
|
1063 iWaitDialogDismissed = ETrue; |
|
1064 User::Leave( err ); |
|
1065 } |
|
1066 else |
|
1067 { |
|
1068 // start waiting for actual hiding if requested |
|
1069 if ( !iWaitDialogDismissed && aWaitUntilDismissed ) |
|
1070 { |
|
1071 if ( !iWait.IsStarted() ) |
|
1072 { |
|
1073 iWait.Start(); // CSI: 10 # iWait is not an active object |
|
1074 } |
|
1075 } |
|
1076 } |
|
1077 // stop capturing the events |
|
1078 ReleaseCapturingL(); |
|
1079 } |
|
1080 |
|
1081 // leave on everything else but imps errors (and timeout) |
|
1082 if ( ( aErrorCode > Imps_ERROR_BASE ) && ( aErrorCode != KErrTimedOut ) |
|
1083 && ( aErrorCode != KErrCancel ) ) |
|
1084 { |
|
1085 User::LeaveIfError( aErrorCode ); |
|
1086 } |
|
1087 else |
|
1088 { |
|
1089 // otherwise show error note, if this is really an error |
|
1090 IMNoteMapper::ShowNoteL( aErrorCode, aAdditionalData ); |
|
1091 } |
|
1092 } |
|
1093 |
|
1094 // ----------------------------------------------------------------------------- |
|
1095 // CCAAppUi::IconLoader |
|
1096 // Return iconloader |
|
1097 // ----------------------------------------------------------------------------- |
|
1098 // |
|
1099 CCAIconLoader& CCAAppUi::IconLoader() const |
|
1100 { |
|
1101 if ( !iIconLoader ) |
|
1102 { |
|
1103 CActiveScheduler::Current()->Error( KErrNotFound ); |
|
1104 } |
|
1105 return *iIconLoader; |
|
1106 } |
|
1107 |
|
1108 // ----------------------------------------------------------------------------- |
|
1109 // CCAAppUi::MessageHandler |
|
1110 // Return message handler |
|
1111 // ----------------------------------------------------------------------------- |
|
1112 // |
|
1113 CCAMessageExtensionsHandler& CCAAppUi::MessageHandler() const |
|
1114 { |
|
1115 if ( !iMessageHandler ) |
|
1116 { |
|
1117 CActiveScheduler::Current()->Error( KErrNotFound ); |
|
1118 } |
|
1119 return *iMessageHandler; |
|
1120 } |
|
1121 |
|
1122 // ----------------------------------------------------------------------------- |
|
1123 // CCAAppUi::DisplayId |
|
1124 // Hide some parts of userid/groupid/listid |
|
1125 // ----------------------------------------------------------------------------- |
|
1126 // |
|
1127 TPtrC CCAAppUi::DisplayId( const TDesC& aId, TBool aListHiding /* = EFalse */ ) |
|
1128 { |
|
1129 return CCAPCUtils::DisplayId( aId, aListHiding ); |
|
1130 } |
|
1131 |
|
1132 // ----------------------------------------------------------------------------- |
|
1133 // CCAAppUi::ReadBrandedResourcesL |
|
1134 // (other items were commented in a header). |
|
1135 // ----------------------------------------------------------------------------- |
|
1136 // |
|
1137 void CCAAppUi::ReadBrandedResourcesL() |
|
1138 { |
|
1139 // check if we have resource-file variated "wv:"-part showing support |
|
1140 // enabled and cache it to storage (everything uses that) |
|
1141 TInt hideWV = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_HIDE_WV ); |
|
1142 iApplicationNGPC.SetWVHiding( hideWV ? ETrue : EFalse ); |
|
1143 |
|
1144 // UI CR : Domain part showing. Only prefix hiding |
|
1145 TInt hideWVprefix = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_HIDE_ONLY_PREFIX ); |
|
1146 iApplicationNGPC.SetWVHidingPrefixOnly( hideWVprefix ? ETrue : EFalse ); |
|
1147 |
|
1148 TInt capitalEnabled = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_CONTACT_LISTS_CAPITALIZED ); |
|
1149 iApplicationNGPC.SetCapitalizingEnabled( capitalEnabled ? ETrue : EFalse ); |
|
1150 |
|
1151 // Not used in backported 3.0 environment |
|
1152 TInt overRideDefaultTone = |
|
1153 IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_OVERRIDE_DEFAULT_TONE ); |
|
1154 if ( overRideDefaultTone && iUISessionManager ) |
|
1155 { |
|
1156 |
|
1157 // When application is started there might not be any SAPs defined, |
|
1158 // ignore KErrNotFound leave. |
|
1159 CIMPSSAPSettings* currentSap = NULL; |
|
1160 TRAPD( err, |
|
1161 currentSap = iUISessionManager->CurrentSAPLC(); |
|
1162 // currentSap has to be popped before exiting TRAP harness |
|
1163 CleanupStack::Pop( currentSap ); |
|
1164 ); // TRAPD |
|
1165 |
|
1166 // Push it back to CleanupStack |
|
1167 CleanupStack::PushL( currentSap ); |
|
1168 |
|
1169 if ( err == KErrNone ) |
|
1170 { |
|
1171 TPtrC currentTone; |
|
1172 TInt retVal = |
|
1173 currentSap->GetOpaqueDesC16( KIMAlertTonePath(), currentTone ); |
|
1174 if ( retVal == KErrNotFound ) |
|
1175 { |
|
1176 // Set default sound only once from resources |
|
1177 HBufC* tone = iCoeEnv->AllocReadResourceAsDes16LC( R_DEFAULT_TONE ); |
|
1178 currentSap->SetOpaqueDesC16( KIMAlertTonePath(), *tone ); |
|
1179 iSAPSettingsStore->UpdateOldSAPL( currentSap, currentSap->Uid() ); |
|
1180 CleanupStack::PopAndDestroy( tone ); |
|
1181 } |
|
1182 } |
|
1183 |
|
1184 CleanupStack::PopAndDestroy( currentSap ); |
|
1185 } |
|
1186 // this method is also done when we get a SAP change event |
|
1187 } |
|
1188 |
|
1189 // --------------------------------------------------------- |
|
1190 // CCAAppUi::DialogDismissedL |
|
1191 // (other items were commented in a header). |
|
1192 // --------------------------------------------------------- |
|
1193 // |
|
1194 void CCAAppUi::DialogDismissedL( TInt /*aButtonId*/ ) |
|
1195 { |
|
1196 iWaitDialogDismissed = ETrue; |
|
1197 if ( iWait.IsStarted() ) |
|
1198 { |
|
1199 iWait.AsyncStop(); |
|
1200 } |
|
1201 |
|
1202 // stop capturing the events |
|
1203 ReleaseCapturingL(); |
|
1204 } |
|
1205 |
|
1206 // --------------------------------------------------------- |
|
1207 // CCAAppUi::SwitchViewBackL( TUid aViewId ) |
|
1208 // |
|
1209 // --------------------------------------------------------- |
|
1210 // |
|
1211 void CCAAppUi::SwitchViewBackL( TUid aViewId, TUid aCustomMessageId /* = NULL*/, |
|
1212 const TDesC8& aCustomMessage /* = KNullDesC*/ ) |
|
1213 { |
|
1214 TInt switchViewIndex = iSwitchView.Count() - 1; |
|
1215 TInt switchMsgIndex = iSwitchMessage.Count() - 1; |
|
1216 TInt switchMsgContentIndex = iSwitchMessageContent.Count() - 1; |
|
1217 |
|
1218 if ( switchViewIndex >= 0 && iSwitchMessageContent[ switchMsgContentIndex ] ) |
|
1219 { |
|
1220 TRAPD( err, SwitchViewL( iSwitchView[ switchViewIndex ], |
|
1221 iSwitchMessage[ switchMsgIndex ], |
|
1222 *iSwitchMessageContent[ switchMsgContentIndex ] ) ); |
|
1223 |
|
1224 if ( iSwitchView[ switchViewIndex ] == KUidChatView || |
|
1225 iSwitchView[ switchViewIndex ] == KUidConversationsView || |
|
1226 iSwitchView[ switchViewIndex ] == KUidRecordedChatView ) |
|
1227 |
|
1228 { |
|
1229 iLastView = TUid::Uid( 0 ); |
|
1230 } |
|
1231 |
|
1232 iSwitchView[ switchViewIndex ] = TUid::Uid( 0 ); |
|
1233 iSwitchMessage[ switchMsgIndex ] = TUid::Uid( 0 ); |
|
1234 |
|
1235 delete iSwitchMessageContent[ switchMsgContentIndex ]; |
|
1236 iSwitchMessageContent[ switchMsgContentIndex ] = NULL; |
|
1237 |
|
1238 iSwitchView.Remove( switchViewIndex ); |
|
1239 iSwitchMessage.Remove( switchMsgIndex ); |
|
1240 iSwitchMessageContent.Remove( switchMsgContentIndex ); |
|
1241 |
|
1242 User::LeaveIfError( err ); |
|
1243 |
|
1244 return; |
|
1245 } |
|
1246 else if ( switchViewIndex >= 0 && iSwitchView[ switchViewIndex ] != |
|
1247 TUid::Uid( 0 ) ) |
|
1248 { |
|
1249 SwitchViewL( iSwitchView[ switchViewIndex ] ); |
|
1250 iSwitchView[ switchViewIndex ] = TUid::Uid( 0 ); |
|
1251 iSwitchView.Remove( switchViewIndex ); |
|
1252 return; |
|
1253 } |
|
1254 |
|
1255 if ( iLastView != TUid::Uid( 0 ) & iLastView != KUidInvitationView ) |
|
1256 { |
|
1257 SwitchViewL( iLastView, aCustomMessageId, aCustomMessage ); |
|
1258 iLastView = TUid::Uid( 0 ); |
|
1259 } |
|
1260 else |
|
1261 { |
|
1262 SwitchViewL( aViewId, aCustomMessageId, aCustomMessage ); |
|
1263 } |
|
1264 } |
|
1265 |
|
1266 // --------------------------------------------------------- |
|
1267 // CCAAppUi::SwitchViewL( TUid aViewId ) |
|
1268 // From MCAViewSwitcher, handles view-switch requests |
|
1269 // (other items were commented in a header). |
|
1270 // --------------------------------------------------------- |
|
1271 // |
|
1272 void CCAAppUi::SwitchViewL( TUid aViewId ) |
|
1273 { |
|
1274 CHAT_DP( D_CHAT_LIT( "CCAAppUi::SwitchViewL, requested view: %d" ), |
|
1275 aViewId.iUid ); |
|
1276 |
|
1277 if ( iIsAppForeground ) |
|
1278 { |
|
1279 CHAT_DP_FUNC_DP( "SwitchViewL", "Application was in foreground" ); |
|
1280 TUid myLastView = ActiveViewId(); |
|
1281 if ( myLastView != aViewId && myLastView != KUidRefreshView ) |
|
1282 { |
|
1283 iLastView = myLastView; |
|
1284 } |
|
1285 |
|
1286 ActivateLocalViewL( aViewId ); |
|
1287 |
|
1288 iOkToSwitch = EFalse; |
|
1289 } |
|
1290 else |
|
1291 { |
|
1292 iOkToSwitch = ETrue; |
|
1293 } |
|
1294 |
|
1295 iActiveViewId = aViewId; |
|
1296 iCustomMessageId = KNullUid; |
|
1297 delete iCustomMessage; |
|
1298 iCustomMessage = NULL; |
|
1299 |
|
1300 ReleaseCapturingL(); |
|
1301 } |
|
1302 |
|
1303 // --------------------------------------------------------- |
|
1304 // CCAAppUi::SwitchViewL |
|
1305 // From MCAViewSwitcher, handles view-switch requests |
|
1306 // (other items were commented in a header). |
|
1307 // --------------------------------------------------------- |
|
1308 // |
|
1309 void CCAAppUi::SwitchViewL( TUid aViewId, |
|
1310 TUid aCustomMessageId, |
|
1311 const TDesC8& aCustomMessage ) |
|
1312 { |
|
1313 CHAT_DP( D_CHAT_LIT( |
|
1314 "CCAAppUi::SwitchViewL, requested view: %d, messageID: %d, message: %S" ), |
|
1315 aViewId.iUid, aCustomMessageId.iUid, &aCustomMessage ); |
|
1316 |
|
1317 if ( iIsAppForeground ) |
|
1318 { |
|
1319 CHAT_DP_FUNC_DP( "SwitchViewL", "Application was in foreground" ); |
|
1320 TUid myLastView = ActiveViewId(); |
|
1321 if ( myLastView != aViewId && myLastView != KUidRefreshView ) |
|
1322 { |
|
1323 iLastView = myLastView; |
|
1324 } |
|
1325 |
|
1326 ActivateLocalViewL( aViewId, aCustomMessageId, aCustomMessage ); |
|
1327 |
|
1328 iOkToSwitch = EFalse; |
|
1329 } |
|
1330 else |
|
1331 { |
|
1332 iOkToSwitch = ETrue; |
|
1333 } |
|
1334 |
|
1335 HBufC8* tmp = aCustomMessage.AllocLC(); |
|
1336 delete iCustomMessage; |
|
1337 iCustomMessage = tmp; |
|
1338 CleanupStack::Pop(); // tmp |
|
1339 |
|
1340 iActiveViewId = aViewId; |
|
1341 iCustomMessageId = aCustomMessageId; |
|
1342 |
|
1343 ReleaseCapturingL(); |
|
1344 } |
|
1345 |
|
1346 // --------------------------------------------------------- |
|
1347 // CCAAppUi::RegisterSwitchBack |
|
1348 // From MCAViewSwitcher |
|
1349 // --------------------------------------------------------- |
|
1350 // |
|
1351 void CCAAppUi::RegisterSwitchBack( TUid aViewId, |
|
1352 TUid aCustomMessageId, |
|
1353 HBufC8* aCustomMessage, |
|
1354 TUid aNextView ) |
|
1355 { |
|
1356 TUid prevViewId; |
|
1357 |
|
1358 if ( iSwitchView.Count() > 0 ) |
|
1359 { |
|
1360 prevViewId = iSwitchView[ iSwitchView.Count() - 1 ]; |
|
1361 } |
|
1362 else |
|
1363 { |
|
1364 prevViewId = KNullUid; |
|
1365 } |
|
1366 |
|
1367 // Check if we are forwarding for the second time |
|
1368 if ( ( prevViewId == KUidChatView || prevViewId == KUidConversationsView ) |
|
1369 && ( aViewId == KUidChatView || aViewId == KUidConversationsView ) ) |
|
1370 { |
|
1371 if ( iSwitchView.Count() > 0 ) |
|
1372 { |
|
1373 // remove the previous view |
|
1374 delete iSwitchMessageContent[ iSwitchMessageContent.Count()-1 ]; |
|
1375 iSwitchMessageContent[ iSwitchMessageContent.Count()-1 ] = NULL; |
|
1376 |
|
1377 iSwitchView.Remove( iSwitchView.Count() - 1 ); |
|
1378 iSwitchMessage.Remove( iSwitchMessage.Count() - 1 ); |
|
1379 iSwitchMessageContent.Remove( iSwitchMessageContent.Count() - 1 ); |
|
1380 } |
|
1381 |
|
1382 delete aCustomMessage; |
|
1383 |
|
1384 if ( aNextView == KUidConversationsView ) |
|
1385 { |
|
1386 // add the conversation list view. |
|
1387 iSwitchView.Append( KUidChatPrivateChatListView ); |
|
1388 } |
|
1389 else // aNextView == KUidChatView |
|
1390 { |
|
1391 // add the chat group list view. |
|
1392 iSwitchView.Append( KUidChatListView ); |
|
1393 } |
|
1394 |
|
1395 iSwitchMessage.Append( KNullUid ); |
|
1396 iSwitchMessageContent.Append( NULL ); |
|
1397 } |
|
1398 else |
|
1399 { |
|
1400 // normal behaviour |
|
1401 iSwitchView.Append( aViewId ); |
|
1402 iSwitchMessage.Append( aCustomMessageId ); |
|
1403 iSwitchMessageContent.Append( aCustomMessage ); |
|
1404 } |
|
1405 } |
|
1406 |
|
1407 // --------------------------------------------------------- |
|
1408 // CCAAppUi::DeRegisterSwitchBack |
|
1409 // From MCAViewSwitcher |
|
1410 // --------------------------------------------------------- |
|
1411 // |
|
1412 void CCAAppUi::DeRegisterSwitchBack( TUid aViewId, |
|
1413 const TDesC& aTarget ) |
|
1414 { |
|
1415 TInt index = 0; |
|
1416 TInt count = iSwitchView.Count(); |
|
1417 |
|
1418 // Check all views in queue |
|
1419 for ( ; index < count; index++ ) |
|
1420 { |
|
1421 if ( aViewId == iSwitchView[index] ) |
|
1422 { |
|
1423 TInt compare = -1; |
|
1424 |
|
1425 // Check if this is view to be deregistered |
|
1426 if ( aViewId == KUidChatView ) |
|
1427 { |
|
1428 TCADnlChatViewBuf viewBuf; |
|
1429 viewBuf.Copy( *iSwitchMessageContent[index] ); |
|
1430 compare = CAUtils::NeutralCompare( aTarget, viewBuf().iGroupId ); |
|
1431 } |
|
1432 else if ( aViewId == KUidConversationsView ) |
|
1433 { |
|
1434 TCADnlConvViewBuf viewBuf; |
|
1435 viewBuf.Copy( *iSwitchMessageContent[index] ); |
|
1436 compare = CAUtils::NeutralCompare( aTarget, viewBuf().iWVID ); |
|
1437 } |
|
1438 |
|
1439 // Deregister view |
|
1440 if ( compare == 0 ) |
|
1441 { |
|
1442 iSwitchView.Remove( index ); |
|
1443 iSwitchMessage.Remove( index ); |
|
1444 delete iSwitchMessageContent[index]; |
|
1445 iSwitchMessageContent.Remove( index ); |
|
1446 count = iSwitchView.Count(); |
|
1447 } |
|
1448 } |
|
1449 } |
|
1450 } |
|
1451 |
|
1452 // ----------------------------------------------------------------------------- |
|
1453 // CCAAppUi::ViewExists |
|
1454 // Checks if view exists |
|
1455 // ----------------------------------------------------------------------------- |
|
1456 // |
|
1457 TBool CCAAppUi::ViewExists( TUid aViewId ) |
|
1458 { |
|
1459 if ( View( aViewId ) ) |
|
1460 { |
|
1461 return ETrue; |
|
1462 } |
|
1463 return EFalse; |
|
1464 } |
|
1465 |
|
1466 |
|
1467 // ----------------------------------------------------------------------------- |
|
1468 // CCAAppUi::ActiveViewId |
|
1469 // ----------------------------------------------------------------------------- |
|
1470 // |
|
1471 TUid CCAAppUi::ActiveViewId() |
|
1472 { |
|
1473 TVwsViewId viewId; |
|
1474 GetActiveViewId( viewId ); |
|
1475 return viewId.iViewUid; |
|
1476 } |
|
1477 |
|
1478 // --------------------------------------------------------- |
|
1479 // CCAAppUi::HandleResourceChangeL |
|
1480 // (other items were commented in a header). |
|
1481 // --------------------------------------------------------- |
|
1482 // |
|
1483 void CCAAppUi::HandleResourceChangeL( TInt aType ) |
|
1484 { |
|
1485 CAknViewAppUi::HandleResourceChangeL( aType ); |
|
1486 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
1487 { |
|
1488 // skin change for this app ui class |
|
1489 iLayoutInfo->LayoutChangedL( aType ); |
|
1490 |
|
1491 CalculatePreviewPaneWidth(); |
|
1492 |
|
1493 // Update skin layout |
|
1494 CCAVariantFactory* varFact = |
|
1495 static_cast<CCAApp*>( Application() )->VariantFactory(); |
|
1496 varFact->SkinVariantL()->UpdateLayout(); |
|
1497 } |
|
1498 |
|
1499 |
|
1500 if ( aType == KEikDynamicLayoutVariantSwitch || |
|
1501 aType == KAknsMessageSkinChange ) |
|
1502 { |
|
1503 TInt count( iLayoutObservers.Count() ); |
|
1504 for ( TInt i( 0 ); i < count; ++i ) |
|
1505 { |
|
1506 iLayoutObservers[i]->LayoutChangedL( aType ); |
|
1507 } |
|
1508 // Set the icons |
|
1509 if ( iUISessionManager ) |
|
1510 { |
|
1511 iUISessionManager->SetStatusPaneIconsL(); |
|
1512 } |
|
1513 } |
|
1514 } |
|
1515 |
|
1516 // --------------------------------------------------------- |
|
1517 // CCAAppUi::ConstructL |
|
1518 // Symbian OS default constructor can leave. |
|
1519 // --------------------------------------------------------- |
|
1520 // |
|
1521 void CCAAppUi::ConstructL() |
|
1522 { |
|
1523 CHAT_DP_TXT( "CCAAppUi::ConstructL() starting" ); |
|
1524 |
|
1525 // The Settings are now stored in Cenrep, and it needs to be fetched using the instance of CRepository, so InitializeLibL will create the instance of CRepository |
|
1526 //using the instance of CRepository, so InitializeLibL will create the instance of CRepository |
|
1527 IMUtils::InitializeLibL(); |
|
1528 iIsFSWExit = EFalse; |
|
1529 iDestructingFlag = EFalse; |
|
1530 |
|
1531 BaseConstructL( EAknEnableSkin | ENoAppResourceFile | |
|
1532 EAppOrientationAutomatic | EAknEnableMSK ); |
|
1533 |
|
1534 |
|
1535 //create Splash Screen |
|
1536 iSplashScreen = CCASplashScreen::NewL( this ); |
|
1537 CAVersion::UpdateVersion( iCoeEnv->FsSession() |
|
1538 , KPrivateVersionFile |
|
1539 , KPublishedVersionFile ); |
|
1540 |
|
1541 // Get mem low note variation status |
|
1542 iShowMemLowNote = |
|
1543 ( IMUtils::CRKeyL( KCRUidIMVariation, KIMVariationKey ) |
|
1544 & EIMFeatMemLowWarningNote ); |
|
1545 |
|
1546 // Read CR variation flag |
|
1547 iBrandableToneList = |
|
1548 ( IMUtils::CRKeyL( KCRUidIMVariation, KIMVariationKey ) |
|
1549 & EIMFeatBrandableTones ); |
|
1550 |
|
1551 iStatusMessage = HBufC::NewL( KPEngMaxWVStatusTextLength ); |
|
1552 |
|
1553 iLayoutInfo = CCALayoutInfo::NewL( TChatListBoxLayout::EWithoutEditor ); |
|
1554 iLayoutInfo->LayoutChangedL(); |
|
1555 |
|
1556 CalculatePreviewPaneWidth(); |
|
1557 |
|
1558 //Creating exit idle |
|
1559 iExitIdle = CIdle::NewL( CActive::EPriorityIdle ); |
|
1560 |
|
1561 FeatureManager::InitializeLibL(); |
|
1562 |
|
1563 /** CR - 106 - 1357 |
|
1564 * KFeatureIdChatNG, if not supported, then we should not allow the |
|
1565 * Application to launch further, so we leave with an error |
|
1566 * "Feature Not Supported!". |
|
1567 */ |
|
1568 if ( !FeatureManager :: FeatureSupported ( KFeatureIdChatNG ) ) |
|
1569 { |
|
1570 User :: Leave ( KErrNotSupported ); |
|
1571 } |
|
1572 |
|
1573 CHAT_DP_TXT( "CCAAppUi::ConstructL() featuremanager initialized" ); |
|
1574 |
|
1575 // Brand UI |
|
1576 CCAVariantFactory* varFact = |
|
1577 static_cast<CCAApp*>( Application() )->VariantFactory(); |
|
1578 |
|
1579 // CR : 101-39724 Error note needed when application cannot be opened because of the lack of the memory |
|
1580 MCAOpBrandVariant* opBrand = NULL ; |
|
1581 TRAPD( err, opBrand = varFact->OpBrandVariantL() ); |
|
1582 if ( err ) |
|
1583 { |
|
1584 // Using CErrorUI, which matches the errorcode passed with coreesponding error string |
|
1585 // and displays the note. |
|
1586 CErrorUI* errorUI = CErrorUI::NewLC( ); |
|
1587 errorUI->ShowGlobalErrorNoteL( err ); |
|
1588 CleanupStack::PopAndDestroy( errorUI ); |
|
1589 User::Leave( err ); |
|
1590 } |
|
1591 |
|
1592 RetrieveBrandL( *opBrand ); |
|
1593 |
|
1594 CHAT_DP_TXT( "CCAAppUi::ConstructL() brand retrieved" ); |
|
1595 |
|
1596 MCASkinVariant* skin = varFact->SkinVariantL(); |
|
1597 |
|
1598 CHAT_DP_TXT( "CCAAppUi::ConstructL() skinvariant constructed" ); |
|
1599 |
|
1600 iIconLoader = CCAIconLoader::NewL( iChatMbmFullPath, *skin ); |
|
1601 |
|
1602 CHAT_DP_TXT( "CCAAppUi::ConstructL() iconloader constructed" ); |
|
1603 |
|
1604 // Initialize Connection UI agent |
|
1605 iConnUIAgent = CIMPSConnectionUiAgent::NewL( EIMPSConnClientIM ); |
|
1606 |
|
1607 CHAT_DP_TXT( "CCAAppUi::ConstructL() connuiagent constructed" ); |
|
1608 |
|
1609 iConnUIAgent->StartServiceL( |
|
1610 EIMPSQueryActiveConnectionScheduledClose ); |
|
1611 |
|
1612 CHAT_DP_TXT( "CCAAppUi::ConstructL() connuiagent started 1" ); |
|
1613 |
|
1614 iConnUIAgent->StartServiceL( |
|
1615 EIMPSQueryActiveConnectionSuppressForScheduledConnection ); |
|
1616 |
|
1617 CHAT_DP_TXT( "CCAAppUi::ConstructL() connuiagent started 2" ); |
|
1618 |
|
1619 iConnUIAgent->StartServiceL( |
|
1620 EIMPSReqisterAsSignificantConnectionClientInScheduling ); |
|
1621 |
|
1622 CHAT_DP_TXT( "CCAAppUi::ConstructL() connuiagent started 3" ); |
|
1623 |
|
1624 iConnUIAgent->StartServiceL( |
|
1625 EIMPSNotifyActiveConnectionLostReasons ); |
|
1626 |
|
1627 CHAT_DP_TXT( "CCAAppUi::ConstructL() connuiagent started 4" ); |
|
1628 |
|
1629 // SAP settings store |
|
1630 iSAPSettingsStore = CIMPSSAPSettingsStore::NewL(); |
|
1631 //raj |
|
1632 iSAPSettingsStore->AddObserverL( this, EIMPSIMAccessGroup ); |
|
1633 |
|
1634 CHAT_DP_TXT( "CCAAppUi::ConstructL() sapsettingstore constructed" ); |
|
1635 |
|
1636 // Initialize Universal Indicator Pane handling |
|
1637 InitializeUIPHandlingL(); |
|
1638 |
|
1639 CHAT_DP_TXT( "CCAAppUi::ConstructL() uiphandling initialized" ); |
|
1640 |
|
1641 // Centralized handler for navi-pane changes |
|
1642 iStatusPaneHandler = CCAStatusPaneHandler::NewL(); |
|
1643 |
|
1644 CHAT_DP_TXT( "CCAAppUi::ConstructL() statuspanehandler constructed" ); |
|
1645 |
|
1646 iConnUI = CIMPSPresenceConnectionUi::NewL( EIMPSConnClientIM ); |
|
1647 |
|
1648 // Audio manager for playing simple sounds |
|
1649 iAudioManager = CCAAudioManager::NewL( *iConnUI ); |
|
1650 |
|
1651 CHAT_DP_TXT( "CCAAppUi::ConstructL() audiomanager constructed" ); |
|
1652 |
|
1653 // Input absorber |
|
1654 iInputAbsorber = CCAInputAbsorber::NewL(); |
|
1655 |
|
1656 CHAT_DP_TXT( "CCAAppUi::ConstructL() inputabsorber constructed" ); |
|
1657 |
|
1658 // screen name holder |
|
1659 iScreenName = HBufC::NewL( KScreenNameMaxLength ); |
|
1660 |
|
1661 //Message extension handler. This must be created before views. |
|
1662 iMessageHandler = CCAMessageExtensionsHandler::NewL( *skin, *this ); |
|
1663 |
|
1664 CHAT_DP_TXT( "CCAAppUi::ConstructL() messagehandler constructed" ); |
|
1665 |
|
1666 // Create just the main view. Other views are created when the engine |
|
1667 // has been fully constructed, since they depend on it. We can't |
|
1668 // create the engine now because it will boot up the IMPS Server which |
|
1669 // will take a long time. |
|
1670 //CAViewCreator::CreateMainViewL( *this ); |
|
1671 |
|
1672 CHAT_DP_TXT( "CCAAppUi::ConstructL() main view created" ); |
|
1673 |
|
1674 // This has to be set before UISessionManager is created. |
|
1675 // Needed for branding purposes |
|
1676 // and for refresh view. |
|
1677 iActiveViewId = KUidFriendsListView; |
|
1678 |
|
1679 |
|
1680 // Create ui session manager (it takes care of needed UI sequences |
|
1681 // concerning UI construction) |
|
1682 iUISessionManager = CCAUISessionManager::NewL( *iConnUI, skin, |
|
1683 opBrand, |
|
1684 this, |
|
1685 this, |
|
1686 iStatusPaneHandler, |
|
1687 &MbmFullPath() ); |
|
1688 |
|
1689 CHAT_DP_TXT( "CCAAppUi::ConstructL() UISessionManager constructed" ); |
|
1690 |
|
1691 // Show Splash Screen, if variated so |
|
1692 // IM client UI customization, phase 2 |
|
1693 // Based on Variation flag, Display SplashScreen |
|
1694 TBool showSplashScreen = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SHOW_SPLASH_SCREEN ); |
|
1695 if ( showSplashScreen ) |
|
1696 { |
|
1697 ShowSplashScreenL( *skin ); |
|
1698 } |
|
1699 else |
|
1700 { |
|
1701 SplashScreenShowed(); |
|
1702 } |
|
1703 |
|
1704 } |
|
1705 |
|
1706 // ----------------------------------------------------------------------------- |
|
1707 // CCAAppUi::InitializeEngineObserversL |
|
1708 // (other items were commented in a header). |
|
1709 // ----------------------------------------------------------------------------- |
|
1710 // |
|
1711 void CCAAppUi::InitializeEngineObserversL() |
|
1712 { |
|
1713 // engine is valid before this is called |
|
1714 |
|
1715 MCAGlobalNotificationObserverPC& globalNotificationObserverPC ( *iProcessManager.GetGlobalNotificationInterface() ); |
|
1716 |
|
1717 |
|
1718 globalNotificationObserverPC.AddGlobalObserverL( this ); |
|
1719 |
|
1720 //iEngine.MessageUtils().MessageErrorInformer().RegisterObserver( this ); |
|
1721 iEngineInitialized = ETrue; |
|
1722 } |
|
1723 |
|
1724 // ----------------------------------------------------------------------------- |
|
1725 // CCAAppUi::FinalizeChatConstructionL |
|
1726 // (other items were commented in a header). |
|
1727 // ----------------------------------------------------------------------------- |
|
1728 // |
|
1729 void CCAAppUi::FinalizeChatConstructionL() |
|
1730 { |
|
1731 if ( iChatFullyConstructed ) |
|
1732 { |
|
1733 // we're already fully constructed |
|
1734 return; |
|
1735 } |
|
1736 |
|
1737 iProcessManager.FinalizeEngineConstructionL(); |
|
1738 InitializeEngineObserversL(); |
|
1739 CAViewCreator::CreateOtherViewsL( *this ); |
|
1740 |
|
1741 iProcessManager.GetRecordedChatsArrayPC()->FinalizeRecChatsArrayPCConstructionL(); |
|
1742 // after this call, chat application is now fully constructed |
|
1743 iChatFullyConstructed = ETrue; |
|
1744 } |
|
1745 |
|
1746 // ----------------------------------------------------------------------------- |
|
1747 // CCAAppUi::SetPlayOnce |
|
1748 // (other items were commented in a header). |
|
1749 // ----------------------------------------------------------------------------- |
|
1750 // |
|
1751 void CCAAppUi::SetPlayOnce( TBool aPlayOnce ) |
|
1752 { |
|
1753 iPlayOnce = aPlayOnce; |
|
1754 } |
|
1755 |
|
1756 // ----------------------------------------------------------------------------- |
|
1757 // CCAAppUi::AfterRefreshViewId |
|
1758 // (other items were commented in a header). |
|
1759 // ----------------------------------------------------------------------------- |
|
1760 // |
|
1761 TUid CCAAppUi::AfterRefreshViewId( const TUid& aPrevious ) |
|
1762 { |
|
1763 if ( iDefaultRefreshInUse ) |
|
1764 { |
|
1765 return aPrevious; |
|
1766 } |
|
1767 else |
|
1768 { |
|
1769 iDefaultRefreshInUse = ETrue; |
|
1770 return KUidFriendsListView; |
|
1771 } |
|
1772 } |
|
1773 |
|
1774 // ----------------------------------------------------------------------------- |
|
1775 // CCAAppUi::SplashScreenShowed |
|
1776 // (other items were commented in a header). |
|
1777 // ----------------------------------------------------------------------------- |
|
1778 // |
|
1779 void CCAAppUi::SplashScreenShowed() |
|
1780 { |
|
1781 // Create just the main view. Other views are created when the engine |
|
1782 // has been fully constructed, since they depend on it. We can't |
|
1783 // create the engine now because it will boot up the IMPS Server which |
|
1784 // will take a long time. |
|
1785 CAViewCreator::CreateMainViewL( *this ); |
|
1786 CHAT_DP_TXT( "CCAAppUi::ConstructL() main view created" ); |
|
1787 |
|
1788 iGroupUtils = CCAGroupUtils::NewLC( *this ); |
|
1789 CleanupStack::Pop( iGroupUtils ); |
|
1790 |
|
1791 CHAT_DP_TXT( "CCAAppUi::ConstructL() grouputils constructed" ); |
|
1792 |
|
1793 ReadBrandedResourcesL(); |
|
1794 |
|
1795 CHAT_DP_TXT( "CCAAppUi::ConstructL() branded resources read" ); |
|
1796 |
|
1797 |
|
1798 FinalizeChatConstructionL(); |
|
1799 |
|
1800 CCACommandManagerFactory* commandManagerFactory = CCACommandManagerFactory::InstanceL(); |
|
1801 |
|
1802 commandManagerFactory->InitializeSessionHandlerL( iProcessManager, *iUISessionManager ); |
|
1803 |
|
1804 StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); |
|
1805 |
|
1806 CHAT_DP_TXT( "CCAAppUi::ConstructL() ready" ); |
|
1807 |
|
1808 |
|
1809 //create infopopup note controller |
|
1810 iInfoPopup = CAknInfoPopupNoteController::NewL(); |
|
1811 |
|
1812 iInfoPopup->AddObserverL( *this ); |
|
1813 |
|
1814 iPreviewMessageList = new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); |
|
1815 |
|
1816 iFocusFlag = EFalse; |
|
1817 |
|
1818 iQueryAccepted = EFalse; |
|
1819 iForward = TEnumsPC::EUnregistered; |
|
1820 |
|
1821 iIsFSDExitNeeded = EFalse; |
|
1822 |
|
1823 iLaunchSettingsDialogWait = EFalse; |
|
1824 } |
|
1825 |
|
1826 // ----------------------------------------------------------------------------- |
|
1827 // CCAAppUi::ShowSplashScreenL |
|
1828 // (other items were commented in a header). |
|
1829 // ----------------------------------------------------------------------------- |
|
1830 // |
|
1831 void CCAAppUi::ShowSplashScreenL( MCASkinVariant& aSkinVariant ) |
|
1832 { |
|
1833 // Read Splash Screen duration from resource |
|
1834 // IM client UI customization, phase 2 |
|
1835 // Based on Variation flag, SplashScreen Display duration |
|
1836 TBool aSplashDelay = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SPLASH_SCREEN_DURATION ); |
|
1837 // TInt aSplashDelay = 4; //in seconds |
|
1838 /* |
|
1839 CFbsBitmap* bitmapmain = new (ELeave) CFbsBitmap(); |
|
1840 CFbsBitmap* bitmapmask = new (ELeave) CFbsBitmap(); |
|
1841 TSize size(240,320); |
|
1842 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1843 AknsUtils::CreateAppIconLC(skin, TUid::Uid(EAknsMinorGenericQgnGrafShutdown), EAknsAppIconTypeContext,bitmapmain,bitmapmask); |
|
1844 // EAknsMajorScreensaver EAknsMinorGenericQgnPropImSmileysHappy EAknsMinorGenericQgnGrafShutdown EAknsAppIconType3D EAknsAppIconTypeList |
|
1845 AknIconUtils::SetSize(bitmapmain,size); |
|
1846 AknIconUtils::SetSize(bitmapmask,size); |
|
1847 |
|
1848 CGulIcon *Icon = CGulIcon::NewL(bitmapmain,bitmapmask); |
|
1849 CleanupStack::Pop(2); |
|
1850 */ |
|
1851 /* |
|
1852 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1853 CGulIcon* Icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), |
|
1854 KAknsIIDQgnPropSetButton, |
|
1855 AknIconUtils::AvkonIconFileName(), |
|
1856 EMbmAvkonQgn_prop_set_button, |
|
1857 EMbmAvkonQgn_prop_set_button_mask ); |
|
1858 */ |
|
1859 /* |
|
1860 CGulIcon* Icon = aSkinVariant.LoadBitmapL( EMbmChatngQgn_prop_im_smileys_happy, |
|
1861 EMbmChatngQgn_prop_im_smileys_happy_mask, |
|
1862 iChatMbmFullPath ); |
|
1863 */ |
|
1864 CFbsBitmap* bitmap; |
|
1865 CFbsBitmap* mask; |
|
1866 TSize size; |
|
1867 AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::EScreen, size ); |
|
1868 AknIconUtils::CreateIconL( bitmap, mask, KFileName, EMbmChatngQgn_graf_im_splash_screen, EMbmChatngQgn_graf_im_splash_screen_mask ); |
|
1869 AknIconUtils::SetSize( bitmap, size, EAspectRatioPreserved ); |
|
1870 AknIconUtils::SetSize( mask, size, EAspectRatioPreserved ); |
|
1871 |
|
1872 CleanupStack::PushL( bitmap ); |
|
1873 CleanupStack::PushL( mask ); |
|
1874 CGulIcon* Icon = CGulIcon::NewL( bitmap, mask ); |
|
1875 CleanupStack::Pop( 2 ); // bitmap and mask |
|
1876 |
|
1877 iSplashScreen->ShowSplashScreenL( this, aSplashDelay, Icon, EFalse ); |
|
1878 return; |
|
1879 } |
|
1880 |
|
1881 // ----------------------------------------------------------------------------- |
|
1882 // CCAAppUi::SetAfterRefreshMode |
|
1883 // (other items were commented in a header). |
|
1884 // ----------------------------------------------------------------------------- |
|
1885 // |
|
1886 void CCAAppUi::SetAfterRefreshMode( TBool aMode ) |
|
1887 { |
|
1888 iDefaultRefreshInUse = aMode; |
|
1889 } |
|
1890 |
|
1891 // --------------------------------------------------------- |
|
1892 // CCAAppUi::SolveResPathLC |
|
1893 // (other items were commented in a header). |
|
1894 // --------------------------------------------------------- |
|
1895 // |
|
1896 HBufC* CCAAppUi::SolveResPathLC( const TDesC& aPathWithoutDrive ) const |
|
1897 { |
|
1898 CHAT_DP_TXT( "Before add resource file" ); |
|
1899 |
|
1900 TFileName path = Application()->AppFullName(); |
|
1901 TDriveName drive( TParsePtrC( path ).Drive( ) ); // solve drive |
|
1902 |
|
1903 // leave to stack, LC method |
|
1904 HBufC* resourceFilePath = HBufC::NewLC( KMaxResourcePathLength ); |
|
1905 TPtr ptr( resourceFilePath->Des() ); |
|
1906 ptr.Append( aPathWithoutDrive ); // without drive |
|
1907 ptr.Insert( 0, drive ); // insert drive |
|
1908 |
|
1909 // NearestLanguageFile takes only TFileName |
|
1910 path.Zero(); |
|
1911 path.Append( *resourceFilePath ); |
|
1912 |
|
1913 if ( path.Length() != 0 ) |
|
1914 { |
|
1915 BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), path ); |
|
1916 } |
|
1917 |
|
1918 *resourceFilePath = path; |
|
1919 |
|
1920 return resourceFilePath; |
|
1921 } |
|
1922 |
|
1923 // --------------------------------------------------------- |
|
1924 // CCAAppUi::TabChangedL( TInt aIndex ) |
|
1925 // From MAknTabObserver, handles changes in the tabs groups. |
|
1926 // (other items were commented in a header). |
|
1927 // --------------------------------------------------------- |
|
1928 // |
|
1929 void CCAAppUi::TabChangedL( TInt /*aIndex*/ ) |
|
1930 { |
|
1931 /* |
|
1932 CHAT_DP( D_CHAT_LIT("Tab changed to index %d"), aIndex ); |
|
1933 CAknTabGroup* tabGroup = CAStatusPane()->TabGroup(); |
|
1934 if ( tabGroup ) |
|
1935 { |
|
1936 tabGroup->SetActiveTabByIndex( aIndex ); |
|
1937 } |
|
1938 */ |
|
1939 } |
|
1940 |
|
1941 // --------------------------------------------------------- |
|
1942 // CCAAppUi::HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType) |
|
1943 // From CEikAppUi, handles key events. |
|
1944 // (other items were commented in a header). |
|
1945 // --------------------------------------------------------- |
|
1946 // |
|
1947 TKeyResponse CCAAppUi::HandleKeyEventL( const TKeyEvent& /* aKeyEvent */, |
|
1948 TEventCode /* aType */ ) |
|
1949 { |
|
1950 return EKeyWasConsumed; |
|
1951 } |
|
1952 |
|
1953 // --------------------------------------------------------- |
|
1954 // CCAAppUi::HandleForegroundEventL |
|
1955 // (other items were commented in a header). |
|
1956 // --------------------------------------------------------- |
|
1957 // |
|
1958 void CCAAppUi::HandleForegroundEventL( TBool aForeground ) |
|
1959 { |
|
1960 CHAT_DP_FUNC_ENTER( "HandleForegroundEventL" ); |
|
1961 |
|
1962 iIsAppForeground = aForeground; |
|
1963 |
|
1964 if ( aForeground && iOkToSwitch ) |
|
1965 { |
|
1966 // coming from background to foreground, |
|
1967 // so show the view |
|
1968 CHAT_DP_FUNC_DP( "HandleForegroundEventL", |
|
1969 "Going from background to foreground" ); |
|
1970 |
|
1971 if ( iCustomMessageId == KNullUid ) |
|
1972 { |
|
1973 // no custom message |
|
1974 CHAT_DP_FUNC_DP( "HandleForegroundEventL", "No custom message" ); |
|
1975 SwitchViewL( iActiveViewId ); |
|
1976 } |
|
1977 else |
|
1978 { |
|
1979 // custom message |
|
1980 CHAT_DP_FUNC_DP( "HandleForegroundEventL", "Custom message" ); |
|
1981 SwitchViewL( iActiveViewId, iCustomMessageId, *iCustomMessage ); |
|
1982 } |
|
1983 } |
|
1984 else |
|
1985 { |
|
1986 CHAT_DP_FUNC_DP( "HandleForegroundEventL", "Custom message" ); |
|
1987 } |
|
1988 |
|
1989 if ( !aForeground ) |
|
1990 { |
|
1991 // application switched to background, update softnotifier |
|
1992 if ( iEngine.IsFinalized() ) |
|
1993 { |
|
1994 // Universal indicator is not shown when one new message is received |
|
1995 UpdateIMUIPIcon(); |
|
1996 } |
|
1997 |
|
1998 // Set to false -> beep is played next time when |
|
1999 // new msg is received |
|
2000 iPlayOnce = EFalse; |
|
2001 } |
|
2002 else |
|
2003 { |
|
2004 // Disable IM's system attribute. After this call, IM is again under normal |
|
2005 // memory management. It might get killed if more memory is needed by the fw. |
|
2006 iEikonEnv->SetSystem( EFalse ); |
|
2007 } |
|
2008 |
|
2009 CAknViewAppUi::HandleForegroundEventL( aForeground ); |
|
2010 |
|
2011 CHAT_DP_FUNC_DONE( "HandleForegroundEventL" ); |
|
2012 } |
|
2013 |
|
2014 |
|
2015 // --------------------------------------------------------- |
|
2016 // CCAAppUi::HandleChatEvent |
|
2017 // (other items were commented in a header). |
|
2018 // --------------------------------------------------------- |
|
2019 void CCAAppUi::HandleChatEvent( const TEnumsPC::TChatEventType aEvent, |
|
2020 const TDesC& aWvid, |
|
2021 const TDesC& aContactId, |
|
2022 const TDesC& aMessage, |
|
2023 const TEnumsPC::TMessagerType aMsgrType, |
|
2024 const TEnumsPC::TMessageType aMsgType ) |
|
2025 { |
|
2026 CHAT_DP_FUNC_ENTER( "CCAAppUi::HandleChatEvent" ); |
|
2027 switch ( aEvent ) |
|
2028 { |
|
2029 case TEnumsPC::EUnreadCountChanged: |
|
2030 { |
|
2031 |
|
2032 //if message was not sent then wvid will be KNullDesC |
|
2033 //then dont check for aMsgrType, aMsgType |
|
2034 //also dont show the preview pane |
|
2035 if ( aWvid.Length() ) |
|
2036 { |
|
2037 // own message |
|
2038 if ( aMsgrType == TEnumsPC::EMessageSent |
|
2039 // not PtoP message |
|
2040 || aMsgType == TEnumsPC::EMessageInvalid ) |
|
2041 { |
|
2042 return; |
|
2043 } |
|
2044 //play the message tone |
|
2045 PlayBeep(); |
|
2046 |
|
2047 TBool showPreview( EFalse ); |
|
2048 |
|
2049 if ( aMsgType == TEnumsPC::EMessagePTOP ) |
|
2050 { |
|
2051 //conversation message |
|
2052 MCAConversationPC& convPC( *iProcessManager.GetConversationInterface() ); |
|
2053 showPreview = !convPC.IsActiveConversation( aWvid ) ; |
|
2054 } |
|
2055 else |
|
2056 { |
|
2057 //rest are group chat related messages |
|
2058 MCAGroupPC& groupPC ( *iProcessManager.GetGroupInterface() ); |
|
2059 showPreview = !groupPC.IsActiveGroupChat( aWvid ) ; |
|
2060 |
|
2061 } |
|
2062 |
|
2063 //check if the new message is for the current active conversation only |
|
2064 //if the current active view is conversation - |
|
2065 if ( showPreview ) |
|
2066 { |
|
2067 //show preview pane only if the message is not for the |
|
2068 //current active conversation |
|
2069 |
|
2070 TRAP_IGNORE( |
|
2071 { |
|
2072 AddToPreviewListL( aContactId, aMessage ); |
|
2073 if ( !iInfoNoteShowing ) |
|
2074 { |
|
2075 ShowInfoPopupL(); |
|
2076 } |
|
2077 |
|
2078 } |
|
2079 |
|
2080 ); |
|
2081 } |
|
2082 } |
|
2083 //update the universal indicator |
|
2084 //shows the universal indicator |
|
2085 UpdateIMUIPIcon(); |
|
2086 break; |
|
2087 } |
|
2088 |
|
2089 case TEnumsPC::EMemoryLow: |
|
2090 { |
|
2091 if ( iShowMemLowNote ) |
|
2092 { |
|
2093 TRAPD( err, ShowMemLowNoteL() ); |
|
2094 if ( err ) |
|
2095 { |
|
2096 CActiveScheduler::Current()->Error( err ); |
|
2097 } |
|
2098 } |
|
2099 break; |
|
2100 } |
|
2101 default: |
|
2102 { |
|
2103 // No need to handle other events here |
|
2104 break; |
|
2105 } |
|
2106 } |
|
2107 CHAT_DP_FUNC_DONE( "CCAAppUi::HandleChatEvent" ); |
|
2108 } |
|
2109 |
|
2110 // ----------------------------------------------------------------------------- |
|
2111 // CCAAppUi::ChangeStatusProcessL |
|
2112 // (other items were commented in a header). |
|
2113 // ----------------------------------------------------------------------------- |
|
2114 // |
|
2115 void CCAAppUi::ChangeStatusProcessL() |
|
2116 { |
|
2117 if ( iStatusFlag ) |
|
2118 { |
|
2119 return; |
|
2120 } |
|
2121 |
|
2122 iStatusFlag = ETrue; |
|
2123 if ( iUISessionManager->IsLoggedIn() ) |
|
2124 { |
|
2125 // Check variation |
|
2126 TInt showAppearOffline = |
|
2127 IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_APPEAR_OFFLINE ); |
|
2128 TInt showAway = |
|
2129 IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_AWAY_STATUS ); |
|
2130 TInt showBusy = |
|
2131 IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_BUSY_STATUS ); |
|
2132 |
|
2133 TInt awayIndex( 0 ); |
|
2134 TInt busyIndex( 0 ); |
|
2135 TInt appOfflineIndex( 0 ); |
|
2136 |
|
2137 // first icon is online |
|
2138 // calculate indexes for other icons |
|
2139 if ( showAway ) |
|
2140 { |
|
2141 awayIndex++; |
|
2142 busyIndex++; |
|
2143 appOfflineIndex++; |
|
2144 } |
|
2145 else |
|
2146 { |
|
2147 awayIndex = -1; |
|
2148 } |
|
2149 |
|
2150 if ( showBusy ) |
|
2151 { |
|
2152 busyIndex++; |
|
2153 appOfflineIndex++; |
|
2154 } |
|
2155 else |
|
2156 { |
|
2157 busyIndex = -1; |
|
2158 } |
|
2159 |
|
2160 if ( showAppearOffline ) |
|
2161 { |
|
2162 appOfflineIndex++; |
|
2163 } |
|
2164 else |
|
2165 { |
|
2166 appOfflineIndex = -1; |
|
2167 } |
|
2168 |
|
2169 TInt status( 0 ); |
|
2170 CAknListQueryDialog* dlg = new ( ELeave ) |
|
2171 CAknListQueryDialog( &status ); |
|
2172 dlg->PrepareLC( R_CHAT_STATUS_CHANGE_DLG ); |
|
2173 |
|
2174 // Format the texts |
|
2175 // Create a array for texts |
|
2176 CDesCArray* listItemsArray = |
|
2177 new ( ELeave ) CDesCArrayFlat( KAmountOfOwnStatusStates ); |
|
2178 CleanupStack::PushL( listItemsArray ); |
|
2179 |
|
2180 // Online |
|
2181 HBufC* onlineText = NULL; |
|
2182 onlineText = StringLoader::LoadLC( R_CHAT_CHANGE_OWN_ONLINE ); |
|
2183 |
|
2184 HBufC* itemTxtOnline = |
|
2185 HBufC::NewLC( KTabFormatLenght + onlineText->Length() ); |
|
2186 TPtr itemTxtPtrOnline( itemTxtOnline->Des() ); |
|
2187 |
|
2188 itemTxtPtrOnline.Format( KTabFormat, KOnlineIconIndex ); |
|
2189 itemTxtPtrOnline.Append( *onlineText ); |
|
2190 listItemsArray->AppendL( itemTxtPtrOnline ); |
|
2191 CleanupStack::PopAndDestroy( itemTxtOnline ); |
|
2192 CleanupStack::PopAndDestroy( onlineText ); |
|
2193 |
|
2194 // Away |
|
2195 if ( showAway ) |
|
2196 { |
|
2197 HBufC* awayText = NULL; |
|
2198 awayText = StringLoader::LoadLC( R_CHAT_CHANGE_OWN_AWAY ); |
|
2199 |
|
2200 HBufC* itemTxtAway = HBufC::NewLC( |
|
2201 KTabFormatLenght + awayText->Length() ); |
|
2202 TPtr itemTxtPtrAway( itemTxtAway->Des() ); |
|
2203 |
|
2204 itemTxtPtrAway.Format( KTabFormat, awayIndex ); |
|
2205 itemTxtPtrAway.Append( *awayText ); |
|
2206 listItemsArray->AppendL( itemTxtPtrAway ); |
|
2207 CleanupStack::PopAndDestroy( itemTxtAway ); |
|
2208 CleanupStack::PopAndDestroy( awayText ); |
|
2209 } |
|
2210 |
|
2211 // Busy |
|
2212 if ( showBusy ) |
|
2213 { |
|
2214 HBufC* busyText = NULL; |
|
2215 busyText = StringLoader::LoadLC( R_CHAT_CHANGE_OWN_BUSY ); |
|
2216 |
|
2217 HBufC* itemTextBusy = HBufC::NewLC( |
|
2218 KTabFormatLenght + busyText->Length() ); |
|
2219 TPtr itemTxtPtrBusy( itemTextBusy->Des() ); |
|
2220 |
|
2221 itemTxtPtrBusy.Format( KTabFormat, busyIndex ); |
|
2222 itemTxtPtrBusy.Append( *busyText ); |
|
2223 listItemsArray->AppendL( itemTxtPtrBusy ); |
|
2224 CleanupStack::PopAndDestroy( itemTextBusy ); |
|
2225 CleanupStack::PopAndDestroy( busyText ); |
|
2226 } |
|
2227 // Appear offline |
|
2228 if ( showAppearOffline ) |
|
2229 { |
|
2230 HBufC* offlineText = NULL; |
|
2231 offlineText = StringLoader::LoadLC( R_CHAT_CHANGE_OWN_APPEAR_OFFLINE ); |
|
2232 |
|
2233 HBufC* itemTextOffline = HBufC::NewLC( |
|
2234 KTabFormatLenght + offlineText->Length() ); |
|
2235 TPtr itemTxtPtrOffline( itemTextOffline->Des() ); |
|
2236 |
|
2237 itemTxtPtrOffline.Format( KTabFormat, appOfflineIndex ); |
|
2238 itemTxtPtrOffline.Append( *offlineText ); |
|
2239 listItemsArray->AppendL( itemTxtPtrOffline ); |
|
2240 CleanupStack::PopAndDestroy( itemTextOffline ); |
|
2241 CleanupStack::PopAndDestroy( offlineText ); |
|
2242 } |
|
2243 |
|
2244 // Set the array |
|
2245 dlg->SetOwnershipType( ELbmOwnsItemArray ); |
|
2246 CleanupStack::Pop( listItemsArray ); |
|
2247 dlg->SetItemTextArray( listItemsArray ); |
|
2248 |
|
2249 // Add icons |
|
2250 CArrayPtr< CGulIcon >* icons = new( ELeave ) |
|
2251 CAknIconArray( KAmountOfOwnStatusStates ); |
|
2252 CleanupStack::PushL( icons ); |
|
2253 |
|
2254 MCASkinVariant* skinVar = static_cast<CCAApp*>( |
|
2255 Application() )->VariantFactory()->SkinVariantL(); |
|
2256 |
|
2257 // Online |
|
2258 CGulIcon* iconOnline = skinVar->LoadBitmapL( |
|
2259 EMbmChatngQgn_prop_im_friend_on, |
|
2260 EMbmChatngQgn_prop_im_friend_on_mask, |
|
2261 MbmFullPath() ); |
|
2262 CleanupStack::PushL( iconOnline ); |
|
2263 icons->AppendL( iconOnline ); |
|
2264 CleanupStack::Pop( iconOnline ); |
|
2265 |
|
2266 // Away |
|
2267 CGulIcon* iconAway = NULL; |
|
2268 if ( showAway ) |
|
2269 { |
|
2270 iconAway = skinVar->LoadBitmapL( |
|
2271 EMbmChatngQgn_prop_im_friend_away, |
|
2272 EMbmChatngQgn_prop_im_friend_away_mask, |
|
2273 MbmFullPath() ); |
|
2274 CleanupStack::PushL( iconAway ); |
|
2275 icons->AppendL( iconAway ); |
|
2276 CleanupStack::Pop( iconAway ); |
|
2277 } |
|
2278 |
|
2279 // Busy |
|
2280 CGulIcon* iconBusy = NULL; |
|
2281 if ( showBusy ) |
|
2282 { |
|
2283 iconBusy = skinVar->LoadBitmapL( |
|
2284 EMbmChatngQgn_prop_im_friend_busy, |
|
2285 EMbmChatngQgn_prop_im_friend_busy_mask, |
|
2286 MbmFullPath() ); |
|
2287 CleanupStack::PushL( iconBusy ); |
|
2288 icons->AppendL( iconBusy ); |
|
2289 CleanupStack::Pop( iconBusy ); |
|
2290 } |
|
2291 // Appear offline |
|
2292 CGulIcon* iconOffline = NULL; |
|
2293 if ( showAppearOffline ) |
|
2294 { |
|
2295 iconOffline = skinVar->LoadBitmapL( |
|
2296 EMbmChatngQgn_prop_im_friend_invisible, |
|
2297 EMbmChatngQgn_prop_im_friend_invisible_mask, |
|
2298 MbmFullPath() ); |
|
2299 CleanupStack::PushL( iconOffline ); |
|
2300 icons->AppendL( iconOffline ); |
|
2301 CleanupStack::Pop( iconOffline ); |
|
2302 } |
|
2303 |
|
2304 dlg->SetIconArrayL( icons ); // transfers ownership |
|
2305 CleanupStack::Pop( icons ); |
|
2306 |
|
2307 // get own status |
|
2308 |
|
2309 TInt presenceStatus( TEnumsPC::EUnknown ); |
|
2310 MCAMainViewArrayPC* mainViewArrayPC = iProcessManager.GetArrayInterface(); |
|
2311 TInt topIndex( 0 ); |
|
2312 if ( mainViewArrayPC->GetType( topIndex ) == TEnumsPC::EOwnStatusItem ) |
|
2313 { |
|
2314 presenceStatus = mainViewArrayPC->GetOnlineStatus( topIndex ) ; |
|
2315 } |
|
2316 // get dialog's listbox |
|
2317 CEikListBox* listBox = dlg->ListBox(); |
|
2318 |
|
2319 // move focus in the listbox to current status |
|
2320 switch ( presenceStatus ) |
|
2321 { |
|
2322 case TEnumsPC::EOnline: |
|
2323 { |
|
2324 listBox->SetCurrentItemIndex( 0 ); |
|
2325 break; |
|
2326 } |
|
2327 case TEnumsPC::EAway: |
|
2328 { |
|
2329 |
|
2330 if ( showAway || showBusy || showAppearOffline ) |
|
2331 { |
|
2332 listBox->SetCurrentItemIndex( 1 ); |
|
2333 } |
|
2334 break; |
|
2335 } |
|
2336 case TEnumsPC::EBusy: |
|
2337 { |
|
2338 if ( showBusy ) |
|
2339 { |
|
2340 listBox->SetCurrentItemIndex( busyIndex ); |
|
2341 } |
|
2342 else |
|
2343 { |
|
2344 if ( showAway ) |
|
2345 { |
|
2346 // Show as away if busy is disabled |
|
2347 listBox->SetCurrentItemIndex( awayIndex ); |
|
2348 } |
|
2349 else |
|
2350 { |
|
2351 listBox->SetCurrentItemIndex( 0 ); |
|
2352 } |
|
2353 |
|
2354 } |
|
2355 break; |
|
2356 } |
|
2357 case TEnumsPC::EInvisible: |
|
2358 { |
|
2359 if ( showAppearOffline ) |
|
2360 { |
|
2361 // index of invisible is 3 if busy is visible, else 2. |
|
2362 if ( showAway ) |
|
2363 { |
|
2364 listBox->SetCurrentItemIndex( showBusy ? 3 : 2 ); |
|
2365 } |
|
2366 else |
|
2367 { |
|
2368 // away is not shown, index is 2 or 1 |
|
2369 listBox->SetCurrentItemIndex( showBusy ? 2 : 1 ); |
|
2370 } |
|
2371 } |
|
2372 else |
|
2373 { |
|
2374 if ( showAway ) |
|
2375 { |
|
2376 // invisible, but appear offline disabled, |
|
2377 // so show as "away" |
|
2378 listBox->SetCurrentItemIndex( 1 ); |
|
2379 } |
|
2380 else |
|
2381 { |
|
2382 // invisible, but appear offline and away disabled, |
|
2383 // so show as online |
|
2384 listBox->SetCurrentItemIndex( 0 ); |
|
2385 } |
|
2386 } |
|
2387 break; |
|
2388 } |
|
2389 default: |
|
2390 { |
|
2391 // nothing to do |
|
2392 break; |
|
2393 } |
|
2394 } |
|
2395 |
|
2396 TInt result = dlg->RunLD(); |
|
2397 |
|
2398 TInt error( KErrNone ); |
|
2399 if ( ( result == EAknSoftkeyOk ) || |
|
2400 ( result == EAknSoftkeySelect ) ) |
|
2401 { |
|
2402 if ( status == 0 ) |
|
2403 { |
|
2404 TInt autoStatusMsgEnabledForOnline = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_ONLINE_AUTO ); |
|
2405 if ( autoStatusMsgEnabledForOnline ) |
|
2406 { |
|
2407 error = AskStatusMessageL( TEnumsPC::EOnline, EFalse ); |
|
2408 } |
|
2409 if ( error == KErrNone ) |
|
2410 { |
|
2411 CCAWaitNote* note = CCAWaitNote::ShowWaitNoteLC( R_QTN_CHAT_CHANGE_STATUS_CHANGING ); |
|
2412 error = mainViewArrayPC->ChangeStatusL( |
|
2413 TEnumsPC::EOnline, *iStatusMessage ); |
|
2414 CleanupStack::PopAndDestroy( note ); |
|
2415 } |
|
2416 } |
|
2417 if ( status == awayIndex ) /* Away */ |
|
2418 { |
|
2419 // can't get here unless Away is enabled |
|
2420 TInt autoStatusMsgEnabledForAway = |
|
2421 IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_AWAY_AUTO ); |
|
2422 if ( autoStatusMsgEnabledForAway ) |
|
2423 { |
|
2424 error = AskStatusMessageL( TEnumsPC::EAway, EFalse ); |
|
2425 } |
|
2426 if ( error == KErrNone ) |
|
2427 { |
|
2428 CCAWaitNote* note = CCAWaitNote::ShowWaitNoteLC( R_QTN_CHAT_CHANGE_STATUS_CHANGING ); |
|
2429 error = mainViewArrayPC->ChangeStatusL( |
|
2430 TEnumsPC::EAway, *iStatusMessage ); |
|
2431 CleanupStack::PopAndDestroy( note ); |
|
2432 } |
|
2433 } |
|
2434 |
|
2435 if ( status == busyIndex ) // Busy |
|
2436 { |
|
2437 // can't get here unless Busy is enabled |
|
2438 TInt autoStatusMsgEnabledForBusy = |
|
2439 IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_BUSY_AUTO ); |
|
2440 if ( autoStatusMsgEnabledForBusy ) |
|
2441 { |
|
2442 error = AskStatusMessageL( TEnumsPC::EBusy, EFalse ); |
|
2443 } |
|
2444 if ( error == KErrNone ) |
|
2445 { |
|
2446 CCAWaitNote* note = CCAWaitNote::ShowWaitNoteLC( R_QTN_CHAT_CHANGE_STATUS_CHANGING ); |
|
2447 error = mainViewArrayPC->ChangeStatusL( |
|
2448 TEnumsPC::EBusy, *iStatusMessage ); |
|
2449 CleanupStack::PopAndDestroy( note ); |
|
2450 } |
|
2451 } |
|
2452 if ( status == appOfflineIndex ) //Offline |
|
2453 { |
|
2454 // can't get here unless Appear Offline is enabled |
|
2455 CCAWaitNote* note = CCAWaitNote::ShowWaitNoteLC( R_QTN_CHAT_CHANGE_STATUS_CHANGING ); |
|
2456 error = mainViewArrayPC->ChangeStatusL( |
|
2457 TEnumsPC::EOffline, KNullDesC ); |
|
2458 CleanupStack::PopAndDestroy( note ); |
|
2459 } |
|
2460 |
|
2461 |
|
2462 if ( error == KErrNone ) |
|
2463 { |
|
2464 // show confirmation note |
|
2465 HBufC* text = iCoeEnv->AllocReadResourceLC( R_QTN_CHAT_CHANGE_STATUS_CHANGED ); |
|
2466 CAknConfirmationNote* dlg = new( ELeave )CAknConfirmationNote(); |
|
2467 dlg->ExecuteLD( *text ); |
|
2468 CleanupStack::PopAndDestroy( text ); |
|
2469 } |
|
2470 else if ( error == KErrCancel ) |
|
2471 { |
|
2472 // user cancelled, status was not updated |
|
2473 IMDialogUtils::DisplayInformationNoteL( R_QTN_CHAT_CHANGE_STATUS_NOT_CHANGED ); |
|
2474 } |
|
2475 else |
|
2476 { |
|
2477 // change status failed |
|
2478 HBufC* failed = StringLoader::LoadLC( R_QTN_CHAT_CHANGE_STATUS_FAILED ); |
|
2479 IMDialogUtils::DisplayErrorNoteL( *failed ); |
|
2480 CleanupStack::PopAndDestroy( failed ); |
|
2481 } |
|
2482 } |
|
2483 else |
|
2484 { |
|
2485 IMDialogUtils::DisplayInformationNoteL( R_QTN_CHAT_CHANGE_STATUS_NOT_CHANGED ); |
|
2486 } |
|
2487 iStatusFlag = EFalse; |
|
2488 |
|
2489 iUISessionManager->SetStatusPaneIconsL(); |
|
2490 } |
|
2491 } |
|
2492 |
|
2493 // --------------------------------------------------------- |
|
2494 // CCAAppUi::AskStatusMessageL() |
|
2495 // (other items were commented in a header). |
|
2496 // --------------------------------------------------------- |
|
2497 // |
|
2498 TInt CCAAppUi::AskStatusMessageL( TEnumsPC::TOnlineStatus aStatus, |
|
2499 TBool aUpdateToNetwork ) |
|
2500 { |
|
2501 CDesCArray* statusMessages = new( ELeave )CDesCArrayFlat( KMaxStatusMessageCount ); |
|
2502 CleanupStack::PushL( statusMessages ); |
|
2503 |
|
2504 HBufC* firstLine = StringLoader::LoadLC( R_QTN_CHAT_CHANGE_NEW_MESSAGE ); |
|
2505 statusMessages->AppendL( *firstLine ); |
|
2506 CleanupStack::PopAndDestroy( firstLine ); |
|
2507 |
|
2508 // Read status messages |
|
2509 ReadStatusMessagesL( aStatus, *statusMessages ); |
|
2510 |
|
2511 // show the query |
|
2512 TInt selectionIndex( statusMessages->Count() > 1 ? 1 : 0 ); |
|
2513 |
|
2514 // Force to continue if selection query is not shown |
|
2515 TInt ret = EAknSoftkeyOk; |
|
2516 |
|
2517 if ( selectionIndex == 1 ) |
|
2518 { |
|
2519 // There were previous status messages, show selection query |
|
2520 HBufC* titleText = StringLoader::LoadLC( R_QTN_CHAT_CHANGE_SELECT_MESSAGE ); |
|
2521 ret = IMDialogUtils::DisplayListQueryDialogL( &selectionIndex, statusMessages, |
|
2522 R_PRIVATE_CHAT_LIST_SELECT_RECIP_DLG, |
|
2523 *titleText, KNullDesC, ETrue ); |
|
2524 CleanupStack::PopAndDestroy( titleText ); |
|
2525 } |
|
2526 |
|
2527 if ( !( ret == EAknSoftkeyOk || ret == EAknSoftkeyDone || ret == EAknSoftkeySelect ) ) |
|
2528 { |
|
2529 CleanupStack::PopAndDestroy( statusMessages ); |
|
2530 return KErrCancel; |
|
2531 } |
|
2532 |
|
2533 TPtr statusTxt( iStatusMessage->Des() ); |
|
2534 statusTxt.Zero(); |
|
2535 |
|
2536 if ( selectionIndex != 0 ) |
|
2537 { |
|
2538 statusTxt.Copy( ( *statusMessages ) [ selectionIndex ] ); |
|
2539 } |
|
2540 |
|
2541 TInt result = IMDialogUtils::DisplayTextQueryDialogL( |
|
2542 statusTxt , |
|
2543 R_CHAT_ENTER_STATUS_MESSAGE, |
|
2544 R_CHATCLIENT_ENTER_STATUS_MESSAGE_QUERY, |
|
2545 ETrue, // T9 |
|
2546 ETrue // LSK always visible |
|
2547 ); |
|
2548 |
|
2549 if ( ( result == EAknSoftkeyOk || result == EAknSoftkeyDone ) && ( iUISessionManager->IsLoggedIn() ) ) |
|
2550 { |
|
2551 CHAT_DP( D_CHAT_LIT( "iStatusMessage = %S" ), iStatusMessage ); |
|
2552 |
|
2553 // Delete first line. |
|
2554 statusMessages->Delete( 0 ); |
|
2555 statusMessages->InsertL( 0, statusTxt ); |
|
2556 WriteStatusMessagesL( aStatus, *statusMessages ); |
|
2557 if ( aUpdateToNetwork ) |
|
2558 { |
|
2559 CCAWaitNote* note = CCAWaitNote::ShowWaitNoteLC( R_CHAT_CHANGE_MESSAGE_CHANGING ); |
|
2560 |
|
2561 MCAMainViewArrayPC* mainViewArrayPC = iProcessManager.GetArrayInterface(); |
|
2562 TInt error( mainViewArrayPC->ChangeStatusMessageL( statusTxt ) ); |
|
2563 CleanupStack::PopAndDestroy( note ); |
|
2564 if ( error == KErrNone ) |
|
2565 { |
|
2566 // show note qtn_chat_change_message_changing |
|
2567 IMDialogUtils::DisplayInformationNoteL( R_CHAT_CHANGE_MESSAGE_CHANGED ); |
|
2568 } |
|
2569 else if ( error == KErrCancel ) |
|
2570 { |
|
2571 IMDialogUtils::DisplayInformationNoteL( R_CHAT_CHANGE_MESSAGE_NOT_CHANGED ); |
|
2572 } |
|
2573 else |
|
2574 { |
|
2575 IMDialogUtils::DisplayInformationNoteL( R_CHAT_CHANGE_MESSAGE_FAILED ); |
|
2576 } |
|
2577 } |
|
2578 } |
|
2579 else |
|
2580 { |
|
2581 CleanupStack::PopAndDestroy( statusMessages ); |
|
2582 return KErrCancel; |
|
2583 } |
|
2584 CleanupStack::PopAndDestroy( statusMessages ); //statusMessages |
|
2585 return KErrNone; |
|
2586 } |
|
2587 |
|
2588 // ----------------------------------------------------------------------------- |
|
2589 // CCAAppUi::ReadStatusMessagesL |
|
2590 // (other items were commented in a header). |
|
2591 // ----------------------------------------------------------------------------- |
|
2592 // |
|
2593 void CCAAppUi::ReadStatusMessagesL( TEnumsPC::TOnlineStatus aStatus, |
|
2594 CDesCArray& aArray ) |
|
2595 { |
|
2596 MCASettingsPC* settingsPC = iProcessManager.GetSettingsInterface(); |
|
2597 if ( !settingsPC ) |
|
2598 { |
|
2599 User::Leave( KErrNotReady ); |
|
2600 } |
|
2601 |
|
2602 RBuf buffer; |
|
2603 |
|
2604 buffer.Assign( settingsPC->GetSapSettingValuePCL( |
|
2605 ConvertToTEnumsStatusMsgValue( aStatus ) ) ); |
|
2606 |
|
2607 TBuf< KStatusMessageHeaderLength > header; |
|
2608 CleanupClosePushL( buffer ); |
|
2609 |
|
2610 TInt err( KErrNone ); |
|
2611 TInt countOfMessages( 0 ); |
|
2612 TInt offset( 1 ); // First character is for header length |
|
2613 TInt headerLength( 0 ); |
|
2614 if ( buffer.Length() ) |
|
2615 { |
|
2616 TLex lexer( buffer.Left( 1 ) ); |
|
2617 err = lexer.Val( headerLength ); |
|
2618 } |
|
2619 else |
|
2620 { |
|
2621 err = KErrEof; |
|
2622 } |
|
2623 while ( err == KErrNone && countOfMessages < KMaxStatusMessageCount ) |
|
2624 { |
|
2625 TPtrC ptr( buffer.Mid( offset ) ); |
|
2626 if ( ptr.Length() > headerLength ) |
|
2627 { |
|
2628 header.Copy( ptr.Left( headerLength ) ); |
|
2629 header.Trim(); |
|
2630 TLex lexer( header ); |
|
2631 offset += headerLength; |
|
2632 TInt messageLength( 0 ); |
|
2633 err = lexer.Val( messageLength ); |
|
2634 if ( err == KErrNone ) |
|
2635 { |
|
2636 ptr.Set( buffer.Mid( offset ) ); |
|
2637 if ( ptr.Length() >= messageLength ) |
|
2638 { |
|
2639 aArray.AppendL( ptr.Left( messageLength ) ); |
|
2640 offset += messageLength; |
|
2641 ++countOfMessages; |
|
2642 } |
|
2643 else |
|
2644 { |
|
2645 err = KErrEof; |
|
2646 } |
|
2647 } |
|
2648 } |
|
2649 else |
|
2650 { |
|
2651 err = KErrEof; |
|
2652 } |
|
2653 } |
|
2654 CleanupStack::PopAndDestroy(); // buffer |
|
2655 } |
|
2656 |
|
2657 // ----------------------------------------------------------------------------- |
|
2658 // CCAAppUi::WriteStatusMessagesL |
|
2659 // (other items were commented in a header). |
|
2660 // ----------------------------------------------------------------------------- |
|
2661 // |
|
2662 |
|
2663 void CCAAppUi::WriteStatusMessagesL( TEnumsPC::TOnlineStatus aStatus, |
|
2664 MDesCArray& aArray ) |
|
2665 { |
|
2666 MCASettingsPC* settingsPC = iProcessManager.GetSettingsInterface(); |
|
2667 if ( !settingsPC ) |
|
2668 { |
|
2669 User::Leave( KErrNotReady ); |
|
2670 } |
|
2671 |
|
2672 TPtrC firstLine = aArray.MdcaPoint( 0 ); |
|
2673 TInt countOfMessages( 0 ); |
|
2674 TInt arrayCount( aArray.MdcaCount() ); |
|
2675 TInt index( 0 ); |
|
2676 |
|
2677 RBuf buffer; |
|
2678 buffer.CreateL( RProperty::KMaxPropertySize ); |
|
2679 CleanupClosePushL( buffer ); |
|
2680 |
|
2681 TBuf< KStatusMessageHeaderLength > header; |
|
2682 |
|
2683 while ( index < arrayCount && countOfMessages < KMaxStatusMessageCount ) |
|
2684 { |
|
2685 if ( index == 0 ) |
|
2686 { |
|
2687 header.Format( KStatusMessageHeaderLengthFormat, |
|
2688 KStatusMessageHeaderLength ); |
|
2689 buffer.Append( header ); |
|
2690 } |
|
2691 TPtrC message = aArray.MdcaPoint( index ); |
|
2692 if ( index == 0 || message.CompareF( firstLine ) != 0 ) |
|
2693 { |
|
2694 header.Format( KStatusMessageHeaderFormat, message.Length() ); |
|
2695 buffer.Append( header ); |
|
2696 buffer.Append( message ); |
|
2697 ++countOfMessages; |
|
2698 } |
|
2699 ++index; |
|
2700 } |
|
2701 |
|
2702 settingsPC->SetSapSettingValuePCL( ConvertToTEnumsStatusMsgValue( aStatus ) , buffer ); |
|
2703 CleanupStack::PopAndDestroy(); // buffer |
|
2704 } |
|
2705 |
|
2706 // ----------------------------------------------------------------------------- |
|
2707 // CCAAppUi::ShowMemLowNoteL |
|
2708 // (other items were commented in a header). |
|
2709 // ----------------------------------------------------------------------------- |
|
2710 // |
|
2711 void CCAAppUi::ShowMemLowNoteL() |
|
2712 { |
|
2713 // Don't launch note if one is already displayed |
|
2714 if ( !iMemLowNote ) |
|
2715 { |
|
2716 // Give pointer to iMemLowNote to dialog -> |
|
2717 // gets nullified when dialog is destroyed |
|
2718 iMemLowNote = new( ELeave ) CAknNoteDialog( |
|
2719 &iMemLowNote, |
|
2720 CAknNoteDialog::EConfirmationTone ); |
|
2721 iMemLowNote->PrepareLC( R_CHAT_MEM_LOW_NOTE ); |
|
2722 // Pointer to dialog is needed as member |
|
2723 // variable to be able to know when dialog |
|
2724 // is destroyed |
|
2725 iMemLowNote->RunLD(); // CSI: 50 #see above |
|
2726 } |
|
2727 } |
|
2728 |
|
2729 // ----------------------------------------------------------------------------- |
|
2730 // CCAAppUi::HandleContactDelete |
|
2731 // (other items were commented in a header). |
|
2732 // ----------------------------------------------------------------------------- |
|
2733 // |
|
2734 void CCAAppUi::HandleDelete( const TDesC& /*aContactId*/ , TEnumsPC::TItem /*aType*/ ) |
|
2735 { |
|
2736 // Nothing to do |
|
2737 } |
|
2738 |
|
2739 // ----------------------------------------------------------------------------- |
|
2740 // CCAAppUi::HandleAddition |
|
2741 // (other items were commented in a header). |
|
2742 // ----------------------------------------------------------------------------- |
|
2743 // |
|
2744 void CCAAppUi::HandleAddition( TEnumsPC::TItem /*aType*/ ) |
|
2745 { |
|
2746 // Nothing to do |
|
2747 } |
|
2748 |
|
2749 // ----------------------------------------------------------------------------- |
|
2750 // CCAAppUi::HandleChange |
|
2751 // (other items were commented in a header). |
|
2752 // ----------------------------------------------------------------------------- |
|
2753 // |
|
2754 void CCAAppUi::HandleChange( TEnumsPC::TItem /*aType*/, |
|
2755 TEnumsPC::TChange aChangeType ) |
|
2756 { |
|
2757 if ( aChangeType == TEnumsPC::EChanged || |
|
2758 aChangeType == TEnumsPC::EMultipleChanges ) |
|
2759 { |
|
2760 TRAPD( err, iUISessionManager->SetStatusPaneIconsL() ); |
|
2761 if ( err != KErrNone ) |
|
2762 { |
|
2763 CActiveScheduler::Current()->Error( err ); |
|
2764 } |
|
2765 } |
|
2766 } |
|
2767 void CCAAppUi::HandleSettingsChangeL( TInt /*aChangedSettingEnum */ ) |
|
2768 { |
|
2769 //Right now there is no implementation needed here |
|
2770 } |
|
2771 |
|
2772 // ----------------------------------------------------------------------------- |
|
2773 // CCAAppUi::HandleWatcherEvent |
|
2774 // (other items were commented in a header). |
|
2775 // ----------------------------------------------------------------------------- |
|
2776 // |
|
2777 /*void CCAAppUi::HandleWatcherEvent(const TDesC& aString , |
|
2778 TEnumsPC::TOnlineStatus aOnlineStatus) |
|
2779 { |
|
2780 }*/ |
|
2781 |
|
2782 // ----------------------------------------------------------------------------- |
|
2783 // CCAAppUi::HandleMessageError |
|
2784 // (other items were commented in a header). |
|
2785 // ----------------------------------------------------------------------------- |
|
2786 // |
|
2787 void CCAAppUi::HandleMessageError( TInt aError, const TDesC& /*aInfo*/ ) |
|
2788 { |
|
2789 if ( aError == KErrNoMemory ) |
|
2790 { |
|
2791 TRAPD( err, IMNoteMapper::ShowNoteL( aError ) ); |
|
2792 if ( err ) |
|
2793 { |
|
2794 CActiveScheduler::Current()->Error( err ); |
|
2795 } |
|
2796 } |
|
2797 } |
|
2798 |
|
2799 |
|
2800 // ----------------------------------------------------------------------------- |
|
2801 // CCAAppUi::HandleContactChange |
|
2802 // (other items were commented in a header). |
|
2803 // ----------------------------------------------------------------------------- |
|
2804 // |
|
2805 /*void CCAAppUi::HandleContactChange( const TDesC& aContactId ) |
|
2806 { |
|
2807 }*/ |
|
2808 |
|
2809 |
|
2810 // ----------------------------------------------------------------------------- |
|
2811 // CCAAppUi::ExitCallback |
|
2812 // (other items were commented in a header). |
|
2813 // ----------------------------------------------------------------------------- |
|
2814 // |
|
2815 TInt CCAAppUi::ExitCallback( TAny* aInstance ) |
|
2816 { |
|
2817 CHAT_DP_FUNC_ENTER( "ExitCallback" ); |
|
2818 return static_cast<CCAAppUi*>( aInstance )->DoExitCallback(); |
|
2819 } |
|
2820 |
|
2821 // ----------------------------------------------------------------------------- |
|
2822 // CCAAppUi::DoExitCallback |
|
2823 // (other items were commented in a header). |
|
2824 // ----------------------------------------------------------------------------- |
|
2825 // |
|
2826 TInt CCAAppUi::DoExitCallback() |
|
2827 { |
|
2828 CHAT_DP_FUNC_ENTER( "DoExitCallback" ); |
|
2829 if ( iProcessManager.GetLogInInterface()->ReadyForShutdown() && iPendingDialogCounter <= 0 ) |
|
2830 { |
|
2831 TInt level = LevelOfActiveScheduler(); |
|
2832 if( level > 1 ) |
|
2833 { |
|
2834 CActiveScheduler::Current()->Stop(); |
|
2835 } |
|
2836 CHAT_DP_FUNC_DP( "DoExitCallback", "Engine is ready for shutdown" ); |
|
2837 Exit(); |
|
2838 } |
|
2839 CHAT_DP_FUNC_DP( "DoExitCallback", "Engine is NOT ready for shutdown" ); |
|
2840 return ETrue; //just a true value |
|
2841 } |
|
2842 |
|
2843 // ----------------------------------------------------------------------------- |
|
2844 // CCAAppUi::CloseDialog |
|
2845 // (other items were commented in a header). |
|
2846 // ----------------------------------------------------------------------------- |
|
2847 // |
|
2848 void CCAAppUi::CloseDialog( TAny* aInstance ) |
|
2849 { |
|
2850 TRAPD( leave, static_cast<CCAAppUi*>( aInstance )->DismissWaitDialogL( KErrNone ) ); |
|
2851 if ( leave != KErrNone ) |
|
2852 { |
|
2853 CActiveScheduler::Current()->Error( leave ); |
|
2854 } |
|
2855 } |
|
2856 |
|
2857 // ----------------------------------------------------------------------------- |
|
2858 // CCAAppUi::RetrieveBrandL |
|
2859 // (other items were commented in a header). |
|
2860 // ----------------------------------------------------------------------------- |
|
2861 // |
|
2862 void CCAAppUi::RetrieveBrandL( MCAOpBrandVariant& aBrand ) |
|
2863 { |
|
2864 iChatMbmFullPath = Application()->BitmapStoreName(); |
|
2865 |
|
2866 TFileName appRes( Application()->ResourceFileName() ); |
|
2867 _LIT( KResourceEngineFilePathWithoutDrive, "CaEngineNG.rsc" ); |
|
2868 _LIT( KResourcePresenceFilePathWithoutDrive, "WVUIPresenceVariationNG.rsc" ); |
|
2869 _LIT( KResourceVariationFilePathWithoutDrive, "CAVariationNG.rsc" ); |
|
2870 |
|
2871 TFileName engResPathWithoutDrive; |
|
2872 engResPathWithoutDrive.Zero(); |
|
2873 engResPathWithoutDrive.Append( KDC_RESOURCE_FILES_DIR() ); |
|
2874 engResPathWithoutDrive.Append( KResourceEngineFilePathWithoutDrive() ); |
|
2875 HBufC* engResPath = SolveResPathLC( engResPathWithoutDrive ); |
|
2876 |
|
2877 TFileName presResPathWithoutDrive; |
|
2878 presResPathWithoutDrive.Zero(); |
|
2879 presResPathWithoutDrive.Append( KDC_RESOURCE_FILES_DIR() ); |
|
2880 presResPathWithoutDrive.Append( KResourcePresenceFilePathWithoutDrive() ); |
|
2881 HBufC* presResPath = SolveResPathLC( presResPathWithoutDrive ); |
|
2882 |
|
2883 TFileName variationResPathWithoutDrive; |
|
2884 variationResPathWithoutDrive.Zero(); |
|
2885 variationResPathWithoutDrive.Append( KDC_RESOURCE_FILES_DIR() ); |
|
2886 variationResPathWithoutDrive.Append( KResourceVariationFilePathWithoutDrive() ); |
|
2887 HBufC* variationResPath = SolveResPathLC( variationResPathWithoutDrive ); |
|
2888 |
|
2889 |
|
2890 |
|
2891 TPtrC cuiResPath( KNullDesC ); |
|
2892 aBrand.RetrieveSavedSettingsL( iCoeEnv, |
|
2893 appRes, |
|
2894 *engResPath, |
|
2895 *presResPath, |
|
2896 *variationResPath, |
|
2897 cuiResPath, |
|
2898 MbmFullPath() ); |
|
2899 |
|
2900 CleanupStack::PopAndDestroy( 3, engResPath ); // variationResPath, presResPath, engResPath |
|
2901 } |
|
2902 |
|
2903 // ----------------------------------------------------------------------------- |
|
2904 // CCAAppUi::InitializeUIPHandlingL |
|
2905 // (other items were commented in a header). |
|
2906 // ----------------------------------------------------------------------------- |
|
2907 // |
|
2908 void CCAAppUi::InitializeUIPHandlingL() |
|
2909 { |
|
2910 // Connect to server |
|
2911 iNotifierAPI = CANotifierFactory::CreateNotifierL( NULL, KSDUidSysApLocal ); |
|
2912 } |
|
2913 |
|
2914 // ----------------------------------------------------------------------------- |
|
2915 // CCAAppUi::UpdateIMUIPIcon |
|
2916 // (other items were commented in a header). |
|
2917 // ----------------------------------------------------------------------------- |
|
2918 // |
|
2919 void CCAAppUi::UpdateIMUIPIcon() |
|
2920 { |
|
2921 TInt dummy( 0 ); |
|
2922 TInt count( iApplicationNGPC.MessagesPendingCount( dummy, |
|
2923 TEnumsPC::EUnreadReceived ) + |
|
2924 iProcessManager.GetInvitationsInterface()->UnreadInvitesCount() |
|
2925 + iApplicationNGPC.ChatGroupMessagesPendingCount( dummy ) ); |
|
2926 TInt error( iNotifierAPI->SetInt( MCANotifierInterface::EUIPIndKey, count ) ); |
|
2927 |
|
2928 if ( error ) |
|
2929 { |
|
2930 CActiveScheduler::Current()->Error( error ); |
|
2931 } |
|
2932 |
|
2933 // Update unread message count to PS |
|
2934 // Value is used by the ImIndicatorPlugin |
|
2935 RProperty::Define( |
|
2936 KPSUidIMUI, KIMUnreadMsgKey, RProperty::EInt, |
|
2937 KIMUnreadMsgReadPolicy, KIMUnreadMsgWritePolicy ); |
|
2938 RProperty::Set( KPSUidIMUI, KIMUnreadMsgKey, count ); |
|
2939 |
|
2940 |
|
2941 //if count=iUnreadMsgCount then there is no need of soft notification |
|
2942 if ( !iIsAppForeground && count != iUnreadMsgCount ) |
|
2943 { |
|
2944 // we show the soft notifaction only if chat is in backround |
|
2945 UpdateSoftNote( count ); |
|
2946 iUnreadMsgCount = count; |
|
2947 } |
|
2948 } |
|
2949 |
|
2950 // ----------------------------------------------------------------------------- |
|
2951 // CCAAppUi::UpdateSoftNote |
|
2952 // (other items were commented in a header). |
|
2953 // ----------------------------------------------------------------------------- |
|
2954 // |
|
2955 void CCAAppUi::UpdateSoftNote( TInt aUnreadCount ) |
|
2956 { |
|
2957 CHAT_DP_TXT( "CCAAppUi::UpdateSoftNote, signal SoftNotifier about new chat message!" ); |
|
2958 |
|
2959 TRAPD( err, |
|
2960 CAknSoftNotifier* softNotifier = CAknSoftNotifier::NewLC(); |
|
2961 softNotifier->SetNotificationCountL( EChatMessageNotification, aUnreadCount ); |
|
2962 CleanupStack::PopAndDestroy( softNotifier ); |
|
2963 ); |
|
2964 |
|
2965 if ( err ) |
|
2966 { |
|
2967 CActiveScheduler::Current()->Error( err ); |
|
2968 CHAT_DP( D_CHAT_LIT( "CCAAppUi::UpdateSoftNote - softnotifier left with: %d" ), err ); |
|
2969 } |
|
2970 } |
|
2971 |
|
2972 // ----------------------------------------------------------------------------- |
|
2973 // CCAAppUi::LayoutInfo |
|
2974 // (other items were commented in a header). |
|
2975 // ----------------------------------------------------------------------------- |
|
2976 // |
|
2977 MCALayoutInfo* CCAAppUi::LayoutInfo() |
|
2978 { |
|
2979 return iLayoutInfo; |
|
2980 } |
|
2981 |
|
2982 // ----------------------------------------------------------------------------- |
|
2983 // CCAAppUi::SetRefreshed |
|
2984 // (other items were commented in a header). |
|
2985 // ----------------------------------------------------------------------------- |
|
2986 // |
|
2987 void CCAAppUi::SetRefreshed() |
|
2988 { |
|
2989 iRefreshed = ETrue; |
|
2990 } |
|
2991 |
|
2992 // ----------------------------------------------------------------------------- |
|
2993 // CCAAppUi::ListRefreshed |
|
2994 // (other items were commented in a header). |
|
2995 // ----------------------------------------------------------------------------- |
|
2996 // |
|
2997 TBool CCAAppUi::ListRefreshed() |
|
2998 { |
|
2999 return iRefreshed; |
|
3000 } |
|
3001 |
|
3002 // ----------------------------------------------------------------------------- |
|
3003 // CCAAppUi::ChangeConnUiAgentResourceL |
|
3004 // (other items were commented in a header). |
|
3005 // ----------------------------------------------------------------------------- |
|
3006 // |
|
3007 void CCAAppUi::ChangeConnUiAgentResourceL( const TDesC& aNewResource ) |
|
3008 { |
|
3009 if ( iConnUIAgent ) |
|
3010 { |
|
3011 iConnUIAgent->UseResourceFileL( aNewResource ); |
|
3012 } |
|
3013 } |
|
3014 |
|
3015 |
|
3016 // ----------------------------------------------------------------------------- |
|
3017 // CCAAppUi::RefreshWaitFlag |
|
3018 // (other items were commented in a header). |
|
3019 // ----------------------------------------------------------------------------- |
|
3020 // |
|
3021 TInt& CCAAppUi::RefreshWaitFlag() |
|
3022 { |
|
3023 return iRefreshWaitFlag; |
|
3024 } |
|
3025 |
|
3026 // ----------------------------------------------------------------------------- |
|
3027 // CCAAppUi::IsUnderDestruction |
|
3028 // (other items were commented in a header). |
|
3029 // ----------------------------------------------------------------------------- |
|
3030 // |
|
3031 TBool CCAAppUi::IsUnderDestruction() |
|
3032 { |
|
3033 return iDestructingFlag; |
|
3034 } |
|
3035 |
|
3036 // ----------------------------------------------------------------------------- |
|
3037 // CCAAppUi::DefaultServerId |
|
3038 // (other items were commented in a header). |
|
3039 // ----------------------------------------------------------------------------- |
|
3040 // |
|
3041 TUint32 CCAAppUi::DefaultSAPUid() |
|
3042 { |
|
3043 TUint32 SAPUid = 0; |
|
3044 |
|
3045 //if there are no SAPs then don't try the get default server Id |
|
3046 if ( iSAPSettingsStore->SAPCountL( EIMPSIMAccessGroup ) > 0 ) |
|
3047 { |
|
3048 CIMPSSAPSettings* sapSettings = CIMPSSAPSettings::NewLC(); |
|
3049 TRAPD( err, iSAPSettingsStore->GetDefaultL( sapSettings, EIMPSIMAccessGroup ) ); |
|
3050 |
|
3051 if ( err == KErrNone ) |
|
3052 { |
|
3053 SAPUid = sapSettings->Uid(); |
|
3054 } |
|
3055 CleanupStack::PopAndDestroy( sapSettings ); |
|
3056 } |
|
3057 return SAPUid; |
|
3058 } |
|
3059 |
|
3060 |
|
3061 // ----------------------------------------------------------------------------- |
|
3062 // CCAAppUi::LaunchServerSettingsDialogL |
|
3063 // (other items were commented in a header). |
|
3064 // ----------------------------------------------------------------------------- |
|
3065 // |
|
3066 void CCAAppUi::LaunchServerSettingsDialogL() |
|
3067 { |
|
3068 TFileName resPath; |
|
3069 TFileName resIMCUVarPath; |
|
3070 |
|
3071 // resIMCUVarPath, is added to load the new resource file that contains the settings for IM UI. |
|
3072 |
|
3073 |
|
3074 // if there are no SAPs then don't try the get default |
|
3075 if ( iSAPSettingsStore->SAPCountL( EIMPSIMAccessGroup ) > 0 ) |
|
3076 { |
|
3077 CIMPSSAPSettings* sap = static_cast<CCAAppUi*>( iEikonEnv->AppUi() ) |
|
3078 ->UISessionManager().CurrentSAPLC(); |
|
3079 TPtrC sapName( sap->SAPName() ); |
|
3080 TPtrC wvSettRes( KWVSettingsResFileName ); |
|
3081 TPtrC wvIMCUResVar( KIMPSCUVariationResFileName ); |
|
3082 |
|
3083 CCAVariantFactory* varFact = |
|
3084 static_cast<CCAApp*>( Application() )->VariantFactory(); |
|
3085 |
|
3086 // CR : 101-39724 Error note needed when application cannot be opened because of the lack of the memory |
|
3087 MCAOpBrandVariant* opBrand = NULL; |
|
3088 TRAPD( err, opBrand = varFact->OpBrandVariantL() ); |
|
3089 if ( err ) |
|
3090 { |
|
3091 // Using CErrorUI, which matches the errorcode passed with coreesponding error string |
|
3092 // and displays the note. |
|
3093 CErrorUI* errorUI = CErrorUI::NewLC( ); |
|
3094 errorUI->ShowGlobalErrorNoteL( err ); |
|
3095 CleanupStack::PopAndDestroy( errorUI ); |
|
3096 User::Leave( err ); |
|
3097 } |
|
3098 |
|
3099 opBrand->CurrentResourceFileL( sapName, wvSettRes, resPath ); |
|
3100 opBrand->CurrentResourceFileL( sapName, wvIMCUResVar, resIMCUVarPath ); |
|
3101 |
|
3102 |
|
3103 if ( resPath.Length() != 0 ) |
|
3104 { |
|
3105 BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), resPath ); |
|
3106 } |
|
3107 |
|
3108 if ( resIMCUVarPath.Length() != 0 ) |
|
3109 { |
|
3110 BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), resIMCUVarPath ); |
|
3111 } |
|
3112 |
|
3113 CleanupStack::PopAndDestroy( sap ); |
|
3114 } |
|
3115 |
|
3116 TInt exitReason( 0 ); |
|
3117 iServSettingsDialog = CWVSettingsUIDialog::NewL(); |
|
3118 |
|
3119 iUISessionManager->SetStatusPaneIconsL(); |
|
3120 |
|
3121 TBool loggedIn = iUISessionManager->IsLoggedIn(); |
|
3122 |
|
3123 TUint32 SAPUid1; |
|
3124 TUint32 SAPUid2; |
|
3125 SAPUid1 = DefaultSAPUid(); |
|
3126 |
|
3127 // CodeScanner warning ignored because |
|
3128 // iServSettingsDialog is not owned by us |
|
3129 TInt retVal( iServSettingsDialog->RunDialogLD( *iSAPSettingsStore, // CSI: 50 # See comment above |
|
3130 this, |
|
3131 resPath, |
|
3132 resIMCUVarPath, |
|
3133 exitReason, |
|
3134 this, |
|
3135 &iServSettingsDialog ) ); |
|
3136 |
|
3137 SAPUid2 = DefaultSAPUid(); |
|
3138 |
|
3139 if ( SAPUid1 != SAPUid2 ) |
|
3140 { |
|
3141 iNeedRefresh = ETrue; |
|
3142 } |
|
3143 |
|
3144 iServSettingsDialog = NULL; |
|
3145 iUISessionManager->SetStatusPaneIconsL(); |
|
3146 // this is for updating settings view |
|
3147 if ( iNeedRefresh || ( loggedIn != iUISessionManager->IsLoggedIn() ) ) |
|
3148 { |
|
3149 SwitchViewL( KUidRefreshView ); |
|
3150 } |
|
3151 |
|
3152 if ( retVal == EWVSettingsViewExitCalled ) |
|
3153 { |
|
3154 HandleCommandL( EChatClientCmdExit ); |
|
3155 } |
|
3156 } |
|
3157 |
|
3158 #ifdef RD_CHAT_GROUP_MESSAGE_INDICATION_NEW |
|
3159 // --------------------------------------------------------- |
|
3160 // CCAAppUi::IsFullyConstructed |
|
3161 // (other items were commented in a header). |
|
3162 // --------------------------------------------------------- |
|
3163 // |
|
3164 TBool CCAAppUi::IsFullyConstructed() const |
|
3165 { |
|
3166 return iChatFullyConstructed; |
|
3167 } |
|
3168 #endif // RD_CHAT_GROUP_MESSAGE_INDICATION_NEW |
|
3169 |
|
3170 #ifdef RD_SETTINGS_FACELIFT |
|
3171 // --------------------------------------------------------- |
|
3172 // CCAAppUi::IsSettingsDialogActive |
|
3173 // (other items were commented in a header). |
|
3174 // --------------------------------------------------------- |
|
3175 // |
|
3176 TBool CCAAppUi::IsSettingsDialogActive() const |
|
3177 { |
|
3178 // CodeScanner warning ignored because we are not performing |
|
3179 // NULL equality checks here to check for validity of pointer. |
|
3180 // Check is needed to get boolean return value. |
|
3181 return iServSettingsDialog != NULL; // CSI: 64 # See above. |
|
3182 } |
|
3183 #endif // RD_SETTINGS_FACELIFT |
|
3184 |
|
3185 // --------------------------------------------------------- |
|
3186 // CCAAppUi::ReportPendingDialogClosed |
|
3187 // (other items were commented in a header). |
|
3188 // --------------------------------------------------------- |
|
3189 // |
|
3190 void CCAAppUi::ReportPendingDialogClosed() |
|
3191 { |
|
3192 // Counter must be over 1 |
|
3193 __CHAT_ASSERT_DEBUG( iPendingDialogCounter > 0 ); |
|
3194 iPendingDialogCounter--; |
|
3195 } |
|
3196 |
|
3197 // --------------------------------------------------------- |
|
3198 // CCAAppUi::ReportPendingDialog |
|
3199 // (other items were commented in a header). |
|
3200 // --------------------------------------------------------- |
|
3201 // |
|
3202 void CCAAppUi::ReportPendingDialog() |
|
3203 { |
|
3204 iPendingDialogCounter++; |
|
3205 } |
|
3206 // CCAAppUi::LaunchSettingsL |
|
3207 // (other items were commented in a header). |
|
3208 // --------------------------------------------------------- |
|
3209 // |
|
3210 TInt CCAAppUi::LaunchSettingsL ( CIMPSSAPSettings& aServer ) |
|
3211 { |
|
3212 MCASettingsPC* SettingsPC = iProcessManager.GetSettingsInterface(); |
|
3213 CCAAppSettingsDialog* dlg = new ( ELeave ) CCAAppSettingsDialog( *iStatusPaneHandler, |
|
3214 *SettingsPC, |
|
3215 *iUISessionManager, |
|
3216 &aServer ); |
|
3217 |
|
3218 CleanupStack::PushL( dlg ); |
|
3219 dlg->ConstructL( R_CHATCLIENT_APPSETTINGS_MENUBAR ); |
|
3220 CleanupStack::Pop( dlg ); |
|
3221 |
|
3222 return dlg->ExecuteLD( R_CHATCLIENT_APPSETTINGS_DLG ); |
|
3223 } |
|
3224 |
|
3225 |
|
3226 // ----------------------------------------------------------------------------- |
|
3227 // CCAAppUi::ServerChangedL |
|
3228 // (other items were commented in a header). |
|
3229 // ----------------------------------------------------------------------------- |
|
3230 // |
|
3231 void CCAAppUi::ServerChangedL ( const TDesC& aNewServerName, |
|
3232 TBool aDefaultServerchanged /* = |
|
3233 EFalse */ ) |
|
3234 { |
|
3235 CHAT_DP( D_CHAT_LIT( "CCAAppUi::ServerChangedL(%S)" ), &aNewServerName ); |
|
3236 if ( aNewServerName.Length() == 0 || |
|
3237 iSAPSettingsStore->SAPCountL( EIMPSIMAccessGroup ) == 0 ) |
|
3238 { |
|
3239 // no servers |
|
3240 return; |
|
3241 } |
|
3242 |
|
3243 |
|
3244 iNeedRefresh = UISessionManager().BrandUIL( EFalse, aNewServerName ); |
|
3245 |
|
3246 // Stop here if brand did not actually change |
|
3247 if ( ! iNeedRefresh && ! iServSettingsDialog ) |
|
3248 { |
|
3249 return; |
|
3250 } |
|
3251 |
|
3252 // Update status-pane |
|
3253 UISessionManager().SetStatusPaneIconsL(); |
|
3254 |
|
3255 // Get resource file for settings dialog |
|
3256 TFileName resPath; |
|
3257 TFileName resIMCUVariationPath; |
|
3258 |
|
3259 TPtrC resId( KWVSettingsResFileName() ); |
|
3260 TPtrC resIMCUVariationId( KIMPSCUVariationResFileName() ); |
|
3261 |
|
3262 CCAVariantFactory* varFact = |
|
3263 static_cast<CCAApp*>( Application() )->VariantFactory(); |
|
3264 |
|
3265 // CR : 101-39724 Error note needed when application cannot be opened because of the lack of the memory |
|
3266 MCAOpBrandVariant* opBrand = NULL ; |
|
3267 TRAPD( err, opBrand = varFact->OpBrandVariantL() ); |
|
3268 if ( err ) |
|
3269 { |
|
3270 // Using CErrorUI, which matches the errorcode passed with coreesponding error string |
|
3271 // and displays the note. |
|
3272 CErrorUI* errorUI = CErrorUI::NewLC( ); |
|
3273 errorUI->ShowGlobalErrorNoteL( err ); |
|
3274 CleanupStack::PopAndDestroy( errorUI ); |
|
3275 User::Leave( err ); |
|
3276 } |
|
3277 |
|
3278 opBrand->CurrentResourceFileL( aNewServerName, resId, resPath ); |
|
3279 opBrand->CurrentResourceFileL( aNewServerName, resIMCUVariationId, resIMCUVariationPath ); |
|
3280 |
|
3281 if ( resPath.Length() != 0 ) |
|
3282 { |
|
3283 BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), resPath ); |
|
3284 } |
|
3285 |
|
3286 if ( resIMCUVariationPath.Length() != 0 ) |
|
3287 { |
|
3288 BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), resIMCUVariationPath ); |
|
3289 } |
|
3290 |
|
3291 CHAT_DP( D_CHAT_LIT( "CCAAppUi::ServerChangedL, signalling service settings about resPath: %S" ), &resPath ); |
|
3292 if ( iServSettingsDialog ) |
|
3293 { |
|
3294 iServSettingsDialog->ChangeResourceFileL( resPath, resIMCUVariationPath ); |
|
3295 } |
|
3296 // Change resource file in iConnUIAgent |
|
3297 resPath.Zero(); |
|
3298 TPtrC resId2( KIMPSConnUIResFileName() ); |
|
3299 opBrand->CurrentResourceFileL( aNewServerName, resId2, resPath ); |
|
3300 if ( resPath.Length() > 0 ) |
|
3301 { |
|
3302 BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), resPath ); |
|
3303 ChangeConnUiAgentResourceL( resPath ); |
|
3304 } |
|
3305 if ( aDefaultServerchanged ) |
|
3306 { |
|
3307 iProcessManager.GetArrayInterface()->ResetArray( ETrue ); |
|
3308 } |
|
3309 } |
|
3310 |
|
3311 // --------------------------------------------------------- |
|
3312 // CCAAppUi::CurrentServerNameLC |
|
3313 // (other items were commented in a header). |
|
3314 // --------------------------------------------------------- |
|
3315 // |
|
3316 HBufC* CCAAppUi::CurrentServerNameLC() |
|
3317 { |
|
3318 HBufC* sapName = NULL; |
|
3319 TRAPD( err, |
|
3320 CIMPSSAPSettings* sap = UISessionManager().CurrentSAPLC(); |
|
3321 // CodeScanner warning ignored because sapName is pushed to |
|
3322 // cleanupstack later and there is no leaving code before it |
|
3323 sapName = sap->SAPName().AllocL(); // CSI: 35 # See comment above |
|
3324 CleanupStack::PopAndDestroy( sap ); |
|
3325 ); |
|
3326 |
|
3327 if ( err != KErrNone || !sapName ) |
|
3328 { |
|
3329 sapName = KNullDesC().AllocL(); |
|
3330 } |
|
3331 |
|
3332 CleanupStack::PushL( sapName ); |
|
3333 return sapName; |
|
3334 } |
|
3335 |
|
3336 |
|
3337 // --------------------------------------------------------- |
|
3338 // CCAAppUi::ConvertStatusToStatusMsgValue |
|
3339 // (other items were commented in a header). |
|
3340 // --------------------------------------------------------- |
|
3341 // |
|
3342 TEnumsPC::TCASettingStrings CCAAppUi::ConvertToTEnumsStatusMsgValue( |
|
3343 TEnumsPC::TOnlineStatus aStatus ) |
|
3344 { |
|
3345 // Map status to setting item |
|
3346 switch ( aStatus ) |
|
3347 { |
|
3348 case TEnumsPC::EAway: |
|
3349 { |
|
3350 return TEnumsPC::EStatusMsgAway; |
|
3351 // no need to break after return |
|
3352 } |
|
3353 case TEnumsPC::EBusy: |
|
3354 { |
|
3355 return TEnumsPC::EStatusMsgBusy; |
|
3356 // no need to break after return |
|
3357 } |
|
3358 case TEnumsPC::EOnline: // flowthrough |
|
3359 default: |
|
3360 { |
|
3361 return TEnumsPC::EStatusMsgOnline; |
|
3362 // no need to break after return |
|
3363 } |
|
3364 } |
|
3365 } |
|
3366 |
|
3367 |
|
3368 // --------------------------------------------------------- |
|
3369 // CCAAppUi::ShowInfoPopupL() |
|
3370 // --------------------------------------------------------- |
|
3371 // |
|
3372 void CCAAppUi::ShowInfoPopupL() |
|
3373 { |
|
3374 iInfoPopup->HideInfoPopupNote(); |
|
3375 |
|
3376 HBufC* previewBuffer = HBufC::NewLC( iTotalPreviewMsgLength + ( 3 * KLineFeed().Length() ) ); |
|
3377 |
|
3378 TPtr msgPtr( previewBuffer->Des() ); |
|
3379 |
|
3380 for ( TInt index( iPreviewMessageList->Count() - 1 ); index >= 0; --index ) |
|
3381 { |
|
3382 msgPtr.Append( iPreviewMessageList->MdcaPoint( index ) ); |
|
3383 msgPtr.Append( KLineFeed ); |
|
3384 } |
|
3385 |
|
3386 iPreviewMessageList->Reset(); |
|
3387 iInfoPopup->SetTextL( msgPtr ); |
|
3388 CleanupStack::PopAndDestroy(); //previewBuffer |
|
3389 iTotalPreviewMsgLength = 0; |
|
3390 iInfoNoteShowing = ETrue; |
|
3391 iInfoPopup->ShowInfoPopupNote(); |
|
3392 |
|
3393 } |
|
3394 |
|
3395 // --------------------------------------------------------- |
|
3396 // CCAAppUi::HandleInfoPopupNoteEvent() |
|
3397 // --------------------------------------------------------- |
|
3398 // |
|
3399 void CCAAppUi::HandleInfoPopupNoteEvent( CAknInfoPopupNoteController* /*aController*/, |
|
3400 TAknInfoPopupNoteEvent aEvent ) |
|
3401 { |
|
3402 |
|
3403 switch ( aEvent ) |
|
3404 { |
|
3405 case EInfoPopupNoteShown: |
|
3406 { |
|
3407 iInfoNoteShowing = ETrue; |
|
3408 break; |
|
3409 } |
|
3410 case EInfoPopupNoteHidden: |
|
3411 { |
|
3412 |
|
3413 iInfoNoteShowing = EFalse; |
|
3414 |
|
3415 if ( iPreviewMessageList->Count() ) |
|
3416 { |
|
3417 //play the message tone and show preview pane |
|
3418 PlayBeep(); |
|
3419 TRAP_IGNORE( ShowInfoPopupL() ); |
|
3420 } |
|
3421 |
|
3422 break; |
|
3423 } |
|
3424 default: |
|
3425 break; |
|
3426 } |
|
3427 |
|
3428 } |
|
3429 |
|
3430 // --------------------------------------------------------- |
|
3431 // CCAAppUi::AddToPreviewListL() |
|
3432 // --------------------------------------------------------- |
|
3433 // |
|
3434 void CCAAppUi::AddToPreviewListL( const TDesC& aContactId, const TDesC& aMsg ) |
|
3435 { |
|
3436 CDesCArray* array = new( ELeave )CDesCArrayFlat( 2 ); // two items |
|
3437 CleanupStack::PushL( array ); |
|
3438 array->AppendL( aContactId ); |
|
3439 array->AppendL( aMsg ); |
|
3440 |
|
3441 |
|
3442 HBufC* msg = StringLoader::LoadLC( R_QTN_CHAT_MESSAGE_PREVIEW, |
|
3443 *array ); |
|
3444 TPtr msgPtrTmp( msg->Des() ); |
|
3445 |
|
3446 TInt numOfChars = iCurrentFont->TextCount( msgPtrTmp, iPreviewPaneRect.Width() ); |
|
3447 |
|
3448 TPtrC msgPtr( KNullDesC() ); |
|
3449 msgPtr.Set( msg->Left( numOfChars ) ); |
|
3450 |
|
3451 iTotalPreviewMsgLength += msgPtr.Length(); |
|
3452 |
|
3453 if ( iPreviewMessageList->Count() == 3 ) |
|
3454 { |
|
3455 iPreviewMessageList->Delete( 0 ); |
|
3456 } |
|
3457 |
|
3458 iPreviewMessageList->AppendL( msgPtr ); |
|
3459 |
|
3460 CleanupStack::PopAndDestroy( 2, array ); |
|
3461 } |
|
3462 |
|
3463 // --------------------------------------------------------- |
|
3464 // CCAAppUi::CalculatePreviewPaneWidth() |
|
3465 // --------------------------------------------------------- |
|
3466 // |
|
3467 void CCAAppUi::CalculatePreviewPaneWidth() |
|
3468 { |
|
3469 // Get parameter and table limits for popup preview text window |
|
3470 TAknLayoutScalableParameterLimits limits = |
|
3471 AknLayoutScalable_Avkon::popup_preview_text_window_ParamLimits(); |
|
3472 |
|
3473 TAknLayoutScalableTableLimits tableLimits = |
|
3474 AknLayoutScalable_Avkon::popup_preview_text_window_t_Limits(); |
|
3475 |
|
3476 // Get layout rects |
|
3477 TRect rectScreen = iAvkonAppUi->ApplicationRect(); |
|
3478 TRect rectMainPane = rectScreen; |
|
3479 |
|
3480 // Use first variety to be able to get the font for text parsing |
|
3481 TInt firstVariety = SelectWindowVariety( 1, limits ); |
|
3482 |
|
3483 TRect rectPopupWindow = RectFromLayout( rectMainPane, |
|
3484 AknLayoutScalable_Avkon::popup_preview_text_window( firstVariety ) ); |
|
3485 |
|
3486 TInt firstIndex = tableLimits.FirstIndex(); |
|
3487 TInt firstLineVariety = AknLayoutScalable_Avkon:: |
|
3488 popup_preview_text_window_t_ParamLimits( firstIndex ).FirstVariety(); |
|
3489 |
|
3490 TAknTextLineLayout popupTextLayout = |
|
3491 AknLayoutScalable_Avkon::popup_preview_text_window_t( |
|
3492 firstIndex, firstLineVariety ); |
|
3493 |
|
3494 TAknLayoutText layoutText; |
|
3495 layoutText.LayoutText( rectPopupWindow, popupTextLayout ); |
|
3496 |
|
3497 iPreviewPaneRect = layoutText.TextRect(); |
|
3498 |
|
3499 iCurrentFont = const_cast<CFont*> ( layoutText.Font() ); |
|
3500 |
|
3501 } |
|
3502 |
|
3503 // --------------------------------------------------------- |
|
3504 // CCAAppUi::SelectWindowVariety() |
|
3505 // --------------------------------------------------------- |
|
3506 // |
|
3507 TInt CCAAppUi::SelectWindowVariety( const TInt aNumberOfLines, |
|
3508 const TAknLayoutScalableParameterLimits& aLimits ) const |
|
3509 { |
|
3510 TInt index = aNumberOfLines - 1; |
|
3511 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
3512 { |
|
3513 index += 5; |
|
3514 } |
|
3515 |
|
3516 return Min( Max( index, aLimits.FirstVariety() ), |
|
3517 aLimits.LastVariety() ); |
|
3518 } |
|
3519 |
|
3520 // --------------------------------------------------------- |
|
3521 // CCAAppUi::RectFromLayout() |
|
3522 // --------------------------------------------------------- |
|
3523 // |
|
3524 TRect CCAAppUi::RectFromLayout( const TRect& aParent, |
|
3525 const TAknWindowComponentLayout& aComponentLayout ) const |
|
3526 { |
|
3527 TAknWindowLineLayout lineLayout = aComponentLayout.LayoutLine(); |
|
3528 TAknLayoutRect layoutRect; |
|
3529 layoutRect.LayoutRect( aParent, lineLayout ); |
|
3530 return layoutRect.Rect(); |
|
3531 } |
|
3532 |
|
3533 |
|
3534 // --------------------------------------------------------- |
|
3535 // CCAAppUi::OfferTabEventL |
|
3536 // (other items were commented in a header). |
|
3537 // --------------------------------------------------------- |
|
3538 // |
|
3539 TKeyResponse CCAAppUi::OfferTabEventL( const TKeyEvent& |
|
3540 aKeyEvent, TEventCode aType ) |
|
3541 { |
|
3542 |
|
3543 TKeyResponse keyResponse = EKeyWasConsumed; |
|
3544 |
|
3545 CAknTabGroup* tabGroup = CAStatusPane()->TabGroup(); |
|
3546 |
|
3547 if ( tabGroup ) |
|
3548 { |
|
3549 keyResponse = tabGroup->OfferKeyEventL( aKeyEvent, aType ); |
|
3550 } |
|
3551 |
|
3552 return keyResponse; |
|
3553 } |
|
3554 |
|
3555 // --------------------------------------------------------- |
|
3556 // CCAAppUi::AddServerChangeObsL |
|
3557 // (other items were commented in a header). |
|
3558 // --------------------------------------------------------- |
|
3559 // |
|
3560 |
|
3561 void CCAAppUi::AddServerChangeObsL( MCAServerChangeNotify* aObserver ) |
|
3562 { |
|
3563 if ( aObserver ) |
|
3564 { |
|
3565 User::LeaveIfError( iServerChangeNotify.Append( aObserver ) ); |
|
3566 } |
|
3567 } |
|
3568 |
|
3569 // --------------------------------------------------------- |
|
3570 // CCAAppUi::RemoveServerChangeObs |
|
3571 // (other items were commented in a header). |
|
3572 // --------------------------------------------------------- |
|
3573 // |
|
3574 void CCAAppUi::RemoveServerChangeObs( MCAServerChangeNotify* aObserver ) |
|
3575 { |
|
3576 TInt status( iServerChangeNotify.Find( aObserver ) ); |
|
3577 if ( status != KErrNotFound ) |
|
3578 { |
|
3579 iServerChangeNotify.Remove( status ); |
|
3580 iServerChangeNotify.Compress(); |
|
3581 } |
|
3582 |
|
3583 status = iServerChangeNotify.Count(); |
|
3584 if ( status == 0 ) |
|
3585 { |
|
3586 iServerChangeNotify.ResetAndDestroy(); |
|
3587 iServerChangeNotify.Close(); |
|
3588 } |
|
3589 } |
|
3590 |
|
3591 // --------------------------------------------------------- |
|
3592 // CCAAppUi::HandleSAPEvent |
|
3593 // (other items were commented in a header). |
|
3594 // --------------------------------------------------------- |
|
3595 // |
|
3596 void CCAAppUi::HandleSAPEvent( TSAPEvent aEvent ) |
|
3597 { |
|
3598 if ( aEvent == ESAPSettingChanged ) |
|
3599 { |
|
3600 TInt count = iServerChangeNotify.Count(); |
|
3601 TRAP_IGNORE( |
|
3602 { |
|
3603 for ( TInt i = 0; i < count; i++ ) |
|
3604 { |
|
3605 if ( ( !iSAPSettingsStore->SAPCountL( EIMPSIMAccessGroup ) ) ) |
|
3606 { |
|
3607 iServerChangeNotify[i]->HandleServerChangeL( MCAServerChangeNotify::ENoServer ); |
|
3608 } |
|
3609 |
|
3610 else |
|
3611 { |
|
3612 iServerChangeNotify[i]->HandleServerChangeL( MCAServerChangeNotify::EOtherChange ); |
|
3613 } |
|
3614 } |
|
3615 } |
|
3616 ); |
|
3617 } |
|
3618 |
|
3619 } |
|
3620 // --------------------------------------------------------- |
|
3621 // CCAAppUi::SetFocusFlag |
|
3622 // (other items were commented in a header). |
|
3623 // --------------------------------------------------------- |
|
3624 // |
|
3625 void CCAAppUi::SetFocusFlag( TBool aFlag ) |
|
3626 { |
|
3627 iFocusFlag = aFlag; |
|
3628 } |
|
3629 // --------------------------------------------------------- |
|
3630 // CCAAppUi::FocusFlag |
|
3631 // (other items were commented in a header). |
|
3632 // --------------------------------------------------------- |
|
3633 // |
|
3634 TBool CCAAppUi::FocusFlag() |
|
3635 { |
|
3636 return iFocusFlag; |
|
3637 } |
|
3638 |
|
3639 // --------------------------------------------------------- |
|
3640 // CCAAppUi::IsBackgroundTaskPending |
|
3641 // (other items were commented in a header). |
|
3642 // --------------------------------------------------------- |
|
3643 // |
|
3644 TBool CCAAppUi::IsBackgroundTaskPendingL() |
|
3645 { |
|
3646 // When the settings dialog or the exit begins, set it true |
|
3647 iStopUpdateCba = ETrue; |
|
3648 TBool ret = EFalse; |
|
3649 |
|
3650 CHAT_DP_TXT( "CCAAppUi::IsBackgroundTaskPendingL started" ); |
|
3651 |
|
3652 MCALoginPC* loginPC = iProcessManager.GetLogInInterface(); |
|
3653 |
|
3654 iBackgroundTaskPending = loginPC->IsBackgroundTaskPending(); |
|
3655 |
|
3656 // check for group synch state |
|
3657 if ( iBackgroundTaskPending ) |
|
3658 { |
|
3659 loginPC->RegisterBackGroundTaskObserver( this ); |
|
3660 |
|
3661 ret = WaitToCompleteBackgroundTaskL(); |
|
3662 |
|
3663 } |
|
3664 |
|
3665 CHAT_DP_TXT( "CCAAppUi::IsBackgroundTaskPendingL completed" ); |
|
3666 |
|
3667 return ret; |
|
3668 } |
|
3669 |
|
3670 // --------------------------------------------------------- |
|
3671 // CCAAppUi::HandleBackGroundTaskComplete |
|
3672 // (other items were commented in a header). |
|
3673 // --------------------------------------------------------- |
|
3674 |
|
3675 void CCAAppUi::HandleBackGroundTaskCompleteL( TBool aCompleted ) |
|
3676 { |
|
3677 |
|
3678 CHAT_DP_TXT( "CCAAppUi::HandleBackGroundTaskComplete started" ); |
|
3679 |
|
3680 MCALoginPC* loginPC = iProcessManager.GetLogInInterface(); |
|
3681 |
|
3682 iBackgroundTaskPending = aCompleted; |
|
3683 |
|
3684 if ( !iBackgroundTaskPending ) //group synchro is complete |
|
3685 { |
|
3686 // hide wait note |
|
3687 if ( iWaitVisible ) |
|
3688 { |
|
3689 TRAPD( err, DismissWaitDialogL( KErrNone ) ); |
|
3690 if ( err != KErrNone ) |
|
3691 { |
|
3692 User::Leave( err ); |
|
3693 } |
|
3694 iWaitVisible = EFalse; |
|
3695 } |
|
3696 |
|
3697 loginPC->UnRegisterBackGroundTaskObserver( this ); |
|
3698 |
|
3699 if ( iIsFSDExitNeeded ) |
|
3700 { |
|
3701 HandleCommandL( EEikCmdExit ); |
|
3702 iIsFSDExitNeeded = EFalse; |
|
3703 } |
|
3704 |
|
3705 else |
|
3706 { |
|
3707 // every thinh is ok ,now call actual operation now |
|
3708 #ifdef RD_SETTINGS_FACELIFT |
|
3709 LaunchServerSettingsDialogL(); |
|
3710 #else |
|
3711 SwitchViewL( KUidSettingsView ); |
|
3712 #endif |
|
3713 // When the settings dialog exit, set it back |
|
3714 iStopUpdateCba = EFalse; |
|
3715 } |
|
3716 } |
|
3717 if ( iIsFSDExitNeeded ) |
|
3718 { |
|
3719 HandleCommandL( EEikCmdExit ); |
|
3720 iIsFSDExitNeeded = EFalse; |
|
3721 } |
|
3722 CHAT_DP_TXT( "CCAAppUi::HandleBackGroundTaskComplete done" ); |
|
3723 } |
|
3724 |
|
3725 // --------------------------------------------------------- |
|
3726 // CCAAppUi::WaitToCompleteBackgroundTask |
|
3727 // (other items were commented in a header). |
|
3728 // --------------------------------------------------------- |
|
3729 |
|
3730 TBool CCAAppUi::WaitToCompleteBackgroundTaskL() |
|
3731 { |
|
3732 CHAT_DP_TXT( "CCAAppUi::WaitToCompleteBackgroundTask started" ); |
|
3733 |
|
3734 if ( ! iWaitVisible && iBackgroundTaskPending ) |
|
3735 { |
|
3736 CHAT_DP_TXT( |
|
3737 "CCASessionHandler::GroupSyncL - ! iWaitVisible && iGroupSyncProgress" ); |
|
3738 // launch the wait note |
|
3739 iWaitVisible = ETrue; |
|
3740 |
|
3741 ShowWaitDialogL( R_QTN_CHAT_SEARCHVIEW_PROCESSING, ETrue ); |
|
3742 |
|
3743 CHAT_DP_TXT( "CCAAppUi::WaitToCompleteBackgroundTask done" ); |
|
3744 } |
|
3745 return ETrue; |
|
3746 } |
|
3747 |
|
3748 // --------------------------------------------------------- |
|
3749 // CCAAppUi::IsQueryAccepted |
|
3750 // (other items were commented in a header). |
|
3751 // --------------------------------------------------------- |
|
3752 TBool CCAAppUi::IsQueryAccepted() |
|
3753 { |
|
3754 return iQueryAccepted; |
|
3755 } |
|
3756 // --------------------------------------------------------- |
|
3757 // CCAAppUi::IsQueryAccepted |
|
3758 // (other items were commented in a header). |
|
3759 // --------------------------------------------------------- |
|
3760 void CCAAppUi::SetResetForwardTo( TEnumsPC::TForwardStatus aForward ) |
|
3761 { |
|
3762 iForward = aForward; |
|
3763 } |
|
3764 |
|
3765 // --------------------------------------------------------- |
|
3766 // CCAAppUi::IsQueryAccepted |
|
3767 // (other items were commented in a header). |
|
3768 // --------------------------------------------------------- |
|
3769 TEnumsPC::TForwardStatus CCAAppUi::RetForwardTo() |
|
3770 { |
|
3771 return iForward; |
|
3772 } |
|
3773 |
|
3774 // --------------------------------------------------------- |
|
3775 // CCAAppUi::IsQueryAccepted |
|
3776 // (other items were commented in a header). |
|
3777 // --------------------------------------------------------- |
|
3778 void CCAAppUi::UnRegisterPreviousview() |
|
3779 { |
|
3780 TInt index = 0; |
|
3781 TInt count = iSwitchView.Count(); |
|
3782 |
|
3783 // Check all views in queue |
|
3784 for ( ; index < count; index++ ) |
|
3785 { |
|
3786 if ( index == count - 1 |
|
3787 && ( iSwitchView[ index ] == KUidChatView || |
|
3788 iSwitchView[ index ] == KUidConversationsView || |
|
3789 iSwitchView[ index ] == KUidRecordedChatView ) ) |
|
3790 { |
|
3791 iLastView = TUid::Uid( 0 ); |
|
3792 iSwitchView[ index ] = TUid::Uid( 0 ); |
|
3793 iSwitchMessage[ index ] = TUid::Uid( 0 ); |
|
3794 delete iSwitchMessageContent[ index ]; |
|
3795 iSwitchMessageContent[ index ] = NULL; |
|
3796 |
|
3797 iSwitchView.Remove( index ); |
|
3798 iSwitchMessage.Remove( index ); |
|
3799 iSwitchMessageContent.Remove( index ); |
|
3800 count = iSwitchView.Count(); |
|
3801 } |
|
3802 } |
|
3803 } |
|
3804 #ifdef RD_MULTIPLE_DRIVE |
|
3805 // ----------------------------------------------------------------------------- |
|
3806 // CCAAppUi::GetDriveStatusL() |
|
3807 // Check the status of the drive. |
|
3808 // ----------------------------------------------------------------------------- |
|
3809 // |
|
3810 |
|
3811 TBool CCAAppUi::GetDriveStatusL( const TDriveNumber aDriveNumber ) |
|
3812 { |
|
3813 RFs& fs = CCoeEnv::Static()->FsSession(); |
|
3814 _LIT( KFat, "Fat" ); |
|
3815 |
|
3816 // Check if the drive is already mounted |
|
3817 TFullName fsName; |
|
3818 TInt error( fs.FileSystemName( fsName, aDriveNumber ) ); |
|
3819 if ( error ) |
|
3820 { |
|
3821 return EFalse; |
|
3822 } |
|
3823 |
|
3824 // check if MMC already mounted |
|
3825 if ( fsName.Length() == 0 ) |
|
3826 { |
|
3827 // MMC drive isnt mounted at present, so try it now.... |
|
3828 error = fs.MountFileSystem( KFat, aDriveNumber ); |
|
3829 |
|
3830 // If it's a locked MMC and the password is already known it'll be |
|
3831 // unlocked automatically when it's mounted., otherwise the mount will |
|
3832 // return with KErrLocked..... |
|
3833 switch ( error ) |
|
3834 { |
|
3835 case KErrNone: |
|
3836 case KErrLocked: |
|
3837 { |
|
3838 break; |
|
3839 } |
|
3840 default: |
|
3841 { |
|
3842 return EFalse; |
|
3843 } |
|
3844 } |
|
3845 } |
|
3846 TDriveInfo driveInfo; |
|
3847 error = fs.Drive( driveInfo, aDriveNumber ); |
|
3848 if ( error ) |
|
3849 { |
|
3850 return EFalse; |
|
3851 } |
|
3852 |
|
3853 // MMC is in slot |
|
3854 if ( driveInfo.iMediaAtt & KMediaAttLocked ) |
|
3855 { |
|
3856 return EFalse; |
|
3857 } |
|
3858 |
|
3859 TVolumeInfo volumeInfo; |
|
3860 error = fs.Volume( volumeInfo, aDriveNumber ); |
|
3861 if ( error ) |
|
3862 { |
|
3863 return EFalse; |
|
3864 } |
|
3865 |
|
3866 // If type is remote drive and aConnectionState is required |
|
3867 if ( driveInfo.iDriveAtt & KDriveAttRemote ) |
|
3868 { |
|
3869 TChar driveLetter; |
|
3870 fs.DriveToChar( aDriveNumber, driveLetter ); |
|
3871 // This statement migth cause leave.. to be solved |
|
3872 CRsfwMountMan* mountMgr = CRsfwMountMan::NewL( 0, NULL ); |
|
3873 TRsfwMountInfo mountInfo; |
|
3874 error = mountMgr->GetMountInfo( driveLetter, mountInfo ); |
|
3875 delete mountMgr; |
|
3876 |
|
3877 if ( error ) |
|
3878 { |
|
3879 return EFalse; |
|
3880 } |
|
3881 } |
|
3882 return ETrue; |
|
3883 } |
|
3884 #endif |
|
3885 // ----------------------------------------------------------------------------- |
|
3886 // CCAAppUi::GetStopUpdateCba() |
|
3887 // (other items were commented in a header). |
|
3888 // ----------------------------------------------------------------------------- |
|
3889 // |
|
3890 TBool CCAAppUi::GetStopUpdateCba() |
|
3891 { |
|
3892 return iStopUpdateCba; |
|
3893 } |
|
3894 |
|
3895 |
|
3896 // ----------------------------------------------------------------------------- |
|
3897 // CCAAppUi::GetIsFSWExitFlag() |
|
3898 // (other items were commented in a header). |
|
3899 // ----------------------------------------------------------------------------- |
|
3900 // |
|
3901 TBool CCAAppUi::GetIsFSWExitFlag() |
|
3902 { |
|
3903 return iIsFSWExit; |
|
3904 } |
|
3905 |
|
3906 // ----------------------------------------------------------------------------- |
|
3907 // CCAAppUi::SetFSWExitFlag() |
|
3908 // (other items were commented in a header). |
|
3909 // ----------------------------------------------------------------------------- |
|
3910 // |
|
3911 void CCAAppUi::SetFSWExitFlag( TBool aValue ) |
|
3912 { |
|
3913 iIsFSWExit = aValue; |
|
3914 } |
|
3915 |
|
3916 // ----------------------------------------------------------------------------- |
|
3917 // CCAAppUi::CKludgeScheduler::PublicLevel() |
|
3918 // (other items were commented in a header). |
|
3919 // ----------------------------------------------------------------------------- |
|
3920 // |
|
3921 TInt CCAAppUi::CKludgeScheduler::PublicLevel() const |
|
3922 { |
|
3923 return Level(); |
|
3924 } |
|
3925 |
|
3926 // ----------------------------------------------------------------------------- |
|
3927 // CCAAppUi::LevelOfActiveScheduler() |
|
3928 // (other items were commented in a header). |
|
3929 // ----------------------------------------------------------------------------- |
|
3930 // |
|
3931 TInt CCAAppUi::LevelOfActiveScheduler() |
|
3932 { |
|
3933 return STATIC_CAST( CCAAppUi::CKludgeScheduler*, |
|
3934 CActiveScheduler::Current() )->PublicLevel(); |
|
3935 } |
|
3936 // End of File |
|
3937 |
|
3938 |