|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: LandmarksUi Content File - |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 // INCLUDE FILES |
|
26 #include "CLmkParsedLmListProvider.h" |
|
27 #include "CLmkLandmarkUiItem.h" |
|
28 #include "MLmkSelectorIconMgr.h" |
|
29 #include "CLmkParser.h" |
|
30 #include <EPos_CPosLandmark.h> |
|
31 #include <lmkerrors.h> |
|
32 |
|
33 #if defined(_DEBUG) |
|
34 // CONSTANTS |
|
35 /// Unnamed namespace for local definitions |
|
36 namespace { |
|
37 |
|
38 _LIT( KPanicMsg, "CLmkParsedLmListProvider" ); |
|
39 |
|
40 void Panic( TPanicCode aReason ) |
|
41 { |
|
42 User::Panic( KPanicMsg, aReason ); |
|
43 } |
|
44 } // namespace |
|
45 #endif |
|
46 // ============================ MEMBER FUNCTIONS =============================== |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CLmkParsedLmListProvider::CLmkParsedLmListProvider |
|
50 // C++ constructor can NOT contain any code, that |
|
51 // might leave. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CLmkParsedLmListProvider::CLmkParsedLmListProvider( |
|
55 CLmkParser& aParser ) |
|
56 : iParser( aParser ) |
|
57 { |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CLmkParsedLmListProvider::ConstructL |
|
62 // Symbian 2nd phase constructor can leave. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 void CLmkParsedLmListProvider::ConstructL() |
|
66 { |
|
67 // base class 2nd phase constructor |
|
68 CLmkListProviderBase::BaseConstructL(); |
|
69 |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CLmkParsedLmListProvider::NewL |
|
74 // Two-phased constructor. |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 CLmkParsedLmListProvider* CLmkParsedLmListProvider::NewL( |
|
78 CLmkParser& aParser ) |
|
79 { |
|
80 CLmkParsedLmListProvider* self = |
|
81 new ( ELeave ) CLmkParsedLmListProvider( aParser ); |
|
82 |
|
83 CleanupStack::PushL( self ); |
|
84 self->ConstructL(); |
|
85 CleanupStack::Pop(); |
|
86 |
|
87 return self; |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------- |
|
91 // CLmkParsedLmListProvider::~CLmkParsedLmListProvider |
|
92 // --------------------------------------------------------- |
|
93 // |
|
94 CLmkParsedLmListProvider::~CLmkParsedLmListProvider() |
|
95 { |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------- |
|
99 // CLmkParsedLmListProvider::InitializeL |
|
100 // --------------------------------------------------------- |
|
101 // |
|
102 void CLmkParsedLmListProvider::InitializeL() |
|
103 { |
|
104 // This class is not responsible of db initialization or |
|
105 // parser initialization. |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------- |
|
109 // CLmkParsedLmListProvider::StartSearchingLandmarksL() |
|
110 // --------------------------------------------------------- |
|
111 // |
|
112 TBool CLmkParsedLmListProvider::StartSearchingLandmarksL( |
|
113 const TDesC& /*aSearchPattern*/, |
|
114 TBool /*aSearchOnlyInPreviousMatches*/) |
|
115 { |
|
116 // nothing to do |
|
117 return ETrue; |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------- |
|
121 // CLmkParsedLmListProvider::ItemCount |
|
122 // --------------------------------------------------------- |
|
123 // |
|
124 TInt CLmkParsedLmListProvider::ItemCount() const |
|
125 { |
|
126 return iParser.NumOfParsedLandmarks(); |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------- |
|
130 // CLmkParsedLmListProvider::ItemAtL |
|
131 // --------------------------------------------------------- |
|
132 // |
|
133 CLmkUiItemBase* CLmkParsedLmListProvider::ItemAtL( TInt aIndex ) |
|
134 { |
|
135 __ASSERT_DEBUG( iIconMgr, Panic( KLmkPanicNullMember ) ); |
|
136 |
|
137 CPosLandmark* landmark = iParser.LandmarkLC( aIndex ); |
|
138 |
|
139 // Icons are not exchanged when messaging so |
|
140 // use default icon for landmark: |
|
141 TInt iconListIndex = iIconMgr->GetDefaultIconL( |
|
142 MLmkSelectorIconMgr::ELandmarkDefaultIcon ); |
|
143 |
|
144 CLmkLandmarkUiItem* uiItem = |
|
145 CLmkLandmarkUiItem::NewL( landmark, iconListIndex ); |
|
146 CleanupStack::Pop(); // landmark, ownership transferred |
|
147 return uiItem; |
|
148 } |
|
149 |
|
150 // End of File |