|
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: Container for all controls in single-list view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 //platform includes |
|
22 #include <aknlists.h> |
|
23 #include <aknsfld.h> |
|
24 #include <eikclbd.h> // for columndata |
|
25 #include <chatng.rsg> |
|
26 #include <chatng.mbg> |
|
27 #include <aknlayout.lag> // AVKON LAF layouts |
|
28 #include <aknlayoutdef.h> |
|
29 #include <aknnotedialog.h> |
|
30 #include <MdaAudioTonePlayer.h> |
|
31 #include <StringLoader.h> // StringLoader |
|
32 #include <aknquerydialog.h> |
|
33 #include <aknpopup.h> // CAknPopupList |
|
34 #include <barsread.h> |
|
35 #include <AknIconUtils.h> |
|
36 #include <AknDesCArrayDecorator.h> |
|
37 #include <EikMenuB.h> |
|
38 #include <AknListQueryDialog.h> // CAknListQueryDialog |
|
39 #include <AknNoteWrappers.h> |
|
40 #include <AknIconArray.h> |
|
41 //pbk2 changes |
|
42 #include <tvpbkcontactstoreuriptr.h> |
|
43 #include <cvpbkcontactstoreuriarray.h> |
|
44 #include <mvpbkcontactstorelist.h> |
|
45 #include <cvpbkcontactmanager.h> |
|
46 #include <cvpbkfieldtypeselector.h> |
|
47 #include <cvpbkcontactlinkarray.h> |
|
48 #include <vpbkcontactstoreuris.h> |
|
49 #include <vpbkcontactviewfilterbuilder.h> |
|
50 #include <cpbk2storeconfiguration.h> |
|
51 #include <cvpbkcontactstoreuriarray.h> |
|
52 #include <MVPbkContactFieldTextData.h> |
|
53 #include <MVPbkStoreContact.h> |
|
54 #include <MVPbkContactOperationBase.h> |
|
55 #include <CPbk2SortOrderManager.h> |
|
56 #include <Pbk2ContactNameFormatterFactory.h> |
|
57 #include <MPbk2ContactNameFormatter.h> |
|
58 #include <MVPbkFieldType.h> |
|
59 #include <MVPbkContactLink.h> |
|
60 #include <MVPbkContactStore.h> |
|
61 #include <mvpbkcontactstorelistobserver.h> |
|
62 #include <PEngWVPresenceErrors2.h> // wv error codes |
|
63 #include <AknGlobalNote.h> |
|
64 #include <csxhelp/imng.hlp.hrh> |
|
65 #include <MWVSettingsObserverng.h> |
|
66 #include "CAUtils.h" |
|
67 |
|
68 #include "ImpsCSPAllErrors.h" |
|
69 #include "ccasyncchecker.h" |
|
70 |
|
71 // INCLUDE FILES |
|
72 #include "MCASettingsPC.h" |
|
73 #include "TEnumsPC.h" |
|
74 #include "CCAAudioManager.h" |
|
75 #include "chatngclient.hrh" |
|
76 #include "CCAAppUi.h" |
|
77 #include "CCAChatListView.h" |
|
78 #include "CAExternalInterface.h" |
|
79 #include "CCAStatusPaneHandler.h" |
|
80 #include "ccacontactlistboxmodel.h" |
|
81 #include "MCABlocking.h" |
|
82 #include "MCAViewSwitcher.h" |
|
83 #include "chatdefinitions.h" |
|
84 #include "ChatDebugPrint.h" |
|
85 #include "IMNoteMapper.h" |
|
86 #include "CCABlockingUI.h" |
|
87 #include "CCAUISessionManager.h" |
|
88 #include "CCAUINGUtils.h" |
|
89 #include "IMUtils.h" |
|
90 #include "IMDialogUtils.h" |
|
91 #include "impsbuilddefinitions.h" |
|
92 #include "CCAContactDetailsDialog.h" |
|
93 #include "CCAGroupUtils.h" |
|
94 #include "MCASkinVariant.h" |
|
95 #include "CCAVariantFactory.h" |
|
96 #include "CCAApp.h" |
|
97 #include "CCAContactEditor.h" |
|
98 #include "ccacontactlistbox.h" |
|
99 #include "MCABlockingPC.h" |
|
100 #include "MCACommand.h" |
|
101 #include "MCAUiLoginCmdCB.h" |
|
102 #include "CCACommandManager.h" |
|
103 #include "CCACommandManagerFactory.h" |
|
104 #include "MCACommandHelper.h" |
|
105 #include "MCAProcessManager.h" |
|
106 #include "MCAMainViewArrayPC.h" |
|
107 #include "MCASearchDataPC.h" |
|
108 #include "MCASearchInterfacePC.h" |
|
109 #include "CCASingleListViewArray.h" |
|
110 #include "CCASingleListContainer.h" |
|
111 #include "CCAAppUi.h" |
|
112 #include "CCAView.h" |
|
113 #include "MCAInvitationPC.h" |
|
114 #include "MCAGroupPC.h" |
|
115 #include "MCAConversationPC.h" |
|
116 #include "CCAContactSelectionDialog.h" |
|
117 #include "MCAServerContactsArrayPC.h" |
|
118 |
|
119 // The Settings have been moved to Cenrep (also retained in the Resource file), |
|
120 // so the enums for keys and central repository header is added here |
|
121 #include "VariantKeys.h" |
|
122 // Constants |
|
123 |
|
124 |
|
125 // ================= MEMBER FUNCTIONS ======================= |
|
126 |
|
127 |
|
128 // --------------------------------------------------------- |
|
129 // CCASingleListContainer::Constructor |
|
130 // --------------------------------------------------------- |
|
131 // |
|
132 CCASingleListContainer::CCASingleListContainer |
|
133 ( MCACommandHelper& aCommandHelper, CCAView& aView, CCAAppUi* aAppUi ) |
|
134 : iAppUi( aAppUi ), |
|
135 iDeleteFlag( EFalse ), |
|
136 iTaskComplete( ETrue ), |
|
137 iCommandHelper( aCommandHelper ), |
|
138 iView( aView ), |
|
139 iBlocked( EFalse ), iIsMovingFlag( EFalse ) |
|
140 { |
|
141 |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------- |
|
145 // Symbian OS default constructor can leave. |
|
146 // --------------------------------------------------------- |
|
147 // |
|
148 void CCASingleListContainer::ConstructL( TRect aRect, |
|
149 MCAViewSwitcher& aViewSwitcher, TInt /* aSelectedIndexId */ ) |
|
150 { |
|
151 |
|
152 CreateWindowL(); |
|
153 iAppUi->AddLayoutChangeObserver( this ); |
|
154 iForceExpandSingleList = ETrue; |
|
155 iStatusPane = iAppUi->CAStatusPane(); |
|
156 if ( !iStatusPane ) |
|
157 { |
|
158 User::Leave( KErrGeneral ); |
|
159 } |
|
160 iViewSwitcher = &aViewSwitcher; |
|
161 |
|
162 iMainViewArrayPC = iAppUi->GetProcessManager().GetArrayInterface(); |
|
163 |
|
164 iMainViewArrayPC->AddObserverL( this ); |
|
165 //to refresh group array |
|
166 if ( iAppUi->UISessionManager().IsLoggedIn() ) |
|
167 { |
|
168 iMainViewArrayPC->PopulateGroupsListL(); |
|
169 } |
|
170 // Create and construct listbox |
|
171 iListBox = new ( ELeave ) CCAContactListBox; |
|
172 |
|
173 iInfoPopup = CAknInfoPopupNoteController::NewL(); |
|
174 |
|
175 iMainViewArrayPC->ForceExpanded( EFalse ); |
|
176 |
|
177 iListBox->ConstructL( this ); |
|
178 iListBox->SetContactListModel( *iMainViewArrayPC ); |
|
179 iListBox->SetListBoxObserver( this ); |
|
180 iListBox->CreateScrollBarFrameL( ETrue ); |
|
181 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
182 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
183 |
|
184 // remove empty spaces from b-column (new Avkon-support) |
|
185 iListBox->UseEmptyIconSpace( ETrue ); |
|
186 |
|
187 // set marquee on |
|
188 iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
|
189 |
|
190 MCASettingsPC* settings = iAppUi->GetProcessManager().GetSettingsInterface( ); |
|
191 TInt resValue = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_BLOCKING ); |
|
192 |
|
193 if ( !settings->GetBoolValuePC( TEnumsPC::EShowOffline, NULL ) ) |
|
194 { |
|
195 iMyFilter = TEnumsPC::EFilterNonOffline; |
|
196 iShowOffline = EFalse; |
|
197 if ( resValue != 2 ) |
|
198 { |
|
199 iMyFilter = TEnumsPC::EFilterNonOfflineNonBlockedAndOperation; |
|
200 } |
|
201 } |
|
202 else |
|
203 { |
|
204 iMyFilter = TEnumsPC::EFilterAll; |
|
205 iShowOffline = ETrue; |
|
206 if ( resValue != 2 ) |
|
207 { |
|
208 iMyFilter = TEnumsPC::EFilterAllNonBlockedAndOperation; |
|
209 } |
|
210 } |
|
211 // type cast imyfilter to specific enum type here.... |
|
212 iMainViewArrayPC->SetDefaultFilter( ( TEnumsPC::TFilterType )iMyFilter ); |
|
213 |
|
214 iMainViewArrayPC->ResetDefaultFilter(); |
|
215 |
|
216 //Array needs to be refreshed as filters have changed. |
|
217 |
|
218 iMainViewArrayPC->ResetArray( EFalse ); |
|
219 |
|
220 //We DONT need a different filter for the list indicators. |
|
221 //The value on ORing and Anding as below is 21 always |
|
222 TEnumsPC::TFilterType singleListArrayFilter( TEnumsPC::EFilterNotDefined ); |
|
223 if ( iMyFilter == TEnumsPC::EFilterNonOfflineNonBlockedAndOperation ) |
|
224 { |
|
225 singleListArrayFilter = TEnumsPC::EFilterNonOfflineNonBlockedNonOfflineOperation; |
|
226 } |
|
227 else |
|
228 { |
|
229 singleListArrayFilter = TEnumsPC::EFilterAllNonBlockedNonOfflineOperation; |
|
230 } |
|
231 |
|
232 |
|
233 // Create single list array wrapper |
|
234 CCASingleListViewArray * singleListArray = |
|
235 CCASingleListViewArray::NewL( |
|
236 *iMainViewArrayPC, |
|
237 TEnumsPC::ESingleListViewSelect, |
|
238 iListBox->ItemDrawer()->ColumnData(), |
|
239 ETrue, |
|
240 settings->GetBoolValuePC( TEnumsPC::EAutomaticPresenceUpdate , NULL ), |
|
241 *iListBox ); |
|
242 |
|
243 iMainViewArrayPC->SetSingleListArrayFilter( ( TEnumsPC::TFilterType )singleListArrayFilter ); |
|
244 singleListArray->SetContactListBoxModel( ( ( CCAContactListBoxModel* )iListBox->Model() ) ); |
|
245 CHAT_DP( D_CHAT_LIT( " **** contacts in this list %d **** " ), |
|
246 singleListArray->MdcaCount() ); |
|
247 |
|
248 // Ownership transfer to CAknSingleGraphicStyleListBox |
|
249 iListBox->Model()->SetItemTextArray( singleListArray ); |
|
250 |
|
251 SetRect( aRect ); |
|
252 if ( ListboxItems() ) |
|
253 { |
|
254 // Create find-pane |
|
255 ActivateFindPaneL(); |
|
256 } |
|
257 |
|
258 LoadBitmapsL(); |
|
259 |
|
260 iSearchInterfacePC = iAppUi->GetProcessManager().GetSearchInterface(); |
|
261 |
|
262 iDataInterfacePC = iAppUi->GetProcessManager().GetSearchDataInterface(); |
|
263 |
|
264 iBlockingPC = iAppUi->GetProcessManager().GetBlockingInterface( ); |
|
265 iBlockingUI = CCABlockingUI::NewL( iBlockingPC ); |
|
266 SetCbaLockL( EFalse ); |
|
267 iAppUi->AddServerChangeObsL( this ); |
|
268 ActivateL(); |
|
269 |
|
270 InitPbk2SingleEntryFetchL(); |
|
271 } |
|
272 |
|
273 // --------------------------------------------------------- |
|
274 // CCASingleListContainer::Destructor |
|
275 // --------------------------------------------------------- |
|
276 // |
|
277 CCASingleListContainer::~CCASingleListContainer() |
|
278 { |
|
279 if ( iAppUi ) |
|
280 { |
|
281 iAppUi->RemoveServerChangeObs( this ); |
|
282 } |
|
283 |
|
284 CHAT_DP_TXT( "CCASingleListContainer destructor starts" ); |
|
285 if ( iAppUi && !iAppUi->IsUnderDestruction() ) |
|
286 { |
|
287 iAppUi->RemoveLayoutChangeObserver( this ); |
|
288 } |
|
289 |
|
290 if ( iMainViewArrayPC ) |
|
291 { |
|
292 iMainViewArrayPC->RemoveObserver( this ); |
|
293 } |
|
294 delete iListBox; |
|
295 delete iBlockingUI; |
|
296 delete iFindbox; |
|
297 delete iInfoPopup; |
|
298 |
|
299 ReleasePbkSingleEntryFetch(); |
|
300 |
|
301 CHAT_DP_TXT( "CCASingleListContainer destructor ends" ); |
|
302 } |
|
303 |
|
304 |
|
305 // --------------------------------------------------------- |
|
306 // CCASingleListContainer::SelectedType |
|
307 // --------------------------------------------------------- |
|
308 // |
|
309 TEnumsPC::TItem CCASingleListContainer::SelectedType() const |
|
310 { |
|
311 return iMainViewArrayPC->GetType( CurrentListboxIndex() ); |
|
312 } |
|
313 // --------------------------------------------------------- |
|
314 // CCASingleListContainer::OwnStatus |
|
315 // --------------------------------------------------------- |
|
316 // |
|
317 TEnumsPC::TOnlineStatus CCASingleListContainer::OwnStatus() const |
|
318 { |
|
319 if ( iMainViewArrayPC->GetType( 0 ) == TEnumsPC::EOwnStatusItem ) |
|
320 { |
|
321 return iMainViewArrayPC->GetOnlineStatus( 0 ); |
|
322 } |
|
323 else |
|
324 { |
|
325 return TEnumsPC::EUnknown; |
|
326 } |
|
327 } |
|
328 // --------------------------------------------------------- |
|
329 // CCASingleListContainer::GetOnlineStatus |
|
330 // --------------------------------------------------------- |
|
331 // |
|
332 TEnumsPC::TOnlineStatus CCASingleListContainer::GetOnlineStatus() const |
|
333 { |
|
334 return iMainViewArrayPC->GetOnlineStatus( CurrentListboxIndex() ); |
|
335 } |
|
336 |
|
337 // --------------------------------------------------------- |
|
338 // CCASingleListContainer::Synchronised |
|
339 // --------------------------------------------------------- |
|
340 // |
|
341 TEnumsPC::TSyncStatus CCASingleListContainer::Synchronised() const |
|
342 { |
|
343 return iMainViewArrayPC->Synchronised( CurrentListboxIndex() ); |
|
344 } |
|
345 // --------------------------------------------------------- |
|
346 // CCASingleListContainer::IsCollapsed |
|
347 // --------------------------------------------------------- |
|
348 // |
|
349 TBool CCASingleListContainer::IsCollapsed() const |
|
350 { |
|
351 return iMainViewArrayPC->IsCollapsed( CurrentListboxIndex() ); |
|
352 } |
|
353 // --------------------------------------------------------- |
|
354 // CCASingleListContainer::IsWatched |
|
355 // --------------------------------------------------------- |
|
356 // |
|
357 TBool CCASingleListContainer::IsWatched() const |
|
358 { |
|
359 return iMainViewArrayPC->IsWatched( CurrentListboxIndex() ); |
|
360 } |
|
361 // --------------------------------------------------------- |
|
362 // CCASingleListContainer::Count |
|
363 // --------------------------------------------------------- |
|
364 // |
|
365 TInt CCASingleListContainer::Count() const |
|
366 { |
|
367 return iMainViewArrayPC->Count(); |
|
368 } |
|
369 |
|
370 // --------------------------------------------------------- |
|
371 // CCASingleListContainer::PrepareDestruction |
|
372 // --------------------------------------------------------- |
|
373 // |
|
374 void CCASingleListContainer::PrepareDestruction() |
|
375 { |
|
376 delete iFindbox; |
|
377 iFindbox = NULL; // so we don't accidently try to delete deleted findbox. |
|
378 } |
|
379 |
|
380 // --------------------------------------------------------- |
|
381 // CCASingleListContainer::SetCbaLockL() |
|
382 // Sets the lock status of cba keys. |
|
383 // --------------------------------------------------------- |
|
384 // |
|
385 void CCASingleListContainer::SetCbaLockL( TBool aLock ) |
|
386 { |
|
387 iCbaLock = aLock; |
|
388 if ( !aLock ) |
|
389 { |
|
390 UpdateCbaL(); |
|
391 } |
|
392 } |
|
393 |
|
394 // --------------------------------------------------------- |
|
395 // CCASingleListContainer::SizeChanged() |
|
396 // Called by framework when the view size is changed |
|
397 // --------------------------------------------------------- |
|
398 // |
|
399 void CCASingleListContainer::SizeChanged() |
|
400 { |
|
401 SetLayout(); //layouting controls |
|
402 |
|
403 if ( iFindbox && iFindPaneIsVisible ) |
|
404 { |
|
405 iFindbox->MakeVisible( ETrue ); |
|
406 } |
|
407 //fix for the TSW bug id : ECJA-7M68YH |
|
408 FocusChanged( EDrawNow ); |
|
409 } |
|
410 |
|
411 // --------------------------------------------------------- |
|
412 // CCASingleListContainer::Draw() |
|
413 // Called by framework when the view size is changed |
|
414 // --------------------------------------------------------- |
|
415 // |
|
416 void CCASingleListContainer::Draw( const TRect& /*aRect*/ ) const |
|
417 { |
|
418 /*if( ListboxItems() ) |
|
419 { |
|
420 if( iFindbox ) |
|
421 { |
|
422 iFindbox->MakeVisible( ETrue ); |
|
423 } |
|
424 }*/ |
|
425 // XXX we always have at least one item |
|
426 } |
|
427 |
|
428 // --------------------------------------------------------- |
|
429 // CCASingleListContainer::CountComponentControls() const |
|
430 // From CoeControl, Returns the number of control contained |
|
431 // by this class. (other items were commented in a header). |
|
432 // --------------------------------------------------------- |
|
433 // |
|
434 TInt CCASingleListContainer::CountComponentControls() const |
|
435 { |
|
436 // return number of controls inside this container |
|
437 if ( !iFindbox ) |
|
438 { |
|
439 // Find-pane does not exist when there is no data in listbox, |
|
440 // so only one control exists (listbox) |
|
441 return 1; //Ignore CodeScanner warning |
|
442 } |
|
443 else |
|
444 { |
|
445 // listbox and findbox exists. that makes it two |
|
446 return 2; //Ignore CodeScanner warning |
|
447 } |
|
448 } |
|
449 |
|
450 // --------------------------------------------------------- |
|
451 // CCASingleListContainer::ComponentControl(TInt aIndex) const |
|
452 // From CCoeControl, Returns handle to control pointed by aIndex |
|
453 // (other items were commented in a header). |
|
454 // --------------------------------------------------------- |
|
455 // |
|
456 CCoeControl* CCASingleListContainer::ComponentControl( TInt aIndex ) const |
|
457 { |
|
458 switch ( aIndex ) |
|
459 { |
|
460 // the caller wants to have the first control |
|
461 // so it's always listbox |
|
462 case 0: |
|
463 { |
|
464 return iListBox; |
|
465 } |
|
466 // the caller wants to have the second control |
|
467 // so it's always the findbox if it exists |
|
468 case 1: |
|
469 { |
|
470 if ( iFindbox ) |
|
471 { |
|
472 return iFindbox; |
|
473 } |
|
474 return NULL; |
|
475 } |
|
476 default: |
|
477 { |
|
478 return NULL; |
|
479 } |
|
480 } |
|
481 } |
|
482 |
|
483 // --------------------------------------------------------- |
|
484 // CCASingleListContainer::SelectedUserId |
|
485 // --------------------------------------------------------- |
|
486 // |
|
487 TPtrC CCASingleListContainer::SelectedUserId() const |
|
488 { |
|
489 TInt curIndex = CurrentListboxIndex(); |
|
490 return iMainViewArrayPC->GetSelectedContactUserId( curIndex ); |
|
491 } |
|
492 // --------------------------------------------------------- |
|
493 // CCASingleListContainer::DoRefreshViewL |
|
494 // --------------------------------------------------------- |
|
495 // |
|
496 void CCASingleListContainer::DoRefreshViewL( |
|
497 TBool /* aSortList */ ) const |
|
498 { |
|
499 CHAT_DP_FUNC_ENTER( "DoRefreshViewL" ); |
|
500 iListBox->DrawNow(); |
|
501 CHAT_DP_FUNC_DONE( "DoRefreshViewL" ); |
|
502 } |
|
503 |
|
504 // --------------------------------------------------------- |
|
505 // CCASingleListContainer::RefreshView |
|
506 // Called by framework when the view size is changed |
|
507 // --------------------------------------------------------- |
|
508 // |
|
509 void CCASingleListContainer::RefreshView( TBool aSortList ) const |
|
510 { |
|
511 TRAPD( err, DoRefreshViewL( aSortList ) ); |
|
512 HandleError( err ); |
|
513 } |
|
514 |
|
515 // --------------------------------------------------------- |
|
516 // CCASingleListContainer::CurrentListboxIndex() const |
|
517 // Get's current index of listbox |
|
518 // (other items were commented in a header). |
|
519 // --------------------------------------------------------- |
|
520 // |
|
521 TInt CCASingleListContainer::CurrentListboxIndex() const |
|
522 { |
|
523 if ( !iListBox ) |
|
524 { |
|
525 return KErrNotFound; |
|
526 } |
|
527 if ( !iListBox->View() ) |
|
528 { |
|
529 // CurrentItemIndex panics if the listbox has no view |
|
530 return KErrNotFound; |
|
531 } |
|
532 |
|
533 TInt curIndex( iListBox->CurrentItemIndex() ); |
|
534 |
|
535 if ( curIndex == iListBox->TopItemIndex() ) |
|
536 { |
|
537 curIndex = 0; |
|
538 } |
|
539 if ( curIndex < 0 ) |
|
540 { |
|
541 return KErrNotFound; |
|
542 } |
|
543 CCAContactListBoxModel* model = |
|
544 static_cast<CCAContactListBoxModel*>( iListBox->Model() ); |
|
545 |
|
546 if ( model ) |
|
547 { |
|
548 return model->FilteredItemIndex( curIndex ); |
|
549 } |
|
550 return KErrNotFound; |
|
551 } |
|
552 // ----------------------------------------------------------------------------- |
|
553 // CCASingleListContainer::DeleteFriendL |
|
554 // Creates a new contact list and shows the appropriate dialogs |
|
555 // ----------------------------------------------------------------------------- |
|
556 // |
|
557 void CCASingleListContainer::DeleteFriendL( ) |
|
558 { |
|
559 |
|
560 TInt index( CurrentListboxIndex() ); |
|
561 if ( index == KErrNotFound ) |
|
562 { |
|
563 // listbox is empty |
|
564 return; |
|
565 } |
|
566 |
|
567 // going to delete the friend, set the contact moving state to true |
|
568 iIsMovingFlag = ETrue; |
|
569 TEnumsPC::TItem itemtype = iMainViewArrayPC->GetType( index ); |
|
570 |
|
571 TPtrC name( KNullDesC ); |
|
572 |
|
573 #ifdef IMPS_BLOCK_AFTER_DELETE |
|
574 HBufC* deletePrompt = NULL; |
|
575 HBufC* contactId = NULL; |
|
576 TBool deletingContact = EFalse; |
|
577 #endif // IMPS_BLOCK_AFTER_DELETE |
|
578 |
|
579 switch ( itemtype ) |
|
580 { |
|
581 case TEnumsPC::EContactListItem: |
|
582 { |
|
583 name.Set( iMainViewArrayPC->DisplayName( index ) ); |
|
584 break; |
|
585 } |
|
586 case TEnumsPC::EContactItem: |
|
587 { |
|
588 TPtrC itemname = iMainViewArrayPC->GetSelectedContactIdentification( index ); |
|
589 name.Set( itemname ); |
|
590 #ifdef IMPS_BLOCK_AFTER_DELETE |
|
591 // must make copies because the contact will be destroyed upon |
|
592 // successful deletion |
|
593 deletePrompt = StringLoader::LoadLC( R_QTN_CHAT_BLOCKING_QUERY, itemname ); |
|
594 contactId = iMainViewArrayPC->GetSelectedContactUserId( index ).AllocLC(); |
|
595 #endif // IMPS_BLOCK_AFTER_DELETE |
|
596 break; |
|
597 } |
|
598 default: |
|
599 { |
|
600 // nothing to do here because own data item cannot be deleted |
|
601 iIsMovingFlag = EFalse; |
|
602 return; |
|
603 } |
|
604 } |
|
605 |
|
606 // load, format and show confirmation note |
|
607 HBufC* prompt = NULL; |
|
608 |
|
609 if ( itemtype == TEnumsPC::EContactListItem && |
|
610 iMainViewArrayPC->CountOfContactsInList( index ) > 0 ) |
|
611 { |
|
612 prompt = StringLoader::LoadLC( R_QTN_CHAT_CONTACTS_DELETE_LIST ); |
|
613 } |
|
614 else |
|
615 { |
|
616 prompt = StringLoader::LoadLC( RSC_CHAT_DELETE_CONFIRMATION, name ); |
|
617 } |
|
618 |
|
619 TInt ret( IMDialogUtils::DisplayQueryDialogL( R_GENERIC_YES_NO_CONFIRMATION_QUERY, *prompt ) ); |
|
620 CleanupStack::PopAndDestroy( prompt ); |
|
621 TInt err( KErrNone ); |
|
622 |
|
623 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
624 { |
|
625 // accepted, lets delete the contact |
|
626 iAppUi->ShowWaitDialogLC( R_QTN_CHAT_DELETING_CONTACT ); |
|
627 |
|
628 if ( itemtype == TEnumsPC::EContactListItem ) |
|
629 { |
|
630 err = iMainViewArrayPC->DeleteContactListL( index ); |
|
631 UpdateViewAfterDeleteL(); |
|
632 } |
|
633 else |
|
634 { |
|
635 TRAP( err, iMainViewArrayPC->DeleteServerContactL( index ) ); |
|
636 |
|
637 |
|
638 #ifdef IMPS_BLOCK_AFTER_DELETE |
|
639 // item will cease to exist upon successful deletion |
|
640 deletingContact = ETrue; |
|
641 #endif // IMPS_BLOCK_AFTER_DELETE |
|
642 } |
|
643 |
|
644 //CodeScanner warning to be ignored |
|
645 CleanupStack::PopAndDestroy(); // waitnote |
|
646 if ( err != KErrNone ) |
|
647 { |
|
648 if ( itemtype == TEnumsPC::EContactListItem ) |
|
649 { |
|
650 IMDialogUtils::DisplayErrorConfirmationNoteL( |
|
651 R_QTN_CHAT_CONTACT_LIST_DELETING_FAILED ); |
|
652 } |
|
653 else |
|
654 { |
|
655 #ifdef IMPS_BLOCK_AFTER_DELETE |
|
656 //CodeScanner warning to be ignored |
|
657 CleanupStack::PopAndDestroy( 2, deletePrompt ); // contactId, deletePrompt |
|
658 #endif // IMPS_BLOCK_AFTER_DELETE |
|
659 IMNoteMapper::ShowNoteL( err ); |
|
660 } |
|
661 } |
|
662 #ifdef IMPS_BLOCK_AFTER_DELETE |
|
663 else if ( deletingContact ) |
|
664 { |
|
665 // no error and it's a contact |
|
666 // Ask blocking query depending upon variation Flag. |
|
667 // UI CR ID :101-39727: Service provider issues |
|
668 TBool blockVariation( IMUtils::IntResourceValueL( |
|
669 RSC_CHAT_VARIATION_BLOCK_QUERY ) ); |
|
670 if ( blockVariation ) |
|
671 { |
|
672 TInt block = IMDialogUtils::DisplayYesNoConfirmationDialogL( |
|
673 *deletePrompt ); |
|
674 |
|
675 if ( block ) |
|
676 { |
|
677 // block after delete requested |
|
678 iBlockingUI->BlockUserL( *contactId ); |
|
679 } |
|
680 } |
|
681 //Co deScanner warning to be ignored |
|
682 CleanupStack::PopAndDestroy( 2, deletePrompt ); // contactId, deletePrompt |
|
683 } |
|
684 #endif // IMPS_BLOCK_AFTER_DELETE |
|
685 UpdateCbaL(); |
|
686 } |
|
687 |
|
688 // everything is done, set the moving state back |
|
689 iIsMovingFlag = EFalse; |
|
690 } |
|
691 |
|
692 |
|
693 // --------------------------------------------------------- |
|
694 // CCASingleListContainer::EditFriendL() |
|
695 // (other items were commented in a header). |
|
696 // Note: CodeScanner is likely to return false positives for |
|
697 // this situation, because some returned TInt values will not |
|
698 // be error codes. |
|
699 // --------------------------------------------------------- |
|
700 // |
|
701 TInt CCASingleListContainer::EditFriendL( TEnumsPC::TContactEditorMode aCreateNew ) |
|
702 { |
|
703 |
|
704 CHAT_DP( D_CHAT_LIT( "CCAFriendListViewContainer::EditFriend begin" ) ); |
|
705 |
|
706 if ( iFindbox ) |
|
707 { |
|
708 iFindbox->SetFocus( EFalse ); |
|
709 } |
|
710 |
|
711 // index initialised to -1. This will not initialise the ContactEditor's PC. |
|
712 // This is used to indicate that it is an addition of new contact |
|
713 TInt listIndex( CurrentListboxIndex() ); |
|
714 TInt editorEditableDataIndex = -1; |
|
715 |
|
716 // aCreateNew = EFalse if edit operation / ETrue if add operation |
|
717 if ( !( aCreateNew == TEnumsPC::EAddToContact || aCreateNew == TEnumsPC::ECreateNew ) ) |
|
718 { |
|
719 //since edit will take place we need current index |
|
720 editorEditableDataIndex = listIndex; |
|
721 } |
|
722 |
|
723 TPtrC itemname = iMainViewArrayPC->GetSelectedContactUserId( listIndex ); |
|
724 |
|
725 TEnumsPC::TItem itemtype = iMainViewArrayPC->GetType( listIndex ); |
|
726 |
|
727 TPtrC listId( KNullDesC() ); |
|
728 if ( itemtype != TEnumsPC::EOwnStatusItem ) |
|
729 { |
|
730 // don't need to check for contact lists for own status |
|
731 if ( ( itemtype == TEnumsPC::EContactItem ) || ( itemtype == TEnumsPC::EContactListItem ) ) |
|
732 { |
|
733 // we have a list |
|
734 listId.Set( iMainViewArrayPC->GetSelectedListId( listIndex ) ) ; |
|
735 } |
|
736 // make sure we have contact list |
|
737 else |
|
738 { |
|
739 CCAUINGUtils::TChatContactListCreationType listCreation = |
|
740 CCAUINGUtils::VerifyContactlistL(); |
|
741 |
|
742 if ( listCreation == CCAUINGUtils::EChatContactListWasCreated ) |
|
743 { |
|
744 iListBox->HandleItemAdditionL(); |
|
745 UpdateFilterL(); |
|
746 UpdateCbaL(); |
|
747 } |
|
748 else |
|
749 { |
|
750 if ( listCreation == CCAUINGUtils::EChatNoContactList ) |
|
751 { |
|
752 // Could not create contact list |
|
753 return NULL; |
|
754 } |
|
755 } |
|
756 } |
|
757 } |
|
758 |
|
759 TPtrC itemName; |
|
760 if ( ( itemtype == TEnumsPC::EContactItem || |
|
761 itemtype == TEnumsPC::EOwnStatusItem ) && |
|
762 aCreateNew != TEnumsPC::ECreateNew ) |
|
763 { |
|
764 itemName.Set( itemname ); |
|
765 } |
|
766 |
|
767 CHAT_DP( D_CHAT_LIT( |
|
768 "CCAFriendListViewContainer::EditFriend before editcontact" ) ); |
|
769 |
|
770 HBufC* userName = HBufC::NewMaxL( KServerWVUserIdMaxLength ); |
|
771 userName->Des().SetLength( 0 ); |
|
772 CleanupStack::PushL( userName ); |
|
773 TPtr userNamePtr = userName->Des(); |
|
774 |
|
775 // Show domain selection query, if variated so |
|
776 TBool cursorToBeginning = EFalse; |
|
777 if ( aCreateNew == TEnumsPC::ECreateNew |
|
778 && IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_DOMAIN_SELECTION ) ) |
|
779 { |
|
780 // Fill the user name with domain, if user selected it |
|
781 TInt retVal = iAppUi->UISessionManager().DisplayDomainSelectionQueryL( |
|
782 userNamePtr ); |
|
783 if ( retVal == 0 ) |
|
784 { |
|
785 // User cancelled the procedure |
|
786 CleanupStack::PopAndDestroy( userName ); |
|
787 return NULL; |
|
788 } |
|
789 else |
|
790 { |
|
791 cursorToBeginning = ETrue; |
|
792 } |
|
793 } |
|
794 |
|
795 TBool contactSaved( EFalse ); |
|
796 // the contact editor should not return to details view at all, |
|
797 // even if Editing existing one |
|
798 |
|
799 CCAContactEditor* editor = CCAContactEditor::NewL( |
|
800 editorEditableDataIndex, contactSaved ); |
|
801 |
|
802 |
|
803 // If user selected a domain, pass the prefilled user name |
|
804 iCbaLock = ETrue; |
|
805 TInt err = KErrNone; |
|
806 if ( userName->Length() > 0 ) |
|
807 { |
|
808 |
|
809 TRAP( err, editor->EditContactLD( aCreateNew, |
|
810 listId, |
|
811 userNamePtr, |
|
812 KNullDesC, |
|
813 EFalse, |
|
814 EFalse, |
|
815 cursorToBeginning ) ); |
|
816 } |
|
817 else |
|
818 { |
|
819 |
|
820 TRAP( err, editor->EditContactLD( aCreateNew, listId, itemname ) ); |
|
821 } |
|
822 iCbaLock = EFalse; |
|
823 User::LeaveIfError( err ); |
|
824 |
|
825 CleanupStack::PopAndDestroy( userName ); // userName |
|
826 |
|
827 if ( iFindbox ) |
|
828 { |
|
829 /* |
|
830 * The FindBox is cleared, so the filter also |
|
831 * needs to be cleared. |
|
832 */ |
|
833 TRAPD( error, static_cast<CAknFilteredTextListBoxModel*>( ListBox()->Model() ) |
|
834 ->Filter()->ResetFilteringL(); ); |
|
835 |
|
836 ResetFindBoxL(); |
|
837 if ( !iAppUi->IsDisplayingDialog()) |
|
838 { |
|
839 iFindbox->SetFocus( ETrue ); |
|
840 } |
|
841 UpdateFilterL(); |
|
842 } |
|
843 |
|
844 if ( !contactSaved ) |
|
845 { |
|
846 return listIndex; |
|
847 } |
|
848 if ( aCreateNew == TEnumsPC::EAddToContact ) |
|
849 { |
|
850 // return the old index of item |
|
851 // need to focus the item from where adding started |
|
852 return listIndex; |
|
853 } |
|
854 return CurrentListboxIndex(); |
|
855 |
|
856 } |
|
857 |
|
858 // --------------------------------------------------------- |
|
859 // CCASingleListContainer::MoveContactL |
|
860 // (other items were commented in a header). |
|
861 // --------------------------------------------------------- |
|
862 // |
|
863 void CCASingleListContainer::MoveContactL() |
|
864 { |
|
865 if ( ListboxItems() ) |
|
866 { |
|
867 |
|
868 iIsMovingFlag = ETrue; |
|
869 TInt index = CurrentListboxIndex(); |
|
870 |
|
871 // current item type..which should be moved |
|
872 TEnumsPC::TItem itemtype = iMainViewArrayPC->GetType( index ); |
|
873 |
|
874 if ( itemtype == TEnumsPC::EContactItem || itemtype == TEnumsPC::EOwnStatusItem ) |
|
875 { |
|
876 TInt focusIndex = index + 1;// focus should goto next item.... |
|
877 if ( focusIndex >= Count() ) |
|
878 { |
|
879 // we reached end of array and don't have any more items.. |
|
880 // so move the focus to before item... |
|
881 focusIndex = index - 1; |
|
882 } |
|
883 |
|
884 |
|
885 //NEXT OR PREVIOUS ITEM DETAILS |
|
886 // get the type of item here..... |
|
887 TEnumsPC::TItem focusIndexType = iMainViewArrayPC->GetType( focusIndex ); |
|
888 |
|
889 // if move is success then get the next or previous item details |
|
890 HBufC* focusWVid = NULL; // user id of next or previous item,where focus should be, |
|
891 HBufC* focusListid = NULL; |
|
892 |
|
893 if ( focusIndexType == TEnumsPC::EContactItem ) |
|
894 { |
|
895 // get the list id and contact index... |
|
896 focusWVid = iMainViewArrayPC->GetSelectedContactUserId( focusIndex ).AllocLC(); |
|
897 focusListid = iMainViewArrayPC->GetSelectedListId( focusIndex ).AllocLC(); |
|
898 } |
|
899 else |
|
900 { |
|
901 // for this case both are holding the same string... |
|
902 focusWVid = iMainViewArrayPC->GetSelectedListId( focusIndex ).AllocLC(); |
|
903 focusListid = iMainViewArrayPC->GetSelectedListId( focusIndex ).AllocLC(); |
|
904 } |
|
905 |
|
906 // we got all the details....so let's invoke dialog to move contact.... |
|
907 |
|
908 //END OF NEXT OR PREVIOUS DETAILS |
|
909 TBool contactSaved( EFalse ); |
|
910 HBufC* wvid = iMainViewArrayPC->GetSelectedContactUserId( index ).AllocLC(); |
|
911 TPtrC listid = iMainViewArrayPC->GetSelectedListId( index ); |
|
912 TInt findIndex = -1; |
|
913 |
|
914 TBool moveFocusToNextItem = EFalse; // whether the contact should be moved to next item or not |
|
915 |
|
916 CCAContactEditor* editor = |
|
917 CCAContactEditor::NewLC( index, contactSaved ); |
|
918 |
|
919 HBufC* movedListId; |
|
920 TBool collapsed; |
|
921 |
|
922 SetSkipStorageEvents( ETrue ); |
|
923 |
|
924 // Fix warning: C2874W: extMoved may be used before being set |
|
925 // Set extMoved a default value |
|
926 TBool extMoved = EFalse; |
|
927 TRAPD( err, extMoved = editor->MoveContactL( listid, *&movedListId, collapsed ) ); |
|
928 if ( err != KErrNone ) |
|
929 { |
|
930 SetSkipStorageEvents( EFalse ); |
|
931 CleanupStack::PopAndDestroy( 4, focusWVid ); |
|
932 if ( movedListId ) |
|
933 { |
|
934 delete movedListId; |
|
935 } |
|
936 iIsMovingFlag = EFalse; |
|
937 User::Leave( err ); |
|
938 } |
|
939 |
|
940 if ( !extMoved ) // if move failed...then focus need not be changed.. |
|
941 { |
|
942 // move failed.b'coz of multiple reasons... |
|
943 // 1) user canceled the move operation. |
|
944 // 2) contact was deleted from old list. |
|
945 // as it's existing in the list, where it was moved. |
|
946 findIndex = iMainViewArrayPC->FindContactL( listid, *wvid ); |
|
947 |
|
948 // if this index is valid, whom the user treid to moved, then user cancelled operation |
|
949 if ( findIndex != KErrNotFound ) |
|
950 { |
|
951 // we found the contact..so set the focused items correctly here... |
|
952 focusIndex = findIndex;// focus should goto same item |
|
953 // get the type of item here..... |
|
954 focusIndexType = iMainViewArrayPC->GetType( focusIndex ); |
|
955 } |
|
956 else |
|
957 { |
|
958 // Reset array has to called explictly( reset arry |
|
959 // on deletion of a contact is not done on pc side |
|
960 // due to SetSkipStorageEvents) |
|
961 |
|
962 iMainViewArrayPC->ResetArray( EFalse ); |
|
963 UpdateViewAfterDeleteL(); |
|
964 moveFocusToNextItem = ETrue; |
|
965 } |
|
966 } |
|
967 else |
|
968 { |
|
969 // move was success...... |
|
970 moveFocusToNextItem = ETrue; |
|
971 } |
|
972 |
|
973 iIsMovingFlag = EFalse; |
|
974 |
|
975 SetSkipStorageEvents( EFalse ); |
|
976 |
|
977 // now get the index of item,where focus should be if move was success |
|
978 if ( moveFocusToNextItem ) |
|
979 { |
|
980 // move was success...focus should be on next item.. |
|
981 // OR contact has been removed from old list..... |
|
982 // now get the index of next item and set the focus to that.. |
|
983 if ( movedListId ) |
|
984 { |
|
985 if ( collapsed ) |
|
986 { |
|
987 iMainViewArrayPC->SetCollapsed( collapsed, iMainViewArrayPC->FindContactListIndexL( movedListId->Des() ) ); |
|
988 } |
|
989 } |
|
990 if ( focusIndexType == TEnumsPC::EContactItem ) |
|
991 { |
|
992 focusIndex = iMainViewArrayPC->FindContactL( *focusListid, *focusWVid ); |
|
993 focusIndexType = iMainViewArrayPC->GetType( focusIndex ); |
|
994 } |
|
995 else |
|
996 { |
|
997 focusIndex = iMainViewArrayPC->FindContactListIndexL( *focusListid ); |
|
998 focusIndexType = iMainViewArrayPC->GetType( focusIndex ); |
|
999 } |
|
1000 } |
|
1001 |
|
1002 |
|
1003 |
|
1004 if ( movedListId ) |
|
1005 { |
|
1006 delete movedListId; |
|
1007 } |
|
1008 |
|
1009 UpdateViewL( focusIndex, focusIndexType, ETrue ); |
|
1010 UpdateCbaL(); |
|
1011 // update the view accordingly.... |
|
1012 CleanupStack::PopAndDestroy( 4, focusWVid ); // editor, wvid,focusListid,focuswvid |
|
1013 } |
|
1014 |
|
1015 else |
|
1016 { |
|
1017 // if item is anything else, don't do anything just return from this function..... |
|
1018 return; |
|
1019 } |
|
1020 } |
|
1021 } |
|
1022 // --------------------------------------------------------- |
|
1023 // CCASingleListContainer::UpdateViewL |
|
1024 // (other items were commented in a header). |
|
1025 // --------------------------------------------------------- |
|
1026 // |
|
1027 void CCASingleListContainer::UpdateViewL( |
|
1028 TInt aIndex, TEnumsPC::TItem aType, TBool aSyncSuccess ) |
|
1029 { |
|
1030 if ( !aSyncSuccess ) |
|
1031 { |
|
1032 //do nothing if not synchronized |
|
1033 return; |
|
1034 } |
|
1035 |
|
1036 CCAContactListBoxModel* list = |
|
1037 ( ( CCAContactListBoxModel* ) iListBox->Model() ); |
|
1038 TInt count = list->NumberOfItems(); |
|
1039 TInt index; |
|
1040 switch ( aType ) |
|
1041 { |
|
1042 case TEnumsPC::EContactItem: |
|
1043 case TEnumsPC::EOwnStatusItem: |
|
1044 { |
|
1045 /*Not attempting to get the index of contact because aIndex is the |
|
1046 same as this index and we pass it on to the contactlistboxmodel's |
|
1047 visibleitem method*/ |
|
1048 index = list->VisibleItemIndex( aIndex ); |
|
1049 if ( index != KErrNotFound ) |
|
1050 { |
|
1051 CHAT_DP( D_CHAT_LIT( |
|
1052 "CCASingleListContainer::UpdateViewL, setting index %d" ), |
|
1053 index ); |
|
1054 iListBox->ScrollToMakeItemVisible( index - 1 ); |
|
1055 iListBox->SetCurrentItemIndex( index ); |
|
1056 iListBox->DrawNow(); |
|
1057 } |
|
1058 else if ( iBlocked && iIndexPrevBlocking < count ) |
|
1059 { |
|
1060 iListBox->SetCurrentItemIndexAndDraw( iIndexPrevBlocking ); |
|
1061 iBlocked = EFalse; |
|
1062 } |
|
1063 else |
|
1064 { |
|
1065 // Contact not found |
|
1066 TInt maxindex = list->NumberOfItems() - 1; |
|
1067 if ( maxindex >= 0 ) |
|
1068 { |
|
1069 TInt curIndex = CurrentListboxIndex() - 1; |
|
1070 if ( !Rng( 0, curIndex, maxindex ) ) |
|
1071 { |
|
1072 // cur index out of range -> set to last item |
|
1073 curIndex = maxindex; |
|
1074 } |
|
1075 iListBox->SetCurrentItemIndex( curIndex ); |
|
1076 } |
|
1077 iListBox->DrawNow(); |
|
1078 } |
|
1079 break; |
|
1080 } |
|
1081 case TEnumsPC::EContactListItem: |
|
1082 case TEnumsPC::EOpenChatsListItem: |
|
1083 { |
|
1084 /*We get the index of list because and we pass it on to the |
|
1085 contactlistboxmodel's visibleitem method*/ |
|
1086 |
|
1087 index = list->VisibleItemIndex( iMainViewArrayPC->IndexOfList( aIndex ) ); |
|
1088 if ( index != KErrNotFound ) |
|
1089 { |
|
1090 CHAT_DP( D_CHAT_LIT( |
|
1091 "CCASingleListContainer::UpdateViewL, setting index %d" ), |
|
1092 index ); |
|
1093 iListBox->ScrollToMakeItemVisible( index - 1 ); |
|
1094 iListBox->SetCurrentItemIndex( index ); |
|
1095 iListBox->DrawNow(); |
|
1096 } |
|
1097 break; |
|
1098 } |
|
1099 case TEnumsPC::EConversationItem: |
|
1100 { |
|
1101 /* we have to focused the the existing item after |
|
1102 add to IM contact and sroll the list box to be visible */ |
|
1103 index = list->VisibleItemIndex( aIndex ); |
|
1104 if ( index != KErrNotFound ) |
|
1105 { |
|
1106 CHAT_DP( D_CHAT_LIT( |
|
1107 "CCASingleListContainer::UpdateViewL, setting index %d" ), |
|
1108 index ); |
|
1109 |
|
1110 iListBox->ScrollToMakeItemVisible( index - 1 ); |
|
1111 |
|
1112 iListBox->SetCurrentItemIndexAndDraw( index ); |
|
1113 } |
|
1114 |
|
1115 break; |
|
1116 } |
|
1117 case TEnumsPC::EInviteItem: |
|
1118 { |
|
1119 /* we have to focused the the existing item. |
|
1120 And sroll the list box to be visible */ |
|
1121 index = list->VisibleItemIndex( aIndex ); |
|
1122 if ( index != KErrNotFound ) |
|
1123 { |
|
1124 CHAT_DP( D_CHAT_LIT( |
|
1125 "CCASingleListContainer::UpdateViewL, setting index %d" ), |
|
1126 index ); |
|
1127 |
|
1128 iListBox->ScrollToMakeItemVisible( index - 1 ); |
|
1129 |
|
1130 iListBox->SetCurrentItemIndexAndDraw( index ); |
|
1131 } |
|
1132 |
|
1133 break; |
|
1134 } |
|
1135 case TEnumsPC::EGroupItem: |
|
1136 { |
|
1137 /* we have to focused the the existing item. |
|
1138 And sroll the list box to be visible */ |
|
1139 index = list->VisibleItemIndex( aIndex ); |
|
1140 if ( index != KErrNotFound ) |
|
1141 { |
|
1142 CHAT_DP( D_CHAT_LIT( |
|
1143 "CCASingleListContainer::UpdateViewL, setting index %d" ), |
|
1144 index ); |
|
1145 |
|
1146 iListBox->ScrollToMakeItemVisible( index - 1 ); |
|
1147 |
|
1148 iListBox->SetCurrentItemIndexAndDraw( index ); |
|
1149 } |
|
1150 |
|
1151 break; |
|
1152 } |
|
1153 default: |
|
1154 { |
|
1155 //nothing to do |
|
1156 break; |
|
1157 } |
|
1158 } |
|
1159 |
|
1160 |
|
1161 |
|
1162 CHAT_DP( D_CHAT_LIT( "CCAFriendListViewContainer::UpdateViewL end" ) ); |
|
1163 } |
|
1164 |
|
1165 // --------------------------------------------------------- |
|
1166 // CCASingleListContainer::RefreshPresenceL() |
|
1167 // --------------------------------------------------------- |
|
1168 // |
|
1169 void CCASingleListContainer::RefreshPresenceL( TBool aManualLaunch ) |
|
1170 { |
|
1171 TBool autoUpdate( iAppUi->GetProcessManager().GetSettingsInterface()->GetBoolValuePC( |
|
1172 TEnumsPC::EAutomaticPresenceUpdate , NULL ) ); |
|
1173 |
|
1174 if ( autoUpdate ) |
|
1175 { |
|
1176 // in automatic update mode, don't do refresh (unless variated) |
|
1177 if ( !IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_FETCH_PRESENCE ) ) |
|
1178 { |
|
1179 // variant doesn't allow refreshing in automatic mode |
|
1180 return; |
|
1181 } |
|
1182 } |
|
1183 |
|
1184 // show dialog immediately |
|
1185 iAppUi->ShowWaitDialogL( R_QTN_CHAT_WAIT_REFRESH, ETrue ); |
|
1186 |
|
1187 TRAPD( err, iMainViewArrayPC->RefreshFriendsL() ); |
|
1188 |
|
1189 CHAT_DP( D_CHAT_LIT( "**CAPresenceManager::RefreshFriendsL leave code %d" ), |
|
1190 err ); |
|
1191 |
|
1192 if ( err != KErrNone ) |
|
1193 { |
|
1194 User::Leave( err ); |
|
1195 } |
|
1196 // Server sent us some non-OK error. Maybe we had some bogus ID in the list. |
|
1197 // We shouldn't show any dialog here, because information about the |
|
1198 // non-successful event is shown by the confirmation query below. |
|
1199 iAppUi->DismissWaitDialogL( err ); |
|
1200 |
|
1201 RefreshView( ETrue ); |
|
1202 |
|
1203 CCACommandManager* commandManager = CCACommandManagerFactory::InstanceL()->GetCommandManager(); |
|
1204 MCASessionHandlerCmd* sessHandlerCmd = commandManager->GetSessionHandlerCmd() ; |
|
1205 if ( sessHandlerCmd ) |
|
1206 { |
|
1207 sessHandlerCmd->SetContactsRefreshed( ETrue ); |
|
1208 } |
|
1209 |
|
1210 // If something failed, then show confirmation query |
|
1211 if ( err != KErrNone ) |
|
1212 { |
|
1213 if ( IMDialogUtils::DisplayQueryDialogL( |
|
1214 R_FRIENDS_CANNOT_UPDATE_QUERY ) == EAknSoftkeyDetails ) |
|
1215 { |
|
1216 // If user choosed details, then show explanation of |
|
1217 // error |
|
1218 IMDialogUtils::DisplayQueryDialogL( |
|
1219 R_FRIENDS_CANNOT_UPDATE_REASON_QUERY ); |
|
1220 } |
|
1221 } |
|
1222 |
|
1223 if ( !aManualLaunch && !autoUpdate ) |
|
1224 { |
|
1225 // manual presence update and user didn't start this, show info note |
|
1226 HBufC* text = iEikonEnv->AllocReadResourceLC( |
|
1227 R_QTN_CHAT_MANUAL_UPDATE_ACT ); |
|
1228 IMDialogUtils::DisplayNoteDialogL( *text, R_AVKON_SOFTKEYS_OK_EMPTY__OK, |
|
1229 CAknNoteDialog::ENoTimeout ); |
|
1230 CleanupStack::PopAndDestroy( text ); |
|
1231 } |
|
1232 |
|
1233 iAppUi->ReleaseCapturingL(); |
|
1234 } |
|
1235 |
|
1236 |
|
1237 // --------------------------------------------------------- |
|
1238 // CCASingleListContainer::ShowDetailsL() |
|
1239 // Add friend from phonebook |
|
1240 // --------------------------------------------------------- |
|
1241 // |
|
1242 void CCASingleListContainer::ShowDetailsL() |
|
1243 { |
|
1244 if ( ListboxItems() ) |
|
1245 { |
|
1246 TInt index = CurrentListboxIndex(); |
|
1247 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( index ); |
|
1248 |
|
1249 if ( itemType == TEnumsPC::EContactItem || itemType == TEnumsPC::EOwnStatusItem ) |
|
1250 { |
|
1251 iStatusPane->ClearNaviPaneL(); |
|
1252 TBool saved( EFalse ); |
|
1253 |
|
1254 TPtrC list( KNullDesC() ); |
|
1255 |
|
1256 // set list id if it exists |
|
1257 if ( itemType == TEnumsPC::EContactItem ) |
|
1258 { |
|
1259 list.Set( iMainViewArrayPC->GetSelectedListId( index ) ); |
|
1260 } |
|
1261 |
|
1262 |
|
1263 CCAContactDetailsDialog* dialog = |
|
1264 CCAContactDetailsDialog::NewL( saved, index, list ); |
|
1265 |
|
1266 if ( iFindbox ) |
|
1267 { |
|
1268 iFindbox->SetFocus( EFalse ); |
|
1269 } |
|
1270 |
|
1271 // Prevent view from changing softkeys while dialog is active |
|
1272 iCbaLock = ETrue; |
|
1273 dialog->ShowLD(); |
|
1274 iCbaLock = EFalse; |
|
1275 |
|
1276 if ( iFindbox ) |
|
1277 { |
|
1278 iFindbox->SetFocus( ETrue ); |
|
1279 } |
|
1280 |
|
1281 iStatusPane->ShowTabGroupL( KUidFriendsListView ); |
|
1282 |
|
1283 UpdateCbaL(); |
|
1284 } |
|
1285 } |
|
1286 } |
|
1287 |
|
1288 // --------------------------------------------------------- |
|
1289 // CCASingleListContainer::ListboxItems() const |
|
1290 // (other items were commented in a header). |
|
1291 // --------------------------------------------------------- |
|
1292 // |
|
1293 TBool CCASingleListContainer::ListboxItems() const |
|
1294 { |
|
1295 return ( iListBox->Model()->NumberOfItems() > 0 ); |
|
1296 } |
|
1297 |
|
1298 // --------------------------------------------------------- |
|
1299 // CCASingleListContainer::DisplayBlockedListL() |
|
1300 // Displays list of blocked persons |
|
1301 // (other items were commented in a header). |
|
1302 // --------------------------------------------------------- |
|
1303 // |
|
1304 void CCASingleListContainer::DisplayBlockedListL() |
|
1305 { |
|
1306 //SetSkipStorageEvents( ETrue ); |
|
1307 |
|
1308 iBlockingUI->DisplayBlockedListL(); |
|
1309 |
|
1310 //SetSkipStorageEvents( EFalse ); |
|
1311 |
|
1312 iMainViewArrayPC->ResetArray( EFalse ); |
|
1313 TInt index = CurrentListboxIndex(); |
|
1314 iListBox->HandleItemAdditionL(); |
|
1315 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( index ); |
|
1316 UpdateViewL( index, itemType, ETrue ); |
|
1317 UpdateFilterL(); |
|
1318 } |
|
1319 |
|
1320 // --------------------------------------------------------- |
|
1321 // |
|
1322 // (other items were commented in a header). |
|
1323 // --------------------------------------------------------- |
|
1324 // |
|
1325 void CCASingleListContainer::DisplayUnblockListQueryL() |
|
1326 { |
|
1327 iBlockingUI->DisplayUnblockListQueryL(); |
|
1328 } |
|
1329 |
|
1330 // --------------------------------------------------------- |
|
1331 // CCASingleListContainer::BlockUserL() |
|
1332 // Blocks focused user |
|
1333 // (other items were commented in a header). |
|
1334 // --------------------------------------------------------- |
|
1335 // |
|
1336 void CCASingleListContainer::BlockUserL() |
|
1337 { |
|
1338 iIsMovingFlag = ETrue; |
|
1339 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( CurrentListboxIndex() ); |
|
1340 if ( itemType == TEnumsPC::EInvalid ) |
|
1341 { |
|
1342 User::Leave( KErrNotFound ); |
|
1343 } |
|
1344 |
|
1345 switch ( itemType ) |
|
1346 { |
|
1347 |
|
1348 case TEnumsPC::EContactItem: |
|
1349 { |
|
1350 |
|
1351 TInt indexOfList = 0; |
|
1352 TInt countOfContactsInList = 0; |
|
1353 |
|
1354 iIndexPrevBlocking = CurrentListboxIndex(); //iListBox->CurrentItemIndex(); |
|
1355 |
|
1356 if ( IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_BLOCKING ) == 1 ) |
|
1357 { |
|
1358 indexOfList = iMainViewArrayPC->IndexOfList( iIndexPrevBlocking ); |
|
1359 countOfContactsInList = iMainViewArrayPC->CountOfContactsInList( indexOfList ); |
|
1360 } |
|
1361 |
|
1362 iBlocked = ETrue; |
|
1363 iBlockingUI->BlockUserL( iMainViewArrayPC-> |
|
1364 GetSelectedContactUserId( iIndexPrevBlocking ) ); |
|
1365 |
|
1366 if ( IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_BLOCKING ) == 1 ) |
|
1367 { |
|
1368 if ( indexOfList + countOfContactsInList == iIndexPrevBlocking ) |
|
1369 { |
|
1370 iListBox->SetCurrentItemIndex( iIndexPrevBlocking - 1 ); |
|
1371 } |
|
1372 iMainViewArrayPC->ResetArray( EFalse ); |
|
1373 } |
|
1374 |
|
1375 break; |
|
1376 } |
|
1377 |
|
1378 case TEnumsPC::EConversationItem: |
|
1379 case TEnumsPC::EInviteItem: |
|
1380 { |
|
1381 TInt listIndex = iListBox->CurrentItemIndex(); |
|
1382 |
|
1383 iBlockingUI->BlockUserL( iMainViewArrayPC-> |
|
1384 GetSelectedContactUserId( listIndex ) ); |
|
1385 |
|
1386 break; |
|
1387 } |
|
1388 |
|
1389 default: |
|
1390 { |
|
1391 break; |
|
1392 } |
|
1393 } |
|
1394 UpdateCbaL(); |
|
1395 iIsMovingFlag = EFalse; |
|
1396 } |
|
1397 |
|
1398 |
|
1399 // --------------------------------------------------------- |
|
1400 // CCASingleListContainer::IsBlocked() |
|
1401 // (other items were commented in a header). |
|
1402 // --------------------------------------------------------- |
|
1403 // |
|
1404 TBool CCASingleListContainer::IsBlocked() const |
|
1405 { |
|
1406 TInt index = CurrentListboxIndex(); |
|
1407 TBool isBlocked = iMainViewArrayPC->IsBlocked( index ); |
|
1408 return isBlocked; |
|
1409 } |
|
1410 |
|
1411 // --------------------------------------------------------- |
|
1412 // CCASingleListContainer::FindJoinedChatsL() |
|
1413 // Finds joined chats and displays dialog. |
|
1414 // (other items were commented in a header). |
|
1415 // --------------------------------------------------------- |
|
1416 // |
|
1417 void CCASingleListContainer::FindJoinedChatsL() |
|
1418 { |
|
1419 TInt index = CurrentListboxIndex(); |
|
1420 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( index ); |
|
1421 if ( itemType != TEnumsPC::EContactItem && itemType == TEnumsPC::EOwnStatusItem )//!contact ) |
|
1422 { |
|
1423 User::Leave( KErrNotFound ); |
|
1424 } |
|
1425 |
|
1426 HBufC* wvUIDBuf = iMainViewArrayPC->GetSelectedContactUserId( index ).AllocLC(); |
|
1427 HBufC* identification = iMainViewArrayPC->GetSelectedContactIdentification( index ).AllocLC(); |
|
1428 HBufC* prompt = StringLoader::LoadLC( R_CHAT_FIND_JOINED_PRTX, *identification ); |
|
1429 |
|
1430 //granularity is one |
|
1431 CSearchPairs* pairs = new ( ELeave ) CSearchPairs( 1 ); |
|
1432 CleanupStack::PushL( pairs ); |
|
1433 |
|
1434 CImpsSearchRequest* request = CImpsSearchRequest::NewL(); |
|
1435 CleanupStack::PushL( request ); |
|
1436 |
|
1437 request->SetRequestL( EImpsGroupUserIDJoined, *wvUIDBuf ); |
|
1438 pairs->AppendL( request ); |
|
1439 |
|
1440 TInt err( KErrNone ); |
|
1441 iAppUi->ShowWaitDialogL( R_QTN_CHAT_WNOTE_SEARCHING ); |
|
1442 TRAPD( leave, err = iSearchInterfacePC->StartSearchL( |
|
1443 KSearchLimit, NULL, pairs ) ); |
|
1444 iAppUi->DismissWaitDialogL( leave ); |
|
1445 |
|
1446 if ( err == KErrNone ) |
|
1447 { |
|
1448 // displayid'd version of group id |
|
1449 CDesCArrayFlat* itemList = new ( ELeave ) CDesCArrayFlat( |
|
1450 KArrayGranularity ); |
|
1451 CleanupStack::PushL( itemList ); |
|
1452 |
|
1453 // contains the full group id with wv: and domain |
|
1454 CDesCArrayFlat* itemListFullId = new ( ELeave ) CDesCArrayFlat( |
|
1455 KArrayGranularity ); |
|
1456 CleanupStack::PushL( itemListFullId ); |
|
1457 |
|
1458 TInt resultCount( iDataInterfacePC->SearchDataCount() ); |
|
1459 |
|
1460 // If we have found some joined chats -> show list |
|
1461 if ( resultCount > 0 ) |
|
1462 { |
|
1463 for ( TInt count( 0 ); count < resultCount; ++count ) |
|
1464 { |
|
1465 // identical arrays, the index of itemList is used for itemListFullId |
|
1466 itemList->AppendL( iAppUi->DisplayId( |
|
1467 iDataInterfacePC->SearchData( count ) ) ); |
|
1468 itemListFullId->AppendL( iDataInterfacePC->SearchData( count ) ); |
|
1469 } |
|
1470 |
|
1471 TInt indexOfChat( 0 ); |
|
1472 TInt ret( IMDialogUtils::DisplayListQueryDialogL( &indexOfChat, itemList, |
|
1473 R_FIND_JOINED_CHATS_RESULTS_DLG, *prompt ) ); |
|
1474 |
|
1475 if ( ( ret == EChatClientJoin || ret == EAknSoftkeyOk ) && ( indexOfChat > |
|
1476 KErrNotFound ) ) |
|
1477 { |
|
1478 iAppUi->GroupUtils()->JoinGroupL( EFalse, itemListFullId->MdcaPoint( |
|
1479 indexOfChat ) ); |
|
1480 } |
|
1481 } |
|
1482 // no joined chats -> show only info note |
|
1483 else |
|
1484 { |
|
1485 IMDialogUtils::DisplayInformationNoteL( |
|
1486 R_QTN_CHAT_CONTACTS_NO_JOINED_FOUND ); |
|
1487 } |
|
1488 |
|
1489 CleanupStack::PopAndDestroy( itemListFullId ); |
|
1490 CleanupStack::PopAndDestroy( itemList ); |
|
1491 } |
|
1492 else |
|
1493 { |
|
1494 IMNoteMapper::ShowNoteL( err ); |
|
1495 } |
|
1496 |
|
1497 //CodeScanner warning to be ignored |
|
1498 CleanupStack::PopAndDestroy( 5, wvUIDBuf ); // request, pairs, prompt, identification, wvUIDBuf |
|
1499 |
|
1500 } |
|
1501 |
|
1502 // --------------------------------------------------------- |
|
1503 // CCASingleListContainer::DisplayConfirmationNoteL() |
|
1504 // (other items were commented in a header). |
|
1505 // --------------------------------------------------------- |
|
1506 // |
|
1507 void CCASingleListContainer::DisplayConfirmationNoteL( |
|
1508 const TInt aTextResourceId ) |
|
1509 { |
|
1510 HBufC* text = iCoeEnv->AllocReadResourceLC( aTextResourceId ); |
|
1511 CAknConfirmationNote* dlg = new( ELeave )CAknConfirmationNote(); |
|
1512 dlg->ExecuteLD( *text ); |
|
1513 CleanupStack::PopAndDestroy( text ); |
|
1514 } |
|
1515 |
|
1516 // --------------------------------------------------------- |
|
1517 // CCASingleListContainer::UpdatePresenceL() |
|
1518 // (other items were commented in a header). |
|
1519 // Note: CodeScanner is likely to return false positives for |
|
1520 // this situation |
|
1521 // --------------------------------------------------------- |
|
1522 // |
|
1523 TInt CCASingleListContainer::UpdatePresenceL( TInt aIndex ) |
|
1524 { |
|
1525 TInt err( KErrNone ); |
|
1526 TBool autoUpdate( iAppUi->GetProcessManager().GetSettingsInterface()->GetBoolValuePC( |
|
1527 TEnumsPC::EAutomaticPresenceUpdate , NULL ) ); |
|
1528 |
|
1529 CHAT_DP_TXT( "CCASingleListContainer::UpdatePresenceL" ); |
|
1530 if ( !autoUpdate ) |
|
1531 { |
|
1532 |
|
1533 TPtrC userId = iMainViewArrayPC->GetSelectedContactUserId( aIndex ); |
|
1534 // no automatic update |
|
1535 // => fetch the presence information |
|
1536 CHAT_DP_TXT( "no auto update, fetch presence" ); |
|
1537 |
|
1538 if ( userId.Length() > 0 ) |
|
1539 { |
|
1540 CHAT_DP( D_CHAT_LIT( "fetching presence for %S" ), &userId ); |
|
1541 // array has size of one because only one user will be added |
|
1542 CDesCArray* users = new( ELeave )CDesCArrayFlat( 1 ); |
|
1543 CleanupStack::PushL( users ); |
|
1544 users->AppendL( userId ); |
|
1545 |
|
1546 HBufC* text = StringLoader::LoadLC( R_QTN_CHAT_CHECKING_AVAILABILITY, |
|
1547 iMainViewArrayPC->GetSelectedContactIdentification( aIndex ) ); |
|
1548 |
|
1549 iAppUi->ShowWaitDialogL( *text ); |
|
1550 TRAP( err, iMainViewArrayPC->GetOnlineUsersL( users, NULL, NULL, ETrue ) ); |
|
1551 CHAT_DP( D_CHAT_LIT( "GetOnlineUsersL leave code %d" ), err ); |
|
1552 if ( err == KErrInUse ) |
|
1553 { |
|
1554 // user may open convesation while objects are refreshings |
|
1555 // in background so ignore this error |
|
1556 err = KErrNone; |
|
1557 } |
|
1558 iAppUi->DismissWaitDialogL( err, EFalse, userId ); |
|
1559 |
|
1560 //CodeScanner warning to be ignored |
|
1561 CleanupStack::PopAndDestroy( 2, users ); // text, users |
|
1562 } |
|
1563 } |
|
1564 return err; |
|
1565 } |
|
1566 |
|
1567 // --------------------------------------------------------- |
|
1568 // CCASingleListContainer::OpenConversationL() |
|
1569 // (other items were commented in a header). |
|
1570 // --------------------------------------------------------- |
|
1571 // |
|
1572 void CCASingleListContainer::OpenConversationL() |
|
1573 { |
|
1574 |
|
1575 if ( !iIsMovingFlag ) |
|
1576 { |
|
1577 TInt index = CurrentListboxIndex(); |
|
1578 |
|
1579 const TDesC& wvId( iMainViewArrayPC->GetSelectedContactUserId( index ) ); |
|
1580 const TDesC& identification( iMainViewArrayPC->GetSelectedContactIdentification( index ) ); |
|
1581 const TDesC& listID( iMainViewArrayPC->GetSelectedListId( index ) ); |
|
1582 //SetReadInterfaceL() function is called in OpenConversations. |
|
1583 //This causes HandleChatEvent() which increments the iContactListIndex. |
|
1584 //Better we store the user id at this point and pass it on |
|
1585 //to the conversation view so that iContactListIndex change doesn't affect |
|
1586 //the logic of getting the user id |
|
1587 TCADnlConvView dnlConView; |
|
1588 |
|
1589 //collecting only first KMaxWVIDLength character in iWVID. |
|
1590 dnlConView.iWVID = ( CAUtils::DisplayId( wvId ) ).Left( KMaxWVIDLength ); |
|
1591 if ( listID != KNullDesC ) |
|
1592 { |
|
1593 dnlConView.iListID = listID; |
|
1594 } |
|
1595 else |
|
1596 { |
|
1597 dnlConView.iListID = KNullDesC; |
|
1598 } |
|
1599 dnlConView.iIsForwarded = EFalse; |
|
1600 dnlConView.iSAPChanged = EFalse; |
|
1601 dnlConView.iSwitchTab = EFalse; |
|
1602 |
|
1603 if ( !iMainViewArrayPC->ChatExistsL( index ) ) |
|
1604 { |
|
1605 CHAT_DP_TXT( " not found, fetching presence.." ); |
|
1606 if ( !iAppUi->UISessionManager().IsLoggedIn() ) |
|
1607 { |
|
1608 iAppUi->UISessionManager().LoginL( MCAUiLoginCmdCB::ELogin ); |
|
1609 if ( !iAppUi->UISessionManager().IsLoggedIn() ) |
|
1610 { |
|
1611 return; |
|
1612 } |
|
1613 } |
|
1614 |
|
1615 if ( UpdatePresenceL( index ) != KErrNone ) |
|
1616 { |
|
1617 // invalid wv id or server error |
|
1618 return; |
|
1619 } |
|
1620 |
|
1621 if ( iMainViewArrayPC->IgnoreOfflineStatusL( index ) != TEnumsPC::EOnline ) |
|
1622 { |
|
1623 TPtrC contactname = iMainViewArrayPC->GetItemNameText( index ); |
|
1624 |
|
1625 iOpeningConversation = ETrue; |
|
1626 |
|
1627 // User does not want to send msg to offline user |
|
1628 if ( IMUtils::IgnoreOfflineStatusL( contactname ) < 0 ) |
|
1629 { |
|
1630 iOpeningConversation = EFalse; |
|
1631 return; |
|
1632 } |
|
1633 } |
|
1634 |
|
1635 CHAT_DP_TXT( " trying to create chatdata.." ); |
|
1636 iMainViewArrayPC->SetMessageReadInterfaceL( index ); |
|
1637 } |
|
1638 |
|
1639 UpdateCbaL( ETrue ); |
|
1640 SetCbaLockL( ETrue ); |
|
1641 iOpeningConversation = ETrue; |
|
1642 |
|
1643 //Add the conversation item to open chats array before switching the view |
|
1644 iMainViewArrayPC->InsertConversationItemL( wvId, identification ); |
|
1645 |
|
1646 TCADnlConvViewBuf convMsgBuf( dnlConView ); |
|
1647 iViewSwitcher->SwitchViewL( KUidConversationsView, KUidConvViewMsgId, convMsgBuf ); |
|
1648 } |
|
1649 } |
|
1650 |
|
1651 // --------------------------------------------------------- |
|
1652 // CloseConversationL |
|
1653 // (other items were commented in a header). |
|
1654 // --------------------------------------------------------- |
|
1655 // |
|
1656 void CCASingleListContainer::CloseConversationL() |
|
1657 { |
|
1658 TInt index = CurrentListboxIndex(); |
|
1659 |
|
1660 HBufC* identification = |
|
1661 iMainViewArrayPC->GetItemNameText( index ).AllocLC(); |
|
1662 |
|
1663 HBufC* prompt = StringLoader::LoadLC( R_CLOSE_CONVERSATION_PROMPT, |
|
1664 *identification ); |
|
1665 |
|
1666 |
|
1667 CAknQueryDialog* dlg = new ( ELeave ) CAknQueryDialog( |
|
1668 CAknQueryDialog::ENoTone ); |
|
1669 |
|
1670 CleanupStack::PushL( dlg ); |
|
1671 |
|
1672 dlg->SetPromptL( *prompt ); |
|
1673 |
|
1674 CleanupStack::Pop( dlg ); |
|
1675 |
|
1676 TInt ret( dlg->ExecuteLD( R_CLOSE_COVERSATION_QUERY ) ); |
|
1677 |
|
1678 CleanupStack::PopAndDestroy( 2, identification ); // prompt, identification |
|
1679 |
|
1680 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
1681 { |
|
1682 MCAConversationPC* ConversationPC = iAppUi->GetProcessManager().GetConversationInterface(); |
|
1683 //update the index before closing bcoz some new conversation might have recieved in between |
|
1684 index = CurrentListboxIndex(); |
|
1685 TInt indexOfList = iMainViewArrayPC->IndexOfList( index ); |
|
1686 TInt countOfContactsInList = iMainViewArrayPC->CountOfContactsInList( indexOfList ); |
|
1687 |
|
1688 TBuf<KMaxWVIDLength> wvId; |
|
1689 |
|
1690 wvId.Copy( iMainViewArrayPC->GetSelectedContactUserId( index ).Left( |
|
1691 wvId.MaxLength() ) ); |
|
1692 //To remove the item from open chats array when conv is closed |
|
1693 iMainViewArrayPC->RemoveConversationItem( wvId ); |
|
1694 |
|
1695 ConversationPC->DeleteChatL( KNullDesC, |
|
1696 KNullDesC, |
|
1697 wvId ); |
|
1698 |
|
1699 } |
|
1700 UpdateCbaL(); |
|
1701 UpdateFilterL(); |
|
1702 } |
|
1703 // |
|
1704 // (other items were commented in a header). |
|
1705 // --------------------------------------------------------- |
|
1706 // |
|
1707 CEikListBox* CCASingleListContainer::ListBox() const |
|
1708 { |
|
1709 return iListBox; |
|
1710 } |
|
1711 |
|
1712 // --------------------------------------------------------- |
|
1713 // (other items were commented in a header). |
|
1714 // --------------------------------------------------------- |
|
1715 // |
|
1716 void CCASingleListContainer::DisplayBlockTextQueryL() |
|
1717 { |
|
1718 if ( iFindbox ) |
|
1719 { |
|
1720 iFindbox->SetFocus( EFalse ); |
|
1721 } |
|
1722 |
|
1723 iBlockingUI->DisplayBlockTextQueryL(); |
|
1724 |
|
1725 if ( iFindbox ) |
|
1726 { |
|
1727 iFindbox->SetFocus( ETrue ); |
|
1728 } |
|
1729 } |
|
1730 |
|
1731 // --------------------------------------------------------- |
|
1732 // (other items were commented in a header). |
|
1733 // --------------------------------------------------------- |
|
1734 // |
|
1735 TBool CCASingleListContainer::OpeningConversation() |
|
1736 { |
|
1737 return iOpeningConversation; |
|
1738 } |
|
1739 |
|
1740 |
|
1741 // --------------------------------------------------------- |
|
1742 // CCASingleListContainer::ActivateFindPaneL() |
|
1743 // Activates find-pane |
|
1744 // (other items were commented in a header). |
|
1745 // --------------------------------------------------------- |
|
1746 // |
|
1747 void CCASingleListContainer::ActivateFindPaneL() |
|
1748 { |
|
1749 if ( !iFindbox ) |
|
1750 { |
|
1751 iFindbox = CAknSearchField::NewL( *this, |
|
1752 CAknSearchField::ESearch, |
|
1753 NULL, KTextLimit ); |
|
1754 static_cast<CAknFilteredTextListBoxModel*>( iListBox->Model() ) |
|
1755 ->CreateFilterL( iListBox, iFindbox ); |
|
1756 |
|
1757 } |
|
1758 iFindbox->SetObserver( this ); |
|
1759 iFindbox->ActivateL(); |
|
1760 iFindbox->ResetL(); |
|
1761 iFindbox->SetSearchTextL( KNullDesC ); |
|
1762 |
|
1763 // Create filtering |
|
1764 |
|
1765 // Signal listbox that findbox got activated |
|
1766 |
|
1767 static_cast<CAknColumnListBoxView*>( iListBox->View() ) |
|
1768 ->SetFindEmptyListState( ETrue ); |
|
1769 iFindPaneIsVisible = ETrue; |
|
1770 SetLayout(); |
|
1771 |
|
1772 if ( IsActivated() ) |
|
1773 { |
|
1774 iFindbox->MakeVisible( ETrue ); |
|
1775 iFindbox->SetFocus( ETrue ); |
|
1776 iListBox->SizeChanged(); |
|
1777 DrawNow(); |
|
1778 } |
|
1779 } |
|
1780 |
|
1781 // --------------------------------------------------------- |
|
1782 // CCASingleListContainer::DeactivateFindPaneL() |
|
1783 // De-activates find-pane |
|
1784 // (other items were commented in a header). |
|
1785 // --------------------------------------------------------- |
|
1786 // |
|
1787 void CCASingleListContainer::DeactivateFindPaneL() |
|
1788 { |
|
1789 static_cast<CAknFilteredTextListBoxModel*>( iListBox->Model() ) |
|
1790 ->Filter()->ResetFilteringL(); |
|
1791 |
|
1792 iFindbox->MakeVisible( EFalse ); |
|
1793 iFindbox->SetFocus( EFalse ); |
|
1794 iMainViewArrayPC->ForceExpanded( EFalse ); |
|
1795 |
|
1796 // Signal listbox that findbox went away |
|
1797 static_cast<CAknColumnListBoxView*>( iListBox->View() ) |
|
1798 ->SetFindEmptyListState( EFalse ); |
|
1799 iFindPaneIsVisible = EFalse; |
|
1800 SetLayout(); |
|
1801 |
|
1802 if ( IsActivated() ) |
|
1803 { |
|
1804 DrawNow(); |
|
1805 } |
|
1806 } |
|
1807 |
|
1808 // --------------------------------------------------------- |
|
1809 // CCASingleListContainer::SetLayout() |
|
1810 // Layouts current components according to AVKON LAF |
|
1811 // (other items were commented in a header). |
|
1812 // --------------------------------------------------------- |
|
1813 // |
|
1814 void CCASingleListContainer::SetLayout() |
|
1815 { |
|
1816 const TRect rect( Rect() ); |
|
1817 if ( iListBox && iFindPaneIsVisible ) |
|
1818 { |
|
1819 AknLayoutUtils::LayoutControl( iListBox, |
|
1820 rect, |
|
1821 AKN_LAYOUT_WINDOW_list_gen_pane( 1 ) ); |
|
1822 |
|
1823 AknLayoutUtils::LayoutControl( iFindbox, |
|
1824 rect, |
|
1825 AKN_LAYOUT_WINDOW_find_pane ); |
|
1826 |
|
1827 } |
|
1828 else if ( iListBox ) |
|
1829 { |
|
1830 AknLayoutUtils::LayoutControl( iListBox, |
|
1831 rect, |
|
1832 AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) ); |
|
1833 } |
|
1834 } |
|
1835 |
|
1836 // --------------------------------------------------------- |
|
1837 // CCASingleListContainer::DisplayInfoNoteL() |
|
1838 // Displays info note defined in resource |
|
1839 // --------------------------------------------------------- |
|
1840 // |
|
1841 void CCASingleListContainer::DisplayInfoNoteL( const TInt aResourceId ) |
|
1842 { |
|
1843 CAknNoteDialog* infoNote = |
|
1844 new ( ELeave ) CAknNoteDialog( CAknNoteDialog::EConfirmationTone, |
|
1845 CAknNoteDialog::EShortTimeout ); |
|
1846 |
|
1847 infoNote->ExecuteLD( aResourceId ); |
|
1848 |
|
1849 } |
|
1850 |
|
1851 // --------------------------------------------------------- |
|
1852 // |
|
1853 // (other items were commented in a header). |
|
1854 // --------------------------------------------------------- |
|
1855 // |
|
1856 void CCASingleListContainer::UpdateScrollBars( CEikListBox* aListBox ) |
|
1857 { |
|
1858 if ( aListBox ) |
|
1859 { |
|
1860 TInt pos = CurrentListboxIndex(); |
|
1861 if ( aListBox->ScrollBarFrame() ) |
|
1862 { |
|
1863 if ( pos >= 0 && pos < aListBox->Model()->NumberOfItems() ) |
|
1864 { |
|
1865 aListBox->ScrollBarFrame()->MoveVertThumbTo( pos ); |
|
1866 } |
|
1867 } |
|
1868 } |
|
1869 } |
|
1870 |
|
1871 // --------------------------------------------------------- |
|
1872 // CCASingleListContainer::UpdateViewAfterDeleteL |
|
1873 // Called by framework when the view size is changed |
|
1874 // --------------------------------------------------------- |
|
1875 // |
|
1876 void CCASingleListContainer::UpdateViewAfterDeleteL() |
|
1877 { |
|
1878 // prevent index from being in the last slot |
|
1879 // if it's going to be deleted, to prevent |
|
1880 // HandleItemRemovalL from exploding |
|
1881 // by default focus next items |
|
1882 TInt index = iListBox->CurrentItemIndex(); |
|
1883 TInt items = iListBox->Model()->NumberOfItems(); |
|
1884 if ( index >= ( items - 1 ) || index == KErrNotFound ) |
|
1885 { |
|
1886 CHAT_DP_TXT( "fixing index to last element" ); |
|
1887 iListBox->SetCurrentItemIndex( items - 1 ); |
|
1888 } |
|
1889 |
|
1890 |
|
1891 iListBox->HandleItemRemovalL(); |
|
1892 |
|
1893 UpdateFilterL(); |
|
1894 |
|
1895 CHAT_DP( D_CHAT_LIT( |
|
1896 "CCASingleListContainer::UpdateViewAfterDeleteL, index %d" ), |
|
1897 index ); |
|
1898 |
|
1899 // We have to manually recalculate focused index after item removal |
|
1900 TInt item = iListBox->Model()->NumberOfItems(); |
|
1901 |
|
1902 if ( ( index == item ) && ( index > 0 ) ) |
|
1903 { |
|
1904 CHAT_DP_TXT( "decreasing index" ); |
|
1905 |
|
1906 /* need to check focus for contact item |
|
1907 * if it only one contact is available then focus shoud be on |
|
1908 * contact list or not from where contact is deleted |
|
1909 */ |
|
1910 iListBox->SetCurrentItemIndex( item - index ); |
|
1911 |
|
1912 } |
|
1913 |
|
1914 if ( !ListFilter()->NonFilteredNumberOfItems() ) |
|
1915 { |
|
1916 // list is really empty |
|
1917 DeactivateFindPaneL(); |
|
1918 } |
|
1919 |
|
1920 iListBox->DrawNow(); |
|
1921 |
|
1922 #ifdef _DEBUG |
|
1923 index = iListBox->CurrentItemIndex(); |
|
1924 CHAT_DP( D_CHAT_LIT( |
|
1925 "CCASingleListContainer::UpdateViewAfterDeleteL done, index %d" ), |
|
1926 index ); |
|
1927 #endif |
|
1928 } |
|
1929 |
|
1930 |
|
1931 // --------------------------------------------------------- |
|
1932 // CCASingleListContainer::UpdateFilterL |
|
1933 // --------------------------------------------------------- |
|
1934 // |
|
1935 void CCASingleListContainer::UpdateFilterL() const |
|
1936 { |
|
1937 if ( iFindPaneIsVisible && iFindbox ) |
|
1938 { |
|
1939 // Avkon apparently changed the logic of listboxes |
|
1940 // so that the filter needs to be updated even though |
|
1941 // there's nothing in it. |
|
1942 // findpane is visible and contains something, notify it about |
|
1943 // the changed array |
|
1944 |
|
1945 CCAContactListBoxModel* model = |
|
1946 static_cast<CCAContactListBoxModel*>( iListBox->Model() ); |
|
1947 if ( model ) |
|
1948 { |
|
1949 CAknListBoxFilterItems* filter = |
|
1950 static_cast<CAknListBoxFilterItems*>( model->Filter() ); |
|
1951 |
|
1952 TInt index = iListBox->CurrentItemIndex(); |
|
1953 |
|
1954 if ( index == KErrNotFound ) |
|
1955 { |
|
1956 // for some reason the listbox loses the current |
|
1957 // index sometimes, breaking any calls to FilteredItemIndex. |
|
1958 // draw it nevertheless. otherwise when erasing a character |
|
1959 // from the filter causes nothing to be displayed. |
|
1960 if ( iListBox ) |
|
1961 { |
|
1962 iListBox->DrawNow(); |
|
1963 } |
|
1964 return; |
|
1965 } |
|
1966 |
|
1967 // HandleItemArrayChangeL resets the listbox index, |
|
1968 // work-around it |
|
1969 |
|
1970 // Handle Item addition only when there are visible items |
|
1971 iListBox->HandleItemAdditionL(); |
|
1972 |
|
1973 TInt top = iListBox->TopItemIndex(); |
|
1974 |
|
1975 TInt filteredIndex = model->FilteredItemIndex( index ); |
|
1976 TInt filteredTop = model->FilteredItemIndex( top ); |
|
1977 |
|
1978 if ( filter ) |
|
1979 { |
|
1980 // this resets the listbox index |
|
1981 filter->HandleItemArrayChangeL(); |
|
1982 } |
|
1983 |
|
1984 TInt filteredItems = model->NumberOfItems(); |
|
1985 if ( filteredItems ) |
|
1986 { |
|
1987 // we have some items to show |
|
1988 if ( filteredIndex >= filteredItems ) |
|
1989 { |
|
1990 // original index was beyond the last visible item, |
|
1991 // so move the index there |
|
1992 filteredIndex = filteredItems - 1; |
|
1993 } |
|
1994 |
|
1995 iListBox->SetCurrentItemIndex( filteredIndex ); |
|
1996 |
|
1997 if ( filteredTop <= filteredIndex ) |
|
1998 { |
|
1999 // move the filtered top item to the top |
|
2000 iListBox->SetTopItemIndex( filteredTop ); |
|
2001 } |
|
2002 else |
|
2003 { |
|
2004 iListBox->SetTopItemIndex( filteredIndex ); |
|
2005 } |
|
2006 } |
|
2007 |
|
2008 if ( iListBox ) |
|
2009 { |
|
2010 iListBox->DrawNow(); |
|
2011 } |
|
2012 } |
|
2013 } |
|
2014 } |
|
2015 |
|
2016 |
|
2017 // --------------------------------------------------------- |
|
2018 // CCASingleListContainer::LoadBitmapsL |
|
2019 // Called by framework when the view size is changed |
|
2020 // --------------------------------------------------------- |
|
2021 // |
|
2022 void CCASingleListContainer::LoadBitmapsL() |
|
2023 { |
|
2024 CColumnListBoxData* listBoxData = iListBox->ItemDrawer()->ColumnData(); |
|
2025 if ( !listBoxData ) |
|
2026 { |
|
2027 //No listbox data |
|
2028 User::Leave( KErrNotFound ); |
|
2029 } |
|
2030 |
|
2031 MCASkinVariant* skinVar = static_cast<CCAApp*>( |
|
2032 iAppUi->Application() )->VariantFactory()->SkinVariantL(); |
|
2033 |
|
2034 |
|
2035 CAknIconArray* icons = CCASingleListViewArray::LoadIconsLC( |
|
2036 iAppUi->MbmFullPath(), *skinVar ); |
|
2037 |
|
2038 CArrayPtr<CGulIcon>* oldIconArray = listBoxData->IconArray(); |
|
2039 if ( oldIconArray ) |
|
2040 { |
|
2041 oldIconArray->ResetAndDestroy(); |
|
2042 delete oldIconArray; |
|
2043 listBoxData->SetIconArray( NULL ); |
|
2044 } |
|
2045 |
|
2046 // Set icon-array to listbox's drawer |
|
2047 listBoxData->SetIconArray( icons ); |
|
2048 CleanupStack::Pop( icons ); |
|
2049 } |
|
2050 |
|
2051 // --------------------------------------------------------- |
|
2052 // CCASingleListContainer::OfferKeyEventL( |
|
2053 // const TKeyEvent& aEvent, |
|
2054 // TEventCode aType ) |
|
2055 // From CCoeControl, Handles key-events |
|
2056 // (other items were commented in a header). |
|
2057 // --------------------------------------------------------- |
|
2058 // |
|
2059 TKeyResponse CCASingleListContainer::OfferKeyEventL( |
|
2060 const TKeyEvent& aEvent, |
|
2061 TEventCode aType ) |
|
2062 { |
|
2063 CHAT_DP( D_CHAT_LIT( "CCASingleListContainer:: EventL %d %d" ), |
|
2064 aEvent, aType ); |
|
2065 |
|
2066 if ( iAppUi->AreEventsCaptured() ) |
|
2067 { |
|
2068 // for some reason the input absorber goes |
|
2069 // to the wrong position in view stack... |
|
2070 return EKeyWasConsumed; |
|
2071 } |
|
2072 |
|
2073 switch ( aEvent.iCode ) |
|
2074 { |
|
2075 case EKeyBackspace: |
|
2076 { |
|
2077 CHAT_DP_TXT( "backspace event" ); |
|
2078 if ( iFindbox ) |
|
2079 { |
|
2080 if ( iFindbox->TextLength() == 0 ) |
|
2081 { |
|
2082 TEnumsPC::TItem item = iMainViewArrayPC->GetType( CurrentListboxIndex() ); |
|
2083 |
|
2084 #ifdef IMPS_CONTACT_FETCH_BACKGROUND |
|
2085 if ( item == TEnumsPC::EContactListItem || |
|
2086 item == TEnumsPC::EContactItem ) |
|
2087 { |
|
2088 if ( !CCASyncChecker::CheckSyncStateL() ) |
|
2089 { |
|
2090 return EKeyWasConsumed; |
|
2091 } |
|
2092 } |
|
2093 #endif //IMPS_CONTACT_FETCH_BACKGROUND |
|
2094 |
|
2095 switch ( item ) |
|
2096 { |
|
2097 case TEnumsPC::EContactListItem: |
|
2098 { |
|
2099 TBool listCreateDelete( IMUtils::IntResourceValueL( |
|
2100 RSC_CHAT_VARIATION_CREATE_DELETE_CONTACT_LIST ) ); |
|
2101 if ( listCreateDelete ) |
|
2102 { |
|
2103 DeleteFriendL(); |
|
2104 return EKeyWasConsumed; |
|
2105 } |
|
2106 return EKeyWasNotConsumed; |
|
2107 } |
|
2108 case TEnumsPC::EContactItem: |
|
2109 { |
|
2110 DeleteFriendL(); |
|
2111 return EKeyWasConsumed; |
|
2112 } |
|
2113 case TEnumsPC::EConversationItem: |
|
2114 { |
|
2115 CloseConversationL(); |
|
2116 return EKeyWasConsumed; |
|
2117 } |
|
2118 case TEnumsPC::EInviteItem: |
|
2119 { |
|
2120 DeleteInvitationL(); |
|
2121 return EKeyWasConsumed; |
|
2122 } |
|
2123 case TEnumsPC::EGroupItem: |
|
2124 { |
|
2125 LeaveGroupL(); |
|
2126 return EKeyWasConsumed; |
|
2127 } |
|
2128 default: |
|
2129 { |
|
2130 //we should never be here. |
|
2131 break; |
|
2132 } |
|
2133 } |
|
2134 |
|
2135 } |
|
2136 } |
|
2137 break; |
|
2138 } |
|
2139 case EKeyPhoneSend: |
|
2140 { |
|
2141 // modified for all item types |
|
2142 TEnumsPC::TItem itemtype = iMainViewArrayPC->GetType( CurrentListboxIndex() ); |
|
2143 if ( !( itemtype == TEnumsPC::EOwnStatusItem |
|
2144 || itemtype == TEnumsPC::EOpenChatsListItem |
|
2145 || itemtype == TEnumsPC::EContactListItem |
|
2146 || itemtype == TEnumsPC::EConversationItem |
|
2147 || itemtype == TEnumsPC::EInviteItem ) |
|
2148 && IsFocused() ) |
|
2149 { |
|
2150 //if item type is only contact item then send key works |
|
2151 //open the conversation with selected contact. |
|
2152 HandleListBoxEventL( iListBox, EEventEnterKeyPressed ); |
|
2153 return EKeyWasConsumed; |
|
2154 } |
|
2155 } |
|
2156 // Flow-through |
|
2157 case EKeyRightArrow: |
|
2158 case EKeyLeftArrow: |
|
2159 { |
|
2160 // change default sofkeys prior to view change |
|
2161 //UpdateCbaL( ETrue ); |
|
2162 return EKeyWasNotConsumed; |
|
2163 } |
|
2164 default: |
|
2165 { |
|
2166 break; |
|
2167 } |
|
2168 } |
|
2169 |
|
2170 // got some key, let find box process it |
|
2171 TKeyResponse response = EKeyWasNotConsumed; |
|
2172 |
|
2173 if ( iFindPaneIsVisible && iFindbox ) |
|
2174 { |
|
2175 if ( iFindbox->OfferKeyEventL( aEvent, aType ) == EKeyWasNotConsumed && |
|
2176 iListBox ) |
|
2177 { |
|
2178 if ( aEvent.iCode == EKeyUpArrow ) |
|
2179 { |
|
2180 TInt topIndex = iListBox->TopItemIndex(); |
|
2181 TInt curIndex = iListBox->CurrentItemIndex(); |
|
2182 if ( topIndex == curIndex - 1 && topIndex ) |
|
2183 { |
|
2184 iListBox->SetTopItemIndex( topIndex - 1 ); |
|
2185 iListBox->DrawNow(); |
|
2186 } |
|
2187 } |
|
2188 response = iListBox->OfferKeyEventL( aEvent, aType ); |
|
2189 } |
|
2190 UpdateCbaL(); |
|
2191 } |
|
2192 |
|
2193 if ( response == EKeyWasConsumed ) |
|
2194 { |
|
2195 // listbox consumed the key |
|
2196 ShowInfoPopupL(); |
|
2197 } |
|
2198 |
|
2199 return EKeyWasConsumed; |
|
2200 } |
|
2201 |
|
2202 // --------------------------------------------------------- |
|
2203 // CCASingleListContainer::HandleListBoxEventL( |
|
2204 // CEikListBox* /*aListBox*/, TListBoxEvent /*aEventType*/ ) |
|
2205 // From MEikListBoxObserver, Handles event's generated by listbox |
|
2206 // (other items were commented in a header). |
|
2207 // --------------------------------------------------------- |
|
2208 // |
|
2209 void CCASingleListContainer::HandleListBoxEventL( |
|
2210 CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) |
|
2211 { |
|
2212 // Refresh softkeys |
|
2213 UpdateCbaL(); |
|
2214 |
|
2215 if ( aEventType != EEventEnterKeyPressed && |
|
2216 aEventType != EEventItemDoubleClicked && |
|
2217 aEventType != EEventItemClicked ) |
|
2218 { |
|
2219 return; |
|
2220 } |
|
2221 if ( iOpeningConversation ) |
|
2222 { |
|
2223 return; |
|
2224 } |
|
2225 |
|
2226 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( CurrentListboxIndex() ); |
|
2227 |
|
2228 if ( |
|
2229 ( ( itemType == TEnumsPC::EContactListItem ) || |
|
2230 ( itemType == TEnumsPC::EOpenChatsListItem ) ) |
|
2231 && ( aEventType != EEventItemDoubleClicked ) // double click is inactive |
|
2232 ) |
|
2233 |
|
2234 { |
|
2235 // if this is list, collapse/expand it |
|
2236 ExpandCollapseListL(); |
|
2237 return; |
|
2238 } |
|
2239 |
|
2240 //own data item |
|
2241 if ( itemType == TEnumsPC::EOwnStatusItem && |
|
2242 aEventType != EEventItemClicked ) // single click inactive |
|
2243 |
|
2244 { |
|
2245 iCommandHelper.InvokeCommandL( EChatClientMainViewCmdChangeStatus ); |
|
2246 return; |
|
2247 } |
|
2248 |
|
2249 //invitation item in chats folder |
|
2250 if ( itemType == TEnumsPC::EInviteItem && |
|
2251 aEventType != EEventItemClicked ) |
|
2252 { |
|
2253 iCommandHelper.InvokeCommandL( EChatPrivateListCmdOpen ); |
|
2254 return; |
|
2255 } |
|
2256 |
|
2257 //Check if it has to be done for double click or single click event |
|
2258 //group item in chats folder |
|
2259 if ( itemType == TEnumsPC::EGroupItem |
|
2260 && aEventType != EEventItemClicked ) |
|
2261 { |
|
2262 iCommandHelper.InvokeCommandL( EChatClientSingleListViewCmdGroupOpen ); |
|
2263 return; |
|
2264 } |
|
2265 |
|
2266 //conversation item in chats folder |
|
2267 if ( itemType == TEnumsPC::EConversationItem && |
|
2268 aEventType != EEventItemClicked ) |
|
2269 { |
|
2270 iCommandHelper.InvokeCommandL( EChatPrivateListCmdOpen ); |
|
2271 return; |
|
2272 } |
|
2273 |
|
2274 |
|
2275 if ( itemType != TEnumsPC::EContactItem |
|
2276 || aEventType == EEventItemClicked ) // single click inactive |
|
2277 { |
|
2278 ShowInfoPopupL(); |
|
2279 return; |
|
2280 } |
|
2281 |
|
2282 OpenConversationL(); |
|
2283 } |
|
2284 |
|
2285 // --------------------------------------------------------- |
|
2286 // CCASingleListContainer::HandleListBoxEventL |
|
2287 //From MCAMainViewObserverPC, called when a contact is deleted. |
|
2288 // --------------------------------------------------------- |
|
2289 // |
|
2290 |
|
2291 void CCASingleListContainer::HandleDelete( const TDesC& /*aContactId*/ , TEnumsPC::TItem /*type*/ ) |
|
2292 { |
|
2293 CHAT_DP_TXT( "CCASingleListContainer::HandleDelete" ); |
|
2294 |
|
2295 if ( iMainViewArrayPC->GetSkipStorageEvents() ) |
|
2296 { |
|
2297 return; |
|
2298 } |
|
2299 |
|
2300 TRAPD( err, UpdateViewAfterDeleteL() ); |
|
2301 HandleError( err ); |
|
2302 } |
|
2303 |
|
2304 // --------------------------------------------------------- |
|
2305 // CCASingleListContainer::HandleInvitationEventL |
|
2306 //From MCAMainViewObserverPC, when a invitation is received. |
|
2307 // --------------------------------------------------------- |
|
2308 // |
|
2309 void CCASingleListContainer::HandleInvitationEventL( TEnumsPC::TInviteType /*aInviteType*/, |
|
2310 const TDesC& /* aUserID */, |
|
2311 const TDesC& /* aMessage */ ) |
|
2312 { |
|
2313 |
|
2314 |
|
2315 } |
|
2316 |
|
2317 |
|
2318 // --------------------------------------------------------- |
|
2319 // CCAMainViewArrayPC::HandleInvitationResponse() |
|
2320 // (other items were commented in a header). |
|
2321 // --------------------------------------------------------- |
|
2322 // |
|
2323 void CCASingleListContainer::HandleInvitationResponse( TBool /* aAcceptance */, |
|
2324 const TDesC& /*aUserId */, |
|
2325 const TDesC& /*aGroupName */, |
|
2326 const TDesC& /*aResponse */ ) |
|
2327 { |
|
2328 // nothing to do here since CCAppUi shows the dialog |
|
2329 } |
|
2330 |
|
2331 // --------------------------------------------------------- |
|
2332 // CCASingleListContainer::HandleListBoxEventL |
|
2333 // From MCAMainViewObserverPC, called when a contact is added |
|
2334 // --------------------------------------------------------- |
|
2335 // |
|
2336 void CCASingleListContainer::HandleAddition( TEnumsPC::TItem aType, TInt aIndex ) |
|
2337 { |
|
2338 if ( iMainViewArrayPC->GetSkipStorageEvents() ) |
|
2339 { |
|
2340 return; |
|
2341 } |
|
2342 |
|
2343 TRAPD( err, |
|
2344 iListBox->HandleItemAdditionL(); |
|
2345 UpdateViewL( aIndex , aType, ETrue ); |
|
2346 ); |
|
2347 |
|
2348 if ( err != KErrNone ) |
|
2349 { |
|
2350 CActiveScheduler::Current()->Error( err ); |
|
2351 } |
|
2352 } |
|
2353 |
|
2354 // --------------------------------------------------------- |
|
2355 // CCASingleListContainer::HandleListBoxEventL |
|
2356 // From MCAMainViewObserverPC, called when a contact is changed. |
|
2357 // --------------------------------------------------------- |
|
2358 // |
|
2359 void CCASingleListContainer::HandleChange( TEnumsPC::TItem aType, |
|
2360 TInt aIndex, TEnumsPC::TChange changeType ) |
|
2361 { |
|
2362 CHAT_DP_FUNC_ENTER( "HandleChange" ); |
|
2363 |
|
2364 if ( iMainViewArrayPC->GetSkipStorageEvents() ) |
|
2365 { |
|
2366 return; |
|
2367 } |
|
2368 |
|
2369 TInt error( KErrNone ); |
|
2370 |
|
2371 switch ( aType ) |
|
2372 { |
|
2373 // first handle for own data if it has.. |
|
2374 case TEnumsPC::EOwnStatusItem: |
|
2375 // second contact ..handle it here.. |
|
2376 case TEnumsPC::EContactItem: |
|
2377 { |
|
2378 switch ( changeType ) |
|
2379 { |
|
2380 /*14th nov 2006 wvui20 changes |
|
2381 case TEnumsPC::EPreChange: |
|
2382 { |
|
2383 // Pre change events are received |
|
2384 // before contact lists are resorted, |
|
2385 // store current item to keep focus correct |
|
2386 // after resorting |
|
2387 iPrevItem = SelectedItem(); |
|
2388 return; |
|
2389 } |
|
2390 */ |
|
2391 case TEnumsPC::EMultipleChanges: |
|
2392 { |
|
2393 // When logged out, items are removed from list. So for to be sure |
|
2394 // call handleItemRemoval. |
|
2395 //Note: Code Scanner warning ignored. |
|
2396 TRAP( error, iListBox->HandleItemRemovalL(); |
|
2397 |
|
2398 if ( !iFindPaneIsVisible && iListBox->Model()->NumberOfItems() > 0 ) |
|
2399 { |
|
2400 ActivateFindPaneL(); |
|
2401 } |
|
2402 |
|
2403 UpdateFilterL(); |
|
2404 ); |
|
2405 if ( iMainViewArrayPC->Count() < 1 |
|
2406 || iListBox->Model()->NumberOfItems() == 1 ) |
|
2407 { |
|
2408 iListBox->SetCurrentItemIndexAndDraw( 0 ); |
|
2409 } |
|
2410 TRAP( error, UpdateCbaL() ); |
|
2411 |
|
2412 break; |
|
2413 } |
|
2414 |
|
2415 case TEnumsPC::EAddition: |
|
2416 case TEnumsPC::EDelete: |
|
2417 case TEnumsPC::EChanged: |
|
2418 { |
|
2419 //Note: Code Scanner warning ignored. |
|
2420 TRAP( error, iListBox->HandleItemRemovalL(); |
|
2421 |
|
2422 if ( !iFindPaneIsVisible && iListBox->Model()->NumberOfItems() > 0 ) |
|
2423 { |
|
2424 ActivateFindPaneL(); |
|
2425 } |
|
2426 |
|
2427 UpdateFilterL(); |
|
2428 ); |
|
2429 iListBox->DrawNow(); |
|
2430 break; |
|
2431 } |
|
2432 default: |
|
2433 { |
|
2434 break; |
|
2435 } |
|
2436 } |
|
2437 break; |
|
2438 } |
|
2439 |
|
2440 case TEnumsPC::EContactListItem: |
|
2441 { |
|
2442 switch ( changeType ) |
|
2443 { |
|
2444 /*14th nov 2006 wvui20 changes |
|
2445 case TEnumsPC::EPreChange: |
|
2446 { |
|
2447 // Pre change events are received |
|
2448 // before contact lists are resorted, |
|
2449 // store current item to keep focus correct |
|
2450 // after resorting |
|
2451 iPrevItem = SelectedItem(); |
|
2452 return; |
|
2453 } |
|
2454 */ |
|
2455 case TEnumsPC::EChanged: |
|
2456 case TEnumsPC::EAddition: |
|
2457 { |
|
2458 TBool failedFromAll = ETrue; |
|
2459 if ( iMainViewArrayPC->IsAllSynchronised( ) != TEnumsPC::ESyncSuccess ) |
|
2460 { |
|
2461 // If fetching is on-going, set aList to NULL |
|
2462 // to avoid list box index updating in UpdateViewL |
|
2463 failedFromAll = EFalse; |
|
2464 } |
|
2465 //Note: Code Scanner warning ignored. |
|
2466 TRAP( error, iListBox->HandleItemAdditionL(); |
|
2467 |
|
2468 if ( !iFindPaneIsVisible && iListBox->Model()->NumberOfItems() > 0 ) |
|
2469 { |
|
2470 ActivateFindPaneL(); |
|
2471 } |
|
2472 |
|
2473 UpdateFilterL(); |
|
2474 UpdateViewL( aIndex, aType, failedFromAll ); |
|
2475 UpdateCbaL() |
|
2476 ); |
|
2477 break; |
|
2478 } |
|
2479 case TEnumsPC::EDelete: |
|
2480 case TEnumsPC::EMultipleChanges: |
|
2481 { |
|
2482 TRAP( error, iListBox->HandleItemRemovalL(); |
|
2483 if ( !iFindPaneIsVisible && iListBox->Model()->NumberOfItems() > 0 ) |
|
2484 { |
|
2485 ActivateFindPaneL(); |
|
2486 } |
|
2487 |
|
2488 UpdateFilterL(); |
|
2489 ); |
|
2490 |
|
2491 if ( iMainViewArrayPC->Count() < 1 |
|
2492 || iListBox->Model()->NumberOfItems() == 1 ) |
|
2493 { |
|
2494 iListBox->SetCurrentItemIndexAndDraw( 0 ); |
|
2495 } |
|
2496 /*14th nov 2006 wvui20 changes */ |
|
2497 #ifdef IMPS_CONTACT_FETCH_BACKGROUND |
|
2498 else |
|
2499 { |
|
2500 TInt newIndex = CurrentListboxIndex(); |
|
2501 if ( newIndex != KErrNotFound ) |
|
2502 { |
|
2503 // Get real visible index for newIndex |
|
2504 CCAContactListBoxModel* list = |
|
2505 ( ( CCAContactListBoxModel* ) iListBox->Model() ); |
|
2506 newIndex = list->VisibleItemIndex( newIndex ); |
|
2507 } |
|
2508 if ( newIndex != KErrNotFound ) |
|
2509 { |
|
2510 // Set correct index |
|
2511 iListBox->SetCurrentItemIndexAndDraw( newIndex ); |
|
2512 } |
|
2513 } |
|
2514 #endif // IMPS_CONTACT_FETCH_BACKGROUND |
|
2515 TRAP( error, UpdateCbaL() ); |
|
2516 break; |
|
2517 } |
|
2518 default : |
|
2519 { |
|
2520 //Handle error condition here |
|
2521 break; |
|
2522 } |
|
2523 } |
|
2524 // third contact list. |
|
2525 break; |
|
2526 } |
|
2527 case TEnumsPC::EInviteItem: |
|
2528 { |
|
2529 switch ( changeType ) |
|
2530 { |
|
2531 case TEnumsPC::EDelete: |
|
2532 case TEnumsPC::EChanged: |
|
2533 case TEnumsPC::EAddition: |
|
2534 { |
|
2535 TRAP( error, iListBox->HandleItemRemovalL(); |
|
2536 |
|
2537 if ( !iFindPaneIsVisible && iListBox->Model()->NumberOfItems() > 0 ) |
|
2538 { |
|
2539 ActivateFindPaneL(); |
|
2540 } |
|
2541 UpdateFilterL(); |
|
2542 ); |
|
2543 iListBox->DrawNow(); |
|
2544 break; |
|
2545 } |
|
2546 default : |
|
2547 { |
|
2548 break; |
|
2549 } |
|
2550 } |
|
2551 // third contact list |
|
2552 break; |
|
2553 } |
|
2554 |
|
2555 case TEnumsPC::EOpenChatsListItem: |
|
2556 { |
|
2557 switch ( changeType ) |
|
2558 { |
|
2559 case TEnumsPC::EChanged: |
|
2560 { |
|
2561 TCAItemDetails itemDetails = iMainViewArrayPC->GetArrayItemIdDetails( KErrNotFound ); |
|
2562 TInt currentIndex( 0 ); |
|
2563 TRAP( error, currentIndex = iMainViewArrayPC->GetArrayItemIdIndexL( itemDetails ); |
|
2564 iListBox->HandleItemRemovalL(); |
|
2565 if ( !iFindPaneIsVisible && iListBox->Model()->NumberOfItems() > 0 ) |
|
2566 { |
|
2567 ActivateFindPaneL(); |
|
2568 } |
|
2569 UpdateFilterL(); |
|
2570 ); |
|
2571 if ( KErrNotFound == currentIndex ) |
|
2572 { |
|
2573 currentIndex = 0; |
|
2574 } |
|
2575 |
|
2576 // Don't set the index if there is anything in |
|
2577 // find pane. |
|
2578 if ( iFindbox->TextLength() == 0 ) |
|
2579 { |
|
2580 iListBox->SetCurrentItemIndex( currentIndex ); |
|
2581 } |
|
2582 iListBox->DrawNow(); |
|
2583 break; |
|
2584 } |
|
2585 case TEnumsPC::EAddition: |
|
2586 { |
|
2587 TCAItemDetails itemDetails = iMainViewArrayPC->GetArrayItemIdDetails( KErrNotFound ); |
|
2588 TInt currentIndex( 0 ); |
|
2589 TRAP( error, currentIndex = iMainViewArrayPC->GetArrayItemIdIndexL( itemDetails ); |
|
2590 iListBox->HandleItemAdditionL(); |
|
2591 if ( !iFindPaneIsVisible && iListBox->Model()->NumberOfItems() > 0 ) |
|
2592 { |
|
2593 ActivateFindPaneL(); |
|
2594 } |
|
2595 UpdateFilterL(); |
|
2596 ); |
|
2597 if ( KErrNotFound == currentIndex ) |
|
2598 { |
|
2599 currentIndex = 0; |
|
2600 } |
|
2601 |
|
2602 // Don't set the index if there is anything in |
|
2603 // find pane. |
|
2604 if ( iFindbox->TextLength() == 0 ) |
|
2605 { |
|
2606 iListBox->SetCurrentItemIndex( currentIndex ); |
|
2607 } |
|
2608 iListBox->DrawNow(); |
|
2609 break; |
|
2610 } |
|
2611 case TEnumsPC::EDelete: |
|
2612 { |
|
2613 TCAItemDetails itemDetails = iMainViewArrayPC->GetArrayItemIdDetails( KErrNotFound ); |
|
2614 TInt currentIndex( 0 ); |
|
2615 TRAP( error, currentIndex = iMainViewArrayPC->GetArrayItemIdIndexL( itemDetails ); |
|
2616 iListBox->HandleItemRemovalL(); |
|
2617 if ( !iFindPaneIsVisible && iListBox->Model()->NumberOfItems() > 0 ) |
|
2618 { |
|
2619 ActivateFindPaneL(); |
|
2620 } |
|
2621 |
|
2622 UpdateFilterL(); |
|
2623 ); |
|
2624 if ( KErrNotFound == currentIndex ) |
|
2625 { |
|
2626 currentIndex = 0; |
|
2627 } |
|
2628 |
|
2629 // Don't set the index if there is anything in |
|
2630 // find pane. |
|
2631 if ( iFindbox->TextLength() == 0 ) |
|
2632 { |
|
2633 iListBox->SetCurrentItemIndex( currentIndex ); |
|
2634 } |
|
2635 iListBox->DrawNow(); |
|
2636 break; |
|
2637 } |
|
2638 default: |
|
2639 { |
|
2640 //should never be here. |
|
2641 break; |
|
2642 } |
|
2643 } |
|
2644 break; |
|
2645 } |
|
2646 |
|
2647 // default throw exception |
|
2648 default: |
|
2649 { |
|
2650 //Handle error condition here |
|
2651 break; |
|
2652 } |
|
2653 } |
|
2654 |
|
2655 iListBox->DrawNow(); |
|
2656 |
|
2657 if ( error ) |
|
2658 { |
|
2659 CActiveScheduler::Current()->Error( error ); |
|
2660 } |
|
2661 |
|
2662 CHAT_DP_FUNC_DONE( "HandleChange" ); |
|
2663 } |
|
2664 |
|
2665 // --------------------------------------------------------- |
|
2666 // void CCASingleListContainer::GetHelpContext() |
|
2667 // Gets help context |
|
2668 // --------------------------------------------------------- |
|
2669 // |
|
2670 void CCASingleListContainer::GetHelpContext( |
|
2671 TCoeHelpContext& aContext ) const |
|
2672 { |
|
2673 aContext.iMajor = KUidChatClient; |
|
2674 aContext.iContext = KIMNG_HLP_COMMUNITY_VIEW ; |
|
2675 } |
|
2676 |
|
2677 // --------------------------------------------------------- |
|
2678 // CCASingleListContainer::FocusChanged |
|
2679 // (other items were commented in a header). |
|
2680 // --------------------------------------------------------- |
|
2681 // |
|
2682 void CCASingleListContainer::FocusChanged( TDrawNow /* aDrawNow */ ) |
|
2683 { |
|
2684 if ( iListBox ) |
|
2685 { |
|
2686 // give focus to list box so that highlight animations |
|
2687 // are done properly |
|
2688 iListBox->SetFocus( IsFocused() ); |
|
2689 } |
|
2690 if ( iFindbox ) |
|
2691 { |
|
2692 iFindbox->SetFocus( IsFocused() ); |
|
2693 } |
|
2694 } |
|
2695 |
|
2696 // --------------------------------------------------------- |
|
2697 // void CCASingleListContainer::LayoutChangedL() |
|
2698 // From MCALayoutChangeObserver |
|
2699 // Called when layout or skin changes |
|
2700 // --------------------------------------------------------- |
|
2701 // |
|
2702 void CCASingleListContainer::LayoutChangedL( TInt aType /*= 0*/ ) |
|
2703 { |
|
2704 // load this view's bitmaps |
|
2705 LoadBitmapsL(); |
|
2706 // update status pane's bitmaps |
|
2707 iStatusPane->ShowTabGroupL( KUidFriendsListView ); |
|
2708 |
|
2709 if ( iFindbox && iFindPaneIsVisible ) |
|
2710 { |
|
2711 iFindbox->MakeVisible( EFalse ); |
|
2712 } |
|
2713 |
|
2714 TRect mainPaneRect; |
|
2715 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); |
|
2716 SetRect( mainPaneRect ); |
|
2717 |
|
2718 CCoeControl::HandleResourceChange( aType ); |
|
2719 } |
|
2720 |
|
2721 // --------------------------------------------------------- |
|
2722 // CCASingleListContainer::HandleError( TInt aError ) const |
|
2723 // (other items were commented in a header). |
|
2724 // --------------------------------------------------------- |
|
2725 // |
|
2726 void CCASingleListContainer::HandleError( TInt aError ) const |
|
2727 { |
|
2728 CHAT_DP( D_CHAT_LIT( |
|
2729 "CCASingleListContainer::HandleError, aError = %d" ), |
|
2730 aError ); |
|
2731 if ( ( aError > Imps_ERROR_BASE ) && ( aError < KErrNone ) ) |
|
2732 { |
|
2733 // propagate system errors to current active scheduler, |
|
2734 // it should show a note |
|
2735 CActiveScheduler::Current()->Error( aError ); |
|
2736 } |
|
2737 |
|
2738 // imps errors are ignored at the moment as we don't have any |
|
2739 // notes specified for them |
|
2740 } |
|
2741 |
|
2742 |
|
2743 // ----------------------------------------------------------------------------- |
|
2744 // CCASingleListContainer::ResetFindBoxL |
|
2745 // Resets find box. |
|
2746 // ----------------------------------------------------------------------------- |
|
2747 // |
|
2748 void CCASingleListContainer::ResetFindBoxL() |
|
2749 { |
|
2750 if ( iMainViewArrayPC )//!=NULL ) |
|
2751 { |
|
2752 iMainViewArrayPC->ForceExpanded( EFalse ); |
|
2753 } |
|
2754 if ( iForceExpandChats ) |
|
2755 { |
|
2756 //expand the chats folder if it was collapsed. |
|
2757 iMainViewArrayPC->SetCollapsed( EFalse, 1 ); |
|
2758 iCurrentState = iMainViewArrayPC->IsCollapsed( 1 ); |
|
2759 iForceExpandChats = EFalse; |
|
2760 } |
|
2761 if ( iFindbox ) |
|
2762 { |
|
2763 iFindbox->ResetL(); |
|
2764 iFindbox->SetSearchTextL( KNullDesC ); |
|
2765 iFindbox->DrawNow(); |
|
2766 } |
|
2767 } |
|
2768 |
|
2769 // ----------------------------------------------------------------------------- |
|
2770 // CCASingleListContainer::SetSkipRefreshL |
|
2771 // Set flag for skipping refresh |
|
2772 // ----------------------------------------------------------------------------- |
|
2773 // |
|
2774 void CCASingleListContainer::SetSkipStorageEvents( TBool aSkip ) |
|
2775 { |
|
2776 iSkipStorageEvents = aSkip; |
|
2777 iMainViewArrayPC->SetSkipStorageEvents( aSkip ); |
|
2778 } |
|
2779 |
|
2780 // --------------------------------------------------------- |
|
2781 // CCASingleListContainer::ExpandCollapseListL |
|
2782 // --------------------------------------------------------- |
|
2783 // |
|
2784 void CCASingleListContainer::ExpandCollapseListL() |
|
2785 { |
|
2786 TInt index( CurrentListboxIndex() ); |
|
2787 if ( index == KErrNotFound ) |
|
2788 { |
|
2789 // listbox is empty |
|
2790 return; |
|
2791 } |
|
2792 |
|
2793 TEnumsPC::TItem itemtype = iMainViewArrayPC->GetType( index ); |
|
2794 if ( itemtype == TEnumsPC::EContactListItem || |
|
2795 itemtype == TEnumsPC::EContactItem || |
|
2796 itemtype == TEnumsPC::EOpenChatsListItem || |
|
2797 itemtype == TEnumsPC::EConversationItem || |
|
2798 itemtype == TEnumsPC::EInviteItem || |
|
2799 itemtype == TEnumsPC::EGroupItem ) |
|
2800 { |
|
2801 // there's a contact list or contact in current position |
|
2802 |
|
2803 #ifdef IMPS_CONTACT_FETCH_BACKGROUND |
|
2804 // If contact list is not synchronized, do not collapse/expand. |
|
2805 TEnumsPC::TSyncStatus syncState = iMainViewArrayPC->Synchronised( index ); |
|
2806 |
|
2807 if ( syncState != TEnumsPC::ESyncSuccess && itemtype == TEnumsPC::EContactListItem ) |
|
2808 { |
|
2809 // If current list is failed, user can choose if lists should |
|
2810 // be fetched again. |
|
2811 if ( syncState == TEnumsPC::ESyncFailed ) |
|
2812 { |
|
2813 TInt ret( IMDialogUtils::DisplayYesNoConfirmationDialogL( |
|
2814 R_QTN_CHAT_CONTACTLIST_FETCHAGAIN ) ); |
|
2815 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
2816 { |
|
2817 iMainViewArrayPC->FetchContactsL(); |
|
2818 } |
|
2819 } |
|
2820 return; |
|
2821 } |
|
2822 #endif //IMPS_CONTACT_FETCH_BACKGROUND |
|
2823 |
|
2824 TInt focusedIndex = iMainViewArrayPC->IndexOfList( index, EFalse, EFalse ); |
|
2825 TInt items = iListBox->Model()->NumberOfItems(); |
|
2826 |
|
2827 TInt filteredCount = iMainViewArrayPC->GetFilteredCount( |
|
2828 ( TEnumsPC::TFilterType )iMyFilter, index ); |
|
2829 |
|
2830 TBool collapsed( iMainViewArrayPC->IsCollapsed( index ) ); |
|
2831 TBool isForceExpanded( EFalse ); |
|
2832 if ( iFindbox && iFindbox->TextLength() > 0 ) |
|
2833 { |
|
2834 if ( itemtype == TEnumsPC::EContactListItem || |
|
2835 itemtype == TEnumsPC::EContactItem ) |
|
2836 { |
|
2837 isForceExpanded = iMainViewArrayPC->IsForceExpanded(); |
|
2838 if ( isForceExpanded && collapsed ) |
|
2839 { |
|
2840 iMainViewArrayPC->SetCollapsed( collapsed, index ); |
|
2841 } |
|
2842 else |
|
2843 { |
|
2844 iMainViewArrayPC->SetCollapsed( !collapsed, index ); |
|
2845 } |
|
2846 } |
|
2847 else |
|
2848 { |
|
2849 isForceExpanded = iForceExpandChats; |
|
2850 if ( !isForceExpanded ) |
|
2851 { |
|
2852 iMainViewArrayPC->SetCollapsed( !collapsed, index ); |
|
2853 } |
|
2854 } |
|
2855 |
|
2856 } |
|
2857 else |
|
2858 { |
|
2859 iMainViewArrayPC->SetCollapsed( !collapsed, index ); |
|
2860 } |
|
2861 |
|
2862 TInt curIndex( iListBox->CurrentItemIndex() ); |
|
2863 |
|
2864 ResetFindBoxL(); |
|
2865 UpdateFilterL(); |
|
2866 |
|
2867 if ( collapsed ) |
|
2868 { |
|
2869 // list was expanded => more items |
|
2870 iListBox->HandleItemAdditionL(); |
|
2871 |
|
2872 // Shift group upwards so that as much |
|
2873 // contacts as possible is shown |
|
2874 items = iListBox->Model()->NumberOfItems(); |
|
2875 iListBox->ScrollToMakeItemVisible( curIndex + filteredCount ); |
|
2876 if ( focusedIndex > ( items - 1 ) ) |
|
2877 { |
|
2878 focusedIndex = items - 1; |
|
2879 } |
|
2880 } |
|
2881 else |
|
2882 { |
|
2883 // list was collapsed => less items |
|
2884 iListBox->HandleItemRemovalL(); |
|
2885 // TInt bottomIndex = iListBox->BottomItemIndex(); |
|
2886 items = iListBox->Model()->NumberOfItems(); |
|
2887 // Collapsed list name is shown as up on the display as possible |
|
2888 // No need to scroll any more by default |
|
2889 // HandleItemRemovalL will take care of scrolling |
|
2890 |
|
2891 if ( focusedIndex > ( items - 1 ) ) |
|
2892 { |
|
2893 focusedIndex = items - 1; |
|
2894 } |
|
2895 } |
|
2896 |
|
2897 TInt topIndex = iListBox->TopItemIndex(); |
|
2898 // condition for "greater than" may be removed if the focus is correct |
|
2899 if ( topIndex >= focusedIndex && focusedIndex ) |
|
2900 { |
|
2901 iListBox->SetCurrentItemIndex( focusedIndex ); |
|
2902 iListBox->SetTopItemIndex( focusedIndex - 1 ); |
|
2903 iListBox->DrawNow(); |
|
2904 } |
|
2905 else |
|
2906 { |
|
2907 iListBox->SetCurrentItemIndexAndDraw( focusedIndex ); |
|
2908 } |
|
2909 UpdateCbaL(); |
|
2910 } |
|
2911 |
|
2912 } |
|
2913 |
|
2914 // --------------------------------------------------------- |
|
2915 // CCASingleListContainer::RenameListL |
|
2916 // --------------------------------------------------------- |
|
2917 // |
|
2918 void CCASingleListContainer::RenameListL() |
|
2919 { |
|
2920 TInt index( CurrentListboxIndex() ); |
|
2921 if ( index == KErrNotFound ) |
|
2922 { |
|
2923 // listbox is empty |
|
2924 return; |
|
2925 } |
|
2926 TEnumsPC::TItem itemtype = iMainViewArrayPC->GetType( index ); |
|
2927 if ( itemtype == TEnumsPC::EContactListItem ) |
|
2928 { |
|
2929 // there's a contact list in current position |
|
2930 //TPtrC itemname = SelectedItem(); |
|
2931 |
|
2932 TPtrC listId( KNullDesC() ); |
|
2933 listId.Set( iMainViewArrayPC->GetSelectedListId( index ) ); |
|
2934 |
|
2935 TPtrC displayName = iMainViewArrayPC->DisplayName( index ); |
|
2936 HBufC* name = HBufC::NewLC( KMaxWVIDLength ); |
|
2937 TPtr namePtr( name->Des() ); |
|
2938 namePtr.Copy( displayName.Left( namePtr.MaxLength() ) ); |
|
2939 TInt err( KErrCancel ); |
|
2940 |
|
2941 // We loop until we get a valid name or user cancels |
|
2942 do |
|
2943 { |
|
2944 TInt result( IMDialogUtils::DisplayTextQueryDialogL( namePtr, |
|
2945 R_QTN_CHAT_CONTACT_LIST_NAME_QUERY, |
|
2946 R_CHATCLIENT_CONVLIST_RECIP_QUERY, |
|
2947 ETrue // T9 |
|
2948 ) ); |
|
2949 if ( result == EAknSoftkeyOk || result == EAknSoftkeyDone ) |
|
2950 { |
|
2951 err = iMainViewArrayPC->ListAlreadyExistsL( namePtr ); |
|
2952 |
|
2953 if ( err == KErrNone ) |
|
2954 { |
|
2955 iAppUi->ShowWaitDialogLC( R_QTN_GEN_NOTE_SAVING ); |
|
2956 if ( CAUtils::CapitalizingEnabled() ) |
|
2957 { |
|
2958 // UI CR : |
|
2959 // Extra checking is to keep the current functionality and Newly added functionality |
|
2960 // in seperate parts. |
|
2961 HBufC* capitalizedList = CAUtils::CapitalizeListNameL( *name ); |
|
2962 CleanupStack::PushL( capitalizedList ); |
|
2963 err = iMainViewArrayPC->SetDisplayNameL( index, *capitalizedList ); |
|
2964 CleanupStack::PopAndDestroy(); |
|
2965 } |
|
2966 else |
|
2967 { |
|
2968 err = iMainViewArrayPC->SetDisplayNameL( index, *name ); |
|
2969 } |
|
2970 |
|
2971 //CodeScanner warning to be ignored |
|
2972 CleanupStack::PopAndDestroy(); // waitnote |
|
2973 if ( err != KErrNone ) |
|
2974 { |
|
2975 HBufC* text = CCoeEnv::Static()->AllocReadResourceLC( |
|
2976 R_QTN_CHAT_CONTACT_LIST_RENAMING_FAILED ); |
|
2977 IMDialogUtils::DisplayErrorNoteL( *text ); |
|
2978 CleanupStack::PopAndDestroy( text ); |
|
2979 } |
|
2980 else |
|
2981 { |
|
2982 // rename was successfull now sort the list |
|
2983 // and return new index of renamed contact list |
|
2984 TInt newIndex = KErrNotFound; |
|
2985 newIndex = iMainViewArrayPC->SortContactListAfterRenameL( listId ); |
|
2986 if ( newIndex != KErrNotFound ) |
|
2987 { |
|
2988 //set index for focus |
|
2989 index = newIndex ; |
|
2990 } |
|
2991 } |
|
2992 } |
|
2993 |
|
2994 // contact list already exists |
|
2995 else if ( err == KErrAlreadyExists ) |
|
2996 { |
|
2997 HBufC* text = NULL; |
|
2998 text = StringLoader::LoadLC( |
|
2999 R_QTN_FLDR_NAME_ALREADY_USED, namePtr ); |
|
3000 IMDialogUtils::DisplayInformationNoteL( *text ); |
|
3001 CleanupStack::PopAndDestroy( text ); |
|
3002 } |
|
3003 //Other error cases (like KErrUnknown )would be handled later |
|
3004 } |
|
3005 else |
|
3006 { |
|
3007 err = KErrCancel; |
|
3008 } |
|
3009 |
|
3010 } while ( err != KErrNone && err != KErrCancel ); |
|
3011 CleanupStack::PopAndDestroy( name ); |
|
3012 UpdateViewL( index, TEnumsPC::EContactListItem, ETrue ); |
|
3013 } |
|
3014 |
|
3015 } |
|
3016 |
|
3017 // --------------------------------------------------------- |
|
3018 // CCASingleListContainer::ContactSelectionFromPhoneBookL() |
|
3019 // Add friend from phonebook |
|
3020 // --------------------------------------------------------- |
|
3021 void CCASingleListContainer::ContactSelectionFromPhoneBookL() |
|
3022 { |
|
3023 // Check that we have even one contact list where to add the contact |
|
3024 if ( CCAUINGUtils::EChatNoContactList == CCAUINGUtils::VerifyContactlistL() ) |
|
3025 { |
|
3026 return; |
|
3027 } |
|
3028 |
|
3029 iStoresOpened = EFalse; |
|
3030 iOperationComplete = ETrue; |
|
3031 // As user may not use the "Add From Phonebook" functionality very often |
|
3032 // Contact stores should be opened only when he selects this options |
|
3033 // So this piece of code should not be moved to ConstructL() |
|
3034 if ( !iContactManager ) |
|
3035 { |
|
3036 //general error for phonebook can be shown |
|
3037 //we can later have a specific error string "Phonebook error" etc |
|
3038 //for phonebook related error |
|
3039 IMNoteMapper::ShowNoteL( EGeneralServerError ); |
|
3040 return; |
|
3041 } |
|
3042 iContactManager->ContactStoresL().OpenAllL( *this ); |
|
3043 |
|
3044 } |
|
3045 |
|
3046 // --------------------------------------------------------- |
|
3047 // CCASingleListContainer::InitPbk2SingleEntryFetchL() |
|
3048 // Add friend from phonebook |
|
3049 // --------------------------------------------------------- |
|
3050 void CCASingleListContainer::InitPbk2SingleEntryFetchL() |
|
3051 { |
|
3052 iServiceHandler = CAiwServiceHandler::NewL(); |
|
3053 // Attach interests |
|
3054 iServiceHandler->AttachL( R_AIWSELECT_INTEREST ); |
|
3055 |
|
3056 CPbk2StoreConfiguration* configuration = CPbk2StoreConfiguration::NewL(); |
|
3057 CleanupStack::PushL( configuration ); |
|
3058 CVPbkContactStoreUriArray* uriArray = configuration->CurrentConfigurationL(); |
|
3059 CleanupStack::PushL( uriArray ); |
|
3060 if ( !( uriArray->IsIncluded( VPbkContactStoreUris::DefaultCntDbUri() ) ) ) |
|
3061 { |
|
3062 uriArray->AppendL( VPbkContactStoreUris::DefaultCntDbUri() ); |
|
3063 } |
|
3064 |
|
3065 iContactManager = CVPbkContactManager::NewL( *uriArray ); |
|
3066 |
|
3067 //Note : Code scanner warning to be ignored. |
|
3068 CleanupStack::PopAndDestroy( 2 ); // uriArray, configuration |
|
3069 |
|
3070 iSortOrderManager = |
|
3071 CPbk2SortOrderManager::NewL( iContactManager->FieldTypes() ); |
|
3072 |
|
3073 iNameFormatter = Pbk2ContactNameFormatterFactory::CreateL( |
|
3074 iContactManager->FieldTypes(), |
|
3075 *iSortOrderManager ); |
|
3076 |
|
3077 // Construct empty filter |
|
3078 iContactViewFilter = |
|
3079 CVPbkFieldTypeSelector::NewL( iContactManager->FieldTypes() ); |
|
3080 |
|
3081 // Append the filter object with suitable criteria |
|
3082 VPbkContactViewFilterBuilder::BuildContactViewFilterL |
|
3083 ( *iContactViewFilter, EVPbkContactViewFilterPhoneNumber, |
|
3084 *iContactManager ); |
|
3085 |
|
3086 } |
|
3087 |
|
3088 // --------------------------------------------------------- |
|
3089 // CCASingleListContainer::CloseAllContactStores() |
|
3090 // Add friend from phonebook |
|
3091 // --------------------------------------------------------- |
|
3092 void CCASingleListContainer::CloseAllContactStores() |
|
3093 { |
|
3094 if ( iContactManager ) |
|
3095 { |
|
3096 TRAP_IGNORE( iContactManager->ContactStoresL().CloseAll( *this ) ); |
|
3097 } |
|
3098 } |
|
3099 |
|
3100 // --------------------------------------------------------- |
|
3101 // CCASingleListContainer::ReleasePbkSingleEntryFetch() |
|
3102 // Add friend from phonebook |
|
3103 // --------------------------------------------------------- |
|
3104 void CCASingleListContainer::ReleasePbkSingleEntryFetch() |
|
3105 { |
|
3106 if ( iServiceHandler ) |
|
3107 { |
|
3108 TRAP_IGNORE( iServiceHandler->DetachL( R_AIWSELECT_INTEREST ) ); |
|
3109 } |
|
3110 delete iNameFormatter; |
|
3111 iNameFormatter = NULL; |
|
3112 |
|
3113 delete iSortOrderManager; |
|
3114 iSortOrderManager = NULL; |
|
3115 |
|
3116 delete iContactViewFilter; |
|
3117 iContactViewFilter = NULL; |
|
3118 |
|
3119 delete iContactManager; |
|
3120 iContactManager = NULL; |
|
3121 |
|
3122 delete iServiceHandler; |
|
3123 iServiceHandler = NULL; |
|
3124 } |
|
3125 |
|
3126 // -------------------------------------------------------------------------- |
|
3127 // CCASingleListContainer::ExecutePbkSingleEntryFetchL |
|
3128 // -------------------------------------------------------------------------- |
|
3129 // |
|
3130 void CCASingleListContainer::ExecutePbkSingleEntryFetchL |
|
3131 ( TAiwSingleEntrySelectionDataV2 aData, |
|
3132 const TDesC& aUri1, |
|
3133 const TDesC& aUri2, |
|
3134 const TDesC& aUri3 ) |
|
3135 { |
|
3136 TAiwSingleEntrySelectionDataV2Pckg dataPckg( aData ); |
|
3137 TAiwVariant variant( dataPckg ); |
|
3138 TAiwGenericParam param( EGenericParamContactSelectionData, variant ); |
|
3139 CAiwGenericParamList& inParamList = iServiceHandler->InParamListL(); |
|
3140 inParamList.AppendL( param ); |
|
3141 |
|
3142 CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewL(); |
|
3143 CleanupStack::PushL( uriArray ); |
|
3144 if ( aUri1.Length() > 0 ) uriArray->AppendL( aUri1 ); |
|
3145 if ( aUri2.Length() > 0 ) uriArray->AppendL( aUri2 ); |
|
3146 if ( aUri3.Length() > 0 ) uriArray->AppendL( aUri3 ); |
|
3147 |
|
3148 HBufC8* packedUris = uriArray->PackLC(); |
|
3149 if ( uriArray->Count() > 0 ) |
|
3150 { |
|
3151 inParamList.AppendL( |
|
3152 TAiwGenericParam( |
|
3153 EGenericParamContactStoreUriArray, |
|
3154 TAiwVariant( *packedUris ) ) ); |
|
3155 } |
|
3156 |
|
3157 iServiceHandler->ExecuteServiceCmdL( |
|
3158 KAiwCmdSelect, |
|
3159 inParamList, |
|
3160 iServiceHandler->OutParamListL(), |
|
3161 KAiwOptASyncronous, |
|
3162 this ); |
|
3163 //Note: Code Scanner warning to be ignored |
|
3164 CleanupStack::PopAndDestroy( 2 ); // packedUris, uriArray |
|
3165 |
|
3166 } |
|
3167 |
|
3168 |
|
3169 // --------------------------------------------------------------------------- |
|
3170 // Retrive the selected contact from parameter list |
|
3171 // --------------------------------------------------------------------------- |
|
3172 // |
|
3173 TInt CCASingleListContainer::HandleNotifyL( TInt aCmdId, TInt aEventId, |
|
3174 CAiwGenericParamList& aEventParamList, const |
|
3175 CAiwGenericParamList& /*aInParamList*/ ) |
|
3176 { |
|
3177 TInt result( 0 ); |
|
3178 if ( aCmdId == KAiwCmdSelect ) |
|
3179 { |
|
3180 if ( aEventId == KAiwEventCompleted ) |
|
3181 { |
|
3182 TInt paramIndex = 0; |
|
3183 |
|
3184 //Retrive the parameter from parameter list |
|
3185 // |
|
3186 const TAiwGenericParam* contactParam = |
|
3187 aEventParamList.FindFirst( paramIndex, |
|
3188 EGenericParamContactLinkArray ); |
|
3189 |
|
3190 if ( !iStoresOpened ) |
|
3191 { |
|
3192 CloseAllContactStores(); |
|
3193 IMNoteMapper::ShowNoteL( EGeneralServerError ); |
|
3194 return result; |
|
3195 } |
|
3196 |
|
3197 // Retrive the storecontact from parameter |
|
3198 // |
|
3199 if ( contactParam && iStoresOpened ) |
|
3200 { |
|
3201 //Get the contact link from parameter |
|
3202 // |
|
3203 TPtrC8 result = contactParam->Value().AsData(); |
|
3204 MVPbkContactLinkArray* contactLinkArray = |
|
3205 iContactManager->CreateLinksLC( result ); |
|
3206 |
|
3207 const MVPbkContactLink* contactLink = contactLinkArray->At( 0 ).CloneLC(); |
|
3208 //Use the contact manager to retrive the contact store |
|
3209 iContactManager->RetrieveContactL( *contactLink, *this ); |
|
3210 |
|
3211 //Note:CodeScanner warning to be ignored. |
|
3212 CleanupStack::PopAndDestroy( 2 ); //contactLink, contactLinkArray |
|
3213 } |
|
3214 } |
|
3215 |
|
3216 else if ( aEventId == KAiwEventCanceled ) |
|
3217 { |
|
3218 CloseAllContactStores(); |
|
3219 } |
|
3220 else if ( aEventId == KAiwEventOutParamCheck ) |
|
3221 { |
|
3222 // should always be 1(yes) |
|
3223 result = 1; |
|
3224 } |
|
3225 else if ( aEventId == KAiwEventError || aEventId == KAiwEventStopped ) |
|
3226 { |
|
3227 CloseAllContactStores(); |
|
3228 IMNoteMapper::ShowNoteL( EGeneralServerError ); |
|
3229 } |
|
3230 } |
|
3231 return result; |
|
3232 } |
|
3233 |
|
3234 |
|
3235 // ----------------------------------------------------------------------------- |
|
3236 // CCASingleListContainer::GetWVIdOfSelPbkContactL |
|
3237 // Adds a new contact from phone book |
|
3238 // ----------------------------------------------------------------------------- |
|
3239 // |
|
3240 HBufC* CCASingleListContainer::GetWVIdOfSelPbkContactL( const TDesC& aTitle, |
|
3241 const TDesC& aNumberToSearch ) |
|
3242 { |
|
3243 HBufC* myWVID = HBufC::NewLC( KWVUserIDMaxLength ); |
|
3244 |
|
3245 if ( aNumberToSearch.Length() > 0 ) |
|
3246 { |
|
3247 TPtrC myDebug( aNumberToSearch ); |
|
3248 CHAT_DP( D_CHAT_LIT( |
|
3249 "CCASingleListContainer::GetWVIdOfSelPbkContactL number to search %S" ) |
|
3250 , &myDebug ); |
|
3251 |
|
3252 myDebug.Set( aTitle ); |
|
3253 CHAT_DP( D_CHAT_LIT( |
|
3254 "CCASingleListContainer::GetWVIdOfSelPbkContactL title:%S" ), |
|
3255 &myDebug ); |
|
3256 |
|
3257 HBufC* text = StringLoader::LoadLC( R_QTN_CHAT_SEARCHVIEW_PROCESSING ); |
|
3258 iAppUi->ShowWaitDialogL( *text, ETrue ); |
|
3259 CleanupStack::PopAndDestroy( text ); |
|
3260 |
|
3261 CSearchPairs* pairs = new ( ELeave ) CSearchPairs( 1 ); |
|
3262 CleanupStack::PushL( pairs ); |
|
3263 |
|
3264 CImpsSearchRequest* request = CImpsSearchRequest::NewL(); |
|
3265 CleanupStack::PushL( request ); |
|
3266 |
|
3267 request->SetRequestL( EImpsUserMobileNumber, aNumberToSearch ); |
|
3268 pairs->AppendL( request ); |
|
3269 |
|
3270 TInt err( KErrNone ); |
|
3271 |
|
3272 TRAPD( leave, err = iSearchInterfacePC->StartSearchL( |
|
3273 KSearchLimit, NULL, pairs ) ); |
|
3274 iAppUi->DismissWaitDialogL( leave ); |
|
3275 |
|
3276 if ( err == KErrNone ) |
|
3277 { |
|
3278 |
|
3279 TInt resultCount( iDataInterfacePC->SearchDataCount() ); |
|
3280 CHAT_DP( D_CHAT_LIT( |
|
3281 "CCASingleListContainer::GetWVIdOfSelPbkContactL results:%d" ), |
|
3282 resultCount ); |
|
3283 |
|
3284 if ( resultCount > 0 ) |
|
3285 { |
|
3286 if ( resultCount > 1 ) |
|
3287 { |
|
3288 text = StringLoader::LoadLC( R_QTN_CHAT_FOUND_MANY_IDS, |
|
3289 resultCount ); |
|
3290 |
|
3291 IMDialogUtils::DisplayQueryDialogL( R_CHAT_CONFOK_TEMPLATE, *text ); |
|
3292 |
|
3293 CleanupStack::PopAndDestroy( text ); |
|
3294 |
|
3295 CDesCArrayFlat* itemList = new ( ELeave ) |
|
3296 CDesCArrayFlat( |
|
3297 KArrayGranularity ); |
|
3298 CleanupStack::PushL( itemList ); |
|
3299 |
|
3300 for ( TInt count( 0 ); count < resultCount; ++count ) |
|
3301 { |
|
3302 myDebug.Set( iDataInterfacePC->SearchData( count ) ); |
|
3303 CHAT_DP( D_CHAT_LIT( |
|
3304 "CCASingleListContainer::GetWVIdOfSelPbkContactL result:%S" ), |
|
3305 &myDebug ); |
|
3306 itemList->AppendL( iAppUi->DisplayId( |
|
3307 iDataInterfacePC->SearchData( count ) ) ); |
|
3308 } |
|
3309 |
|
3310 TInt selectionIndex( 0 ); |
|
3311 TInt ret( IMDialogUtils::DisplayListQueryDialogL( |
|
3312 &selectionIndex, |
|
3313 itemList, |
|
3314 R_CHAT_ADDPB_LIST_QUERY ) ); |
|
3315 |
|
3316 CHAT_DP( D_CHAT_LIT( |
|
3317 "CCASingleListContainer::GetWVIdOfSelPbkContactL ret %d" ) |
|
3318 , ret ); |
|
3319 |
|
3320 CleanupStack::PopAndDestroy( itemList ); |
|
3321 |
|
3322 if ( ret == 0 ) |
|
3323 { |
|
3324 // User cancelled list query, cleanup and return NULL |
|
3325 CleanupStack::PopAndDestroy( 3, myWVID ); |
|
3326 return NULL; |
|
3327 } |
|
3328 |
|
3329 ( *myWVID ) = iDataInterfacePC->SearchData( selectionIndex ); |
|
3330 } |
|
3331 else |
|
3332 { |
|
3333 //else part of 4th condition,if ( resultCount > 1 ) |
|
3334 myDebug.Set( iDataInterfacePC->SearchData( 0 ) ); |
|
3335 CHAT_DP( D_CHAT_LIT( |
|
3336 "CCASingleListContainer::GetWVIdOfSelPbkContactL result:%S" ) |
|
3337 , &myDebug ); |
|
3338 |
|
3339 ( *myWVID ) = iDataInterfacePC->SearchData( 0 ); |
|
3340 } |
|
3341 //ok just one selected |
|
3342 } |
|
3343 else |
|
3344 { |
|
3345 //else part of 3rd condition, if ( resultCount > 0 ) |
|
3346 //no hits |
|
3347 IMDialogUtils::DisplayInformationNoteL( R_QTN_CHAT_CONT_NOT_FOUND, aTitle ); |
|
3348 CHAT_DP_TXT( |
|
3349 "CCASingleListContainer::GetWVIdOfSelPbkContactL no user found by number" ); |
|
3350 |
|
3351 TUint fetchFlags = 0; |
|
3352 //remove setflags if not required |
|
3353 ExecutePbkSingleEntryFetchL( TAiwSingleEntrySelectionDataV2(). |
|
3354 SetFetchFilter( iContactViewFilter ). |
|
3355 SetFlags( fetchFlags ) |
|
3356 ); |
|
3357 //Reset the flag to so that contact stores should not get closed |
|
3358 // for this case as still single entry fetch is going on |
|
3359 iOperationComplete = EFalse; |
|
3360 } |
|
3361 |
|
3362 } |
|
3363 else |
|
3364 { |
|
3365 //else part of 2nd condition ,if ( err == KErrNone ) |
|
3366 IMNoteMapper::ShowNoteL( err ); |
|
3367 } |
|
3368 |
|
3369 //CodeScanner warning to be ignored |
|
3370 CleanupStack::PopAndDestroy( 2, pairs ); // request, pairs |
|
3371 } |
|
3372 else |
|
3373 { |
|
3374 //else part of first condition, if(aNumberToSearch.Length() >0) |
|
3375 //oops, no number , handle no. of results = zero |
|
3376 } |
|
3377 |
|
3378 |
|
3379 |
|
3380 //lets check if we have data |
|
3381 if ( myWVID->Length() ) |
|
3382 { |
|
3383 CleanupStack::Pop( myWVID ); |
|
3384 } |
|
3385 else |
|
3386 { |
|
3387 //remove and return NULL if we dont have anything |
|
3388 CleanupStack::PopAndDestroy( myWVID ); |
|
3389 myWVID = NULL; |
|
3390 } |
|
3391 |
|
3392 return myWVID; |
|
3393 |
|
3394 } |
|
3395 |
|
3396 |
|
3397 // --------------------------------------------------------- |
|
3398 // CCASingleListContainer::AddSelectedPbk2ContactL() |
|
3399 // Note: CodeScanner is likely to return false positives for |
|
3400 // this situation |
|
3401 // --------------------------------------------------------- |
|
3402 // |
|
3403 void CCASingleListContainer::AddSelectedPbk2ContactL( MVPbkStoreContact* aContact ) |
|
3404 { |
|
3405 |
|
3406 HBufC* myTitle = HBufC::NewLC( KWVUserIDMaxLength ); |
|
3407 HBufC* myNumberToSearch = HBufC::NewLC( KWVUserIDMaxLength ); |
|
3408 |
|
3409 //check return value |
|
3410 TPtr myTitlePtr( myTitle->Des() ); |
|
3411 TPtr myNumberToSearchPtr( myNumberToSearch->Des() ); |
|
3412 |
|
3413 CDesCArray* selectedContacts = new ( ELeave ) CDesCArrayFlat( 10 ); |
|
3414 CleanupStack::PushL( selectedContacts ); |
|
3415 TInt fieldCount = aContact->Fields().FieldCount(); |
|
3416 for ( TInt i( 0 ); i < fieldCount; ++i ) |
|
3417 { |
|
3418 const MVPbkStoreContactField& field = aContact->Fields().FieldAt( i ); |
|
3419 const MVPbkFieldType* fieldType = field.BestMatchingFieldType(); |
|
3420 if ( field.FieldData().DataType() == EVPbkFieldStorageTypeText ) |
|
3421 { |
|
3422 if ( ContainsFieldType( fieldType->VersitProperties(), EVPbkVersitNameTEL ) ) |
|
3423 { |
|
3424 TPtrC text = MVPbkContactFieldTextData::Cast( field.FieldData() ).Text(); |
|
3425 selectedContacts->AppendL( text ); |
|
3426 } |
|
3427 } |
|
3428 } |
|
3429 |
|
3430 if ( iNameFormatter ) |
|
3431 { |
|
3432 HBufC* tempTitle = iNameFormatter->GetContactTitleL( aContact->Fields(), 0 ); |
|
3433 myTitlePtr = *tempTitle; |
|
3434 delete tempTitle; |
|
3435 } |
|
3436 // check if there are multiple mobile numbers, if only one Mobile number, then no need |
|
3437 // to show the dialog. |
|
3438 if ( 1 < selectedContacts->Count() ) |
|
3439 { |
|
3440 TInt selectionIndex = -1; |
|
3441 IMDialogUtils::DisplayPopupListL( selectionIndex, selectedContacts, myTitlePtr, ELbmDoesNotOwnItemArray, KErrNotFound ); |
|
3442 |
|
3443 // if Back is pressed then the list of contacts is shown. |
|
3444 if ( -1 == selectionIndex ) |
|
3445 { |
|
3446 TUint fetchFlags = 0; |
|
3447 //remove setflags if not required |
|
3448 ExecutePbkSingleEntryFetchL( TAiwSingleEntrySelectionDataV2(). |
|
3449 SetFetchFilter( iContactViewFilter ). |
|
3450 SetFlags( fetchFlags ) |
|
3451 ); |
|
3452 //Reset the flag to so that contact stores should not get closed |
|
3453 // for this case as still single entry fetch is going on |
|
3454 iOperationComplete = EFalse; |
|
3455 CleanupStack::PopAndDestroy( 3 ); //selectedcontacts,myNumberToSearch,myTitle |
|
3456 return; |
|
3457 } |
|
3458 |
|
3459 myNumberToSearchPtr = selectedContacts->MdcaPoint( selectionIndex ) ; |
|
3460 } |
|
3461 |
|
3462 else if ( 0 < selectedContacts->Count() ) |
|
3463 { |
|
3464 // since there is only one contact, hence the index is 0 |
|
3465 myNumberToSearchPtr = selectedContacts->MdcaPoint( 0 ) ; |
|
3466 } |
|
3467 else |
|
3468 { |
|
3469 // There will be a note here. |
|
3470 } |
|
3471 |
|
3472 HBufC* myWVID = GetWVIdOfSelPbkContactL( *myTitle, *myNumberToSearch ); |
|
3473 if ( myWVID ) |
|
3474 { |
|
3475 CleanupStack::PushL( myWVID ); |
|
3476 TPtrC myDebug( myWVID->Des() ); |
|
3477 CHAT_DP( D_CHAT_LIT( |
|
3478 "CCASingleListContainer::AddSelectedPbk2ContactL number to search %S" ) |
|
3479 , &myDebug ); |
|
3480 |
|
3481 HBufC* titleText = iStatusPane->Title()->AllocLC(); |
|
3482 |
|
3483 TInt index = CurrentListboxIndex(); |
|
3484 // creating new |
|
3485 TBool contactSaved( EFalse ); |
|
3486 |
|
3487 //as we are goin to add a new contact the index passed to Contact Editor |
|
3488 //must be -1. So we can avoid initialisation with wrong data |
|
3489 CCAContactEditor* contactEditor = |
|
3490 CCAContactEditor::NewL( -1, contactSaved ); |
|
3491 |
|
3492 |
|
3493 TPtrC listId( KNullDesC() ); |
|
3494 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( index ); |
|
3495 if ( itemType == TEnumsPC::EContactListItem || itemType == TEnumsPC::EContactListItem ) |
|
3496 { |
|
3497 listId.Set( iMainViewArrayPC->GetSelectedListId( index ) ) ; |
|
3498 } |
|
3499 |
|
3500 TInt err; |
|
3501 TRAP( err, contactEditor->EditContactLD( TEnumsPC::EAddToContact, |
|
3502 listId, *myWVID, KNullDesC ) ); |
|
3503 iStatusPane->SetTitleL( *titleText ); |
|
3504 |
|
3505 //CodeScanner warning to be ignored |
|
3506 CleanupStack::PopAndDestroy(); // titleText |
|
3507 CleanupStack::PopAndDestroy( ); //myWVID |
|
3508 } |
|
3509 |
|
3510 CleanupStack::PopAndDestroy( 3 ); //selectedcontacts,myNumberToSearch,myTitle |
|
3511 |
|
3512 // restore the navipane since CPbkMultipleEntryFetchDialog leaves it empty |
|
3513 iStatusPane->ShowTabGroupL( KUidFriendsListView ); |
|
3514 } |
|
3515 |
|
3516 // ----------------------------------------------------------------------------- |
|
3517 // CCASingleListContainer::ContainsFieldType |
|
3518 // ----------------------------------------------------------------------------- |
|
3519 // |
|
3520 TBool CCASingleListContainer::ContainsFieldType( TArray<TVPbkFieldVersitProperty> aArray, |
|
3521 TVPbkFieldTypeName aName ) |
|
3522 { |
|
3523 TBool ret = EFalse; |
|
3524 const TInt size = aArray.Count(); |
|
3525 for ( TInt i = 0; i < size; ++i ) |
|
3526 { |
|
3527 /*if (aArray[i].Name() == aName) |
|
3528 { |
|
3529 ret = ETrue; |
|
3530 break; |
|
3531 }*/ |
|
3532 |
|
3533 if ( aArray[i].Parameters().Contains( EVPbkVersitParamCELL ) ) |
|
3534 { |
|
3535 ret = ETrue; |
|
3536 break; |
|
3537 } |
|
3538 } |
|
3539 return ret; |
|
3540 } |
|
3541 |
|
3542 |
|
3543 // -------------------------------------------------------------------------- |
|
3544 // CCASingleListContainer::VPbkSingleContactOperationComplete |
|
3545 // -------------------------------------------------------------------------- |
|
3546 |
|
3547 void CCASingleListContainer::VPbkSingleContactOperationComplete( |
|
3548 MVPbkContactOperationBase& aOperation, |
|
3549 MVPbkStoreContact* aContact ) |
|
3550 { |
|
3551 TRAP_IGNORE( AddSelectedPbk2ContactL( aContact ) ); |
|
3552 delete &aOperation; |
|
3553 delete aContact; |
|
3554 if ( iOperationComplete ) |
|
3555 { |
|
3556 CloseAllContactStores(); |
|
3557 } |
|
3558 //reset it for next single entry fetch from Phonebook |
|
3559 iOperationComplete = ETrue; |
|
3560 } |
|
3561 |
|
3562 |
|
3563 // -------------------------------------------------------------------------- |
|
3564 // CCASingleListContainer::VPbkSingleContactOperationFailed |
|
3565 // -------------------------------------------------------------------------- |
|
3566 |
|
3567 void CCASingleListContainer::VPbkSingleContactOperationFailed( |
|
3568 MVPbkContactOperationBase& aOperation, |
|
3569 TInt aError ) |
|
3570 { |
|
3571 delete &aOperation; |
|
3572 CloseAllContactStores(); |
|
3573 TRAP_IGNORE( IMNoteMapper::ShowNoteL( aError ) ); |
|
3574 } |
|
3575 |
|
3576 |
|
3577 // -------------------------------------------------------------------------- |
|
3578 // CCASingleListContainer::OpenComplete |
|
3579 // -------------------------------------------------------------------------- |
|
3580 // |
|
3581 void CCASingleListContainer::OpenComplete( ) |
|
3582 { |
|
3583 TUint fetchFlags = 0; |
|
3584 //remove setflags if not required |
|
3585 TRAPD( err, ExecutePbkSingleEntryFetchL( TAiwSingleEntrySelectionDataV2(). |
|
3586 SetFetchFilter( iContactViewFilter ). |
|
3587 SetFlags( fetchFlags ) |
|
3588 ) ); |
|
3589 if ( err != KErrNone ) |
|
3590 { |
|
3591 TRAP_IGNORE( IMNoteMapper::ShowNoteL( err ) ); |
|
3592 } |
|
3593 } |
|
3594 |
|
3595 // -------------------------------------------------------------------------- |
|
3596 // CCASingleListContainer::StoreReady |
|
3597 // -------------------------------------------------------------------------- |
|
3598 // |
|
3599 void CCASingleListContainer::StoreReady( MVPbkContactStore& /*aContactStore*/ ) |
|
3600 { |
|
3601 iStoresOpened = ETrue; |
|
3602 } |
|
3603 |
|
3604 // -------------------------------------------------------------------------- |
|
3605 // CCASingleListContainer::StoreUnavailable |
|
3606 // -------------------------------------------------------------------------- |
|
3607 // |
|
3608 void CCASingleListContainer::StoreUnavailable |
|
3609 ( MVPbkContactStore& /*aContactStore*/, TInt /*aReason*/ ) |
|
3610 { |
|
3611 // Do nothing |
|
3612 } |
|
3613 |
|
3614 // -------------------------------------------------------------------------- |
|
3615 // CCASingleListContainer::HandleStoreEventL |
|
3616 // -------------------------------------------------------------------------- |
|
3617 // |
|
3618 void CCASingleListContainer::HandleStoreEventL( MVPbkContactStore& /*aContactStore*/, |
|
3619 TVPbkContactStoreEvent /*aStoreEvent*/ ) |
|
3620 { |
|
3621 // Do nothing |
|
3622 } |
|
3623 |
|
3624 // --------------------------------------------------------- |
|
3625 // CCASingleListView::HandleWatcherEvent |
|
3626 // @see MCAWatcherObserver |
|
3627 // --------------------------------------------------------- |
|
3628 void CCASingleListContainer::HandleWatcherEvent( const TDesC& aString, |
|
3629 TEnumsPC::TOnlineStatus aOnlineStatus ) |
|
3630 { |
|
3631 CHAT_DP_TXT( "UI received WATCHER EVENT!" ); |
|
3632 // We can't leave here so we have to ignore |
|
3633 // possible watcher event handling errors |
|
3634 TRAPD( err, DoHandleWatcherEventL( aString, aOnlineStatus ) ); |
|
3635 HandleError( err ); |
|
3636 } |
|
3637 |
|
3638 |
|
3639 // --------------------------------------------------------- |
|
3640 // CCASingleListContainer::DoHandleWatcherEventL() |
|
3641 // Handles watcher events |
|
3642 // @see MCAWatcherObserver for more information |
|
3643 // --------------------------------------------------------- |
|
3644 // |
|
3645 void CCASingleListContainer::DoHandleWatcherEventL( const TDesC& aString, |
|
3646 TEnumsPC::TOnlineStatus aOnlineStatus ) |
|
3647 { |
|
3648 |
|
3649 TInt globalSoftNoteId = -1; |
|
3650 |
|
3651 CHAT_DP_TXT( "CCASingleListContainer::DoHandleWatcherEventL - show note" ); |
|
3652 CAknGlobalNote* globalNote = CAknGlobalNote::NewLC(); |
|
3653 globalNote->SetSoftkeys( R_AVKON_SOFTKEYS_OK_EMPTY ); |
|
3654 HBufC* text = NULL; |
|
3655 |
|
3656 switch ( aOnlineStatus ) |
|
3657 { |
|
3658 case TEnumsPC::EUnknown: |
|
3659 { |
|
3660 return; |
|
3661 } |
|
3662 case TEnumsPC::EOnline: |
|
3663 { |
|
3664 text = StringLoader::LoadLC( R_CHAT_SNOTIF_WATCH_CHG_ON, aString ); |
|
3665 break; |
|
3666 } |
|
3667 case TEnumsPC::EInvisible: |
|
3668 { |
|
3669 break; |
|
3670 } |
|
3671 case TEnumsPC::EAway: |
|
3672 { |
|
3673 text = StringLoader::LoadLC( R_CHAT_SNOTIF_WATCH_CHG_AWAY, aString ); |
|
3674 break; |
|
3675 } |
|
3676 case TEnumsPC::EBusy: |
|
3677 { |
|
3678 text = StringLoader::LoadLC( R_CHAT_SNOTIF_WATCH_CHG_BUSY, aString ); |
|
3679 break; |
|
3680 } |
|
3681 default: |
|
3682 { |
|
3683 text = StringLoader::LoadLC( R_CHAT_SNOTIF_WATCH_CHG_OFF, aString ); |
|
3684 break; |
|
3685 } |
|
3686 } |
|
3687 |
|
3688 globalSoftNoteId = globalNote->ShowNoteL( EAknGlobalInformationNote, *text ); |
|
3689 CHAT_DP( D_CHAT_LIT( " **** note id %d **** " ), globalSoftNoteId ); |
|
3690 |
|
3691 //CodeScanner warning to be ignored |
|
3692 CleanupStack::PopAndDestroy( 2, globalNote ); |
|
3693 } |
|
3694 |
|
3695 |
|
3696 // --------------------------------------------------------- |
|
3697 // CCASingleListContainer::ShowInfoPopupL() |
|
3698 // --------------------------------------------------------- |
|
3699 // |
|
3700 void CCASingleListContainer::ShowInfoPopupL() |
|
3701 { |
|
3702 iInfoPopup->HideInfoPopupNote(); |
|
3703 |
|
3704 TInt index = CurrentListboxIndex(); |
|
3705 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( index ); |
|
3706 if ( itemType == TEnumsPC::EOwnStatusItem || itemType == TEnumsPC::EContactItem ) |
|
3707 { |
|
3708 const TDesC& statusText = iMainViewArrayPC->StatusText( index ); |
|
3709 TEnumsPC::TOnlineStatus status = iMainViewArrayPC->GetOnlineStatus( index ); |
|
3710 if ( ( status == TEnumsPC::EOnline || |
|
3711 status == TEnumsPC::EAway || |
|
3712 status == TEnumsPC::EBusy ) |
|
3713 && statusText.Length() > 0 && !iMainViewArrayPC->IsBlocked( index ) ) |
|
3714 { |
|
3715 iInfoPopup->SetTextL( statusText ); |
|
3716 iInfoPopup->ShowInfoPopupNote(); |
|
3717 } |
|
3718 } |
|
3719 } |
|
3720 // --------------------------------------------------------- |
|
3721 // CCASingleListContainer::ListFilter() |
|
3722 // --------------------------------------------------------- |
|
3723 // |
|
3724 CAknListBoxFilterItems* CCASingleListContainer::ListFilter() |
|
3725 { |
|
3726 return static_cast<CCAContactListBoxModel*>( iListBox->Model() )->Filter(); |
|
3727 } |
|
3728 |
|
3729 // --------------------------------------------------------- |
|
3730 // CCASingleListContainer::UpdateCbaL() |
|
3731 // Updates Softkeys according to current focus. |
|
3732 // --------------------------------------------------------- |
|
3733 // |
|
3734 void CCASingleListContainer::UpdateCbaL( TBool aUseDefaultCba /*= EFalse*/ ) |
|
3735 { |
|
3736 // If true, stop the cba update; otherwise go update cba |
|
3737 if ( iAppUi->GetStopUpdateCba() ) |
|
3738 return; |
|
3739 |
|
3740 TInt cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__EMPTY; |
|
3741 if ( !iCbaLock ) |
|
3742 { |
|
3743 TInt index = CurrentListboxIndex(); |
|
3744 if ( index < 0 || index > Count() ) |
|
3745 { |
|
3746 if ( iCba ) |
|
3747 { |
|
3748 iCba->SetCommandSetL( cbaRes ); |
|
3749 iCba->DrawNow(); |
|
3750 } |
|
3751 return; |
|
3752 } |
|
3753 |
|
3754 TPtrC contact = iMainViewArrayPC->GetItemNameText( index ); |
|
3755 TEnumsPC::TItem itemtype = iMainViewArrayPC->GetType( index ); |
|
3756 TBool updateinvalid( iLastFocusedItemType == TEnumsPC::EInvalid ); |
|
3757 if ( !iCba ) |
|
3758 { |
|
3759 iCba = CEikButtonGroupContainer::Current(); |
|
3760 } |
|
3761 |
|
3762 // default softkeys |
|
3763 if ( aUseDefaultCba || updateinvalid || itemtype == TEnumsPC::EContactListItem |
|
3764 || itemtype == TEnumsPC::EOpenChatsListItem ) |
|
3765 { |
|
3766 if ( aUseDefaultCba ) |
|
3767 { |
|
3768 iLastFocusedItemType = TEnumsPC::EOwnStatusItem; |
|
3769 } |
|
3770 else |
|
3771 { |
|
3772 iLastFocusedItemType = itemtype; |
|
3773 } |
|
3774 |
|
3775 if ( iCba ) |
|
3776 { |
|
3777 if ( itemtype == TEnumsPC::EOwnStatusItem ) |
|
3778 { |
|
3779 // Own status |
|
3780 // Options/Back/Change status |
|
3781 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__CHANGESTATUS; |
|
3782 } |
|
3783 |
|
3784 else if ( itemtype == TEnumsPC::EContactListItem ) |
|
3785 { |
|
3786 |
|
3787 #ifdef IMPS_CONTACT_FETCH_BACKGROUND |
|
3788 if ( iMainViewArrayPC->Synchronised( index ) == |
|
3789 TEnumsPC::ESyncFailed ) |
|
3790 { |
|
3791 // Failed list |
|
3792 // Options/Back/Fetch |
|
3793 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__FETCH; |
|
3794 } |
|
3795 else if ( iMainViewArrayPC->Synchronised( index ) == |
|
3796 TEnumsPC::ESyncNotDone ) |
|
3797 { |
|
3798 // Not yet synhronised |
|
3799 // Options/Back |
|
3800 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__EMPTY; |
|
3801 } |
|
3802 else |
|
3803 #endif // IMPS_CONTACT_FETCH_BACKGROUND |
|
3804 if ( iMainViewArrayPC->IsCollapsed( index ) |
|
3805 && !iMainViewArrayPC->IsForceExpanded() ) |
|
3806 { |
|
3807 // Collapsed |
|
3808 // Options/Back/Expand |
|
3809 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__EXPAND; |
|
3810 } |
|
3811 else |
|
3812 { |
|
3813 // Expanded |
|
3814 // Options/Back/Collapse |
|
3815 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__COLLAPSE; |
|
3816 } |
|
3817 } |
|
3818 else if ( itemtype == TEnumsPC::EOpenChatsListItem ) |
|
3819 { |
|
3820 if ( iMainViewArrayPC->IsCollapsed( index ) |
|
3821 && !iForceExpandChats ) |
|
3822 { |
|
3823 // Collapsed |
|
3824 // Options/Back/Expand |
|
3825 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__EXPAND; |
|
3826 } |
|
3827 else |
|
3828 { |
|
3829 // Expanded |
|
3830 // Options/Back/Collapse |
|
3831 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__COLLAPSE; |
|
3832 } |
|
3833 } |
|
3834 iCba->SetCommandSetL( cbaRes ); |
|
3835 iCba->DrawNow(); |
|
3836 } |
|
3837 } |
|
3838 |
|
3839 // collapse softkey ( when focus is on contact ) |
|
3840 else if ( updateinvalid || itemtype == TEnumsPC::EContactItem ) |
|
3841 { |
|
3842 iLastFocusedItemType = itemtype; |
|
3843 if ( iCba ) |
|
3844 { |
|
3845 // Options/Collapse/Chat |
|
3846 iCba->SetCommandSetL( R_CHAT_SOFTKEYS_OPTIONS_COLLAPSE__CHAT ); |
|
3847 iCba->DrawNow(); |
|
3848 } |
|
3849 } |
|
3850 // collapse softkey ( when focus is on ConversationItem ) |
|
3851 else if ( updateinvalid || itemtype == TEnumsPC::EConversationItem ) |
|
3852 { |
|
3853 iLastFocusedItemType = itemtype; |
|
3854 if ( iCba ) |
|
3855 { |
|
3856 // Options/Collapse/Chat |
|
3857 iCba->SetCommandSetL( R_CHAT_SOFTKEYS_OPTIONS_COLLAPSE__OPEN ); |
|
3858 iCba->DrawNow(); |
|
3859 } |
|
3860 } |
|
3861 // Focus on own contact item |
|
3862 else if ( updateinvalid || itemtype == TEnumsPC::EOwnStatusItem ) |
|
3863 { |
|
3864 iLastFocusedItemType = itemtype; |
|
3865 if ( iCba ) |
|
3866 { |
|
3867 iCba->SetCommandSetL( R_CHAT_SOFTKEYS_OPTIONS_EXIT__CHANGESTATUS ); |
|
3868 iCba->DrawNow(); |
|
3869 } |
|
3870 } |
|
3871 // Focus on invitation item |
|
3872 else if ( updateinvalid || itemtype == TEnumsPC::EInviteItem ) |
|
3873 { |
|
3874 iLastFocusedItemType = itemtype; |
|
3875 if ( iCba ) |
|
3876 { |
|
3877 iCba->SetCommandSetL( R_CHAT_SOFTKEYS_OPTIONS_COLLAPSE__OPENINVITATION ); |
|
3878 iCba->DrawNow(); |
|
3879 } |
|
3880 } |
|
3881 |
|
3882 // Focus on group item |
|
3883 else if ( updateinvalid || itemtype == TEnumsPC::EGroupItem ) |
|
3884 { |
|
3885 iLastFocusedItemType = itemtype; |
|
3886 if ( iCba ) |
|
3887 { |
|
3888 //check if group is joined or not n accordingly |
|
3889 //set msk as open or join |
|
3890 if ( IsJoinedToGroup() ) |
|
3891 { |
|
3892 iCba->SetCommandSetL( R_CHAT_SOFTKEYS_OPTIONS_COLLAPSE__OPENGROUP ); |
|
3893 } |
|
3894 else |
|
3895 { |
|
3896 iCba->SetCommandSetL( R_CHAT_SOFTKEYS_OPTIONS_COLLAPSE__JOINGROUP ); |
|
3897 } |
|
3898 iCba->DrawNow(); |
|
3899 } |
|
3900 } |
|
3901 |
|
3902 } |
|
3903 } |
|
3904 |
|
3905 // --------------------------------------------------------- |
|
3906 // CCASingleListContainer::DeleteSelfD |
|
3907 // (other items were commented in a header). |
|
3908 // --------------------------------------------------------- |
|
3909 // |
|
3910 void CCASingleListContainer::DeleteSelfD() |
|
3911 { |
|
3912 iDeleteFlag = ETrue; |
|
3913 |
|
3914 // if task is already completed -> delete immediately |
|
3915 if ( iTaskComplete ) |
|
3916 { |
|
3917 delete this; |
|
3918 } |
|
3919 } |
|
3920 // --------------------------------------------------------- |
|
3921 // CCASingleListContainer::IsChatsForceExpanded |
|
3922 // (other items were commented in a header). |
|
3923 // --------------------------------------------------------- |
|
3924 // |
|
3925 TBool CCASingleListContainer::IsChatsForceExpanded() |
|
3926 { |
|
3927 return iForceExpandChats; |
|
3928 } |
|
3929 // --------------------------------------------------------- |
|
3930 // CCASingleListContainer::HandleControlEventL |
|
3931 // --------------------------------------------------------- |
|
3932 // |
|
3933 void CCASingleListContainer::HandleControlEventL( CCoeControl* /*aControl*/, TCoeEvent aEventType ) |
|
3934 { |
|
3935 // We only observe iFindbox |
|
3936 if ( EEventStateChanged == aEventType ) |
|
3937 { |
|
3938 iCurrentState = iMainViewArrayPC->IsCollapsed( 1 ); |
|
3939 TBool forceExpand = EFalse; |
|
3940 iForceExpandChats = EFalse; |
|
3941 if ( iFindbox && iFindbox->TextLength() > 0 ) |
|
3942 { |
|
3943 // we have active search going on --> expand all contact lists |
|
3944 forceExpand = ETrue; |
|
3945 //Force expansion on the chats folder is done only if its collapsed. |
|
3946 if ( iCurrentState ) |
|
3947 { |
|
3948 iForceExpandChats = ETrue; |
|
3949 } |
|
3950 iPreviousState = iCurrentState; |
|
3951 } |
|
3952 iMainViewArrayPC->ForceExpanded( forceExpand ); |
|
3953 if ( iForceExpandChats ) |
|
3954 { |
|
3955 //expand the chats folder if it was collapsed. |
|
3956 iMainViewArrayPC->SetCollapsed( EFalse, 1 ); |
|
3957 iCurrentState = iMainViewArrayPC->IsCollapsed( 1 ); |
|
3958 } |
|
3959 |
|
3960 // set the chats folder to the previous state. |
|
3961 else if ( EFalse == iForceExpandChats && iPreviousState != iCurrentState ) |
|
3962 { |
|
3963 iMainViewArrayPC->SetCollapsed( EFalse, 1 ); |
|
3964 iPreviousState = iMainViewArrayPC->IsCollapsed( 1 ); |
|
3965 } |
|
3966 // Update filter |
|
3967 ( ( CAknFilteredTextListBoxModel* ) iListBox->Model() ) |
|
3968 ->Filter()->HandleOfferkeyEventL(); |
|
3969 UpdateFilterL(); |
|
3970 |
|
3971 } |
|
3972 } |
|
3973 |
|
3974 // --------------------------------------------------------- |
|
3975 // CCASingleListContainer::SetListboxIndexL |
|
3976 // (other items were commented in a header). |
|
3977 // --------------------------------------------------------- |
|
3978 // |
|
3979 void CCASingleListContainer::SetListboxIndexL( TInt aIndex ) |
|
3980 { |
|
3981 if ( iListBox ) |
|
3982 { |
|
3983 if ( aIndex < 0 || aIndex >= iListBox->Model()->NumberOfItems() ) |
|
3984 { |
|
3985 aIndex = 0; |
|
3986 } |
|
3987 |
|
3988 iListBox->SetCurrentItemIndexAndDraw( aIndex ); |
|
3989 |
|
3990 // If true, stop the cba update; otherwise go update cba |
|
3991 if ( iAppUi->GetStopUpdateCba() ) |
|
3992 return; |
|
3993 |
|
3994 //iCba = CEikButtonGroupContainer::Current(); |
|
3995 // Update softkeys |
|
3996 if ( iCba ) |
|
3997 { |
|
3998 TPtrC curitem = iMainViewArrayPC->GetItemNameText( aIndex ); |
|
3999 TEnumsPC::TItem itemtype = iMainViewArrayPC->GetType( aIndex ); |
|
4000 |
|
4001 TInt cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__EMPTY; |
|
4002 if ( itemtype == TEnumsPC::EOwnStatusItem ) |
|
4003 { |
|
4004 // Own status |
|
4005 // Options/Back/Change status |
|
4006 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__CHANGESTATUS; |
|
4007 } |
|
4008 else if ( itemtype == TEnumsPC::EContactListItem ) |
|
4009 { |
|
4010 // Contact list |
|
4011 #ifdef IMPS_CONTACT_FETCH_BACKGROUND |
|
4012 if ( iMainViewArrayPC->Synchronised( aIndex ) == |
|
4013 TEnumsPC::ESyncFailed ) |
|
4014 { |
|
4015 // Failed list |
|
4016 // Options/Back/Fetch |
|
4017 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__FETCH; |
|
4018 } |
|
4019 else if ( iMainViewArrayPC->Synchronised( aIndex ) == |
|
4020 TEnumsPC::ESyncNotDone ) |
|
4021 { |
|
4022 // Not yet synhronised |
|
4023 // Options/Back |
|
4024 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__EMPTY; |
|
4025 } |
|
4026 else |
|
4027 #endif // IMPS_CONTACT_FETCH_BACKGROUND |
|
4028 if ( iMainViewArrayPC->IsCollapsed( aIndex ) ) |
|
4029 { |
|
4030 // Collapsed |
|
4031 // Options/Back/Expand |
|
4032 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__EXPAND; |
|
4033 } |
|
4034 else |
|
4035 { |
|
4036 // Expanded |
|
4037 // Options/Back/Collapse |
|
4038 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__COLLAPSE; |
|
4039 } |
|
4040 } |
|
4041 |
|
4042 else if ( itemtype == TEnumsPC::EOpenChatsListItem ) |
|
4043 { |
|
4044 if ( iMainViewArrayPC->IsCollapsed( aIndex ) ) |
|
4045 { |
|
4046 // Collapsed |
|
4047 // Options/Back/Expand |
|
4048 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__EXPAND; |
|
4049 } |
|
4050 else |
|
4051 { |
|
4052 // Expanded |
|
4053 // Options/Back/Collapse |
|
4054 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_EXIT__COLLAPSE; |
|
4055 } |
|
4056 } |
|
4057 else if ( itemtype == TEnumsPC::EContactItem ) |
|
4058 { |
|
4059 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_COLLAPSE__CHAT; |
|
4060 } |
|
4061 |
|
4062 else if ( itemtype == TEnumsPC::EConversationItem ) |
|
4063 { |
|
4064 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_COLLAPSE__OPEN; |
|
4065 } |
|
4066 |
|
4067 else if ( itemtype == TEnumsPC::EInviteItem ) |
|
4068 { |
|
4069 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_COLLAPSE__OPENINVITATION; |
|
4070 } |
|
4071 else if ( itemtype == TEnumsPC::EGroupItem ) |
|
4072 { |
|
4073 //check if group is joined or not n accordingly |
|
4074 //set msk as open or join |
|
4075 if ( IsJoinedToGroup() ) |
|
4076 { |
|
4077 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_COLLAPSE__OPENGROUP; |
|
4078 } |
|
4079 else |
|
4080 { |
|
4081 cbaRes = R_CHAT_SOFTKEYS_OPTIONS_COLLAPSE__JOINGROUP; |
|
4082 } |
|
4083 } |
|
4084 |
|
4085 iCba->SetCommandSetL( cbaRes ); |
|
4086 iCba->DrawNow(); |
|
4087 } |
|
4088 } |
|
4089 } |
|
4090 |
|
4091 |
|
4092 // --------------------------------------------------------- |
|
4093 // CCASingleListContainer::HandleSettingsChangeL |
|
4094 // --------------------------------------------------------- |
|
4095 // |
|
4096 void CCASingleListContainer::HandleSettingsChangeL( TInt aChangedSettingEnum ) |
|
4097 { |
|
4098 CHAT_DP_FUNC_ENTER( "CCASingleListContainer::HandleSettingsChangeL" ); |
|
4099 |
|
4100 if ( ( aChangedSettingEnum != TEnumsPC::EShowOffline ) && |
|
4101 ( aChangedSettingEnum != TEnumsPC::EAutomaticPresenceUpdate ) ) |
|
4102 { |
|
4103 // it's not for us |
|
4104 CHAT_DP_FUNC_DP( "HandleSettingsChangeL", |
|
4105 "Got event but it was not for me" ); |
|
4106 return; |
|
4107 } |
|
4108 |
|
4109 MCASettingsPC* settings = iAppUi->GetProcessManager().GetSettingsInterface( ); |
|
4110 |
|
4111 if ( aChangedSettingEnum == TEnumsPC::EShowOffline ) |
|
4112 { |
|
4113 TEnumsPC::TCASettingValues newValue = ( TEnumsPC::TCASettingValues ) |
|
4114 settings->GetBoolValuePC( TEnumsPC::EShowOffline, NULL ); |
|
4115 |
|
4116 if ( newValue == iShowOffline ) |
|
4117 { |
|
4118 CHAT_DP_FUNC_DP( "HandleSettingsChangeL", |
|
4119 "Unchanged setting state for filter" ); |
|
4120 return; |
|
4121 } |
|
4122 TInt resValue = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_BLOCKING ); |
|
4123 if ( !newValue ) |
|
4124 { |
|
4125 iMyFilter = TEnumsPC::EFilterNonOffline; |
|
4126 iShowOffline = EFalse; |
|
4127 if ( resValue != 2 ) |
|
4128 { |
|
4129 iMyFilter = TEnumsPC::EFilterNonOfflineNonBlockedAndOperation; |
|
4130 } |
|
4131 } |
|
4132 else |
|
4133 { |
|
4134 iMyFilter = TEnumsPC::EFilterAll; |
|
4135 iShowOffline = ETrue; |
|
4136 if ( resValue != 2 ) |
|
4137 { |
|
4138 iMyFilter = TEnumsPC::EFilterAllNonBlockedAndOperation; |
|
4139 } |
|
4140 } |
|
4141 //// WVUi20 merged code as of wk45 14Nov,2006 |
|
4142 // Get current item |
|
4143 TCAItemDetails itemDetails; |
|
4144 TInt oldIndex = CurrentListboxIndex(); |
|
4145 itemDetails = iMainViewArrayPC->GetArrayItemIdDetails( oldIndex ); |
|
4146 |
|
4147 //Set the filter for engine's contact list model |
|
4148 iMainViewArrayPC->SetDefaultFilter( ( TEnumsPC::TFilterType )iMyFilter ); |
|
4149 iMainViewArrayPC->ResetDefaultFilter(); |
|
4150 //We DONT need a different filter for the list indicators. |
|
4151 //The value on ORing and Anding as below is 21 always |
|
4152 TEnumsPC::TFilterType singleListArrayFilter( TEnumsPC::EFilterNotDefined ); |
|
4153 if ( iMyFilter == TEnumsPC::EFilterNonOfflineNonBlockedAndOperation ) |
|
4154 { |
|
4155 singleListArrayFilter = TEnumsPC::EFilterNonOfflineNonBlockedNonOfflineOperation; |
|
4156 } |
|
4157 else |
|
4158 { |
|
4159 singleListArrayFilter = TEnumsPC::EFilterAllNonBlockedNonOfflineOperation; |
|
4160 } |
|
4161 |
|
4162 iMainViewArrayPC->ResetArray( EFalse ); |
|
4163 CCASingleListViewArray* singleListArray = |
|
4164 static_cast<CCASingleListViewArray*>( iListBox->Model()->ItemTextArray() ); |
|
4165 //Set the filter for single list array |
|
4166 iMainViewArrayPC->SetSingleListArrayFilter( ( TEnumsPC::TFilterType )singleListArrayFilter ); |
|
4167 |
|
4168 // Once the presence info is changed list box need to be updated, ex |
|
4169 // when the presence settings has changed from online to offline |
|
4170 UpdateFilterL(); |
|
4171 |
|
4172 // Set index correct |
|
4173 TInt index = KErrNotFound; |
|
4174 |
|
4175 TBool needSetCurrentItemIndex = ETrue; |
|
4176 |
|
4177 // Try to find item |
|
4178 if ( itemDetails.aItem == TEnumsPC::EContactListItem ) |
|
4179 { |
|
4180 index = iMainViewArrayPC->FindContactListIndexL( itemDetails.aListID ); |
|
4181 } |
|
4182 if ( itemDetails.aItem == TEnumsPC::EContactItem ) |
|
4183 { |
|
4184 index = iMainViewArrayPC->FindContactL( itemDetails.aListID, itemDetails.aItemID ); |
|
4185 } |
|
4186 if ( index == KErrNotFound ) |
|
4187 { |
|
4188 // Item was not found anymore, keep old index |
|
4189 TInt itemCount = iListBox->Model()->NumberOfItems(); |
|
4190 |
|
4191 if ( itemCount <= 0 ) |
|
4192 { |
|
4193 needSetCurrentItemIndex = EFalse; |
|
4194 } |
|
4195 else if ( oldIndex >= itemCount ) |
|
4196 { |
|
4197 // Check for overflow |
|
4198 index = itemCount - 1; |
|
4199 } |
|
4200 else if ( ( oldIndex >= 0 ) && ( oldIndex < itemCount ) ) |
|
4201 { |
|
4202 index = oldIndex; |
|
4203 } |
|
4204 else |
|
4205 { |
|
4206 index = 0; |
|
4207 } |
|
4208 } |
|
4209 |
|
4210 if ( needSetCurrentItemIndex ) |
|
4211 { |
|
4212 iListBox->SetCurrentItemIndex( index ); |
|
4213 } |
|
4214 } |
|
4215 |
|
4216 if ( aChangedSettingEnum == TEnumsPC::EAutomaticPresenceUpdate ) |
|
4217 { |
|
4218 // get the automatic presence update info |
|
4219 TBool newAutoUpdate = ( TBool ) |
|
4220 settings->GetBoolValuePC( TEnumsPC::EAutomaticPresenceUpdate, NULL ); |
|
4221 CCASingleListViewArray* friendsArray = |
|
4222 static_cast<CCASingleListViewArray*>( iListBox->Model()->ItemTextArray() ); |
|
4223 friendsArray->SetAutomaticRefresh( newAutoUpdate ); |
|
4224 } |
|
4225 |
|
4226 iListBox->DrawNow(); |
|
4227 } |
|
4228 // --------------------------------------------------------- |
|
4229 // CCASingleListContainer::HandleItemAdditionL |
|
4230 // --------------------------------------------------------- |
|
4231 // |
|
4232 void CCASingleListContainer::HandleItemAdditionL() |
|
4233 { |
|
4234 |
|
4235 iListBox->HandleItemAdditionL(); |
|
4236 |
|
4237 iListBox->DrawNow(); |
|
4238 } |
|
4239 |
|
4240 |
|
4241 // --------------------------------------------------------- |
|
4242 // CCASingleListContainer::OpenInvitationL() |
|
4243 // (other items were commented in a header). |
|
4244 // --------------------------------------------------------- |
|
4245 void CCASingleListContainer::OpenInvitationL( ) |
|
4246 |
|
4247 { |
|
4248 TInt index = CurrentListboxIndex(); |
|
4249 |
|
4250 // just to make sure |
|
4251 if ( iMainViewArrayPC->GetType( index ) != TEnumsPC::EInviteItem ) |
|
4252 { |
|
4253 User::Leave( KErrGeneral ); |
|
4254 } |
|
4255 |
|
4256 // Leave with KErrNotFound if there are no items. |
|
4257 if ( index == KErrNotFound ) |
|
4258 { |
|
4259 User::Leave( KErrNotFound ); |
|
4260 } |
|
4261 |
|
4262 MCAInvitationPC& invitePC( *iAppUi->GetProcessManager().GetInvitationsInterface() ); |
|
4263 |
|
4264 TCADnlInvView dnlInvView; |
|
4265 dnlInvView.iInvitationIndex = invitePC.FindInvitationIndex( |
|
4266 iMainViewArrayPC->GetInviteItemID( index ) ); |
|
4267 dnlInvView.iInviteID = iMainViewArrayPC->GetInviteItemID( index ); |
|
4268 dnlInvView.iSwitchTab = EFalse; |
|
4269 TCADnlInvViewBuf invMsgBuf( dnlInvView ); |
|
4270 |
|
4271 UpdateCbaL( ETrue ); |
|
4272 SetCbaLockL( ETrue ); |
|
4273 iViewSwitcher->SwitchViewL( KUidInvitationView, KUidInvViewMsgId, invMsgBuf ); |
|
4274 |
|
4275 } |
|
4276 |
|
4277 // ----------------------------------------------------------------------------- |
|
4278 // CCASingleListContainer::DeleteInvitationL |
|
4279 // (other items were commented in a header) |
|
4280 // ----------------------------------------------------------------------------- |
|
4281 // |
|
4282 void CCASingleListContainer::DeleteInvitationL() |
|
4283 { |
|
4284 TInt index = CurrentListboxIndex(); |
|
4285 // just to make sure |
|
4286 if ( iMainViewArrayPC->GetType( index ) != TEnumsPC::EInviteItem ) |
|
4287 { |
|
4288 User::Leave( KErrGeneral ); |
|
4289 } |
|
4290 |
|
4291 // display the query |
|
4292 HBufC* prompt = iEikonEnv->AllocReadResourceLC( R_CHAT_CONV_LIST_INV_DEL ); |
|
4293 TInt ret( IMDialogUtils::DisplayQueryDialogL( R_CLOSE_COVERSATION_QUERY, |
|
4294 *prompt ) ); |
|
4295 CleanupStack::PopAndDestroy( prompt ); |
|
4296 |
|
4297 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
4298 { |
|
4299 TInt invitationIndex = iMainViewArrayPC->GetItemEngineIndex( index ); |
|
4300 TInt indexOfList = iMainViewArrayPC->IndexOfList( index ); |
|
4301 TInt countOfContactsInList = iMainViewArrayPC->CountOfContactsInList( indexOfList ); |
|
4302 TPtrC inviteID( iMainViewArrayPC->GetInviteItemID( index ) ); |
|
4303 |
|
4304 iMainViewArrayPC->FindInvitationAndDelete( index/*invitationIndex*/ ); |
|
4305 //Deletion of a invitation requires the invitation to be deleted |
|
4306 //form mainviewarraypc and invitationpc |
|
4307 MCAInvitationPC& invitePC( *iAppUi->GetProcessManager().GetInvitationsInterface() ); |
|
4308 |
|
4309 invitePC.DeleteSingleListViewInvitationL( inviteID /*invitationIndex*/ ); |
|
4310 |
|
4311 |
|
4312 //Plus One because one contact has been deleted in the above |
|
4313 //deleteFromNetwork() call |
|
4314 if ( indexOfList + countOfContactsInList == index ) |
|
4315 { |
|
4316 iListBox->SetCurrentItemIndex( index - 1 ); |
|
4317 } |
|
4318 iListBox->HandleItemRemovalL(); |
|
4319 UpdateFilterL(); |
|
4320 } |
|
4321 } |
|
4322 |
|
4323 |
|
4324 // --------------------------------------------------------- |
|
4325 // CCASingleListContainer::CreateNewChatL() |
|
4326 // Creates new chat |
|
4327 // (other items were commented in a header). |
|
4328 // --------------------------------------------------------- |
|
4329 // |
|
4330 HBufC* CCASingleListContainer::CreateNewChatL() |
|
4331 { |
|
4332 // Ignore CBA update events so that user can't mess up the |
|
4333 // group creation operation |
|
4334 //iIgnoreCbaUpdateEvents = ETrue; |
|
4335 TInt currentIndex( CurrentListboxIndex() ); |
|
4336 if ( currentIndex == KErrNotFound ) |
|
4337 { |
|
4338 // listbox is empty |
|
4339 return NULL; |
|
4340 } |
|
4341 HBufC* group = NULL; |
|
4342 TEnumsPC::TListSelectionType selType( TEnumsPC::EMultiSelect ); |
|
4343 TBool isContactFound( EFalse ); |
|
4344 TBool inviteSupported( iAppUi->UISessionManager().IsSupported( CCAUISessionManager::EInvite ) ); |
|
4345 |
|
4346 if ( inviteSupported ) |
|
4347 { |
|
4348 |
|
4349 TEnumsPC::TItem itemtype = iMainViewArrayPC->GetType( currentIndex ); |
|
4350 MCASettingsPC* settings = iAppUi->GetProcessManager().GetSettingsInterface(); |
|
4351 TBool isShowOffline = settings->GetBoolValuePC( TEnumsPC::EShowOffline, NULL ); |
|
4352 TBool isSendMsgOffline = IMUtils::IntResourceValueL( |
|
4353 RSC_CHAT_VARIATION_SEND_MSG_IGNORE_OFFLINE_NOTIFY ) |
|
4354 || IMUtils::IntResourceValueL( |
|
4355 RSC_CHAT_VARIATION_SEND_MSG_IGNORE_OFFLINE ); |
|
4356 |
|
4357 TInt resValue = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_BLOCKING ); |
|
4358 TEnumsPC::TFilterType filter = TEnumsPC::EFilterNonOffline; |
|
4359 |
|
4360 if ( ( !isShowOffline || ( isShowOffline && !isSendMsgOffline ) ) ) |
|
4361 { |
|
4362 // offline contacts are not shown |
|
4363 filter = TEnumsPC::EFilterNonOffline; |
|
4364 if ( resValue != 2 ) |
|
4365 { |
|
4366 // offline and blocked contacts are not shown |
|
4367 filter = TEnumsPC::EFilterNonOfflineNonBlockedAndOperation; |
|
4368 } |
|
4369 } |
|
4370 else if ( isShowOffline && isSendMsgOffline ) |
|
4371 { |
|
4372 // online/offline/blocked contacts are shown |
|
4373 filter = TEnumsPC::EFilterAll; |
|
4374 if ( resValue != 2 ) |
|
4375 { |
|
4376 //only blocked contacts are hidden |
|
4377 filter = TEnumsPC::EFilterAllNonBlockedAndOperation; |
|
4378 } |
|
4379 } |
|
4380 |
|
4381 if ( itemtype == TEnumsPC::EContactListItem ) |
|
4382 { |
|
4383 selType = TEnumsPC::ESingleListMultiSelect; |
|
4384 TInt contactsCount = iMainViewArrayPC->GetFilteredCount( filter , currentIndex ); |
|
4385 isContactFound = contactsCount ? ETrue : EFalse; |
|
4386 |
|
4387 } |
|
4388 else |
|
4389 { |
|
4390 selType = TEnumsPC::EMultiSelect; |
|
4391 TInt count( iMainViewArrayPC->Count() ); |
|
4392 |
|
4393 for ( TInt index( 0 ); index < count && !isContactFound; index++ ) |
|
4394 { |
|
4395 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( index ); |
|
4396 if ( TEnumsPC::EContactListItem == itemType ) |
|
4397 { |
|
4398 if ( iMainViewArrayPC->GetFilteredCount( filter , index ) ) |
|
4399 { |
|
4400 isContactFound = ETrue; |
|
4401 } |
|
4402 } |
|
4403 } |
|
4404 } |
|
4405 } |
|
4406 |
|
4407 SetSkipStorageEvents( ETrue ); |
|
4408 |
|
4409 TRAP_IGNORE( group = iAppUi->GroupUtils()->CreateNewChatL( |
|
4410 R_CHATCLIENT_MAIN_VIEW_TITLE, KUidFriendsListView, |
|
4411 isContactFound, selType, currentIndex ) ); |
|
4412 CleanupStack::PushL( group ); |
|
4413 |
|
4414 SetSkipStorageEvents( EFalse ); |
|
4415 |
|
4416 iMainViewArrayPC->ResetArray( EFalse ); |
|
4417 iListBox->HandleItemAdditionL(); |
|
4418 TInt newIndex = CurrentListboxIndex(); |
|
4419 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( newIndex ); |
|
4420 UpdateViewL( currentIndex, itemType , ETrue ); |
|
4421 UpdateFilterL(); |
|
4422 |
|
4423 //iIgnoreCbaUpdateEvents = EFalse; |
|
4424 |
|
4425 // We should be joining a group so no need to update cba |
|
4426 CleanupStack::Pop(); |
|
4427 return group; |
|
4428 } |
|
4429 |
|
4430 // --------------------------------------------------------- |
|
4431 // CCASingleListContainer::JoinGroupL() |
|
4432 // Joins group |
|
4433 // (other items were commented in a header). |
|
4434 // --------------------------------------------------------- |
|
4435 // |
|
4436 void CCASingleListContainer::JoinGroupL( const TDesC& aGroupId ) |
|
4437 { |
|
4438 CHAT_DP_FUNC_ENTER( "JoinGroupL()" ); |
|
4439 //TInt index( CurrentListboxIndex() ); |
|
4440 //TPtrC userid = iMainViewArrayPC->GetSelectedContactUserId( index ); |
|
4441 |
|
4442 //Errors are handled in group utils |
|
4443 iAppUi->GroupUtils()->JoinGroupL( EFalse, aGroupId ); |
|
4444 } |
|
4445 |
|
4446 |
|
4447 // --------------------------------------------------------- |
|
4448 // CCASingleListContainer::IsJoinedToGroup() |
|
4449 // Checks if already joined to group |
|
4450 // (other items were commented in a header). |
|
4451 // --------------------------------------------------------- |
|
4452 // |
|
4453 TBool CCASingleListContainer::IsJoinedToGroup( ) |
|
4454 { |
|
4455 |
|
4456 TInt index( CurrentListboxIndex() ); |
|
4457 TPtrC groupid = iMainViewArrayPC->GetSelectedContactUserId( index ); |
|
4458 |
|
4459 //Errors are handled in group utils |
|
4460 return iAppUi->GroupUtils()->IsJoinedToGroup( groupid ); |
|
4461 } |
|
4462 |
|
4463 // --------------------------------------------------------- |
|
4464 // CCASingleListContainer::IsFavourite() |
|
4465 // Checks if indexed group is favourite |
|
4466 // (other items were commented in a header). |
|
4467 // --------------------------------------------------------- |
|
4468 // |
|
4469 TBool CCASingleListContainer::IsFavourite( ) |
|
4470 { |
|
4471 |
|
4472 TInt index( CurrentListboxIndex() ); |
|
4473 TPtrC groupId = iMainViewArrayPC->GetSelectedContactUserId( index ); |
|
4474 |
|
4475 //Errors are handled in group utils |
|
4476 return iAppUi->GroupUtils()->IsFavouriteChatGroup( groupId ); |
|
4477 } |
|
4478 |
|
4479 // --------------------------------------------------------- |
|
4480 // CCASingleListContainer::SaveAsFavouriteL() |
|
4481 // Saves as favourite |
|
4482 // (other items were commented in a header). |
|
4483 // --------------------------------------------------------- |
|
4484 // |
|
4485 void CCASingleListContainer::SaveAsFavouriteL() |
|
4486 { |
|
4487 TInt index( CurrentListboxIndex() ); |
|
4488 TPtrC groupid = iMainViewArrayPC->GetSelectedContactUserId( index ); |
|
4489 |
|
4490 iAppUi->GroupUtils()->SaveAsFavouriteL( groupid ); |
|
4491 UpdateFilterL(); |
|
4492 } |
|
4493 |
|
4494 // --------------------------------------------------------- |
|
4495 // CCASingleListContainer::DeleteGroupL() |
|
4496 // Deletes group |
|
4497 // (other items were commented in a header). |
|
4498 // --------------------------------------------------------- |
|
4499 // |
|
4500 void CCASingleListContainer::DeleteGroupL( TPtrC aGroupId ) |
|
4501 { |
|
4502 |
|
4503 //TInt index = CurrentListboxIndex(); |
|
4504 //TPtrC selectedGroupId = iMainViewArrayPC->GetSelectedContactUserId(index); |
|
4505 |
|
4506 TInt ret = iAppUi->GroupUtils()->DeleteGroupL( aGroupId ); |
|
4507 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
4508 { |
|
4509 UpdateCbaL(); |
|
4510 } |
|
4511 } |
|
4512 |
|
4513 // --------------------------------------------------------- |
|
4514 // CCASingleListContainer::LeaveGroupL() |
|
4515 // Leaves from group |
|
4516 // (other items were commented in a header). |
|
4517 // --------------------------------------------------------- |
|
4518 // |
|
4519 void CCASingleListContainer::LeaveGroupL() |
|
4520 { |
|
4521 TInt index = CurrentListboxIndex(); |
|
4522 |
|
4523 //once the group is deleted the userId returned will be deleted |
|
4524 //hence we store in a local buffer so that this can be used |
|
4525 //for later operations |
|
4526 TBuf<2 * KMaxWVIDLength> groupId; |
|
4527 |
|
4528 groupId.Copy( iMainViewArrayPC->GetSelectedContactUserId( index ).Left( |
|
4529 groupId.MaxLength() ) ); |
|
4530 |
|
4531 TInt err( KErrNone ); |
|
4532 |
|
4533 TInt indexOfList = iMainViewArrayPC->IndexOfList( index ); |
|
4534 TInt countOfContactsInList = iMainViewArrayPC->CountOfContactsInList( indexOfList ); |
|
4535 |
|
4536 TRAPD( leave, err = iAppUi->GroupUtils()->LeaveGroupL( groupId ) ); |
|
4537 |
|
4538 |
|
4539 if ( err != KErrNone || leave != KErrNone ) |
|
4540 { |
|
4541 IMNoteMapper::ShowNoteL( err ); |
|
4542 } |
|
4543 |
|
4544 // If the group is not owned or saved and it is the last item in the |
|
4545 // openchats folder.Then move the focus to openchatsfolder. |
|
4546 if ( indexOfList + countOfContactsInList == index && |
|
4547 !iAppUi->GroupUtils()->IsOwnGroup( groupId ) && |
|
4548 !iAppUi->GroupUtils()->IsFavouriteChatGroup( groupId ) ) |
|
4549 { |
|
4550 iListBox->SetCurrentItemIndex( index - 1 ); |
|
4551 } |
|
4552 // Deregister group from switch back views |
|
4553 iAppUi->DeRegisterSwitchBack( KUidChatView, groupId ); |
|
4554 UpdateCbaL(); |
|
4555 |
|
4556 } |
|
4557 |
|
4558 |
|
4559 // --------------------------------------------------------- |
|
4560 // CCASingleListContainer::DisplayJoinedMembersL() |
|
4561 // Displays joined members |
|
4562 // (other items were commented in a header). |
|
4563 // --------------------------------------------------------- |
|
4564 // |
|
4565 void CCASingleListContainer::DisplayJoinedMembersL() |
|
4566 { |
|
4567 |
|
4568 TInt index( CurrentListboxIndex() ); |
|
4569 TPtrC groupId = iMainViewArrayPC->GetSelectedContactUserId( index ); |
|
4570 iAppUi->GroupUtils()->DisplayJoinedMembersL( groupId ); |
|
4571 UpdateFilterL(); |
|
4572 } |
|
4573 |
|
4574 // --------------------------------------------------------- |
|
4575 // CCASingleListContainer::EditChatGroupPropertiesL() |
|
4576 // Launches chat group properties dialog |
|
4577 // (other items were commented in a header). |
|
4578 // --------------------------------------------------------- |
|
4579 // |
|
4580 void CCASingleListContainer::EditChatGroupPropertiesL() |
|
4581 { |
|
4582 TInt index( CurrentListboxIndex() ); |
|
4583 TPtrC groupId = iMainViewArrayPC->GetSelectedContactUserId( index ); |
|
4584 iAppUi->GroupUtils()->EditChatGroupPropertiesL( groupId ); |
|
4585 |
|
4586 UpdateFilterL(); |
|
4587 } |
|
4588 |
|
4589 |
|
4590 |
|
4591 // --------------------------------------------------------- |
|
4592 // CCASingleListContainer::DisplayChatInfoL() |
|
4593 // Displays chat info |
|
4594 // (other items were commented in a header). |
|
4595 // --------------------------------------------------------- |
|
4596 // |
|
4597 void CCASingleListContainer::DisplayChatInfoL() |
|
4598 { |
|
4599 TInt index( CurrentListboxIndex() ); |
|
4600 TPtrC groupId = iMainViewArrayPC->GetSelectedContactUserId( index ); |
|
4601 |
|
4602 iAppUi->GroupUtils()->DisplayChatInfoL( groupId ); |
|
4603 UpdateFilterL(); |
|
4604 } |
|
4605 |
|
4606 |
|
4607 // --------------------------------------------------------- |
|
4608 // CCASingleListContainer::IsUserAdmin() |
|
4609 // (other items were commented in a header). |
|
4610 // --------------------------------------------------------- |
|
4611 // |
|
4612 TBool CCASingleListContainer::IsUserAdmin() const |
|
4613 { |
|
4614 TInt index( CurrentListboxIndex() ); |
|
4615 TPtrC groupid = iMainViewArrayPC->GetSelectedContactUserId( index ); |
|
4616 |
|
4617 return ( iAppUi->GroupUtils()->IsAdmin( groupid ) || |
|
4618 iAppUi->GroupUtils()->IsOwnGroup( groupid ) ); |
|
4619 } |
|
4620 // --------------------------------------------------------- |
|
4621 // CCASingleListContainer::IsUserAdmin() |
|
4622 // (other items were commented in a header). |
|
4623 // --------------------------------------------------------- |
|
4624 // |
|
4625 TBool CCASingleListContainer::IsOwnGroup() const |
|
4626 { |
|
4627 TInt index( CurrentListboxIndex() ); |
|
4628 TPtrC groupId = iMainViewArrayPC->GetSelectedContactUserId( index ); |
|
4629 |
|
4630 return iAppUi->GroupUtils()->IsOwnGroup( groupId ); |
|
4631 } |
|
4632 |
|
4633 // --------------------------------------------------------- |
|
4634 // CCASingleListContainer::DisplayRecipientTextQueryForGrpIDL() |
|
4635 // (other items were commented in a header). |
|
4636 // --------------------------------------------------------- |
|
4637 // |
|
4638 void CCASingleListContainer::DisplayRecipientTextQueryForGrpIDL( TDes& aDataPtr ) |
|
4639 { |
|
4640 // Show domain selection query, if variated so |
|
4641 IMDialogUtils::TInitialSelectionMode selectionMode = |
|
4642 IMDialogUtils::ESelectAll; |
|
4643 |
|
4644 TBool domainSelection = |
|
4645 IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_DOMAIN_SELECTION ); |
|
4646 |
|
4647 if ( domainSelection ) |
|
4648 { |
|
4649 // Fill the user name with domain, if user selected it |
|
4650 TInt retVal = |
|
4651 iAppUi->UISessionManager().DisplayDomainSelectionQueryL( aDataPtr ); |
|
4652 if ( retVal == 0 ) |
|
4653 { |
|
4654 // User cancelled the procedure |
|
4655 // CleanupStack::PopAndDestroy( data ); |
|
4656 return; |
|
4657 } |
|
4658 else |
|
4659 { |
|
4660 selectionMode = IMDialogUtils::ESelectNone; |
|
4661 } |
|
4662 } |
|
4663 |
|
4664 TBool textualInputMode = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_USERID_TEXTUAL_INPUTMODE ); |
|
4665 TInt result( IMDialogUtils::DisplayTextQueryDialogL( aDataPtr, |
|
4666 R_CHATCLIENT_CHATLIST_ENTER_CHATGROUP, |
|
4667 textualInputMode ? |
|
4668 R_CHATCLIENT_SEARCH_WVID_QUERY : |
|
4669 R_CHATCLIENT_SEARCH_WVID_QUERY2 , |
|
4670 ETrue, // T9 |
|
4671 EFalse, // LSK visibility, visible when needed |
|
4672 IMDialogUtils::EDefault, // Left soft key |
|
4673 selectionMode, |
|
4674 domainSelection |
|
4675 ) ); |
|
4676 |
|
4677 if ( result == EAknSoftkeyOk || result == EAknSoftkeyDone ) |
|
4678 { |
|
4679 TInt errorCode = iAppUi->GroupUtils()->JoinGroupL( EFalse, aDataPtr, KNullDesC, NULL, CCAGroupUtils::EManualId ); |
|
4680 if ( errorCode != KErrNone ) |
|
4681 { |
|
4682 DisplayRecipientTextQueryForGrpIDL( aDataPtr ); |
|
4683 } |
|
4684 } |
|
4685 |
|
4686 } |
|
4687 |
|
4688 // --------------------------------------------------------- |
|
4689 // CCASingleListContainer::DisplayRecipientTextQueryL() |
|
4690 // (other items were commented in a header). |
|
4691 // --------------------------------------------------------- |
|
4692 // |
|
4693 void CCASingleListContainer::DisplayRecipientTextQueryL() |
|
4694 { |
|
4695 |
|
4696 |
|
4697 HBufC* data = HBufC::NewLC( KMaxWVIDLength ); |
|
4698 TPtr dataPtr( data->Des() ); |
|
4699 |
|
4700 // Show domain selection query, if variated so |
|
4701 IMDialogUtils::TInitialSelectionMode selectionMode = |
|
4702 IMDialogUtils::ESelectAll; |
|
4703 |
|
4704 TBool domainSelection = |
|
4705 IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_DOMAIN_SELECTION ); |
|
4706 |
|
4707 if ( domainSelection ) |
|
4708 { |
|
4709 // Fill the user name with domain, if user selected it |
|
4710 TInt retVal = |
|
4711 iAppUi->UISessionManager().DisplayDomainSelectionQueryL( dataPtr ); |
|
4712 if ( retVal == 0 ) |
|
4713 { |
|
4714 // User cancelled the procedure |
|
4715 CleanupStack::PopAndDestroy( data ); |
|
4716 return; |
|
4717 } |
|
4718 else |
|
4719 { |
|
4720 selectionMode = IMDialogUtils::ESelectNone; |
|
4721 } |
|
4722 } |
|
4723 |
|
4724 TBool textualInputMode = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_USERID_TEXTUAL_INPUTMODE ); |
|
4725 TInt result( IMDialogUtils::DisplayTextQueryDialogL( dataPtr, |
|
4726 R_CHATCLIENT_CONVLIST_ENTER_RECIP, |
|
4727 textualInputMode ? |
|
4728 R_CHATCLIENT_SEARCH_WVID_QUERY : |
|
4729 R_CHATCLIENT_SEARCH_WVID_QUERY2 , |
|
4730 ETrue, // T9 |
|
4731 EFalse, // LSK visibility, visible when needed |
|
4732 IMDialogUtils::EDefault, // Left soft key |
|
4733 selectionMode, |
|
4734 domainSelection |
|
4735 ) ); |
|
4736 |
|
4737 if ( result == EAknSoftkeyOk || result == EAknSoftkeyDone ) |
|
4738 |
|
4739 { |
|
4740 MCAConversationPC* ConversationPC = iAppUi->GetProcessManager().GetConversationInterface(); |
|
4741 |
|
4742 TRAPD( error, ConversationPC->SetMessageReadInterfaceL( *data ) ); |
|
4743 |
|
4744 |
|
4745 if ( error != KErrNone ) |
|
4746 { |
|
4747 HandleError( error ); |
|
4748 } |
|
4749 else |
|
4750 { |
|
4751 //Add the conversation item to open chats array before switching the view |
|
4752 iMainViewArrayPC->InsertConversationItemL( *data, KNullDesC ); |
|
4753 |
|
4754 SwitchToConvViewL( *data ); |
|
4755 } |
|
4756 } |
|
4757 else if ( result == EAknSoftkeyExit ) |
|
4758 { |
|
4759 // Editor cleared by user |
|
4760 DisplayRecipientTextQueryL(); |
|
4761 } |
|
4762 |
|
4763 CleanupStack::PopAndDestroy( data ); |
|
4764 |
|
4765 |
|
4766 } |
|
4767 |
|
4768 |
|
4769 // --------------------------------------------------------- |
|
4770 // CCASingleListContainer::SwitchToConvViewL() |
|
4771 // (other items were commented in a header). |
|
4772 // --------------------------------------------------------- |
|
4773 // |
|
4774 void CCASingleListContainer::SwitchToConvViewL( |
|
4775 const TDesC& aGroupId /*=KNullDesC*/ ) |
|
4776 { |
|
4777 TCADnlConvView dnlConView; |
|
4778 dnlConView.iIsForwarded = EFalse; |
|
4779 dnlConView.iSAPChanged = EFalse; |
|
4780 dnlConView.iSwitchTab = EFalse; |
|
4781 if ( aGroupId.Length() > 0 ) |
|
4782 { |
|
4783 //Store last known wvid |
|
4784 //iLastKnownWVID->Des() = aGroupId; |
|
4785 dnlConView.iWVID = aGroupId; |
|
4786 TCADnlConvViewBuf convMsgBuf( dnlConView ); |
|
4787 iViewSwitcher->SwitchViewL( KUidConversationsView, KUidConvViewMsgId, |
|
4788 convMsgBuf ); |
|
4789 } |
|
4790 } |
|
4791 |
|
4792 // --------------------------------------------------------- |
|
4793 // CCASingleListContainer::DisplayRecipientListQueryL() |
|
4794 // (other items were commented in a header). |
|
4795 // --------------------------------------------------------- |
|
4796 // |
|
4797 void CCASingleListContainer::DisplayRecipientListQueryL() |
|
4798 { |
|
4799 TInt itemIndex = CurrentListboxIndex(); |
|
4800 TEnumsPC::TItem itemIndexType = iMainViewArrayPC->GetType( itemIndex ); |
|
4801 //check if there is any contacts - If any only then call |
|
4802 //contact selection dialog. |
|
4803 TBool contactfound = EFalse; |
|
4804 TInt count( iMainViewArrayPC->Count() ); |
|
4805 |
|
4806 for ( TInt index( 0 ); index < count; index++ ) |
|
4807 { |
|
4808 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( index ); |
|
4809 if ( TEnumsPC::EContactListItem == itemType ) |
|
4810 { |
|
4811 if ( iMainViewArrayPC->CountOfContactsInList( index ) > 0 ) |
|
4812 { |
|
4813 contactfound = ETrue; |
|
4814 break; |
|
4815 } |
|
4816 } |
|
4817 } |
|
4818 |
|
4819 if ( !contactfound ) |
|
4820 { |
|
4821 IMDialogUtils::DisplayInformationNoteL( |
|
4822 R_QTN_CHAT_NO_CONTACTS_AVAILABLE ); |
|
4823 return; |
|
4824 } |
|
4825 |
|
4826 |
|
4827 MCASkinVariant* skinVar = static_cast<CCAApp*>( iAppUi->Application() ) |
|
4828 ->VariantFactory()->SkinVariantL(); |
|
4829 |
|
4830 CDesCArray* selectedContacts = new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); |
|
4831 CleanupStack::PushL( selectedContacts ); |
|
4832 |
|
4833 CDesCArray* selContactsIdentification = new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); |
|
4834 CleanupStack::PushL( selContactsIdentification ); |
|
4835 |
|
4836 SetSkipStorageEvents( ETrue ); |
|
4837 |
|
4838 // show selection dialog |
|
4839 if ( !CCAContactSelectionDialog::ShowDialogL( *selectedContacts, |
|
4840 *iAppUi->GetProcessManager().GetArrayInterface(), |
|
4841 *skinVar, |
|
4842 *iAppUi->GetProcessManager().GetSettingsInterface(), |
|
4843 iAppUi->MbmFullPath(), |
|
4844 TEnumsPC::EMultiSelect, |
|
4845 R_CONTACT_SELECTION_DIALOG, |
|
4846 *iViewSwitcher->CAStatusPane(), |
|
4847 selContactsIdentification ) ) |
|
4848 { |
|
4849 // no contacts |
|
4850 CleanupStack::PopAndDestroy( 2, selectedContacts ); // selectedContacts,selContactsIdentification |
|
4851 |
|
4852 SetSkipStorageEvents( EFalse ); |
|
4853 |
|
4854 iMainViewArrayPC->ResetArray( EFalse ); |
|
4855 iListBox->HandleItemAdditionL(); |
|
4856 UpdateViewL( itemIndex, itemIndexType , ETrue ); |
|
4857 UpdateFilterL(); |
|
4858 |
|
4859 return; |
|
4860 } |
|
4861 |
|
4862 SetSkipStorageEvents( EFalse ); |
|
4863 iMainViewArrayPC->ResetArray( EFalse ); |
|
4864 iListBox->HandleItemAdditionL(); |
|
4865 UpdateViewL( itemIndex, itemIndexType , ETrue ); |
|
4866 UpdateFilterL(); |
|
4867 |
|
4868 |
|
4869 TInt index = CurrentListboxIndex(); |
|
4870 TEnumsPC::TItem itemType = iMainViewArrayPC->GetType( index ); |
|
4871 if ( selectedContacts->MdcaCount() == 1 ) |
|
4872 { |
|
4873 TPtrC wvid( selectedContacts->MdcaPoint( 0 ) ); |
|
4874 //Add the conversation item to open chats array before switching the view |
|
4875 iMainViewArrayPC->InsertConversationItemL( wvid, selContactsIdentification->MdcaPoint( 0 ) ); |
|
4876 |
|
4877 SwitchToConvViewL( wvid ); |
|
4878 |
|
4879 } |
|
4880 else if ( selectedContacts->MdcaCount() > 1 ) |
|
4881 { |
|
4882 // get the message to be sent to the user |
|
4883 TInt msgLength = IMUtils::MaxMsgLength(); |
|
4884 HBufC* sendMessage = HBufC::NewLC( msgLength ); |
|
4885 TPtr sendMessagePtr( sendMessage->Des() ); |
|
4886 |
|
4887 CAknQueryDialog* dlg = CAknQueryDialog::NewL( sendMessagePtr ); |
|
4888 dlg->PrepareLC( R_CHATCLIENT_SEND_TEXT_QUERY ); |
|
4889 dlg->SetPredictiveTextInputPermitted( ETrue ); |
|
4890 TInt result( dlg->RunLD() ); |
|
4891 |
|
4892 if ( ( result == EAknSoftkeyOk ) || ( result == EAknSoftkeyYes ) ) |
|
4893 { |
|
4894 MCAConversationPC* ConversationPC = iAppUi->GetProcessManager().GetConversationInterface(); |
|
4895 ConversationPC->SetMessageWriteInterfaceL(); |
|
4896 for ( TInt i = 0; i < selectedContacts->MdcaCount(); i++ ) |
|
4897 { |
|
4898 TPtrC wvid( selectedContacts->MdcaPoint( i ) ); |
|
4899 CHAT_DP( D_CHAT_LIT( "starting conversation with %S" ), &wvid ); |
|
4900 |
|
4901 ConversationPC->SetMessageReadInterfaceL( wvid ); |
|
4902 |
|
4903 //Add the conversation item to open chats array before switching the view |
|
4904 iMainViewArrayPC->InsertConversationItemL( wvid, selContactsIdentification->MdcaPoint( i ) ); |
|
4905 |
|
4906 |
|
4907 ConversationPC->SendMessageL( sendMessagePtr ) ; |
|
4908 |
|
4909 |
|
4910 } |
|
4911 // after creating multiple conversation |
|
4912 // focus the 1st open conversation in chat folder |
|
4913 TBool collapsed( iMainViewArrayPC->IsCollapsed( index ) ); |
|
4914 |
|
4915 if ( itemType == TEnumsPC::EOpenChatsListItem ) |
|
4916 { |
|
4917 // focus is on open chat folder, now focus 1st conversation item |
|
4918 if ( collapsed ) |
|
4919 { |
|
4920 // not expanded ,expand now |
|
4921 ExpandCollapseListL(); |
|
4922 } |
|
4923 iListBox->SetCurrentItemIndex( index + 1 ); |
|
4924 iListBox->DrawNow(); |
|
4925 } |
|
4926 else if ( itemType == TEnumsPC::EOwnStatusItem ) |
|
4927 { |
|
4928 // focus is on own data item, now focus 1st conversation item |
|
4929 // set index to open chat folder |
|
4930 iListBox->SetCurrentItemIndex( index + 1 ); |
|
4931 TInt curIndex = iListBox->CurrentItemIndex(); |
|
4932 //check open chat folder is expanded or not |
|
4933 collapsed = iMainViewArrayPC->IsCollapsed( curIndex ); |
|
4934 if ( collapsed ) |
|
4935 { |
|
4936 // not expanded ,expand now |
|
4937 ExpandCollapseListL(); |
|
4938 } |
|
4939 // expanded ,focus 1st item in open chat folder |
|
4940 iListBox->SetCurrentItemIndex( curIndex + 1 ); |
|
4941 iListBox->DrawNow(); |
|
4942 } |
|
4943 } |
|
4944 CleanupStack::PopAndDestroy( sendMessage ); |
|
4945 } |
|
4946 |
|
4947 CleanupStack::PopAndDestroy( 2, selectedContacts ); // selectedContacts,selContactsIdentification |
|
4948 |
|
4949 } |
|
4950 |
|
4951 // --------------------------------------------------------- |
|
4952 // CCASingleListContainer::HandleServerChangeL |
|
4953 // (other items were commented in a header). |
|
4954 // --------------------------------------------------------- |
|
4955 // |
|
4956 |
|
4957 void CCASingleListContainer::HandleServerChangeL ( TServerNotify aKey ) |
|
4958 { |
|
4959 if ( aKey == MCAServerChangeNotify::ENoServer ) |
|
4960 { |
|
4961 HBufC* emptyTxtBuf = IMUtils::CombineStringFromResourceLC( |
|
4962 R_QTN_CHAT_EMPTY_COMMUNITY_VIEW_PRIMARY, |
|
4963 R_QTN_CHAT_EMPTY_COMMUNITY_VIEW ); |
|
4964 ListBox()->View()->SetListEmptyTextL( *emptyTxtBuf ); |
|
4965 CleanupStack::PopAndDestroy( emptyTxtBuf ); |
|
4966 |
|
4967 UpdateCbaL(); |
|
4968 } |
|
4969 |
|
4970 if ( aKey == MCAServerChangeNotify::EOtherChange ) |
|
4971 { |
|
4972 HBufC* emptyTxtBuf = IMUtils::CombineStringFromResourceLC( |
|
4973 R_QTN_CHAT_EMPTY_COMMUNITY_VIEW_NOT_VISIBLE_PRIMARY, |
|
4974 R_QTN_CHAT_EMPTY_COMMUNITY_VIEW_NOT_VISIBLE ); |
|
4975 ListBox()->View()->SetListEmptyTextL( *emptyTxtBuf ); |
|
4976 CleanupStack::PopAndDestroy( emptyTxtBuf ); |
|
4977 |
|
4978 if ( iFindbox && iListBox->Model()->NumberOfItems() <= 0 ) |
|
4979 { |
|
4980 DeactivateFindPaneL(); |
|
4981 } |
|
4982 SizeChanged(); |
|
4983 } |
|
4984 } |
|
4985 |
|
4986 // --------------------------------------------------------- |
|
4987 // CCASingleListContainer::IsBckGrdTaskComplete |
|
4988 // (other items were commented in a header). |
|
4989 // --------------------------------------------------------- |
|
4990 // |
|
4991 |
|
4992 TBool CCASingleListContainer::IsBckGrdTaskComplete ( ) |
|
4993 { |
|
4994 return iTaskComplete; |
|
4995 } |
|
4996 |
|
4997 // End of File |