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 |
* Logs application "Event list" view class implementation
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <eikmenub.h>
|
|
22 |
#include <AknQueryDialog.h>
|
|
23 |
#include <featmgr.h> //FeatureManger
|
|
24 |
#include <Logs.rsg>
|
|
25 |
|
|
26 |
#include "CLogsEventListView.h"
|
|
27 |
#include "CLogsAppUi.h"
|
|
28 |
#include "CLogsEngine.h"
|
|
29 |
#include "MLogsModel.h"
|
|
30 |
#include "MLogsEventGetter.h"
|
|
31 |
#include "MLogsClearLog.h"
|
|
32 |
#include "CLogsEventListControlContainer.h"
|
|
33 |
#include "CLogsReaderConfigFactory.h"
|
|
34 |
#include "MLogsStateHolder.h"
|
|
35 |
#include "MLogsSharedData.h"
|
|
36 |
#include "LogsEngConsts.h" //KLogEngWlanEventTypeUid
|
|
37 |
#include "MLogsReader.h"
|
|
38 |
#include "LogsUID.h"
|
|
39 |
|
|
40 |
#include "LogsDebug.h"
|
|
41 |
#include "LogsTraces.h"
|
|
42 |
|
|
43 |
// EXTERNAL DATA STRUCTURES
|
|
44 |
|
|
45 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
46 |
|
|
47 |
// CONSTANTS
|
|
48 |
|
|
49 |
// MACROS
|
|
50 |
|
|
51 |
// LOCAL CONSTANTS AND MACROS
|
|
52 |
|
|
53 |
// MODULE DATA STRUCTURES
|
|
54 |
|
|
55 |
// LOCAL FUNCTION PROTOTYPES
|
|
56 |
|
|
57 |
// ==================== LOCAL FUNCTIONS ====================
|
|
58 |
|
|
59 |
// ================= MEMBER FUNCTIONS =======================
|
|
60 |
|
|
61 |
// ----------------------------------------------------------------------------
|
|
62 |
// CLogsEventListView::NewL
|
|
63 |
// ----------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
CLogsEventListView* CLogsEventListView::NewL()
|
|
66 |
{
|
|
67 |
CLogsEventListView* self = new( ELeave ) CLogsEventListView;
|
|
68 |
CleanupStack::PushL( self );
|
|
69 |
self->ConstructL();
|
|
70 |
CleanupStack::Pop(); // self
|
|
71 |
return self;
|
|
72 |
}
|
|
73 |
|
|
74 |
// ----------------------------------------------------------------------------
|
|
75 |
// CLogsEventListView::~CLogsEventListView
|
|
76 |
// ----------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
CLogsEventListView::~CLogsEventListView()
|
|
79 |
{
|
|
80 |
if( iContainer )
|
|
81 |
{
|
|
82 |
AppUi()->RemoveFromViewStack( *this, iContainer );
|
|
83 |
delete iContainer;
|
|
84 |
}
|
|
85 |
}
|
|
86 |
|
|
87 |
// ----------------------------------------------------------------------------
|
|
88 |
// CLogsEventListView::CLogsEventListView
|
|
89 |
// ----------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
CLogsEventListView::CLogsEventListView() :
|
|
92 |
iCurrentFilter( ELogsFilterAllComms ),
|
|
93 |
iState( EStateUndefined ),
|
|
94 |
iClearListInProgress(EFalse)
|
|
95 |
{
|
|
96 |
}
|
|
97 |
|
|
98 |
// ----------------------------------------------------------------------------
|
|
99 |
// CLogsEventListView::HandleCommandL
|
|
100 |
// ----------------------------------------------------------------------------
|
|
101 |
//
|
|
102 |
void CLogsEventListView::HandleCommandL( TInt aCommandId )
|
|
103 |
{
|
|
104 |
iEventListCurrent = iContainer->ListBox()->CurrentItemIndex();
|
|
105 |
|
|
106 |
const MLogsEventGetter* event = NULL;
|
|
107 |
event = Engine()->Model( ELogsMainModel )->At( iEventListCurrent );
|
|
108 |
|
|
109 |
switch( aCommandId )
|
|
110 |
{
|
|
111 |
case ELogsCmdMenuDetails:
|
|
112 |
//if in clearlog process, ignore the request to avoid show
|
|
113 |
//deteiled view EJDU-7PCDKG
|
|
114 |
if(!iClearListInProgress)
|
|
115 |
{
|
|
116 |
LogsAppUi()->CmdOkL( iEventListCurrent );
|
|
117 |
}
|
|
118 |
break;
|
|
119 |
|
|
120 |
case ELogsCmdMenuFilter:
|
|
121 |
CmdFilterL();
|
|
122 |
break;
|
|
123 |
|
|
124 |
case ELogsCmdMenuClearList:
|
|
125 |
CmdClearListL();
|
|
126 |
break;
|
|
127 |
|
|
128 |
default:
|
|
129 |
{
|
|
130 |
CLogsBaseView::HandleCommandEventL( aCommandId, event );
|
|
131 |
}
|
|
132 |
}
|
|
133 |
}
|
|
134 |
|
|
135 |
// ----------------------------------------------------------------------------
|
|
136 |
// CLogsEventListView::ChangeTitlePaneTextToDefaultL
|
|
137 |
// ----------------------------------------------------------------------------
|
|
138 |
//
|
|
139 |
void CLogsEventListView::ChangeTitlePaneTextToDefaultL()
|
|
140 |
{
|
|
141 |
iContainer->SetTitlePaneTextToDefaultL( LogsAppUi()->ActiveViewId() );
|
|
142 |
}
|
|
143 |
|
|
144 |
// ----------------------------------------------------------------------------
|
|
145 |
// CLogsEventListView::ProcessCommandL
|
|
146 |
//
|
|
147 |
// Called from FW when e.g. cba pressed
|
|
148 |
// ----------------------------------------------------------------------------
|
|
149 |
|
|
150 |
void CLogsEventListView::ProcessCommandL( TInt aCommand )
|
|
151 |
{
|
|
152 |
if (LogsAppUi()->ActiveViewId() != ELogEventListViewId || !iContainer )
|
|
153 |
{
|
|
154 |
LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
|
|
155 |
( "CLogsRecentListView::ProcessCommandL - view already deactivated! return " ));
|
|
156 |
return;
|
|
157 |
}
|
|
158 |
|
|
159 |
if (aCommand == EAknSoftkeyOptions)
|
|
160 |
{
|
|
161 |
TInt currentEventIndex = iContainer->ListBox()->CurrentItemIndex();
|
|
162 |
const MLogsEventGetter* event = NULL;
|
|
163 |
event = Engine()->Model( ELogsMainModel )->At( currentEventIndex );
|
|
164 |
|
|
165 |
// If options menu is opened call SetRefreshMenuOnUpdate which records the current event id
|
|
166 |
// which can then be used to make a decision on wether options menu needs to be refreshed
|
|
167 |
// when reading is finished.
|
|
168 |
SetRefreshMenuOnUpdate( event );
|
|
169 |
}
|
|
170 |
|
|
171 |
CLogsBaseView::ProcessCommandL( aCommand );
|
|
172 |
}
|
|
173 |
|
|
174 |
// ----------------------------------------------------------------------------
|
|
175 |
// CLogsEventListView::ProcessKeyEventL
|
|
176 |
// ----------------------------------------------------------------------------
|
|
177 |
//
|
|
178 |
TBool CLogsEventListView::ProcessKeyEventL( const TKeyEvent& aKeyEvent,
|
|
179 |
TEventCode aType )
|
|
180 |
{
|
|
181 |
iEventListCurrent = iContainer->ListBox()->CurrentItemIndex();
|
|
182 |
|
|
183 |
const MLogsEventGetter* event = CurrentModel()->At( iEventListCurrent );
|
|
184 |
|
|
185 |
//FIXME (CLogsRecentListView and CLogsEventListView):
|
|
186 |
//The below is needed only because we get key event before the actual row
|
|
187 |
//is changed in the listbox. If/when listbox observer for changed row focus
|
|
188 |
//is available, remove code below and get correct event index from observer.
|
|
189 |
iEventListCurrent = iContainer->ListBox()->CurrentItemIndex();
|
|
190 |
|
|
191 |
if( aType == EEventKey && iEventListCurrent != KErrNotFound )
|
|
192 |
{
|
|
193 |
TInt count( CurrentModel()->Count() );
|
|
194 |
switch (aKeyEvent.iScanCode)
|
|
195 |
{
|
|
196 |
case EStdKeyUpArrow:
|
|
197 |
//Set iEventListCurrent + jump to previous or last event depending on position in list
|
|
198 |
iEventListCurrent > 0 ? event = CurrentModel()->At( --iEventListCurrent ) :
|
|
199 |
event = CurrentModel()->At( iEventListCurrent = count - 1 );
|
|
200 |
break;
|
|
201 |
|
|
202 |
case EStdKeyDownArrow:
|
|
203 |
//Set iEventListCurrent + jump to next or first event depending on position in list
|
|
204 |
iEventListCurrent < count - 1 ? event = CurrentModel()->At( ++iEventListCurrent ) :
|
|
205 |
event = CurrentModel()->At( iEventListCurrent = 0 );
|
|
206 |
break;
|
|
207 |
}
|
|
208 |
}
|
|
209 |
|
|
210 |
return CLogsBaseView::ProcessKeyEventEventL( aKeyEvent,aType, event );
|
|
211 |
}
|
|
212 |
|
|
213 |
// ----------------------------------------------------------------------------
|
|
214 |
// CLogsEventListView::Id
|
|
215 |
// ----------------------------------------------------------------------------
|
|
216 |
//
|
|
217 |
TUid CLogsEventListView::Id() const
|
|
218 |
{
|
|
219 |
return TUid::Uid( ELogEventListViewId );
|
|
220 |
}
|
|
221 |
|
|
222 |
// ----------------------------------------------------------------------------
|
|
223 |
// CLogsEventListView::DynInitMenuPaneL
|
|
224 |
// ----------------------------------------------------------------------------
|
|
225 |
//
|
|
226 |
void CLogsEventListView::DynInitMenuPaneL
|
|
227 |
( TInt aResourceId
|
|
228 |
, CEikMenuPane* aMenuPane
|
|
229 |
)
|
|
230 |
{
|
|
231 |
//First check do we have data already available. Data may not yet be available if asynch request(s) are
|
|
232 |
//not yet completed
|
|
233 |
iEventListCurrent = iContainer->ListBox()->CurrentItemIndex();
|
|
234 |
const MLogsEventGetter* event = NULL;
|
|
235 |
|
|
236 |
if( Engine()->Model( ELogsMainModel )->Count() > 0 && iEventListCurrent >= 0 )
|
|
237 |
{
|
|
238 |
event = Engine()->Model( ELogsMainModel )->At( iEventListCurrent );
|
|
239 |
}
|
|
240 |
|
|
241 |
//Process menuitems. Note that data may not yet be available.
|
|
242 |
if( aResourceId == R_LOGS_EVENT_LIST_MENU_CLEAR_LIST )
|
|
243 |
{
|
|
244 |
if( !event )
|
|
245 |
{
|
|
246 |
aMenuPane->DeleteMenuItem( ELogsCmdMenuClearList );
|
|
247 |
return;
|
|
248 |
}
|
|
249 |
}
|
|
250 |
else if( aResourceId == R_LOGS_EVENT_LIST_MENU_FILTER )
|
|
251 |
{
|
|
252 |
if( !event )
|
|
253 |
{
|
|
254 |
//Remove filter option if we had broadest filter in use and still got an empty list
|
|
255 |
if( Engine()->Model( ELogsMainModel )->Count() == 0 &&
|
|
256 |
iCurrentFilter == ELogsFilterAllComms )
|
|
257 |
{
|
|
258 |
aMenuPane->DeleteMenuItem( ELogsCmdMenuFilter );
|
|
259 |
}
|
|
260 |
return;
|
|
261 |
}
|
|
262 |
}
|
|
263 |
else if( aResourceId == R_LOGS_EVENT_LIST_MENU_DETAILS )
|
|
264 |
{
|
|
265 |
if( !event )
|
|
266 |
{
|
|
267 |
aMenuPane->DeleteMenuItem( ELogsCmdMenuDetails );
|
|
268 |
return;
|
|
269 |
}
|
|
270 |
else
|
|
271 |
{
|
|
272 |
// If MSK is enabled both in the platform and in the application, the menu text
|
|
273 |
// for viewing the event details is changed to conform with the MSK label
|
|
274 |
if( Engine()->SharedDataL()->IsMSKEnabledInPlatform() &&
|
|
275 |
AknLayoutUtils::MSKEnabled() )
|
|
276 |
{
|
|
277 |
aMenuPane->SetItemTextL( ELogsCmdMenuDetails, R_QTN_LOGS_CMD_VIEW);
|
|
278 |
}
|
|
279 |
}
|
|
280 |
}
|
|
281 |
else
|
|
282 |
{
|
|
283 |
CLogsBaseView::DynInitMenuPaneEventL( aResourceId, aMenuPane, event );
|
|
284 |
}
|
|
285 |
}
|
|
286 |
|
|
287 |
|
|
288 |
// ----------------------------------------------------------------------------
|
|
289 |
// CLogsEventListView::HandleClientRectChange
|
|
290 |
// ----------------------------------------------------------------------------
|
|
291 |
//
|
|
292 |
void CLogsEventListView::HandleClientRectChange()
|
|
293 |
{
|
|
294 |
if (iContainer)
|
|
295 |
{
|
|
296 |
iContainer->SetRect( ClientRect() );
|
|
297 |
}
|
|
298 |
}
|
|
299 |
|
|
300 |
// ----------------------------------------------------------------------------
|
|
301 |
// CLogsEventListView::DrawComponents
|
|
302 |
// ----------------------------------------------------------------------------
|
|
303 |
//
|
|
304 |
void CLogsEventListView::DrawComponents()
|
|
305 |
{
|
|
306 |
if (iContainer)
|
|
307 |
{
|
|
308 |
iContainer->DrawNow();
|
|
309 |
}
|
|
310 |
}
|
|
311 |
|
|
312 |
// ----------------------------------------------------------------------------
|
|
313 |
// CLogsEventListView::DoActivateL
|
|
314 |
// ----------------------------------------------------------------------------
|
|
315 |
//
|
|
316 |
void CLogsEventListView::DoActivateL
|
|
317 |
( const TVwsViewId& aPrevViewId,
|
|
318 |
TUid aCustomMessageId,
|
|
319 |
const TDesC8& aCustomMessage )
|
|
320 |
{
|
|
321 |
TRACE_ENTRY_POINT;
|
|
322 |
CLogsBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
|
|
323 |
|
|
324 |
|
|
325 |
Engine()->CreateModelL( ELogsMainModel ); //Creates if not already exist
|
|
326 |
|
|
327 |
if( iContainer == NULL )
|
|
328 |
{
|
|
329 |
iContainer = CLogsEventListControlContainer::NewL( this, ClientRect() );
|
|
330 |
AppUi()->AddToViewStackL( *this, iContainer );
|
|
331 |
}
|
|
332 |
iContainer->ListBox()->SetListBoxObserver( this );
|
|
333 |
|
|
334 |
//We reset this list when activated. Only exception is when returning from Logs Detail View
|
|
335 |
if( aPrevViewId.iViewUid != TUid::Uid( ELogDetailViewId ))
|
|
336 |
{
|
|
337 |
MLogsReaderConfig* readerConfig;
|
|
338 |
iCurrentFilter = ELogsFilterAllComms; //reset filter selection
|
|
339 |
readerConfig = CLogsReaderConfigFactory::LogsReaderConfigLC( iCurrentFilter); //reread all events
|
|
340 |
iContainer->ListBox()->SetCurrentItemIndex( 0 );
|
|
341 |
Engine()->Model( ELogsMainModel )->ConfigureL( readerConfig );
|
|
342 |
CleanupStack::PopAndDestroy(); //readerConfig
|
|
343 |
}
|
|
344 |
|
|
345 |
LogsAppUi()->SetPreviousViewId( aPrevViewId.iViewUid );
|
|
346 |
LogsAppUi()->SetCurrentViewId( Id() );
|
|
347 |
Engine()->Model( ELogsMainModel )->SetObserver( this );
|
|
348 |
Engine()->Model( ELogsMainModel )->DoActivateL( MLogsModel::ERefresh );
|
|
349 |
Engine()->StartSMSEventUpdaterL( /* MLogsReader::EPbkAndSim */ );//Starts the asynch process of reading Phonebook,
|
|
350 |
//updating Logs event and eventually receiving
|
|
351 |
//notification of changed database data to view.
|
|
352 |
// Just to make sure the inputblocker is not on
|
|
353 |
iClearListInProgress = EFalse;
|
|
354 |
RemoveInputBlocker();
|
|
355 |
|
|
356 |
TRACE_EXIT_POINT;
|
|
357 |
}
|
|
358 |
// ----------------------------------------------------------------------------
|
|
359 |
// CLogsEventListView::DoDeactivate
|
|
360 |
// ----------------------------------------------------------------------------
|
|
361 |
//
|
|
362 |
void CLogsEventListView::DoDeactivate()
|
|
363 |
{
|
|
364 |
if( iContainer )
|
|
365 |
{
|
|
366 |
iEventListCurrent = iContainer->ListBox()->CurrentItemIndex();
|
|
367 |
iEventListTop = iContainer->ListBox()->TopItemIndex();
|
|
368 |
AppUi()->RemoveFromViewStack( *this, iContainer );
|
|
369 |
delete iContainer;
|
|
370 |
iContainer = NULL;
|
|
371 |
}
|
|
372 |
|
|
373 |
//Deactivate model. We must keep the model connected to the database, otherwise we don't have the
|
|
374 |
//the same data available when we return from Detail view.
|
|
375 |
Engine()->Model( ELogsMainModel )->DoDeactivate( MLogsModel::ENormalOperation,
|
|
376 |
MLogsModel::EKeepDBConnection ); //EFalse: keep connected to db
|
|
377 |
|
|
378 |
}
|
|
379 |
|
|
380 |
// ----------------------------------------------------------------------------
|
|
381 |
// CLogsEventListView::ConstructL
|
|
382 |
// ----------------------------------------------------------------------------
|
|
383 |
//
|
|
384 |
void CLogsEventListView::ConstructL()
|
|
385 |
{
|
|
386 |
BaseConstructL( R_LOGS_EVENT_LIST_VIEW );
|
|
387 |
}
|
|
388 |
|
|
389 |
|
|
390 |
// ----------------------------------------------------------------------------
|
|
391 |
// CLogsEventListView::CmdClearListL
|
|
392 |
// ----------------------------------------------------------------------------
|
|
393 |
//
|
|
394 |
void CLogsEventListView::CmdClearListL()
|
|
395 |
{
|
|
396 |
CAknQueryDialog* queryDlg = CAknQueryDialog::NewL();
|
|
397 |
if( queryDlg->ExecuteLD( R_CLEAR_LIST_CONFIRMATION_QUERY ) )
|
|
398 |
{
|
|
399 |
Engine()->ClearLogsL()->ClearModelL( ELogsMainModel );
|
|
400 |
Engine()->SharedDataL()->NewMissedCalls( ETrue );
|
|
401 |
SetInputBlockerL();
|
|
402 |
iClearListInProgress = ETrue;
|
|
403 |
|
|
404 |
}
|
|
405 |
}
|
|
406 |
|
|
407 |
// ----------------------------------------------------------------------------
|
|
408 |
// CLogsEventListView::AddOneListBoxTextLineL
|
|
409 |
// ----------------------------------------------------------------------------
|
|
410 |
//
|
|
411 |
void CLogsEventListView::AddOneListBoxTextLineL(
|
|
412 |
CDesCArrayFlat* aItems,
|
|
413 |
TInt aResourceText )
|
|
414 |
{
|
|
415 |
HBufC* text;
|
|
416 |
text = iCoeEnv->AllocReadResourceLC( aResourceText );
|
|
417 |
aItems->AppendL( *text );
|
|
418 |
CleanupStack::PopAndDestroy(); // text
|
|
419 |
}
|
|
420 |
|
|
421 |
// ----------------------------------------------------------------------------
|
|
422 |
// CLogsEventListView::InitFilterPopupListL
|
|
423 |
//
|
|
424 |
// Show Popuplist containing filtering options
|
|
425 |
// ----------------------------------------------------------------------------
|
|
426 |
//
|
|
427 |
TLogsFilter CLogsEventListView::InitFilterPopupListL()
|
|
428 |
{
|
|
429 |
CDesCArrayFlat* items = new( ELeave )CDesCArrayFlat( ELogsFilterNumberOfFilters );
|
|
430 |
CleanupStack::PushL( items );
|
|
431 |
|
|
432 |
//NOTE! In enum TLogsFilter does not necessarily contain same options as in created filter listbox.,
|
|
433 |
//Therefore we create popUpRow[] containing only the filtering options corresponding to
|
|
434 |
//rows available in popuplistbox (e.g. wlan option is not present in all configurations).
|
|
435 |
TLogsFilter popUpRow[ELogsFilterNumberOfFilters]; //(ELogsFilterNumberOfFilters is last of enums)
|
|
436 |
TInt i = 0;
|
|
437 |
TInt setFocusInLB = KErrNotFound;
|
|
438 |
TInt count( Engine()->Model( ELogsMainModel )->Count() );
|
|
439 |
|
|
440 |
//If previous choice did not give any events, then do not add it again to listbox (hide that option)
|
|
441 |
if( !( iCurrentFilter == ELogsFilterAllComms && count == 0 ) ) //1.Add other than current filters to list 2.Add also current filter to
|
|
442 |
{ // list if it found events from db, otherwise discard current filter.
|
|
443 |
(iCurrentFilter == ELogsFilterAllComms && count > 0) ? setFocusInLB = i : 0; //Set focus to this line if current & found events from db.
|
|
444 |
AddOneListBoxTextLineL( items, R_LOGS_MF_ALL_COMMUNICATION_TEXT );
|
|
445 |
popUpRow[i++] = ELogsFilterAllComms;
|
|
446 |
}
|
|
447 |
if( !( iCurrentFilter == ELogsFilterOutgoing && count == 0 ) )
|
|
448 |
{
|
|
449 |
(iCurrentFilter == ELogsFilterOutgoing && count > 0) ? setFocusInLB = i : 0;
|
|
450 |
AddOneListBoxTextLineL( items, R_LOGS_MF_OUTGOING_TEXT );
|
|
451 |
popUpRow[i++] = ELogsFilterOutgoing;
|
|
452 |
}
|
|
453 |
if( !( iCurrentFilter == ELogsFilterIncoming && count == 0 ) )
|
|
454 |
{
|
|
455 |
(iCurrentFilter == ELogsFilterIncoming && count > 0) ? setFocusInLB = i : 0;
|
|
456 |
AddOneListBoxTextLineL( items, R_LOGS_MF_INCOMING_TEXT );
|
|
457 |
popUpRow[i++] = ELogsFilterIncoming;
|
|
458 |
}
|
|
459 |
if( !( iCurrentFilter == ELogsFilterVoice && count == 0 ) )
|
|
460 |
{
|
|
461 |
(iCurrentFilter == ELogsFilterVoice && count > 0) ? setFocusInLB = i : 0;
|
|
462 |
if( FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ) )
|
|
463 |
{
|
|
464 |
AddOneListBoxTextLineL( items, R_LOGS_MF_VOICEVIDEO_TEXT );
|
|
465 |
}
|
|
466 |
else
|
|
467 |
{
|
|
468 |
AddOneListBoxTextLineL( items, R_LOGS_MF_VOICE_TEXT );
|
|
469 |
}
|
|
470 |
popUpRow[i++] = ELogsFilterVoice;
|
|
471 |
}
|
|
472 |
if( !( iCurrentFilter == ELogsFilterMessages && count == 0 ) )
|
|
473 |
{
|
|
474 |
(iCurrentFilter == ELogsFilterMessages && count > 0) ? setFocusInLB = i : 0;
|
|
475 |
AddOneListBoxTextLineL( items, R_LOGS_MF_SMS_TEXT );
|
|
476 |
popUpRow[i++] = ELogsFilterMessages;
|
|
477 |
}
|
|
478 |
if( !( iCurrentFilter == ELogsFilterPacket && count == 0 ) )
|
|
479 |
{
|
|
480 |
(iCurrentFilter == ELogsFilterPacket && count > 0) ? setFocusInLB = i : 0;
|
|
481 |
AddOneListBoxTextLineL( items, R_LOGS_MF_PACKET_TEXT );
|
|
482 |
popUpRow[i++] = ELogsFilterPacket;
|
|
483 |
}
|
|
484 |
if( !( iCurrentFilter == ELogsFilterData && count == 0 ) )
|
|
485 |
{
|
|
486 |
(iCurrentFilter == ELogsFilterData && count > 0) ? setFocusInLB = i : 0;
|
|
487 |
AddOneListBoxTextLineL( items, R_LOGS_MF_DATA_TEXT );
|
|
488 |
popUpRow[i++] = ELogsFilterData;
|
|
489 |
}
|
|
490 |
if( !( iCurrentFilter == ELogsFilterWlan && count == 0 ) )
|
|
491 |
{
|
|
492 |
if( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) )
|
|
493 |
{
|
|
494 |
(iCurrentFilter == ELogsFilterWlan && count > 0) ? setFocusInLB = i : 0;
|
|
495 |
AddOneListBoxTextLineL( items, R_LOGS_MF_WLAN_TEXT );
|
|
496 |
popUpRow[i++] = ELogsFilterWlan;
|
|
497 |
}
|
|
498 |
}
|
|
499 |
if( count > 0 && MenuBar()->ItemSpecificCommandsEnabled() )
|
|
500 |
{
|
|
501 |
const MLogsEventGetter* event = Engine()->Model( ELogsMainModel )->At( iEventListCurrent );
|
|
502 |
//Seletected event supported only for events that have number or remoty party available, so e.g
|
|
503 |
//payphones, unknowns, privates and poc group calls not supported
|
|
504 |
if( event->Number() || event->RemoteParty() )
|
|
505 |
{
|
|
506 |
(iCurrentFilter == ELogsFilterPerson) ? setFocusInLB = i : 0;
|
|
507 |
AddOneListBoxTextLineL( items, R_LOGS_MF_SELECTED_PERSON_TEXT );
|
|
508 |
popUpRow[i++] = ELogsFilterPerson;
|
|
509 |
}
|
|
510 |
}
|
|
511 |
|
|
512 |
// Create popuplistbox
|
|
513 |
CAknSinglePopupMenuStyleListBox* popupListBox = new( ELeave ) CAknSinglePopupMenuStyleListBox;
|
|
514 |
CleanupStack::PushL( popupListBox );
|
|
515 |
CAknPopupList* popupFrame = CAknPopupList::NewL( popupListBox,
|
|
516 |
R_AVKON_SOFTKEYS_SELECT_CANCEL );
|
|
517 |
CleanupStack::PushL( popupFrame );
|
|
518 |
popupListBox->ConstructL( popupFrame, CEikListBox::ELeftDownInViewRect );
|
|
519 |
|
|
520 |
// Create the model for listbox
|
|
521 |
CTextListBoxModel* model = popupListBox->Model();
|
|
522 |
model->SetItemTextArray( items );
|
|
523 |
model->SetOwnershipType( ELbmDoesNotOwnItemArray ); // items in CleanupStack
|
|
524 |
popupListBox->HandleItemAdditionL();
|
|
525 |
|
|
526 |
// Create title for the Pop-Up window
|
|
527 |
HBufC* title;
|
|
528 |
title = iCoeEnv->AllocReadResourceLC( R_LOGS_MF_SHOW_TEXT );
|
|
529 |
popupFrame->SetTitleL( *title );
|
|
530 |
CleanupStack::PopAndDestroy(); // title
|
|
531 |
|
|
532 |
// Select previous filter (except for the first time or if no rows got using that filter)
|
|
533 |
if( setFocusInLB != KErrNotFound )
|
|
534 |
{
|
|
535 |
popupListBox->SetCurrentItemIndex( setFocusInLB ); //Same choice as on previous filtering
|
|
536 |
}
|
|
537 |
else
|
|
538 |
{
|
|
539 |
popupListBox->SetCurrentItemIndex( 0 );
|
|
540 |
}
|
|
541 |
|
|
542 |
popupListBox->SetTopItemIndex( 0 ); // To see as many lines as possible
|
|
543 |
iContainer->MakeScrollArrowsL( popupListBox ); // Activate scrollbar
|
|
544 |
CleanupStack::Pop( popupFrame );
|
|
545 |
|
|
546 |
TLogsFilter newFilter;
|
|
547 |
|
|
548 |
if( popupFrame->ExecuteLD() )
|
|
549 |
{
|
|
550 |
newFilter = popUpRow[popupListBox->CurrentItemIndex()];
|
|
551 |
}
|
|
552 |
else
|
|
553 |
{
|
|
554 |
newFilter = ELogsFilterNothing; //ELogsFilterNothing is last enum option
|
|
555 |
}
|
|
556 |
|
|
557 |
CleanupStack::PopAndDestroy( popupListBox );
|
|
558 |
CleanupStack::PopAndDestroy( items );
|
|
559 |
return newFilter;
|
|
560 |
}
|
|
561 |
|
|
562 |
|
|
563 |
// ----------------------------------------------------------------------------
|
|
564 |
// CLogsEventListView::CmdFilterL
|
|
565 |
// ----------------------------------------------------------------------------
|
|
566 |
//
|
|
567 |
void CLogsEventListView::CmdFilterL()
|
|
568 |
{
|
|
569 |
TLogsFilter newFilter( InitFilterPopupListL() ); //Show popuplist and get user's selection for filter option
|
|
570 |
|
|
571 |
// Start filtering procedure only if new filter is selected.
|
|
572 |
if( iCurrentFilter != newFilter &&
|
|
573 |
newFilter != ELogsFilterNothing )
|
|
574 |
{
|
|
575 |
iCurrentFilter = newFilter;
|
|
576 |
MLogsReaderConfig* readerConfig;
|
|
577 |
|
|
578 |
if( iCurrentFilter == ELogsFilterPerson &&
|
|
579 |
Engine()->Model( ELogsMainModel )->Count() )
|
|
580 |
{
|
|
581 |
const MLogsEventGetter* event = Engine()->
|
|
582 |
Model( ELogsMainModel )->At( iEventListCurrent );
|
|
583 |
TPtrC number(KNullDesC());
|
|
584 |
TPtrC remote(KNullDesC());
|
|
585 |
if( event->Number() )
|
|
586 |
{
|
|
587 |
number.Set( *(event->Number()) );
|
|
588 |
}
|
|
589 |
if( event->RemoteParty() )
|
|
590 |
{
|
|
591 |
remote.Set( *(event->RemoteParty()) );
|
|
592 |
}
|
|
593 |
|
|
594 |
readerConfig = CLogsReaderConfigFactory::
|
|
595 |
LogsReaderConfigLC( &number,
|
|
596 |
&remote );
|
|
597 |
}
|
|
598 |
else
|
|
599 |
{
|
|
600 |
readerConfig = CLogsReaderConfigFactory::
|
|
601 |
LogsReaderConfigLC( iCurrentFilter );
|
|
602 |
}
|
|
603 |
|
|
604 |
iContainer->ListBox()->SetCurrentItemIndex( 0 );
|
|
605 |
Engine()->Model( ELogsMainModel )->ConfigureL( readerConfig );
|
|
606 |
CleanupStack::PopAndDestroy(); //readerConfig
|
|
607 |
}
|
|
608 |
}
|
|
609 |
|
|
610 |
// ----------------------------------------------------------------------------
|
|
611 |
// CLogsEventListView::CurrentFilter
|
|
612 |
// ----------------------------------------------------------------------------
|
|
613 |
//
|
|
614 |
TLogsFilter CLogsEventListView::CurrentFilter() const
|
|
615 |
{
|
|
616 |
return iCurrentFilter;
|
|
617 |
}
|
|
618 |
|
|
619 |
// ----------------------------------------------------------------------------
|
|
620 |
// CLogsEventListView::StateChangedL
|
|
621 |
//
|
|
622 |
// CLogsModel informs that it has changed the event array (e.g. added an entry or reseted the array etc)
|
|
623 |
// ----------------------------------------------------------------------------
|
|
624 |
//
|
|
625 |
void CLogsEventListView::StateChangedL( MLogsStateHolder* aHolder )
|
|
626 |
{
|
|
627 |
if( !aHolder )
|
|
628 |
{
|
|
629 |
return;
|
|
630 |
}
|
|
631 |
|
|
632 |
iState = aHolder->State();
|
|
633 |
|
|
634 |
// When check contact link finished, call base method to check if need to
|
|
635 |
// refresh menu.
|
|
636 |
if( iState == EStateCheckContactLinkFinished )
|
|
637 |
{
|
|
638 |
CLogsBaseView::StateChangedL( aHolder );
|
|
639 |
return;
|
|
640 |
}
|
|
641 |
|
|
642 |
#ifdef _DEBUG
|
|
643 |
_LIT(KDebugString,"Performance monitoring: Log view list item time %D");
|
|
644 |
if( !iCreationTimeCalculated && Engine()->Model( ELogsMainModel )->Count() > 0 )
|
|
645 |
{
|
|
646 |
iCreationTimeCalculated = ETrue;
|
|
647 |
TTime currentTime;
|
|
648 |
currentTime.UniversalTime();
|
|
649 |
|
|
650 |
RDebug::Print( KDebugString, currentTime.MicroSecondsFrom( iCreationTime ));
|
|
651 |
}
|
|
652 |
#endif
|
|
653 |
|
|
654 |
//Call Update() when related items available to show changes immediately plus when reading is finished.
|
|
655 |
const TInt KNbrShownEntries = 16;
|
|
656 |
|
|
657 |
iState = aHolder->State();
|
|
658 |
|
|
659 |
if( iContainer )
|
|
660 |
{
|
|
661 |
//Optimization: we reduce frequent calling of iContainer->UpdateL(). Although the UpdateL() can be called always when
|
|
662 |
//StateChangedL is called, this slows down the performance significantly
|
|
663 |
|
|
664 |
TBool finished = ( iState != EStateActive && iState != EStateUndefined && iState != EStateInitializing);
|
|
665 |
TInt count( iContainer->ListBox()->Model()->NumberOfItems() );
|
|
666 |
// TInt interval = 50;
|
|
667 |
// TBool update = ( count / interval == (count+interval-1) / interval );//This may cause refreshes *above* the user's current line
|
|
668 |
//when there are changes in db that affect the view. This
|
|
669 |
//causes unpleasant jumping in the view so no need to update.
|
|
670 |
|
|
671 |
//Magic number KNbrShownEntries: Call Update() when first screenful of items available or when reading finished, stopped,
|
|
672 |
//interrupted etc. Also call update when about to start to read (count==0) in order to show "Retrieving data".
|
|
673 |
if( count == 0 || count == KNbrShownEntries || finished ) // || update )
|
|
674 |
{
|
|
675 |
iContainer->UpdateL();
|
|
676 |
|
|
677 |
//Show MSK if anything on list
|
|
678 |
Cba()->MakeCommandVisible(
|
|
679 |
ELogsCmdMenuDetails,
|
|
680 |
count );
|
|
681 |
|
|
682 |
//Perform some time consuming operations if not yet already done
|
|
683 |
if( count == KNbrShownEntries || finished )
|
|
684 |
{
|
|
685 |
ConstructDelayedL( ETrue ); //ETrue: perform using idle time
|
|
686 |
iEventListCurrent = iContainer->ListBox()->CurrentItemIndex();
|
|
687 |
const MLogsEventGetter* event = Engine()->
|
|
688 |
Model( ELogsMainModel )->At( iEventListCurrent );
|
|
689 |
|
|
690 |
if (finished)
|
|
691 |
{
|
|
692 |
//Checks wheter the options menu was opened already and should it be refreshed
|
|
693 |
//now that the reading is finishing
|
|
694 |
HandleMenuRefreshL( event );
|
|
695 |
// just in case inputblocker still alive
|
|
696 |
iClearListInProgress = EFalse;
|
|
697 |
RemoveInputBlocker();
|
|
698 |
}
|
|
699 |
}
|
|
700 |
}
|
|
701 |
}
|
|
702 |
}
|
|
703 |
|
|
704 |
// ----------------------------------------------------------------------------
|
|
705 |
// CLogsEventListView::State
|
|
706 |
// ----------------------------------------------------------------------------
|
|
707 |
//
|
|
708 |
TLogsState CLogsEventListView::State() const
|
|
709 |
{
|
|
710 |
return iState;
|
|
711 |
}
|
|
712 |
|
|
713 |
// End of File
|