|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: View class for single list |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 //platform includes |
|
21 #include <chatNG.rsg> |
|
22 #include <eikmenup.h> |
|
23 #include <aknglobalnote.h> |
|
24 #include <stringloader.h> |
|
25 #include <eikmenub.h> // CEikMenuBar |
|
26 #include <eiklbx.h> |
|
27 #include <hlplch.h> |
|
28 #include <FeatMgr.h> |
|
29 #include <SysUtil.h> |
|
30 |
|
31 |
|
32 #include "ImpsCSPAllErrors.h" |
|
33 #include "ccasyncchecker.h" |
|
34 // INCLUDE FILES |
|
35 #include "MCAProcessManager.h" |
|
36 #include "MCASettingsPC.h" |
|
37 #include "MCAMainViewArrayPC.h" |
|
38 #include "chatngclient.hrh" |
|
39 #include "CCAStatusPaneHandler.h" |
|
40 #include "ChatDefinitions.h" |
|
41 #include "CCAAppUi.h" |
|
42 #include "CAExternalInterface.h" |
|
43 #include "IMDialogUtils.h" |
|
44 #include "IMNoteMapper.h" |
|
45 |
|
46 #include "CCAGroupUtils.h" |
|
47 #include "ChatDebugPrint.h" |
|
48 #include "CAExternalInterface.h" |
|
49 #include "ChatDebugPrint.h" |
|
50 #include "CCAUISessionManager.h" |
|
51 #include "CCAIdleWait.h" |
|
52 #include "IMUtils.h" |
|
53 #include "CCASearchViewContainer.h" |
|
54 #include "IMPrivateCRKeys.h" |
|
55 #include "IMVariant.hrh" |
|
56 #include "impsbuilddefinitions.h" |
|
57 #include "MCAUiLoginCmdCB.h" |
|
58 #include "CCASingleListContainer.h" |
|
59 #include "CCAUISessionManager.h" |
|
60 #include "CCASingleListView.h" |
|
61 #include "CCAUINGUtils.h" |
|
62 #include "MCALoginPC.h" |
|
63 #include "CAUtils.h" |
|
64 #include "MCASingleListViewCB.h" |
|
65 #include "CCACommandManager.h" |
|
66 #include "CCACommandManagerFactory.h" |
|
67 |
|
68 #include "AknDlgShut.h" |
|
69 #include "MCAApplicationNGPC.h" |
|
70 #include "MCAInvitationPC.h" |
|
71 |
|
72 // The Settings have been moved to Cenrep (also retained in the Resource file), |
|
73 // so the enums for keys and central repository header is added here |
|
74 #include "VariantKeys.h" |
|
75 |
|
76 // ================= MEMBER FUNCTIONS ======================= |
|
77 |
|
78 // Symbian OS default constructor can leave. |
|
79 CCASingleListView::~CCASingleListView() |
|
80 { |
|
81 CHAT_DP_TXT( "CCASingleListView destructor starts" ); |
|
82 if ( iContextMenuBar ) |
|
83 { |
|
84 iEikonEnv->EikAppUi()->RemoveFromStack( iContextMenuBar ); |
|
85 delete iContextMenuBar; |
|
86 } |
|
87 |
|
88 if ( iContainer ) |
|
89 { |
|
90 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
91 delete iContainer; |
|
92 } |
|
93 |
|
94 iMainViewArrayPC->UnRegisterCallBack( ); |
|
95 iMainViewArrayPC->RemoveObserver(); |
|
96 |
|
97 CHAT_DP_TXT( "CCASingleListView destructor ends" ); |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------- |
|
101 // CCAChatListView::ConstructL() |
|
102 // Symbian OS default constructor |
|
103 // (other items were commented in a header). |
|
104 // --------------------------------------------------------- |
|
105 // |
|
106 void CCASingleListView::ConstructL( TInt aAvkonViewResourceId, TUid aViewId ) |
|
107 { |
|
108 BaseConstructL( aAvkonViewResourceId, aViewId ); |
|
109 |
|
110 iAppUi = static_cast<CCAAppUi*>( iEikonEnv->AppUi() ); |
|
111 iMainViewArrayPC = iAppUi->GetProcessManager().GetArrayInterface(); |
|
112 iCurrentIndex = 0; |
|
113 iContainerIndexId = 0; |
|
114 iMainViewArrayPC->RegisterCallBack( this ); |
|
115 iConversationExits = EFalse; |
|
116 iCreateGrpFromContactList = EFalse; |
|
117 iMainViewArrayPC->ResetArray( ETrue ); |
|
118 iMainViewArrayPC->AddObserver( this ); |
|
119 iFirstManualRefresh = EFalse; |
|
120 } |
|
121 |
|
122 |
|
123 // --------------------------------------------------------- |
|
124 // CCASingleListView::DoActivateL( |
|
125 // const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, |
|
126 // const TDesC8& /*aCustomMessage*/) |
|
127 // From CAknView, Gets called from framework when activating this view |
|
128 // (other items were commented in a header). |
|
129 // --------------------------------------------------------- |
|
130 // |
|
131 void CCASingleListView::DoActivateL( |
|
132 const TVwsViewId& /*aPrevViewId*/, TUid aCustomMessageId, |
|
133 const TDesC8& aCustomMessage ) |
|
134 { |
|
135 CHAT_DP_TXT( "CCASingleListView::DoActivateL" ); |
|
136 CHAT_DP( D_CHAT_LIT( "Container: %d" ), iContainer ); |
|
137 |
|
138 // Unregister the view that was registered from Forward option. |
|
139 // didn't find any better place to put this. |
|
140 if ( TEnumsPC::EToBeUnregistered == iAppUi->RetForwardTo() ) |
|
141 { |
|
142 iAppUi->UnRegisterPreviousview( ); |
|
143 iAppUi->SetResetForwardTo( TEnumsPC::EUnregistered ); |
|
144 } |
|
145 |
|
146 if ( aCustomMessageId == KUidChatPrivateChatListViewSoftNoteActivationId ) |
|
147 { |
|
148 // Shutdown possible dialogs before changing views etc. |
|
149 // If this is not done, wrong dialog get events. |
|
150 CHAT_DP_FUNC_DP( "DoActivateL", "ShutDialogsL..." ); |
|
151 AknDialogShutter::ShutDialogsL( *iEikonEnv ); |
|
152 CHAT_DP_FUNC_DP( "DoActivateL", "done." ); |
|
153 |
|
154 // we might be here before chat has been fully constructed. |
|
155 CAAppUi()->FinalizeChatConstructionL(); |
|
156 |
|
157 // Launched from soft notification -> Beep allready played |
|
158 // Set not to be played again |
|
159 CAAppUi()->SetPlayOnce( ETrue ); |
|
160 |
|
161 TInt countOfInvites = CAAppUi()->ReceivedInvites(); |
|
162 TInt countOfPendingChats; |
|
163 TInt countOfPendingGroupChats; |
|
164 |
|
165 TInt countOfMessages = iAppUi->GetProcessManager().GetApplicationNGPC() |
|
166 ->MessagesPendingCount( countOfPendingChats, TEnumsPC::EUnreadReceived ); |
|
167 |
|
168 countOfMessages = iAppUi->GetProcessManager().GetApplicationNGPC() |
|
169 ->ChatGroupMessagesPendingCount( countOfPendingGroupChats ); |
|
170 |
|
171 if ( countOfInvites + countOfPendingChats + countOfPendingGroupChats == 1 ) |
|
172 { |
|
173 if ( countOfPendingChats ) |
|
174 { |
|
175 |
|
176 // we have a sender, so this is p2p-message |
|
177 TCADnlConvView dnlConView; |
|
178 dnlConView.iIsForwarded = EFalse; |
|
179 dnlConView.iSAPChanged = EFalse; |
|
180 dnlConView.iWVID = iMainViewArrayPC->PendingMessageInfo(); |
|
181 dnlConView.iSwitchTab = EFalse; |
|
182 |
|
183 TCADnlConvViewBuf convMsgBuf( dnlConView ); |
|
184 // Chat was already there -> beep will not |
|
185 // be played again. Set to false so beep |
|
186 // will be played next time when new |
|
187 // msg is received |
|
188 CAAppUi()->SetPlayOnce( EFalse ); |
|
189 CAViewSwitcher()->SwitchViewL( KUidConversationsView, |
|
190 KUidConvViewMsgId, convMsgBuf ); |
|
191 |
|
192 return; // we're done with this view |
|
193 |
|
194 } |
|
195 else if ( countOfInvites ) |
|
196 { |
|
197 const TDesC& invitationId = iAppUi->GetProcessManager().GetInvitationsInterface() |
|
198 ->UnresdInvitationInfo(); |
|
199 |
|
200 MCAInvitationPC& invitePC( *iAppUi->GetProcessManager().GetInvitationsInterface() ); |
|
201 |
|
202 TCADnlInvView dnlInvView; |
|
203 dnlInvView.iInvitationIndex = invitePC.FindInvitationIndex( invitationId ); |
|
204 dnlInvView.iInviteID = invitationId; |
|
205 dnlInvView.iSwitchTab = EFalse; |
|
206 |
|
207 TCADnlInvViewBuf invMsgBuf( dnlInvView ); |
|
208 |
|
209 CAViewSwitcher()->SwitchViewL( KUidInvitationView, |
|
210 KUidInvViewMsgId, invMsgBuf ); |
|
211 return; // we're done with this view |
|
212 |
|
213 } |
|
214 else |
|
215 { |
|
216 TCADnlChatView viewDnl; |
|
217 viewDnl.iIsForwarded = EFalse; |
|
218 viewDnl.iSwitchTab = EFalse; |
|
219 viewDnl.iGroupId = iMainViewArrayPC->ChatGroupPendingMessageInfo( viewDnl.iGroupName ); |
|
220 viewDnl.iInviteQuery = EFalse; |
|
221 |
|
222 TCADnlChatViewBuf grpMsgBuf( viewDnl ); |
|
223 |
|
224 // Chat was already there -> beep will not |
|
225 // be played again. Set to false so beep |
|
226 // will be played next time when new |
|
227 // msg is received |
|
228 CAAppUi()->SetPlayOnce( EFalse ); |
|
229 |
|
230 CAViewSwitcher()->SwitchViewL( KUidChatView, |
|
231 KUidChatViewMsgId, grpMsgBuf ); |
|
232 |
|
233 return; // we're done with this view |
|
234 |
|
235 } |
|
236 } |
|
237 else if ( ( countOfInvites + countOfPendingChats + countOfPendingGroupChats ) > 1 ) |
|
238 { |
|
239 TInt itemIndex = iMainViewArrayPC->FindIndexOfOpenChatsItem( |
|
240 TEnumsPC::EOpenChatsListItem, KNullDesC ); |
|
241 itemIndex = itemIndex + KOpenChatsIndex; |
|
242 // just to make sure |
|
243 if ( iMainViewArrayPC->GetType( itemIndex ) != TEnumsPC::EOpenChatsListItem ) |
|
244 { |
|
245 User::Leave( KErrGeneral ); |
|
246 } |
|
247 if ( !iContainer ) |
|
248 { |
|
249 CreateContainerL( aCustomMessage, aCustomMessageId ); |
|
250 } |
|
251 iContainer->SetListboxIndexL( itemIndex ); |
|
252 |
|
253 if ( iMainViewArrayPC->IsCollapsed( itemIndex ) ) |
|
254 { |
|
255 // collapse ,expand now |
|
256 iContainer->ExpandCollapseListL(); |
|
257 } |
|
258 |
|
259 //Find the index of top most pending message,To high light that item. |
|
260 itemIndex = iMainViewArrayPC->GetIndexOfTopPendingMessage(); |
|
261 |
|
262 // focus the current item by setting itemIndex |
|
263 iContainer->SetListboxIndexL( itemIndex ); |
|
264 |
|
265 } |
|
266 } |
|
267 |
|
268 // Reuse the container if it exists. |
|
269 if ( !iContainer ) |
|
270 { |
|
271 CreateContainerL( aCustomMessage, aCustomMessageId ); |
|
272 } |
|
273 // show manual update note if not shown yet |
|
274 CCACommandManager* commandManager = CCACommandManagerFactory::InstanceL()->GetCommandManager(); |
|
275 MCASessionHandlerCmd* sessHandlerCmd = commandManager->GetSessionHandlerCmd() ; |
|
276 TBool contactsRefreshed( EFalse ); |
|
277 if ( sessHandlerCmd ) |
|
278 { |
|
279 contactsRefreshed = sessHandlerCmd->ContactsRefreshed(); |
|
280 } |
|
281 if ( contactsRefreshed && !iAppUi->GetProcessManager().GetSettingsInterface() |
|
282 ->GetBoolValuePC( TEnumsPC::EAutomaticPresenceUpdate , NULL ) ) |
|
283 { |
|
284 // only if all contact are synch |
|
285 // and if manual update. |
|
286 ShowManualUpdateNoteL(); |
|
287 } |
|
288 } |
|
289 |
|
290 |
|
291 ///---------------------------------------------------------- |
|
292 ///This functiate will Instantiate iContainer, if it is NULL |
|
293 ///---------------------------------------------------------- |
|
294 void CCASingleListView::CreateContainerL( const TDesC8& aCustomMessage, TUid aCustomMessageId ) |
|
295 { |
|
296 CAAppUi()->CAStatusPane()->SynchroniseAndRemoveTabGroup(); |
|
297 |
|
298 iContainer = new ( ELeave ) CCASingleListContainer( *this, *this, iAppUi ); |
|
299 iContainer->ConstructL( ClientRect(), |
|
300 *CAViewSwitcher(), iContainerIndexId ); |
|
301 AppUi()->AddToViewStackL( *this, iContainer ); |
|
302 |
|
303 |
|
304 iContainer->SetMopParent( this ); |
|
305 |
|
306 if ( IMUtils::CRKeyL( KCRUidIMVariation, KIMVariationKey ) |
|
307 & EIMFeatSimplifiedUI ) |
|
308 { |
|
309 CCAUISessionManager& uisessionmanager = iAppUi->UISessionManager(); |
|
310 if ( !uisessionmanager.IsServerDefined() ) |
|
311 { |
|
312 HBufC* emptyTxtBuf = IMUtils::CombineStringFromResourceLC( |
|
313 R_QTN_CHAT_EMPTY_COMMUNITY_VIEW_PRIMARY, |
|
314 R_QTN_CHAT_EMPTY_COMMUNITY_VIEW ); |
|
315 iContainer->ListBox()->View()->SetListEmptyTextL( *emptyTxtBuf ); |
|
316 CleanupStack::PopAndDestroy( emptyTxtBuf ); |
|
317 } |
|
318 else |
|
319 { |
|
320 HBufC* emptyTxtBuf = IMUtils::CombineStringFromResourceLC( |
|
321 R_QTN_CHAT_EMPTY_COMMUNITY_VIEW_NOT_VISIBLE_PRIMARY, |
|
322 R_QTN_CHAT_EMPTY_COMMUNITY_VIEW_NOT_VISIBLE ); |
|
323 iContainer->ListBox()->View()->SetListEmptyTextL( *emptyTxtBuf ); |
|
324 CleanupStack::PopAndDestroy( emptyTxtBuf ); |
|
325 |
|
326 } |
|
327 } |
|
328 |
|
329 |
|
330 // Update navi-pane |
|
331 CAAppUi()->CAStatusPane()->ShowTabGroupL( KUidFriendsListView ); |
|
332 CAAppUi()->CAStatusPane()->ClearNaviPaneL(); |
|
333 UpdateTitleL(); |
|
334 iContainer->ListBox()->UpdateScrollBarsL(); |
|
335 // Logged in with a different userid,so focus owndata. |
|
336 TBool isNewLogIn = EFalse; |
|
337 MCALoginPC* loginPC = iAppUi->GetProcessManager().GetLogInInterface(); |
|
338 |
|
339 TRAP_IGNORE( isNewLogIn = loginPC->FreshLoginL( ) ) |
|
340 if ( isNewLogIn ) |
|
341 { |
|
342 iCurrentIndex = 0; |
|
343 } |
|
344 |
|
345 //focus item as iCurrentIndex |
|
346 else |
|
347 { |
|
348 iCurrentIndex = iMainViewArrayPC->GetArrayItemIdIndexL( iItemDetails ); |
|
349 } |
|
350 if ( KErrNotFound == iCurrentIndex ) |
|
351 { |
|
352 iCurrentIndex = 0; |
|
353 } |
|
354 |
|
355 TCADnlConvInvGroupFocusBuf viewBuf; |
|
356 viewBuf.Copy( aCustomMessage ); |
|
357 |
|
358 if ( aCustomMessageId == KConvInvGroupFocusId && KNullDesC() == viewBuf().iListID ) |
|
359 { |
|
360 TBool collapsed = iMainViewArrayPC->IsCollapsed( KOpenChatsIndex ); |
|
361 if ( collapsed ) |
|
362 { |
|
363 iMainViewArrayPC->SetCollapsed( !collapsed, KOpenChatsIndex ); |
|
364 } |
|
365 |
|
366 TEnumsPC::TItem itemType = TEnumsPC::EInvalid; |
|
367 switch ( viewBuf().iType ) |
|
368 { |
|
369 case EConversationItem: |
|
370 { |
|
371 itemType = TEnumsPC::EConversationItem; |
|
372 break; |
|
373 } |
|
374 case EInviteItem: |
|
375 { |
|
376 itemType = TEnumsPC::EInviteItem; |
|
377 break; |
|
378 } |
|
379 case EGroupItem: |
|
380 { |
|
381 itemType = TEnumsPC::EGroupItem; |
|
382 break; |
|
383 } |
|
384 default://we should never be here. |
|
385 break; |
|
386 } |
|
387 |
|
388 iCurrentIndex = iMainViewArrayPC->FindIndexOfOpenChatsItem( |
|
389 itemType, viewBuf().iInvConvGroupID ); |
|
390 iCurrentIndex += KOpenChatsIndex; |
|
391 iContainer->ListBox()->HandleItemAdditionL(); |
|
392 } |
|
393 |
|
394 iContainer->SetListboxIndexL( iCurrentIndex ); |
|
395 iItemDetails.aItem = TEnumsPC::EInvalid; |
|
396 iItemDetails.aItemID.Copy( KNullDesC ); |
|
397 iItemDetails.aListID.Copy( KNullDesC ); |
|
398 |
|
399 ConstructContextMenuBarL(); |
|
400 } |
|
401 |
|
402 |
|
403 |
|
404 // --------------------------------------------------------- |
|
405 // CCASingleListView::DoDeactivate() |
|
406 // From AknView, Gets called from framework when deactivating this view |
|
407 // (other items were commented in a header). |
|
408 // --------------------------------------------------------- |
|
409 // |
|
410 void CCASingleListView::DoDeactivate() |
|
411 { |
|
412 CHAT_DP_TXT( "CCASingleListView::DoDeactivate" ); |
|
413 if ( iContextMenuBar ) |
|
414 { |
|
415 iEikonEnv->EikAppUi()->RemoveFromStack( iContextMenuBar ); |
|
416 delete iContextMenuBar; |
|
417 iContextMenuBar = NULL; |
|
418 } |
|
419 |
|
420 if ( iContainer ) |
|
421 { |
|
422 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
423 |
|
424 // Capture events because if they are not captured |
|
425 // and user is quick to write keys |
|
426 // when opening conversation. -> crash. |
|
427 if ( iContainer->OpeningConversation() ) |
|
428 { |
|
429 CHAT_DP_TXT( "start capturing events" ); |
|
430 TRAPD( err, CAAppUi()->CaptureEventsL() ); |
|
431 CHAT_DP_TXT( "started capturing events.." ); |
|
432 |
|
433 if ( err != KErrNone ) |
|
434 { |
|
435 CActiveScheduler::Current()->Error( err ); |
|
436 } |
|
437 } |
|
438 |
|
439 if ( iContainer->OpeningConversation() ) |
|
440 { |
|
441 // Stop capturing events. |
|
442 TRAPD( err, CAAppUi()->ReleaseCapturingL() ); |
|
443 if ( err != KErrNone ) |
|
444 { |
|
445 CActiveScheduler::Current()->Error( err ); |
|
446 } |
|
447 } |
|
448 if ( iCreateGrpFromContactList ) |
|
449 { |
|
450 iCreateGrpFromContactList = EFalse; |
|
451 } |
|
452 |
|
453 // delete container safely. |
|
454 // if container has some ongoing task. it will complete the task first |
|
455 // and then delete itself. Owner is not responsible for deleting the |
|
456 // object after this call |
|
457 iContainer->DeleteSelfD(); |
|
458 iConversationExits = EFalse; |
|
459 if ( iContainer && iContainer->IsBckGrdTaskComplete() ) |
|
460 { |
|
461 iContainer = NULL; |
|
462 } |
|
463 |
|
464 } |
|
465 } |
|
466 // --------------------------------------------------------- |
|
467 // CCASingleListView::AddCreateNewSubmenuL() |
|
468 // add "create new" sub menu or just one item |
|
469 // --------------------------------------------------------- |
|
470 // |
|
471 |
|
472 void CCASingleListView::AddCreateNewSubmenuL( CEikMenuPane* aMenuPane ) |
|
473 { |
|
474 if ( !UISessionManager().IsSupported( CCAUISessionManager::ESearch ) ) |
|
475 { |
|
476 // search not supported => don't add submenu |
|
477 IMUtils::AddMenuItemL( ETrue, *aMenuPane, R_QTN_CHAT_FRIEND_OM_CRNEW, |
|
478 EChatClientFriendsListViewCmdAddManually ); |
|
479 return; |
|
480 } |
|
481 |
|
482 IMUtils::AddMenuItemL( ETrue, *aMenuPane, R_QTN_CHAT_FRIEND_OM_CRNEW, 0, |
|
483 R_QTN_CHAT_FRIEND_OM_CRNEW_SUBMENU ); |
|
484 } |
|
485 // --------------------------------------------------------- |
|
486 // CCASingleListView::AddOwnOptionsSubMenuL() |
|
487 // add "Own options" sub menu depending on the online status |
|
488 // --------------------------------------------------------- |
|
489 // |
|
490 void CCASingleListView::AddOwnOptionsSubMenuL( CEikMenuPane* aMenuPane ) |
|
491 { |
|
492 TEnumsPC::TOnlineStatus onlineStatus = iContainer->GetOnlineStatus(); |
|
493 if ( onlineStatus == TEnumsPC::EUnknown ) |
|
494 { |
|
495 return; |
|
496 } |
|
497 else |
|
498 { |
|
499 IMUtils::AddMenuItemL( ETrue, *aMenuPane, R_QTN_CHAT_FRIEND_OWN_OPTIONS, 0, |
|
500 R_QTN_CHAT_FRIEND_OWN_OPTIONS_SUBMENU ); |
|
501 } |
|
502 } |
|
503 |
|
504 // --------------------------------------------------------- |
|
505 // CCASingleListView::AddContactEditOptionsSubMenuL() |
|
506 // add "Edit options" sub menu when focus is on a contact |
|
507 // --------------------------------------------------------- |
|
508 // |
|
509 void CCASingleListView::AddContactEditOptionsSubMenuL( CEikMenuPane* aMenuPane, TBool aIsContact ) |
|
510 { |
|
511 |
|
512 IMUtils::AddMenuItemL( aIsContact, *aMenuPane, R_QTN_CHAT_FRIEND_EDIT_OPTIONS, |
|
513 0, R_QTN_CHAT_FRIEND_EDIT_OPTIONS_SUBMENU ); |
|
514 |
|
515 } |
|
516 |
|
517 // --------------------------------------------------------- |
|
518 // CCASingleListView::AddNewChatSubmenuL() |
|
519 // add "Edit options" sub menu when focus is on a contact |
|
520 // --------------------------------------------------------- |
|
521 // |
|
522 void CCASingleListView::AddNewChatSubmenuL( CEikMenuPane* aMenuPane ) |
|
523 { |
|
524 IMUtils::AddMenuItemL( ETrue, *aMenuPane, R_QTN_CHAT_OPT_NEW_CHAT, |
|
525 0, R_CHAT_FRIEND_NEW_CHAT_SUBMENU ); |
|
526 |
|
527 } |
|
528 // --------------------------------------------------------- |
|
529 // CCASingleListView::DynCreateMenuPaneL() |
|
530 // construct menu pane dynamically |
|
531 // --------------------------------------------------------- |
|
532 // |
|
533 void CCASingleListView::DynCreateMenuPaneL( CEikMenuPane* aMenuPane ) |
|
534 { |
|
535 TEnumsPC::TSyncStatus syncStatus = TEnumsPC::ESyncSuccess; |
|
536 |
|
537 /* All these many boolean variables should be |
|
538 * replaced with enums and there should be single function on |
|
539 * PC side get give us status.*/ |
|
540 TBool search( UISessionManager().IsSupported( |
|
541 CCAUISessionManager::ESearch ) ); |
|
542 TBool groups( UISessionManager().IsSupported( CCAUISessionManager::EGroup ) ); |
|
543 TBool block ( UISessionManager().IsSupported( CCAUISessionManager::EBlock ) ); |
|
544 |
|
545 TBool manualUpdate( !iAppUi->GetProcessManager().GetSettingsInterface() |
|
546 ->GetBoolValuePC( TEnumsPC::EAutomaticPresenceUpdate, NULL ) ); |
|
547 |
|
548 // UI CR : 101-39731: Add variation to contact list handling |
|
549 |
|
550 /* Contactlist creation and deletion is |
|
551 * based upon flag "CHAT_VARIATION_CREATE_DELETE_CONTACT_LIST" |
|
552 * Contactlist renaming |
|
553 * based upon flag " CHAT_VARIATION_MODIFY_CONTACT_LIST" */ |
|
554 |
|
555 TBool listCreateDelete( IMUtils::IntResourceValueL( |
|
556 RSC_CHAT_VARIATION_CREATE_DELETE_CONTACT_LIST ) ); // UI CR : 101-39731 |
|
557 TBool listEdit( IMUtils::IntResourceValueL( |
|
558 RSC_CHAT_VARIATION_MODIFY_CONTACT_LIST ) ); |
|
559 TBool findJoinedChats = IMUtils::IntResourceValueL( |
|
560 RSC_CHAT_VARIATION_SEARCH_GROUPMEMBER ); |
|
561 TBool contact( EFalse ); |
|
562 |
|
563 TEnumsPC::TOnlineStatus status = iContainer->OwnStatus(); |
|
564 |
|
565 TBool synchronised = ETrue; |
|
566 TBool failed = EFalse; |
|
567 |
|
568 #ifdef IMPS_CONTACT_FETCH_BACKGROUND |
|
569 |
|
570 syncStatus = iMainViewArrayPC->IsAllSynchronised(); |
|
571 |
|
572 #endif //IMPS_CONTACT_FETCH_BACKGROUND |
|
573 |
|
574 TEnumsPC::TItem itemtype = iContainer->SelectedType(); |
|
575 |
|
576 TBool ownStatusOffLine( status == TEnumsPC::EOffline ); |
|
577 |
|
578 switch ( itemtype ) |
|
579 { |
|
580 case TEnumsPC::EOwnStatusItem: |
|
581 { |
|
582 IMUtils::AddMenuItemL( ETrue, *aMenuPane, |
|
583 R_QTN_CHAT_FRIEND_CHANGE_STATUS, |
|
584 EChatClientMainViewCmdChangeStatus ); |
|
585 AddOwnOptionsSubMenuL( aMenuPane ); |
|
586 |
|
587 /* Added to make what are the option available in online should |
|
588 * be present in offline also. Add create new menu with sub menu */ |
|
589 AddNewChatSubmenuL( aMenuPane ); |
|
590 |
|
591 /* User is not offline then only add this menu*/ |
|
592 if ( !ownStatusOffLine ) |
|
593 { |
|
594 //add fetch failed list only if online state |
|
595 IMUtils::AddMenuItemL( ( syncStatus == TEnumsPC::ESyncFailed ), |
|
596 *aMenuPane, R_QTN_CHAT_CONTACTLIST_FETCH_ALL, |
|
597 EChatClientFriendsListViewCmdFetchFailed ); |
|
598 } |
|
599 |
|
600 //----------------------------------------------------------------------- |
|
601 // This option is shown when the loging is sucessful |
|
602 // and also when the contactlist fetching is ongoing. |
|
603 AddCreateNewSubmenuL( aMenuPane ); |
|
604 |
|
605 //------------------------------------------------------------------------ |
|
606 // Some options are missing in the option menu when fetching of contact |
|
607 // list failed commented. |
|
608 IMUtils::AddMenuItemL( listCreateDelete, *aMenuPane, |
|
609 R_QTN_CHAT_FRIEND_NEW_GROUP, |
|
610 EChatClientCmdNewList ); |
|
611 if ( !UISessionManager().IsSupported( CCAUISessionManager::ECLIMod ) ) |
|
612 { |
|
613 aMenuPane->SetItemDimmed( EChatClientCmdNewList, ETrue ); |
|
614 TEnumsPC::TItem itemtype = iContainer->SelectedType(); |
|
615 if ( itemtype == TEnumsPC::EContactListItem ) |
|
616 { |
|
617 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdDelete, ETrue ); |
|
618 } |
|
619 } |
|
620 //----------------------------------------------------------------------- |
|
621 //REFRESHLIST |
|
622 IMUtils::AddMenuItemL( synchronised && manualUpdate, *aMenuPane, |
|
623 R_QTN_CHAT_FRIEND_OM_REFRESH, |
|
624 EChatClientFriendsListViewCmdRefresh ); |
|
625 break; |
|
626 } |
|
627 case TEnumsPC::EContactListItem: |
|
628 { |
|
629 TBool collapsed( iContainer->IsCollapsed() ); |
|
630 TBool forceExpanded( iMainViewArrayPC->IsForceExpanded() ); |
|
631 #ifdef IMPS_CONTACT_FETCH_BACKGROUND |
|
632 |
|
633 /* All these boolean variables should be replaced with enums. |
|
634 * and there should be single function on PC side give us sync |
|
635 * status or other relavent data*/ |
|
636 synchronised = ( iMainViewArrayPC->Synchronised( iContainer-> |
|
637 CurrentListboxIndex() ) == TEnumsPC::ESyncSuccess ); |
|
638 failed = ( iMainViewArrayPC->Synchronised( iContainer-> |
|
639 CurrentListboxIndex() ) == TEnumsPC::ESyncFailed ); |
|
640 #endif //IMPS_CONTACT_FETCH_BACKGROUND |
|
641 IMUtils::AddMenuItemL( ( collapsed && !forceExpanded ) && synchronised, *aMenuPane, |
|
642 R_QTN_CHAT_FRIEND_EXPAND_GROUP, |
|
643 EChatClientCmdExpandList ); |
|
644 |
|
645 IMUtils::AddMenuItemL( ( !collapsed || forceExpanded ) && synchronised, *aMenuPane, |
|
646 R_QTN_CHAT_FRIEND_COLLAPSE_GROUP, |
|
647 EChatClientCmdCollapseList ); |
|
648 |
|
649 IMUtils::AddMenuItemL( synchronised && manualUpdate, *aMenuPane, |
|
650 R_QTN_CHAT_FRIEND_OM_REFRESH, |
|
651 EChatClientFriendsListViewCmdRefresh ) ; |
|
652 IMUtils::AddMenuItemL( ( syncStatus == TEnumsPC::ESyncFailed ), |
|
653 *aMenuPane, |
|
654 R_QTN_CHAT_CONTACTLIST_FETCH_ALL, |
|
655 EChatClientFriendsListViewCmdFetchFailed ); |
|
656 |
|
657 //---------------------------------------------------------------------- |
|
658 // Some options are missing in the option menu when fetching of contact |
|
659 // list failed. If the list in focus is synchronised then all the options |
|
660 // should be available. |
|
661 if ( synchronised ) |
|
662 { |
|
663 IMUtils::AddMenuItemL( ETrue, *aMenuPane, |
|
664 R_QTN_CHAT_CONTACTS_OPEN_GROUP_CONV, |
|
665 EChatClientCmdOpenGroupConv ); |
|
666 |
|
667 AddCreateNewSubmenuL( aMenuPane ); |
|
668 IMUtils::AddMenuItemL( listCreateDelete, *aMenuPane, |
|
669 R_QTN_CHAT_FRIEND_NEW_GROUP, |
|
670 EChatClientCmdNewList ); |
|
671 |
|
672 IMUtils::AddMenuItemL( listCreateDelete && ( synchronised || failed ), *aMenuPane, |
|
673 R_QTN_CHAT_FRIEND_OM_DEL, |
|
674 EChatClientFriendsListViewCmdDelete ); |
|
675 |
|
676 if ( !UISessionManager().IsSupported( CCAUISessionManager::ECLIMod ) ) |
|
677 { |
|
678 aMenuPane->SetItemDimmed( EChatClientCmdNewList, ETrue ); |
|
679 TEnumsPC::TItem itemtype = iContainer->SelectedType(); |
|
680 if ( itemtype == TEnumsPC::EContactListItem ) |
|
681 { |
|
682 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdDelete, ETrue ); |
|
683 } |
|
684 } |
|
685 } |
|
686 IMUtils::AddMenuItemL( listEdit && synchronised, *aMenuPane, |
|
687 R_QTN_CHAT_FRIEND_RENAME_GROUP, |
|
688 EChatClientCmdRenameList ); |
|
689 break; |
|
690 } |
|
691 case TEnumsPC::EContactItem: |
|
692 { |
|
693 contact = ETrue; |
|
694 //open conversation |
|
695 IMUtils::AddMenuItemL( contact, *aMenuPane, |
|
696 R_QTN_CHAT_FRIEND_OM_SENDI, |
|
697 EChatPrivateListCmdOpen ); |
|
698 |
|
699 //REFRESHLIST |
|
700 IMUtils::AddMenuItemL( synchronised && manualUpdate, *aMenuPane, |
|
701 R_QTN_CHAT_FRIEND_OM_REFRESH, |
|
702 EChatClientFriendsListViewCmdRefresh ); |
|
703 IMUtils::AddMenuItemL( ( syncStatus == TEnumsPC::ESyncFailed ), *aMenuPane, |
|
704 R_QTN_CHAT_CONTACTLIST_FETCH_ALL, |
|
705 EChatClientFriendsListViewCmdFetchFailed ); |
|
706 |
|
707 //EDITOPTIONS |
|
708 AddContactEditOptionsSubMenuL( aMenuPane, contact ); |
|
709 |
|
710 IMUtils::AddMenuItemL( search && groups && findJoinedChats, |
|
711 *aMenuPane, |
|
712 R_QTN_CHAT_FRIEND_OM_FIND, |
|
713 EChatClientFriendsListViewCmdFindJoinedChats ); |
|
714 //------------------------------------------------------------------------- |
|
715 // Some options are missing in the option menu when fetching of contact list |
|
716 // failed. Create New and New contact lists are available as default(if |
|
717 // the list synchronised) |
|
718 AddCreateNewSubmenuL( aMenuPane ); |
|
719 |
|
720 IMUtils::AddMenuItemL( listCreateDelete, *aMenuPane, |
|
721 R_QTN_CHAT_FRIEND_NEW_GROUP, |
|
722 EChatClientCmdNewList ); |
|
723 if ( !UISessionManager().IsSupported( CCAUISessionManager::ECLIMod ) ) |
|
724 { |
|
725 aMenuPane->SetItemDimmed( EChatClientCmdNewList, ETrue ); |
|
726 TEnumsPC::TItem itemtype = iContainer->SelectedType(); |
|
727 if ( itemtype == TEnumsPC::EContactListItem ) |
|
728 { |
|
729 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdDelete, ETrue ); |
|
730 } |
|
731 } |
|
732 break; |
|
733 } |
|
734 case TEnumsPC::EConversationItem: |
|
735 { |
|
736 TBool contactExistsInAnyList( EFalse ); |
|
737 TEnumsPC::TItem itemtype = iContainer->SelectedType(); |
|
738 TPtrC userid = iMainViewArrayPC->GetSelectedContactUserId( |
|
739 iContainer->CurrentListboxIndex() ); |
|
740 if ( iMainViewArrayPC->FindAnyContactL( userid ) ) |
|
741 { |
|
742 contactExistsInAnyList = ETrue; |
|
743 } |
|
744 IMUtils::AddMenuItemL( ETrue, *aMenuPane, |
|
745 R_CHAT_MENUBAR_CONVERSATION_CHATLIST_MENU_OPEN, |
|
746 EChatPrivateListCmdOpen ); |
|
747 |
|
748 IMUtils::AddMenuItemL( !contactExistsInAnyList, *aMenuPane, |
|
749 R_CHAT_MENUBAR_CONVERSATION_CHATLIST_MENU_ADDTOFRIENDS, |
|
750 EChatPrivateListCmdAddToFriends ); |
|
751 |
|
752 IMUtils::AddMenuItemL( ETrue, *aMenuPane, |
|
753 R_CHAT_MENUBAR_CONVERSATION_CHATLIST_MENU_CLOSECONVERS, |
|
754 EChatPrivateListCmdCloseConvers ); |
|
755 |
|
756 AddNewChatSubmenuL( aMenuPane ); //add create new menu with sub menu |
|
757 |
|
758 break; |
|
759 } |
|
760 case TEnumsPC::EOpenChatsListItem: |
|
761 { |
|
762 TBool collapsed( iContainer->IsCollapsed() ); |
|
763 TBool forceExpanded( iContainer->IsChatsForceExpanded() ); |
|
764 |
|
765 IMUtils::AddMenuItemL( collapsed && !forceExpanded, *aMenuPane, |
|
766 R_QTN_CHAT_FRIEND_EXPAND_GROUP, |
|
767 EChatClientCmdExpandList ); |
|
768 |
|
769 IMUtils::AddMenuItemL( !collapsed || forceExpanded, *aMenuPane, |
|
770 R_QTN_CHAT_FRIEND_COLLAPSE_GROUP, |
|
771 EChatClientCmdCollapseList ); |
|
772 |
|
773 AddNewChatSubmenuL( aMenuPane ); //add create new menu with sub menu |
|
774 |
|
775 break; |
|
776 } |
|
777 |
|
778 |
|
779 case TEnumsPC::EInviteItem: |
|
780 { |
|
781 TBool contactExistsInAnyList( EFalse ); |
|
782 TEnumsPC::TItem itemtype = iContainer->SelectedType(); |
|
783 TPtrC userid = |
|
784 iMainViewArrayPC->GetSelectedContactUserId( iContainer->CurrentListboxIndex() ); |
|
785 if ( iMainViewArrayPC->FindAnyContactL( userid ) ) |
|
786 { |
|
787 contactExistsInAnyList = ETrue; |
|
788 } |
|
789 IMUtils::AddMenuItemL( ETrue, *aMenuPane, |
|
790 R_CHAT_MENUBAR_CONVERSATION_CHATLIST_MENU_OPEN, |
|
791 EChatPrivateListCmdOpen ); |
|
792 |
|
793 IMUtils::AddMenuItemL( !contactExistsInAnyList, *aMenuPane, |
|
794 R_CHAT_MENUBAR_CONVERSATION_CHATLIST_MENU_ADDTOFRIENDS, |
|
795 EChatPrivateListCmdAddToFriends ); |
|
796 IMUtils::AddMenuItemL( ETrue, *aMenuPane, |
|
797 R_CHAT_MENUBAR_CONVERSATION_CHATLIST_MENU_DELETE, |
|
798 EChatPrivateListCmdDelete ); |
|
799 |
|
800 AddNewChatSubmenuL( aMenuPane ); // add new chat and sub options |
|
801 |
|
802 break; |
|
803 } |
|
804 case TEnumsPC::EGroupItem: |
|
805 { |
|
806 TBool isJoined = iContainer->IsJoinedToGroup(); |
|
807 IMUtils::AddMenuItemL( !ownStatusOffLine && isJoined, *aMenuPane, |
|
808 R_QTN_CHAT_CLIST_OM_OPEN, |
|
809 EChatClientSingleListViewCmdGroupOpen ); |
|
810 |
|
811 IMUtils::AddMenuItemL( !isJoined, *aMenuPane, |
|
812 R_QTN_CHAT_FRIEND_JOIN_GROUP, |
|
813 EChatClientSingleListViewCmdGroupJoin ); |
|
814 |
|
815 |
|
816 IMUtils::AddMenuItemL( ETrue, *aMenuPane, |
|
817 R_QTN_CHAT_CLIST_OM_CGR, |
|
818 0, |
|
819 R_CHAT_GROUP_OPTIONS_SUBMENU |
|
820 ); |
|
821 |
|
822 |
|
823 IMUtils::AddMenuItemL( !ownStatusOffLine && isJoined, *aMenuPane, |
|
824 R_QTN_CHAT_CLIST_CGR_SM_LEAVE, |
|
825 EChatClientSingleListViewCmdGroupLeave ); |
|
826 |
|
827 AddNewChatSubmenuL( aMenuPane ); // add new chat and sub options |
|
828 break; |
|
829 } |
|
830 default: |
|
831 { |
|
832 IMUtils::AddMenuItemL( contact, *aMenuPane, |
|
833 R_QTN_CHAT_FRIEND_OM_SENDI, |
|
834 EChatClientFriendsListViewCmdIMessage ); |
|
835 |
|
836 #ifndef RD_REMOVE_COLLAPSE_OPTION |
|
837 IMUtils::AddMenuItemL( contact, *aMenuPane, |
|
838 R_QTN_CHAT_FRIEND_COLLAPSE_GROUP, |
|
839 EChatClientCmdCollapseList ); |
|
840 #endif // RD_REMOVE_COLLAPSE_OPTION |
|
841 |
|
842 IMUtils::AddMenuItemL( contact, *aMenuPane, |
|
843 R_QTN_CHAT_FRIEND_OM_OPEN1, |
|
844 EChatClientFriendsListViewCmdOpen ); |
|
845 |
|
846 if ( !( ( status == TEnumsPC::EUnknown ) || ( status == TEnumsPC::EOffline ) ) ) |
|
847 { |
|
848 AddCreateNewSubmenuL( aMenuPane ); |
|
849 } |
|
850 |
|
851 AddContactEditOptionsSubMenuL( aMenuPane, contact ); |
|
852 |
|
853 TInt index = iContainer->CurrentListboxIndex(); |
|
854 IMUtils::AddMenuItemL( search && groups && findJoinedChats && index != KErrNotFound, |
|
855 *aMenuPane, |
|
856 R_QTN_CHAT_FRIEND_OM_FIND, |
|
857 EChatClientFriendsListViewCmdFindJoinedChats ); |
|
858 |
|
859 IMUtils::AddMenuItemL( listCreateDelete, *aMenuPane, |
|
860 R_QTN_CHAT_FRIEND_NEW_GROUP, |
|
861 EChatClientCmdNewList ); |
|
862 |
|
863 if ( !UISessionManager().IsSupported( CCAUISessionManager::ECLIMod ) ) |
|
864 { |
|
865 aMenuPane->SetItemDimmed( EChatClientCmdNewList, ETrue ); |
|
866 TEnumsPC::TItem itemtype = iContainer->SelectedType(); |
|
867 if ( itemtype == TEnumsPC::EContactListItem ) |
|
868 { |
|
869 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdDelete, ETrue ); |
|
870 } |
|
871 } |
|
872 |
|
873 |
|
874 break; |
|
875 } |
|
876 } |
|
877 |
|
878 //block options |
|
879 IMUtils::AddMenuItemL( block, *aMenuPane, R_QTN_CHAT_FRIEND_OM_IMSG_SET, 0, |
|
880 R_CHATCLIENT_FRIENDSLIST_SUBMENU ); |
|
881 |
|
882 IMUtils::AddMenuItemL( ETrue, *aMenuPane, R_QTN_CHAT_FRIEND_SAVED_CONVERSATIONS, |
|
883 EChatClientSingleListViewCmdSavedConversations ); |
|
884 TBool loggedIn( UISessionManager().IsLoggedIn() ); |
|
885 IMUtils::AddMenuItemL( loggedIn, *aMenuPane, R_QTN_CHAT_MAIN_OM_LOGOUT, |
|
886 EChatClientMainViewCmdLogout ); |
|
887 |
|
888 IMUtils::AddMenuItemL( !loggedIn, *aMenuPane, R_QTN_CHAT_MAIN_OM_LOGIN, |
|
889 EChatClientMainViewCmdLogin ); |
|
890 |
|
891 IMUtils::AddMenuItemL( ETrue, *aMenuPane, R_QTN_CHAT_SETTINGS, |
|
892 EChatClientChatListSettings ); |
|
893 } |
|
894 |
|
895 // --------------------------------------------------------- |
|
896 // CCASingleListView::DynInitMenuPaneL() |
|
897 // From MEikMenuObserver, Called by framework before constructing menupane |
|
898 // (other items were commented in a header). |
|
899 // --------------------------------------------------------- |
|
900 // |
|
901 void CCASingleListView::DynInitMenuPaneL( TInt aResourceId, |
|
902 CEikMenuPane* aMenuPane ) |
|
903 { |
|
904 TBool ownStatusOffLine( iContainer->OwnStatus() == TEnumsPC::EOffline ); |
|
905 |
|
906 // least 2 contact lists |
|
907 TInt minContactLists( 2 ); |
|
908 switch ( aResourceId ) |
|
909 { |
|
910 case R_CHATCLIENT_GENERAL_MENU: |
|
911 { |
|
912 // dim the help menu item |
|
913 aMenuPane->SetItemDimmed( EChatClientCmdHelp, |
|
914 !FeatureManager::FeatureSupported( KFeatureIdHelp ) ); |
|
915 break; |
|
916 } |
|
917 case R_CHATCLIENT_FRIENDSLIST_VIEW_MENU: |
|
918 { |
|
919 DynCreateMenuPaneL( aMenuPane ); |
|
920 break; |
|
921 } |
|
922 case R_CHATCLIENT_FRIENDSLIST_SUBMENU://Blocklist |
|
923 { |
|
924 TBool nonContact( ( iContainer->SelectedType() |
|
925 == TEnumsPC::EContactListItem ) |
|
926 || ( iContainer->SelectedType() |
|
927 == TEnumsPC::EGroupItem ) |
|
928 || ( iContainer->SelectedType() |
|
929 == TEnumsPC::EOwnStatusItem ) |
|
930 || ( iContainer->SelectedType() |
|
931 == TEnumsPC::EOpenChatsListItem ) |
|
932 ); |
|
933 |
|
934 // show/hide "show blocked list" option |
|
935 if ( !IMUtils::IntResourceValueL( |
|
936 RSC_CHAT_VARIATION_SHOW_BLOCKED_LIST ) ) |
|
937 { |
|
938 aMenuPane->SetItemDimmed( |
|
939 EChatClientFriendsListViewShowBlockedList, ETrue ); |
|
940 } |
|
941 |
|
942 TBool showUnblock = ( ( iContainer->SelectedType() != TEnumsPC::EContactItem ) |
|
943 || !iContainer->IsBlocked() ); |
|
944 |
|
945 aMenuPane->SetItemDimmed( EChatClientFriendsListViewUnblock, |
|
946 showUnblock ); |
|
947 |
|
948 TInt index = iContainer->CurrentListboxIndex(); |
|
949 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdBlock, |
|
950 iContainer->IsBlocked() || nonContact || ( index == KErrNotFound ) ); |
|
951 break; |
|
952 } |
|
953 case R_CHATCLIENT_FRIENDSLIST_CRNEW_SUBMENU: |
|
954 { |
|
955 // check if search is supported |
|
956 // branding: check if there are any available search criteria |
|
957 if ( !UISessionManager().IsSupported( CCAUISessionManager::ESearch ) || |
|
958 ( !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_NAME ) && |
|
959 !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_USERID ) && |
|
960 !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_PHONE ) && |
|
961 !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_EMAIL ) ) ) |
|
962 { |
|
963 aMenuPane->SetItemDimmed( |
|
964 EChatClientFriendsListViewCmdAddFromSrv, ETrue ); |
|
965 aMenuPane->SetItemDimmed( |
|
966 EChatClientFriendsListViewCmdAddFromPb, ETrue ); |
|
967 } |
|
968 if ( !IMUtils::IntResourceValueL( |
|
969 RSC_CHAT_VARIATION_MSISDN_SUPPORT ) ) |
|
970 { |
|
971 aMenuPane->SetItemDimmed( |
|
972 EChatClientFriendsListViewCmdAddFromPb, ETrue ); |
|
973 } |
|
974 |
|
975 // this is not used when full contact list support is on |
|
976 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdMoveFromSrv, |
|
977 ETrue ); |
|
978 break; |
|
979 } |
|
980 |
|
981 case R_QTN_CHAT_FRIEND_OM_CRNEW_SUBMENU: |
|
982 { |
|
983 // check if search is supported |
|
984 // branding: check if there are any available search criteria |
|
985 if ( !UISessionManager().IsSupported( CCAUISessionManager::ESearch ) || |
|
986 ( !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_NAME ) && |
|
987 !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_USERID ) && |
|
988 !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_PHONE ) && |
|
989 !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_EMAIL ) ) ) |
|
990 { |
|
991 aMenuPane->SetItemDimmed( |
|
992 EChatClientFriendsListViewCmdAddFromSrv, ETrue ); |
|
993 aMenuPane->SetItemDimmed( |
|
994 EChatClientFriendsListViewCmdAddFromPb, ETrue ); |
|
995 } |
|
996 if ( !IMUtils::IntResourceValueL( |
|
997 RSC_CHAT_VARIATION_MSISDN_SUPPORT ) ) |
|
998 { |
|
999 aMenuPane->SetItemDimmed( |
|
1000 EChatClientFriendsListViewCmdAddFromPb, ETrue ); |
|
1001 } |
|
1002 |
|
1003 |
|
1004 break; |
|
1005 } |
|
1006 |
|
1007 case R_CHATCLIENT_FRIENDSLIST_EDIT_SUBMENU: |
|
1008 { |
|
1009 TBool manualUpdate( !iAppUi->GetProcessManager().GetSettingsInterface() |
|
1010 ->GetBoolValuePC( TEnumsPC::EAutomaticPresenceUpdate , NULL ) ); |
|
1011 |
|
1012 // if manual update is on, we should not have watch in menu |
|
1013 if ( manualUpdate ) |
|
1014 { |
|
1015 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdRemoveWatch, |
|
1016 ETrue ); |
|
1017 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdAddWatch, |
|
1018 ETrue ); |
|
1019 } |
|
1020 else |
|
1021 { |
|
1022 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdRemoveWatch, |
|
1023 !iContainer->IsWatched() ); |
|
1024 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdAddWatch, |
|
1025 iContainer->IsWatched() ); |
|
1026 } |
|
1027 |
|
1028 // "move" option is not shown if there isn't at |
|
1029 // least 2 contact lists |
|
1030 TInt listCount = iMainViewArrayPC->ListCountL(); |
|
1031 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdMove, |
|
1032 listCount < minContactLists ); |
|
1033 break; |
|
1034 } |
|
1035 case R_QTN_CHAT_FRIEND_EDIT_OPTIONS_SUBMENU: |
|
1036 { |
|
1037 TBool manualUpdate( !iAppUi->GetProcessManager().GetSettingsInterface() |
|
1038 ->GetBoolValuePC( TEnumsPC::EAutomaticPresenceUpdate , NULL ) ); |
|
1039 |
|
1040 // if manual update is on, we should not have watch in menu |
|
1041 if ( manualUpdate ) |
|
1042 { |
|
1043 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdRemoveWatch, |
|
1044 ETrue ); |
|
1045 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdAddWatch, |
|
1046 ETrue ); |
|
1047 } |
|
1048 else |
|
1049 { |
|
1050 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdRemoveWatch, |
|
1051 !iContainer->IsWatched() ); |
|
1052 aMenuPane->SetItemDimmed( EChatClientFriendsListViewCmdAddWatch, |
|
1053 iContainer->IsWatched() ); |
|
1054 } |
|
1055 |
|
1056 // "move" option is not shown if there isn't at |
|
1057 // least 2 contact lists |
|
1058 TInt listCount = iMainViewArrayPC->ListCountL(); |
|
1059 |
|
1060 aMenuPane->SetItemDimmed( EChatClientSingleListViewCmdMove, |
|
1061 listCount < minContactLists ); |
|
1062 break; |
|
1063 } |
|
1064 case R_QTN_CHAT_FRIEND_OWN_OPTIONS_SUBMENU: |
|
1065 { |
|
1066 TEnumsPC::TOnlineStatus onlineStatus = iContainer->GetOnlineStatus(); |
|
1067 // UI CR ID :101-39726: Status message variation : start |
|
1068 TBool ownStatusOnline( onlineStatus == TEnumsPC::EOnline ); |
|
1069 TBool ownStatusAway( onlineStatus == TEnumsPC::EAway ); |
|
1070 TBool ownStatusBusy( onlineStatus == TEnumsPC::EBusy ); |
|
1071 |
|
1072 /* The option "status Message" is available depending upon different variation flags. |
|
1073 * e.g :If "CHAT_VARIATION_ONLINE_OPTION " is supported then |
|
1074 * user has the option "status Message" when User status is online, not present for |
|
1075 * other status.(busy ,away) |
|
1076 * In the same way it works for " away " and "busy " status, depending upon |
|
1077 * "RSC_CHAT_VARIATION_AWAY_OPTION" and "RSC_CHAT_VARIATION_BUSY_OPTION" flags */ |
|
1078 |
|
1079 TBool statusMsgOnline( IMUtils::IntResourceValueL( |
|
1080 RSC_CHAT_VARIATION_ONLINE_OPTION ) ); |
|
1081 TBool statusMsgAway( IMUtils::IntResourceValueL( |
|
1082 RSC_CHAT_VARIATION_AWAY_OPTION ) ); |
|
1083 TBool statusMsgBusy( IMUtils::IntResourceValueL( |
|
1084 RSC_CHAT_VARIATION_BUSY_OPTION ) ); |
|
1085 |
|
1086 TBool option( ( ownStatusOnline && statusMsgOnline ) |
|
1087 || ( ownStatusAway && statusMsgAway ) |
|
1088 || ( ownStatusBusy && statusMsgBusy ) ); |
|
1089 |
|
1090 if ( ( onlineStatus == TEnumsPC::EOffline ) |
|
1091 || ( onlineStatus == TEnumsPC::EInvisible ) |
|
1092 || ( !option ) ) |
|
1093 { |
|
1094 aMenuPane->SetItemDimmed( EChatClientSingleListViewCmdChangeMessage, |
|
1095 ETrue ); |
|
1096 } |
|
1097 break; |
|
1098 // UI CR ID :101-39726: Status message variation : End |
|
1099 |
|
1100 } |
|
1101 case R_CHAT_FRIEND_NEW_CHAT_SUBMENU: |
|
1102 { |
|
1103 // check if search is supported for contact |
|
1104 // branding: check if there are any available search criteria |
|
1105 if ( !UISessionManager().IsSupported( CCAUISessionManager::ESearch ) || |
|
1106 ( !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_NAME ) && |
|
1107 !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_USERID ) && |
|
1108 !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_PHONE ) && |
|
1109 !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_EMAIL ) ) ) |
|
1110 { |
|
1111 aMenuPane->SetItemDimmed( EChatClientSingleListViewCmdSearchContact, |
|
1112 ETrue ); |
|
1113 } |
|
1114 |
|
1115 // for create group option |
|
1116 // check if group is supported |
|
1117 TBool isGroupSupported = UISessionManager().IsSupported( CCAUISessionManager::EGroup ); |
|
1118 if ( ! isGroupSupported ) |
|
1119 { |
|
1120 aMenuPane->SetItemDimmed( EChatClientSingleListViewCmdCreateGrp, ETrue ); |
|
1121 } |
|
1122 |
|
1123 // check if search is supported for group |
|
1124 // branding: check if there are any available search criteria |
|
1125 if ( !isGroupSupported || |
|
1126 ( !UISessionManager().IsSupported( CCAUISessionManager::ESearch ) ) || |
|
1127 ( !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_GROUPNAME ) && |
|
1128 !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_GROUPTOPIC ) && |
|
1129 !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_SEARCH_GROUPMEMBER ) ) ) |
|
1130 { |
|
1131 aMenuPane->SetItemDimmed( EChatClientSingleListViewCmdSearchGrp, ETrue ); |
|
1132 } |
|
1133 |
|
1134 if ( !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_JOIN_CHAT_ROOM_MANUAL ) ) |
|
1135 { |
|
1136 aMenuPane->SetItemDimmed( EChatClientSingleListViewCmdEnterGrpID, ETrue ); |
|
1137 } |
|
1138 break; |
|
1139 } |
|
1140 case R_CHAT_GROUP_OPTIONS_SUBMENU: |
|
1141 { |
|
1142 TBool isJoined = iContainer->IsJoinedToGroup(); |
|
1143 TBool isFavourite = iContainer->IsFavourite(); |
|
1144 TBool isOwner = iContainer->IsOwnGroup(); |
|
1145 TBool isAdminOrOwner = iContainer->IsUserAdmin(); |
|
1146 |
|
1147 if ( !isJoined || !isAdminOrOwner ) |
|
1148 { |
|
1149 aMenuPane->SetItemDimmed( EChatClientSingleListViewCmdGroupEdit, ETrue ); |
|
1150 } |
|
1151 aMenuPane->SetItemDimmed( EChatClientSingleListViewCmdGroupFavor, ownStatusOffLine || isFavourite ); |
|
1152 aMenuPane->SetItemDimmed( EChatClientSingleListViewCmdGroupRmv, |
|
1153 ( ! ( ( isFavourite || isOwner ) && !isJoined ) ) ); |
|
1154 aMenuPane->SetItemDimmed( EChatClientSingleListViewCmdGroupPart, ownStatusOffLine || !isJoined ); |
|
1155 aMenuPane->SetItemDimmed( EChatClientSingleListViewCmdGroupInfo, ownStatusOffLine || !isJoined ); |
|
1156 break; |
|
1157 } |
|
1158 default: |
|
1159 { |
|
1160 // nothing to do |
|
1161 break; |
|
1162 } |
|
1163 } |
|
1164 } |
|
1165 |
|
1166 // --------------------------------------------------------- |
|
1167 // CCASingleListView::HandleCommandL( TInt aCommand ) |
|
1168 // From CAknView, takes care of command handling. |
|
1169 // (other items were commented in a header). |
|
1170 // --------------------------------------------------------- |
|
1171 // |
|
1172 void CCASingleListView::HandleCommandL( TInt aCommand ) |
|
1173 { |
|
1174 // If background login is underway, avoid all single list events. |
|
1175 if ( iAppUi->UISessionManager().IsBackgroundTaskRunning() ) |
|
1176 return; |
|
1177 |
|
1178 // hide the context menu if active |
|
1179 if ( iContextMenuBar->IsDisplayed() ) |
|
1180 { |
|
1181 iContextMenuBar->StopDisplayingMenuBar(); |
|
1182 } |
|
1183 |
|
1184 //Store the contact pointer to local variable |
|
1185 //TPtrC contact; |
|
1186 TInt focusedIndex = iContainer->CurrentListboxIndex(); |
|
1187 HBufC* focusedIdBuf = iMainViewArrayPC->GetSelectedContactUserId(focusedIndex).AllocLC(); |
|
1188 TPtrC focusedId = focusedIdBuf->Des(); |
|
1189 |
|
1190 iCurrentIndex = iContainer->CurrentListboxIndex(); |
|
1191 iItemDetails = iMainViewArrayPC->GetArrayItemIdDetails( iCurrentIndex ); |
|
1192 |
|
1193 switch ( aCommand ) |
|
1194 { |
|
1195 case EChatClientSingleListViewCmdMove: |
|
1196 case EChatClientSingleListViewCmdDelete: |
|
1197 case EChatClientSingleListViewCmdChangeMessage: |
|
1198 case EChatClientSingleListViewCmdDetails: |
|
1199 case EChatClientSingleListViewCmdEdit: |
|
1200 case EChatClientFriendsListViewCmdAddManually: |
|
1201 case EChatClientFriendsListViewCmdMoveFromSrv: |
|
1202 case EChatClientFriendsListViewCmdMove: |
|
1203 case EChatClientFriendsListViewCmdBlock: |
|
1204 case EChatClientFriendsListViewCmdBlockEnter: |
|
1205 case EChatClientFriendsListViewCmdRefresh: |
|
1206 case EChatClientFriendsListViewCmdFetchFailed: |
|
1207 case EChatClientFriendsListViewShowBlockedList: |
|
1208 case EChatClientFriendsListViewUnblock: |
|
1209 case EChatClientFriendsListViewCmdFindJoinedChats: |
|
1210 case EChatClientFriendsListViewCmdAddFromSrv: |
|
1211 case EChatClientFriendsListViewCmdChangeList: |
|
1212 case EChatClientCmdNewList: |
|
1213 case EChatClientCmdRenameList: |
|
1214 case EChatClientMainViewCmdChangeStatus: |
|
1215 case EChatPrivateListCmdAddToFriends: |
|
1216 case EChatPrivateListWriteNewConvers: |
|
1217 case EChatPrivateListCmdSelectRecipient: |
|
1218 case EChatClientFriendsListViewCmdAddFromPb: |
|
1219 case EChatClientSingleListViewCmdGroupOpen: |
|
1220 case EChatClientSingleListViewCmdGroupJoin: |
|
1221 case EChatClientSingleListViewCmdGroupLeave: |
|
1222 case EChatClientSingleListViewCmdGroupRmv: |
|
1223 case EChatClientSingleListViewCmdGroupPart: |
|
1224 case EChatClientSingleListViewCmdGroupInfo: |
|
1225 case EChatClientSingleListViewCmdGroupFavor: |
|
1226 case EChatClientSingleListViewCmdGroupEdit: |
|
1227 case EChatClientSingleListViewCmdCreateGrp: |
|
1228 case EChatClientSingleListViewCmdSearchGrp: |
|
1229 case EChatClientSingleListViewCmdSearchContact: |
|
1230 case EChatClientCmdOpenGroupConv: |
|
1231 case EChatClientFriendsListViewCmdEdit: |
|
1232 case EChatClientSingleListViewCmdOwnEdit: |
|
1233 { |
|
1234 if ( !UISessionManager().LoginL( MCAUiLoginCmdCB::EQueryLogin ) ) |
|
1235 { |
|
1236 CleanupStack::PopAndDestroy(focusedIdBuf); |
|
1237 |
|
1238 return; |
|
1239 } |
|
1240 |
|
1241 break; |
|
1242 } |
|
1243 default: |
|
1244 { |
|
1245 break; |
|
1246 } |
|
1247 } |
|
1248 |
|
1249 #ifdef IMPS_CONTACT_FETCH_BACKGROUND |
|
1250 switch ( aCommand ) |
|
1251 { |
|
1252 case EChatClientSingleListViewCmdMove: |
|
1253 case EChatClientSingleListViewCmdDelete: |
|
1254 case EChatClientSingleListViewCmdEdit: |
|
1255 case EChatClientFriendsListViewCmdAddManually: |
|
1256 case EChatClientFriendsListViewCmdMoveFromSrv: |
|
1257 case EChatClientFriendsListViewCmdMove: |
|
1258 case EChatClientFriendsListViewCmdRefresh: |
|
1259 //case EChatClientFriendsListViewCmdAddFromSrv: |
|
1260 case EChatClientCmdNewList: |
|
1261 case EChatClientCmdRenameList: |
|
1262 case EChatClientFriendsListViewCmdDelete: |
|
1263 case EChatClientFriendsListViewCmdAddFromPb: |
|
1264 case EChatClientFriendsListViewCmdEdit: |
|
1265 case EChatPrivateListCmdAddToFriends: |
|
1266 //case EChatPrivateListWriteNewConvers: |
|
1267 case EChatPrivateListCmdSelectRecipient: |
|
1268 //case EChatClientSingleListViewCmdSearchContact: |
|
1269 case EChatClientSingleListViewCmdCreateGrp: |
|
1270 //joing to a group does not require any |
|
1271 //synchronization with the contact list. |
|
1272 |
|
1273 case EChatClientFriendsListViewShowBlockedList: |
|
1274 |
|
1275 //case EChatClientSingleListViewCmdSearchGrp: |
|
1276 //case EChatClientSingleListViewCmdGroupOpen: |
|
1277 //case EChatClientSingleListViewCmdGroupJoin: |
|
1278 //case EChatClientSingleListViewCmdGroupLeave: |
|
1279 case EChatClientSingleListViewCmdGroupRmv: |
|
1280 case EChatClientSingleListViewCmdGroupPart: |
|
1281 case EChatClientSingleListViewCmdGroupInfo: |
|
1282 case EChatClientSingleListViewCmdGroupFavor: |
|
1283 case EChatClientSingleListViewCmdGroupEdit: |
|
1284 case EChatClientCmdOpenGroupConv: |
|
1285 |
|
1286 { |
|
1287 if ( !CCASyncChecker::CheckSyncStateL() ) |
|
1288 { |
|
1289 CleanupStack::PopAndDestroy(focusedIdBuf); |
|
1290 |
|
1291 return; |
|
1292 } |
|
1293 break; |
|
1294 |
|
1295 } |
|
1296 default: |
|
1297 { |
|
1298 break; |
|
1299 } |
|
1300 } |
|
1301 #endif //IMPS_CONTACT_FETCH_BACKGROUND |
|
1302 |
|
1303 switch ( aCommand ) |
|
1304 { |
|
1305 case EChatClientCmdExpandList: // flowthrough |
|
1306 case EChatClientCmdCollapseList: |
|
1307 { |
|
1308 iContainer->ExpandCollapseListL(); |
|
1309 break; |
|
1310 } |
|
1311 case EChatClientCmdNewList: |
|
1312 { |
|
1313 TInt index = KErrNotFound; |
|
1314 TInt err = CCAUINGUtils::NewContactListL( index ); |
|
1315 if ( index != KErrNotFound ) |
|
1316 { |
|
1317 iContainer->UpdateViewL( index, TEnumsPC::EContactListItem, ETrue ); |
|
1318 } |
|
1319 break; |
|
1320 } |
|
1321 case EChatClientCmdRenameList: |
|
1322 { |
|
1323 iContainer->RenameListL(); |
|
1324 break; |
|
1325 } |
|
1326 |
|
1327 case EChatClientCmdContextMenu: |
|
1328 { |
|
1329 iContextMenuBar->TryDisplayMenuBarL(); |
|
1330 break; |
|
1331 } |
|
1332 case EChatClientFriendsListViewCmdDelete: |
|
1333 { |
|
1334 iContainer->DeleteFriendL(); |
|
1335 break; |
|
1336 } |
|
1337 case EChatClientFriendsListViewCmdOpen: |
|
1338 { |
|
1339 iContainer->ShowDetailsL(); |
|
1340 UpdateTitleL(); |
|
1341 break; |
|
1342 } |
|
1343 |
|
1344 case EChatClientFriendsListViewCmdAddWatch: |
|
1345 { |
|
1346 TPtrC userid( iContainer->SelectedUserId() ); |
|
1347 CHAT_DP( D_CHAT_LIT( |
|
1348 "CCASingleListView -> addwatcher to %S" ), &userid ); |
|
1349 iMainViewArrayPC->AddWatcherL( userid ); |
|
1350 iContainer->RefreshView( EFalse ); |
|
1351 break; |
|
1352 } |
|
1353 |
|
1354 case EChatClientFriendsListViewCmdRemoveWatch: |
|
1355 { |
|
1356 TPtrC userid( iContainer->SelectedUserId() ); |
|
1357 CHAT_DP( D_CHAT_LIT( |
|
1358 "CCASingleListView -> removewatcher from %S" ), &userid ); |
|
1359 iMainViewArrayPC->RemoveWatcherL( userid ); |
|
1360 iContainer->RefreshView( EFalse ); |
|
1361 break; |
|
1362 } |
|
1363 |
|
1364 case EChatClientFriendsListViewCmdAddManually: |
|
1365 { |
|
1366 iContainer->SetCbaLockL( ETrue ); |
|
1367 TInt indexofcontact( iContainer->EditFriendL( TEnumsPC::ECreateNew ) ); |
|
1368 |
|
1369 if ( iContainer ) |
|
1370 { |
|
1371 // if the container still exists, update the view |
|
1372 if ( UISessionManager().IsLoggedIn() ) |
|
1373 { |
|
1374 iContainer->UpdateViewL( indexofcontact, TEnumsPC::EContactItem, ETrue ); |
|
1375 iContainer->SetCbaLockL( EFalse ); |
|
1376 UpdateTitleL(); |
|
1377 } |
|
1378 } |
|
1379 break; |
|
1380 } |
|
1381 |
|
1382 case EChatClientFriendsListViewCmdAddFromPb: |
|
1383 { |
|
1384 if ( UISessionManager().IsSupported( CCAUISessionManager::ESearch ) ) |
|
1385 { |
|
1386 // Check disk space before creating new contact, |
|
1387 // needed to do allready here in this case |
|
1388 IMUtils::FFSSpaceBelowCriticalLevelL( KContactSizeEstimate ); |
|
1389 |
|
1390 iContainer->ContactSelectionFromPhoneBookL(); |
|
1391 } |
|
1392 else |
|
1393 { |
|
1394 IMDialogUtils::DisplayNoteDialogL( |
|
1395 R_CHAT_ERROR_NOT_SUP_FUNCTIONS ); |
|
1396 } |
|
1397 break; |
|
1398 } |
|
1399 |
|
1400 case EChatClientFriendsListViewCmdMove: |
|
1401 { |
|
1402 iContainer->MoveContactL(); |
|
1403 break; |
|
1404 } |
|
1405 |
|
1406 case EChatClientFriendsListViewCmdEdit: |
|
1407 { |
|
1408 TInt indexofcontact( iContainer->EditFriendL( TEnumsPC::EEditContact ) ); |
|
1409 if ( iContainer ) |
|
1410 { |
|
1411 // if the container still exists, update the view |
|
1412 iContainer->UpdateViewL( indexofcontact, TEnumsPC::EContactItem, ETrue ); |
|
1413 UpdateTitleL(); |
|
1414 } |
|
1415 break; |
|
1416 } |
|
1417 |
|
1418 case EChatClientFriendsListViewCmdIMessage: |
|
1419 { |
|
1420 iContainer->OpenConversationL(); |
|
1421 break; |
|
1422 } |
|
1423 |
|
1424 case EChatClientFriendsListViewCmdBlock: |
|
1425 { |
|
1426 iContainer->BlockUserL(); |
|
1427 break; |
|
1428 } |
|
1429 case EChatClientFriendsListViewCmdBlockEnter: |
|
1430 { |
|
1431 iContainer->DisplayBlockTextQueryL(); |
|
1432 break; |
|
1433 } |
|
1434 case EChatClientFriendsListViewCmdRefresh: |
|
1435 { |
|
1436 // this is manually selected |
|
1437 iContainer->RefreshPresenceL( ETrue ); |
|
1438 break; |
|
1439 } |
|
1440 case EChatClientFriendsListViewCmdFetchFailed: |
|
1441 { |
|
1442 if ( TEnumsPC::ESyncFailed == iMainViewArrayPC->Synchronised( GetCurrentItemIndex( ) ) ) |
|
1443 { |
|
1444 TInt ret( IMDialogUtils::DisplayYesNoConfirmationDialogL( |
|
1445 R_QTN_CHAT_CONTACTLIST_FETCHAGAIN ) ); |
|
1446 if ( !( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) ) |
|
1447 { |
|
1448 break; |
|
1449 } |
|
1450 |
|
1451 } |
|
1452 |
|
1453 iMainViewArrayPC->FetchContactsL(); |
|
1454 break; |
|
1455 } |
|
1456 case EChatClientFriendsListViewShowBlockedList: |
|
1457 { |
|
1458 iContainer->DisplayBlockedListL(); |
|
1459 break; |
|
1460 } |
|
1461 case EChatClientFriendsListViewUnblock: |
|
1462 { |
|
1463 iContainer->DisplayUnblockListQueryL(); |
|
1464 break; |
|
1465 } |
|
1466 case EChatClientFriendsListViewCmdFindJoinedChats: |
|
1467 { |
|
1468 // check if the groups are supported |
|
1469 if ( IsFunctionSupported( CCAUISessionManager::EGroup ) ) |
|
1470 { |
|
1471 iContainer->FindJoinedChatsL(); |
|
1472 } |
|
1473 break; |
|
1474 } |
|
1475 |
|
1476 case EChatClientMainViewCmdLogin: |
|
1477 { |
|
1478 iAppUi->UISessionManager().LoginL( MCAUiLoginCmdCB::ELogin ); |
|
1479 break; |
|
1480 } |
|
1481 |
|
1482 case EChatClientMainViewCmdLogout: |
|
1483 { |
|
1484 iMainViewArrayPC->AddObserver( this ); |
|
1485 AppUi()->HandleCommandL( EChatClientMainViewCmdLogout ); |
|
1486 SetCurrentItemIndexL(); |
|
1487 break; |
|
1488 } |
|
1489 case EChatClientChatListSettings: |
|
1490 { |
|
1491 AppUi()->HandleCommandL( EChatClientChatListSettings ); |
|
1492 // Force refresh the CBA! |
|
1493 iContainer->UpdateCbaL(); |
|
1494 break; |
|
1495 } |
|
1496 case EAknSoftkeyOpen: |
|
1497 // case EChatPrivateListCmdOpen: |
|
1498 { |
|
1499 if ( iMainViewArrayPC->GetType( GetCurrentItemIndex() ) == TEnumsPC::EInviteItem ) |
|
1500 { |
|
1501 iContainer->OpenInvitationL(); |
|
1502 } |
|
1503 |
|
1504 break; |
|
1505 } |
|
1506 case EChatPrivateListCmdDelete: |
|
1507 { |
|
1508 iContainer->DeleteInvitationL(); |
|
1509 break; |
|
1510 } |
|
1511 case EChatPrivateListCmdAddToFriends: |
|
1512 { |
|
1513 iContainer->SetCbaLockL( ETrue ); |
|
1514 TEnumsPC::TItem itemType = iContainer->SelectedType(); |
|
1515 TInt prevIndex( iContainer->EditFriendL( TEnumsPC::EAddToContact ) ); |
|
1516 |
|
1517 if ( iContainer ) |
|
1518 { |
|
1519 // if the container still exists, update the view |
|
1520 if ( UISessionManager().IsLoggedIn() ) |
|
1521 { |
|
1522 iContainer->UpdateViewL( prevIndex, itemType, ETrue ); |
|
1523 iContainer->SetCbaLockL( EFalse ); |
|
1524 UpdateTitleL(); |
|
1525 } |
|
1526 } |
|
1527 break; |
|
1528 } |
|
1529 // Flow-through |
|
1530 case EAknSoftkeyExit: |
|
1531 case EChatClientCmdExit: |
|
1532 { |
|
1533 CHAT_DP( D_CHAT_LIT( " CCASingleListView -> BACK command start" ) ); |
|
1534 |
|
1535 if ( iAlreadyTrytoExit ) |
|
1536 { |
|
1537 break; |
|
1538 } |
|
1539 iAlreadyTrytoExit = ETrue; |
|
1540 |
|
1541 TRAPD( err, AppUi()->HandleCommandL( EAknSoftkeyExit ) ); |
|
1542 |
|
1543 iAlreadyTrytoExit = EFalse; |
|
1544 User::LeaveIfError( err ); |
|
1545 |
|
1546 // getcalled whenever the exit RSk presesd |
|
1547 // it delete the findbox so that no more operation will be called |
|
1548 // for iFindBox, because it was giving panic in FocusChaged of container |
|
1549 if ( iAppUi->IsQueryAccepted() ) |
|
1550 { |
|
1551 iContainer->PrepareDestruction(); |
|
1552 } |
|
1553 CHAT_DP( D_CHAT_LIT( " CCASingleListView -> BACK command end" ) ); |
|
1554 break; |
|
1555 } |
|
1556 case EChatClientFriendsListViewCmdAddFromSrv: |
|
1557 case EChatClientSingleListViewCmdSearchContact: |
|
1558 { |
|
1559 // check the init pending show note and then process |
|
1560 CompletePendingTaskForSearchL() ; |
|
1561 |
|
1562 break; |
|
1563 } |
|
1564 // Help key support EChatClientCmdHelp is assigned EAknCmdHelp in |
|
1565 // chatngclient.hrh |
|
1566 case EChatClientCmdHelp: |
|
1567 { |
|
1568 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
1569 AppUi()->AppHelpContextL() ); |
|
1570 break; |
|
1571 } |
|
1572 case EChatPrivateListCmdOpen: |
|
1573 case EChatClientFriendsListViewCmdChat: |
|
1574 { |
|
1575 //TPtrC item = iContainer->SelectedItem(); |
|
1576 TEnumsPC::TItem itemtype = iContainer->SelectedType(); |
|
1577 if ( itemtype == TEnumsPC::EContactItem |
|
1578 || itemtype == TEnumsPC::EConversationItem ) |
|
1579 { |
|
1580 // Don't try to open conversation if selected item is |
|
1581 // not a contact |
|
1582 iContainer->OpenConversationL(); |
|
1583 } |
|
1584 |
|
1585 else if ( itemtype == TEnumsPC::EInviteItem ) |
|
1586 { |
|
1587 iContainer->OpenInvitationL(); |
|
1588 } |
|
1589 break; |
|
1590 } |
|
1591 case EChatPrivateListCmdCloseConvers: |
|
1592 { |
|
1593 iContainer->CloseConversationL(); |
|
1594 break; |
|
1595 } |
|
1596 case EChatPrivateListWriteNewConvers: |
|
1597 { |
|
1598 iContainer->DisplayRecipientTextQueryL(); |
|
1599 break; |
|
1600 } |
|
1601 case EChatPrivateListCmdSelectRecipient: |
|
1602 { |
|
1603 iContainer->DisplayRecipientListQueryL(); |
|
1604 break; |
|
1605 } |
|
1606 |
|
1607 case EChatClientSingleListViewCmdSearchGrp: |
|
1608 { |
|
1609 if ( UISessionManager().IsSupported( CCAUISessionManager::ESearch ) ) |
|
1610 { |
|
1611 // Check disk space before creating new contact, |
|
1612 // needed to do allready here in this case |
|
1613 IMUtils::FFSSpaceBelowCriticalLevelL( KContactSizeEstimate ); |
|
1614 |
|
1615 if ( CCASearchViewContainer::DisplaySearchCriteriaDlgL( |
|
1616 CCASearchViewContainer::ESearchGroups ) ) |
|
1617 { |
|
1618 CAViewSwitcher()->SwitchViewL( KUidSearchView, |
|
1619 KUidSearchViewMsgIdGroup, |
|
1620 KNullDesC8 ); |
|
1621 } |
|
1622 } |
|
1623 else |
|
1624 { |
|
1625 IMDialogUtils::DisplayNoteDialogL( |
|
1626 R_CHAT_ERROR_NOT_SUP_FUNCTIONS ); |
|
1627 } |
|
1628 break; |
|
1629 } |
|
1630 case EChatClientSingleListViewCmdEnterGrpID : |
|
1631 { |
|
1632 HBufC* data = HBufC::NewLC( KMaxChatGroupLenght ); |
|
1633 TPtr dataPtr( data->Des() ); |
|
1634 iContainer->DisplayRecipientTextQueryForGrpIDL( dataPtr ); |
|
1635 CleanupStack::PopAndDestroy( data ); |
|
1636 break; |
|
1637 } |
|
1638 case EChatClientSingleListViewCmdEdit: |
|
1639 { |
|
1640 TInt indexofcontact( iContainer->EditFriendL( TEnumsPC::EEditContact ) ); |
|
1641 if ( iContainer ) |
|
1642 { |
|
1643 // if the container still exists, update the view |
|
1644 if ( UISessionManager().IsLoggedIn() ) |
|
1645 { |
|
1646 iContainer->UpdateViewL( indexofcontact, TEnumsPC::EContactItem, ETrue ); |
|
1647 } |
|
1648 // No matter login or not, title should be updated |
|
1649 UpdateTitleL(); |
|
1650 } |
|
1651 break; |
|
1652 } |
|
1653 case EChatClientSingleListViewCmdDetails: |
|
1654 { |
|
1655 iContainer->ShowDetailsL(); |
|
1656 UpdateTitleL(); |
|
1657 break; |
|
1658 } |
|
1659 case EChatClientSingleListViewCmdChangeMessage: |
|
1660 { |
|
1661 AppUi()->HandleCommandL( EChatClientCmdStatusMessage ); |
|
1662 break; |
|
1663 } |
|
1664 |
|
1665 case EChatClientSingleListViewCmdOwnEdit: |
|
1666 { |
|
1667 TInt indexofcontact( iContainer->EditFriendL( TEnumsPC::EEditContact ) ); |
|
1668 if ( iContainer ) |
|
1669 { |
|
1670 // if the container still exists, update the view |
|
1671 iContainer->UpdateViewL( indexofcontact, TEnumsPC::EOwnStatusItem, ETrue ); |
|
1672 UpdateTitleL(); |
|
1673 } |
|
1674 } |
|
1675 case EChatClientSingleListViewCmdDelete: |
|
1676 { |
|
1677 iContainer->DeleteFriendL(); |
|
1678 break; |
|
1679 } |
|
1680 case EChatClientSingleListViewCmdMove: |
|
1681 { |
|
1682 if ( iContainer->IsWatched() ) |
|
1683 { |
|
1684 HBufC* userid = iContainer->SelectedUserId().AllocLC(); |
|
1685 iContainer->MoveContactL(); |
|
1686 iMainViewArrayPC->AddWatcherL( userid->Des() ); |
|
1687 CleanupStack::PopAndDestroy( userid ); |
|
1688 iContainer->RefreshView( EFalse ); |
|
1689 } |
|
1690 else |
|
1691 { |
|
1692 iContainer->MoveContactL(); |
|
1693 } |
|
1694 break; |
|
1695 } |
|
1696 case EChatClientSingleListViewCmdSavedConversations: //Recorded Chat list view |
|
1697 { |
|
1698 CAViewSwitcher()->SwitchViewL( KUidRecordedChatListView ); |
|
1699 break; |
|
1700 } |
|
1701 //Group options should be shown only if group feature is supported |
|
1702 case EChatClientSingleListViewCmdCreateGrp: //Group Chat view |
|
1703 { |
|
1704 //iCurrentIndex = iContainer->CurrentListboxIndex(); |
|
1705 //iItemDetails = iMainViewArrayPC->GetArrayItemIdDetails( iCurrentIndex ); |
|
1706 if ( IsFunctionSupported( CCAUISessionManager::EGroup ) ) |
|
1707 { |
|
1708 HBufC* groupId = iContainer->CreateNewChatL(); |
|
1709 CleanupStack::PushL( groupId ); |
|
1710 CleanupStack::PopAndDestroy( groupId ); |
|
1711 } |
|
1712 break; |
|
1713 } |
|
1714 case EChatClientCmdOpenGroupConv: |
|
1715 { |
|
1716 //iItemDetails = iMainViewArrayPC->GetArrayItemIdDetails( iContainer->CurrentListboxIndex() ); |
|
1717 //iCreateGrpFromContactList = ETrue; |
|
1718 if ( IsFunctionSupported( CCAUISessionManager::EGroup ) ) |
|
1719 { |
|
1720 HBufC* groupId = iContainer->CreateNewChatL(); |
|
1721 CleanupStack::PushL( groupId ); |
|
1722 CleanupStack::PopAndDestroy( groupId ); |
|
1723 } |
|
1724 break; |
|
1725 } |
|
1726 // Options for when focus is on group chat case EAknSoftkeyOpen: |
|
1727 // This case can be merged with the case for invitation item (EChatPrivateListCmdOpen) |
|
1728 case EChatClientSingleListViewCmdGroupOpen: // Flowthrough |
|
1729 case EChatClientSingleListViewCmdGroupJoin: |
|
1730 { |
|
1731 //iCurrentIndex = iContainer->CurrentListboxIndex(); |
|
1732 //iItemDetails = iMainViewArrayPC->GetArrayItemIdDetails( iCurrentIndex ); |
|
1733 |
|
1734 // When we have already tried to join a group, just get out |
|
1735 if ( iAlreadyTrytoJoinGroup ) |
|
1736 break; |
|
1737 |
|
1738 // Try to join a group |
|
1739 iAlreadyTrytoJoinGroup = ETrue; |
|
1740 |
|
1741 HBufC* groupId = focusedId.AllocLC(); |
|
1742 TRAPD( err, iContainer->JoinGroupL( *groupId ) ); |
|
1743 |
|
1744 // Finish join the group |
|
1745 iAlreadyTrytoJoinGroup = EFalse; |
|
1746 |
|
1747 CleanupStack::PopAndDestroy( groupId ); |
|
1748 User::LeaveIfError( err ); |
|
1749 |
|
1750 break; |
|
1751 } |
|
1752 case EChatClientSingleListViewCmdGroupLeave: |
|
1753 { |
|
1754 TInt currentIndex = iContainer->CurrentListboxIndex(); |
|
1755 TInt indexOfList = iMainViewArrayPC->IndexOfList( currentIndex - 1 ); |
|
1756 TInt countOfContactsInList = iMainViewArrayPC->CountOfContactsInList( indexOfList ); |
|
1757 |
|
1758 TCAItemDetails itemDetails = iMainViewArrayPC->GetArrayItemIdDetails( currentIndex ); |
|
1759 iContainer->LeaveGroupL(); |
|
1760 |
|
1761 if ( !iAppUi->GroupUtils()->IsOwnGroup( itemDetails.aItemID ) |
|
1762 && !iAppUi->GroupUtils()->IsFavouriteChatGroup( itemDetails.aItemID ) ) |
|
1763 { |
|
1764 if ( indexOfList + countOfContactsInList == currentIndex ) |
|
1765 { |
|
1766 --currentIndex; |
|
1767 } |
|
1768 iContainer->SetListboxIndexL( currentIndex ); |
|
1769 } |
|
1770 break; |
|
1771 } |
|
1772 case EChatClientSingleListViewCmdGroupRmv: |
|
1773 { |
|
1774 //iCurrentIndex = iContainer->CurrentListboxIndex(); |
|
1775 //iItemDetails = iMainViewArrayPC->GetArrayItemIdDetails( iCurrentIndex ); |
|
1776 iAlreadyTrytoJoinGroup = ETrue; |
|
1777 iContainer->DeleteGroupL( focusedId ); |
|
1778 iAlreadyTrytoJoinGroup = EFalse; |
|
1779 break; |
|
1780 } |
|
1781 case EChatClientSingleListViewCmdGroupPart: |
|
1782 { |
|
1783 //iCurrentIndex = iContainer->CurrentListboxIndex(); |
|
1784 //iItemDetails = iMainViewArrayPC->GetArrayItemIdDetails( iCurrentIndex ); |
|
1785 iContainer->DisplayJoinedMembersL(); |
|
1786 break; |
|
1787 } |
|
1788 case EChatClientSingleListViewCmdGroupInfo: |
|
1789 { |
|
1790 //iCurrentIndex = iContainer->CurrentListboxIndex(); |
|
1791 //iItemDetails = iMainViewArrayPC->GetArrayItemIdDetails( iCurrentIndex ); |
|
1792 iContainer->DisplayChatInfoL(); |
|
1793 break; |
|
1794 } |
|
1795 case EChatClientSingleListViewCmdGroupFavor: |
|
1796 { |
|
1797 //iCurrentIndex = iContainer->CurrentListboxIndex(); |
|
1798 //iItemDetails = iMainViewArrayPC->GetArrayItemIdDetails( iCurrentIndex ); |
|
1799 iContainer->SaveAsFavouriteL( ); |
|
1800 break; |
|
1801 } |
|
1802 case EChatClientSingleListViewCmdGroupEdit: |
|
1803 { |
|
1804 //iCurrentIndex = iContainer->CurrentListboxIndex(); |
|
1805 //iItemDetails = iMainViewArrayPC->GetArrayItemIdDetails( iCurrentIndex ); |
|
1806 iContainer->EditChatGroupPropertiesL(); |
|
1807 UpdateTitleL(); |
|
1808 break; |
|
1809 } |
|
1810 default: |
|
1811 { |
|
1812 AppUi()->HandleCommandL( aCommand ); |
|
1813 break; |
|
1814 } |
|
1815 } |
|
1816 CleanupStack::PopAndDestroy( focusedIdBuf ); |
|
1817 } |
|
1818 |
|
1819 // --------------------------------------------------------- |
|
1820 // CCASingleListView::InvokeCommandL |
|
1821 // --------------------------------------------------------- |
|
1822 // |
|
1823 void CCASingleListView::InvokeCommandL( TInt aCommand ) |
|
1824 { |
|
1825 HandleCommandL( aCommand ); |
|
1826 } |
|
1827 |
|
1828 // --------------------------------------------------------- |
|
1829 // CCASingleListView::UpdateTitleL |
|
1830 // --------------------------------------------------------- |
|
1831 // |
|
1832 void CCASingleListView::UpdateTitleL() |
|
1833 { |
|
1834 CAAppUi()->CAStatusPane()->SetTitleL( iEikonEnv, |
|
1835 R_CHATCLIENT_MAIN_VIEW_TITLE ); |
|
1836 } |
|
1837 // --------------------------------------------------------- |
|
1838 // CCASingleListView::ConstructContextMenuBarL |
|
1839 // (other items were commented in a header). |
|
1840 // --------------------------------------------------------- |
|
1841 // |
|
1842 void CCASingleListView::ConstructContextMenuBarL() |
|
1843 { |
|
1844 if ( iContextMenuBar ) |
|
1845 { |
|
1846 iEikonEnv->EikAppUi()->RemoveFromStack( iContextMenuBar ); |
|
1847 delete iContextMenuBar; |
|
1848 iContextMenuBar = NULL; |
|
1849 } |
|
1850 TEnumsPC::TItem itemtype = iContainer->SelectedType(); |
|
1851 |
|
1852 CEikMenuBar* menuBar = new ( ELeave ) CEikMenuBar(); |
|
1853 CleanupStack::PushL( menuBar ); |
|
1854 menuBar->ConstructL( this, NULL, |
|
1855 R_CHATCLIENT_FRIENDSLIST_MENUBAR_CONTEXT ); |
|
1856 iEikonEnv->EikAppUi()->AddToStackL( menuBar, ECoeStackPriorityMenu, |
|
1857 ECoeStackFlagRefusesFocus ); |
|
1858 iContextMenuBar = menuBar; |
|
1859 CleanupStack::Pop( menuBar ); |
|
1860 } |
|
1861 |
|
1862 // --------------------------------------------------------- |
|
1863 // CCASingleListView::HandleError |
|
1864 // (other items were commented in a header). |
|
1865 // --------------------------------------------------------- |
|
1866 // |
|
1867 void CCASingleListView::HandleError( TInt aError ) |
|
1868 { |
|
1869 CHAT_DP( D_CHAT_LIT( "CCASingleListView::HandleError, aError = %d" ), |
|
1870 aError ); |
|
1871 if ( ( aError > Imps_ERROR_BASE ) && ( aError < KErrNone ) ) |
|
1872 { |
|
1873 // propagate system errors to current active scheduler, |
|
1874 // it should show a note |
|
1875 CActiveScheduler::Current()->Error( aError ); |
|
1876 } |
|
1877 |
|
1878 // imps errors are ignored at the moment as we don't have any |
|
1879 // notes specified for them |
|
1880 } |
|
1881 |
|
1882 // --------------------------------------------------------- |
|
1883 // CCASingleListView::GetCurrentItemIndex |
|
1884 // (other items were commented in a header). |
|
1885 // --------------------------------------------------------- |
|
1886 // |
|
1887 TInt CCASingleListView::GetCurrentItemIndex( ) |
|
1888 { |
|
1889 if ( iContainer ) |
|
1890 { |
|
1891 return iContainer->CurrentListboxIndex(); |
|
1892 } |
|
1893 |
|
1894 return iCurrentIndex; |
|
1895 } |
|
1896 |
|
1897 // --------------------------------------------------------- |
|
1898 // CCASingleListView::SetCurrentItemIndex |
|
1899 // (other items were commented in a header). |
|
1900 // --------------------------------------------------------- |
|
1901 // |
|
1902 void CCASingleListView::SetCurrentItemIndexL( TBool aFreshLogin /* = EFalse */ ) |
|
1903 { |
|
1904 // After the logout the focus should go to owndata |
|
1905 // if it was on contactlist/contactitem |
|
1906 TInt currentIndex = GetCurrentItemIndex(); |
|
1907 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( currentIndex ); |
|
1908 if ( TEnumsPC::EInvalid == itemType || aFreshLogin ) |
|
1909 { |
|
1910 currentIndex = 0; |
|
1911 } |
|
1912 if ( iContainer ) |
|
1913 { |
|
1914 iContainer->SetListboxIndexL( currentIndex ); |
|
1915 } |
|
1916 else |
|
1917 { |
|
1918 iCurrentIndex = 0; |
|
1919 } |
|
1920 |
|
1921 } |
|
1922 |
|
1923 // --------------------------------------------------------- |
|
1924 // CCASingleListView::GetCurrentItemIndex |
|
1925 // (other items were commented in a header). |
|
1926 // --------------------------------------------------------- |
|
1927 // |
|
1928 void CCASingleListView::NotifySyncCompleted( ) |
|
1929 { |
|
1930 CCACommandManager* commandManager( NULL ); |
|
1931 TRAPD( err, commandManager = CCACommandManagerFactory::InstanceL()->GetCommandManager() ); |
|
1932 if ( err == KErrNone && commandManager ) |
|
1933 { |
|
1934 MCASessionHandlerCmd* sessHandlerCmd = commandManager->GetSessionHandlerCmd() ; |
|
1935 TBool contactsRefreshed( EFalse ); |
|
1936 if ( sessHandlerCmd ) |
|
1937 { |
|
1938 contactsRefreshed = sessHandlerCmd->ContactsRefreshed(); |
|
1939 } |
|
1940 |
|
1941 if ( !contactsRefreshed && !iAppUi->GetProcessManager().GetSettingsInterface() |
|
1942 ->GetBoolValuePC( TEnumsPC::EAutomaticPresenceUpdate , NULL ) ) |
|
1943 { |
|
1944 TRAP_IGNORE( |
|
1945 iMainViewArrayPC->RefreshFriendsL(); |
|
1946 // If something failed, we are going to ignore as in case of automatic mode |
|
1947 if ( sessHandlerCmd ) |
|
1948 { |
|
1949 sessHandlerCmd->SetContactsRefreshed( ETrue ); |
|
1950 } |
|
1951 // show the manual update note if user in same view |
|
1952 if ( iContainer && !iFirstManualRefresh ) |
|
1953 { |
|
1954 ShowManualUpdateNoteL(); |
|
1955 } |
|
1956 ); |
|
1957 } |
|
1958 } |
|
1959 iMainViewArrayPC->RemoveObserver( ); |
|
1960 } |
|
1961 // --------------------------------------------------------- |
|
1962 // CCASingleListView::HandleInitChange |
|
1963 // (other items were commented in a header). |
|
1964 // --------------------------------------------------------- |
|
1965 // |
|
1966 void CCASingleListView::HandleListInitChange( TBool aCompleted ) |
|
1967 { |
|
1968 CHAT_DP_TXT( "CCASingleListView::HandleListInitChange started" ); |
|
1969 |
|
1970 if ( aCompleted ) //list init is complete |
|
1971 { |
|
1972 |
|
1973 // hide wait note |
|
1974 if ( iWaitVisible ) |
|
1975 { |
|
1976 CHAT_DP_TXT( "CCASingleListView::HandleListInitChange - iListInitProgress" ); |
|
1977 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
1978 //CS warning ignored |
|
1979 TRAPD( err, appUi->DismissWaitDialogL( KErrNone ) ); |
|
1980 |
|
1981 if ( err != KErrNone ) |
|
1982 { |
|
1983 CActiveScheduler::Current()->Error( err ); |
|
1984 } |
|
1985 iWaitVisible = EFalse; |
|
1986 } |
|
1987 //CS warning ignored |
|
1988 TRAP_IGNORE( iMainViewArrayPC->UnRegisterObserverL(); |
|
1989 |
|
1990 if ( !iWaitVisible ) |
|
1991 { |
|
1992 if ( !CCASyncChecker::CheckSyncStateL() ) |
|
1993 { |
|
1994 return; |
|
1995 } |
|
1996 if ( UISessionManager().IsSupported( CCAUISessionManager::ESearch ) ) |
|
1997 { |
|
1998 // Check disk space before creating new contact, |
|
1999 // needed to do allready here in this case |
|
2000 IMUtils::FFSSpaceBelowCriticalLevelL( KContactSizeEstimate ); |
|
2001 |
|
2002 if ( CCASearchViewContainer::DisplaySearchCriteriaDlgL( |
|
2003 CCASearchViewContainer::ESearchUsers ) ) |
|
2004 { |
|
2005 CAViewSwitcher()->SwitchViewL( KUidSearchView, |
|
2006 KUidSearchViewMsgIdUser, |
|
2007 KNullDesC8 ); |
|
2008 } |
|
2009 |
|
2010 } |
|
2011 else |
|
2012 { |
|
2013 IMDialogUtils::DisplayNoteDialogL( |
|
2014 R_CHAT_ERROR_NOT_SUP_FUNCTIONS ); |
|
2015 } |
|
2016 } |
|
2017 ); |
|
2018 } |
|
2019 CHAT_DP_TXT( "ASingleListView::HandleListInitChange completed" ); |
|
2020 //check waiting then stop |
|
2021 } |
|
2022 // --------------------------------------------------------- |
|
2023 // CCASingleListView::HandleInitChange |
|
2024 // (other items were commented in a header). |
|
2025 // --------------------------------------------------------- |
|
2026 TBool CCASingleListView::CompletePendingTaskForSearchL() |
|
2027 { |
|
2028 CHAT_DP_TXT( "CCASingleListView::CompletePendingTaskForSearchL started" ); |
|
2029 |
|
2030 TBool result = EFalse; |
|
2031 |
|
2032 // show the wait note if we have pending list initialization |
|
2033 |
|
2034 if ( iMainViewArrayPC->IsListInitializationCompletedL() ) |
|
2035 { |
|
2036 iMainViewArrayPC->RegisterObserverL( this ); |
|
2037 // init the list |
|
2038 result = InitializeListL(); |
|
2039 |
|
2040 } |
|
2041 else |
|
2042 { |
|
2043 if ( !CCASyncChecker::CheckSyncStateL() ) |
|
2044 { |
|
2045 return EFalse; |
|
2046 } |
|
2047 if ( UISessionManager().IsSupported( CCAUISessionManager::ESearch ) ) |
|
2048 { |
|
2049 // Check disk space before creating new contact, |
|
2050 // needed to do allready here in this case |
|
2051 IMUtils::FFSSpaceBelowCriticalLevelL( KContactSizeEstimate ); |
|
2052 |
|
2053 if ( CCASearchViewContainer::DisplaySearchCriteriaDlgL( |
|
2054 CCASearchViewContainer::ESearchUsers ) ) |
|
2055 { |
|
2056 CAViewSwitcher()->SwitchViewL( KUidSearchView, |
|
2057 KUidSearchViewMsgIdUser, |
|
2058 KNullDesC8 ); |
|
2059 } |
|
2060 |
|
2061 } |
|
2062 else |
|
2063 { |
|
2064 IMDialogUtils::DisplayNoteDialogL( |
|
2065 R_CHAT_ERROR_NOT_SUP_FUNCTIONS ); |
|
2066 } |
|
2067 |
|
2068 CHAT_DP_TXT( "CCASingleListView::ListInitL done" ); |
|
2069 |
|
2070 } |
|
2071 |
|
2072 CHAT_DP_TXT( "CCASingleListView::CompletePendingTaskForSearchL completed" ); |
|
2073 |
|
2074 return result; |
|
2075 |
|
2076 } |
|
2077 |
|
2078 |
|
2079 // ----------------------------------------------------------------------------- |
|
2080 // CCASessionHandler::GroupSyncL |
|
2081 // (other items were commented in a header). |
|
2082 // ----------------------------------------------------------------------------- |
|
2083 // |
|
2084 TBool CCASingleListView::InitializeListL() |
|
2085 { |
|
2086 |
|
2087 CHAT_DP_TXT( "CCASingleListView::InitializeListL started" ); |
|
2088 |
|
2089 CCAAppUi* appUi = static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
2090 |
|
2091 if ( !iWaitVisible ) |
|
2092 { |
|
2093 CHAT_DP_TXT( |
|
2094 "CCASingleListView::InitializeListL - ! iWaitVisible " ); |
|
2095 |
|
2096 // launch the wait note |
|
2097 |
|
2098 iWaitVisible = ETrue; |
|
2099 |
|
2100 appUi->ShowWaitDialogL( R_QTN_CHAT_SEARCHVIEW_PROCESSING, ETrue ); |
|
2101 |
|
2102 CHAT_DP_TXT( "CCASingleListView::InitializeListL done" ); |
|
2103 |
|
2104 } |
|
2105 // nothing interesting, do nothing, but come back here |
|
2106 CHAT_DP_TXT( "CCASingleListView::InitializeListL done" ); |
|
2107 |
|
2108 return ETrue; |
|
2109 } |
|
2110 // ----------------------------------------------------------------------------- |
|
2111 // CCASingleListView::ShowManualUpdateNoteL |
|
2112 // (other items were commented in a header). |
|
2113 // ----------------------------------------------------------------------------- |
|
2114 // |
|
2115 void CCASingleListView::ShowManualUpdateNoteL() |
|
2116 { |
|
2117 if ( !iFirstManualRefresh ) |
|
2118 { |
|
2119 iFirstManualRefresh = ETrue; |
|
2120 // manual presence update and user didn't start this, show info note |
|
2121 HBufC* text = iEikonEnv->AllocReadResourceLC( |
|
2122 R_QTN_CHAT_MANUAL_UPDATE_ACT ); |
|
2123 IMDialogUtils::DisplayNoteDialogL( *text, R_AVKON_SOFTKEYS_OK_EMPTY__OK, |
|
2124 CAknNoteDialog::ENoTimeout ); |
|
2125 CleanupStack::PopAndDestroy( text ); |
|
2126 |
|
2127 } |
|
2128 } |
|
2129 |
|
2130 // End of File |
|
2131 |