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 "LogViewWindowChangeObserver.h" sl@0: sl@0: // Constants sl@0: const TInt KLogViewIgnoreStackGranularity = 3; sl@0: sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: // -----> CLogViewWindowChangeObserver (source) sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: CLogViewWindowChangeObserver::CLogViewWindowChangeObserver(MLogViewChangeObserverInternal& aObserver) sl@0: : iObserver(aObserver), iIgnoreStack(KLogViewIgnoreStackGranularity) sl@0: { sl@0: } sl@0: sl@0: CLogViewWindowChangeObserver::~CLogViewWindowChangeObserver() sl@0: { sl@0: iIgnoreStack.Close(); sl@0: } sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: void CLogViewWindowChangeObserver::IgnoreNextEventL(TLogId aId, TType aType) sl@0: { sl@0: TIgnoreEvent event(aId, aType); sl@0: User::LeaveIfError(iIgnoreStack.Append(event)); sl@0: } sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: void CLogViewWindowChangeObserver::HandleLogViewChangeEventAddedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount) sl@0: { sl@0: const TInt index = Find(aId, ELogEventTypeAdd); sl@0: if (index == KErrNotFound) sl@0: iObserver.HandleLogViewChangeEventAddedL(aId, aViewIndex, aChangeIndex, aTotalChangeCount); sl@0: else sl@0: iIgnoreStack.Remove(index); sl@0: } sl@0: sl@0: void CLogViewWindowChangeObserver::HandleLogViewChangeEventChangedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount) sl@0: { sl@0: const TInt index = Find(aId, ELogEventTypeChange); sl@0: if (index == KErrNotFound) sl@0: iObserver.HandleLogViewChangeEventChangedL(aId, aViewIndex, aChangeIndex, aTotalChangeCount); sl@0: else sl@0: iIgnoreStack.Remove(index); sl@0: } sl@0: sl@0: void CLogViewWindowChangeObserver::HandleLogViewChangeEventDeletedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount) sl@0: { sl@0: const TInt index = Find(aId, ELogEventTypeDelete); sl@0: if (index == KErrNotFound) sl@0: iObserver.HandleLogViewChangeEventDeletedL(aId, aViewIndex, aChangeIndex, aTotalChangeCount); sl@0: else sl@0: iIgnoreStack.Remove(index); sl@0: } sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: void CLogViewWindowChangeObserver::HandleLogViewChangeEventLogClearedL() sl@0: { sl@0: iObserver.HandleLogViewChangeEventLogClearedL(); sl@0: } sl@0: sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: ///////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: TInt CLogViewWindowChangeObserver::Find(TLogId aId, TType aType) const sl@0: { sl@0: const TInt count = iIgnoreStack.Count(); sl@0: for(TInt i=0; i