sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "LogViewWindowChangeObserver.h"
|
sl@0
|
17 |
|
sl@0
|
18 |
// Constants
|
sl@0
|
19 |
const TInt KLogViewIgnoreStackGranularity = 3;
|
sl@0
|
20 |
|
sl@0
|
21 |
|
sl@0
|
22 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
23 |
// -----> CLogViewWindowChangeObserver (source)
|
sl@0
|
24 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
25 |
|
sl@0
|
26 |
CLogViewWindowChangeObserver::CLogViewWindowChangeObserver(MLogViewChangeObserverInternal& aObserver)
|
sl@0
|
27 |
: iObserver(aObserver), iIgnoreStack(KLogViewIgnoreStackGranularity)
|
sl@0
|
28 |
{
|
sl@0
|
29 |
}
|
sl@0
|
30 |
|
sl@0
|
31 |
CLogViewWindowChangeObserver::~CLogViewWindowChangeObserver()
|
sl@0
|
32 |
{
|
sl@0
|
33 |
iIgnoreStack.Close();
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
37 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
38 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
39 |
|
sl@0
|
40 |
void CLogViewWindowChangeObserver::IgnoreNextEventL(TLogId aId, TType aType)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
TIgnoreEvent event(aId, aType);
|
sl@0
|
43 |
User::LeaveIfError(iIgnoreStack.Append(event));
|
sl@0
|
44 |
}
|
sl@0
|
45 |
|
sl@0
|
46 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
47 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
48 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
49 |
|
sl@0
|
50 |
void CLogViewWindowChangeObserver::HandleLogViewChangeEventAddedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount)
|
sl@0
|
51 |
{
|
sl@0
|
52 |
const TInt index = Find(aId, ELogEventTypeAdd);
|
sl@0
|
53 |
if (index == KErrNotFound)
|
sl@0
|
54 |
iObserver.HandleLogViewChangeEventAddedL(aId, aViewIndex, aChangeIndex, aTotalChangeCount);
|
sl@0
|
55 |
else
|
sl@0
|
56 |
iIgnoreStack.Remove(index);
|
sl@0
|
57 |
}
|
sl@0
|
58 |
|
sl@0
|
59 |
void CLogViewWindowChangeObserver::HandleLogViewChangeEventChangedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount)
|
sl@0
|
60 |
{
|
sl@0
|
61 |
const TInt index = Find(aId, ELogEventTypeChange);
|
sl@0
|
62 |
if (index == KErrNotFound)
|
sl@0
|
63 |
iObserver.HandleLogViewChangeEventChangedL(aId, aViewIndex, aChangeIndex, aTotalChangeCount);
|
sl@0
|
64 |
else
|
sl@0
|
65 |
iIgnoreStack.Remove(index);
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
void CLogViewWindowChangeObserver::HandleLogViewChangeEventDeletedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount)
|
sl@0
|
69 |
{
|
sl@0
|
70 |
const TInt index = Find(aId, ELogEventTypeDelete);
|
sl@0
|
71 |
if (index == KErrNotFound)
|
sl@0
|
72 |
iObserver.HandleLogViewChangeEventDeletedL(aId, aViewIndex, aChangeIndex, aTotalChangeCount);
|
sl@0
|
73 |
else
|
sl@0
|
74 |
iIgnoreStack.Remove(index);
|
sl@0
|
75 |
}
|
sl@0
|
76 |
|
sl@0
|
77 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
78 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
79 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
80 |
|
sl@0
|
81 |
void CLogViewWindowChangeObserver::HandleLogViewChangeEventLogClearedL()
|
sl@0
|
82 |
{
|
sl@0
|
83 |
iObserver.HandleLogViewChangeEventLogClearedL();
|
sl@0
|
84 |
}
|
sl@0
|
85 |
|
sl@0
|
86 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
87 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
88 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
89 |
|
sl@0
|
90 |
TInt CLogViewWindowChangeObserver::Find(TLogId aId, TType aType) const
|
sl@0
|
91 |
{
|
sl@0
|
92 |
const TInt count = iIgnoreStack.Count();
|
sl@0
|
93 |
for(TInt i=0; i<count; i++)
|
sl@0
|
94 |
{
|
sl@0
|
95 |
const TIgnoreEvent& event = iIgnoreStack[i];
|
sl@0
|
96 |
if (event.iId == aId && event.iType == aType)
|
sl@0
|
97 |
return i;
|
sl@0
|
98 |
}
|
sl@0
|
99 |
return KErrNotFound;
|
sl@0
|
100 |
}
|