1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation for CVIMPSTUiTabbedView |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cvimpstuitabbedview.h" |
|
21 |
|
22 #include "cvimpstcmdhandler.h" |
|
23 #include "mvimpstuitabbedviewcontrol.h" |
|
24 #include "mvimpstuitabcontrolfactory.h" |
|
25 #include "vimpstcmd.hrh" |
|
26 #include "mvimpstcmd.h" |
|
27 #include "mvimpstengine.h" |
|
28 #include "mvimpstenginesearchmgrextention.h" |
|
29 |
|
30 #include "vimpstui.hrh" |
|
31 #include "vimpstextentionuiuid.h" |
|
32 #include "tvimpstconsts.h" |
|
33 #include "cvimpstuiextensionservice.h" |
|
34 #include "cvimpstuibranddata.h" |
|
35 #include "mvimpstprocessarray.h" |
|
36 #include "vimpstutilsdialog.h" |
|
37 #include "vimpstutilswaitnote.h" |
|
38 #include "vimpstcmd.hrh" |
|
39 #include "cvimpstuisearchfieldaray.h" |
|
40 #include "mvimpstuisearchfield.h" |
|
41 #include "cvimpstuisearchquerydialog.h" |
|
42 #include "cvimpstuiavatarselectionhandler.h" // avatar selection |
|
43 #include "cvimpstuistatuspanehandler.h" |
|
44 |
|
45 |
|
46 #include "mvimpstengineextentionfeatures.h" |
|
47 #include "mvimpststoragevpbkstorehandler.h" |
|
48 |
|
49 // System includes |
|
50 #include <akntoolbar.h> //CAknToolbar |
|
51 #include <eikcolib.h> //CEikAppUiFactory |
|
52 |
|
53 #include <coecntrl.h> |
|
54 #include <eikmenup.h> |
|
55 #include <AknGlobalNote.h> |
|
56 #include <eikbtgpc.h> |
|
57 #include <avkon.rsg> |
|
58 #include <aknnotewrappers.h> |
|
59 #include <AknQueryDialog.h> |
|
60 #include <StringLoader.h> |
|
61 #include <eikenv.h> |
|
62 #include <e32property.h> |
|
63 #include <apgtask.h> |
|
64 #include <aknmessagequerydialog.h> |
|
65 |
|
66 // Pbk2 |
|
67 #include <MPbk2AppUi.h> |
|
68 #include <CPbk2UIExtensionView.h> |
|
69 #include <MPbk2ViewActivationTransaction.h> |
|
70 #include <MPbk2ViewExplorer.h> |
|
71 #include <CPbk2ViewState.h> |
|
72 #include <MPbk2StartupMonitor.h> |
|
73 #include <Pbk2Commands.hrh> |
|
74 #include <MVPbkStoreContact.h> |
|
75 |
|
76 #include <MPbk2ApplicationServices.h> |
|
77 #include <MPbk2CommandHandler.h> |
|
78 // xSP extension manager |
|
79 #include "MxSPViewMapper.h" |
|
80 #include "MxSPContactManager.h" |
|
81 #include "cvimpststoragemanagerfactory.h" |
|
82 #include "mvimpststorageserviceview.h" |
|
83 #include "cvimpstuimenuextension.h" |
|
84 |
|
85 //resource |
|
86 #include <extensionmanagerres.rsg> |
|
87 #include <vimpstuires.rsg> |
|
88 |
|
89 //CCA |
|
90 #include <mccaparameter.h> |
|
91 #include <ccafactory.h> |
|
92 #include <mccaconnection.h> |
|
93 |
|
94 #include "uiservicetabtracer.h" |
|
95 |
|
96 //AIW - VOIP |
|
97 #include <aiwdialdataext.h> |
|
98 #include <aknPopup.h> |
|
99 #include <AiwCommon.hrh> |
|
100 #include <AiwServiceHandler.h> |
|
101 #include <aiwdialdata.h> |
|
102 #include <MVPbkStoreContact.h> |
|
103 |
|
104 //browser launch |
|
105 #include <browserlauncher.h> |
|
106 #include "cvimpstuitermsofusedialoghandler.h" |
|
107 #include <cvimpstsettingsstore.h> |
|
108 #include <aknmessagequerydialog.h> |
|
109 #include "tvimpstconsts.h" |
|
110 // avatar |
|
111 #include "mvimpstenginepresencesubservice.h" |
|
112 #include "mvimpstenginesubservice.h" |
|
113 #include "mvimpstengineimsubservice.h" |
|
114 #include "cvimpstuicontactselection.h" |
|
115 |
|
116 #include <vimpstui.mbg> |
|
117 // help launch |
|
118 #include <hlplch.h> |
|
119 #include <coehelp.h> |
|
120 #include "meco.hlp.hrh" |
|
121 |
|
122 #include <AiwGenericParam.h> |
|
123 #include <AiwCommon.hrh> //KAiwCmdCall |
|
124 #include <AiwContactAssignDataTypes.h> |
|
125 #include <commonphoneparser.h> |
|
126 |
|
127 using namespace AiwContactAssign; |
|
128 using namespace Phonebook2; |
|
129 |
|
130 const TInt KBufLen(512); |
|
131 |
|
132 |
|
133 // ================= MEMBER FUNCTIONS ======================= |
|
134 |
|
135 |
|
136 // -------------------------------------------------------------------------- |
|
137 // CVIMPSTUiTabbedView::CVIMPSTUiTabbedView |
|
138 // -------------------------------------------------------------------------- |
|
139 // |
|
140 CVIMPSTUiTabbedView::CVIMPSTUiTabbedView( |
|
141 MxSPViewMapper& aMapper, |
|
142 MxSPContactManager& aContactManager, |
|
143 TUint aTabbedViewId, |
|
144 TUint aServiceId, |
|
145 CPbk2UIExtensionView& aView, |
|
146 TUid /*aId*/, |
|
147 CVIMPSTUIExtensionService& aServiceData, |
|
148 MVIMPSTEngine& aEngine, |
|
149 MVIMPSTCmdHandler& aCommandHandler, |
|
150 CVIMPSTUIMenuExtension& aMenuExtension) : |
|
151 CxSPBaseView( aMapper, aContactManager, aView ), |
|
152 iViewId( aTabbedViewId ), |
|
153 iServiceId(aServiceId), |
|
154 iEngine(aEngine), |
|
155 iExtensionService( aServiceData ), |
|
156 iCommandHandler( aCommandHandler), |
|
157 iMenuExtension(aMenuExtension), |
|
158 iSelectedAction( KErrNotFound ) |
|
159 |
|
160 { |
|
161 iFixedToolbar = NULL; |
|
162 iIsToolBarHidden = ETrue; |
|
163 } |
|
164 |
|
165 |
|
166 // -------------------------------------------------------------------------- |
|
167 // CVIMPSTUiTabbedView::ConstructL |
|
168 // -------------------------------------------------------------------------- |
|
169 // |
|
170 inline void CVIMPSTUiTabbedView::ConstructL() |
|
171 { |
|
172 ViewBaseConstructL( KIMCONTACTSEXTNIMPLEMENTATIONUID, iViewId ); |
|
173 |
|
174 iCommandHandler.RegisterEventObserverL(this); |
|
175 |
|
176 iPreviousState = TVIMPSTEnums::ESVCENotRegistered; |
|
177 |
|
178 iServiceHandler = CAiwServiceHandler::NewL(); |
|
179 |
|
180 iServiceHandler->AttachL( R_IM_APP_INTEREST ); |
|
181 iServiceHandler->AttachMenuL( R_SERVTAB_TABBED_VIEW_MENU, |
|
182 R_IM_APP_INTEREST ); |
|
183 |
|
184 iServiceHandler->AttachL( R_AIWASSIGNMENT_INTEREST ); |
|
185 |
|
186 iServiceHandler->AttachL( R_AIWSELECT_INTEREST ); |
|
187 |
|
188 iStatusMessage = HBufC::NewL( KStatusTextLength ); |
|
189 |
|
190 iStatusPaneHandler = CCVIMPSTUiStatusPaneHandler::NewL(); |
|
191 |
|
192 //Get SearchMgr |
|
193 MVIMPSTEngineExtentionFeatures* feature = iEngine.ExtentionFeatures(TVIMPSTEnums::ESearch); |
|
194 if (feature) |
|
195 { |
|
196 MVIMPSTEngineSearchMgrExtention& searchMgr = |
|
197 MVIMPSTEngineSearchMgrExtention::Cast |
|
198 (*feature); |
|
199 |
|
200 searchMgr.RegisterObserver(this); |
|
201 } |
|
202 iSettingsStore = CVIMPSTSettingsStore::NewL(); |
|
203 |
|
204 iBrandHandler = CVIMPSTUiBrandData::NewL( iEngine ); |
|
205 |
|
206 iAppUi = CCoeEnv::Static()->AppUi(); |
|
207 |
|
208 CFbsBitmap *bitmap, *mask; |
|
209 iBrandHandler->GetBrandBitmapsL( &bitmap, &mask); |
|
210 iStatusPaneHandler->SetPictureL( bitmap, mask ); |
|
211 |
|
212 iIsServiceHandleReSet = EFalse; |
|
213 |
|
214 iContainerCreationStarted = EFalse; |
|
215 } |
|
216 |
|
217 |
|
218 // -------------------------------------------------------------------------- |
|
219 // CVIMPSTUiTabbedView::NewL |
|
220 // -------------------------------------------------------------------------- |
|
221 // |
|
222 CVIMPSTUiTabbedView* CVIMPSTUiTabbedView::NewL( MxSPViewMapper& aMapper, |
|
223 MxSPContactManager& aContactManager, |
|
224 TUint aTabbedViewId, |
|
225 TUint aServiceId, |
|
226 CPbk2UIExtensionView& aView, |
|
227 TUid aId, |
|
228 CVIMPSTUIExtensionService& aServiceData, |
|
229 MVIMPSTEngine& aEngine, |
|
230 MVIMPSTCmdHandler& aCommandHandler, |
|
231 CVIMPSTUIMenuExtension& aMenuExtension) |
|
232 { |
|
233 CVIMPSTUiTabbedView* self = new(ELeave) CVIMPSTUiTabbedView( aMapper, |
|
234 aContactManager, |
|
235 aTabbedViewId, |
|
236 aServiceId, |
|
237 aView, |
|
238 aId, |
|
239 aServiceData, |
|
240 aEngine, |
|
241 aCommandHandler, |
|
242 aMenuExtension); |
|
243 CleanupStack::PushL(self); |
|
244 self->ConstructL(); |
|
245 CleanupStack::Pop(self); |
|
246 return self; |
|
247 } |
|
248 |
|
249 |
|
250 // -------------------------------------------------------------------------- |
|
251 // CVIMPSTUiTabbedView::~CVIMPSTUiTabbedView |
|
252 // -------------------------------------------------------------------------- |
|
253 // |
|
254 CVIMPSTUiTabbedView::~CVIMPSTUiTabbedView() |
|
255 { |
|
256 delete iContactSelection; |
|
257 delete iFriendRequestId; |
|
258 |
|
259 delete iSelectedData.iPackedLinks; |
|
260 iSelectedData.iXSPList.ResetAndDestroy(); |
|
261 |
|
262 delete iQueryResult; |
|
263 //Get SearchMgr |
|
264 MVIMPSTEngineExtentionFeatures* feature = iEngine.ExtentionFeatures(TVIMPSTEnums::ESearch); |
|
265 if (feature) |
|
266 { |
|
267 MVIMPSTEngineSearchMgrExtention& searchMgr = |
|
268 MVIMPSTEngineSearchMgrExtention::Cast |
|
269 (*feature); |
|
270 |
|
271 searchMgr.UnRegisterObserver(this); |
|
272 } |
|
273 |
|
274 if(iParameter!=NULL) |
|
275 iParameter->Close(); |
|
276 if(iConnection!=NULL) |
|
277 { |
|
278 iConnection->Close(); |
|
279 iConnection = NULL; |
|
280 } |
|
281 |
|
282 if (iContainer && iAppUi ) |
|
283 { |
|
284 iAppUi->RemoveFromStack( iContainer->CoeControl() ); |
|
285 delete iContainer; |
|
286 iContainerCreationStarted = EFalse; |
|
287 } |
|
288 delete iBrandHandler; |
|
289 iCommandHandler.UnRegisterEventObserver(this); |
|
290 |
|
291 if ( iFixedToolbar ) |
|
292 { |
|
293 iFixedToolbar->SetToolbarObserver( NULL ); |
|
294 delete iFixedToolbar; |
|
295 iFixedToolbar = NULL; |
|
296 } |
|
297 |
|
298 if (iServiceHandler) |
|
299 { |
|
300 iServiceHandler->Reset(); |
|
301 delete iServiceHandler; |
|
302 iServiceHandler = NULL; |
|
303 } |
|
304 |
|
305 delete iContact; |
|
306 |
|
307 if(iFocussedIDHistory) |
|
308 { |
|
309 delete iFocussedIDHistory; |
|
310 iFocussedIDHistory = NULL; |
|
311 } |
|
312 delete iBrLauncher; |
|
313 delete iUserId; |
|
314 |
|
315 if(iSettingsStore) |
|
316 { |
|
317 delete iSettingsStore; |
|
318 iSettingsStore = NULL; |
|
319 } |
|
320 delete iStatusPaneHandler; |
|
321 |
|
322 delete iAiwParamList; |
|
323 |
|
324 if(iStatusMessage) |
|
325 { |
|
326 delete iStatusMessage; |
|
327 } |
|
328 |
|
329 } |
|
330 |
|
331 |
|
332 |
|
333 // -------------------------------------------------------------------------- |
|
334 // CVIMPSTUiTabbedView::DynInitMenuPaneL |
|
335 // -------------------------------------------------------------------------- |
|
336 // |
|
337 void CVIMPSTUiTabbedView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
338 { |
|
339 |
|
340 if (iEngine.IsUnInstalled()) |
|
341 { |
|
342 // if engine is uninstalled, do not initiate the menu pane. |
|
343 return; |
|
344 } |
|
345 // AIW knows its own submenu hooks, so we can return from |
|
346 // here if AIW handled this. |
|
347 ReInitializeServiceHandlerL(); |
|
348 |
|
349 iMenuExtension.ResetAIWCommandMap(); |
|
350 |
|
351 if ( iServiceHandler->HandleSubmenuL( *aMenuPane ) ) |
|
352 { |
|
353 return; |
|
354 } |
|
355 |
|
356 TBool imService = iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EIM); |
|
357 TBool voipService = iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EVoip); |
|
358 TBool presenceService = iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EPresence); |
|
359 TVIMPSTEnums::TVIMPSTRegistrationState serviceTabState = |
|
360 iEngine.ServiceState(); |
|
361 |
|
362 TInt itemIndex = CurrentItemIndex(); |
|
363 // fetch the item and process correct type |
|
364 TVIMPSTEnums::TItem itemType = iCommandHandler.GetProcessInterface().GetType(itemIndex); |
|
365 TVIMPSTEnums::TOnlineStatus onlinestatus = iCommandHandler.GetProcessInterface().GetOnlineStatusL(itemIndex); |
|
366 |
|
367 switch( aResourceId) |
|
368 { |
|
369 case R_EXTENSION_MANAGER_MENU: |
|
370 { |
|
371 aMenuPane->AddMenuItemsL(R_SERVTAB_TABBED_VIEW_MENU); |
|
372 aMenuPane->AddMenuItemsL(R_TABBED_VIEW_GENERAL_MENU); |
|
373 |
|
374 aMenuPane->SetItemDimmed(ECmdGetBlockedList, ETrue); |
|
375 //based on sevice states decide what all submenu should be shown |
|
376 //and main menu's to be shown |
|
377 switch (serviceTabState) |
|
378 { |
|
379 case TVIMPSTEnums::ESVCENotRegistered: |
|
380 { |
|
381 aMenuPane->SetItemDimmed(ECmdCreateNewOption, ETrue); |
|
382 aMenuPane->SetItemDimmed(ECmdMyAvatar, ETrue); |
|
383 aMenuPane->SetItemDimmed(ECmdChangeStatus, ETrue); |
|
384 aMenuPane->SetItemDimmed(ECmdLogout, ETrue); |
|
385 aMenuPane->SetItemDimmed(ECmdCancelLogin, ETrue); |
|
386 aMenuPane->SetItemDimmed(ECmdChangeConnectioninOnlineState, ETrue); |
|
387 aMenuPane->SetItemDimmed(ECmdChangeConnectioninWaitingState, ETrue); |
|
388 break; |
|
389 } |
|
390 case TVIMPSTEnums::ESVCERegistered: |
|
391 { |
|
392 if (!presenceService) |
|
393 { |
|
394 aMenuPane->SetItemDimmed(ECmdMyAvatar, ETrue); |
|
395 aMenuPane->SetItemDimmed(ECmdChangeStatus, ETrue); |
|
396 } |
|
397 else |
|
398 { |
|
399 //find whether avatar is supported |
|
400 //Get Presence SubService |
|
401 MVIMPSTEngineSubService* subService = |
|
402 (iEngine.SubService(TVIMPSTEnums::EPresence)); |
|
403 if(subService) |
|
404 { |
|
405 MVIMPSTEnginePresenceSubService& presence = |
|
406 MVIMPSTEnginePresenceSubService::Cast (*subService); |
|
407 |
|
408 aMenuPane->SetItemDimmed(ECmdMyAvatar, !presence.IsAvatarSupported() ); |
|
409 } |
|
410 |
|
411 } |
|
412 aMenuPane->SetItemDimmed(ECmdLogin, ETrue); |
|
413 aMenuPane->SetItemDimmed(ECmdCancelLogin, ETrue); |
|
414 |
|
415 if (!ChangeConnectionSupportedL()) |
|
416 { |
|
417 aMenuPane->SetItemDimmed(ECmdChangeConnectioninOnlineState, ETrue); |
|
418 } |
|
419 |
|
420 aMenuPane->SetItemDimmed(ECmdChangeConnectioninWaitingState, ETrue); |
|
421 if(iEngine.IsBlockSupportedL()) |
|
422 { |
|
423 aMenuPane->SetItemDimmed(ECmdGetBlockedList, EFalse); |
|
424 } |
|
425 break; |
|
426 } |
|
427 case TVIMPSTEnums::ESVCENetworkConnecting: |
|
428 { |
|
429 aMenuPane->SetItemDimmed(ECmdChangeStatus, ETrue); |
|
430 aMenuPane->SetItemDimmed(ECmdCreateNewOption, ETrue); |
|
431 aMenuPane->SetItemDimmed(ECmdMyAvatar, ETrue); |
|
432 aMenuPane->SetItemDimmed(ECmdLogin, ETrue); |
|
433 aMenuPane->SetItemDimmed(ECmdLogout, ETrue); |
|
434 aMenuPane->SetItemDimmed(ECmdSettings, ETrue); |
|
435 aMenuPane->SetItemDimmed(ECmdChangeConnectioninOnlineState, ETrue); |
|
436 aMenuPane->SetItemDimmed(ECmdChangeConnectioninWaitingState, ETrue); |
|
437 if( !CancelLoginSupportedL()) |
|
438 { |
|
439 aMenuPane->SetItemDimmed(ECmdCancelLogin, ETrue); |
|
440 } |
|
441 break; |
|
442 } |
|
443 case TVIMPSTEnums::ESVCEWaitingForNetwork: |
|
444 case TVIMPSTEnums::ESVCEUpdatingContacts: |
|
445 { |
|
446 aMenuPane->SetItemDimmed(ECmdChangeStatus, ETrue); |
|
447 aMenuPane->SetItemDimmed(ECmdCreateNewOption, ETrue); |
|
448 aMenuPane->SetItemDimmed(ECmdMyAvatar, ETrue); |
|
449 aMenuPane->SetItemDimmed(ECmdLogin, ETrue); |
|
450 aMenuPane->SetItemDimmed(ECmdCancelLogin, ETrue); |
|
451 aMenuPane->SetItemDimmed(ECmdChangeConnectioninOnlineState, ETrue); |
|
452 if (!ChangeConnectionSupportedL()) |
|
453 { |
|
454 aMenuPane->SetItemDimmed(ECmdChangeConnectioninWaitingState, ETrue); |
|
455 } |
|
456 break; |
|
457 } |
|
458 case TVIMPSTEnums::ESVCENetworkDisConnecting: |
|
459 { |
|
460 aMenuPane->SetItemDimmed(ECmdChangeStatus, ETrue); |
|
461 aMenuPane->SetItemDimmed(ECmdCreateNewOption, ETrue); |
|
462 aMenuPane->SetItemDimmed(ECmdMyAvatar, ETrue); |
|
463 aMenuPane->SetItemDimmed(ECmdLogin, ETrue); |
|
464 aMenuPane->SetItemDimmed(ECmdCancelLogin, ETrue); |
|
465 aMenuPane->SetItemDimmed(ECmdSettings, ETrue); |
|
466 aMenuPane->SetItemDimmed(ECmdLogout, ETrue); |
|
467 aMenuPane->SetItemDimmed(ECmdChangeConnectioninWaitingState, ETrue); |
|
468 aMenuPane->SetItemDimmed(ECmdChangeConnectioninOnlineState, ETrue); |
|
469 break; |
|
470 } |
|
471 default: |
|
472 { |
|
473 break; |
|
474 } |
|
475 } |
|
476 // common to all |
|
477 aMenuPane->SetItemDimmed(ECmdOpenConversation, ETrue); |
|
478 aMenuPane->SetItemDimmed(ECmdContactAddAsFriend, ETrue); |
|
479 aMenuPane->SetItemDimmed(KAiwCmdCall, ETrue); |
|
480 aMenuPane->SetItemDimmed(ECmdCloseConversation, ETrue); |
|
481 aMenuPane->SetItemDimmed(ECmdContactDetails, ETrue); |
|
482 aMenuPane->SetItemDimmed(ECmdOpenFriendRequest, ETrue); |
|
483 aMenuPane->SetItemDimmed(ECmdContactEdit, ETrue); |
|
484 aMenuPane->SetItemDimmed(ECmdAIWAddToContact, ETrue); |
|
485 aMenuPane->SetItemDimmed(ECmdAIWLinkToContact, ETrue); |
|
486 aMenuPane->SetItemDimmed(ECmdBlock, ETrue); |
|
487 aMenuPane->SetItemDimmed(ECmdUnBlock, ETrue); |
|
488 aMenuPane->SetItemDimmed(ECmdContactDelete, ETrue); |
|
489 //based on items in focus decide what main menu items needs to be shown |
|
490 switch(itemType) |
|
491 { |
|
492 case TVIMPSTEnums::EOwnStatusItem: |
|
493 case TVIMPSTEnums::EInvalid: // this case comes when no matched found for findpane characters |
|
494 { |
|
495 break; |
|
496 } |
|
497 case TVIMPSTEnums::EContactItem: |
|
498 { |
|
499 //conversation related menu |
|
500 MVIMPSTStorageServiceView* storage = |
|
501 CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId); |
|
502 TBool localstore = EFalse; |
|
503 if (storage) |
|
504 { |
|
505 localstore = storage->IsLocalStore(); |
|
506 } |
|
507 if (TVIMPSTEnums::ESVCERegistered == serviceTabState) |
|
508 { |
|
509 TPtrC selectedItem = iCommandHandler.GetProcessInterface(). |
|
510 GetItemUserId(itemIndex); |
|
511 if( selectedItem != KNullDesC ) |
|
512 { |
|
513 if (imService) |
|
514 { |
|
515 if ( iCommandHandler.GetProcessInterface().IsConversationExist( itemIndex ) ) |
|
516 { |
|
517 aMenuPane->SetItemDimmed(ECmdCloseConversation, EFalse); |
|
518 aMenuPane->SetItemDimmed(ECmdOpenConversation, ETrue); |
|
519 } |
|
520 else |
|
521 { |
|
522 aMenuPane->SetItemDimmed(ECmdOpenConversation, EFalse); |
|
523 } |
|
524 } |
|
525 } |
|
526 if(voipService) |
|
527 { |
|
528 TInt index; |
|
529 aMenuPane->MenuItemExists(KAiwCmdCall, index); |
|
530 aMenuPane->SetItemDimmed(KAiwCmdCall, EFalse); |
|
531 |
|
532 CAiwDialDataExt* dialDataExt = CAiwDialDataExt::NewL(); |
|
533 CleanupStack::PushL( dialDataExt ); |
|
534 dialDataExt->SetServiceId( iServiceId ); |
|
535 ReInitializeServiceHandlerL(); |
|
536 CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
537 dialDataExt->FillInParamListL( paramList ); |
|
538 TAiwVariant variant; |
|
539 TAiwGenericParam param ( EGenericParamSIPAddress, variant ); |
|
540 paramList.AppendL( param ); |
|
541 iServiceHandler->InitializeMenuPaneL( *aMenuPane, |
|
542 R_SERVTAB_TABBED_VIEW_MENU, |
|
543 // Must not overlap with the other menu ids! |
|
544 ECmdAIWRangeStart, |
|
545 paramList ); |
|
546 |
|
547 CleanupStack::PopAndDestroy( dialDataExt ); |
|
548 |
|
549 CEikMenuPaneItem::SData& data = aMenuPane->ItemDataByIndexL(index); |
|
550 //add to AIW command map of the menuextension manager |
|
551 iMenuExtension.AddToAIWCommandMap(KAiwCmdCall,data.iCommandId); |
|
552 } |
|
553 |
|
554 aMenuPane->SetItemDimmed(ECmdContactDetails, EFalse); |
|
555 |
|
556 if (localstore) |
|
557 { |
|
558 //ContactEdit is enabled only for localstore |
|
559 aMenuPane->SetItemDimmed(ECmdContactEdit, EFalse); |
|
560 } |
|
561 if(iEngine.IsBlockSupportedL()) |
|
562 { |
|
563 TVIMPSTEnums::TOnlineStatus status = iCommandHandler.GetProcessInterface().GetOnlineStatusL(itemIndex); |
|
564 if(TVIMPSTEnums::EBlocked == status ) |
|
565 { |
|
566 aMenuPane->SetItemDimmed(ECmdUnBlock, EFalse); |
|
567 } |
|
568 else if( selectedItem .Length() ) |
|
569 { |
|
570 aMenuPane->SetItemDimmed(ECmdBlock, EFalse); |
|
571 } |
|
572 } |
|
573 aMenuPane->SetItemDimmed(ECmdContactDelete, EFalse); |
|
574 |
|
575 |
|
576 if (!localstore) |
|
577 { |
|
578 aMenuPane->SetItemDimmed(ECmdAIWAddToContact, EFalse); |
|
579 aMenuPane->SetItemDimmed(ECmdAIWLinkToContact, EFalse); |
|
580 } |
|
581 } |
|
582 else if (TVIMPSTEnums::ESVCENotRegistered == serviceTabState) |
|
583 { |
|
584 if(!presenceService) |
|
585 { |
|
586 if (localstore) |
|
587 { |
|
588 //ContactEdit is enabled only for localstore |
|
589 aMenuPane->SetItemDimmed(ECmdContactEdit, EFalse); |
|
590 } |
|
591 } |
|
592 } |
|
593 |
|
594 break; |
|
595 } |
|
596 case TVIMPSTEnums::EUnknonContactItem : |
|
597 { |
|
598 aMenuPane->SetItemDimmed(ECmdContactAddAsFriend, EFalse); |
|
599 aMenuPane->SetItemDimmed(ECmdContactDetails, ETrue); |
|
600 aMenuPane->SetItemDimmed(ECmdOpenFriendRequest, ETrue); |
|
601 aMenuPane->SetItemDimmed(ECmdContactEdit, ETrue); |
|
602 aMenuPane->SetItemDimmed(ECmdAIWAddToContact, ETrue); |
|
603 aMenuPane->SetItemDimmed(ECmdAIWLinkToContact, ETrue); |
|
604 aMenuPane->SetItemDimmed(ECmdBlock, ETrue); |
|
605 aMenuPane->SetItemDimmed(ECmdUnBlock, ETrue); |
|
606 aMenuPane->SetItemDimmed(ECmdContactDelete, ETrue); |
|
607 if( iEngine.IsBlockSupportedL() ) |
|
608 { |
|
609 aMenuPane->SetItemDimmed(ECmdBlock, EFalse); |
|
610 } |
|
611 if (imService) |
|
612 { |
|
613 if (iCommandHandler.GetProcessInterface().IsConversationExist( itemIndex )) |
|
614 { |
|
615 aMenuPane->SetItemDimmed(ECmdCloseConversation, EFalse); |
|
616 aMenuPane->SetItemDimmed(ECmdOpenConversation, ETrue); |
|
617 } |
|
618 else |
|
619 { |
|
620 aMenuPane->SetItemDimmed(ECmdOpenConversation, EFalse); |
|
621 } |
|
622 } |
|
623 if(voipService) |
|
624 { |
|
625 TInt index; |
|
626 aMenuPane->MenuItemExists(KAiwCmdCall, index); |
|
627 |
|
628 aMenuPane->SetItemDimmed(KAiwCmdCall, EFalse); |
|
629 |
|
630 CAiwDialDataExt* dialDataExt = CAiwDialDataExt::NewL(); |
|
631 CleanupStack::PushL( dialDataExt ); |
|
632 dialDataExt->SetServiceId( iServiceId ); |
|
633 ReInitializeServiceHandlerL(); |
|
634 CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
635 dialDataExt->FillInParamListL( paramList ); |
|
636 TAiwVariant variant; |
|
637 TAiwGenericParam param ( EGenericParamSIPAddress, variant ); |
|
638 paramList.AppendL( param ); |
|
639 iServiceHandler->InitializeMenuPaneL( *aMenuPane, |
|
640 R_SERVTAB_TABBED_VIEW_MENU, |
|
641 // Must not overlap with the other menu ids! |
|
642 ECmdAIWRangeStart, |
|
643 paramList ); |
|
644 CleanupStack::PopAndDestroy( dialDataExt ); |
|
645 |
|
646 CEikMenuPaneItem::SData& data = aMenuPane->ItemDataByIndexL(index); |
|
647 //add to AIW command map of the menuextension manager |
|
648 iMenuExtension.AddToAIWCommandMap(KAiwCmdCall,data.iCommandId); |
|
649 |
|
650 } |
|
651 break; |
|
652 } |
|
653 case TVIMPSTEnums::EFriendRequestItem: |
|
654 { |
|
655 aMenuPane->SetItemDimmed(ECmdContactDetails, ETrue); |
|
656 aMenuPane->SetItemDimmed(ECmdContactEdit, ETrue); |
|
657 aMenuPane->SetItemDimmed(ECmdAIWAddToContact, ETrue); |
|
658 aMenuPane->SetItemDimmed(ECmdAIWLinkToContact, ETrue); |
|
659 aMenuPane->SetItemDimmed(ECmdBlock, ETrue); |
|
660 aMenuPane->SetItemDimmed(ECmdUnBlock, ETrue); |
|
661 aMenuPane->SetItemDimmed(ECmdContactDelete, ETrue); |
|
662 aMenuPane->SetItemDimmed(ECmdOpenFriendRequest, EFalse); |
|
663 if(iEngine.IsBlockSupportedL()) |
|
664 { |
|
665 aMenuPane->SetItemDimmed(ECmdBlock, EFalse); |
|
666 } |
|
667 break; |
|
668 } |
|
669 default: |
|
670 { |
|
671 break; |
|
672 } |
|
673 } |
|
674 // append the servicetab options(R_TABBED_VIEW_OPTIONS_MENU) and tabbed |
|
675 // viem(R_SERVTAB_TABBED_VIEW_MENU) menu items and the the service |
|
676 // specific options and then settings,help and exit.(R_TABBED_VIEW_GENERAL_MENU) |
|
677 iMenuExtension.OfferMenuPaneToPlugins(ECmdCancelLogin,*aMenuPane,iServiceId); |
|
678 |
|
679 break; |
|
680 } |
|
681 |
|
682 case R_SERVTAB_CREATENEW_OPTION_SUBMENU: |
|
683 { |
|
684 |
|
685 aMenuPane->SetItemDimmed(ECmdAddContact, ETrue); |
|
686 aMenuPane->SetItemDimmed(ECmdAddFromPhoneBook, ETrue); |
|
687 aMenuPane->SetItemDimmed(ECmdSearch, ETrue); |
|
688 |
|
689 if (TVIMPSTEnums::ESVCERegistered == serviceTabState) |
|
690 { |
|
691 aMenuPane->SetItemDimmed(ECmdAddContact, EFalse); |
|
692 aMenuPane->SetItemDimmed(ECmdAddFromPhoneBook, EFalse); |
|
693 |
|
694 //make search request using search manager in engine |
|
695 MVIMPSTEngineExtentionFeatures* feature = |
|
696 iEngine.ExtentionFeatures(TVIMPSTEnums::ESearch); |
|
697 |
|
698 if (feature) |
|
699 { |
|
700 if ( TVIMPSTEnums::ESupported == feature->IsSupported() ) |
|
701 { |
|
702 aMenuPane->SetItemDimmed(ECmdSearch, EFalse);//show if search is supported. |
|
703 } |
|
704 } |
|
705 } |
|
706 break; |
|
707 } |
|
708 |
|
709 case R_SERVTAB_CHANGEAVATAR_SUBMENU: |
|
710 { |
|
711 if ((TVIMPSTEnums::ESVCERegistered != serviceTabState) || |
|
712 (!presenceService)) |
|
713 { |
|
714 aMenuPane->SetItemDimmed(ECmdAvatarGallery, ETrue); |
|
715 aMenuPane->SetItemDimmed(ECmdAvatarNewPhoto, ETrue); |
|
716 aMenuPane->SetItemDimmed(ECmdDefaultAvatar, ETrue); |
|
717 } |
|
718 break; |
|
719 } |
|
720 |
|
721 case R_TABBED_VIEW_GENERAL_MENU: |
|
722 { |
|
723 switch (serviceTabState) |
|
724 { |
|
725 case TVIMPSTEnums::ESVCENotRegistered: |
|
726 { |
|
727 aMenuPane->SetItemDimmed(ECmdLogout, ETrue); |
|
728 aMenuPane->SetItemDimmed(ECmdCancelLogin, ETrue); |
|
729 aMenuPane->SetItemDimmed(ECmdGetBlockedList, ETrue); |
|
730 break; |
|
731 } |
|
732 case TVIMPSTEnums::ESVCERegistered: |
|
733 { |
|
734 aMenuPane->SetItemDimmed(ECmdLogin, ETrue); |
|
735 aMenuPane->SetItemDimmed(ECmdCancelLogin, ETrue); |
|
736 break; |
|
737 } |
|
738 case TVIMPSTEnums::ESVCENetworkConnecting: |
|
739 { |
|
740 aMenuPane->SetItemDimmed(ECmdLogin, ETrue); |
|
741 aMenuPane->SetItemDimmed(ECmdGetBlockedList, ETrue); |
|
742 aMenuPane->SetItemDimmed(ECmdLogout, ETrue); |
|
743 aMenuPane->SetItemDimmed(ECmdSettings, ETrue); |
|
744 if( !CancelLoginSupportedL()) |
|
745 { |
|
746 aMenuPane->SetItemDimmed(ECmdCancelLogin, ETrue); |
|
747 } |
|
748 break; |
|
749 } |
|
750 case TVIMPSTEnums::ESVCEWaitingForNetwork: |
|
751 case TVIMPSTEnums::ESVCEUpdatingContacts: |
|
752 { |
|
753 aMenuPane->SetItemDimmed(ECmdLogin, ETrue); |
|
754 aMenuPane->SetItemDimmed(ECmdCancelLogin, ETrue); |
|
755 aMenuPane->SetItemDimmed(ECmdGetBlockedList, ETrue); |
|
756 break; |
|
757 } |
|
758 case TVIMPSTEnums::ESVCENetworkDisConnecting: |
|
759 { |
|
760 aMenuPane->SetItemDimmed(ECmdLogin, ETrue); |
|
761 aMenuPane->SetItemDimmed(ECmdCancelLogin, ETrue); |
|
762 aMenuPane->SetItemDimmed(ECmdSettings, ETrue); |
|
763 aMenuPane->SetItemDimmed(ECmdGetBlockedList, ETrue); |
|
764 aMenuPane->SetItemDimmed(ECmdLogout, ETrue); |
|
765 break; |
|
766 } |
|
767 default: |
|
768 { |
|
769 break; |
|
770 } |
|
771 |
|
772 |
|
773 } |
|
774 break; |
|
775 } |
|
776 } |
|
777 |
|
778 } |
|
779 |
|
780 // -------------------------------------------------------------------------- |
|
781 // CVIMPSTUiTabbedView::HandleCommandL |
|
782 // -------------------------------------------------------------------------- |
|
783 // |
|
784 void CVIMPSTUiTabbedView::HandleCommandL(TInt aCommand) |
|
785 { |
|
786 //offer to extensions first, then to aiw. |
|
787 if(iMenuExtension.OfferHandleCommandToPlugins(aCommand)) |
|
788 { |
|
789 //command is executed, hence return. |
|
790 return; |
|
791 } |
|
792 ReInitializeServiceHandlerL(); |
|
793 if ( iServiceHandler ) |
|
794 { |
|
795 TInt serviceCommandId =iServiceHandler->ServiceCmdByMenuCmd(aCommand); |
|
796 |
|
797 if ( iContainer && serviceCommandId == KAiwCmdCall ) |
|
798 { |
|
799 MakeVoipCallL(); |
|
800 return; |
|
801 } |
|
802 } |
|
803 if( iContainer ) |
|
804 { |
|
805 iContainer->SetClrFindPaneFlag(ETrue); |
|
806 } |
|
807 |
|
808 switch (aCommand) |
|
809 { |
|
810 case ECmdLogin: |
|
811 { |
|
812 LoginL(); |
|
813 break; |
|
814 } |
|
815 case ECmdSearch: |
|
816 { |
|
817 SearchContactsL(); |
|
818 break; |
|
819 } |
|
820 case ECmdAddFromPhoneBook: |
|
821 { |
|
822 |
|
823 LaunchFetchDialogL(); |
|
824 break; |
|
825 } |
|
826 case EAknCmdHelp: |
|
827 { |
|
828 TBool imSupported = iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EIM); |
|
829 TBool voipSupported = iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EVoip); |
|
830 if ( imSupported ) |
|
831 { |
|
832 if ( voipSupported ) |
|
833 { // both Im and VOIP are enabled |
|
834 LaunchHelpL( KSERVTAB_HLP_MAIN_VIEW_VOIPIM ); |
|
835 } |
|
836 else |
|
837 {// only IM is enabled |
|
838 LaunchHelpL( KSERVTAB_HLP_MAIN_VIEW_IM ); |
|
839 } |
|
840 } |
|
841 else if ( voipSupported ) |
|
842 { // only VOIP is enabled |
|
843 LaunchHelpL( KSERVTAB_HLP_MAIN_VIEW_VOIP ); |
|
844 } |
|
845 |
|
846 break; |
|
847 } |
|
848 case EAknCmdExit: |
|
849 case EAknSoftkeyExit: |
|
850 { |
|
851 //exit from phone book. |
|
852 Pbk2AppUi()->HandleCommandL( EAknSoftkeyExit ); |
|
853 |
|
854 break; |
|
855 } |
|
856 case ECmdSettings: |
|
857 { |
|
858 LaunchSettingsViewL(); |
|
859 break; |
|
860 } |
|
861 |
|
862 case ECmdLogout: |
|
863 { |
|
864 // this is for actual network logout |
|
865 iCommandHandler.HandleCommandL(ELogoutService, this, &iServiceId); |
|
866 break; |
|
867 } |
|
868 |
|
869 case ECmdContactDetails: |
|
870 { |
|
871 TInt index = KErrNotFound; |
|
872 if (iContainer) |
|
873 { |
|
874 index = iContainer->CurrentItemIndex(); |
|
875 } |
|
876 if(KErrNotFound != index) |
|
877 { |
|
878 TLaunchCCAData data; |
|
879 data.iIndex = index; |
|
880 iConnection = TCCAFactory::NewConnectionL(); |
|
881 data.iConnection = iConnection; |
|
882 iCommandHandler.HandleCommandL(ELaunchCCA, this, &data ); |
|
883 } |
|
884 break; |
|
885 } |
|
886 case ECmdOpenConversation: |
|
887 { |
|
888 if( iContainer ) |
|
889 { |
|
890 iContainer->SendMessageL(); |
|
891 } |
|
892 |
|
893 break; |
|
894 } |
|
895 |
|
896 case ECmdAddContact: |
|
897 { |
|
898 AddContactL( R_IM_ADD_CONTACT_MANUAL_QUERY ); |
|
899 break; |
|
900 } |
|
901 |
|
902 case ECmdContactEdit: |
|
903 { |
|
904 EditContactL(); |
|
905 break; |
|
906 } |
|
907 case ECmdContactDelete: |
|
908 { |
|
909 if( iContainer ) |
|
910 { |
|
911 iContainer->SetClrFindPaneFlag(EFalse); |
|
912 } |
|
913 DeleteContactL(); |
|
914 break; |
|
915 } |
|
916 case ECmdChangeStatus: |
|
917 { |
|
918 ChangeStatusProcessL(); |
|
919 break; |
|
920 } |
|
921 case ECmdCancelLogin: |
|
922 { |
|
923 iCommandHandler.HandleCommandL( ECancelLogin , this , NULL ); |
|
924 break; |
|
925 } |
|
926 |
|
927 case ECmdOpenFriendRequest: |
|
928 { |
|
929 ProcessFriendRequestL(); |
|
930 break; |
|
931 } |
|
932 |
|
933 case ECmdAvatarGallery: |
|
934 case ECmdAvatarNewPhoto: |
|
935 { |
|
936 CAvatarSelectionHandler* avatarHandler = CAvatarSelectionHandler::NewLC(); |
|
937 HBufC* avatarFile = avatarHandler->HandleAvatarSelectionL( aCommand ); |
|
938 if( avatarFile ) // if user selected the image |
|
939 { |
|
940 CleanupStack::PushL( avatarFile ); |
|
941 if(iWaitNote) |
|
942 { |
|
943 delete iWaitNote; |
|
944 iWaitNote = NULL; |
|
945 } |
|
946 iWaitNote = CVIMPSTUtilsWaitNote::ShowWaitNoteL( R_QTN_SERVTAB_CHANGE_AVATAR_CHANGING, EFalse , ETrue ); |
|
947 ChangeOwnAvatarL( *avatarFile , avatarHandler->MimeTypeL() ); |
|
948 CleanupStack::PopAndDestroy(); //avatarFile |
|
949 } |
|
950 CleanupStack::PopAndDestroy(); // avatarHandler |
|
951 break; |
|
952 } |
|
953 case ECmdDefaultAvatar: |
|
954 { |
|
955 ChangeOwnAvatarL( KNullDesC , KNullDesC8 ); |
|
956 break; |
|
957 } |
|
958 |
|
959 case ECmdCloseConversation: |
|
960 { |
|
961 CloseConversationL(); |
|
962 break; |
|
963 } |
|
964 case ECmdChangeConnectioninWaitingState: |
|
965 case ECmdChangeConnectioninOnlineState: |
|
966 { |
|
967 iEngine.ChangeConnectionL(); |
|
968 break; |
|
969 } |
|
970 case ECmdBlock: |
|
971 { |
|
972 if( iContainer ) |
|
973 { |
|
974 iContainer->SetClrFindPaneFlag(EFalse); |
|
975 } |
|
976 BlockContactL(ETrue); |
|
977 break; |
|
978 } |
|
979 case ECmdUnBlock: |
|
980 { |
|
981 if( iContainer ) |
|
982 { |
|
983 iContainer->SetClrFindPaneFlag(EFalse); |
|
984 } |
|
985 BlockContactL(); |
|
986 break; |
|
987 } |
|
988 case ECmdGetBlockedList: |
|
989 { |
|
990 ShowBlockedContactListL(); |
|
991 break; |
|
992 } |
|
993 case ECmdAIWAddToContact: |
|
994 case ECmdAIWLinkToContact: |
|
995 { |
|
996 CreateOrLinkToPhoneBookL(aCommand); |
|
997 break; |
|
998 } |
|
999 case ECmdContactAddAsFriend: |
|
1000 { |
|
1001 TInt index = KErrNotFound; |
|
1002 if (iContainer) |
|
1003 { |
|
1004 index = iContainer->CurrentItemIndex(); |
|
1005 } |
|
1006 MVIMPSTProcessArray& arrayprocess = iCommandHandler.GetProcessInterface(); |
|
1007 TVIMPSTEnums::TItem itemType = arrayprocess.GetType( index ); |
|
1008 if( itemType == TVIMPSTEnums::EUnknonContactItem ) |
|
1009 { |
|
1010 TPtrC userId = arrayprocess.GetItemUserId( index ); |
|
1011 AddContactL( R_IM_ADD_CONTACT_MANUAL_QUERY , userId ); |
|
1012 } |
|
1013 break; |
|
1014 } |
|
1015 case EAknCmdHideInBackground: |
|
1016 { |
|
1017 //in case of EAknCmdHideInBackground phonebook be in |
|
1018 //background and all the child application should close |
|
1019 |
|
1020 if(iConnection)// close connection to close cca |
|
1021 { |
|
1022 iConnection->Close(); |
|
1023 iConnection = NULL; |
|
1024 } |
|
1025 if (iServiceHandler)//reset selectionhandler so that it closes all the phonebook forms if open |
|
1026 { |
|
1027 iServiceHandler->Reset(); |
|
1028 iIsServiceHandleReSet = ETrue; |
|
1029 } |
|
1030 |
|
1031 Pbk2AppUi()->HandleCommandL( aCommand ); |
|
1032 |
|
1033 break; |
|
1034 } |
|
1035 default: |
|
1036 { |
|
1037 Pbk2AppUi()->HandleCommandL( aCommand ); |
|
1038 break; |
|
1039 } |
|
1040 } |
|
1041 } |
|
1042 |
|
1043 |
|
1044 |
|
1045 // -------------------------------------------------------------------------- |
|
1046 // CVIMPSTUiTabbedView::DoActivateViewL |
|
1047 // -------------------------------------------------------------------------- |
|
1048 // |
|
1049 void CVIMPSTUiTabbedView::DoActivateViewL( const TVwsViewId& aPrevViewId, |
|
1050 TUid /*aCustomMessageId*/, |
|
1051 const TDesC8& aCustomMessage) |
|
1052 { |
|
1053 // When ST is launched from widget or universal indicator plugin |
|
1054 // user clicks twice continuously, then DoActivateL is called |
|
1055 // twice, as iContainer is NULL since construction is not complete |
|
1056 // then it creates two controls (containers), hence to avoid this |
|
1057 // situation, we are checking if construction of iContainer has |
|
1058 // started, then we ignore DoActivateL second time. |
|
1059 MPbk2ViewActivationTransaction* viewActivationTransaction = |
|
1060 Pbk2AppUi()->Pbk2ViewExplorer()->HandleViewActivationLC( |
|
1061 iView.Id(), |
|
1062 aPrevViewId, |
|
1063 &iEngine.ServiceName(), |
|
1064 NULL, |
|
1065 EUpdateAll ); |
|
1066 |
|
1067 // Notifies startup monitor of view activation |
|
1068 if( Pbk2AppUi()->Pbk2StartupMonitor() ) |
|
1069 { |
|
1070 Pbk2AppUi()->Pbk2StartupMonitor()-> |
|
1071 NotifyViewActivationL( iView.Id() ); |
|
1072 } |
|
1073 |
|
1074 if (iEngine.IsUnInstalled()) |
|
1075 { |
|
1076 // engine is uninstalled, disable left softkey i.e options and provide only exit. |
|
1077 iView.Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_EXIT); |
|
1078 } |
|
1079 else |
|
1080 { |
|
1081 // engine is constructed completely, provide tabbed view softkeys. |
|
1082 iView.Cba()->SetCommandSetL(R_IM_CONTACTS_TABBED_VIEW_SOFTKEYS); |
|
1083 } |
|
1084 |
|
1085 |
|
1086 ReadAndSetOwnUserIdL(); |
|
1087 |
|
1088 if (!iContainer&& !iContainerCreationStarted) |
|
1089 { |
|
1090 iContainerCreationStarted = ETrue; |
|
1091 iContainer = MVIMPSTUiTabbedViewControlFactory::NewTabControlL(*this, |
|
1092 &iView,iCommandHandler, iServiceId, |
|
1093 *iBrandHandler, iEngine, iView.Cba()); |
|
1094 // take the control pointer |
|
1095 CCoeControl* cCoeControl = iContainer->CoeControl(); |
|
1096 iAppUi->AddToStackL( iView, cCoeControl ); |
|
1097 cCoeControl->SetMopParent( &iView ); |
|
1098 cCoeControl->SetRect( iView.ClientRect() ); |
|
1099 cCoeControl->ActivateL(); |
|
1100 } |
|
1101 iStatusPaneHandler->SetTextL( iEngine.ServiceName() ); |
|
1102 // Commit application-wide state changes |
|
1103 viewActivationTransaction->Commit(); |
|
1104 CleanupStack::PopAndDestroy(); //viewActivationTransaction |
|
1105 |
|
1106 //CreateToolBarL(); |
|
1107 |
|
1108 if(TVIMPSTEnums::ESVCERegistered == iEngine.ServiceState()) |
|
1109 { |
|
1110 if(iIsToolBarHidden) |
|
1111 { |
|
1112 ShowHideFixedToolbarL(ETrue); |
|
1113 } |
|
1114 } |
|
1115 else |
|
1116 { |
|
1117 if(!iIsToolBarHidden) |
|
1118 { |
|
1119 ShowHideFixedToolbarL(EFalse); |
|
1120 } |
|
1121 } |
|
1122 |
|
1123 if(iContainer && iFocussedIDHistory ) |
|
1124 { |
|
1125 iContainer->SetFocussedId( iFocussedIDHistory->Des() ); |
|
1126 } |
|
1127 |
|
1128 /* |
|
1129 * aCustomMessage has following format if it is coming from Service Widget |
|
1130 * when you click on widget |
|
1131 * we need to unpack data in similar format |
|
1132 * version number --> stream.WriteInt8L(1); |
|
1133 * EEnd --> stream.WriteInt8L( 0 ); |
|
1134 * Service Id --> stream.WriteInt32L( iServiceId ); |
|
1135 * |
|
1136 * If function call is coming from other than service widget then |
|
1137 * aCustomMessage will not have data in above format |
|
1138 */ |
|
1139 |
|
1140 if(aCustomMessage.Length()) |
|
1141 { |
|
1142 RDesReadStream stream( aCustomMessage); |
|
1143 stream.PushL(); |
|
1144 TInt serviceId = KErrNotFound; |
|
1145 TRAP_IGNORE( const TUint versionNumber = stream.ReadUint8L(); //equal to 1 |
|
1146 TInt type = stream.ReadInt8L(); // equal to eend |
|
1147 serviceId = stream.ReadInt32L(); ); |
|
1148 CleanupStack::PopAndDestroy();//stream |
|
1149 if( serviceId == iServiceId ) |
|
1150 { |
|
1151 // this case will get excuted only when there is |
|
1152 // fresh login from service widget for first time only |
|
1153 // uid has been taken for autologin |
|
1154 // if the service id is matches to aCustomMessage |
|
1155 // it is auto login ,called from service widget |
|
1156 // start the login procedure |
|
1157 LoginL(); |
|
1158 } |
|
1159 } |
|
1160 UpdateToolbarL(); |
|
1161 } |
|
1162 |
|
1163 // -------------------------------------------------------------------------- |
|
1164 // CVIMPSTUiTabbedView::DoDeactivate |
|
1165 // -------------------------------------------------------------------------- |
|
1166 // |
|
1167 void CVIMPSTUiTabbedView::DoDeactivate() |
|
1168 { |
|
1169 |
|
1170 if(iFixedToolbar) |
|
1171 { |
|
1172 iIsToolBarHidden = ETrue; |
|
1173 delete iFixedToolbar; |
|
1174 iFixedToolbar = NULL; |
|
1175 } |
|
1176 |
|
1177 if (iContainer) |
|
1178 { |
|
1179 delete iFocussedIDHistory; |
|
1180 iFocussedIDHistory = NULL; |
|
1181 TRAP_IGNORE( iFocussedIDHistory = iContainer->GetFocussedId().AllocL() ); |
|
1182 iAppUi->RemoveFromStack( iContainer->CoeControl() ); |
|
1183 delete iContainer; |
|
1184 iContainer = NULL; |
|
1185 iContainerCreationStarted = EFalse; |
|
1186 } |
|
1187 } |
|
1188 |
|
1189 // -------------------------------------------------------------------------- |
|
1190 // CVIMPSTUiTabbedView::HandleForegroundEventL |
|
1191 // -------------------------------------------------------------------------- |
|
1192 // |
|
1193 TAny* CVIMPSTUiTabbedView::UIExtensionViewExtension( |
|
1194 TUid aExtensionUid ) |
|
1195 { |
|
1196 if (aExtensionUid == KMPbk2UIExtensionView2Uid) |
|
1197 { |
|
1198 return static_cast<MPbk2UIExtensionView2*>(this); |
|
1199 } |
|
1200 return NULL; |
|
1201 } |
|
1202 // -------------------------------------------------------------------------- |
|
1203 // CVIMPSTUiTabbedView::HandleForegroundEventL |
|
1204 // -------------------------------------------------------------------------- |
|
1205 // |
|
1206 |
|
1207 void CVIMPSTUiTabbedView::HandleForegroundEventL(TBool aForeground) |
|
1208 { |
|
1209 if( aForeground && TVIMPSTEnums::ESVCENotRegistered == iEngine.ServiceState() ) |
|
1210 { |
|
1211 // user might has changed the setting read the new and refresh the view |
|
1212 // user can change setting in offline only |
|
1213 ReadAndSetOwnUserIdL(); |
|
1214 } |
|
1215 } |
|
1216 |
|
1217 // -------------------------------------------------------------------------- |
|
1218 // CVIMPSTUiTabbedView::HandleCommandKeyL |
|
1219 // -------------------------------------------------------------------------- |
|
1220 // |
|
1221 TBool CVIMPSTUiTabbedView::HandleCommandKeyL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/) |
|
1222 { |
|
1223 TBool result = EFalse; |
|
1224 switch (aKeyEvent.iCode) |
|
1225 { |
|
1226 default: |
|
1227 { |
|
1228 break; |
|
1229 } |
|
1230 } |
|
1231 return result; |
|
1232 } |
|
1233 |
|
1234 // -------------------------------------------------------------------------- |
|
1235 // CVIMPSTUiTabbedView::HandleStatusPaneSizeChange |
|
1236 // -------------------------------------------------------------------------- |
|
1237 // |
|
1238 void CVIMPSTUiTabbedView::HandleStatusPaneSizeChange() |
|
1239 { |
|
1240 // Resize the container to fill the client rectangle |
|
1241 if (iContainer) |
|
1242 { |
|
1243 iContainer->CoeControl()->SetRect( iView.ClientRect() ); |
|
1244 } |
|
1245 } |
|
1246 |
|
1247 // -------------------------------------------------------------------------- |
|
1248 // CVIMPSTUiTabbedView::CommandHandlerL |
|
1249 // -------------------------------------------------------------------------- |
|
1250 // |
|
1251 MVIMPSTCmdHandler& CVIMPSTUiTabbedView::CommandHandlerL() |
|
1252 { |
|
1253 return iCommandHandler; |
|
1254 } |
|
1255 |
|
1256 |
|
1257 // -------------------------------------------------------------------------- |
|
1258 // CVIMPSTUiTabbedView::CommandFinishedL |
|
1259 // -------------------------------------------------------------------------- |
|
1260 // |
|
1261 |
|
1262 void CVIMPSTUiTabbedView::CommandFinishedL( |
|
1263 const MVIMPSTCmd& aCommand ) |
|
1264 { |
|
1265 TRACER_AUTO; |
|
1266 //handle the observer for commands issues thro HandleCommandL() |
|
1267 |
|
1268 switch (aCommand.CommandId()) |
|
1269 { |
|
1270 case ELoginService: |
|
1271 { |
|
1272 //login command is complete |
|
1273 //use aCommand.Result() to get the data |
|
1274 //Ownership is not given to the caller |
|
1275 break; |
|
1276 } |
|
1277 case ELogoutService: |
|
1278 { |
|
1279 //logout command is complete |
|
1280 //use aCommand.Result() to get the data |
|
1281 //Ownership is not given to the caller |
|
1282 break; |
|
1283 } |
|
1284 case ECmdProcessAcceptedContactNew: // accept create new |
|
1285 case ECmdProcessAcceptedContactExist: // update existing |
|
1286 case ECmdProcessSelectedContactNew: |
|
1287 case ECmdProcessSelectedContactExist:// add from phonebook |
|
1288 case EAddContact: |
|
1289 { |
|
1290 //addcontact command is complete |
|
1291 //use aCommand.Result() to get the data |
|
1292 //Ownership is not given to the caller |
|
1293 //some error occured. |
|
1294 if (iWaitNote) |
|
1295 { |
|
1296 delete iWaitNote; |
|
1297 iWaitNote = NULL; |
|
1298 } |
|
1299 if(aCommand.Result() != KErrNone) |
|
1300 { |
|
1301 ShowErrorNoteL( aCommand.Result() ); |
|
1302 } |
|
1303 break; |
|
1304 } |
|
1305 case EDeleteContact: |
|
1306 { |
|
1307 //addcontact command is complete |
|
1308 //use aCommand.Result() to get the data |
|
1309 //Ownership is not given to the caller |
|
1310 //some error occured. |
|
1311 if (iWaitNote) |
|
1312 { |
|
1313 delete iWaitNote; |
|
1314 iWaitNote = NULL; |
|
1315 } |
|
1316 if(aCommand.Result() != KErrNone) |
|
1317 { |
|
1318 HBufC* prompt = NULL; |
|
1319 prompt = StringLoader::LoadLC( R_IM_ERROR_SERVICE_ERR ); |
|
1320 TInt ret( VIMPSTUtilsDialog::DisplayErrorNoteL( *prompt ) ); |
|
1321 CleanupStack::PopAndDestroy(prompt); |
|
1322 } |
|
1323 break; |
|
1324 } |
|
1325 case EChangeOwnStatus: |
|
1326 { |
|
1327 TInt error = aCommand.Result(); |
|
1328 if( KErrNone == error ) |
|
1329 { |
|
1330 // show confirmation note |
|
1331 HBufC* text = CEikonEnv::Static()->AllocReadResourceLC( R_QTN_CHAT_CHANGE_STATUS_CHANGED ); |
|
1332 CAknConfirmationNote* dlg = new( ELeave )CAknConfirmationNote(); |
|
1333 dlg->ExecuteLD( *text ); |
|
1334 CleanupStack::PopAndDestroy( text ); |
|
1335 //get the status from the engine and update in the ui. |
|
1336 if(iContainer) |
|
1337 { |
|
1338 iContainer->HandleItemAdditionL(); |
|
1339 } |
|
1340 |
|
1341 } |
|
1342 else if( KErrCancel == error ) |
|
1343 { |
|
1344 // user cancelled, status was not updated |
|
1345 HBufC* text = NULL; |
|
1346 text = StringLoader::LoadLC( R_QTN_IM_CHANGE_STATUS_NOT_CHANGED ); |
|
1347 VIMPSTUtilsDialog::DisplayNoteDialogL( *text ); |
|
1348 CleanupStack::PopAndDestroy(); //onlineText |
|
1349 } |
|
1350 else |
|
1351 { |
|
1352 // change status failed |
|
1353 HBufC* failed = StringLoader::LoadLC( R_QTN_CHAT_CHANGE_STATUS_FAILED ); |
|
1354 VIMPSTUtilsDialog::DisplayErrorNoteL( *failed ); |
|
1355 CleanupStack::PopAndDestroy( failed ); |
|
1356 } |
|
1357 break; |
|
1358 } |
|
1359 case EChangeOwnMessage: |
|
1360 { |
|
1361 TInt error = aCommand.Result(); |
|
1362 if( KErrNone == error ) |
|
1363 { |
|
1364 // show note qtn_chat_change_message_changing |
|
1365 HBufC* prompt = NULL; |
|
1366 prompt = StringLoader::LoadLC( R_QTN_CHAT_CHANGE_MESSAGE_CHANGED ); |
|
1367 VIMPSTUtilsDialog::DisplayNoteDialogL( *prompt); |
|
1368 CleanupStack::PopAndDestroy(prompt); |
|
1369 } |
|
1370 else if( KErrCancel == error) |
|
1371 { |
|
1372 HBufC* prompt = NULL; |
|
1373 prompt = StringLoader::LoadLC( R_QTN_IM_CHANGE_STATUS_NOT_CHANGED ); |
|
1374 VIMPSTUtilsDialog::DisplayNoteDialogL( *prompt); |
|
1375 CleanupStack::PopAndDestroy(prompt); |
|
1376 } |
|
1377 else |
|
1378 { |
|
1379 HBufC* prompt = NULL; |
|
1380 prompt = StringLoader::LoadLC( R_QTN_CHAT_CHANGE_MESSAGE_FAILED ); |
|
1381 VIMPSTUtilsDialog::DisplayNoteDialogL(*prompt ); |
|
1382 CleanupStack::PopAndDestroy(prompt); |
|
1383 } |
|
1384 |
|
1385 break; |
|
1386 } |
|
1387 case ESearch: |
|
1388 { |
|
1389 // Search command is complete |
|
1390 //use aCommand.Result() to get the data |
|
1391 if(iWaitNote) |
|
1392 { |
|
1393 delete iWaitNote; |
|
1394 iWaitNote = NULL; |
|
1395 } |
|
1396 if(aCommand.Result() != KErrNone) |
|
1397 { |
|
1398 HBufC* prompt = NULL; |
|
1399 prompt = StringLoader::LoadLC(R_QTN_CHAT_ERROR_NOT_SUP_FUNCTIONS ); |
|
1400 VIMPSTUtilsDialog::DisplayErrorNoteL( *prompt ) ; |
|
1401 CleanupStack::PopAndDestroy(prompt); |
|
1402 LaunchViewL(iExtensionService.TabbedViewId()); |
|
1403 } |
|
1404 } |
|
1405 case EFriendRejected: |
|
1406 case EFriendAccpeted: |
|
1407 { |
|
1408 if(iWaitNote) |
|
1409 { |
|
1410 delete iWaitNote; |
|
1411 iWaitNote = NULL; |
|
1412 } |
|
1413 if( ( aCommand.Result() != KErrNone ) && ( aCommand.CommandId() == EFriendAccpeted ) ) |
|
1414 { |
|
1415 HBufC* prompt = StringLoader::LoadLC( R_QTN_SERVTAB_SAVING_CONTACT_FAILED ); |
|
1416 VIMPSTUtilsDialog::DisplayErrorNoteL( *prompt ) ; |
|
1417 CleanupStack::PopAndDestroy(prompt); |
|
1418 } |
|
1419 break; |
|
1420 } |
|
1421 case EChangeOwnAvtar: |
|
1422 { |
|
1423 if(aCommand.Result() == KErrNone) // successfull show confirmation note |
|
1424 { |
|
1425 if(iWaitNote) |
|
1426 { |
|
1427 delete iWaitNote; |
|
1428 iWaitNote = NULL; |
|
1429 } |
|
1430 } |
|
1431 else // show error note |
|
1432 { |
|
1433 HBufC* prompt = StringLoader::LoadLC( R_QTN_SERVTAB_ERROR_UPDATE_AVATAR ); |
|
1434 VIMPSTUtilsDialog::DisplayErrorNoteL( *prompt ) ; |
|
1435 CleanupStack::PopAndDestroy(prompt); |
|
1436 } |
|
1437 break; |
|
1438 } |
|
1439 case ECmdBlockContact: |
|
1440 { |
|
1441 TRACE("block finished enter"); |
|
1442 //blockcontact command is complete |
|
1443 //use aCommand.Result() to get the data |
|
1444 //Ownership is not given to the caller |
|
1445 //some error occured. |
|
1446 if(iWaitNote) |
|
1447 { |
|
1448 delete iWaitNote; |
|
1449 iWaitNote = NULL; |
|
1450 } |
|
1451 if(aCommand.Result() != KErrNone) |
|
1452 { |
|
1453 TRACE( "aCommand result = %d ", aCommand.Result() ); |
|
1454 HBufC* prompt = NULL; |
|
1455 prompt = StringLoader::LoadLC( R_QTN_CHAT_BLOCKING_FAILED ); |
|
1456 TRACE("blocking error prompt displaying"); |
|
1457 TInt ret( VIMPSTUtilsDialog::DisplayErrorNoteL( *prompt ) ); |
|
1458 CleanupStack::PopAndDestroy(prompt); |
|
1459 } |
|
1460 break; |
|
1461 } |
|
1462 case ECmdUnBlockContact: |
|
1463 { |
|
1464 TRACE("unblock finished enter"); |
|
1465 |
|
1466 if(iWaitNote) |
|
1467 { |
|
1468 delete iWaitNote; |
|
1469 iWaitNote = NULL; |
|
1470 } |
|
1471 //unblockcontact command is complete |
|
1472 //use aCommand.Result() to get the data |
|
1473 //Ownership is not given to the caller |
|
1474 //some error occured. |
|
1475 if(aCommand.Result() != KErrNone) |
|
1476 { |
|
1477 TRACE( "aCommand result = %d ", aCommand.Result() ); |
|
1478 HBufC* prompt = NULL; |
|
1479 prompt = StringLoader::LoadLC( R_QTN_CHAT_UNBLOCKING_FAILED ); |
|
1480 TRACE("unblocking error prompt displaying"); |
|
1481 TInt ret( VIMPSTUtilsDialog::DisplayErrorNoteL( *prompt ) ); |
|
1482 CleanupStack::PopAndDestroy(prompt); |
|
1483 } |
|
1484 else |
|
1485 { |
|
1486 TRACE("unblocking successful"); |
|
1487 |
|
1488 if(iContainer) |
|
1489 { |
|
1490 TInt index = CurrentItemIndex(); |
|
1491 if( index > 0 ) |
|
1492 { |
|
1493 MVIMPSTProcessArray& arrayprocess = iCommandHandler.GetProcessInterface(); |
|
1494 HBufC* contactId = arrayprocess.GetItemUserId(index).AllocLC(); |
|
1495 if( contactId->Length() ) |
|
1496 { |
|
1497 TRACE("HandleAvatarRefreshl calling for unblock"); |
|
1498 iContainer->HandleAvatarRefreshL(*contactId,EFalse); |
|
1499 |
|
1500 } |
|
1501 } |
|
1502 CleanupStack::PopAndDestroy(); |
|
1503 } |
|
1504 } |
|
1505 break; |
|
1506 } |
|
1507 default: |
|
1508 { |
|
1509 //should never be here. |
|
1510 break; |
|
1511 } |
|
1512 } |
|
1513 } |
|
1514 |
|
1515 // -------------------------------------------------------------------------- |
|
1516 // CVIMPSTUiTabbedView::ShowErrorNoteL |
|
1517 // -------------------------------------------------------------------------- |
|
1518 void CVIMPSTUiTabbedView::ShowErrorNoteL(TInt aError ) |
|
1519 { |
|
1520 TRACER_AUTO; |
|
1521 HBufC* textResource = NULL; |
|
1522 switch( aError) |
|
1523 { |
|
1524 case EErrExistInBlockList: |
|
1525 { |
|
1526 textResource = StringLoader::LoadLC( R_QTN_SERVTAB_ADD_FRIEND_BLOCKED); |
|
1527 break; |
|
1528 } |
|
1529 case KErrAlreadyExists : |
|
1530 case EErrExistInContactList: |
|
1531 { |
|
1532 textResource = StringLoader::LoadLC( R_QTN_SERTAB_CONTACT_ALREADY_EXISTS_ERROR_NOTE); |
|
1533 break; |
|
1534 } |
|
1535 default : |
|
1536 { |
|
1537 textResource = StringLoader::LoadLC( R_QTN_SERVTAB_SAVING_CONTACT_FAILED ); |
|
1538 break; |
|
1539 } |
|
1540 } |
|
1541 if( textResource ) |
|
1542 { |
|
1543 CAknInformationNote* note = new ( ELeave ) CAknInformationNote; |
|
1544 note->ExecuteLD( *textResource ); |
|
1545 CleanupStack::PopAndDestroy( textResource ); |
|
1546 } |
|
1547 } |
|
1548 |
|
1549 // -------------------------------------------------------------------------- |
|
1550 // CVIMPSTUiTabbedView::HandleCommandEventL |
|
1551 // -------------------------------------------------------------------------- |
|
1552 // |
|
1553 void CVIMPSTUiTabbedView::HandleCommandEventL(TVIMPSTEnums::TVIMPSTRegistrationState aState, TInt /*aServiceError*/) |
|
1554 { |
|
1555 switch (aState) |
|
1556 { |
|
1557 case TVIMPSTEnums::ESVCERegistered: |
|
1558 { |
|
1559 // this is to make sure that it always has the user id |
|
1560 // some services they do not have the user id in offline case |
|
1561 // like skype ,get the user if service is logged in |
|
1562 if( !iUserId || iUserId->Length() == 0 ) |
|
1563 { |
|
1564 // read if user id is empty only |
|
1565 ReadAndSetOwnUserIdL(); |
|
1566 } |
|
1567 TInt isSuccessfulLogin = 0; |
|
1568 iSettingsStore->GetL(iServiceId, EServiceSuccessfullLogin, isSuccessfulLogin); |
|
1569 if(!isSuccessfulLogin) |
|
1570 { |
|
1571 isSuccessfulLogin = 1; |
|
1572 iSettingsStore->SetL(iServiceId, EServiceSuccessfullLogin, isSuccessfulLogin); |
|
1573 } |
|
1574 if(iIsToolBarHidden) |
|
1575 { |
|
1576 ShowHideFixedToolbarL(ETrue); |
|
1577 } |
|
1578 break; |
|
1579 } |
|
1580 case TVIMPSTEnums::ESVCENotRegistered: |
|
1581 { |
|
1582 // might user has choosen some diff user id while login |
|
1583 // set to store and engine etc |
|
1584 ReadAndSetOwnUserIdL(); |
|
1585 |
|
1586 // no need to hide the tool bar here as its already called while in the |
|
1587 // disconnecting state. |
|
1588 // assume in some cornere scenario, where network is lost, and the ui does not |
|
1589 // get a callback for disconnecting state then we need to call hidetoolbar in this case. |
|
1590 // hence the flag iIsToolBarHidden will set it when ever the tool bar is hidden |
|
1591 if(!iIsToolBarHidden) |
|
1592 { |
|
1593 ShowHideFixedToolbarL(EFalse); |
|
1594 } |
|
1595 break; |
|
1596 } |
|
1597 case TVIMPSTEnums::ESVCENetworkConnecting: |
|
1598 { |
|
1599 // might user has choosen some diff user id while login |
|
1600 // set to store and engine etc |
|
1601 ReadAndSetOwnUserIdL(); |
|
1602 break; |
|
1603 } |
|
1604 case TVIMPSTEnums::ESVCEWaitingForNetwork: |
|
1605 { |
|
1606 break; |
|
1607 } |
|
1608 case TVIMPSTEnums::ESVCENetworkDisConnecting: |
|
1609 { |
|
1610 if(!iIsToolBarHidden) |
|
1611 { |
|
1612 ShowHideFixedToolbarL(EFalse); |
|
1613 } |
|
1614 break; |
|
1615 } |
|
1616 case TVIMPSTEnums::ESVCEUpdatingContacts: |
|
1617 { |
|
1618 // might user has choosen some diff user id while login |
|
1619 // set to store and engine etc |
|
1620 // this is to make sure that it always has the user id |
|
1621 // some services they do not have the user id in offline case |
|
1622 // like skype ,get the user if service is logged in |
|
1623 if( !iUserId || iUserId->Length() == 0 ) |
|
1624 { |
|
1625 // read if user id is empty only |
|
1626 ReadAndSetOwnUserIdL(); |
|
1627 } |
|
1628 break; |
|
1629 } |
|
1630 default: |
|
1631 { |
|
1632 //should never be here. |
|
1633 break; |
|
1634 } |
|
1635 |
|
1636 } |
|
1637 if(iContainer) |
|
1638 { |
|
1639 iContainer->HandleItemAdditionL(); |
|
1640 } |
|
1641 |
|
1642 } |
|
1643 |
|
1644 // -------------------------------------------------------------------------- |
|
1645 // CVIMPSTUiTabbedView::CurrentItemIndex |
|
1646 // -------------------------------------------------------------------------- |
|
1647 // |
|
1648 TInt CVIMPSTUiTabbedView:: CurrentItemIndex() |
|
1649 { |
|
1650 TInt index = KErrNone; |
|
1651 iContainer?(index = iContainer->CurrentItemIndex()):(index = KErrNotFound); |
|
1652 return index; |
|
1653 } |
|
1654 |
|
1655 |
|
1656 // -------------------------------------------------------------------------- |
|
1657 // CVIMPSTUiTabbedView::ReadAndSetOwnUserIdL() |
|
1658 // -------------------------------------------------------------------------- |
|
1659 // |
|
1660 void CVIMPSTUiTabbedView::ReadAndSetOwnUserIdL() |
|
1661 { |
|
1662 if( iUserId ) |
|
1663 { |
|
1664 delete iUserId; |
|
1665 iUserId = NULL; |
|
1666 } |
|
1667 iUserId = iEngine.GetOwnUserIdFromCChOrStorageL(); |
|
1668 iEngine.SetOwnUserIdIfChangedL( *iUserId ); |
|
1669 } |
|
1670 // -------------------------------------------------------------------------- |
|
1671 // CVIMPSTUiTabbedView::AddContactL |
|
1672 // -------------------------------------------------------------------------- |
|
1673 // |
|
1674 void CVIMPSTUiTabbedView::AddContactL( const TInt aResouceId, const TDesC& aUserId ) |
|
1675 { |
|
1676 TRACER_AUTO; |
|
1677 MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId); |
|
1678 if (storage) |
|
1679 { |
|
1680 if (!storage->IsLocalStore()) |
|
1681 { |
|
1682 HBufC* userid = HBufC::NewL(KUsernameMaxLength); |
|
1683 CleanupStack::PushL( userid ); |
|
1684 TPtr useridPtr( userid->Des() ); |
|
1685 |
|
1686 useridPtr.Copy( aUserId.Left( KUsernameMaxLength ) ); |
|
1687 TInt result = 0; |
|
1688 if( useridPtr == KNullDesC ) |
|
1689 { |
|
1690 CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( useridPtr, CAknQueryDialog::ENoTone ); |
|
1691 dlg->SetPredictiveTextInputPermitted( ETrue ); // T9 |
|
1692 result = dlg->ExecuteLD( aResouceId ); |
|
1693 } |
|
1694 if( ( result == EAknSoftkeyOk ) || ( result == EAknSoftkeyYes ) || ( useridPtr != KNullDesC ) ) |
|
1695 { |
|
1696 TPtrC ownUserId = storage->OwnContactL().UserId(); |
|
1697 if(useridPtr.Compare( ownUserId ) == 0) //Do not add own data item to contact list |
|
1698 { |
|
1699 //show note "Own Data Item cannot be added" |
|
1700 HBufC* failed = StringLoader::LoadLC( R_QTN_SERVTAB_ERROR_ADDOWN ); |
|
1701 VIMPSTUtilsDialog::DisplayErrorNoteL( *failed ); |
|
1702 CleanupStack::PopAndDestroy( failed ); |
|
1703 } |
|
1704 else |
|
1705 { |
|
1706 CVIMPSTUtilsWaitNote* note = CVIMPSTUtilsWaitNote::ShowWaitNoteLC( R_QTN_SERVTAB_SAVING_CONTACT ,ETrue); |
|
1707 iCommandHandler.HandleCommandL(EAddContact, this, userid ); |
|
1708 CleanupStack::PopAndDestroy( note ); |
|
1709 } |
|
1710 } |
|
1711 CleanupStack::PopAndDestroy(userid); |
|
1712 } |
|
1713 else // server store |
|
1714 |
|
1715 { |
|
1716 //////////////////////////////////////////// |
|
1717 ReInitializeServiceHandlerL(); |
|
1718 TUint assignFlags = 0; |
|
1719 //for unknown item createnew/update existing querry is shown |
|
1720 // check whether the selected contact is unknown |
|
1721 if( iCommandHandler.GetProcessInterface().GetType(iContainer->CurrentItemIndex()) == TVIMPSTEnums::EUnknonContactItem ) |
|
1722 { |
|
1723 iSelectedAction = ShowNewUpdateQueryL(); |
|
1724 if(CVIMPSTUiTabbedView::EInvitAcceptCreateNew == iSelectedAction )//create new |
|
1725 { |
|
1726 assignFlags |= ECreateNewContact; |
|
1727 iSelectedAction = EContactCreateNew; |
|
1728 } |
|
1729 else if(CVIMPSTUiTabbedView::EInvitAcceptUpdateExisting == iSelectedAction ) // update existing |
|
1730 { |
|
1731 iSelectedAction = EContactAddFromContacts; |
|
1732 } |
|
1733 else // selected cancle option |
|
1734 { |
|
1735 return; |
|
1736 } |
|
1737 } |
|
1738 else // not unknown contact |
|
1739 { |
|
1740 iSelectedAction = EContactCreateNew; |
|
1741 assignFlags |= ECreateNewContact; |
|
1742 } |
|
1743 //show the phonebook dialog for create new/update existing option |
|
1744 if(iAiwParamList) |
|
1745 { |
|
1746 delete iAiwParamList; |
|
1747 iAiwParamList = NULL; |
|
1748 } |
|
1749 iAiwParamList = CAiwGenericParamList::NewL(); |
|
1750 iAiwParamList->AppendL( |
|
1751 TAiwGenericParam( |
|
1752 EGenericParamContactAssignData, |
|
1753 TAiwVariant(TAiwSingleContactAssignDataV1Pckg( |
|
1754 TAiwSingleContactAssignDataV1().SetFlags( assignFlags ))))); |
|
1755 |
|
1756 if( aUserId.Length() > 0 ) |
|
1757 { |
|
1758 // add user id in impp field |
|
1759 TBuf<KBufLen> xspId; //xsp max length |
|
1760 xspId.Append(iEngine.ServiceName()); |
|
1761 xspId.Append(KColon); |
|
1762 xspId.Append(aUserId); |
|
1763 |
|
1764 iAiwParamList->AppendL( |
|
1765 TAiwGenericParam( |
|
1766 EGenericParamXSpId, |
|
1767 TAiwVariant(xspId) ) ); |
|
1768 } |
|
1769 iServiceHandler->ExecuteServiceCmdL( |
|
1770 KAiwCmdAssign, |
|
1771 *iAiwParamList, |
|
1772 iServiceHandler->OutParamListL(), |
|
1773 0, |
|
1774 this); |
|
1775 } |
|
1776 } |
|
1777 } |
|
1778 |
|
1779 // -------------------------------------------------------------------------- |
|
1780 // CVIMPSTUiTabbedView::CreateOrLinkToPhoneBookL |
|
1781 // -------------------------------------------------------------------------- |
|
1782 // |
|
1783 void CVIMPSTUiTabbedView::CreateOrLinkToPhoneBookL(TInt aCommand ) |
|
1784 { |
|
1785 TRACER_AUTO; |
|
1786 TInt index = CurrentItemIndex(); |
|
1787 if( index <= 0 ) |
|
1788 { |
|
1789 return; |
|
1790 } |
|
1791 TUint assignFlags = 0; |
|
1792 if(ECmdAIWAddToContact == aCommand )//create new option |
|
1793 { |
|
1794 assignFlags |= ECreateNewContact; |
|
1795 } |
|
1796 TPtrC itemUserId = iCommandHandler.GetProcessInterface().GetItemUserId(index) ; |
|
1797 if(iAiwParamList) |
|
1798 { |
|
1799 delete iAiwParamList; |
|
1800 iAiwParamList = NULL; |
|
1801 } |
|
1802 iAiwParamList = CAiwGenericParamList::NewL(); |
|
1803 iAiwParamList->AppendL( |
|
1804 TAiwGenericParam( |
|
1805 EGenericParamContactAssignData, |
|
1806 TAiwVariant(TAiwSingleContactAssignDataV1Pckg( |
|
1807 TAiwSingleContactAssignDataV1().SetFlags( assignFlags ))))); |
|
1808 |
|
1809 TBuf<KBufLen> xspid; |
|
1810 xspid.Append(iEngine.ServiceName()); |
|
1811 xspid.Append(KColon); |
|
1812 xspid.Append(itemUserId); |
|
1813 ReInitializeServiceHandlerL(); |
|
1814 iAiwParamList->AppendL( |
|
1815 TAiwGenericParam( |
|
1816 EGenericParamXSpId, |
|
1817 TAiwVariant(xspid)) ); |
|
1818 |
|
1819 iServiceHandler->ExecuteServiceCmdL( KAiwCmdAssign, |
|
1820 *iAiwParamList, |
|
1821 iServiceHandler->OutParamListL(), |
|
1822 0, |
|
1823 this); |
|
1824 } |
|
1825 |
|
1826 // -------------------------------------------------------------------------- |
|
1827 // CVIMPSTUiTabbedView::EditContactL |
|
1828 // -------------------------------------------------------------------------- |
|
1829 // |
|
1830 void CVIMPSTUiTabbedView::EditContactL() |
|
1831 { |
|
1832 TRACER_AUTO; |
|
1833 MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId); |
|
1834 if (storage) |
|
1835 { |
|
1836 if( storage->IsLocalStore()) |
|
1837 { |
|
1838 iSelectedAction = KErrNotFound; |
|
1839 TInt index = CurrentItemIndex(); |
|
1840 MVPbkContactLink* contactLink = iCommandHandler.GetProcessInterface().ContactLink(index); |
|
1841 //show the phonebook dialog for edit existing data |
|
1842 if(iAiwParamList) |
|
1843 { |
|
1844 delete iAiwParamList; |
|
1845 iAiwParamList = NULL; |
|
1846 } |
|
1847 iAiwParamList = CAiwGenericParamList::NewL(); |
|
1848 iAiwParamList->AppendL( |
|
1849 TAiwGenericParam( |
|
1850 EGenericParamContactAssignData, |
|
1851 TAiwVariant(TAiwSingleContactAssignDataV1Pckg( |
|
1852 TAiwSingleContactAssignDataV1().SetFlags( EskipInfoNotes ))))); |
|
1853 |
|
1854 HBufC8* packedLinks = contactLink->PackLC(); |
|
1855 iAiwParamList->AppendL( |
|
1856 TAiwGenericParam( |
|
1857 EGenericParamContactLinkArray, |
|
1858 TAiwVariant(*packedLinks) ) ); |
|
1859 ReInitializeServiceHandlerL(); |
|
1860 |
|
1861 iServiceHandler->ExecuteServiceCmdL( |
|
1862 KAiwCmdAssign, |
|
1863 *iAiwParamList, |
|
1864 iServiceHandler->OutParamListL(), |
|
1865 0, |
|
1866 this); |
|
1867 CleanupStack::PopAndDestroy(); // packedLinks |
|
1868 } |
|
1869 } |
|
1870 } |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 // -------------------------------------------------------------------------- |
|
1876 // CVIMPSTUiTabbedView::AddContactL |
|
1877 // -------------------------------------------------------------------------- |
|
1878 void CVIMPSTUiTabbedView::AddContactL(RPointerArray<HBufC> aContacts) |
|
1879 { |
|
1880 TRACER_AUTO; |
|
1881 TInt count = aContacts.Count(); |
|
1882 |
|
1883 switch( count ) |
|
1884 { |
|
1885 case 0://no xsp found. |
|
1886 { |
|
1887 //launch add manually dialog. |
|
1888 AddContactL( R_IM_ADD_CONTACT_MANUAL_QUERY );//to do replace with some thing else. |
|
1889 break; |
|
1890 } |
|
1891 case 1://1 xsp foud. |
|
1892 { |
|
1893 //add new contact. |
|
1894 HBufC* xspId = aContacts[0]; |
|
1895 AddContactL( R_IM_ADD_CONTACT_MANUAL_QUERY, *xspId ); |
|
1896 break; |
|
1897 } |
|
1898 default :// > 1 xsp found. |
|
1899 { |
|
1900 //show single selection dialog |
|
1901 TInt selectionIndex = 0; |
|
1902 CDesCArray* xspIds = new( ELeave )CDesCArrayFlat( count ); |
|
1903 CleanupStack::PushL( xspIds ); |
|
1904 |
|
1905 //add all xsp(s) from aContacts to xspIds. |
|
1906 for( TInt i = 0 ; i < count ; i++ ) |
|
1907 { |
|
1908 xspIds->AppendL( *aContacts[i] ); |
|
1909 } |
|
1910 |
|
1911 HBufC* titleText = StringLoader::LoadLC( R_QTN_SERVTAB_SELECT_USER ); |
|
1912 |
|
1913 TInt ret = VIMPSTUtilsDialog::DisplayListQueryDialogL( &selectionIndex, |
|
1914 xspIds, |
|
1915 R_IM_LIST_SELECT_STATUS_MESSAGE_DLG, |
|
1916 *titleText, |
|
1917 KNullDesC, |
|
1918 ETrue ); |
|
1919 CleanupStack::PopAndDestroy( titleText ); |
|
1920 |
|
1921 |
|
1922 if ( ret == EAknSoftkeyOk || ret == EAknSoftkeyDone || ret == EAknSoftkeySelect ) |
|
1923 { |
|
1924 TPtrC selectedXspid = (*xspIds)[selectionIndex]; |
|
1925 AddContactL( R_IM_ADD_CONTACT_MANUAL_QUERY, selectedXspid ); |
|
1926 } |
|
1927 CleanupStack::PopAndDestroy(xspIds); |
|
1928 break; |
|
1929 } |
|
1930 } |
|
1931 } |
|
1932 |
|
1933 // -------------------------------------------------------------------------- |
|
1934 // CVIMPSTUiTabbedView::CopyToPhoneBookL |
|
1935 // -------------------------------------------------------------------------- |
|
1936 // |
|
1937 void CVIMPSTUiTabbedView::CopyToPhoneBookL() |
|
1938 { |
|
1939 TRACER_AUTO; |
|
1940 TInt index = CurrentItemIndex(); |
|
1941 |
|
1942 TPtrC name( KNullDesC ); |
|
1943 if( index <= 0 ) |
|
1944 { |
|
1945 // return if item not found |
|
1946 return; |
|
1947 } |
|
1948 |
|
1949 TPtrC seletctedItem = iCommandHandler.GetProcessInterface().GetItemUserId(index) ; |
|
1950 |
|
1951 MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL(iServiceId) ; |
|
1952 if(storage) |
|
1953 { |
|
1954 MVIMPSTStorageContact* contact = storage->FindContactByUserId(seletctedItem); |
|
1955 if(contact) |
|
1956 { |
|
1957 CVIMPSTUtilsWaitNote* note = CVIMPSTUtilsWaitNote::ShowWaitNoteLC( R_QTN_SERVTAB_SAVING_CONTACT ,ETrue); |
|
1958 iCommandHandler.HandleCommandL(EAddToPbk, this, contact ); |
|
1959 CleanupStack::PopAndDestroy(note); |
|
1960 } |
|
1961 } |
|
1962 } |
|
1963 |
|
1964 // -------------------------------------------------------------------------- |
|
1965 // CVIMPSTUiTabbedView::DeleteContactL |
|
1966 // -------------------------------------------------------------------------- |
|
1967 // |
|
1968 void CVIMPSTUiTabbedView:: DeleteContactL() |
|
1969 { |
|
1970 TRACER_AUTO; |
|
1971 TInt index = CurrentItemIndex(); |
|
1972 HBufC* deletePrompt = NULL; |
|
1973 TPtrC name( KNullDesC ); |
|
1974 |
|
1975 if(iContainer) |
|
1976 { |
|
1977 iContainer->CheckAndSetLastItemFlag(); |
|
1978 } |
|
1979 if( index <= 0 ) |
|
1980 { |
|
1981 // return if item not found |
|
1982 return; |
|
1983 } |
|
1984 |
|
1985 TPtrC seletctedItem = iCommandHandler.GetProcessInterface().GetItemUserId(index) ; |
|
1986 name.Set( seletctedItem ); |
|
1987 |
|
1988 deletePrompt = StringLoader::LoadLC( R_QTN_SERVTAB_DELETE_CONTACT, name, CCoeEnv::Static() ); |
|
1989 TInt ret( VIMPSTUtilsDialog::DisplayQueryDialogL(R_GENERIC_YES_NO_CONFIRMATION_QUERY, *deletePrompt ) ); |
|
1990 CleanupStack::PopAndDestroy( deletePrompt ); |
|
1991 |
|
1992 MVPbkContactLink* contactLink = iCommandHandler.GetProcessInterface().ContactLink(index); |
|
1993 |
|
1994 if( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
1995 { |
|
1996 if(iWaitNote) |
|
1997 { |
|
1998 delete iWaitNote; |
|
1999 iWaitNote = NULL; |
|
2000 } |
|
2001 iWaitNote = CVIMPSTUtilsWaitNote::ShowWaitNoteL( R_QTN_CHAT_DELETING_CONTACT ,ETrue); |
|
2002 iCommandHandler.HandleCommandL(EDeleteContact, this, &contactLink ); |
|
2003 } |
|
2004 } |
|
2005 |
|
2006 |
|
2007 |
|
2008 // ----------------------------------------------------------------------------- |
|
2009 // CVIMPSTUiTabbedView::ChangeStatusProcessL |
|
2010 // (other items were commented in a header). |
|
2011 // ----------------------------------------------------------------------------- |
|
2012 // |
|
2013 void CVIMPSTUiTabbedView::ChangeStatusProcessL() |
|
2014 { |
|
2015 TRACER_AUTO; |
|
2016 if( iEngine.ServiceState() ) |
|
2017 { |
|
2018 // Check variation |
|
2019 TInt showAppearOffline = 1; |
|
2020 TInt showAway = 1 ; |
|
2021 TInt showBusy = 1; |
|
2022 |
|
2023 TInt awayIndex( 0 ); |
|
2024 TInt busyIndex( 0 ); |
|
2025 TInt appOfflineIndex( 0 ); |
|
2026 |
|
2027 // first icon is online |
|
2028 // calculate indexes for other icons |
|
2029 if ( showAway) |
|
2030 { |
|
2031 awayIndex++; |
|
2032 busyIndex++; |
|
2033 appOfflineIndex++; |
|
2034 } |
|
2035 else |
|
2036 { |
|
2037 awayIndex = -1; |
|
2038 } |
|
2039 |
|
2040 if ( showBusy ) |
|
2041 { |
|
2042 busyIndex++; |
|
2043 appOfflineIndex++; |
|
2044 } |
|
2045 else |
|
2046 { |
|
2047 busyIndex = -1; |
|
2048 } |
|
2049 |
|
2050 if ( showAppearOffline ) |
|
2051 { |
|
2052 appOfflineIndex++; |
|
2053 } |
|
2054 else |
|
2055 { |
|
2056 appOfflineIndex = -1; |
|
2057 } |
|
2058 |
|
2059 TInt status( 0 ); |
|
2060 CAknListQueryDialog* dlg = new ( ELeave ) |
|
2061 CAknListQueryDialog( &status ); |
|
2062 dlg->PrepareLC( R_IM_STATUS_CHANGE_DLG ); |
|
2063 |
|
2064 // Format the texts |
|
2065 // Create a array for texts |
|
2066 CDesCArray* listItemsArray = |
|
2067 new ( ELeave ) CDesCArrayFlat( KAmountOfOwnStatusStates ); |
|
2068 CleanupStack::PushL( listItemsArray ); |
|
2069 |
|
2070 // Online |
|
2071 HBufC* onlineText = NULL; |
|
2072 onlineText = StringLoader::LoadLC( R_QTN_CHAT_CHANGE_OWN_ONLINE ); |
|
2073 |
|
2074 HBufC* itemTxtOnline = |
|
2075 HBufC::NewLC( KTabFormatLenght + onlineText->Length() ); |
|
2076 TPtr itemTxtPtrOnline( itemTxtOnline->Des() ); |
|
2077 |
|
2078 itemTxtPtrOnline.Format( KTabFormat, KOnlineIconIndex ); |
|
2079 itemTxtPtrOnline.Append( *onlineText ); |
|
2080 listItemsArray->AppendL( itemTxtPtrOnline ); |
|
2081 CleanupStack::PopAndDestroy( itemTxtOnline ); |
|
2082 CleanupStack::PopAndDestroy( onlineText ); |
|
2083 |
|
2084 // Away |
|
2085 if ( showAway ) |
|
2086 { |
|
2087 HBufC* awayText = NULL; |
|
2088 awayText = StringLoader::LoadLC( R_QTN_CHAT_CHANGE_OWN_AWAY ); |
|
2089 |
|
2090 HBufC* itemTxtAway = HBufC::NewLC( |
|
2091 KTabFormatLenght + awayText->Length() ); |
|
2092 TPtr itemTxtPtrAway( itemTxtAway->Des() ); |
|
2093 |
|
2094 itemTxtPtrAway.Format( KTabFormat, awayIndex ); |
|
2095 itemTxtPtrAway.Append( *awayText ); |
|
2096 listItemsArray->AppendL( itemTxtPtrAway ); |
|
2097 CleanupStack::PopAndDestroy( itemTxtAway ); |
|
2098 CleanupStack::PopAndDestroy( awayText ); |
|
2099 } |
|
2100 |
|
2101 // Busy |
|
2102 if ( showBusy ) |
|
2103 { |
|
2104 HBufC* busyText = NULL; |
|
2105 busyText = StringLoader::LoadLC( R_QTN_SERVTAB_CHANGE_OWN_DND ); |
|
2106 |
|
2107 HBufC* itemTextBusy = HBufC::NewLC( |
|
2108 KTabFormatLenght + busyText->Length() ); |
|
2109 TPtr itemTxtPtrBusy( itemTextBusy->Des() ); |
|
2110 |
|
2111 itemTxtPtrBusy.Format( KTabFormat, busyIndex ); |
|
2112 itemTxtPtrBusy.Append( *busyText ); |
|
2113 listItemsArray->AppendL( itemTxtPtrBusy ); |
|
2114 CleanupStack::PopAndDestroy( itemTextBusy ); |
|
2115 CleanupStack::PopAndDestroy( busyText ); |
|
2116 } |
|
2117 // Appear offline |
|
2118 if ( showAppearOffline ) |
|
2119 { |
|
2120 HBufC* offlineText = NULL; |
|
2121 offlineText = StringLoader::LoadLC( R_QTN_CHAT_CHANGE_OWN_APPEAR_OFFLINE ); |
|
2122 |
|
2123 HBufC* itemTextOffline = HBufC::NewLC( |
|
2124 KTabFormatLenght + offlineText->Length() ); |
|
2125 TPtr itemTxtPtrOffline( itemTextOffline->Des() ); |
|
2126 |
|
2127 itemTxtPtrOffline.Format( KTabFormat, appOfflineIndex ); |
|
2128 itemTxtPtrOffline.Append( *offlineText ); |
|
2129 listItemsArray->AppendL( itemTxtPtrOffline ); |
|
2130 CleanupStack::PopAndDestroy( itemTextOffline ); |
|
2131 CleanupStack::PopAndDestroy( offlineText ); |
|
2132 } |
|
2133 |
|
2134 // Set the array |
|
2135 dlg->SetOwnershipType( ELbmOwnsItemArray ); |
|
2136 CleanupStack::Pop( listItemsArray ); |
|
2137 dlg->SetItemTextArray( listItemsArray ); |
|
2138 |
|
2139 // Add icons |
|
2140 CArrayPtr< CGulIcon >* icons = LoadOwnStatusIconsL(); |
|
2141 |
|
2142 |
|
2143 dlg->SetIconArrayL( icons ); // transfers ownership |
|
2144 // TODO::get own status |
|
2145 |
|
2146 // get dialog's listbox |
|
2147 CEikListBox* listBox = dlg->ListBox(); |
|
2148 |
|
2149 //listBox->SetCurrentItemIndex( 0 ); |
|
2150 |
|
2151 TInt result = dlg->RunLD(); |
|
2152 |
|
2153 //structure to pack status and status text. |
|
2154 TStatusAndStatusText statusAndSatatustext; |
|
2155 |
|
2156 TInt error( KErrNone ); |
|
2157 if ( ( result == EAknSoftkeyOk ) || |
|
2158 ( result == EAknSoftkeySelect ) ) |
|
2159 { |
|
2160 if ( status == 0 ) |
|
2161 { |
|
2162 TInt autoStatusMsgEnabledForOnline = 1; /*IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_ONLINE_AUTO );*/ |
|
2163 if( autoStatusMsgEnabledForOnline ) |
|
2164 { |
|
2165 error = AskStatusMessageL( TVIMPSTEnums::EOnline, EFalse ); |
|
2166 } |
|
2167 if( error == KErrNone ) |
|
2168 { |
|
2169 statusAndSatatustext.iStatus = TVIMPSTEnums::EOnline; |
|
2170 statusAndSatatustext.iStatusText.Copy(iStatusMessage->Des()); |
|
2171 CVIMPSTUtilsWaitNote* note = CVIMPSTUtilsWaitNote::ShowWaitNoteLC( R_QTN_CHAT_CHANGE_STATUS_CHANGING ); |
|
2172 error = iCommandHandler.HandleCommandL(EChangeOwnStatus, this, &statusAndSatatustext); |
|
2173 CleanupStack::PopAndDestroy( note ); |
|
2174 } |
|
2175 } |
|
2176 else if ( status == awayIndex ) // Away |
|
2177 { |
|
2178 // can't get here unless Away is enabled |
|
2179 TInt autoStatusMsgEnabledForAway = 1; |
|
2180 //IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_AWAY_AUTO ); |
|
2181 if( autoStatusMsgEnabledForAway ) |
|
2182 { |
|
2183 error = AskStatusMessageL( TVIMPSTEnums::EAway, EFalse ); |
|
2184 } |
|
2185 if( error == KErrNone ) |
|
2186 { |
|
2187 statusAndSatatustext.iStatus = TVIMPSTEnums::EAway; |
|
2188 statusAndSatatustext.iStatusText.Copy(iStatusMessage->Des()); |
|
2189 CVIMPSTUtilsWaitNote* note = CVIMPSTUtilsWaitNote::ShowWaitNoteLC( R_QTN_CHAT_CHANGE_STATUS_CHANGING ); |
|
2190 error = iCommandHandler.HandleCommandL(EChangeOwnStatus, this, &statusAndSatatustext); |
|
2191 CleanupStack::PopAndDestroy( note ); |
|
2192 } |
|
2193 } |
|
2194 |
|
2195 else if ( status == busyIndex ) // Busy |
|
2196 { |
|
2197 // can't get here unless Busy is enabled |
|
2198 TInt autoStatusMsgEnabledForBusy = 1; |
|
2199 //IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_BUSY_AUTO ); |
|
2200 if( autoStatusMsgEnabledForBusy ) |
|
2201 { |
|
2202 error = AskStatusMessageL( TVIMPSTEnums::EBusy, EFalse ); |
|
2203 } |
|
2204 if( error == KErrNone ) |
|
2205 { |
|
2206 statusAndSatatustext.iStatus = TVIMPSTEnums::EBusy; |
|
2207 statusAndSatatustext.iStatusText.Copy(iStatusMessage->Des()); |
|
2208 CVIMPSTUtilsWaitNote* note = CVIMPSTUtilsWaitNote::ShowWaitNoteLC( R_QTN_CHAT_CHANGE_STATUS_CHANGING ); |
|
2209 error = iCommandHandler.HandleCommandL(EChangeOwnStatus, this, &statusAndSatatustext); |
|
2210 CleanupStack::PopAndDestroy( note ); |
|
2211 |
|
2212 } |
|
2213 } |
|
2214 else if ( status == appOfflineIndex ) //appearOffline |
|
2215 { |
|
2216 |
|
2217 statusAndSatatustext.iStatus = TVIMPSTEnums::EInvisible; |
|
2218 statusAndSatatustext.iStatusText.Copy(iStatusMessage->Des()); |
|
2219 CVIMPSTUtilsWaitNote* note = CVIMPSTUtilsWaitNote::ShowWaitNoteLC( R_QTN_CHAT_CHANGE_STATUS_CHANGING ); |
|
2220 error = iCommandHandler.HandleCommandL(EChangeOwnStatus, this, &statusAndSatatustext); |
|
2221 CleanupStack::PopAndDestroy( note ); |
|
2222 } |
|
2223 else |
|
2224 { |
|
2225 HBufC* text = NULL; |
|
2226 text = StringLoader::LoadLC( R_QTN_IM_CHANGE_STATUS_NOT_CHANGED ); |
|
2227 VIMPSTUtilsDialog::DisplayNoteDialogL( *text ); |
|
2228 CleanupStack::PopAndDestroy( text ); |
|
2229 } |
|
2230 //iUISessionManager->SetStatusPaneIconsL(); |
|
2231 } |
|
2232 } |
|
2233 } |
|
2234 |
|
2235 // --------------------------------------------------------- |
|
2236 // CVIMPSTUiTabbedView::LoadOwnStatusIconsL |
|
2237 // --------------------------------------------------------- |
|
2238 // |
|
2239 CAknIconArray* CVIMPSTUiTabbedView::LoadOwnStatusIconsL() |
|
2240 { |
|
2241 TRACER_AUTO; |
|
2242 CAknIconArray* icons = iBrandHandler->LoadOwnStatusIconsLC(); |
|
2243 CleanupStack::Pop( icons ); |
|
2244 return icons; |
|
2245 } |
|
2246 |
|
2247 // --------------------------------------------------------- |
|
2248 // CVIMPSTUiTabbedView::AskStatusMessageL() |
|
2249 // (other items were commented in a header). |
|
2250 // --------------------------------------------------------- |
|
2251 // |
|
2252 TInt CVIMPSTUiTabbedView::AskStatusMessageL( TVIMPSTEnums::TOnlineStatus aStatus, |
|
2253 TBool aUpdateToNetwork ) |
|
2254 { |
|
2255 TRACER_AUTO; |
|
2256 CDesCArray* statusMessages = new( ELeave )CDesCArrayFlat(4); |
|
2257 CleanupStack::PushL( statusMessages ); |
|
2258 |
|
2259 HBufC* firstLine = StringLoader::LoadLC( R_QTN_CHAT_CHANGE_NEW_MESSAGE ); |
|
2260 statusMessages->AppendL( *firstLine ); |
|
2261 CleanupStack::PopAndDestroy( firstLine ); |
|
2262 |
|
2263 // Read status messages |
|
2264 ReadStatusMessagesL( *statusMessages, aStatus ); |
|
2265 |
|
2266 // show the query |
|
2267 TInt selectionIndex( statusMessages->Count() > 1 ? 1 : 0 ); |
|
2268 |
|
2269 // Force to continue if selection query is not shown |
|
2270 TInt ret = EAknSoftkeyOk; |
|
2271 |
|
2272 if( selectionIndex == 1 ) |
|
2273 { |
|
2274 // There were previous status messages, show selection query |
|
2275 HBufC* titleText = StringLoader::LoadLC( R_QTN_CHAT_CHANGE_SELECT_MESSAGE ); |
|
2276 ret = VIMPSTUtilsDialog::DisplayListQueryDialogL( &selectionIndex, statusMessages, |
|
2277 R_IM_LIST_SELECT_STATUS_MESSAGE_DLG, |
|
2278 *titleText, KNullDesC, ETrue ); |
|
2279 CleanupStack::PopAndDestroy( titleText ); |
|
2280 } |
|
2281 |
|
2282 if ( !( ret == EAknSoftkeyOk || ret == EAknSoftkeyDone || ret == EAknSoftkeySelect ) ) |
|
2283 { |
|
2284 CleanupStack::PopAndDestroy( statusMessages ); |
|
2285 return KErrCancel; |
|
2286 } |
|
2287 |
|
2288 TPtr statusTxt( iStatusMessage->Des() ); |
|
2289 statusTxt.Zero(); |
|
2290 |
|
2291 if( selectionIndex != 0 ) |
|
2292 { |
|
2293 statusTxt.Copy( ( *statusMessages) [ selectionIndex ] ); |
|
2294 } |
|
2295 |
|
2296 TInt result = VIMPSTUtilsDialog::DisplayTextQueryDialogL( |
|
2297 statusTxt , |
|
2298 R_QTN_CHAT_CHANGE_STATUS_MESSAGE, |
|
2299 R_IM_ENTER_STATUS_MESSAGE_QUERY, |
|
2300 ETrue, // T9 |
|
2301 ETrue // LSK always visible |
|
2302 ); |
|
2303 |
|
2304 if ( (result == EAknSoftkeyOk || result == EAknSoftkeyDone )&&(iEngine.ServiceState())) |
|
2305 { |
|
2306 |
|
2307 // Delete first line. |
|
2308 statusMessages->Delete( 0 ); |
|
2309 statusMessages->InsertL( 0, statusTxt ); |
|
2310 WriteStatusMessagesL( *statusMessages, aStatus ); |
|
2311 if( aUpdateToNetwork ) |
|
2312 { |
|
2313 CVIMPSTUtilsWaitNote* note = CVIMPSTUtilsWaitNote::ShowWaitNoteLC( R_QTN_CHAT_CHANGE_MESSAGE_CHANGING ); |
|
2314 //structure to pack status and status text. |
|
2315 TStatusAndStatusText statusAndSatatustext; |
|
2316 statusAndSatatustext.iStatus = aStatus; |
|
2317 statusAndSatatustext.iStatusText.Copy( statusTxt ); |
|
2318 iCommandHandler.HandleCommandL(EChangeOwnMessage, this, &statusAndSatatustext); |
|
2319 CleanupStack::PopAndDestroy( note ); |
|
2320 } |
|
2321 } |
|
2322 else |
|
2323 { |
|
2324 CleanupStack::PopAndDestroy();//statusMessages |
|
2325 return KErrCancel; |
|
2326 } |
|
2327 CleanupStack::PopAndDestroy(); //statusMessages |
|
2328 return KErrNone; |
|
2329 } |
|
2330 |
|
2331 // ----------------------------------------------------------------------------- |
|
2332 // CVIMPSTUiTabbedView::ReadStatusMessagesL |
|
2333 // (other items were commented in a header). |
|
2334 // ----------------------------------------------------------------------------- |
|
2335 // |
|
2336 void CVIMPSTUiTabbedView::ReadStatusMessagesL( CDesCArray& aArray, TVIMPSTEnums::TOnlineStatus aStatus) |
|
2337 { |
|
2338 TRACER_AUTO; |
|
2339 RBuf buffer; |
|
2340 buffer.CreateL( RProperty::KMaxPropertySize ); |
|
2341 CleanupClosePushL( buffer ); |
|
2342 TInt err(KErrNone); |
|
2343 switch ( aStatus ) |
|
2344 { |
|
2345 case TVIMPSTEnums::EOnline: |
|
2346 { |
|
2347 err = iSettingsStore->GetL( iServiceId, EServiceOwnStatusMessagesOnline, buffer ); |
|
2348 break; |
|
2349 } |
|
2350 case TVIMPSTEnums::EBusy: |
|
2351 { |
|
2352 err = iSettingsStore->GetL( iServiceId, EServiceOwnStatusMessagesBusy, buffer ); |
|
2353 break; |
|
2354 } |
|
2355 case TVIMPSTEnums::EAway: |
|
2356 { |
|
2357 err = iSettingsStore->GetL( iServiceId, EServiceOwnStatusMessagesAway, buffer ); |
|
2358 break; |
|
2359 } |
|
2360 } |
|
2361 TBuf< KStatusMessageHeaderLength > header; |
|
2362 |
|
2363 TInt countOfMessages( 0 ); |
|
2364 TInt offset( 1 ); // First character is for header length |
|
2365 TInt headerLength( 0 ); |
|
2366 if( err == KErrNone && buffer.Length() ) |
|
2367 { |
|
2368 TLex lexer( buffer.Left( 1 ) ); |
|
2369 err = lexer.Val( headerLength ); |
|
2370 } |
|
2371 else |
|
2372 { |
|
2373 err = KErrEof; |
|
2374 } |
|
2375 while( err == KErrNone && countOfMessages < KMaxStatusMessageCount ) |
|
2376 { |
|
2377 TPtrC ptr( buffer.Mid( offset ) ); |
|
2378 if( ptr.Length() > headerLength ) |
|
2379 { |
|
2380 header.Copy( ptr.Left( headerLength ) ); |
|
2381 header.Trim(); |
|
2382 TLex lexer( header ); |
|
2383 offset += headerLength; |
|
2384 TInt messageLength( 0 ); |
|
2385 err = lexer.Val( messageLength ); |
|
2386 if( err == KErrNone ) |
|
2387 { |
|
2388 ptr.Set( buffer.Mid( offset ) ); |
|
2389 if( ptr.Length() >= messageLength ) |
|
2390 { |
|
2391 if (messageLength) |
|
2392 { |
|
2393 aArray.AppendL( ptr.Left( messageLength ) ); |
|
2394 ++countOfMessages; // this should be increased only for not null messages. |
|
2395 } |
|
2396 offset += messageLength; |
|
2397 } |
|
2398 else |
|
2399 { |
|
2400 err = KErrEof; |
|
2401 } |
|
2402 } |
|
2403 } |
|
2404 else |
|
2405 { |
|
2406 err = KErrEof; |
|
2407 } |
|
2408 } |
|
2409 CleanupStack::PopAndDestroy(); //buffer |
|
2410 } |
|
2411 |
|
2412 // ----------------------------------------------------------------------------- |
|
2413 // CVIMPSTUiTabbedView::WriteStatusMessagesL |
|
2414 // (other items were commented in a header). |
|
2415 // ----------------------------------------------------------------------------- |
|
2416 // |
|
2417 |
|
2418 void CVIMPSTUiTabbedView::WriteStatusMessagesL( MDesCArray& aArray, TVIMPSTEnums::TOnlineStatus aStatus ) |
|
2419 { |
|
2420 TRACER_AUTO; |
|
2421 TPtrC firstLine = aArray.MdcaPoint( 0 ); |
|
2422 TInt countOfMessages( 0 ); |
|
2423 TInt arrayCount( aArray.MdcaCount() ); |
|
2424 TInt index( 0 ); |
|
2425 |
|
2426 RBuf buffer; |
|
2427 buffer.CreateL( RProperty::KMaxPropertySize ); |
|
2428 CleanupClosePushL( buffer ); |
|
2429 |
|
2430 TBuf< KStatusMessageHeaderLength > header; |
|
2431 // Read the array and append the buffer |
|
2432 while( index < arrayCount && countOfMessages < KMaxStatusMessageCount ) |
|
2433 { |
|
2434 if( index == 0 ) |
|
2435 { |
|
2436 header.Format( KStatusMessageHeaderLengthFormat, |
|
2437 KStatusMessageHeaderLength ); |
|
2438 buffer.Append( header ); |
|
2439 } |
|
2440 TPtrC message = aArray.MdcaPoint( index ); |
|
2441 if( index == 0 || message.CompareF( firstLine ) != 0 ) |
|
2442 { |
|
2443 header.Format( KStatusMessageHeaderFormat, message.Length() ); |
|
2444 buffer.Append( header ); |
|
2445 buffer.Append( message ); |
|
2446 //skipping increase of countOfMessages is to get one more status message if it is null. |
|
2447 if( message.Length() ) // null status message |
|
2448 { |
|
2449 ++countOfMessages; |
|
2450 } |
|
2451 } |
|
2452 ++index; |
|
2453 } |
|
2454 switch ( aStatus ) |
|
2455 { |
|
2456 case TVIMPSTEnums::EOnline: |
|
2457 { |
|
2458 iSettingsStore->SetL( iServiceId, EServiceOwnStatusMessagesOnline, buffer ); |
|
2459 break; |
|
2460 } |
|
2461 case TVIMPSTEnums::EBusy: |
|
2462 { |
|
2463 iSettingsStore->SetL( iServiceId, EServiceOwnStatusMessagesBusy, buffer ); |
|
2464 break; |
|
2465 } |
|
2466 case TVIMPSTEnums::EAway: |
|
2467 { |
|
2468 iSettingsStore->SetL( iServiceId, EServiceOwnStatusMessagesAway, buffer ); |
|
2469 break; |
|
2470 } |
|
2471 } |
|
2472 CleanupStack::PopAndDestroy(); // buffer |
|
2473 } |
|
2474 |
|
2475 |
|
2476 // ----------------------------------------------------------------------------- |
|
2477 // CVIMPSTUiTabbedView::ChangeOwnStatusMessageL |
|
2478 // (other items were commented in a header). |
|
2479 // ----------------------------------------------------------------------------- |
|
2480 // |
|
2481 void CVIMPSTUiTabbedView::ChangeOwnStatusMessageL() |
|
2482 { |
|
2483 TVIMPSTEnums::TOnlineStatus status = iCommandHandler.GetProcessInterface().GetOnlineStatusL( 0 ); //0 for own status item |
|
2484 // ETrue meaning network change required |
|
2485 AskStatusMessageL(status, ETrue); |
|
2486 } |
|
2487 // ----------------------------------------------------------------------------- |
|
2488 // CVIMPSTUiTabbedView::ChangeOwnAvatarL |
|
2489 // (other items were commented in a header). |
|
2490 // ----------------------------------------------------------------------------- |
|
2491 // |
|
2492 void CVIMPSTUiTabbedView::ChangeOwnAvatarL(const TDesC& aFileName, const TDesC8& aMimeType ) |
|
2493 { |
|
2494 TRACER_AUTO; |
|
2495 MVIMPSTProcessArray& arrayprocess = iCommandHandler.GetProcessInterface(); |
|
2496 TAvatarData avatarData; |
|
2497 avatarData.iStatus = arrayprocess.GetOnlineStatusL(0); |
|
2498 avatarData.iStatusText.Copy( arrayprocess.StatusTextL(0) ); |
|
2499 avatarData.iFileName.Set(aFileName); |
|
2500 avatarData.iMimeType.Set(aMimeType); |
|
2501 iCommandHandler.HandleCommandL(EChangeOwnAvtar, this, &avatarData); |
|
2502 } |
|
2503 // ----------------------------------------------------------------------------- |
|
2504 // CVIMPSTUiTabbedView::GetServiceState |
|
2505 // (other items were commented in a header). |
|
2506 // ----------------------------------------------------------------------------- |
|
2507 // |
|
2508 TVIMPSTEnums::TVIMPSTRegistrationState CVIMPSTUiTabbedView::GetServiceState() |
|
2509 { |
|
2510 return iEngine.ServiceState(); |
|
2511 } |
|
2512 |
|
2513 |
|
2514 // -------------------------------------------------------------------------- |
|
2515 // CVIMPSTUiTabbedView::SearchContactsL |
|
2516 // -------------------------------------------------------------------------- |
|
2517 // |
|
2518 void CVIMPSTUiTabbedView:: SearchContactsL() |
|
2519 { |
|
2520 TRACER_AUTO; |
|
2521 CVIMPSTUiSearchFieldArray& fieldArray = iExtensionService.GetSearchFieldArray(); |
|
2522 |
|
2523 if( !fieldArray.Count() ) |
|
2524 { |
|
2525 return; |
|
2526 } |
|
2527 |
|
2528 if(!iIsToolBarHidden) |
|
2529 { |
|
2530 ShowHideFixedToolbarL(EFalse); |
|
2531 } |
|
2532 |
|
2533 if (iContainer) |
|
2534 { |
|
2535 iContainer->DeactivateFindPaneL(); |
|
2536 } |
|
2537 |
|
2538 fieldArray.ResetFieldData(); |
|
2539 fieldArray.SetSearchType( EIMBasicSearch ); |
|
2540 //Launch the search view with search dialog |
|
2541 LaunchViewL( iExtensionService.SearchViewId() ); |
|
2542 |
|
2543 } |
|
2544 |
|
2545 // --------------------------------------------------------------------------- |
|
2546 // CVIMPSTUiTabbedView::LaunchViewL() |
|
2547 // --------------------------------------------------------------------------- |
|
2548 // |
|
2549 void CVIMPSTUiTabbedView::LaunchViewL( TInt aViewId ) |
|
2550 { |
|
2551 TRACER_AUTO; |
|
2552 |
|
2553 CPbk2ViewState* state = CPbk2ViewState::NewLC( ); |
|
2554 |
|
2555 TInt searchViewId; |
|
2556 TInt err = iMapper.GetNewView( |
|
2557 KIMCONTACTSEXTNIMPLEMENTATIONUID, |
|
2558 aViewId, |
|
2559 searchViewId ); |
|
2560 User::LeaveIfError( err ); |
|
2561 Phonebook2::Pbk2AppUi()->Pbk2ViewExplorer()->ActivatePhonebook2ViewL |
|
2562 (TUid::Uid(searchViewId), state); |
|
2563 |
|
2564 CleanupStack::PopAndDestroy( state ); |
|
2565 } |
|
2566 |
|
2567 // --------------------------------------------------------- |
|
2568 // CVIMPSTUiTabbedView::CreateToolBarL |
|
2569 // --------------------------------------------------------- |
|
2570 // |
|
2571 void CVIMPSTUiTabbedView::CreateToolBarL() |
|
2572 { |
|
2573 TRACER_AUTO; |
|
2574 if ( AknLayoutUtils::PenEnabled() ) |
|
2575 { |
|
2576 TInt resourceId = 0; |
|
2577 if(iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EIM) && |
|
2578 !iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EVoip)) |
|
2579 { |
|
2580 resourceId = R_IM_APP_TOOLBAR; |
|
2581 } |
|
2582 else if(iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EVoip) && |
|
2583 !iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EIM)) |
|
2584 { |
|
2585 resourceId = R_VOIP_APP_TOOLBAR; |
|
2586 } |
|
2587 else |
|
2588 { |
|
2589 resourceId = R_IM_VOIP_APP_TOOLBAR; |
|
2590 } |
|
2591 if ( resourceId != 0 && !iFixedToolbar ) |
|
2592 { |
|
2593 CAknToolbar* temp = iFixedToolbar; |
|
2594 |
|
2595 iFixedToolbar = CAknToolbar::NewL( resourceId ); |
|
2596 iFixedToolbar->SetToolbarObserver( this ); |
|
2597 iFixedToolbar->SetCloseOnAllCommands( EFalse ); |
|
2598 CEikAppUiFactory* appUiFactory = |
|
2599 static_cast<CEikAppUiFactory*>(CEikonEnv::Static()->AppUiFactory() ); |
|
2600 appUiFactory->SetViewFixedToolbar( iFixedToolbar ); |
|
2601 |
|
2602 iFixedToolbar->SetToolbarVisibility( EFalse, EFalse ); |
|
2603 delete temp; |
|
2604 temp = NULL; |
|
2605 } |
|
2606 } |
|
2607 else |
|
2608 { |
|
2609 delete iFixedToolbar; |
|
2610 iFixedToolbar = NULL; |
|
2611 } |
|
2612 } |
|
2613 |
|
2614 // --------------------------------------------------------- |
|
2615 // CVIMPSTUiTabbedView::UpdateToolbarL |
|
2616 // --------------------------------------------------------- |
|
2617 // |
|
2618 void CVIMPSTUiTabbedView::UpdateToolbarL() |
|
2619 { |
|
2620 TRACER_AUTO; |
|
2621 if ( AknLayoutUtils::PenEnabled() && iFixedToolbar && iContainer ) |
|
2622 { |
|
2623 TInt currentItemIndex = iContainer->CurrentItemIndex(); |
|
2624 TVIMPSTEnums::TItem itemType = iCommandHandler.GetProcessInterface().GetType(currentItemIndex); |
|
2625 TVIMPSTEnums::TOnlineStatus onlinestatus = iCommandHandler.GetProcessInterface().GetOnlineStatusL(currentItemIndex); |
|
2626 TBool imEnabled = iEngine.IsSubServiceEnabled(TVIMPSTEnums::EIM); |
|
2627 TBool voipEnabled = iEngine.IsSubServiceEnabled(TVIMPSTEnums::EVoip); |
|
2628 TPtrC selectedItem = iCommandHandler.GetProcessInterface().GetItemUserId(currentItemIndex); |
|
2629 |
|
2630 if(voipEnabled && imEnabled) |
|
2631 { |
|
2632 if( TVIMPSTEnums::EOwnStatusItem == itemType || |
|
2633 TVIMPSTEnums::EFriendRequestItem == itemType || |
|
2634 KErrNotFound == currentItemIndex ) |
|
2635 { |
|
2636 iFixedToolbar->SetItemDimmed( ECmdToolbarVoipCall, ETrue, EFalse ); |
|
2637 iFixedToolbar->SetItemDimmed( ECmdToolbarChat, ETrue, EFalse ); |
|
2638 iFixedToolbar->SetItemDimmed( ECmdToolbarDetails, ETrue, EFalse ); |
|
2639 } |
|
2640 else if( TVIMPSTEnums::EUnknonContactItem == itemType ) |
|
2641 { |
|
2642 iFixedToolbar->SetItemDimmed(ECmdToolbarVoipCall, EFalse, EFalse); |
|
2643 iFixedToolbar->SetItemDimmed(ECmdToolbarChat, EFalse, EFalse); |
|
2644 iFixedToolbar->SetItemDimmed(ECmdToolbarDetails, ETrue, EFalse); |
|
2645 } |
|
2646 else if( TVIMPSTEnums::EContactItem == itemType ) |
|
2647 { |
|
2648 if( selectedItem != KNullDesC && TVIMPSTEnums::EServiceOut != onlinestatus ) |
|
2649 { |
|
2650 |
|
2651 iFixedToolbar->SetItemDimmed(ECmdToolbarChat, EFalse, EFalse); |
|
2652 } |
|
2653 else |
|
2654 { |
|
2655 iFixedToolbar->SetItemDimmed(ECmdToolbarChat, ETrue, EFalse); |
|
2656 } |
|
2657 iFixedToolbar->SetItemDimmed(ECmdToolbarDetails, EFalse, EFalse); |
|
2658 iFixedToolbar->SetItemDimmed(ECmdToolbarVoipCall, EFalse, EFalse); |
|
2659 } |
|
2660 else |
|
2661 { |
|
2662 iFixedToolbar->SetItemDimmed(ECmdToolbarVoipCall, ETrue, EFalse); |
|
2663 iFixedToolbar->SetItemDimmed(ECmdToolbarChat, ETrue, EFalse); |
|
2664 iFixedToolbar->SetItemDimmed(ECmdToolbarDetails, EFalse, EFalse); |
|
2665 } |
|
2666 } |
|
2667 else if(imEnabled && !voipEnabled) |
|
2668 { |
|
2669 if( TVIMPSTEnums::EOwnStatusItem == itemType || |
|
2670 TVIMPSTEnums::EFriendRequestItem == itemType || |
|
2671 KErrNotFound == currentItemIndex) |
|
2672 { |
|
2673 iFixedToolbar->SetItemDimmed( ECmdToolbarChat, ETrue, EFalse ); |
|
2674 iFixedToolbar->SetItemDimmed( ECmdToolbarDetails, ETrue, EFalse ); |
|
2675 } |
|
2676 else if( TVIMPSTEnums::EUnknonContactItem == itemType ) |
|
2677 { |
|
2678 iFixedToolbar->SetItemDimmed(ECmdToolbarChat, EFalse, EFalse); |
|
2679 iFixedToolbar->SetItemDimmed(ECmdToolbarDetails, ETrue, EFalse); |
|
2680 } |
|
2681 else if( TVIMPSTEnums::EContactItem == itemType ) |
|
2682 { |
|
2683 iFixedToolbar->SetItemDimmed( ECmdToolbarDetails, EFalse, EFalse ); |
|
2684 if( selectedItem != KNullDesC && TVIMPSTEnums::EServiceOut != onlinestatus ) |
|
2685 { |
|
2686 iFixedToolbar->SetItemDimmed(ECmdToolbarChat, EFalse, EFalse); |
|
2687 } |
|
2688 else |
|
2689 { |
|
2690 iFixedToolbar->SetItemDimmed(ECmdToolbarChat, ETrue, EFalse); |
|
2691 } |
|
2692 } |
|
2693 } |
|
2694 else if( voipEnabled && !imEnabled ) |
|
2695 { |
|
2696 if( (TVIMPSTEnums::EOwnStatusItem == itemType || |
|
2697 TVIMPSTEnums::EFriendRequestItem == itemType || |
|
2698 KErrNotFound == currentItemIndex) && !iAddContact ) |
|
2699 { |
|
2700 iFixedToolbar->SetItemDimmed( ECmdToolbarNewContact, EFalse, EFalse ); |
|
2701 iFixedToolbar->SetItemDimmed( ECmdToolbarVoipCall, ETrue, EFalse ); |
|
2702 iFixedToolbar->SetItemDimmed( ECmdToolbarDetails, ETrue, EFalse ); |
|
2703 } |
|
2704 else if( TVIMPSTEnums::EUnknonContactItem == itemType ) |
|
2705 { |
|
2706 iFixedToolbar->SetItemDimmed( ECmdToolbarNewContact, EFalse, EFalse ); |
|
2707 iFixedToolbar->SetItemDimmed(ECmdToolbarVoipCall, EFalse, EFalse ); |
|
2708 iFixedToolbar->SetItemDimmed(ECmdToolbarDetails, ETrue, EFalse); |
|
2709 } |
|
2710 else if( TVIMPSTEnums::EContactItem == itemType ) |
|
2711 { |
|
2712 iFixedToolbar->SetItemDimmed( ECmdToolbarNewContact, EFalse, EFalse ); |
|
2713 iFixedToolbar->SetItemDimmed( ECmdToolbarDetails, EFalse, EFalse ); |
|
2714 iFixedToolbar->SetItemDimmed(ECmdToolbarVoipCall, EFalse, EFalse); |
|
2715 } |
|
2716 } |
|
2717 else |
|
2718 { |
|
2719 if( (TVIMPSTEnums::EOwnStatusItem == itemType || |
|
2720 TVIMPSTEnums::EFriendRequestItem == itemType || |
|
2721 KErrNotFound == currentItemIndex) && !iAddContact ) |
|
2722 { |
|
2723 iFixedToolbar->SetItemDimmed( ECmdToolbarNewContact, EFalse, EFalse ); |
|
2724 } |
|
2725 else if( TVIMPSTEnums::EUnknonContactItem == itemType ) |
|
2726 { |
|
2727 iFixedToolbar->SetItemDimmed( ECmdToolbarNewContact, EFalse, EFalse); |
|
2728 } |
|
2729 else |
|
2730 { |
|
2731 iFixedToolbar->SetItemDimmed( ECmdToolbarNewContact, EFalse, EFalse ); |
|
2732 iFixedToolbar->SetItemDimmed( ECmdToolbarDetails, EFalse, EFalse ); |
|
2733 } |
|
2734 } |
|
2735 iFixedToolbar->DrawNow(); |
|
2736 } |
|
2737 } |
|
2738 // --------------------------------------------------------- |
|
2739 // CVIMPSTUiTabbedView::DynInitToolbarL |
|
2740 // --------------------------------------------------------- |
|
2741 // |
|
2742 void CVIMPSTUiTabbedView::DynInitToolbarL( TInt /*aResourceId*/, CAknToolbar* /*aToolbar*/ ) |
|
2743 { |
|
2744 if ( AknLayoutUtils::PenEnabled() ) |
|
2745 { |
|
2746 UpdateToolbarL(); |
|
2747 } |
|
2748 } |
|
2749 |
|
2750 // --------------------------------------------------------- |
|
2751 // CVIMPSTUiTabbedView::OfferToolbarEventL |
|
2752 // --------------------------------------------------------- |
|
2753 // |
|
2754 void CVIMPSTUiTabbedView::OfferToolbarEventL( TInt aCommand ) |
|
2755 { |
|
2756 TRACER_AUTO; |
|
2757 if ( AknLayoutUtils::PenEnabled() ) |
|
2758 { |
|
2759 switch( aCommand ) |
|
2760 { |
|
2761 case ECmdToolbarVoipCall: |
|
2762 { |
|
2763 MakeVoipCallL(); |
|
2764 break; |
|
2765 } |
|
2766 case ECmdToolbarChat: |
|
2767 { |
|
2768 HandleCommandL( ECmdOpenConversation ); |
|
2769 break; |
|
2770 } |
|
2771 case ECmdToolbarDetails: |
|
2772 { |
|
2773 HandleCommandL( ECmdContactDetails );//EChatLaunchCCA |
|
2774 |
|
2775 break; |
|
2776 } |
|
2777 case ECmdToolbarNewContact: |
|
2778 { |
|
2779 HandleCommandL ( ECmdAddContact ); |
|
2780 break; |
|
2781 } |
|
2782 } |
|
2783 } |
|
2784 } |
|
2785 |
|
2786 // --------------------------------------------------------- |
|
2787 // CVIMPSTUiTabbedView::ShowHideFixedToolbarL |
|
2788 // --------------------------------------------------------- |
|
2789 // |
|
2790 void CVIMPSTUiTabbedView::ShowHideFixedToolbarL(TBool aShow) |
|
2791 { |
|
2792 if ( iFixedToolbar && iContainer ) |
|
2793 { |
|
2794 iFixedToolbar->HideItemsAndDrawOnlyBackground( !aShow ); |
|
2795 if(aShow) |
|
2796 { |
|
2797 iFixedToolbar->SetToolbarVisibility( aShow, !aShow); |
|
2798 } |
|
2799 iContainer->CoeControl()->SetRect( iView.ClientRect() ); |
|
2800 iContainer->CoeControl()->DrawDeferred(); |
|
2801 iIsToolBarHidden = !aShow; |
|
2802 } |
|
2803 |
|
2804 } |
|
2805 |
|
2806 // --------------------------------------------------------- |
|
2807 // CVIMPSTUiTabbedView::ProcessFriendRequestL |
|
2808 // --------------------------------------------------------- |
|
2809 // |
|
2810 void CVIMPSTUiTabbedView::ProcessFriendRequestL() |
|
2811 { |
|
2812 TRACER_AUTO; |
|
2813 TInt index = CurrentItemIndex(); |
|
2814 if( index <= 0 ) |
|
2815 { |
|
2816 // return if item not found |
|
2817 return; |
|
2818 } |
|
2819 MVIMPSTProcessArray& arrayprocess = iCommandHandler.GetProcessInterface(); |
|
2820 if( iFriendRequestId ) |
|
2821 { |
|
2822 delete iFriendRequestId; |
|
2823 iFriendRequestId = NULL; |
|
2824 } |
|
2825 iFriendRequestId = arrayprocess.GetItemUserId(index).AllocL() ; |
|
2826 |
|
2827 if( !iFriendRequestId ) |
|
2828 { |
|
2829 return; |
|
2830 } |
|
2831 |
|
2832 HBufC* queryTxt = StringLoader::LoadLC( R_SERVTAB_FRIEND_REQUEST_CONF, *iFriendRequestId ); |
|
2833 |
|
2834 //ask the query and send the response back to the server. |
|
2835 TInt response = VIMPSTUtilsDialog::DisplayQueryDialogL(R_SERVTAB_GENERIC_ACCEPT_DECLINE_CONFIRMATION_QUERY,*queryTxt); |
|
2836 CleanupStack::PopAndDestroy(queryTxt); |
|
2837 |
|
2838 if((EAknSoftkeyYes == response)||(EAknSoftkeyOk == response ) ) |
|
2839 { |
|
2840 |
|
2841 MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL( iEngine.ServiceId() ) ; |
|
2842 if( storage && storage->IsLocalStore() )//if local store popup create new/update existing dialog |
|
2843 { |
|
2844 iSelectedAction = ShowNewUpdateQueryL(); |
|
2845 TUint assignFlags = 0; |
|
2846 if(CVIMPSTUiTabbedView::EInvitAcceptCreateNew == iSelectedAction )//create new option |
|
2847 { |
|
2848 assignFlags |= ECreateNewContact; |
|
2849 } |
|
2850 else if(CVIMPSTUiTabbedView::EInvitAcceptUpdateExisting == iSelectedAction ) //if update existing is selected |
|
2851 { |
|
2852 assignFlags = 0; |
|
2853 } |
|
2854 else //if the selection dialog is cancelled then just do nothing |
|
2855 { |
|
2856 return; |
|
2857 } |
|
2858 //show the phonebook dialog for create new/update existing option |
|
2859 if(iAiwParamList) |
|
2860 { |
|
2861 delete iAiwParamList; |
|
2862 iAiwParamList = NULL; |
|
2863 } |
|
2864 iAiwParamList = CAiwGenericParamList::NewL(); |
|
2865 |
|
2866 iAiwParamList->AppendL( |
|
2867 TAiwGenericParam( |
|
2868 EGenericParamContactAssignData, |
|
2869 TAiwVariant(TAiwSingleContactAssignDataV1Pckg( |
|
2870 TAiwSingleContactAssignDataV1().SetFlags( assignFlags ))))); |
|
2871 |
|
2872 TBuf<KBufLen> xspId; //xsp max length |
|
2873 xspId.Append(iEngine.ServiceName()); |
|
2874 xspId.Append(KColon); |
|
2875 xspId.Append(*iFriendRequestId); |
|
2876 |
|
2877 iAiwParamList->AppendL( |
|
2878 TAiwGenericParam( |
|
2879 EGenericParamXSpId, |
|
2880 TAiwVariant(xspId)) |
|
2881 ); |
|
2882 ReInitializeServiceHandlerL(); |
|
2883 iServiceHandler->ExecuteServiceCmdL( |
|
2884 KAiwCmdAssign, |
|
2885 *iAiwParamList, |
|
2886 iServiceHandler->OutParamListL(), |
|
2887 0, |
|
2888 this); |
|
2889 // remove of friend request is done in HnadleNotify aiw call back |
|
2890 // to handle the cancel of selection dialog |
|
2891 } |
|
2892 else // in case of server store |
|
2893 { |
|
2894 if( iWaitNote ) |
|
2895 { |
|
2896 delete iWaitNote; |
|
2897 iWaitNote = NULL; |
|
2898 } |
|
2899 iWaitNote = CVIMPSTUtilsWaitNote::ShowWaitNoteL( R_QTN_SERVTAB_SAVING_CONTACT, ETrue, EFalse ); |
|
2900 iCommandHandler.HandleCommandL(EFriendAccpeted, this, iFriendRequestId); |
|
2901 } |
|
2902 |
|
2903 } |
|
2904 //response value comes as zero if user rejects the request |
|
2905 else if( EAknSoftkeyCancel == response || 0 == response) // rejected the request |
|
2906 { |
|
2907 if(iWaitNote) |
|
2908 { |
|
2909 delete iWaitNote; |
|
2910 iWaitNote = NULL; |
|
2911 } |
|
2912 iWaitNote = CVIMPSTUtilsWaitNote::ShowWaitNoteL( R_QTN_SERVTAB_DECLINING_INVITE, ETrue , EFalse );; |
|
2913 iCommandHandler.HandleCommandL(EFriendRejected, this, iFriendRequestId ); |
|
2914 } |
|
2915 |
|
2916 |
|
2917 } |
|
2918 |
|
2919 // --------------------------------------------------------- |
|
2920 // CVIMPSTUiTabbedView::HandleSearchResultL() |
|
2921 // --------------------------------------------------------- |
|
2922 // |
|
2923 void CVIMPSTUiTabbedView::HandleSearchResultL(RArray<TVIMPSTSearchData> /*aSearchData*/ ) |
|
2924 { |
|
2925 // no implemetation |
|
2926 } |
|
2927 |
|
2928 |
|
2929 // --------------------------------------------------------- |
|
2930 // CVIMPSTUiTabbedView::HandleSearchFinishedL() |
|
2931 // --------------------------------------------------------- |
|
2932 // |
|
2933 void CVIMPSTUiTabbedView::HandleSearchFinishedL(TInt /*aError*/) |
|
2934 { |
|
2935 // no implemetation |
|
2936 } |
|
2937 |
|
2938 // --------------------------------------------------------- |
|
2939 // CVIMPSTUiSearchView::HandleSearchKeysEventL() |
|
2940 // --------------------------------------------------------- |
|
2941 // |
|
2942 void CVIMPSTUiTabbedView::HandleSearchKeysEventL( RArray<TInt>& aEnumKeysArray, RPointerArray<HBufC>& aLebelKeysArray ) |
|
2943 { |
|
2944 iExtensionService.SetSearchFieldsDataL(aEnumKeysArray, aLebelKeysArray ); |
|
2945 } |
|
2946 |
|
2947 // --------------------------------------------------------- |
|
2948 // CVIMPSTUiSearchView::ShowURLQueryL() |
|
2949 // --------------------------------------------------------- |
|
2950 // |
|
2951 void CVIMPSTUiTabbedView::ShowURLQueryL( ) |
|
2952 { |
|
2953 TRACER_AUTO; |
|
2954 // Open browser with the specified URL |
|
2955 RBuf buffer; |
|
2956 buffer.CreateL( RProperty::KMaxPropertySize ); |
|
2957 CleanupClosePushL( buffer ); |
|
2958 iSettingsStore->GetL(iServiceId, EServiceURLLink, buffer); |
|
2959 HBufC16* url = HBufC::NewL(buffer.Length()); |
|
2960 url = buffer.Alloc(); |
|
2961 OpenWebBrowserL( *url ); |
|
2962 CleanupStack::PopAndDestroy( ); //buffer |
|
2963 } |
|
2964 |
|
2965 // ----------------------------------------------------------------------------- |
|
2966 // CVIMPSTUiTabbedView::OpenWebBrowserL |
|
2967 // ----------------------------------------------------------------------------- |
|
2968 // |
|
2969 void CVIMPSTUiTabbedView::OpenWebBrowserL( const TDesC& aUrl ) |
|
2970 { |
|
2971 if( !iBrLauncher ) |
|
2972 { |
|
2973 iBrLauncher = CBrowserLauncher::NewL(); |
|
2974 } |
|
2975 //Asynchronous operation to launch the browser with aUrl |
|
2976 iBrLauncher->LaunchBrowserEmbeddedL( aUrl,this,this ); |
|
2977 } |
|
2978 |
|
2979 |
|
2980 // ----------------------------------------------------------------------------- |
|
2981 // CVIMPSTUiTabbedView::LoginL |
|
2982 // ----------------------------------------------------------------------------- |
|
2983 // |
|
2984 void CVIMPSTUiTabbedView::LoginL() |
|
2985 { |
|
2986 TRACER_AUTO; |
|
2987 TBool IsPasswordSet = iEngine.IsPasswordAvailableL(); |
|
2988 |
|
2989 if(iUserId) |
|
2990 { |
|
2991 delete iUserId; |
|
2992 iUserId = NULL; |
|
2993 } |
|
2994 |
|
2995 iUserId = iEngine.GetOwnUserIdFromCChOrStorageL(); |
|
2996 |
|
2997 |
|
2998 TBool urlNeedtoShow = IsURLQueryToBeShownL(); |
|
2999 //first login : userid is not initialized and password is not set. |
|
3000 TBool doLogin = ETrue; |
|
3001 if( urlNeedtoShow && (!IsPasswordSet) && (iUserId->Length() == 0)) |
|
3002 { |
|
3003 TInt menuChoise( KErrCancel ); |
|
3004 ShowUseExistingOrCreateNewMenuL( menuChoise ); |
|
3005 switch(menuChoise ) |
|
3006 { |
|
3007 case CVIMPSTUiTabbedView::EXmppMenuValuesCreateNew: |
|
3008 { |
|
3009 doLogin = EFalse; |
|
3010 ShowURLQueryL(); |
|
3011 break; |
|
3012 } |
|
3013 case CVIMPSTUiTabbedView::EXmppMenuValuesUseExisting: |
|
3014 { |
|
3015 // login must be called |
|
3016 doLogin = ETrue; |
|
3017 break; |
|
3018 } |
|
3019 default: // user has cancelled the createnew and i have acccount query |
|
3020 doLogin = EFalse; |
|
3021 break; |
|
3022 } |
|
3023 } |
|
3024 if( doLogin ) |
|
3025 { |
|
3026 TInt error = ShowTermsofuseL(); |
|
3027 if(KErrNone == error) |
|
3028 { |
|
3029 if( urlNeedtoShow ) |
|
3030 { |
|
3031 // Url query has been shown and accep by user |
|
3032 iSettingsStore->SetL(iServiceId, EURLRegistrationOff, ETrue); |
|
3033 } |
|
3034 iCommandHandler.HandleCommandL(ELoginService, this, &iServiceId); |
|
3035 } |
|
3036 } |
|
3037 } |
|
3038 |
|
3039 |
|
3040 // ----------------------------------------------------------------------------- |
|
3041 // CVIMPSTUiTabbedView::IsURLQueryToBeShownL |
|
3042 // ----------------------------------------------------------------------------- |
|
3043 // |
|
3044 TBool CVIMPSTUiTabbedView::IsURLQueryToBeShownL() |
|
3045 { |
|
3046 TRACER_AUTO; |
|
3047 TBool urlQueryShown = EFalse; |
|
3048 |
|
3049 RBuf buffer; |
|
3050 buffer.CreateL( RProperty::KMaxPropertySize ); |
|
3051 CleanupClosePushL( buffer ); |
|
3052 iSettingsStore->GetL(iServiceId, EServiceURLLink, buffer); |
|
3053 |
|
3054 //get the url from the cenrep. |
|
3055 TInt isURLQueryDisabled = EFalse; |
|
3056 iSettingsStore->GetL(iServiceId, EURLRegistrationOff, isURLQueryDisabled); |
|
3057 |
|
3058 if(buffer.Length() && !isURLQueryDisabled) |
|
3059 { |
|
3060 urlQueryShown = ETrue; |
|
3061 } |
|
3062 CleanupStack::PopAndDestroy(); //buffer |
|
3063 return urlQueryShown; |
|
3064 } |
|
3065 |
|
3066 // --------------------------------------------------------------------------- |
|
3067 // CVIMPSTUiTabbedView::ShowUseExistingOrCreateNewMenuL |
|
3068 // return values <0 -> error |
|
3069 // 0 -> use existing |
|
3070 // 1 -> create new |
|
3071 // --------------------------------------------------------------------------- |
|
3072 // |
|
3073 void CVIMPSTUiTabbedView::ShowUseExistingOrCreateNewMenuL( TInt& aMenuChoise ) |
|
3074 { |
|
3075 TRACER_AUTO; |
|
3076 TInt rvalue( KErrGeneral ); |
|
3077 |
|
3078 CAknSinglePopupMenuStyleListBox* accountList = |
|
3079 new ( ELeave ) CAknSinglePopupMenuStyleListBox; |
|
3080 CleanupStack::PushL( accountList ); |
|
3081 |
|
3082 CAknPopupList* popupList = |
|
3083 CAknPopupList::NewL( accountList, R_AVKON_SOFTKEYS_OK_BACK ); |
|
3084 CleanupStack::PushL( popupList ); |
|
3085 |
|
3086 accountList->ConstructL( popupList, EAknListBoxMenuList); |
|
3087 |
|
3088 // construct listbox item array |
|
3089 CDesCArray *itemList = new (ELeave) CDesCArrayFlat( 2 ); |
|
3090 CleanupStack::PushL( itemList ); |
|
3091 TBuf<KMaxListItemLength> item; |
|
3092 |
|
3093 // First listbox item |
|
3094 HBufC* text1 = StringLoader::LoadLC( R_QTN_USE_EXISTING ); |
|
3095 itemList->AppendL( *text1 ); |
|
3096 CleanupStack::PopAndDestroy( text1 ); |
|
3097 |
|
3098 // Second listbox item |
|
3099 HBufC* text2 = StringLoader::LoadLC( R_QTN_CREATE_NEW ); |
|
3100 itemList->AppendL( *text2 ); |
|
3101 CleanupStack::PopAndDestroy( text2 ); |
|
3102 |
|
3103 // Set items and ownership |
|
3104 accountList->Model()->SetItemTextArray( itemList ); |
|
3105 accountList->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
|
3106 CleanupStack::Pop( itemList ); |
|
3107 |
|
3108 HBufC* title = StringLoader::LoadLC( R_QTN_SELECT_ACTION ); |
|
3109 popupList->SetTitleL( *title ); |
|
3110 CleanupStack::PopAndDestroy( title ); |
|
3111 |
|
3112 TInt popupOk = popupList->ExecuteLD(); |
|
3113 |
|
3114 if ( popupOk ) |
|
3115 { |
|
3116 rvalue = accountList->CurrentItemIndex(); |
|
3117 } |
|
3118 else |
|
3119 { |
|
3120 rvalue = KErrCancel; |
|
3121 } |
|
3122 |
|
3123 CleanupStack::Pop( popupList ); |
|
3124 CleanupStack::PopAndDestroy( accountList ); |
|
3125 |
|
3126 aMenuChoise = rvalue; |
|
3127 } |
|
3128 // --------------------------------------------------------------------------- |
|
3129 // CVIMPSTUiTabbedView::ShowNewUpdateQueryL |
|
3130 // return values <0 -> error |
|
3131 // 0 ->create new |
|
3132 // 1 -> update existing |
|
3133 // --------------------------------------------------------------------------- |
|
3134 // |
|
3135 TInt CVIMPSTUiTabbedView::ShowNewUpdateQueryL() |
|
3136 { |
|
3137 TRACER_AUTO; |
|
3138 TInt retValue( KErrCancel ); |
|
3139 |
|
3140 CAknSinglePopupMenuStyleListBox* selectionList = |
|
3141 new ( ELeave ) CAknSinglePopupMenuStyleListBox; |
|
3142 CleanupStack::PushL( selectionList ); |
|
3143 |
|
3144 CAknPopupList* popupList = CAknPopupList::NewL( |
|
3145 selectionList, |
|
3146 R_AVKON_SOFTKEYS_SELECT_CANCEL ); |
|
3147 CleanupStack::PushL( popupList ); |
|
3148 |
|
3149 selectionList->ConstructL( popupList, EAknListBoxMenuList ); |
|
3150 |
|
3151 // construct listbox item array |
|
3152 CDesCArray *itemList = new (ELeave) CDesCArrayFlat( 2 ); |
|
3153 CleanupStack::PushL( itemList ); |
|
3154 |
|
3155 // First listbox item |
|
3156 HBufC* newItem = StringLoader::LoadLC( R_QTN_CREATE_NEW_CONTACT ); |
|
3157 itemList->AppendL( *newItem ); |
|
3158 CleanupStack::PopAndDestroy( newItem ); |
|
3159 |
|
3160 // Second listbox item |
|
3161 HBufC* updateItem = StringLoader::LoadLC( R_QTN_UPDATE_EXISTING ); |
|
3162 itemList->AppendL( *updateItem ); |
|
3163 CleanupStack::PopAndDestroy( updateItem ); |
|
3164 |
|
3165 // Set items and ownership |
|
3166 selectionList->Model()->SetItemTextArray( itemList ); |
|
3167 selectionList->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
|
3168 CleanupStack::Pop( itemList ); // ownership is transfered to selectionList |
|
3169 |
|
3170 HBufC* title = StringLoader::LoadLC( R_QTN_SELECT_ACTION ); |
|
3171 popupList->SetTitleL( *title ); |
|
3172 CleanupStack::PopAndDestroy( title ); |
|
3173 |
|
3174 TInt response = popupList->ExecuteLD(); |
|
3175 |
|
3176 if ( response ) |
|
3177 { |
|
3178 retValue = selectionList->CurrentItemIndex(); |
|
3179 } |
|
3180 CleanupStack::Pop( popupList ); // onership given to selectionList |
|
3181 CleanupStack::PopAndDestroy( selectionList ); // selectionList |
|
3182 |
|
3183 return retValue; |
|
3184 } |
|
3185 // CVIMPSTUiTabbedView::ShowLoginDialogL |
|
3186 // --------------------------------------------------------------------------- |
|
3187 // |
|
3188 void CVIMPSTUiTabbedView::ShowLoginDialogL( TDes& aUserName, TDes& aPassword ) |
|
3189 { |
|
3190 TRACER_AUTO; |
|
3191 HBufC* userName = HBufC::NewLC( KUsernameMaxLength ); |
|
3192 HBufC* passWord = HBufC::NewLC( KPasswordMaxLength ); |
|
3193 |
|
3194 TPtr ptrUserName = userName->Des(); |
|
3195 TPtr ptrPassWord = passWord->Des(); |
|
3196 |
|
3197 if( aUserName.Length()== 0 ) |
|
3198 { |
|
3199 CAknMultiLineDataQueryDialog* dlg = CAknMultiLineDataQueryDialog::NewL( ptrUserName, |
|
3200 ptrPassWord ); |
|
3201 if ( dlg->ExecuteLD( R_LOGIN_DIALOG ) ) |
|
3202 { |
|
3203 aUserName.Copy( ptrUserName.LeftTPtr( aUserName.MaxLength() ) ); |
|
3204 aPassword.Copy( ptrPassWord.LeftTPtr( aPassword.MaxLength() ) ); |
|
3205 } |
|
3206 else |
|
3207 { |
|
3208 User::Leave( KErrCancel ); |
|
3209 } |
|
3210 } |
|
3211 else |
|
3212 { |
|
3213 CAknMultiLineDataQueryDialog* dlg = CAknMultiLineDataQueryDialog::NewL( aUserName, |
|
3214 aPassword ); |
|
3215 if ( dlg->ExecuteLD( R_LOGIN_DIALOG ) ) |
|
3216 { |
|
3217 aUserName.Copy( aUserName.LeftTPtr( aUserName.MaxLength() ) ); |
|
3218 aPassword.Copy( aPassword.LeftTPtr( aPassword.MaxLength() ) ); |
|
3219 } |
|
3220 else |
|
3221 { |
|
3222 User::Leave( KErrCancel ); |
|
3223 } |
|
3224 } |
|
3225 CleanupStack::PopAndDestroy( passWord ); |
|
3226 CleanupStack::PopAndDestroy( userName ); |
|
3227 } |
|
3228 // ---------------------------------------------------- |
|
3229 // CVIMPSTUiTabbedView::HandleContentL |
|
3230 // Handles the content coming from the embedded browser. |
|
3231 // Returns EFalse: content will be passed on to framework |
|
3232 // ---------------------------------------------------- |
|
3233 // |
|
3234 TBool CVIMPSTUiTabbedView::HandleContentL( |
|
3235 const TDesC& /*aFileName*/, |
|
3236 const CAiwGenericParamList& /*aParamList*/, |
|
3237 TBool& aContinue ) |
|
3238 { |
|
3239 // Close browser after downloading content |
|
3240 aContinue = EFalse; |
|
3241 return EFalse; |
|
3242 } |
|
3243 |
|
3244 // ---------------------------------------------------- |
|
3245 // CVIMPSTUiTabbedView::DownloadedContentHandlerReserved1 |
|
3246 // ( Reserved for future use ) |
|
3247 // ---------------------------------------------------- |
|
3248 // |
|
3249 TAny* CVIMPSTUiTabbedView::DownloadedContentHandlerReserved1( TAny* /*aAnyParam*/ ) |
|
3250 { |
|
3251 // Empty implementation. |
|
3252 return NULL; |
|
3253 } |
|
3254 |
|
3255 // --------------------------------------------------------------------------- |
|
3256 // CVIMPSTUiTabbedView::CloseConversation |
|
3257 // --------------------------------------------------------------------------- |
|
3258 // |
|
3259 void CVIMPSTUiTabbedView::CloseConversationL() |
|
3260 { |
|
3261 TRACER_AUTO; |
|
3262 TInt index = CurrentItemIndex(); |
|
3263 if( index <= 0 ) |
|
3264 { |
|
3265 // return if item not found |
|
3266 return; |
|
3267 } |
|
3268 MVIMPSTProcessArray& arrayprocess = iCommandHandler.GetProcessInterface(); |
|
3269 TPtrC itemId = arrayprocess.GetItemUserId(index); |
|
3270 |
|
3271 if(itemId.Length() == 0) |
|
3272 { |
|
3273 return; |
|
3274 } |
|
3275 |
|
3276 HBufC* queryTxt = StringLoader::LoadLC( R_QTN_SERVTAB_CLOSE_CONV, itemId ); |
|
3277 |
|
3278 //ask the query and send the response back to the server. |
|
3279 TInt response = VIMPSTUtilsDialog::DisplayQueryDialogL(R_GENERIC_YES_NO_CONFIRMATION_QUERY,*queryTxt); |
|
3280 CleanupStack::PopAndDestroy(queryTxt); |
|
3281 |
|
3282 if( (EAknSoftkeyYes == response)||(EAknSoftkeyOk == response ) ) |
|
3283 { |
|
3284 iCommandHandler.HandleCommandL(ECloseConversation, this, &itemId ); |
|
3285 } |
|
3286 |
|
3287 } |
|
3288 |
|
3289 // ---------------------------------------------------- |
|
3290 // CVIMPSTUiTabbedView::HandleServerAppExit |
|
3291 // ( Reserved for future use ) |
|
3292 // ---------------------------------------------------- |
|
3293 // |
|
3294 void CVIMPSTUiTabbedView::HandleServerAppExit( TInt /*aReason*/ ) |
|
3295 { |
|
3296 TRACER_AUTO; |
|
3297 TInt error = KErrNone; |
|
3298 TRAPD(leaveErr,error = ShowTermsofuseL()); |
|
3299 if(KErrNone == error && KErrNone == leaveErr) |
|
3300 { |
|
3301 TRAP_IGNORE(iCommandHandler.HandleCommandL(ELoginService, this, &iServiceId)); |
|
3302 } |
|
3303 } |
|
3304 |
|
3305 // ---------------------------------------------------- |
|
3306 // CVIMPSTUiTabbedView::ShowTermsofuseL |
|
3307 // ( Reserved for future use ) |
|
3308 // ---------------------------------------------------- |
|
3309 // |
|
3310 TInt CVIMPSTUiTabbedView::ShowTermsofuseL() |
|
3311 { |
|
3312 TRACER_AUTO; |
|
3313 TInt retVal = KErrNone; |
|
3314 // get the ETOUDlgOff if its set don't show TOU dialog else show TOU |
|
3315 TInt termsOfUseDisabled = KErrNone; |
|
3316 iSettingsStore->GetL(iServiceId, ETOUDlgOff, termsOfUseDisabled); |
|
3317 if( !termsOfUseDisabled) |
|
3318 { |
|
3319 HBufC* termsOfUsetext = iBrandHandler->GetToUStringL(); |
|
3320 if( termsOfUsetext ) |
|
3321 { |
|
3322 CleanupStack::PushL(termsOfUsetext); |
|
3323 retVal = CVIMPSTUiTermsOfUseDialogHandler::HandleTermsOfUseDialogLD( |
|
3324 *iSettingsStore, |
|
3325 *iUserId, |
|
3326 iServiceId, |
|
3327 termsOfUsetext ); // termsOfUsetext ownership is transfered |
|
3328 CleanupStack::Pop(); // termsOfUsetext ownership is transfered |
|
3329 } |
|
3330 } |
|
3331 return retVal; |
|
3332 } |
|
3333 // ---------------------------------------------------- |
|
3334 // CVIMPSTUiTabbedView::MakeVoipCallL |
|
3335 // ( Reserved for future use ) |
|
3336 // ---------------------------------------------------- |
|
3337 // |
|
3338 void CVIMPSTUiTabbedView::MakeVoipCallL() |
|
3339 { |
|
3340 TRACER_AUTO; |
|
3341 // making voip call will take in three steps |
|
3342 // pop up the selection dialog |
|
3343 // select adress |
|
3344 // create a call |
|
3345 TInt index = CurrentItemIndex(); |
|
3346 //Index should always be greater than zero |
|
3347 //Negative index means item not found. |
|
3348 if(index <= 0 ) |
|
3349 { |
|
3350 return; |
|
3351 } |
|
3352 MVIMPSTProcessArray& processArray = iCommandHandler.GetProcessInterface(); |
|
3353 TVIMPSTEnums::TItem itemType = processArray.GetType( index ) ; |
|
3354 |
|
3355 if( itemType == TVIMPSTEnums::EContactItem ) |
|
3356 { |
|
3357 iSelectedAction = CVIMPSTUiTabbedView::ECreateXSPCall; |
|
3358 TUint fetchFlags = 0; |
|
3359 TAiwSingleItemSelectionDataV3 data; |
|
3360 data.SetFlags(fetchFlags); |
|
3361 data.SetCommAddressSelectType(EAiwCommVOIPCall); |
|
3362 ReInitializeServiceHandlerL(); |
|
3363 CAiwGenericParamList& inParamList = iServiceHandler->InParamListL(); |
|
3364 // Set service data |
|
3365 inParamList.AppendL(TAiwGenericParam(EGenericParamContactSelectionData, |
|
3366 TAiwVariant(TAiwSingleItemSelectionDataV3Pckg(data)))); |
|
3367 |
|
3368 HBufC8* pack = processArray.ContactLink(index )->PackLC(); |
|
3369 // Set contactlink |
|
3370 inParamList.AppendL(TAiwGenericParam(EGenericParamContactLinkArray, |
|
3371 TAiwVariant(*pack))); |
|
3372 |
|
3373 iServiceHandler->ExecuteServiceCmdL(KAiwCmdSelect, inParamList, |
|
3374 iServiceHandler->OutParamListL(), 0, this); |
|
3375 CleanupStack::PopAndDestroy( pack ); |
|
3376 } |
|
3377 else if( itemType == TVIMPSTEnums::EUnknonContactItem ) |
|
3378 { |
|
3379 TPtrC unknownId = processArray.GetItemUserId( index ); |
|
3380 ExecuteAiwCallL( unknownId ); |
|
3381 } |
|
3382 } |
|
3383 // --------------------------------------------------------- |
|
3384 // CVIMPSTUiTabbedView::ExecuteAiwCallL |
|
3385 // --------------------------------------------------------- |
|
3386 void CVIMPSTUiTabbedView::ExecuteAiwCallL( const TDesC& aSelectedAddress ) |
|
3387 { |
|
3388 TRACER_AUTO; |
|
3389 //aSelectedAdress will be an xsp id of format "ServiceName:UserId" |
|
3390 //here we need to truncate the servicename and pass only the UserId |
|
3391 //Find if aSelectedAdress of type "ServiceName:UserId" |
|
3392 //if true, then remove the service part |
|
3393 TInt phoneNumberStart = aSelectedAddress.Locate(':'); |
|
3394 HBufC* numBuf = NULL; |
|
3395 |
|
3396 if ( KErrNotFound != phoneNumberStart ) |
|
3397 { |
|
3398 phoneNumberStart++; //To get rid of ':' |
|
3399 numBuf = aSelectedAddress.Right( |
|
3400 aSelectedAddress.Length() - phoneNumberStart |
|
3401 ).AllocLC(); |
|
3402 } |
|
3403 else |
|
3404 { |
|
3405 numBuf = aSelectedAddress.AllocLC(); |
|
3406 } |
|
3407 |
|
3408 TPtr numDesc( numBuf->Des ()); |
|
3409 CommonPhoneParser::ParsePhoneNumber ( numDesc, |
|
3410 CommonPhoneParser::EPhoneClientNumber); |
|
3411 |
|
3412 CAiwDialDataExt* dialDataExt = CAiwDialDataExt::NewLC(); |
|
3413 dialDataExt->SetPhoneNumberL ( numBuf->Des ()); |
|
3414 dialDataExt->SetServiceId(iServiceId); |
|
3415 dialDataExt->SetCallType( CAiwDialData::EAIWVoiP); |
|
3416 |
|
3417 dialDataExt->SetWindowGroup ( CCoeEnv::Static()->RootWin().Identifier() ); |
|
3418 ReInitializeServiceHandlerL(); |
|
3419 CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
3420 dialDataExt->FillInParamListL ( paramList); |
|
3421 iServiceHandler->ExecuteServiceCmdL ( KAiwCmdCall, |
|
3422 paramList, |
|
3423 iServiceHandler->OutParamListL(), |
|
3424 0, |
|
3425 NULL); |
|
3426 CleanupStack::PopAndDestroy(dialDataExt); |
|
3427 CleanupStack::PopAndDestroy(numBuf); |
|
3428 } |
|
3429 |
|
3430 // --------------------------------------------------------- |
|
3431 // CVIMPSTUiTabbedView::LaunchHelpL() |
|
3432 // Function launches help application using the HlpLauncher. |
|
3433 // @params: Reference to a descriptor, serves as context. |
|
3434 // --------------------------------------------------------- |
|
3435 // |
|
3436 |
|
3437 void CVIMPSTUiTabbedView::LaunchHelpL( const TDesC& aContext ) |
|
3438 { |
|
3439 TRACER_AUTO; |
|
3440 CArrayFix< TCoeHelpContext >* cntx = new( ELeave ) CArrayFixFlat< TCoeHelpContext >( KHelpContextSize ); |
|
3441 CleanupStack::PushL( cntx ); |
|
3442 |
|
3443 TUid KHelpUid = { KHELPUID }; |
|
3444 cntx->AppendL( TCoeHelpContext( KHelpUid, aContext ) ); |
|
3445 CleanupStack::Pop( cntx ); |
|
3446 |
|
3447 //and launch help - takes ownership of context array |
|
3448 HlpLauncher::LaunchHelpApplicationL( CEikonEnv::Static()->WsSession(), cntx ); |
|
3449 } |
|
3450 |
|
3451 // ---------------------------------------------------- |
|
3452 // CVIMPSTUiTabbedView::SettingsStore() |
|
3453 // ---------------------------------------------------- |
|
3454 // |
|
3455 MVIMPSTSettingsStore* CVIMPSTUiTabbedView::SettingsStore() |
|
3456 { |
|
3457 return iSettingsStore; |
|
3458 } |
|
3459 |
|
3460 // ---------------------------------------------------- |
|
3461 // CVIMPSTUiTabbedView::CancelLoginSupportedL() |
|
3462 // ---------------------------------------------------- |
|
3463 // |
|
3464 TBool CVIMPSTUiTabbedView::CancelLoginSupportedL() |
|
3465 { |
|
3466 TRACER_AUTO; |
|
3467 TInt cancelNotSupported(KErrNone); |
|
3468 TBool returnValue = ETrue; |
|
3469 // read from the cenrep settings |
|
3470 TInt err = iSettingsStore->GetL(iServiceId, EServiceCancelLoginNotSupported,cancelNotSupported); |
|
3471 // if any error OR cancelNotSupported = 1 then |
|
3472 if ( err || cancelNotSupported ) |
|
3473 { |
|
3474 returnValue = EFalse; // SOME Error or cancel is not supported : return EFalse |
|
3475 } |
|
3476 return returnValue; // cancel is supported : return ETrue |
|
3477 } |
|
3478 |
|
3479 |
|
3480 // ---------------------------------------------------- |
|
3481 // CVIMPSTUiTabbedView::ChangeConnectionSupportedL() |
|
3482 // ---------------------------------------------------- |
|
3483 // |
|
3484 TBool CVIMPSTUiTabbedView::ChangeConnectionSupportedL() |
|
3485 { |
|
3486 TRACER_AUTO; |
|
3487 TInt changeConnectionSupported(KErrNone); |
|
3488 TBool returnValue = ETrue; |
|
3489 // read from the cenrep settings |
|
3490 TInt err = iSettingsStore->GetL(iServiceId, EServiceChangeConnectionNotSupported,changeConnectionSupported); |
|
3491 // if any error OR cancelNotSupported = 1 then |
|
3492 if ( err || changeConnectionSupported ) |
|
3493 { |
|
3494 returnValue = EFalse; // SOME Error or cancel is not supported : return EFalse |
|
3495 } |
|
3496 return returnValue; // cancel is supported : return ETrue |
|
3497 } |
|
3498 |
|
3499 // ---------------------------------------------------- |
|
3500 // CVIMPSTUiTabbedView::HandleNotifyL() |
|
3501 // ---------------------------------------------------- |
|
3502 // |
|
3503 TInt CVIMPSTUiTabbedView::HandleNotifyL( |
|
3504 TInt aCmdId, |
|
3505 TInt aEventId, |
|
3506 CAiwGenericParamList& aEventParamList, |
|
3507 const CAiwGenericParamList& /* aInParamList */) |
|
3508 { |
|
3509 TRACER_AUTO; |
|
3510 TInt result = 0; |
|
3511 if( (aCmdId == KAiwCmdSelect) && (aEventId == KAiwEventCompleted && iSelectedAction == ECreateXSPCall )) |
|
3512 { |
|
3513 if( iQueryResult ) |
|
3514 { |
|
3515 delete iQueryResult; |
|
3516 iQueryResult = NULL; |
|
3517 } |
|
3518 TInt index = 1; // Get field data from index 1 |
|
3519 const TAiwGenericParam* param = |
|
3520 aEventParamList.FindFirst(index, EGenericParamContactFieldData); |
|
3521 if (KErrNotFound != index) |
|
3522 { |
|
3523 TInt length = param->Value().AsDes().Length(); |
|
3524 iQueryResult = HBufC::NewL(length); |
|
3525 iQueryResult->Des().Append( param->Value().AsDes() ); |
|
3526 // Data must be found! |
|
3527 if (0 >= iQueryResult->Length()) |
|
3528 { |
|
3529 User::Leave(KErrGeneral); |
|
3530 } |
|
3531 if( !iContactSelection ) |
|
3532 { |
|
3533 iContactSelection = CVIMPSTUiContactSelection::NewL(*this); //register for the contactselection |
|
3534 } |
|
3535 iContactSelection->IssueRequest(); |
|
3536 } |
|
3537 else |
|
3538 { |
|
3539 User::Leave(KErrNotFound); |
|
3540 } |
|
3541 result = ETrue; |
|
3542 } |
|
3543 |
|
3544 else if (aCmdId == KAiwCmdAssign || aCmdId == KAiwCmdSelect ) |
|
3545 { |
|
3546 if (aEventId == KAiwEventCompleted ) |
|
3547 { |
|
3548 if( iSelectedAction == CVIMPSTUiTabbedView::EInvitAcceptUpdateExisting || |
|
3549 iSelectedAction == CVIMPSTUiTabbedView::EInvitAcceptCreateNew || |
|
3550 iSelectedAction == CVIMPSTUiTabbedView::EContactCreateNew || |
|
3551 iSelectedAction == CVIMPSTUiTabbedView::EContactAddFromContacts ) |
|
3552 { |
|
3553 // action has been completed , |
|
3554 // this will be excuted only if invitation accepted using update existing contact |
|
3555 TInt paramIndex = 0; |
|
3556 const TAiwGenericParam* contactParam = aEventParamList.FindFirst( |
|
3557 paramIndex, EGenericParamContactLinkArray );//get the contact link |
|
3558 TPtrC8 packLink = contactParam->Value().AsData(); |
|
3559 delete iSelectedData.iPackedLinks; |
|
3560 iSelectedData.iPackedLinks = NULL; |
|
3561 if( packLink.Length() ) |
|
3562 { |
|
3563 iSelectedData.iPackedLinks = packLink.AllocL(); |
|
3564 if( !iContactSelection ) |
|
3565 { |
|
3566 iContactSelection = CVIMPSTUiContactSelection::NewL(*this); //register for the contactselection |
|
3567 } |
|
3568 iContactSelection->IssueRequest(); |
|
3569 } |
|
3570 } |
|
3571 result = ETrue; |
|
3572 } |
|
3573 else if (aEventId == KAiwEventQueryExit) |
|
3574 { |
|
3575 // Send an exit command in order to close CCA and Phonebook2 |
|
3576 CAknAppUi* appUi = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
3577 |
|
3578 if ( appUi ) |
|
3579 { |
|
3580 appUi->ProcessCommandL( EAknCmdExit ); |
|
3581 } |
|
3582 result = ETrue; |
|
3583 } |
|
3584 else if(aEventId == KAiwEventOutParamCheck) |
|
3585 { |
|
3586 result = ETrue; |
|
3587 } |
|
3588 } |
|
3589 if(aEventId == KAiwEventCanceled) |
|
3590 { |
|
3591 result = ETrue; |
|
3592 } |
|
3593 return result; |
|
3594 } |
|
3595 // -------------------------------------------------------------------------- |
|
3596 // CVIMPSTUiTabbedView::BlockContactL |
|
3597 // -------------------------------------------------------------------------- |
|
3598 // |
|
3599 void CVIMPSTUiTabbedView::BlockContactL(TBool aBlock /* = EFalse */) |
|
3600 { |
|
3601 TRACER_AUTO; |
|
3602 TInt index = CurrentItemIndex(); |
|
3603 if(iContainer) |
|
3604 { |
|
3605 iContainer->CheckAndSetLastItemFlag(); |
|
3606 } |
|
3607 if( index <= 0 ) |
|
3608 { |
|
3609 // return if item not found |
|
3610 // 0 for own item which can not be blocked |
|
3611 return; |
|
3612 } |
|
3613 if(iWaitNote) |
|
3614 { |
|
3615 delete iWaitNote; |
|
3616 iWaitNote = NULL; |
|
3617 } |
|
3618 |
|
3619 MVIMPSTProcessArray& arrayprocess = iCommandHandler.GetProcessInterface(); |
|
3620 HBufC* contactId = arrayprocess.GetItemUserId(index).AllocLC(); |
|
3621 |
|
3622 if( contactId->Length() ) |
|
3623 { |
|
3624 if(aBlock ) |
|
3625 { |
|
3626 // load, format and show confirmation note |
|
3627 HBufC* prompt = StringLoader::LoadLC( R_QTN_SERVTAB_BLOCKING, *contactId ); |
|
3628 iWaitNote = CVIMPSTUtilsWaitNote::ShowWaitNoteL( *prompt, ETrue, EFalse ); |
|
3629 // iCommandHandler.HandleCommandL(ECmdBlockContact, this, &(contactId) ); |
|
3630 iCommandHandler.HandleCommandL(ECmdBlockContact, this, contactId ); |
|
3631 CleanupStack::PopAndDestroy();// prompt |
|
3632 |
|
3633 if(iContainer) |
|
3634 { |
|
3635 TRACE("HandleAvatarRefreshl calling for blocking"); |
|
3636 |
|
3637 iContainer->HandleAvatarRefreshL(*contactId, ETrue); |
|
3638 } |
|
3639 } |
|
3640 else |
|
3641 { |
|
3642 HBufC* unBprompt = StringLoader::LoadLC( R_QTN_CHAT_UNBLOCKING, *contactId ); |
|
3643 // load, format and show confirmation note |
|
3644 iWaitNote = CVIMPSTUtilsWaitNote::ShowWaitNoteL( *unBprompt, ETrue, EFalse ); |
|
3645 iCommandHandler.HandleCommandL(ECmdUnBlockContact, this, contactId ); |
|
3646 CleanupStack::PopAndDestroy();// unBprompt |
|
3647 } |
|
3648 } |
|
3649 CleanupStack::PopAndDestroy(); //contactId |
|
3650 } |
|
3651 |
|
3652 // -------------------------------------------------------------------------- |
|
3653 // CVIMPSTUiTabbedView::ShowBlockedContactListL |
|
3654 // -------------------------------------------------------------------------- |
|
3655 void CVIMPSTUiTabbedView::ShowBlockedContactListL() |
|
3656 { |
|
3657 TRACER_AUTO; |
|
3658 if(!iIsToolBarHidden) |
|
3659 { |
|
3660 ShowHideFixedToolbarL(EFalse); |
|
3661 } |
|
3662 |
|
3663 if (iContainer) |
|
3664 { |
|
3665 iContainer->DeactivateFindPaneL(); |
|
3666 } |
|
3667 |
|
3668 //Launch the search view with search dialog |
|
3669 LaunchViewL( iExtensionService.BlockViewId() ); |
|
3670 } |
|
3671 |
|
3672 // -------------------------------------------------------------------------- |
|
3673 // CVIMPSTUiTabbedView::HandleContactSelectionCompleteL |
|
3674 // -------------------------------------------------------------------------- |
|
3675 void CVIMPSTUiTabbedView::HandleContactSelectionCompleteL() |
|
3676 { |
|
3677 TRACER_AUTO; |
|
3678 |
|
3679 if( iWaitNote ) |
|
3680 { |
|
3681 delete iWaitNote; |
|
3682 iWaitNote = NULL; |
|
3683 } |
|
3684 if( iSelectedAction == CVIMPSTUiTabbedView::EInvitAcceptUpdateExisting || iSelectedAction == CVIMPSTUiTabbedView::EInvitAcceptCreateNew) |
|
3685 { |
|
3686 iWaitNote = CVIMPSTUtilsWaitNote::ShowWaitNoteL( R_QTN_SERVTAB_SAVING_CONTACT, ETrue, EFalse ); |
|
3687 |
|
3688 if ( iSelectedData.iPackedLinks ) //add the selected contact to the service tab |
|
3689 { |
|
3690 TRACE("process contact"); |
|
3691 if( iSelectedAction == CVIMPSTUiTabbedView::EInvitAcceptCreateNew ) |
|
3692 { |
|
3693 iCommandHandler.HandleCommandL( ECmdProcessAcceptedContactNew, this, (TAny*)&iSelectedData ); |
|
3694 } |
|
3695 else |
|
3696 { |
|
3697 iCommandHandler.HandleCommandL( ECmdProcessAcceptedContactExist, this, (TAny*)&iSelectedData ); |
|
3698 } |
|
3699 delete iSelectedData.iPackedLinks; |
|
3700 iSelectedData.iPackedLinks = NULL; |
|
3701 } |
|
3702 iSelectedData.iXSPList.ResetAndDestroy(); |
|
3703 |
|
3704 //invitation has been accepted using update existing contact |
|
3705 // updation is successful |
|
3706 // send accepted request to command/engine/server |
|
3707 TRACE("frnrequest accepted"); |
|
3708 iCommandHandler.HandleCommandL(EFriendAccpeted, this, iFriendRequestId ); |
|
3709 } |
|
3710 else if( iSelectedAction == CVIMPSTUiTabbedView::EContactCreateNew || iSelectedAction == CVIMPSTUiTabbedView::EContactAddFromContacts) |
|
3711 { |
|
3712 MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL( iEngine.ServiceId() ) ; |
|
3713 TBool localStore = EFalse; |
|
3714 if( storage ) |
|
3715 { |
|
3716 localStore = storage->IsLocalStore(); |
|
3717 } |
|
3718 if( localStore )//for server store wait note is shown by AddContactL function |
|
3719 { |
|
3720 if(iWaitNote) |
|
3721 { |
|
3722 delete iWaitNote; |
|
3723 iWaitNote = NULL; |
|
3724 } |
|
3725 iWaitNote = CVIMPSTUtilsWaitNote::ShowWaitNoteL( R_QTN_SERVTAB_SAVING_CONTACT, ETrue, EFalse ); |
|
3726 } |
|
3727 |
|
3728 if ( iSelectedData.iPackedLinks ) //add the selected contact to the service tab |
|
3729 { |
|
3730 TRACE("process contact"); |
|
3731 if( iSelectedAction == CVIMPSTUiTabbedView::EContactCreateNew ) |
|
3732 { |
|
3733 iCommandHandler.HandleCommandL( ECmdProcessSelectedContactNew, this, (TAny*)&iSelectedData ); |
|
3734 } |
|
3735 else |
|
3736 { |
|
3737 iCommandHandler.HandleCommandL( ECmdProcessSelectedContactExist, this, (TAny*)&iSelectedData ); |
|
3738 } |
|
3739 delete iSelectedData.iPackedLinks; |
|
3740 iSelectedData.iPackedLinks = NULL; |
|
3741 //server store xspid will be stored in iSelectedData.iXSPList and adding it to UI |
|
3742 if( !localStore && iSelectedAction == CVIMPSTUiTabbedView::EContactAddFromContacts) |
|
3743 { |
|
3744 AddContactL( iSelectedData.iXSPList ); |
|
3745 } |
|
3746 iSelectedData.iXSPList.ResetAndDestroy(); |
|
3747 |
|
3748 } |
|
3749 // this is for adding a fresh contact for local store |
|
3750 // read the data from link and send it to server for updation |
|
3751 } |
|
3752 else if( iSelectedAction == CVIMPSTUiTabbedView::ECreateXSPCall && iQueryResult ) |
|
3753 { |
|
3754 // make a call here |
|
3755 ExecuteAiwCallL(*iQueryResult ); |
|
3756 delete iQueryResult; |
|
3757 iQueryResult = NULL; |
|
3758 } |
|
3759 iSelectedAction = KErrNotFound; // This is to clear the previous selected action. |
|
3760 |
|
3761 } |
|
3762 |
|
3763 // -------------------------------------------------------------------------- |
|
3764 // CVIMPSTUiTabbedView::LaunchSettingsViewL |
|
3765 // -------------------------------------------------------------------------- |
|
3766 void CVIMPSTUiTabbedView::LaunchSettingsViewL() |
|
3767 { |
|
3768 /* |
|
3769 If settingsui is already opened, instead of starting with StartDocument just bring csc to foreground and send message |
|
3770 (csc opens correct settings ui even when itīs already open)What comes to coming back to meco tab by pressing Back in |
|
3771 settingsui i made change that tab view is opened by using RxSPViewServices in csc side and csc is closed after that. |
|
3772 I found only one problem while testing this solution, that is if phonebook is closed when settingsui is still open. |
|
3773 In that case settingsui stays in background, but even then when Back is pressed on settingsui correct tab is opened |
|
3774 (phonebook is reopened using RxSPViewServices) |
|
3775 |
|
3776 ************************************************************************************** |
|
3777 CSC team agreed to provide new generic CSC view launcher API, once CSC provide new API |
|
3778 below code need to remove and new API will be called. |
|
3779 *************************************************************************************** |
|
3780 */ |
|
3781 TRACER_AUTO; |
|
3782 _LIT(KStartupParams, "ACTION=4 SERID="); |
|
3783 _LIT8(KStartupParams8, "ACTION=4 SERID="); |
|
3784 //Take CSC UID (In future if this UID change , we also need to change it otherwise we will not be able |
|
3785 //to launch CSC settings. |
|
3786 const TUid KCSCAppUid = { 0x10275458 }; |
|
3787 RWsSession ws; |
|
3788 User::LeaveIfError( ws.Connect() ); |
|
3789 CleanupClosePushL( ws ); |
|
3790 TApaTaskList list( ws ); |
|
3791 |
|
3792 TApaTask task( list.FindApp( KCSCAppUid ) ); |
|
3793 |
|
3794 if ( task.Exists() ) |
|
3795 { |
|
3796 TBuf8<255> params8; |
|
3797 params8.Copy( KStartupParams8 ); |
|
3798 params8.AppendNum( iServiceId ); |
|
3799 //Bring CSC to foreground if already open |
|
3800 task.BringToForeground(); |
|
3801 task.SendMessage( |
|
3802 TUid::Uid( KUidApaMessageSwitchOpenFileValue ), params8 ); |
|
3803 } |
|
3804 else |
|
3805 { |
|
3806 RApaLsSession session; |
|
3807 CleanupClosePushL( session ); |
|
3808 User::LeaveIfError(session.Connect()); |
|
3809 |
|
3810 TUid appUid = KCSCAppUid; |
|
3811 TThreadId threadId; |
|
3812 TFileName fileName; |
|
3813 |
|
3814 fileName.Copy( KStartupParams ); |
|
3815 fileName.AppendNum( iServiceId ); |
|
3816 |
|
3817 User::LeaveIfError( |
|
3818 session.StartDocument( fileName, appUid, threadId ) ); |
|
3819 |
|
3820 session.Close(); |
|
3821 CleanupStack::PopAndDestroy( &session ); |
|
3822 } |
|
3823 |
|
3824 CleanupStack::PopAndDestroy( &ws ); |
|
3825 |
|
3826 }//End LaunchSettingsUiL() |
|
3827 // -------------------------------------------------------------------------- |
|
3828 // CVIMPSTUiTabbedView::ReInitializeServiceHandlerL() |
|
3829 // -------------------------------------------------------------------------- |
|
3830 |
|
3831 void CVIMPSTUiTabbedView::ReInitializeServiceHandlerL() |
|
3832 { |
|
3833 TRACER_AUTO; |
|
3834 if(iIsServiceHandleReSet ) |
|
3835 { |
|
3836 if(iServiceHandler) |
|
3837 { |
|
3838 iServiceHandler->AttachL( R_IM_APP_INTEREST ); |
|
3839 iServiceHandler->AttachMenuL( R_SERVTAB_TABBED_VIEW_MENU, |
|
3840 R_IM_APP_INTEREST ); |
|
3841 |
|
3842 iServiceHandler->AttachL( R_AIWASSIGNMENT_INTEREST ); |
|
3843 |
|
3844 iServiceHandler->AttachL( R_AIWSELECT_INTEREST ); |
|
3845 iIsServiceHandleReSet = EFalse; |
|
3846 } |
|
3847 } |
|
3848 } |
|
3849 // -------------------------------------------------------------------------- |
|
3850 // CVIMPSTUiTabbedView::LaunchFetchDialogL() |
|
3851 // -------------------------------------------------------------------------- |
|
3852 |
|
3853 void CVIMPSTUiTabbedView::LaunchFetchDialogL() |
|
3854 { |
|
3855 TRACER_AUTO; |
|
3856 iSelectedAction = EContactAddFromContacts; |
|
3857 MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL( iEngine.ServiceId() ) ; |
|
3858 TBool localStore = EFalse; |
|
3859 if( storage ) |
|
3860 { |
|
3861 localStore = storage->IsLocalStore(); |
|
3862 } |
|
3863 |
|
3864 if( localStore ) |
|
3865 { |
|
3866 //multiple item fetch. |
|
3867 TUint fetchFlags = 0; |
|
3868 fetchFlags |= ::EExcludeGroupsView; |
|
3869 |
|
3870 ExecuteMultipleItemFetchL( TAiwMultipleEntrySelectionDataV2().SetFlags( fetchFlags ) ); |
|
3871 } |
|
3872 else |
|
3873 { |
|
3874 //single item fetch. |
|
3875 TUint fetchFlags = 0; |
|
3876 |
|
3877 ExecuteSingleItemFetchL( TAiwSingleEntrySelectionDataV2().SetFlags( fetchFlags ) ); |
|
3878 } |
|
3879 |
|
3880 } |
|
3881 // -------------------------------------------------------------------------- |
|
3882 // CVIMPSTUiTabbedView::ExecuteSingleItemFetchL |
|
3883 // -------------------------------------------------------------------------- |
|
3884 |
|
3885 void CVIMPSTUiTabbedView::ExecuteSingleItemFetchL( TAiwSingleEntrySelectionDataV2 aData ) |
|
3886 { |
|
3887 TRACER_AUTO; |
|
3888 if(iAiwParamList) |
|
3889 { |
|
3890 delete iAiwParamList; |
|
3891 iAiwParamList = NULL; |
|
3892 } |
|
3893 iAiwParamList = CAiwGenericParamList::NewL(); |
|
3894 iAiwParamList->AppendL( |
|
3895 TAiwGenericParam( |
|
3896 EGenericParamContactSelectionData, |
|
3897 TAiwVariant(TAiwSingleEntrySelectionDataV2Pckg(aData)))); |
|
3898 |
|
3899 ReInitializeServiceHandlerL(); |
|
3900 iServiceHandler->ExecuteServiceCmdL( |
|
3901 KAiwCmdSelect, |
|
3902 *iAiwParamList, |
|
3903 iServiceHandler->OutParamListL(), |
|
3904 0, |
|
3905 this |
|
3906 ); |
|
3907 |
|
3908 } |
|
3909 // -------------------------------------------------------------------------- |
|
3910 // CVIMPSTUiTabbedView::ExecuteMultipleItemFetchL |
|
3911 // -------------------------------------------------------------------------- |
|
3912 void CVIMPSTUiTabbedView::ExecuteMultipleItemFetchL( TAiwMultipleEntrySelectionDataV2 aData ) |
|
3913 { |
|
3914 TRACER_AUTO; |
|
3915 if(iAiwParamList) |
|
3916 { |
|
3917 delete iAiwParamList; |
|
3918 iAiwParamList = NULL; |
|
3919 } |
|
3920 iAiwParamList = CAiwGenericParamList::NewL(); |
|
3921 ReInitializeServiceHandlerL(); |
|
3922 iAiwParamList->AppendL( |
|
3923 TAiwGenericParam( |
|
3924 EGenericParamContactSelectionData, |
|
3925 TAiwVariant(TAiwMultipleEntrySelectionDataV2Pckg(aData)))); |
|
3926 |
|
3927 |
|
3928 iServiceHandler->ExecuteServiceCmdL( |
|
3929 KAiwCmdSelect, |
|
3930 *iAiwParamList, |
|
3931 iServiceHandler->OutParamListL(), |
|
3932 0, |
|
3933 this |
|
3934 ); |
|
3935 } |
|
3936 // End of File |
|