63
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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:
|
|
15 |
* Abstract base class for recent views
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
|
|
22 |
// System includes
|
|
23 |
#include <eikmenub.h>
|
|
24 |
#include <AknQueryDialog.h>
|
|
25 |
#include <aknnotewrappers.h>
|
|
26 |
#include <baclipb.h>
|
|
27 |
#include <StringLoader.h>
|
|
28 |
#include <CMessageData.h>
|
|
29 |
#include <sendui.h>
|
|
30 |
#include <SendUiConsts.h>
|
|
31 |
#include <TSendingCapabilities.h>
|
|
32 |
#include <Sendnorm.rsg>
|
|
33 |
#include <Logs.rsg>
|
|
34 |
#include <AiwCommon.hrh> //KAiwCmdCall
|
|
35 |
#include <AiwPoCParameters.h> //TAiwPocParameterData
|
|
36 |
#include <aknViewAppUi.h>
|
|
37 |
#include <AiwServiceHandler.h>
|
|
38 |
#include <AiwGenericParam.h>
|
|
39 |
#include <StringLoader.h>
|
|
40 |
#include <aknnotewrappers.h>
|
|
41 |
#include <AknGlobalNote.h>
|
|
42 |
#include <AknGlobalConfirmationQuery.h>
|
|
43 |
#include <MGFetch.h>
|
|
44 |
#include <AiwContactSelectionDataTypes.h>
|
|
45 |
#include <AiwContactAssignDataTypes.h>
|
|
46 |
|
|
47 |
// Virtual Phonebook
|
|
48 |
#include <RVPbkContactFieldDefaultPriorities.h>
|
|
49 |
#include <VPbkFieldType.hrh>
|
|
50 |
#include <TVPbkContactStoreUriPtr.h>
|
|
51 |
#include <CVPbkContactStoreUriArray.h>
|
|
52 |
#include <MVPbkContactStoreList.h>
|
|
53 |
#include <CVPbkContactManager.h>
|
|
54 |
#include <CVPbkFieldTypeSelector.h>
|
|
55 |
#include <CVPbkContactLinkArray.h>
|
|
56 |
#include <VPbkContactStoreUris.h>
|
|
57 |
#include <VPbkContactViewFilterBuilder.h>
|
|
58 |
//------------------------
|
|
59 |
|
|
60 |
#include "CLogsRecentListView.h"
|
|
61 |
#include "CLogsRecentListControlContainer.h"
|
|
62 |
#include "CLogsEngine.h"
|
|
63 |
#include "MLogsEventGetter.h"
|
|
64 |
#include "MLogsClearLog.h"
|
|
65 |
#include "MLogsStateHolder.h"
|
|
66 |
#include "MLogsSharedData.h"
|
|
67 |
#include "CLogsAppUi.h"
|
|
68 |
#include "LogsUID.h"
|
|
69 |
#include "CLogsViewGlobals.h"
|
|
70 |
#include "MLogsExtensionFactory.h"
|
|
71 |
#include "MLogsViewExtension.h"
|
|
72 |
#include "MLogsSystemAgent.h"
|
|
73 |
#include "MLogsUiControlExtension.h"
|
|
74 |
#include "LogsConstants.hrh"
|
|
75 |
#include "CLogsPrependQuery.h"
|
|
76 |
|
|
77 |
#include "LogsDebug.h"
|
|
78 |
#include "LogsTraces.h"
|
|
79 |
|
|
80 |
// EXTERNAL DATA STRUCTURES
|
|
81 |
|
|
82 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
83 |
|
|
84 |
// CONSTANTS
|
|
85 |
|
|
86 |
// Panic string
|
|
87 |
_LIT( KStmRecentView, "StmRecentView" );
|
|
88 |
|
|
89 |
// MACROS
|
|
90 |
|
|
91 |
|
|
92 |
// LOCAL CONSTANTS AND MACROS
|
|
93 |
|
|
94 |
// MODULE DATA STRUCTURES
|
|
95 |
|
|
96 |
// LOCAL FUNCTION PROTOTYPES
|
|
97 |
|
|
98 |
// ================= MEMBER FUNCTIONS =======================
|
|
99 |
|
|
100 |
// ----------------------------------------------------------------------------
|
|
101 |
// CLogsRecentListView::NewL
|
|
102 |
// ----------------------------------------------------------------------------
|
|
103 |
//
|
|
104 |
CLogsRecentListView* CLogsRecentListView::NewL( TLogsModel aModel )
|
|
105 |
{
|
|
106 |
CLogsRecentListView* self = new ( ELeave ) CLogsRecentListView( aModel );
|
|
107 |
CleanupStack::PushL( self );
|
|
108 |
self->ConstructL();
|
|
109 |
CleanupStack::Pop( self ); // self
|
|
110 |
return self;
|
|
111 |
}
|
|
112 |
|
|
113 |
// ----------------------------------------------------------------------------
|
|
114 |
// CLogsRecentListView::CLogsRecentListView
|
|
115 |
// ----------------------------------------------------------------------------
|
|
116 |
//
|
|
117 |
CLogsRecentListView::CLogsRecentListView( TLogsModel aModel ) :
|
|
118 |
iState( EStateUndefined ),
|
|
119 |
iViewExtension( NULL ),
|
|
120 |
iEventListCurrentNoChange( KErrNotFound ) //iEventListCurrentNoChange switched off
|
|
121 |
{
|
|
122 |
iModel = aModel;
|
|
123 |
}
|
|
124 |
|
|
125 |
// ----------------------------------------------------------------------------
|
|
126 |
// CLogsRecentListView::~CLogsRecentListView
|
|
127 |
// ----------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
CLogsRecentListView::~CLogsRecentListView()
|
|
130 |
{
|
|
131 |
delete iExitCbaButton;
|
|
132 |
delete iBackCbaButton;
|
|
133 |
iCoeEnv->RemoveForegroundObserver( *this );
|
|
134 |
|
|
135 |
Release( iViewExtension );
|
|
136 |
Release( iViewGlobal );
|
|
137 |
}
|
|
138 |
|
|
139 |
// ----------------------------------------------------------------------------
|
|
140 |
// CLogsRecentListView::ConstructL
|
|
141 |
// ----------------------------------------------------------------------------
|
|
142 |
//
|
|
143 |
void CLogsRecentListView::ConstructL()
|
|
144 |
{
|
|
145 |
BaseConstructL( R_STM_COMMON_VIEW );
|
|
146 |
iCoeEnv->AddForegroundObserverL( *this );
|
|
147 |
iExitCbaButton = iCoeEnv->AllocReadResourceL( R_STM_EXIT_CBA_BUTTON );
|
|
148 |
iBackCbaButton = iCoeEnv->AllocReadResourceL( R_STM_BACK_CBA_BUTTON );
|
|
149 |
iViewGlobal = CLogsViewGlobals::InstanceL();
|
|
150 |
|
|
151 |
// Safwish VoIP changes >>>
|
|
152 |
if ( !iViewExtension )
|
|
153 |
{
|
|
154 |
CPbkContactEngine* nullContactEngine = NULL;
|
|
155 |
iViewExtension = iViewGlobal->ExtensionFactoryL().
|
|
156 |
CreateLogsViewExtensionL( *nullContactEngine, this );
|
|
157 |
|
|
158 |
iViewExtension->SetSendUi( *LogsAppUi()->SendUiL() );
|
|
159 |
iViewExtension->SetSendUiText( SendUiTextL() );
|
|
160 |
}
|
|
161 |
// <<< Safwish VoIP changes
|
|
162 |
}
|
|
163 |
|
|
164 |
// ----------------------------------------------------------------------------
|
|
165 |
// CLogsRecentListView::LogsCurrentRecentViewId
|
|
166 |
// ----------------------------------------------------------------------------
|
|
167 |
//
|
|
168 |
TLogsViewIds CLogsRecentListView::LogsCurrentRecentViewId() const
|
|
169 |
{
|
|
170 |
switch( iModel )
|
|
171 |
{
|
|
172 |
case ELogsReceivedModel:
|
|
173 |
return EStmReceivedListViewId;
|
|
174 |
case ELogsDialledModel:
|
|
175 |
return EStmDialledListViewId;
|
|
176 |
case ELogsMissedModel:
|
|
177 |
return EStmMissedListViewId;
|
|
178 |
default:
|
|
179 |
User::Panic( KStmRecentView, KErrUnknown );
|
|
180 |
return ELogsDummyViewId; // just to compile without error
|
|
181 |
//break;
|
|
182 |
}
|
|
183 |
}
|
|
184 |
|
|
185 |
|
|
186 |
// ----------------------------------------------------------------------------
|
|
187 |
// CLogsRecentListView::Id
|
|
188 |
// ----------------------------------------------------------------------------
|
|
189 |
//
|
|
190 |
TUid CLogsRecentListView::Id() const
|
|
191 |
{
|
|
192 |
return TUid::Uid( LogsCurrentRecentViewId() );
|
|
193 |
}
|
|
194 |
|
|
195 |
// ----------------------------------------------------------------------------
|
|
196 |
// CLogsRecentListView::RecentListType
|
|
197 |
// ----------------------------------------------------------------------------
|
|
198 |
//
|
|
199 |
TLogsModel CLogsRecentListView::RecentListType() const
|
|
200 |
{
|
|
201 |
return iModel;
|
|
202 |
}
|
|
203 |
|
|
204 |
// ----------------------------------------------------------------------------
|
|
205 |
// CLogsRecentListView::ProcessKeyEventL
|
|
206 |
//
|
|
207 |
// Called by base control container when a key press happens.
|
|
208 |
// ----------------------------------------------------------------------------
|
|
209 |
//
|
|
210 |
TBool CLogsRecentListView::ProcessKeyEventL(
|
|
211 |
const TKeyEvent& aKeyEvent,
|
|
212 |
TEventCode aType )
|
|
213 |
{
|
|
214 |
if( MenuBar()->ItemSpecificCommandsEnabled() && aType == EEventKey )
|
|
215 |
{
|
|
216 |
if( aKeyEvent.iCode == EKeyBackspace )
|
|
217 |
{
|
|
218 |
HandleCommandL( ELogsCmdMenuDelete );
|
|
219 |
return ETrue;
|
|
220 |
}
|
|
221 |
}
|
|
222 |
|
|
223 |
const MLogsEventGetter* event( CurrentEvent() );
|
|
224 |
|
|
225 |
//FIXME (CLogsRecentListView and CLogsEventListView):
|
|
226 |
//The below is needed only because we get key event before the actual row
|
|
227 |
//is changed in the listbox. If/when listbox observer for changed row focus
|
|
228 |
//is available, remove code below and get correct event index from observer.
|
|
229 |
SetEventListCurrent(iContainer->ListBox()->CurrentItemIndex());
|
|
230 |
|
|
231 |
if( aType == EEventKey && EventListCurrent() != KErrNotFound )
|
|
232 |
{
|
|
233 |
TInt count( CurrentModel()->Count() );
|
|
234 |
switch (aKeyEvent.iScanCode)
|
|
235 |
{
|
|
236 |
case EStdKeyUpArrow:
|
|
237 |
//Set iEventListCurrent + jump to previous or last event depending on position in list
|
|
238 |
iEventListCurrent > 0 ? event = CurrentModel()->At( --iEventListCurrent ) :
|
|
239 |
event = CurrentModel()->At( iEventListCurrent = count - 1 );
|
|
240 |
break;
|
|
241 |
|
|
242 |
case EStdKeyDownArrow:
|
|
243 |
//Set iEventListCurrent + jump to next or first event depending on position in list
|
|
244 |
iEventListCurrent < count - 1 ? event = CurrentModel()->At( ++iEventListCurrent ) :
|
|
245 |
event = CurrentModel()->At( iEventListCurrent = 0 );
|
|
246 |
break;
|
|
247 |
}
|
|
248 |
}
|
|
249 |
|
|
250 |
|
|
251 |
return CLogsBaseView::ProcessKeyEventEventL( aKeyEvent,aType, event );
|
|
252 |
}
|
|
253 |
|
|
254 |
// ----------------------------------------------------------------------------
|
|
255 |
// CLogsRecentListView::ProcessPointerEventL
|
|
256 |
//
|
|
257 |
// Handler for pointer events, when the current focused item is tapped
|
|
258 |
// ----------------------------------------------------------------------------
|
|
259 |
//
|
|
260 |
void CLogsRecentListView::ProcessPointerEventL( TInt /* aIndex */ )
|
|
261 |
{
|
|
262 |
// Open the context sensitive menu
|
|
263 |
ProcessCommandL( EAknSoftkeyContextOptions );
|
|
264 |
}
|
|
265 |
|
|
266 |
// ----------------------------------------------------------------------------
|
|
267 |
// CLogsRecentListView::HandleCommandL
|
|
268 |
// ----------------------------------------------------------------------------
|
|
269 |
//
|
|
270 |
void CLogsRecentListView::HandleCommandL( TInt aCommandId )
|
|
271 |
{
|
|
272 |
TRACE_ENTRY_POINT;
|
|
273 |
|
|
274 |
// Safwish VoIP changes >>>
|
|
275 |
//1. Process first the commands that may be in range interested by PECLogs exension
|
|
276 |
if ( iViewExtension->HandleCommandL( aCommandId ) )
|
|
277 |
{
|
|
278 |
return;
|
|
279 |
}
|
|
280 |
// <<< Safwish VoIP changes
|
|
281 |
|
|
282 |
//2. Was not a command in range intended for extension. Continue processing.
|
|
283 |
const MLogsEventGetter* event = CurrentEvent();
|
|
284 |
|
|
285 |
switch( aCommandId )
|
|
286 |
{
|
|
287 |
case ELogsCmdMenuDeleteAll:
|
|
288 |
CmdClearRecentListL();
|
|
289 |
break;
|
|
290 |
|
|
291 |
case ELogsCmdMenuDelete:
|
|
292 |
CmdDeleteEventL();
|
|
293 |
break;
|
|
294 |
|
|
295 |
case ELogsCmdHandleMSK:
|
|
296 |
{
|
|
297 |
// If single click or press MSK for a log event,
|
|
298 |
// it will request directly by AiwSrvCmd.
|
|
299 |
aCommandId = ELogsCmdSingleTapCall;
|
|
300 |
} // Fall through
|
|
301 |
|
|
302 |
default:
|
|
303 |
{
|
|
304 |
CLogsBaseView::HandleCommandEventL( aCommandId, event );
|
|
305 |
}
|
|
306 |
}
|
|
307 |
|
|
308 |
TRACE_EXIT_POINT;
|
|
309 |
}
|
|
310 |
|
|
311 |
// ----------------------------------------------------------------------------
|
|
312 |
// CLogsRecentListView::ChangeTitlePaneTextToDefaultL
|
|
313 |
// ----------------------------------------------------------------------------
|
|
314 |
//
|
|
315 |
void CLogsRecentListView::ChangeTitlePaneTextToDefaultL()
|
|
316 |
{
|
|
317 |
iContainer->SetTitlePaneTextToDefaultL( LogsAppUi()->ActiveViewId() );
|
|
318 |
}
|
|
319 |
|
|
320 |
// ----------------------------------------------------------------------------
|
|
321 |
// CLogsRecentListView::ProcessCommandL
|
|
322 |
//
|
|
323 |
// Called from FW when e.g. cba pressed
|
|
324 |
// ----------------------------------------------------------------------------
|
|
325 |
//
|
|
326 |
void CLogsRecentListView::ProcessCommandL( TInt aCommand )
|
|
327 |
{
|
|
328 |
TRACE_ENTRY_POINT;
|
|
329 |
|
|
330 |
if (LogsAppUi()->ActiveViewId() != LogsCurrentRecentViewId() || !iContainer )
|
|
331 |
{
|
|
332 |
LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
|
|
333 |
( "CLogsRecentListView::ProcessCommandL - view already deactivated! return " ));
|
|
334 |
return;
|
|
335 |
}
|
|
336 |
|
|
337 |
if (aCommand == EAknSoftkeyOptions)
|
|
338 |
{
|
|
339 |
// If options menu is opened call SetRefreshMenuOnUpdate which records the current event id
|
|
340 |
// which can then be used to make a decision on wether options menu needs to be refreshed
|
|
341 |
// when reading is finished.
|
|
342 |
SetRefreshMenuOnUpdate( CurrentEvent() );
|
|
343 |
}
|
|
344 |
|
|
345 |
CLogsBaseView::ProcessCommandL( aCommand );
|
|
346 |
|
|
347 |
TRACE_EXIT_POINT;
|
|
348 |
}
|
|
349 |
|
|
350 |
// ----------------------------------------------------------------------------
|
|
351 |
// CLogsRecentListView::DynInitMenuPaneL
|
|
352 |
// ----------------------------------------------------------------------------
|
|
353 |
//
|
|
354 |
void CLogsRecentListView::DynInitMenuPaneL(
|
|
355 |
TInt aResourceId,
|
|
356 |
CEikMenuPane* aMenuPane )
|
|
357 |
{
|
|
358 |
//Get event. Note that event may NOT yet be available if asynch request(s) are not completed.
|
|
359 |
const MLogsEventGetter* event = CurrentEvent(); //returns NULL if no data yet available
|
|
360 |
CLogsBaseView::DynInitMenuPaneEventL( aResourceId, aMenuPane, event );
|
|
361 |
|
|
362 |
// Sawfish VoIP changes >>>
|
|
363 |
iViewExtension->DynInitMenuPaneL( aResourceId, aMenuPane, event );
|
|
364 |
// <<< Sawfish VoIP changes
|
|
365 |
|
|
366 |
}
|
|
367 |
|
|
368 |
|
|
369 |
// ----------------------------------------------------------------------------
|
|
370 |
// CLogsRecentListView::HandleClientRectChange
|
|
371 |
// ----------------------------------------------------------------------------
|
|
372 |
//
|
|
373 |
void CLogsRecentListView::HandleClientRectChange()
|
|
374 |
{
|
|
375 |
if (iContainer)
|
|
376 |
{
|
|
377 |
iContainer->SetRect( ClientRect() );
|
|
378 |
}
|
|
379 |
}
|
|
380 |
|
|
381 |
// ----------------------------------------------------------------------------
|
|
382 |
// CLogsRecentListView::DrawComponents
|
|
383 |
// ----------------------------------------------------------------------------
|
|
384 |
//
|
|
385 |
void CLogsRecentListView::DrawComponents()
|
|
386 |
{
|
|
387 |
if (iContainer)
|
|
388 |
{
|
|
389 |
iContainer->DrawNow();
|
|
390 |
}
|
|
391 |
}
|
|
392 |
|
|
393 |
// ----------------------------------------------------------------------------
|
|
394 |
// CLogsRecentListView::ViewDeactivated
|
|
395 |
//
|
|
396 |
// This is called by framework when really losing foreground but not when losing foreground to some note etc.
|
|
397 |
// Also called by framework when switching views inside application.
|
|
398 |
// So DoDeactivate is not always called when ViewDeactivated is called.
|
|
399 |
//
|
|
400 |
// Note: there is no guarenteed order of which is called first ViewDeactivated or HandleLosingForeground
|
|
401 |
//
|
|
402 |
// ----------------------------------------------------------------------------
|
|
403 |
//
|
|
404 |
void CLogsRecentListView::ViewDeactivated()
|
|
405 |
{
|
|
406 |
// When view is deactivated due to losing foreground we reset the list here in advance so there won't be
|
|
407 |
// flickering of the old list. Since view server introduced redraw storing the HandleGainingForeground
|
|
408 |
// comes too late and the old list will flicker before it is reseted.
|
|
409 |
// We'll skip this when Phonebook update pending - the list is going to be updated later.
|
|
410 |
//
|
|
411 |
// If we would do this in HandleLosingForeground, then the list would be emptied when for example when
|
|
412 |
// active applications list, global note etc. is shown.
|
|
413 |
//
|
|
414 |
if (CurrentModel() && iContainer && ( iFocusChangeControl != ELogsNoChange_PbkUpdPending ) )
|
|
415 |
{
|
|
416 |
|
|
417 |
// EJZO-7RJB3V
|
|
418 |
if (IgnoreViewDeactivatedOperation())
|
|
419 |
{
|
|
420 |
CAknView::ViewDeactivated();
|
|
421 |
return;
|
|
422 |
}
|
|
423 |
|
|
424 |
if (iFocusChangeControl != ELogsOkToChange)
|
|
425 |
{
|
|
426 |
StoreEvenListCurrentFocus();
|
|
427 |
}
|
|
428 |
|
|
429 |
// Reset array and set dirty which means refresh requested,
|
|
430 |
// will call StateChangedL with state EStateArrayReseted and update the listbox.
|
|
431 |
// Keep db connection.
|
|
432 |
CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
|
|
433 |
MLogsModel::EKeepDBConnection );
|
|
434 |
|
|
435 |
}
|
|
436 |
|
|
437 |
CAknView::ViewDeactivated();
|
|
438 |
}
|
|
439 |
|
|
440 |
// ----------------------------------------------------------------------------
|
|
441 |
// CLogsRecentListView::DoActivateL
|
|
442 |
// ----------------------------------------------------------------------------
|
|
443 |
//
|
|
444 |
void CLogsRecentListView::DoActivateL(
|
|
445 |
const TVwsViewId& aPrevViewId,
|
|
446 |
TUid aCustomMessageId,
|
|
447 |
const TDesC8& aCustomMessage )
|
|
448 |
{
|
|
449 |
TRACE_ENTRY_POINT;
|
|
450 |
|
|
451 |
CLogsBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
|
|
452 |
|
|
453 |
//To prevent first time flicker of context menu if no ctx mnu will be displayed
|
|
454 |
Cba()->MakeCommandVisible( EAknSoftkeyContextOptions, EFalse );
|
|
455 |
|
|
456 |
iFocusChangeControl = ELogsOkToChange;
|
|
457 |
iEventListCurrentNoChange = KErrNotFound;
|
|
458 |
|
|
459 |
LogsAppUi()->SetCurrentViewId( Id() );
|
|
460 |
|
|
461 |
//To avoid possible flicker, change the cba text to 'Exit' when going to background
|
|
462 |
//but don't draw it. Sometimes CAknView::ConstructMenuAndCbaL might draw the cba
|
|
463 |
//when we are going to background and activating dialled calls view. It is safer
|
|
464 |
//to have the cba thus set as 'Exit'
|
|
465 |
if( aCustomMessageId.iUid == ELogsViewActivationBackground &&
|
|
466 |
LogsAppUi()->ExecutionMode() == ELogsInBackground_ExitOrEndPressed )
|
|
467 |
{
|
|
468 |
ChangeCba2ToExitL( ELogsDontDraw );
|
|
469 |
}
|
|
470 |
else if ( LogsAppUi()->ProvideOnlyRecentViews())
|
|
471 |
{
|
|
472 |
LogsAppUi()->SetPreviousAppUid( aPrevViewId.iAppUid );
|
|
473 |
LogsAppUi()->SetPreviousViewId( aPrevViewId.iViewUid );
|
|
474 |
Engine()->DeleteConfig(); //Logs settings
|
|
475 |
ChangeCba2ToExitL( ELogsDrawNow ); //We must not be able to back to other Logs views, just exit
|
|
476 |
}
|
|
477 |
else
|
|
478 |
{
|
|
479 |
ChangeCba2ToBackL();
|
|
480 |
}
|
|
481 |
|
|
482 |
|
|
483 |
Engine()->CreateModelL( iModel ); //Creates model only if not yet exists
|
|
484 |
|
|
485 |
//Create the control container.
|
|
486 |
if( !iContainer )
|
|
487 |
{
|
|
488 |
iContainer = CLogsRecentListControlContainer::NewL( this, ClientRect() );
|
|
489 |
AppUi()->AddToViewStackL( *this,iContainer );
|
|
490 |
}
|
|
491 |
iContainer->ListBox()->SetListBoxObserver( this );
|
|
492 |
|
|
493 |
//External launch has been done already, so come here
|
|
494 |
if ( ! LogsAppUi()->ProvideOnlyRecentViews() )
|
|
495 |
{
|
|
496 |
LogsAppUi()->SetPreviousAppUid( TUid::Uid( KLogsAppUID3 ) );
|
|
497 |
LogsAppUi()->SetPreviousViewId( aPrevViewId.iViewUid );
|
|
498 |
}
|
|
499 |
|
|
500 |
//Update item selection. Set always focus to top. If previous focus is to be retained, comment below two rows out
|
|
501 |
SetEventListCurrent(0);
|
|
502 |
SetEventListTop(0);
|
|
503 |
|
|
504 |
CurrentModel()->SetObserver( this );
|
|
505 |
|
|
506 |
if( aCustomMessageId.iUid == ELogsViewActivationBackground &&
|
|
507 |
LogsAppUi()->ExecutionMode() == ELogsInBackground_ExitOrEndPressed )
|
|
508 |
{
|
|
509 |
// We have activated this view because we are hiding Logs into background (faking exit)
|
|
510 |
// so this view is waiting when Logs is again foregrounded.
|
|
511 |
//
|
|
512 |
// With MLogsModel::ECloseDBConnectionAndResetArray the connection to the database is
|
|
513 |
// closed and event array will be deleted. Calls StateChangedL with state EStateArrayReseted
|
|
514 |
// which will update the listbox to empty state.
|
|
515 |
// Keep db connection
|
|
516 |
CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
|
|
517 |
MLogsModel::EKeepDBConnection );
|
|
518 |
|
|
519 |
CurrentModel()->DoActivateL( MLogsModel::EResetAndRefresh );
|
|
520 |
// Now we can enable bring-to-foreground on view activation:
|
|
521 |
AppUi()->SetCustomControl(0);
|
|
522 |
AppUi()->HideInBackground();
|
|
523 |
// If listbox needs to redraw,do it.
|
|
524 |
if( CurrentModel()->Count()>0 &&
|
|
525 |
( iContainer->ListBox()->TopItemIndex() != EventListTop() ||
|
|
526 |
iContainer->ListBox()->CurrentItemIndex() != EventListCurrent()))
|
|
527 |
{
|
|
528 |
iContainer->ListBox()->DrawDeferred();
|
|
529 |
}
|
|
530 |
|
|
531 |
}
|
|
532 |
else
|
|
533 |
{
|
|
534 |
// Just to make sure the inputblocker is not on
|
|
535 |
RemoveInputBlocker();
|
|
536 |
TRAPD( err, CurrentModel()->DoActivateL( MLogsModel::EResetAndRefresh ));
|
|
537 |
if( err )
|
|
538 |
{
|
|
539 |
iCoeEnv->HandleError( err );
|
|
540 |
}
|
|
541 |
if( err == KErrDiskFull )
|
|
542 |
{
|
|
543 |
RWsSession& wsSession = CCoeEnv::Static()->WsSession();
|
|
544 |
TApaTask logsui( wsSession );
|
|
545 |
TInt wgId = CCoeEnv::Static()->RootWin().WindowGroupId();
|
|
546 |
logsui.SetWgId( wgId );
|
|
547 |
logsui.KillTask();
|
|
548 |
return;
|
|
549 |
}
|
|
550 |
|
|
551 |
// Avoid the flicking when transfer to foreground from background.
|
|
552 |
if(LogsAppUi()->IsBackground())
|
|
553 |
{
|
|
554 |
iContainer->DrawNow();
|
|
555 |
iEikonEnv->AppUiFactory()->StatusPane()->DrawNow();
|
|
556 |
LogsAppUi()->SetCustomControl(0);
|
|
557 |
|
|
558 |
CCoeEnv * env = CCoeEnv::Static();
|
|
559 |
env->WsSession().SetWindowGroupOrdinalPosition(env->RootWin().Identifier(),0);
|
|
560 |
|
|
561 |
}
|
|
562 |
|
|
563 |
}
|
|
564 |
|
|
565 |
|
|
566 |
if( CurrentModel()->Count() )
|
|
567 |
{
|
|
568 |
iContainer->ListBox()->SetTopItemIndex( EventListTop() );
|
|
569 |
if( EventListCurrent() < 0 )
|
|
570 |
{
|
|
571 |
SetEventListCurrent(0);
|
|
572 |
}
|
|
573 |
iContainer->ListBox()->SetCurrentItemIndex( EventListCurrent() );
|
|
574 |
}
|
|
575 |
|
|
576 |
ClearMissedCallNotificationsL(); //Clear cenrep new missed calls counter + notifications (however, possible missed
|
|
577 |
//list duplicate counters need to be cleared separately).
|
|
578 |
|
|
579 |
TRACE_EXIT_POINT;
|
|
580 |
}
|
|
581 |
|
|
582 |
// ----------------------------------------------------------------------------
|
|
583 |
// CLogsRecentListView::ReadingFinished
|
|
584 |
// ----------------------------------------------------------------------------
|
|
585 |
//
|
|
586 |
TBool CLogsRecentListView::ReadingFinished()
|
|
587 |
{
|
|
588 |
TBool finished = ( iState != EStateActive && iState != EStateUndefined &&
|
|
589 |
iState != EStateInitializing && iState != EStateSemiFinished &&
|
|
590 |
iState != EStateInterrupted );
|
|
591 |
|
|
592 |
return finished;
|
|
593 |
}
|
|
594 |
|
|
595 |
// ----------------------------------------------------------------------------
|
|
596 |
// CLogsRecentListView::IgnoreViewDeactivatedOperation
|
|
597 |
// ----------------------------------------------------------------------------
|
|
598 |
//
|
|
599 |
TBool CLogsRecentListView::IgnoreViewDeactivatedOperation()
|
|
600 |
{
|
|
601 |
TBool ret = EFalse;
|
|
602 |
if (iIgnoreViewDeactivatedHandling)
|
|
603 |
{
|
|
604 |
// no guarenteed order of which is called first ViewDeactivated or HandleLosingForeground,
|
|
605 |
// so add the iSemiFinishViewDeactivatedOperation flag
|
|
606 |
if (iSemiFinishViewDeactivatedOperation)
|
|
607 |
{
|
|
608 |
iIgnoreViewDeactivatedHandling = EFalse;
|
|
609 |
iSemiFinishViewDeactivatedOperation = EFalse;
|
|
610 |
}
|
|
611 |
else
|
|
612 |
{
|
|
613 |
iSemiFinishViewDeactivatedOperation = ETrue;
|
|
614 |
}
|
|
615 |
|
|
616 |
ret = ETrue;
|
|
617 |
}
|
|
618 |
|
|
619 |
return ret;
|
|
620 |
}
|
|
621 |
|
|
622 |
// ----------------------------------------------------------------------------
|
|
623 |
// CLogsRecentListView::DoDeactivate
|
|
624 |
// ----------------------------------------------------------------------------
|
|
625 |
//
|
|
626 |
void CLogsRecentListView::DoDeactivate()
|
|
627 |
{
|
|
628 |
TRACE_ENTRY_POINT;
|
|
629 |
|
|
630 |
CLogsBaseView::DoDeactivate();
|
|
631 |
|
|
632 |
if( iContainer )
|
|
633 |
{
|
|
634 |
SetEventListCurrent(iContainer->ListBox()->CurrentItemIndex());
|
|
635 |
SetEventListTop(iContainer->ListBox()->TopItemIndex());
|
|
636 |
AppUi()->RemoveFromViewStack( *this, iContainer );
|
|
637 |
delete iContainer;
|
|
638 |
iContainer = NULL;
|
|
639 |
}
|
|
640 |
|
|
641 |
if( iModel == ELogsMissedModel )
|
|
642 |
{
|
|
643 |
// Below we test for reading finshed to prevent unnecessary clearing of duplicate counters,
|
|
644 |
// new missed call icons and missed call notification and the "x missed calls" text
|
|
645 |
// in the Call register view.
|
|
646 |
//
|
|
647 |
// This would otherwise be done when user reopens Logs by
|
|
648 |
// green key or from appshell after first leaving Missed calls view to background.
|
|
649 |
//
|
|
650 |
// (Missed calls view will first receive HandleGainingForeground followed by an
|
|
651 |
// immediate DoDeactivate )
|
|
652 |
//
|
|
653 |
// FIXME: This fix is not 100% sure cause it might happen rarely that the reading has time to
|
|
654 |
// finish before framework activates the actual view that was opened (and calls DoDeactivate for
|
|
655 |
// missed calls view). No better solution found yet though.
|
|
656 |
//
|
|
657 |
if ( ReadingFinished() )
|
|
658 |
{
|
|
659 |
LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
|
|
660 |
( "CLogsRecentListView::DoDeactivate - ReadingFinished" ));
|
|
661 |
ClearMissedCallNotifications(); //Clear cenrep new missed calls counter + notifications
|
|
662 |
// Keep db connection
|
|
663 |
CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
|
|
664 |
MLogsModel::EKeepDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
|
|
665 |
//reduces user's perceived performance for other views
|
|
666 |
//(seems to keep clearing of missed duplicates process alive
|
|
667 |
// so no need for EFalse here as it would increase probability of
|
|
668 |
// EMSH-6JDFBV occurring again
|
|
669 |
|
|
670 |
}
|
|
671 |
|
|
672 |
else
|
|
673 |
{
|
|
674 |
LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
|
|
675 |
( "CLogsRecentListView::DoDeactivate - Reading interrupted" ));
|
|
676 |
// Keep db connection
|
|
677 |
CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
|
|
678 |
MLogsModel::EKeepDBConnection );
|
|
679 |
}
|
|
680 |
}
|
|
681 |
else
|
|
682 |
{
|
|
683 |
CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
|
|
684 |
MLogsModel::EKeepDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
|
|
685 |
//reduces user's perceived performance for other views
|
|
686 |
//EFalse: don't disconnect from db. This keeps read data cached in Logs.
|
|
687 |
}
|
|
688 |
|
|
689 |
//To prevent second time flicker of context menu if ctx mnu was was displayed
|
|
690 |
//but will not later be displayed
|
|
691 |
Cba()->MakeCommandVisible( EAknSoftkeyContextOptions, EFalse );
|
|
692 |
|
|
693 |
TRACE_EXIT_POINT;
|
|
694 |
}
|
|
695 |
|
|
696 |
// ----------------------------------------------------------------------------
|
|
697 |
// CLogsRecentListView::CmdClearRecentListL
|
|
698 |
// ----------------------------------------------------------------------------
|
|
699 |
//
|
|
700 |
void CLogsRecentListView::CmdClearRecentListL()
|
|
701 |
{
|
|
702 |
if( CurrentModel()->Count() )
|
|
703 |
{
|
|
704 |
TInt resId( 0 );
|
|
705 |
|
|
706 |
CAknQueryDialog* queryDlg = CAknQueryDialog::NewL();
|
|
707 |
|
|
708 |
switch( iModel )
|
|
709 |
{
|
|
710 |
case ELogsMissedModel:
|
|
711 |
resId = R_CLEAR_MISSED_LIST_CONFIRMATION_QUERY;
|
|
712 |
break;
|
|
713 |
|
|
714 |
case ELogsReceivedModel:
|
|
715 |
resId = R_CLEAR_RECEIVED_LIST_CONFIRMATION_QUERY;
|
|
716 |
break;
|
|
717 |
|
|
718 |
case ELogsDialledModel:
|
|
719 |
resId = R_CLEAR_DIALLED_LIST_CONFIRMATION_QUERY;
|
|
720 |
break;
|
|
721 |
|
|
722 |
default:
|
|
723 |
User::Panic( KStmRecentView, KErrUnknown );
|
|
724 |
break;
|
|
725 |
}
|
|
726 |
|
|
727 |
if( queryDlg->ExecuteLD( resId ) )
|
|
728 |
{
|
|
729 |
Engine()->ClearLogsL()->ClearModelL( iModel );
|
|
730 |
SetEventListTop(0);
|
|
731 |
SetEventListCurrent(0);
|
|
732 |
|
|
733 |
SetInputBlockerL();
|
|
734 |
}
|
|
735 |
}
|
|
736 |
}
|
|
737 |
|
|
738 |
// ----------------------------------------------------------------------------
|
|
739 |
// CLogsRecentListView::CmdDeleteEventL
|
|
740 |
// ----------------------------------------------------------------------------
|
|
741 |
//
|
|
742 |
void CLogsRecentListView::CmdDeleteEventL()
|
|
743 |
{
|
|
744 |
if( CurrentModel()->Count() && iContainer->ListBox()->CurrentItemIndex() != KErrNotFound )
|
|
745 |
{
|
|
746 |
CAknQueryDialog* queryDlg = CAknQueryDialog::NewL();
|
|
747 |
SetEventListTop(iContainer->ListBox()->TopItemIndex());
|
|
748 |
SetEventListCurrent(iContainer->ListBox()->CurrentItemIndex());
|
|
749 |
|
|
750 |
TLogId id = CurrentModel()->At( EventListCurrent() )->LogId();
|
|
751 |
|
|
752 |
if( queryDlg->ExecuteLD( R_DELETE_CONFIRMATION_QUERY ) )
|
|
753 |
{
|
|
754 |
iEventListCurrentNoChange = iContainer->ListBox()->CurrentItemIndex();
|
|
755 |
Engine()->ClearLogsL()->DeleteEventL( id ); //Delete the event from LogDb. Event from view gets
|
|
756 |
//removed when the view data is reread from db.
|
|
757 |
iFocusChangeControl = ELogsNoChange; //Prevent focus moving to top when list is reread
|
|
758 |
}
|
|
759 |
}
|
|
760 |
}
|
|
761 |
|
|
762 |
// ----------------------------------------------------------------------------
|
|
763 |
// CLogsRecentListView::ChangeCba2ToExitL
|
|
764 |
// ----------------------------------------------------------------------------
|
|
765 |
//
|
|
766 |
TBool CLogsRecentListView::ChangeCba2ToExitL( TLogsDrawNow aDrawNow )
|
|
767 |
{
|
|
768 |
//We must attempt to change CBA only if we have correct view in the foreground
|
|
769 |
if( LogsAppUi()->ActiveViewId() != LogsCurrentRecentViewId() )
|
|
770 |
{
|
|
771 |
return EFalse; //There is some other view already active, so we don't have
|
|
772 |
} // our own cba's present
|
|
773 |
|
|
774 |
TInt pos = Cba()->PositionById( EAknSoftkeyBack );
|
|
775 |
|
|
776 |
if( pos > 0 )
|
|
777 |
{
|
|
778 |
Cba()->SetCommandL( pos,
|
|
779 |
ELogsCmdMenuExit,
|
|
780 |
iExitCbaButton->Des() );
|
|
781 |
|
|
782 |
if (aDrawNow == ELogsDrawNow)
|
|
783 |
{
|
|
784 |
Cba()->DrawNow();
|
|
785 |
}
|
|
786 |
|
|
787 |
return ETrue;
|
|
788 |
}
|
|
789 |
|
|
790 |
return EFalse;
|
|
791 |
}
|
|
792 |
|
|
793 |
// ----------------------------------------------------------------------------
|
|
794 |
// CLogsRecentListView::ChangeCba2ToBackL
|
|
795 |
// ----------------------------------------------------------------------------
|
|
796 |
//
|
|
797 |
TBool CLogsRecentListView::ChangeCba2ToBackL()
|
|
798 |
{
|
|
799 |
if( LogsAppUi()->ActiveViewId() != LogsCurrentRecentViewId() )
|
|
800 |
{
|
|
801 |
return EFalse; //There is some other view already active, so we don't have our own cba's present
|
|
802 |
} // (e.g. FSW can be brought to foreground already)
|
|
803 |
|
|
804 |
TInt pos = Cba()->PositionById( ELogsCmdMenuExit );
|
|
805 |
|
|
806 |
if( pos > 0 )
|
|
807 |
{
|
|
808 |
Cba()->SetCommandL( pos,
|
|
809 |
EAknSoftkeyBack,
|
|
810 |
iBackCbaButton->Des() );
|
|
811 |
Cba()->DrawNow();//Needed when this view already been open and cba changed in other view
|
|
812 |
|
|
813 |
return ETrue;
|
|
814 |
}
|
|
815 |
|
|
816 |
return EFalse;
|
|
817 |
}
|
|
818 |
|
|
819 |
// ----------------------------------------------------------------------------
|
|
820 |
// CLogsRecentListView::HandleGainingForeground
|
|
821 |
//
|
|
822 |
// This function is called once for each already constructed Recent View when
|
|
823 |
// Logs is gaining foreground. No matter if a view is deactivated (i.e. is also
|
|
824 |
// called for view(s) not actually gaining foreground but just have been constructed)
|
|
825 |
// ----------------------------------------------------------------------------
|
|
826 |
//
|
|
827 |
void CLogsRecentListView::HandleGainingForeground()
|
|
828 |
{
|
|
829 |
TRACE_ENTRY_POINT;
|
|
830 |
|
|
831 |
CLogsBaseView::HandleGainingForeground();
|
|
832 |
|
|
833 |
//Process cba if this view is already open and then just brought to foreground
|
|
834 |
//in ProvideOnlyRecentViews mode
|
|
835 |
if( LogsAppUi()->ProvideOnlyRecentViews() )
|
|
836 |
{
|
|
837 |
TRAPD( err, ChangeCba2ToExitL( ELogsDrawNow ) );
|
|
838 |
if( err )
|
|
839 |
{
|
|
840 |
iCoeEnv->HandleError( err );
|
|
841 |
}
|
|
842 |
|
|
843 |
// Always reset focus to the top of the list, when Logs is opened by a send key
|
|
844 |
// press from idle
|
|
845 |
if (LogsAppUi()->LogsOpenedWithSendKey() && LogsCurrentRecentViewId() == EStmDialledListViewId)
|
|
846 |
{
|
|
847 |
iFocusChangeControl = ELogsOkToChange;
|
|
848 |
iEventListCurrentNoChange = KErrNotFound;
|
|
849 |
LogsAppUi()->SetLogsOpenedWithSendKey(EFalse); // reset the send key checking
|
|
850 |
LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
|
|
851 |
( "CLogsRecentListView::HandleGainingForeground - LogsOpenedWithSendKey: reset focus" ));
|
|
852 |
}
|
|
853 |
}
|
|
854 |
|
|
855 |
//Activate current view's model that we deactivated in HandleLosingForeground().
|
|
856 |
//No need to check if already active, DoActivateL() handles this.
|
|
857 |
if( LogsAppUi()->ActiveViewId() == LogsCurrentRecentViewId() && iContainer ) //Only if this object corresponds
|
|
858 |
//to current view.
|
|
859 |
{
|
|
860 |
MLogsModel* model = CurrentModel();
|
|
861 |
|
|
862 |
//ELogsNoChange is special case here, i.e contact just added to pbk: skip activating to avoid unwanted UI-focus change.
|
|
863 |
//We don't know in hw which is finished first, reading of entries because of gaining of foreground (EMSH-6JDFBV) here or
|
|
864 |
//re-reading of entries because change observed in db, or will the first db-read have enough time to finish before.
|
|
865 |
if( model )
|
|
866 |
{
|
|
867 |
if( iFocusChangeControl != ELogsNoChange_PbkUpdPending)
|
|
868 |
{
|
|
869 |
//If menu is shown, we need to close it as focus is lost
|
|
870 |
if (MenuBar()->IsDisplayed())
|
|
871 |
{
|
|
872 |
MenuBar()->StopDisplayingMenuBar();
|
|
873 |
}
|
|
874 |
}
|
|
875 |
else
|
|
876 |
{
|
|
877 |
// Change ELogsNoChange_PbkUpdPending to ELogsNoChange now so there is no need to
|
|
878 |
// differentiate those in StateChangedL
|
|
879 |
iFocusChangeControl = ELogsNoChange;
|
|
880 |
}
|
|
881 |
}
|
|
882 |
// Sure "ClearMissedCallNotificationsL" is called.
|
|
883 |
ClearMissedCallNotificationsL();
|
|
884 |
|
|
885 |
RemoveInputBlocker(); //just in case
|
|
886 |
}
|
|
887 |
TRACE_EXIT_POINT;
|
|
888 |
}
|
|
889 |
|
|
890 |
// ----------------------------------------------------------------------------
|
|
891 |
// CLogsRecentListView::StoreEvenListCurrentFocus()
|
|
892 |
// ----------------------------------------------------------------------------
|
|
893 |
//
|
|
894 |
void CLogsRecentListView::StoreEvenListCurrentFocus()
|
|
895 |
{
|
|
896 |
//
|
|
897 |
// Check that not called from deactivated recent list view that also gets
|
|
898 |
// a notification of losin foreground.
|
|
899 |
if (!iContainer || LogsAppUi()->ActiveViewId() != LogsCurrentRecentViewId())
|
|
900 |
{
|
|
901 |
return;
|
|
902 |
}
|
|
903 |
|
|
904 |
// Store the current focused item. Sometimes foreground can be regained for only very briefly and
|
|
905 |
// event reading is not finished so skip those situations.
|
|
906 |
// Also there is no guarantees which is called fist, HandleLosingForeground
|
|
907 |
// or ViewDeactivated so don't change when list is already deleted.
|
|
908 |
//
|
|
909 |
if( (iContainer->ListBox()->CurrentItemIndex() != KErrNotFound) && ReadingFinished() )
|
|
910 |
{
|
|
911 |
SetEventListCurrent(iContainer->ListBox()->CurrentItemIndex());
|
|
912 |
|
|
913 |
// Switch on iEventListCurrentNoChange: store the current item index to
|
|
914 |
// keep it over effects of loss and gain of foreground.
|
|
915 |
iEventListCurrentNoChange = EventListCurrent();
|
|
916 |
SetEventListTop(iContainer->ListBox()->TopItemIndex());
|
|
917 |
}
|
|
918 |
//
|
|
919 |
// If the list has no focus and iEventListCurrentNoChange is not set, let the focus go
|
|
920 |
// to the top of the list when events are reread.
|
|
921 |
else if ( ( iContainer->ListBox()->CurrentItemIndex() == KErrNotFound ) &&
|
|
922 |
( iEventListCurrentNoChange == KErrNotFound ) )
|
|
923 |
{
|
|
924 |
iFocusChangeControl = ELogsOkToChange;
|
|
925 |
}
|
|
926 |
}
|
|
927 |
|
|
928 |
// ----------------------------------------------------------------------------
|
|
929 |
// CLogsRecentListView::HandleLosingForeground
|
|
930 |
//
|
|
931 |
// This function is called once for each type of already constructed recent view (e.g.when fast swapping
|
|
932 |
// window is brought to foreground).
|
|
933 |
// ----------------------------------------------------------------------------
|
|
934 |
//
|
|
935 |
void CLogsRecentListView::HandleLosingForeground()
|
|
936 |
{
|
|
937 |
TRACE_ENTRY_POINT;
|
|
938 |
CLogsBaseView::HandleLosingForeground();
|
|
939 |
|
|
940 |
TBool finished = ReadingFinished();
|
|
941 |
TLogsViewIds currView = LogsCurrentRecentViewId();
|
|
942 |
|
|
943 |
|
|
944 |
if ( iContainer && ( LogsAppUi()->ActiveViewId() == currView ))
|
|
945 |
{
|
|
946 |
// EJZO-7RJB3V
|
|
947 |
if (IgnoreViewDeactivatedOperation())
|
|
948 |
{
|
|
949 |
TRACE_EXIT_POINT;
|
|
950 |
return;
|
|
951 |
}
|
|
952 |
|
|
953 |
// If we are losing foreground in the middle of event reading, force empty text to the view.
|
|
954 |
// This happens for example when keys are locked EYSN-6X5DYS
|
|
955 |
if (!finished)
|
|
956 |
{
|
|
957 |
// Does not have effect if list is not empty
|
|
958 |
iContainer->ForceEmptyTextListBox();
|
|
959 |
}
|
|
960 |
//
|
|
961 |
// If focus is to be kept (iFocusChangeControl is ELogsNoChange or
|
|
962 |
// ELogsNoChange_PbkUpdPending) store the current focused item
|
|
963 |
if ( iFocusChangeControl != ELogsOkToChange )
|
|
964 |
{
|
|
965 |
StoreEvenListCurrentFocus();
|
|
966 |
}
|
|
967 |
}
|
|
968 |
|
|
969 |
// The below is additional code for tuning performance consumption. It can be removed when no need
|
|
970 |
// for this is found as the code below does not affect functionality.
|
|
971 |
// For performance consumption reasons (EMSH-6JDFBV) we need to deactivate the
|
|
972 |
// current view when we lose foreground. However, this needs to be done only for
|
|
973 |
// missed calls view as other views should not be affected by this. However we do it for dialled calls in order
|
|
974 |
// to prevent old wrong entry staying a while in top of list when redialing from dialled list.
|
|
975 |
//
|
|
976 |
// Update: apply the same for Received calls view. This is needed to to avoid inconsistency
|
|
977 |
// between the views, like in EYSN-6X5DYS
|
|
978 |
//
|
|
979 |
if( ( LogsAppUi()->ActiveViewId() == currView ) && //Only if this object corresponds to current view.
|
|
980 |
( currView == EStmMissedListViewId ||
|
|
981 |
currView == EStmDialledListViewId ||
|
|
982 |
currView == EStmReceivedListViewId ) )
|
|
983 |
{
|
|
984 |
MLogsModel* model = CurrentModel();
|
|
985 |
if( model )
|
|
986 |
{
|
|
987 |
// End key pressed in missed calls view: sent to background before the Dialled calls view
|
|
988 |
// is activated while in background. so need to clear duplicates now since the reader is deleted
|
|
989 |
// and they cannot be cleared in DoDeactivate anymore
|
|
990 |
if( LogsAppUi()->ExecutionMode() == ELogsInBackground_ExitOrEndPressed && currView == EStmMissedListViewId )
|
|
991 |
{
|
|
992 |
LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
|
|
993 |
( "CLogsRecentListView::HandleLosingForeground - clear duplicates" ));
|
|
994 |
// Keep db connection
|
|
995 |
model->DoDeactivate( MLogsModel::ENormalOperation,
|
|
996 |
MLogsModel::EKeepDBConnection ); //EFalse: don't disconnect from db
|
|
997 |
}
|
|
998 |
else
|
|
999 |
{
|
|
1000 |
LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
|
|
1001 |
( "CLogsRecentListView::HandleLosingForeground - skip clearing" ));
|
|
1002 |
//Other loss of foreground (call or AppKey). We'll not touch duplicate counters
|
|
1003 |
// Keep db connection
|
|
1004 |
model->DoDeactivate( MLogsModel::ESkipClearing, //Don't update db (for missed view)
|
|
1005 |
MLogsModel::EKeepDBConnection ); //ETrue: disconnect from db in order to immediately to stop
|
|
1006 |
//EFalse: don't disconnect from db
|
|
1007 |
}
|
|
1008 |
}
|
|
1009 |
}
|
|
1010 |
|
|
1011 |
TRACE_EXIT_POINT;
|
|
1012 |
}
|
|
1013 |
|
|
1014 |
// ----------------------------------------------------------------------------
|
|
1015 |
// CLogsRecentListView::StateChangedL
|
|
1016 |
//
|
|
1017 |
// CLogsModel informs it has changed event array, e.g. added entry to array or reseted the array etc.
|
|
1018 |
// This function is called as many times as there is new/changed row in the event array.
|
|
1019 |
// ----------------------------------------------------------------------------
|
|
1020 |
//
|
|
1021 |
void CLogsRecentListView::StateChangedL( MLogsStateHolder* aHolder )
|
|
1022 |
{
|
|
1023 |
TRACE_ENTRY_POINT;
|
|
1024 |
|
|
1025 |
if( !aHolder )
|
|
1026 |
{
|
|
1027 |
return;
|
|
1028 |
}
|
|
1029 |
|
|
1030 |
iState = aHolder->State();
|
|
1031 |
|
|
1032 |
// When check contact link finished, call base method to check if need to
|
|
1033 |
// refresh menu.
|
|
1034 |
if( iState == EStateCheckContactLinkFinished )
|
|
1035 |
{
|
|
1036 |
CLogsBaseView::StateChangedL(aHolder);
|
|
1037 |
return;
|
|
1038 |
}
|
|
1039 |
|
|
1040 |
//Call Update() when related items available to show changes immediately plus when reading is finished.
|
|
1041 |
const TInt KNbrShownEntries = 8;
|
|
1042 |
|
|
1043 |
iState = aHolder->State();
|
|
1044 |
LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
|
|
1045 |
( "CLogsRecentListView::StateChangedL - iState:%d iFocusChangeControl:%d viewid:%d"),
|
|
1046 |
iState, iFocusChangeControl, LogsCurrentRecentViewId() );
|
|
1047 |
|
|
1048 |
// If there was some error reading events - most likely KErrNoMemory,
|
|
1049 |
// display information to user and close Logs
|
|
1050 |
if( iState == EStateError )
|
|
1051 |
{
|
|
1052 |
iCoeEnv->HandleError(KErrNoMemory);
|
|
1053 |
LogsAppUi()->CmdExit();
|
|
1054 |
}
|
|
1055 |
|
|
1056 |
//A. If reader deleted (EMSH-6JDFBV), stop all processing.
|
|
1057 |
if( iState == EStateReaderDeletedOrStopped )
|
|
1058 |
{
|
|
1059 |
return;
|
|
1060 |
}
|
|
1061 |
// Special case, array is reseted so update the list to empty state. This prevents flicker
|
|
1062 |
// of the old list when regaining foreground
|
|
1063 |
else if ( iState == EStateArrayReseted )
|
|
1064 |
{
|
|
1065 |
if( iContainer )
|
|
1066 |
{
|
|
1067 |
iContainer->UpdateL();
|
|
1068 |
}
|
|
1069 |
return;
|
|
1070 |
}
|
|
1071 |
|
|
1072 |
//B. Continue to show contents quickly and without flicker when enough events available
|
|
1073 |
if( iContainer )
|
|
1074 |
{
|
|
1075 |
//1. Check are we finished and set scroll bars
|
|
1076 |
TInt count( iContainer->ListBox()->Model()->NumberOfItems() ); //Current count of items CLogsModel has read into item array
|
|
1077 |
TBool finished = ReadingFinished();
|
|
1078 |
CEikScrollBarFrame* sbFrame = iContainer->ListBox()->ScrollBarFrame();
|
|
1079 |
|
|
1080 |
if( finished || iState == EStateSemiFinished) //To avoid scroll bar flicker don't show scroll bar until completely finished
|
|
1081 |
{
|
|
1082 |
sbFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn );
|
|
1083 |
}
|
|
1084 |
else if (count == 0)
|
|
1085 |
{
|
|
1086 |
sbFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
|
|
1087 |
}
|
|
1088 |
|
|
1089 |
//2. Update listbox when sufficiently events available
|
|
1090 |
if( finished || iState == EStateSemiFinished)
|
|
1091 |
{
|
|
1092 |
iContainer->UpdateL(); //Calls HandleItemAdditionL (plus sets Empty text if needed)
|
|
1093 |
// Fetch data for extension
|
|
1094 |
iContainer->ControlExtension()->HandleAdditionalData(
|
|
1095 |
*CurrentModel(),
|
|
1096 |
*iContainer->ListBox() );
|
|
1097 |
// Add condition check: To avoid Missing Call Note don't display ,do not call "ClearMissedCallNotificationsL" when logs is in background.
|
|
1098 |
if(!LogsAppUi()->IsBackground())
|
|
1099 |
ClearMissedCallNotificationsL();
|
|
1100 |
// When event reading is finished, remove inputblocker
|
|
1101 |
RemoveInputBlocker();
|
|
1102 |
}
|
|
1103 |
// If focus is not retained, refresh the UI when a screenful of events is read
|
|
1104 |
else if( iFocusChangeControl == ELogsOkToChange && count == KNbrShownEntries )
|
|
1105 |
{
|
|
1106 |
iContainer->UpdateL();
|
|
1107 |
}
|
|
1108 |
|
|
1109 |
//3. Control focus changes in the list during the read of events
|
|
1110 |
|
|
1111 |
//Set focus once when ok to change
|
|
1112 |
if ( iFocusChangeControl == ELogsOkToChange )
|
|
1113 |
{
|
|
1114 |
if( iState == EStateFinished || iState == EStateSemiFinished )
|
|
1115 |
{
|
|
1116 |
//Reset iEventListCurrentNoChange and iFocusChangeControl
|
|
1117 |
iEventListCurrentNoChange = KErrNotFound;
|
|
1118 |
iFocusChangeControl = ELogsNoChange;
|
|
1119 |
}
|
|
1120 |
|
|
1121 |
if( count && //at least one entry from previous read to this view
|
|
1122 |
( iState == EStateUndefined || iState == EStateInitializing )) //we're about start reread
|
|
1123 |
{
|
|
1124 |
SetEventListCurrent(0);
|
|
1125 |
iContainer->ListBox()->SetCurrentItemIndex( EventListCurrent() );
|
|
1126 |
}
|
|
1127 |
}
|
|
1128 |
|
|
1129 |
else
|
|
1130 |
//No focus change when entry saved to phonebook, deleted or list updated twice.
|
|
1131 |
{
|
|
1132 |
if( (iState == EStateFinished && LogsCurrentRecentViewId() != EStmMissedListViewId ) || iState == EStateSemiFinished)
|
|
1133 |
{
|
|
1134 |
//If e.g. foreground regained, use iEventListCurrentNoChange if switched on
|
|
1135 |
if( iEventListCurrentNoChange != KErrNotFound && //iEventListCurrentNoChange is switched on.
|
|
1136 |
( EventListCurrent() == KErrNotFound ||
|
|
1137 |
EventListCurrent() == 0) ) //No iEventListCurrent available.
|
|
1138 |
{
|
|
1139 |
SetEventListCurrent(iEventListCurrentNoChange); //Use iEventListCurrentNoChange
|
|
1140 |
}
|
|
1141 |
|
|
1142 |
if( count > 0 )
|
|
1143 |
{
|
|
1144 |
//If now less rows than current item before, or if no current selection (e.g last
|
|
1145 |
//row was deleted), try to set focus to last available item. Otherwise try to use
|
|
1146 |
//iEventListCurrent.
|
|
1147 |
if( count <= EventListCurrent() || EventListCurrent() < 0 )
|
|
1148 |
{
|
|
1149 |
iContainer->ListBox()->SetCurrentItemIndex( count - 1 );
|
|
1150 |
}
|
|
1151 |
else if( count > EventListCurrent() )
|
|
1152 |
{
|
|
1153 |
iContainer->ListBox()->SetCurrentItemIndex( EventListCurrent() );
|
|
1154 |
// if event list top is sensible, adjust the window back to what it was
|
|
1155 |
if ((EventListTop() >= 0) && (EventListTop() < count) )
|
|
1156 |
{
|
|
1157 |
iContainer->ListBox()->SetTopItemIndex(EventListTop());
|
|
1158 |
}
|
|
1159 |
}
|
|
1160 |
}
|
|
1161 |
|
|
1162 |
iFocusChangeControl = ELogsNoChange;
|
|
1163 |
SetEventListCurrent( iContainer->ListBox()->CurrentItemIndex() );
|
|
1164 |
}
|
|
1165 |
}
|
|
1166 |
|
|
1167 |
//When reading twice (EMSH-6JDFBV), prevent setting focus again for second phase read.
|
|
1168 |
if( iState == EStateSemiFinished )
|
|
1169 |
{
|
|
1170 |
iFocusChangeControl = ELogsNoChange;
|
|
1171 |
}
|
|
1172 |
|
|
1173 |
//4. Set MSK state
|
|
1174 |
if( iState == EStateFinished || iState == EStateSemiFinished )
|
|
1175 |
{
|
|
1176 |
Cba()->MakeCommandVisible(
|
|
1177 |
EAknSoftkeyContextOptions,
|
|
1178 |
IsOkToShowContextMenu( CurrentEvent() ));
|
|
1179 |
}
|
|
1180 |
|
|
1181 |
//5. To improve user's perceived responsiviness we probably now have a good moment to perform
|
|
1182 |
//some time consuming operations if not yet already done
|
|
1183 |
if( count == KNbrShownEntries ) //if( iState == EStateFinished )
|
|
1184 |
{
|
|
1185 |
ConstructDelayedL( ETrue ); //EFalse: perform immediately, ETrue: perform using idle time
|
|
1186 |
}
|
|
1187 |
|
|
1188 |
//6. When starting reading, call UpdateL so the informative text
|
|
1189 |
// "Retrieving data" can be shown instead just the empty screen.
|
|
1190 |
if (count == 0 && iState == EStateInitializing )
|
|
1191 |
{
|
|
1192 |
iContainer->UpdateL();
|
|
1193 |
}
|
|
1194 |
|
|
1195 |
//7. Just in case the menu was open before reading events, handle the possible menu refresh now
|
|
1196 |
if (finished)
|
|
1197 |
{
|
|
1198 |
HandleMenuRefreshL(CurrentEvent());
|
|
1199 |
}
|
|
1200 |
|
|
1201 |
}
|
|
1202 |
|
|
1203 |
TRACE_EXIT_POINT;
|
|
1204 |
}
|
|
1205 |
|
|
1206 |
// ----------------------------------------------------------------------------
|
|
1207 |
// CLogsRecentListView::ExtStateChangedL
|
|
1208 |
// ----------------------------------------------------------------------------
|
|
1209 |
//
|
|
1210 |
void CLogsRecentListView::ExtStateChangedL()
|
|
1211 |
{
|
|
1212 |
if( iContainer )
|
|
1213 |
{
|
|
1214 |
iContainer->UpdateL();
|
|
1215 |
}
|
|
1216 |
}
|
|
1217 |
|
|
1218 |
// ----------------------------------------------------------------------------
|
|
1219 |
// CLogsRecentListView::State
|
|
1220 |
// ----------------------------------------------------------------------------
|
|
1221 |
//
|
|
1222 |
TLogsState CLogsRecentListView::State() const
|
|
1223 |
{
|
|
1224 |
return iState;
|
|
1225 |
}
|
|
1226 |
|
|
1227 |
// ----------------------------------------------------------------------------
|
|
1228 |
// CLogsRecentListView::CurrentEvent
|
|
1229 |
//
|
|
1230 |
// Returns event relating current selection of listbox or NULL
|
|
1231 |
// ----------------------------------------------------------------------------
|
|
1232 |
//
|
|
1233 |
const MLogsEventGetter* CLogsRecentListView::CurrentEvent()
|
|
1234 |
{
|
|
1235 |
TRACE_ENTRY_POINT;
|
|
1236 |
//KErrNotFound if no current selection in listbox:
|
|
1237 |
if (iContainer && iContainer->ListBox())
|
|
1238 |
{
|
|
1239 |
SetEventListCurrent(iContainer->ListBox()->CurrentItemIndex());
|
|
1240 |
}
|
|
1241 |
else
|
|
1242 |
{
|
|
1243 |
TRACE_EXIT_POINT;
|
|
1244 |
return NULL;
|
|
1245 |
}
|
|
1246 |
|
|
1247 |
//Return null if no current selection or no suitable event available
|
|
1248 |
if( CurrentModel() && CurrentModel()->Count() > 0 && EventListCurrent() >= 0 )
|
|
1249 |
{
|
|
1250 |
TRACE_EXIT_POINT;
|
|
1251 |
return CurrentModel()->At( EventListCurrent() );
|
|
1252 |
}
|
|
1253 |
else
|
|
1254 |
{
|
|
1255 |
TRACE_EXIT_POINT;
|
|
1256 |
return NULL;
|
|
1257 |
}
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
// ----------------------------------------------------------------------------
|
|
1261 |
// CLogsRecentListView::HandleNotifyL
|
|
1262 |
//
|
|
1263 |
// Handle AIW-notifications (from asynch ExecuteCmdL call)
|
|
1264 |
// ----------------------------------------------------------------------------
|
|
1265 |
//
|
|
1266 |
TInt CLogsRecentListView::HandleNotifyL(
|
|
1267 |
TInt aCmdId,
|
|
1268 |
TInt aEventId,
|
|
1269 |
CAiwGenericParamList& aEventParamList,
|
|
1270 |
const CAiwGenericParamList& aInParamList )
|
|
1271 |
{
|
|
1272 |
TInt result = CLogsBaseView::HandleNotifyL( aCmdId, aEventId, aEventParamList, aInParamList );
|
|
1273 |
return result;
|
|
1274 |
}
|
|
1275 |
|
|
1276 |
void CLogsRecentListView::ViewActivatedL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage)
|
|
1277 |
{
|
|
1278 |
//To avoid the flicking when transfer to foreground from background,we control the view show manually.
|
|
1279 |
if(LogsAppUi()->IsBackground() &&
|
|
1280 |
LogsAppUi()->ActiveViewId() != LogsCurrentRecentViewId() )
|
|
1281 |
{
|
|
1282 |
LogsAppUi()->SetCustomControl(1);
|
|
1283 |
}
|
|
1284 |
|
|
1285 |
CLogsBaseView::ViewActivatedL(aPrevViewId,aCustomMessageId,aCustomMessage);
|
|
1286 |
|
|
1287 |
}
|
|
1288 |
|
|
1289 |
// End of File
|