sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: sl@0: // User includes sl@0: #include sl@0: #include sl@0: #include "logclipanic.h" sl@0: #include "logservcli.h" sl@0: #include "logpackage.h" sl@0: #include "logclientop.h" sl@0: #include "LogViewObserver.h" sl@0: #include "LogViewWindow.h" sl@0: sl@0: // Constants sl@0: const TInt KLogDefaultWindowSize = 10; sl@0: sl@0: //********************************** sl@0: // CLogView sl@0: //********************************** sl@0: sl@0: CLogView::CLogView(CLogClient& aClient, TInt aPriority/* = CActive:EPriorityStandard*/) sl@0: : CLogActive(aPriority), iClient(aClient) sl@0: { sl@0: // Get the view id sl@0: iViewId = iClient.Session().AllocateIdView(); sl@0: } sl@0: sl@0: EXPORT_C CLogView::~CLogView() sl@0: /** Frees all resources owned by this object prior to its destruction. In particular, sl@0: any outstanding asynchronous request is cancelled. */ sl@0: { sl@0: Cancel(); sl@0: sl@0: delete iEvent; sl@0: delete iPackage; sl@0: delete iMaintain; sl@0: delete iLogViewObserver; sl@0: delete iWindow; sl@0: sl@0: // Delete the view sl@0: iClient.Session().Send(ELogViewDelete, TIpcArgs(iViewId)); // Not much we can do if this goes wrong sl@0: } sl@0: sl@0: void CLogView::ConstructL(TInt aType, MLogViewChangeObserver* aObserver) sl@0: { sl@0: iType = aType; sl@0: iLogViewChangeObserver = aObserver; sl@0: iPackage = CLogPackage::NewL(); sl@0: iEvent = CLogEvent::NewL(); sl@0: iMaintain = new(ELeave)CLogMaintainClientOp(iClient.Session(), *iPackage, Priority()); sl@0: sl@0: PrepareViewChildrenL(); sl@0: } sl@0: sl@0: void CLogView::NotifyLogServerTerminatedL() sl@0: { sl@0: PrepareViewChildrenL(); sl@0: } sl@0: sl@0: void CLogView::PrepareViewChildrenL() sl@0: { sl@0: // Construct the view in the server sl@0: TIpcArgs aArgs; sl@0: aArgs.Set(0, iViewId); sl@0: aArgs.Set(1, iType); sl@0: sl@0: User::LeaveIfError(iClient.Session().Send(ELogViewCreate, aArgs)); sl@0: CLogViewWindow* window = new(ELeave) sl@0: CLogViewWindow(iClient.Session(), iViewId, KLogDefaultWindowSize, sl@0: iLogViewChangeObserver, CActive::EPriorityIdle); sl@0: sl@0: delete iWindow; sl@0: iWindow = window; sl@0: iWindow->ConstructL(*iPackage); sl@0: sl@0: // The Log view observer receives all events from the log server. It then cascades them to an object owned by sl@0: // the log window. In turn this object (CLogViewWindowChangeObserver) cascades them back to the log window. sl@0: // Finally, the log window passes them back up to the client of the log engine, i.e aObserver. sl@0: CLogViewObserver* observer = CLogViewObserver::NewL(*this, iClient, iWindow->ChangeObserver(), iViewId, Priority()); sl@0: delete iLogViewObserver; sl@0: iLogViewObserver = observer; sl@0: } sl@0: sl@0: EXPORT_C TBool CLogView::FirstL(TRequestStatus& aStatus) sl@0: /** Moves the current position in the view to the first event. The first event sl@0: is the most recent event. sl@0: sl@0: This is an asynchronous request. sl@0: sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the position in the view has been successfully moved; otherwise, one of sl@0: the other system wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. */ sl@0: { sl@0: return NavigateL(ELogNavigateFirst, aStatus); sl@0: } sl@0: sl@0: EXPORT_C TBool CLogView::LastL(TRequestStatus& aStatus) sl@0: /** Moves the current position in the view to the last event. The last event is sl@0: the oldest event. sl@0: sl@0: This is an asynchronous request. sl@0: sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the position in the view has been successfully moved; otherwise, one of sl@0: the other system wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. */ sl@0: { sl@0: return NavigateL(ELogNavigateLast, aStatus); sl@0: } sl@0: sl@0: EXPORT_C TBool CLogView::NextL(TRequestStatus& aStatus) sl@0: /** Moves the current position in the view to the next event. The next event is sl@0: always older than the current event, i.e. next implies movement in the first sl@0: to last direction. sl@0: sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the position in the view has been successfully moved; otherwise, one of sl@0: the other system wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. */ sl@0: { sl@0: return NavigateL(ELogNavigateForwards, aStatus); sl@0: } sl@0: sl@0: EXPORT_C TBool CLogView::PreviousL(TRequestStatus& aStatus) sl@0: /** Moves the current position in the view to the previous event. The previous sl@0: event is always more recent than the current event, i.e. previous implies sl@0: movement in the last to first direction. sl@0: sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the position in the view has been successfully moved; otherwise, one of sl@0: the other system wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. */ sl@0: { sl@0: return NavigateL(ELogNavigateBackwards, aStatus); sl@0: } sl@0: sl@0: EXPORT_C TInt CLogView::CountL() sl@0: /** Gets the number of events in the view. sl@0: sl@0: @return The number of events in the view. */ sl@0: { sl@0: // Just return zero if the view isn't setup sl@0: if (!IsValid() && !LogViewRecordCount()) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: // Ask the server the number of events in this view sl@0: const TInt count = iClient.Session().Send(ELogViewCount, TIpcArgs(iViewId)); sl@0: sl@0: User::LeaveIfError(count); sl@0: return count; sl@0: } sl@0: sl@0: EXPORT_C void CLogView::SetFlagsL(TLogFlags aFlags) sl@0: /** sl@0: @capability Note For built-in event types, the required capability level is defined in sl@0: the event type's write access policy. */ sl@0: { sl@0: // To preserve the same server side interface as an operation sl@0: TPckgBuf data; sl@0: data().iOperationType = ELogOperationViewSetFlags; sl@0: data().iOperationId = KLogNullOperationId; sl@0: // sl@0: User::LeaveIfError(iClient.Session().Send(ELogViewOperationInitiate, TIpcArgs(&data,iViewId,aFlags))); sl@0: } sl@0: sl@0: TBool CLogView::NavigateL(TInt aPosition, TRequestStatus& aStatus) sl@0: { sl@0: __ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive1)); sl@0: if (!IsValid() && !LogViewRecordCount()) sl@0: { sl@0: return EFalse; sl@0: } sl@0: // sl@0: const TLogNavigation navigationPosition = static_cast(aPosition); sl@0: const TBool requestIssued = iWindow->NavigateL(navigationPosition, iStatus); sl@0: // sl@0: if (requestIssued) sl@0: { sl@0: Queue(aStatus); sl@0: SetActive(); sl@0: // iValid is false if at time of SetFilterL there is no event. sl@0: // If iWindow->NavigateL returns ETrue then there are always sl@0: // events in the view. sl@0: iValid = ETrue; sl@0: } sl@0: // sl@0: return requestIssued; sl@0: } sl@0: sl@0: void CLogView::DoRunL() sl@0: { sl@0: if (iStatus.Int() == KErrNone) sl@0: ReadEventFromWindowL(); sl@0: } sl@0: sl@0: void CLogView::DoCancel() sl@0: { sl@0: iWindow->Cancel(); sl@0: CLogActive::DoCancel(); sl@0: } sl@0: sl@0: void CLogView::ReadEventFromWindowL() sl@0: { sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: delete iEvent; sl@0: iEvent = event; sl@0: iEvent->CopyL(iWindow->CurrsorEvent()); sl@0: } sl@0: sl@0: void CLogView::ReawaitForChanges() sl@0: { sl@0: iLogViewObserver->Cancel(); sl@0: iLogViewObserver->RequestChanges(); sl@0: } sl@0: sl@0: // sl@0: // The CLogViewWindow member has an observer to receive changes sl@0: // in events. If events are added to database after SetFilterL then sl@0: // iWindow would know about them. sl@0: TInt CLogView::LogViewRecordCount() const sl@0: { sl@0: if (iWindow) sl@0: { sl@0: return iWindow->ViewRecordCount(); sl@0: } sl@0: return 0; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: //********************************** sl@0: // CLogViewEvent sl@0: //********************************** sl@0: sl@0: CLogViewEvent::CLogViewEvent(CLogClient& aClient, TInt aPriority) sl@0: : CLogView(aClient, aPriority) sl@0: { sl@0: } sl@0: sl@0: EXPORT_C CLogViewEvent::~CLogViewEvent() sl@0: /** Frees all resources owned by the object prior to its destruction. In particular, sl@0: any outstanding asynchronous request is cancelled */ sl@0: { sl@0: Cancel(); sl@0: } sl@0: sl@0: void CLogViewEvent::ConstructL(MLogViewChangeObserver* aObserver) sl@0: { sl@0: CLogView::ConstructL(ELogViewTypeEvent, aObserver); sl@0: } sl@0: sl@0: EXPORT_C CLogViewEvent* CLogViewEvent::NewL(CLogClient& aClient, TInt aPriority) sl@0: { sl@0: CLogViewEvent* self = new(ELeave)CLogViewEvent(aClient, aPriority); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C CLogViewEvent* CLogViewEvent::NewL(CLogClient& aClient, MLogViewChangeObserver& aObserver, TInt aPriority) sl@0: { sl@0: CLogViewEvent* self = new(ELeave)CLogViewEvent(aClient, aPriority); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(&aObserver); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C TBool CLogViewEvent::SetFilterL(const CLogFilter& aFilter, TRequestStatus& aStatus) sl@0: /** Initialises or refreshes the event view defined by the specified filter. sl@0: sl@0: The view can only be used after the request completes successfully. sl@0: sl@0: @param aFilter The filter. sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the view has been successfully initialised or refreshed;one of the other sl@0: system wide error codes, otherwise. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. sl@0: @capability Note None required.*/ sl@0: { sl@0: CLogFilterList* list = new(ELeave)CLogFilterList; sl@0: CleanupStack::PushL(list); sl@0: list->AppendL(&aFilter); sl@0: TBool result = SetFilterL(*list, aStatus); sl@0: CleanupStack::PopAndDestroy(); // list sl@0: return result; sl@0: } sl@0: sl@0: EXPORT_C TBool CLogViewEvent::SetFilterL(const CLogFilterList& aFilterList, TRequestStatus& aStatus) sl@0: /** Initialises or refreshes the event view defined by the set of specified filters. sl@0: sl@0: The view can only be used after the request completes successfully. sl@0: sl@0: @param aFilterList The set of filters. sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the view has been successfully initialised or refreshed;one of the other sl@0: system wide error codes, otherwise. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. sl@0: @capability Note None required. */ sl@0: { sl@0: // Start maintenance of the database - ignore errors sl@0: iMaintain->Start(); sl@0: sl@0: // Package the parameters sl@0: iPackage->SetLogFilterListL(aFilterList); sl@0: sl@0: // Setup the view sl@0: const TInt count = iWindow->Setup(aFilterList, 0, ELogFilterConstructFilterByFilterFieldByField); sl@0: User::LeaveIfError(count); sl@0: iValid = count; sl@0: ReawaitForChanges(); sl@0: sl@0: if(count) sl@0: { sl@0: // Get the required event sl@0: iValid = FirstL(aStatus); sl@0: return iValid; sl@0: } sl@0: return EFalse; sl@0: } sl@0: sl@0: EXPORT_C TBool CLogViewEvent::SetFilterParseFilterByFilterL(const CLogFilterList& aFilterList, TRequestStatus& aStatus) sl@0: /** sl@0: @capability Note None required. */ sl@0: { sl@0: // Start maintenance of the database - ignore errors sl@0: iMaintain->Start(); sl@0: sl@0: // Package the parameters sl@0: iPackage->SetLogFilterListL(aFilterList); sl@0: sl@0: // Setup the view sl@0: const TInt count = iWindow->Setup(aFilterList, 0, ELogFilterConstructFieldByFieldFilterByFilter); sl@0: User::LeaveIfError(count); sl@0: iValid = count; sl@0: ReawaitForChanges(); sl@0: sl@0: if(count) sl@0: { sl@0: // Get the required event sl@0: iValid = FirstL(aStatus); sl@0: return iValid; sl@0: } sl@0: return EFalse; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: //********************************** sl@0: // CLogViewRecent sl@0: //********************************** sl@0: sl@0: CLogViewRecent::CLogViewRecent(CLogClient& aClient, TInt aPriority) sl@0: : CLogView(aClient, aPriority) sl@0: { sl@0: } sl@0: sl@0: EXPORT_C CLogViewRecent::~CLogViewRecent() sl@0: /** Frees resources owned by the object priot to its destruction. */ sl@0: { sl@0: Cancel(); sl@0: delete iRemove; sl@0: } sl@0: sl@0: void CLogViewRecent::ConstructL(MLogViewChangeObserver* aObserver) sl@0: { sl@0: // Construct the view sl@0: CLogView::ConstructL(ELogViewTypeRecent, aObserver); sl@0: sl@0: iRemove = new(ELeave) CLogViewRemoveEventClientOp(iClient.Session(), *iPackage, Priority()); sl@0: } sl@0: sl@0: EXPORT_C CLogViewRecent* CLogViewRecent::NewL(CLogClient& aClient, TInt aPriority) sl@0: { sl@0: CLogViewRecent* self = new(ELeave) CLogViewRecent(aClient, aPriority); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(); // self sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C CLogViewRecent* CLogViewRecent::NewL(CLogClient& aClient, MLogViewChangeObserver& aObserver, TInt aPriority) sl@0: { sl@0: CLogViewRecent* self = new(ELeave) CLogViewRecent(aClient, aPriority); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(&aObserver); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C TBool CLogViewRecent::SetRecentListL(TLogRecentList aList, TRequestStatus& aStatus) sl@0: /** Initialises or refreshes the view for the specified recent event list. This sl@0: is an asynchronous request. sl@0: sl@0: On successful completion, the view is positioned at the first, i.e. most recent, sl@0: event within the recent event list. sl@0: sl@0: @param aList The recent event list specifier. A value of KLogNullRecentList sl@0: indicates that the view is to include events from all of the recent event sl@0: lists. sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the view has been successfully initialised or refreshed; otherwise, one sl@0: of the other system wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. sl@0: @capability Note None required. */ sl@0: { sl@0: CLogFilter* filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: TBool result = SetRecentListL(aList, *filter, aStatus); sl@0: CleanupStack::PopAndDestroy(); // filter sl@0: return result; sl@0: } sl@0: sl@0: EXPORT_C TBool CLogViewRecent::SetRecentListL(TLogRecentList aList, const CLogFilter& aFilter, TRequestStatus& aStatus) sl@0: /** Initialises or refreshes the view for the specified recent event list, conforming sl@0: to the specified filter. This is an asynchronous request. sl@0: sl@0: On successful completion, the view is positioned at the first, i.e. most recent, sl@0: event in the recent event list. sl@0: sl@0: @param aList The recent event list specifier. A value of KLogNullRecentList sl@0: indicates that the view is to include events from all of the recent event sl@0: lists. sl@0: @param aFilter The filter. sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the view has been successfully initialised or refreshed; otherwise, one sl@0: of the other system wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. sl@0: @capability Note None required. */ sl@0: { sl@0: CLogFilterList* list = new(ELeave)CLogFilterList; sl@0: CleanupStack::PushL(list); sl@0: list->AppendL(&aFilter); sl@0: TBool result = SetRecentListL(aList, *list, aStatus); sl@0: CleanupStack::PopAndDestroy(); // list sl@0: return result; sl@0: } sl@0: sl@0: EXPORT_C TBool CLogViewRecent::SetRecentListL(TLogRecentList aList, const CLogFilterList& aFilterList, TRequestStatus& aStatus) sl@0: /** Initialises or refreshes the view for the specified recent event list, conforming sl@0: to the set of specified filters. This is an asynchronous request. sl@0: sl@0: On successful completion, the view is positioned at the first, i.e. most recent, sl@0: event in the recent event list. sl@0: sl@0: @param aList The recent event list specifier. A value of KLogNullRecentList sl@0: indicates that the view is to include events from all of the recent event sl@0: lists. sl@0: @param aFilterList The set of filters. sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the view has been successfully initialised or refreshed; otherwise, one sl@0: of the other system wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. sl@0: @capability Note None required. */ sl@0: { sl@0: // Start maintenance of the database - ignore errors sl@0: iMaintain->Start(); sl@0: sl@0: // Package the parameters sl@0: iPackage->SetLogFilterListL(aFilterList); sl@0: sl@0: // Setup the view sl@0: TInt count = iWindow->Setup(aFilterList, aList, ELogFilterConstructFilterByFilterFieldByField); sl@0: User::LeaveIfError(count); sl@0: iValid = count; sl@0: ReawaitForChanges(); sl@0: sl@0: // Initialise list ids sl@0: iRecentList = aList; sl@0: iCurrentList = aList; sl@0: sl@0: // This receives the current recent list id from the server sl@0: iCurrentListBuf() = iCurrentList; sl@0: iData = &iCurrentListBuf; sl@0: sl@0: if(count) sl@0: { sl@0: // Get the required event sl@0: iValid = FirstL(aStatus); sl@0: return iValid; sl@0: } sl@0: return EFalse; sl@0: } sl@0: sl@0: EXPORT_C void CLogViewRecent::RemoveL(TLogId aId) sl@0: /** Removes the event with the specified unique event ID from the view. This does sl@0: not delete the event from the main event log. sl@0: sl@0: @param aId The unique event ID. sl@0: @capability WriteDeviceData */ sl@0: { sl@0: User::LeaveIfError(iRemove->Start(iViewId, aId)); sl@0: iWindow->RemoveFromWindowIfPresentL(aId); sl@0: } sl@0: sl@0: EXPORT_C TBool CLogViewRecent::RemoveL(TRequestStatus& aStatus) sl@0: /** Removes the current event from its recent event list. This is an asynchronous sl@0: request. sl@0: sl@0: This does not delete the event from the main event log. sl@0: sl@0: The function moves the current position in the view to the first, i.e. most sl@0: recent, event. sl@0: sl@0: Note that removing a recent event from a recent event list also removes all sl@0: of its duplicates. sl@0: sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the view has been successfully initialised or refreshed; otherwise, one sl@0: of the other system wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. sl@0: @capability WriteDeviceData */ sl@0: { sl@0: __ASSERT_DEBUG(IsValid(), Panic(ELogNotValid1)); sl@0: RemoveL(Event().Id()); sl@0: return FirstL(aStatus); sl@0: } sl@0: sl@0: EXPORT_C TBool CLogViewRecent::DuplicatesL(CLogViewDuplicate& aView, TRequestStatus& aStatus) sl@0: /** Refreshes the specified duplicate event view with the duplicates of the current sl@0: event in the recent event list view. This is an asynchronous request. sl@0: sl@0: On successful completion, the view is positioned at the first, i.e. most recent, sl@0: event within the view. sl@0: sl@0: @param aView The duplicates view to be refreshed. sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the view has been successfully refreshed; otherwise, one of the other system sl@0: wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. sl@0: @capability Note None required. */ sl@0: { sl@0: __ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive5)); sl@0: return IsValid() && aView.SetEventL(Event().Id(), aStatus); sl@0: } sl@0: sl@0: EXPORT_C TBool CLogViewRecent::DuplicatesL(CLogViewDuplicate& aView, const CLogFilter& aFilter, TRequestStatus& aStatus) sl@0: /** Refreshes the specified duplicate event view with the duplicates of the current sl@0: event in the recent event list view and conforming to the specified filter. sl@0: This is an asynchronous request. sl@0: sl@0: On successful completion, the view is positioned at the first, i.e. most recent, sl@0: event within the view. sl@0: sl@0: @param aView The duplicates view to be refreshed. sl@0: @param aFilter The filter. sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the view has been successfully refreshed; otherwise, one of the other system sl@0: wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. sl@0: @capability Note None required.*/ sl@0: { sl@0: __ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive6)); sl@0: return IsValid() && aView.SetEventL(Event().Id(), aFilter, aStatus); sl@0: } sl@0: sl@0: EXPORT_C TBool CLogViewRecent::DuplicatesL(CLogViewDuplicate& aView, const CLogFilterList& aFilterList, TRequestStatus& aStatus) sl@0: /** Refreshes the specified duplicate event view with the duplicates of the current sl@0: event in the recent event list view and conforming to the set of specified sl@0: filters. This is an asynchronous request. sl@0: sl@0: On successful completion, the view is positioned at the first, i.e. most recent, sl@0: event within the view. sl@0: sl@0: @param aView The duplicates view to be refreshed. sl@0: @param aFilterList The set of filters. sl@0: @param aStatus The request status. On request completion, contains:KErrNone, sl@0: if the view has been successfully refreshed; otherwise, one of the other system sl@0: wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. sl@0: @capability Note None required.*/ sl@0: { sl@0: __ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive7)); sl@0: return IsValid() && aView.SetEventL(Event().Id(), aFilterList, aStatus); sl@0: } sl@0: sl@0: EXPORT_C void CLogViewRecent::ClearDuplicatesL() sl@0: /** sl@0: @capability WriteDeviceData */ sl@0: { sl@0: __ASSERT_DEBUG(IsValid(), Panic(ELogNotValid3)); sl@0: sl@0: // To preserve the same server side interface as an operation sl@0: TPckgBuf data; sl@0: data().iOperationType = ELogOperationViewClearDuplicates; sl@0: data().iOperationId = KLogNullOperationId; sl@0: // sl@0: User::LeaveIfError(iClient.Session().Send(ELogViewOperationInitiate, TIpcArgs(&data,iViewId))); sl@0: } sl@0: sl@0: void CLogViewRecent::DoRunL() sl@0: { sl@0: // To fetch the event sl@0: ReadEventFromWindowL(); sl@0: sl@0: // A fix to maintain source compatibility sl@0: iCurrentList = iCurrentListBuf(); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: //********************************** sl@0: // CLogViewDuplicate sl@0: //********************************** sl@0: sl@0: CLogViewDuplicate::CLogViewDuplicate(CLogClient& aClient, TInt aPriority) sl@0: : CLogView(aClient, aPriority) sl@0: { sl@0: } sl@0: sl@0: EXPORT_C CLogViewDuplicate::~CLogViewDuplicate() sl@0: { sl@0: Cancel(); sl@0: delete iRemove; sl@0: } sl@0: sl@0: void CLogViewDuplicate::ConstructL(MLogViewChangeObserver* aObserver) sl@0: { sl@0: CLogView::ConstructL(ELogViewTypeDuplicate, aObserver); sl@0: sl@0: iRemove = new(ELeave) CLogViewRemoveEventClientOp(iClient.Session(), *iPackage, Priority()); sl@0: } sl@0: sl@0: EXPORT_C CLogViewDuplicate* CLogViewDuplicate::NewL(CLogClient& aClient, TInt aPriority) sl@0: { sl@0: CLogViewDuplicate* self = new(ELeave)CLogViewDuplicate(aClient, aPriority); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(); sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C CLogViewDuplicate* CLogViewDuplicate::NewL(CLogClient& aClient, MLogViewChangeObserver& aObserver, TInt aPriority) sl@0: { sl@0: CLogViewDuplicate* self = new(ELeave) CLogViewDuplicate(aClient, aPriority); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(&aObserver); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: TBool CLogViewDuplicate::SetEventL(TLogId aId, TRequestStatus& aStatus) sl@0: { sl@0: CLogFilter* filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: TBool result = SetEventL(aId, *filter, aStatus); sl@0: CleanupStack::PopAndDestroy(); // filter sl@0: return result; sl@0: } sl@0: sl@0: TBool CLogViewDuplicate::SetEventL(TLogId aId, const CLogFilter& aFilter, TRequestStatus& aStatus) sl@0: { sl@0: CLogFilterList* list = new(ELeave)CLogFilterList; sl@0: CleanupStack::PushL(list); sl@0: list->AppendL(&aFilter); sl@0: TBool result = SetEventL(aId, *list, aStatus); sl@0: CleanupStack::PopAndDestroy(); // list sl@0: return result; sl@0: } sl@0: sl@0: TBool CLogViewDuplicate::SetEventL(TLogId aId, const CLogFilterList& aFilterList, TRequestStatus& aStatus) sl@0: { sl@0: // Start maintenance of the database - ignore errors sl@0: iMaintain->Start(); sl@0: sl@0: // Package the parameters sl@0: iPackage->SetLogFilterListL(aFilterList); sl@0: sl@0: // Setup the view sl@0: TInt count = iWindow->Setup(aFilterList, aId, ELogFilterConstructFilterByFilterFieldByField); sl@0: User::LeaveIfError(count); sl@0: iValid = count; sl@0: iSourceId = aId; sl@0: ReawaitForChanges(); sl@0: sl@0: if(count) sl@0: { sl@0: // Get the required event sl@0: iValid = FirstL(aStatus); sl@0: return iValid; sl@0: } sl@0: return EFalse; sl@0: } sl@0: sl@0: EXPORT_C void CLogViewDuplicate::RemoveL(TLogId aId) sl@0: /** Removes the event with the specified unique event ID from the view. This does sl@0: not delete the event from the main event log. sl@0: sl@0: @param aId The unique event ID. sl@0: @capability WriteDeviceData */ sl@0: { sl@0: // Note: Duplicate views reset themselves sl@0: __ASSERT_DEBUG(IsValid(), Panic(ELogNotValid2)); sl@0: User::LeaveIfError(iRemove->Start(iViewId, aId)); sl@0: iWindow->RemoveFromWindowIfPresentL(aId); sl@0: } sl@0: sl@0: EXPORT_C TBool CLogViewDuplicate::RemoveL(TRequestStatus& aStatus) sl@0: /** Removes the current event from the duplicate list. This is an asynchronous sl@0: request. sl@0: sl@0: This does not delete the event from the main event log. sl@0: sl@0: The function moves the current position in the view to the first, i.e. most sl@0: recent, event. sl@0: sl@0: @param aStatus The request status. On request completion, contains: KErrNone, sl@0: if the view has been successfully initialised or refreshed; otherwise, one sl@0: of the other system wide error codes. sl@0: @return ETrue, if the function has successfully issued the asynchronous request. sl@0: EFalse, if there are no events in the view. sl@0: @capability WriteDeviceData */ sl@0: { sl@0: RemoveL(Event().Id()); sl@0: return FirstL(aStatus); sl@0: }