os/persistentdata/loggingservices/eventlogger/LogCli/src/LOGVIEW.CPP
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <logview.h>
    17 
    18 // User includes
    19 #include <logwrap.h>
    20 #include <logcli.h>
    21 #include "logclipanic.h"
    22 #include "logservcli.h"
    23 #include "logpackage.h"
    24 #include "logclientop.h"
    25 #include "LogViewObserver.h"
    26 #include "LogViewWindow.h"
    27 
    28 // Constants
    29 const TInt KLogDefaultWindowSize = 10;
    30 
    31 //**********************************
    32 // CLogView
    33 //**********************************
    34 
    35 CLogView::CLogView(CLogClient& aClient, TInt aPriority/* = CActive:EPriorityStandard*/)
    36 : CLogActive(aPriority), iClient(aClient)
    37 	{
    38 	// Get the view id
    39 	iViewId = iClient.Session().AllocateIdView();
    40 	}
    41 
    42 EXPORT_C CLogView::~CLogView()
    43 /** Frees all resources owned by this object prior to its destruction. In particular, 
    44 any outstanding asynchronous request is cancelled. */
    45 	{
    46 	Cancel();
    47 
    48 	delete iEvent;
    49 	delete iPackage;
    50 	delete iMaintain;
    51 	delete iLogViewObserver;
    52 	delete iWindow;
    53 
    54 	// Delete the view
    55 	iClient.Session().Send(ELogViewDelete, TIpcArgs(iViewId)); // Not much we can do if this goes wrong
    56 	}
    57 
    58 void CLogView::ConstructL(TInt aType, MLogViewChangeObserver* aObserver)
    59 	{
    60 	iType = aType;
    61 	iLogViewChangeObserver = aObserver;
    62 	iPackage = CLogPackage::NewL();
    63 	iEvent = CLogEvent::NewL();
    64 	iMaintain = new(ELeave)CLogMaintainClientOp(iClient.Session(), *iPackage, Priority());
    65 
    66 	PrepareViewChildrenL();
    67 	}
    68 
    69 void CLogView::NotifyLogServerTerminatedL()
    70 	{
    71 	PrepareViewChildrenL();
    72 	}
    73 
    74 void CLogView::PrepareViewChildrenL()
    75 	{
    76 	// Construct the view in the server
    77 	TIpcArgs aArgs;
    78 	aArgs.Set(0, iViewId);
    79 	aArgs.Set(1, iType);
    80 
    81 	User::LeaveIfError(iClient.Session().Send(ELogViewCreate, aArgs));
    82 	CLogViewWindow* window = new(ELeave)
    83 		CLogViewWindow(iClient.Session(), iViewId, KLogDefaultWindowSize,
    84 		iLogViewChangeObserver, CActive::EPriorityIdle);
    85 	
    86 	delete iWindow;
    87 	iWindow = window;
    88 	iWindow->ConstructL(*iPackage);
    89 
    90 	// The Log view observer receives all events from the log server. It then cascades them to an object owned by
    91 	// the log window. In turn this object (CLogViewWindowChangeObserver) cascades them back to the log window.
    92 	// Finally, the log window passes them back up to the client of the log engine, i.e aObserver.
    93 	CLogViewObserver* observer = CLogViewObserver::NewL(*this, iClient, iWindow->ChangeObserver(), iViewId, Priority());
    94 	delete iLogViewObserver;
    95 	iLogViewObserver = observer;
    96 	}
    97 
    98 EXPORT_C TBool CLogView::FirstL(TRequestStatus& aStatus)
    99 /** Moves the current position in the view to the first event. The first event 
   100 is the most recent event.
   101 
   102 This is an asynchronous request.
   103 
   104 @param aStatus The request status. On request completion, contains:KErrNone, 
   105 if the position in the view has been successfully moved; otherwise, one of 
   106 the other system wide error codes.
   107 @return ETrue, if the function has successfully issued the asynchronous request. 
   108 EFalse, if there are no events in the view. */
   109 	{
   110 	return NavigateL(ELogNavigateFirst, aStatus);
   111 	}
   112 
   113 EXPORT_C TBool CLogView::LastL(TRequestStatus& aStatus)
   114 /** Moves the current position in the view to the last event. The last event is 
   115 the oldest event.
   116 
   117 This is an asynchronous request.
   118 
   119 @param aStatus The request status. On request completion, contains:KErrNone, 
   120 if the position in the view has been successfully moved; otherwise, one of 
   121 the other system wide error codes.
   122 @return ETrue, if the function has successfully issued the asynchronous request. 
   123 EFalse, if there are no events in the view. */
   124 	{
   125 	return NavigateL(ELogNavigateLast, aStatus);
   126 	}
   127 
   128 EXPORT_C TBool CLogView::NextL(TRequestStatus& aStatus)
   129 /** Moves the current position in the view to the next event. The next event is 
   130 always older than the current event, i.e. next implies movement in the first 
   131 to last direction.
   132 
   133 @param aStatus The request status. On request completion, contains:KErrNone, 
   134 if the position in the view has been successfully moved; otherwise, one of 
   135 the other system wide error codes.
   136 @return ETrue, if the function has successfully issued the asynchronous request. 
   137 EFalse, if there are no events in the view. */
   138 	{
   139 	return NavigateL(ELogNavigateForwards, aStatus);
   140 	}
   141 
   142 EXPORT_C TBool CLogView::PreviousL(TRequestStatus& aStatus)
   143 /** Moves the current position in the view to the previous event. The previous 
   144 event is always more recent than the current event, i.e. previous implies 
   145 movement in the last to first direction.
   146 
   147 @param aStatus The request status. On request completion, contains:KErrNone, 
   148 if the position in the view has been successfully moved; otherwise, one of 
   149 the other system wide error codes.
   150 @return ETrue, if the function has successfully issued the asynchronous request. 
   151 EFalse, if there are no events in the view. */
   152 	{
   153 	return NavigateL(ELogNavigateBackwards, aStatus);
   154 	}
   155 
   156 EXPORT_C TInt CLogView::CountL()
   157 /** Gets the number of events in the view.
   158 
   159 @return The number of events in the view. */
   160 	{
   161 	// Just return zero if the view isn't setup
   162 	if	(!IsValid() && !LogViewRecordCount())
   163 		{
   164 		return 0;
   165 		}
   166 
   167 	// Ask the server the number of events in this view
   168 	const TInt count = iClient.Session().Send(ELogViewCount, TIpcArgs(iViewId));
   169 
   170 	User::LeaveIfError(count);
   171 	return count;
   172 	}
   173 
   174 EXPORT_C void CLogView::SetFlagsL(TLogFlags aFlags)
   175 /**
   176 @capability Note For built-in event types, the required capability level is defined in
   177 the event type's write access policy. */
   178 	{
   179 	// To preserve the same server side interface as an operation
   180 	TPckgBuf<TLogClientServerData> data;
   181 	data().iOperationType = ELogOperationViewSetFlags;
   182 	data().iOperationId = KLogNullOperationId;
   183 	//
   184 	User::LeaveIfError(iClient.Session().Send(ELogViewOperationInitiate, TIpcArgs(&data,iViewId,aFlags)));
   185 	}
   186 
   187 TBool CLogView::NavigateL(TInt aPosition, TRequestStatus& aStatus)
   188 	{
   189 	__ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive1));
   190 	if (!IsValid() && !LogViewRecordCount())
   191 		{
   192 		return EFalse;
   193 		}
   194 	//
   195 	const TLogNavigation navigationPosition = static_cast<TLogNavigation>(aPosition);
   196 	const TBool requestIssued = iWindow->NavigateL(navigationPosition, iStatus);
   197 	//
   198 	if	(requestIssued)
   199 		{
   200 		Queue(aStatus);
   201 		SetActive();
   202 		// iValid is false if at time of SetFilterL there is no event.
   203 		// If iWindow->NavigateL returns ETrue then there are always
   204 		// events in the view.
   205 		iValid = ETrue;
   206 		}
   207 	//
   208 	return requestIssued;
   209 	}
   210 
   211 void CLogView::DoRunL()
   212 	{
   213 	if	(iStatus.Int() == KErrNone)
   214 		ReadEventFromWindowL();
   215 	}
   216 
   217 void CLogView::DoCancel()
   218 	{
   219 	iWindow->Cancel();
   220 	CLogActive::DoCancel();
   221 	}
   222 
   223 void CLogView::ReadEventFromWindowL()
   224 	{
   225 	CLogEvent* event = CLogEvent::NewL();
   226 	delete iEvent;
   227 	iEvent = event;
   228 	iEvent->CopyL(iWindow->CurrsorEvent());
   229 	}
   230 
   231 void CLogView::ReawaitForChanges()
   232 	{
   233 	iLogViewObserver->Cancel();
   234 	iLogViewObserver->RequestChanges();
   235 	}
   236 
   237 //
   238 // The CLogViewWindow member has an observer to receive changes
   239 // in events. If events are added to database after SetFilterL then
   240 // iWindow would know about them.
   241 TInt CLogView::LogViewRecordCount() const
   242 	{
   243 	if (iWindow)
   244 		{
   245 		return iWindow->ViewRecordCount();
   246 		}
   247 	return 0;
   248 	}
   249 
   250 
   251 
   252 
   253 
   254 
   255 
   256 
   257 
   258 
   259 
   260 
   261 
   262 
   263 
   264 
   265 //**********************************
   266 // CLogViewEvent
   267 //**********************************
   268 
   269 CLogViewEvent::CLogViewEvent(CLogClient& aClient, TInt aPriority)
   270 : CLogView(aClient, aPriority)
   271 	{
   272 	}
   273 
   274 EXPORT_C CLogViewEvent::~CLogViewEvent()
   275 /** Frees all resources owned by the object prior to its destruction. In particular, 
   276 any outstanding asynchronous request is cancelled */
   277 	{
   278 	Cancel();
   279 	}
   280 
   281 void CLogViewEvent::ConstructL(MLogViewChangeObserver* aObserver)
   282 	{
   283 	CLogView::ConstructL(ELogViewTypeEvent, aObserver);
   284 	}
   285 
   286 EXPORT_C CLogViewEvent* CLogViewEvent::NewL(CLogClient& aClient, TInt aPriority)
   287 	{
   288 	CLogViewEvent* self = new(ELeave)CLogViewEvent(aClient, aPriority);
   289 	CleanupStack::PushL(self);
   290 	self->ConstructL();
   291 	CleanupStack::Pop(self);
   292 	return self;
   293 	}
   294 
   295 EXPORT_C CLogViewEvent* CLogViewEvent::NewL(CLogClient& aClient, MLogViewChangeObserver& aObserver, TInt aPriority)
   296 	{
   297 	CLogViewEvent* self = new(ELeave)CLogViewEvent(aClient, aPriority);
   298 	CleanupStack::PushL(self);
   299 	self->ConstructL(&aObserver);
   300 	CleanupStack::Pop(self);
   301 	return self;
   302 	}
   303 
   304 EXPORT_C TBool CLogViewEvent::SetFilterL(const CLogFilter& aFilter, TRequestStatus& aStatus)
   305 /** Initialises or refreshes the event view defined by the specified filter.
   306 
   307 The view can only be used after the request completes successfully.
   308 
   309 @param aFilter The filter. 
   310 @param aStatus The request status. On request completion, contains:KErrNone, 
   311 if the view has been successfully initialised or refreshed;one of the other 
   312 system wide error codes, otherwise. 
   313 @return ETrue, if the function has successfully issued the asynchronous request. 
   314 EFalse, if there are no events in the view. 
   315 @capability Note None required.*/
   316 	{
   317 	CLogFilterList* list = new(ELeave)CLogFilterList;
   318 	CleanupStack::PushL(list);
   319 	list->AppendL(&aFilter);
   320 	TBool result = SetFilterL(*list, aStatus);
   321 	CleanupStack::PopAndDestroy(); // list
   322 	return result;
   323 	}
   324 
   325 EXPORT_C TBool CLogViewEvent::SetFilterL(const CLogFilterList& aFilterList, TRequestStatus& aStatus)
   326 /** Initialises or refreshes the event view defined by the set of specified filters.
   327 
   328 The view can only be used after the request completes successfully.
   329 
   330 @param aFilterList The set of filters. 
   331 @param aStatus The request status. On request completion, contains:KErrNone, 
   332 if the view has been successfully initialised or refreshed;one of the other 
   333 system wide error codes, otherwise. 
   334 @return ETrue, if the function has successfully issued the asynchronous request. 
   335 EFalse, if there are no events in the view. 
   336 @capability Note None required.  */
   337 	{
   338 	// Start maintenance of the database - ignore errors
   339 	iMaintain->Start();
   340 
   341 	// Package the parameters
   342 	iPackage->SetLogFilterListL(aFilterList);
   343 
   344 	// Setup the view
   345 	const TInt count = iWindow->Setup(aFilterList, 0, ELogFilterConstructFilterByFilterFieldByField);
   346 	User::LeaveIfError(count);
   347 	iValid = count;
   348 	ReawaitForChanges();
   349 
   350 	if(count)
   351 		{
   352 		// Get the required event
   353 		iValid = FirstL(aStatus);
   354 		return iValid;
   355 		}
   356 	return EFalse;
   357 	}
   358 
   359 EXPORT_C TBool CLogViewEvent::SetFilterParseFilterByFilterL(const CLogFilterList& aFilterList, TRequestStatus& aStatus)
   360 /**
   361 @capability Note None required.  */
   362 	{
   363 	// Start maintenance of the database - ignore errors
   364 	iMaintain->Start();
   365 
   366 	// Package the parameters
   367 	iPackage->SetLogFilterListL(aFilterList);
   368 
   369 	// Setup the view
   370 	const TInt count = iWindow->Setup(aFilterList, 0, ELogFilterConstructFieldByFieldFilterByFilter);
   371 	User::LeaveIfError(count);
   372 	iValid = count;
   373 	ReawaitForChanges();
   374 
   375 	if(count)
   376 		{
   377 		// Get the required event
   378 		iValid = FirstL(aStatus);
   379 		return iValid;
   380 		}
   381 	return EFalse;
   382 	}
   383 
   384 
   385 
   386 
   387 
   388 
   389 
   390 
   391 
   392 
   393 
   394 
   395 
   396 
   397 
   398 
   399 
   400 
   401 
   402 
   403 
   404 
   405 
   406 //**********************************
   407 // CLogViewRecent
   408 //**********************************
   409 
   410 CLogViewRecent::CLogViewRecent(CLogClient& aClient, TInt aPriority)
   411 : CLogView(aClient, aPriority)
   412 	{
   413 	}
   414 
   415 EXPORT_C CLogViewRecent::~CLogViewRecent()
   416 /** Frees resources owned by the object priot to its destruction. */
   417 	{
   418 	Cancel();
   419 	delete iRemove;
   420 	}
   421 
   422 void CLogViewRecent::ConstructL(MLogViewChangeObserver* aObserver)
   423 	{
   424 	// Construct the view
   425 	CLogView::ConstructL(ELogViewTypeRecent, aObserver);
   426 
   427 	iRemove = new(ELeave) CLogViewRemoveEventClientOp(iClient.Session(), *iPackage, Priority());
   428 	}
   429 
   430 EXPORT_C CLogViewRecent* CLogViewRecent::NewL(CLogClient& aClient, TInt aPriority)
   431 	{
   432 	CLogViewRecent* self = new(ELeave) CLogViewRecent(aClient, aPriority);
   433 	CleanupStack::PushL(self);
   434 	self->ConstructL();
   435 	CleanupStack::Pop(); // self
   436 	return self;
   437 	}
   438 
   439 EXPORT_C CLogViewRecent* CLogViewRecent::NewL(CLogClient& aClient, MLogViewChangeObserver& aObserver, TInt aPriority)
   440 	{
   441 	CLogViewRecent* self = new(ELeave) CLogViewRecent(aClient, aPriority);
   442 	CleanupStack::PushL(self);
   443 	self->ConstructL(&aObserver);
   444 	CleanupStack::Pop(self);
   445 	return self;
   446 	}
   447 
   448 EXPORT_C TBool CLogViewRecent::SetRecentListL(TLogRecentList aList, TRequestStatus& aStatus)
   449 /** Initialises or refreshes the view for the specified recent event list. This 
   450 is an asynchronous request.
   451 
   452 On successful completion, the view is positioned at the first, i.e. most recent, 
   453 event within the recent event list.
   454 
   455 @param aList The recent event list specifier. A value of KLogNullRecentList 
   456 indicates that the view is to include events from all of the recent event 
   457 lists.
   458 @param aStatus The request status. On request completion, contains:KErrNone, 
   459 if the view has been successfully initialised or refreshed; otherwise, one 
   460 of the other system wide error codes.
   461 @return ETrue, if the function has successfully issued the asynchronous request. 
   462 EFalse, if there are no events in the view. 
   463 @capability Note None required.  */
   464 	{
   465 	CLogFilter* filter = CLogFilter::NewL();
   466 	CleanupStack::PushL(filter);
   467 	TBool result = SetRecentListL(aList, *filter, aStatus);
   468 	CleanupStack::PopAndDestroy(); // filter
   469 	return result;
   470 	}
   471 
   472 EXPORT_C TBool CLogViewRecent::SetRecentListL(TLogRecentList aList, const CLogFilter& aFilter, TRequestStatus& aStatus)
   473 /** Initialises or refreshes the view for the specified recent event list, conforming 
   474 to the specified filter. This is an asynchronous request.
   475 
   476 On successful completion, the view is positioned at the first, i.e. most recent, 
   477 event in the recent event list.
   478 
   479 @param aList The recent event list specifier. A value of KLogNullRecentList 
   480 indicates that the view is to include events from all of the recent event 
   481 lists.
   482 @param aFilter The filter.
   483 @param aStatus The request status. On request completion, contains:KErrNone, 
   484 if the view has been successfully initialised or refreshed; otherwise, one 
   485 of the other system wide error codes.
   486 @return ETrue, if the function has successfully issued the asynchronous request. 
   487 EFalse, if there are no events in the view. 
   488 @capability Note None required.  */
   489 	{
   490 	CLogFilterList* list = new(ELeave)CLogFilterList;
   491 	CleanupStack::PushL(list);
   492 	list->AppendL(&aFilter);
   493 	TBool result = SetRecentListL(aList, *list, aStatus);
   494 	CleanupStack::PopAndDestroy(); // list
   495 	return result;
   496 	}
   497 
   498 EXPORT_C TBool CLogViewRecent::SetRecentListL(TLogRecentList aList, const CLogFilterList& aFilterList, TRequestStatus& aStatus)
   499 /** Initialises or refreshes the view for the specified recent event list, conforming 
   500 to the set of specified filters. This is an asynchronous request.
   501 
   502 On successful completion, the view is positioned at the first, i.e. most recent, 
   503 event in the recent event list.
   504 
   505 @param aList The recent event list specifier. A value of KLogNullRecentList 
   506 indicates that the view is to include events from all of the recent event 
   507 lists.
   508 @param aFilterList The set of filters.
   509 @param aStatus The request status. On request completion, contains:KErrNone, 
   510 if the view has been successfully initialised or refreshed; otherwise, one 
   511 of the other system wide error codes.
   512 @return ETrue, if the function has successfully issued the asynchronous request. 
   513 EFalse, if there are no events in the view. 
   514 @capability Note None required.  */
   515 	{
   516 	// Start maintenance of the database - ignore errors
   517 	iMaintain->Start();
   518 
   519 	// Package the parameters
   520 	iPackage->SetLogFilterListL(aFilterList);
   521 
   522 	// Setup the view
   523 	TInt count = iWindow->Setup(aFilterList, aList, ELogFilterConstructFilterByFilterFieldByField);
   524 	User::LeaveIfError(count);
   525 	iValid = count;
   526 	ReawaitForChanges();
   527 
   528 	// Initialise list ids
   529 	iRecentList = aList;
   530 	iCurrentList = aList;
   531 
   532 	// This receives the current recent list id from the server
   533 	iCurrentListBuf() = iCurrentList;
   534 	iData = &iCurrentListBuf;
   535 
   536 	if(count)
   537 		{
   538 		// Get the required event
   539 		iValid = FirstL(aStatus);
   540 		return iValid;
   541 		}
   542 	return EFalse;
   543 	}
   544 
   545 EXPORT_C void CLogViewRecent::RemoveL(TLogId aId)
   546 /** Removes the event with the specified unique event ID from the view. This does 
   547 not delete the event from the main event log.
   548 
   549 @param aId The unique event ID. 
   550 @capability WriteDeviceData  */
   551 	{
   552 	User::LeaveIfError(iRemove->Start(iViewId, aId));
   553 	iWindow->RemoveFromWindowIfPresentL(aId);
   554 	}
   555 
   556 EXPORT_C TBool CLogViewRecent::RemoveL(TRequestStatus& aStatus)
   557 /** Removes the current event from its recent event list. This is an asynchronous 
   558 request.
   559 
   560 This does not delete the event from the main event log.
   561 
   562 The function moves the current position in the view to the first, i.e. most 
   563 recent, event.
   564 
   565 Note that removing a recent event from a recent event list also removes all 
   566 of its duplicates.
   567 
   568 @param aStatus The request status. On request completion, contains:KErrNone, 
   569 if the view has been successfully initialised or refreshed; otherwise, one 
   570 of the other system wide error codes.
   571 @return ETrue, if the function has successfully issued the asynchronous request. 
   572 EFalse, if there are no events in the view. 
   573 @capability WriteDeviceData  */
   574 	{
   575 	__ASSERT_DEBUG(IsValid(), Panic(ELogNotValid1));
   576 	RemoveL(Event().Id());
   577 	return FirstL(aStatus);
   578 	}
   579 
   580 EXPORT_C TBool CLogViewRecent::DuplicatesL(CLogViewDuplicate& aView, TRequestStatus& aStatus)
   581 /** Refreshes the specified duplicate event view with the duplicates of the current 
   582 event in the recent event list view. This is an asynchronous request.
   583 
   584 On successful completion, the view is positioned at the first, i.e. most recent, 
   585 event within the view.
   586 
   587 @param aView The duplicates view to be refreshed.
   588 @param aStatus The request status. On request completion, contains:KErrNone, 
   589 if the view has been successfully refreshed; otherwise, one of the other system 
   590 wide error codes.
   591 @return ETrue, if the function has successfully issued the asynchronous request. 
   592 EFalse, if there are no events in the view. 
   593 @capability Note None required.  */
   594 	{
   595 	__ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive5));
   596 	return IsValid() && aView.SetEventL(Event().Id(), aStatus);
   597 	}
   598 
   599 EXPORT_C TBool CLogViewRecent::DuplicatesL(CLogViewDuplicate& aView, const CLogFilter& aFilter, TRequestStatus& aStatus)
   600 /** Refreshes the specified duplicate event view with the duplicates of the current 
   601 event in the recent event list view and conforming to the specified filter. 
   602 This is an asynchronous request.
   603 
   604 On successful completion, the view is positioned at the first, i.e. most recent, 
   605 event within the view.
   606 
   607 @param aView The duplicates view to be refreshed.
   608 @param aFilter The filter.
   609 @param aStatus The request status. On request completion, contains:KErrNone, 
   610 if the view has been successfully refreshed; otherwise, one of the other system 
   611 wide error codes.
   612 @return ETrue, if the function has successfully issued the asynchronous request. 
   613 EFalse, if there are no events in the view. 
   614 @capability Note None required.*/
   615 	{
   616 	__ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive6));
   617 	return IsValid() && aView.SetEventL(Event().Id(), aFilter, aStatus);
   618 	}
   619 
   620 EXPORT_C TBool CLogViewRecent::DuplicatesL(CLogViewDuplicate& aView, const CLogFilterList& aFilterList, TRequestStatus& aStatus)
   621 /** Refreshes the specified duplicate event view with the duplicates of the current 
   622 event in the recent event list view and conforming to the set of specified 
   623 filters. This is an asynchronous request.
   624 
   625 On successful completion, the view is positioned at the first, i.e. most recent, 
   626 event within the view.
   627 
   628 @param aView The duplicates view to be refreshed.
   629 @param aFilterList The set of filters.
   630 @param aStatus The request status. On request completion, contains:KErrNone, 
   631 if the view has been successfully refreshed; otherwise, one of the other system 
   632 wide error codes.
   633 @return ETrue, if the function has successfully issued the asynchronous request. 
   634 EFalse, if there are no events in the view. 
   635 @capability Note None required.*/
   636 	{
   637 	__ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive7));
   638 	return IsValid() && aView.SetEventL(Event().Id(), aFilterList, aStatus);
   639 	}
   640 
   641 EXPORT_C void CLogViewRecent::ClearDuplicatesL()
   642 /**
   643 @capability WriteDeviceData  */
   644 	{
   645 	__ASSERT_DEBUG(IsValid(), Panic(ELogNotValid3));
   646 
   647 	// To preserve the same server side interface as an operation
   648 	TPckgBuf<TLogClientServerData> data;
   649 	data().iOperationType = ELogOperationViewClearDuplicates;
   650 	data().iOperationId = KLogNullOperationId;
   651 	//
   652 	User::LeaveIfError(iClient.Session().Send(ELogViewOperationInitiate, TIpcArgs(&data,iViewId)));
   653 	}
   654 
   655 void CLogViewRecent::DoRunL()
   656 	{
   657 	// To fetch the event
   658 	ReadEventFromWindowL();
   659 
   660 	// A fix to maintain source compatibility
   661 	iCurrentList = iCurrentListBuf();
   662 	}
   663 
   664 
   665 
   666 
   667 
   668 
   669 
   670 
   671 
   672 
   673 
   674 
   675 
   676 
   677 
   678 
   679 
   680 
   681 //**********************************
   682 // CLogViewDuplicate
   683 //**********************************
   684 
   685 CLogViewDuplicate::CLogViewDuplicate(CLogClient& aClient, TInt aPriority)
   686 : CLogView(aClient, aPriority)
   687 	{
   688 	}
   689 
   690 EXPORT_C CLogViewDuplicate::~CLogViewDuplicate()
   691 	{
   692 	Cancel();
   693 	delete iRemove;
   694 	}
   695 
   696 void CLogViewDuplicate::ConstructL(MLogViewChangeObserver* aObserver)
   697 	{
   698 	CLogView::ConstructL(ELogViewTypeDuplicate, aObserver);
   699 
   700 	iRemove = new(ELeave) CLogViewRemoveEventClientOp(iClient.Session(), *iPackage, Priority());
   701 	}
   702 
   703 EXPORT_C CLogViewDuplicate* CLogViewDuplicate::NewL(CLogClient& aClient, TInt aPriority)
   704 	{
   705 	CLogViewDuplicate* self = new(ELeave)CLogViewDuplicate(aClient, aPriority);
   706 	CleanupStack::PushL(self);
   707 	self->ConstructL();
   708 	CleanupStack::Pop();
   709 	return self;
   710 	}
   711 
   712 EXPORT_C CLogViewDuplicate* CLogViewDuplicate::NewL(CLogClient& aClient, MLogViewChangeObserver& aObserver, TInt aPriority)
   713 	{
   714 	CLogViewDuplicate* self = new(ELeave) CLogViewDuplicate(aClient, aPriority);
   715 	CleanupStack::PushL(self);
   716 	self->ConstructL(&aObserver);
   717 	CleanupStack::Pop(self);
   718 	return self;
   719 	}
   720 
   721 TBool CLogViewDuplicate::SetEventL(TLogId aId, TRequestStatus& aStatus)
   722 	{
   723 	CLogFilter* filter = CLogFilter::NewL();
   724 	CleanupStack::PushL(filter);
   725 	TBool result = SetEventL(aId, *filter, aStatus);
   726 	CleanupStack::PopAndDestroy(); // filter
   727 	return result;
   728 	}
   729 
   730 TBool CLogViewDuplicate::SetEventL(TLogId aId, const CLogFilter& aFilter, TRequestStatus& aStatus)
   731 	{
   732 	CLogFilterList* list = new(ELeave)CLogFilterList;
   733 	CleanupStack::PushL(list);
   734 	list->AppendL(&aFilter);
   735 	TBool result = SetEventL(aId, *list, aStatus);
   736 	CleanupStack::PopAndDestroy(); // list
   737 	return result;
   738 	}
   739 
   740 TBool CLogViewDuplicate::SetEventL(TLogId aId, const CLogFilterList& aFilterList, TRequestStatus& aStatus)
   741 	{
   742 	// Start maintenance of the database - ignore errors
   743 	iMaintain->Start();
   744 
   745 	// Package the parameters
   746 	iPackage->SetLogFilterListL(aFilterList);
   747 
   748 	// Setup the view
   749 	TInt count = iWindow->Setup(aFilterList, aId, ELogFilterConstructFilterByFilterFieldByField);
   750 	User::LeaveIfError(count);
   751 	iValid = count;
   752 	iSourceId = aId;
   753 	ReawaitForChanges();
   754 
   755 	if(count)
   756 		{
   757 		// Get the required event
   758 		iValid = FirstL(aStatus);
   759 		return iValid;
   760 		}
   761 	return EFalse;
   762 	}
   763 
   764 EXPORT_C void CLogViewDuplicate::RemoveL(TLogId aId)
   765 /** Removes the event with the specified unique event ID from the view. This does 
   766 not delete the event from the main event log.
   767 
   768 @param aId The unique event ID. 
   769 @capability WriteDeviceData  */
   770 	{
   771 	// Note: Duplicate views reset themselves
   772 	__ASSERT_DEBUG(IsValid(), Panic(ELogNotValid2));
   773 	User::LeaveIfError(iRemove->Start(iViewId, aId));
   774 	iWindow->RemoveFromWindowIfPresentL(aId);
   775 	}
   776 
   777 EXPORT_C TBool CLogViewDuplicate::RemoveL(TRequestStatus& aStatus)
   778 /** Removes the current event from the duplicate list. This is an asynchronous 
   779 request.
   780 
   781 This does not delete the event from the main event log.
   782 
   783 The function moves the current position in the view to the first, i.e. most 
   784 recent, event.
   785 
   786 @param aStatus The request status. On request completion, contains: KErrNone, 
   787 if the view has been successfully initialised or refreshed; otherwise, one 
   788 of the other system wide error codes.
   789 @return ETrue, if the function has successfully issued the asynchronous request. 
   790 EFalse, if there are no events in the view. 
   791 @capability WriteDeviceData  */
   792 	{
   793 	RemoveL(Event().Id());
   794 	return FirstL(aStatus);
   795 	}