os/persistentdata/loggingservices/eventlogger/LogCli/src/LogViewWindowChangeObserver.cpp
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "LogViewWindowChangeObserver.h"
19 const TInt KLogViewIgnoreStackGranularity = 3;
22 /////////////////////////////////////////////////////////////////////////////////////////
23 // -----> CLogViewWindowChangeObserver (source)
24 /////////////////////////////////////////////////////////////////////////////////////////
26 CLogViewWindowChangeObserver::CLogViewWindowChangeObserver(MLogViewChangeObserverInternal& aObserver)
27 : iObserver(aObserver), iIgnoreStack(KLogViewIgnoreStackGranularity)
31 CLogViewWindowChangeObserver::~CLogViewWindowChangeObserver()
36 /////////////////////////////////////////////////////////////////////////////////////////
37 /////////////////////////////////////////////////////////////////////////////////////////
38 /////////////////////////////////////////////////////////////////////////////////////////
40 void CLogViewWindowChangeObserver::IgnoreNextEventL(TLogId aId, TType aType)
42 TIgnoreEvent event(aId, aType);
43 User::LeaveIfError(iIgnoreStack.Append(event));
46 /////////////////////////////////////////////////////////////////////////////////////////
47 /////////////////////////////////////////////////////////////////////////////////////////
48 /////////////////////////////////////////////////////////////////////////////////////////
50 void CLogViewWindowChangeObserver::HandleLogViewChangeEventAddedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount)
52 const TInt index = Find(aId, ELogEventTypeAdd);
53 if (index == KErrNotFound)
54 iObserver.HandleLogViewChangeEventAddedL(aId, aViewIndex, aChangeIndex, aTotalChangeCount);
56 iIgnoreStack.Remove(index);
59 void CLogViewWindowChangeObserver::HandleLogViewChangeEventChangedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount)
61 const TInt index = Find(aId, ELogEventTypeChange);
62 if (index == KErrNotFound)
63 iObserver.HandleLogViewChangeEventChangedL(aId, aViewIndex, aChangeIndex, aTotalChangeCount);
65 iIgnoreStack.Remove(index);
68 void CLogViewWindowChangeObserver::HandleLogViewChangeEventDeletedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount)
70 const TInt index = Find(aId, ELogEventTypeDelete);
71 if (index == KErrNotFound)
72 iObserver.HandleLogViewChangeEventDeletedL(aId, aViewIndex, aChangeIndex, aTotalChangeCount);
74 iIgnoreStack.Remove(index);
77 /////////////////////////////////////////////////////////////////////////////////////////
78 /////////////////////////////////////////////////////////////////////////////////////////
79 /////////////////////////////////////////////////////////////////////////////////////////
81 void CLogViewWindowChangeObserver::HandleLogViewChangeEventLogClearedL()
83 iObserver.HandleLogViewChangeEventLogClearedL();
86 /////////////////////////////////////////////////////////////////////////////////////////
87 /////////////////////////////////////////////////////////////////////////////////////////
88 /////////////////////////////////////////////////////////////////////////////////////////
90 TInt CLogViewWindowChangeObserver::Find(TLogId aId, TType aType) const
92 const TInt count = iIgnoreStack.Count();
93 for(TInt i=0; i<count; i++)
95 const TIgnoreEvent& event = iIgnoreStack[i];
96 if (event.iId == aId && event.iType == aType)