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 "LogServRecentListManager.h"
|
sl@0
|
17 |
#include "LogServResourceInterpreter.h"
|
sl@0
|
18 |
#include "LogServRecentList.h"
|
sl@0
|
19 |
#include "logservpanic.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
22 |
// -----> CLogServRecentListManager (source)
|
sl@0
|
23 |
/////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
24 |
|
sl@0
|
25 |
CLogServRecentListManager::~CLogServRecentListManager()
|
sl@0
|
26 |
{
|
sl@0
|
27 |
iLists.ResetAndDestroy();
|
sl@0
|
28 |
iLists.Close();
|
sl@0
|
29 |
}
|
sl@0
|
30 |
|
sl@0
|
31 |
void CLogServRecentListManager::ConstructL(CLogServResourceInterpreter& aResourceInterpreter, TInt aResourceId)
|
sl@0
|
32 |
{
|
sl@0
|
33 |
TResourceReader reader;
|
sl@0
|
34 |
aResourceInterpreter.CreateResourceReaderLC(reader, aResourceId);
|
sl@0
|
35 |
const TInt count = reader.ReadInt16();
|
sl@0
|
36 |
iLists.ReserveL(count);
|
sl@0
|
37 |
for(TInt i=0; i<count; i++)
|
sl@0
|
38 |
{
|
sl@0
|
39 |
CLogServRecentList* list = CLogServRecentList::NewL(reader);
|
sl@0
|
40 |
TInt err = iLists.Append(list);
|
sl@0
|
41 |
__ASSERT_ALWAYS(err == KErrNone, Panic(ELogArrayReserved));
|
sl@0
|
42 |
}
|
sl@0
|
43 |
CleanupStack::PopAndDestroy(); // reader
|
sl@0
|
44 |
#ifdef SYSLIBS_TEST
|
sl@0
|
45 |
//Creates a test recent list used by the unit tests. Helps covering most of the production code branches,
|
sl@0
|
46 |
//related to the recent lists functionality.
|
sl@0
|
47 |
CLogServRecentList* list = CLogServRecentList::TestNewL();
|
sl@0
|
48 |
iLists.AppendL(list);
|
sl@0
|
49 |
#endif
|
sl@0
|
50 |
}
|
sl@0
|
51 |
|
sl@0
|
52 |
CLogServRecentListManager* CLogServRecentListManager::NewL(CLogServResourceInterpreter& aResourceInterpreter, TInt aResourceId)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
CLogServRecentListManager* self = new(ELeave) CLogServRecentListManager;
|
sl@0
|
55 |
CleanupStack::PushL(self);
|
sl@0
|
56 |
self->ConstructL(aResourceInterpreter, aResourceId);
|
sl@0
|
57 |
CleanupStack::Pop();
|
sl@0
|
58 |
return self;
|
sl@0
|
59 |
}
|
sl@0
|
60 |
|
sl@0
|
61 |
const CLogServRecentList* CLogServRecentListManager::GetRecentList(const CLogEvent& aEvent) const
|
sl@0
|
62 |
{
|
sl@0
|
63 |
TInt count = iLists.Count();
|
sl@0
|
64 |
while(count--)
|
sl@0
|
65 |
{
|
sl@0
|
66 |
const CLogServRecentList* list = iLists[count];
|
sl@0
|
67 |
if (list->IsRecent(aEvent))
|
sl@0
|
68 |
return list;
|
sl@0
|
69 |
}
|
sl@0
|
70 |
return NULL;
|
sl@0
|
71 |
}
|
sl@0
|
72 |
|