|
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 <aknlists.h> |
|
27 #include "CLmkDlgCategorySelectorImpl.h" |
|
28 #include "CLmkMultiSelectorDialog.h" |
|
29 #include "CLmkLmItemListProvider.h" |
|
30 #include "LmkListProviderFactory.h" |
|
31 #include "CLmkUiUtils.h" |
|
32 #include <lmkui.rsg> |
|
33 #include <lmkerrors.h> |
|
34 |
|
35 |
|
36 #if defined(_DEBUG) |
|
37 |
|
38 // CONSTANTS |
|
39 /// Unnamed namespace for local definitions |
|
40 namespace { |
|
41 |
|
42 _LIT( KPanicMsg, "CLmkDlgCategorySelectorImpl" ); |
|
43 |
|
44 void Panic( TPanicCode aReason ) |
|
45 { |
|
46 User::Panic( KPanicMsg, aReason ); |
|
47 } |
|
48 } // namespace |
|
49 #endif |
|
50 // ============================ MEMBER FUNCTIONS =============================== |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CLmkDlgCategorySelectorImpl::CLmkDlgCategorySelectorImpl |
|
54 // C++ default constructor can NOT contain any code, that |
|
55 // might leave. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CLmkDlgCategorySelectorImpl::CLmkDlgCategorySelectorImpl( |
|
59 CPosLandmarkDatabase& aDb, |
|
60 TBool aShowEmptyCategories, |
|
61 TBool aShowBlankNaviPane |
|
62 ) |
|
63 : CLmkDlgSelectorImplBase( aDb ), |
|
64 iShowEmptyCategories( aShowEmptyCategories ), |
|
65 iShowBlankNaviPane (aShowBlankNaviPane) |
|
66 { |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CLmkDlgCategorySelectorImpl::ConstructL |
|
71 // Symbian 2nd phase constructor can leave. |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 void CLmkDlgCategorySelectorImpl::ConstructL() |
|
75 { |
|
76 BaseConstructL(); |
|
77 // Hide the navi pane contents of the dialog Launcher |
|
78 if (iShowBlankNaviPane) |
|
79 { |
|
80 iLmkUiUtils->StoreNaviPaneL(); |
|
81 iLmkUiUtils->CreateDefaultNaviPaneL(); |
|
82 } |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CLmkDlgCategorySelectorImpl::NewL |
|
87 // Two-phased constructor. |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 EXPORT_C CLmkDlgCategorySelectorImpl* CLmkDlgCategorySelectorImpl::NewL( |
|
91 CPosLandmarkDatabase& aDb, |
|
92 TBool aShowEmptyCategories, TBool aShowBlankNaviPane) |
|
93 { |
|
94 CLmkDlgCategorySelectorImpl* self = |
|
95 new( ELeave ) CLmkDlgCategorySelectorImpl( aDb, aShowEmptyCategories, aShowBlankNaviPane ); |
|
96 |
|
97 CleanupStack::PushL( self ); |
|
98 self->ConstructL(); |
|
99 CleanupStack::Pop(); |
|
100 |
|
101 return self; |
|
102 } |
|
103 |
|
104 // ---------------------------------------------------- |
|
105 // CLmkDlgCategorySelectorImpl::~CLmkDlgCategorySelectorImpl |
|
106 // ---------------------------------------------------- |
|
107 // |
|
108 CLmkDlgCategorySelectorImpl::~CLmkDlgCategorySelectorImpl() |
|
109 { |
|
110 } |
|
111 |
|
112 // ---------------------------------------------------- |
|
113 // CLmkDlgCategorySelectorImpl::SetupListProviderL |
|
114 // ---------------------------------------------------- |
|
115 // |
|
116 void CLmkDlgCategorySelectorImpl::SetupListProviderL() |
|
117 { |
|
118 if ( !iListProvider ) |
|
119 { |
|
120 TLmkProviderType providerType( ELmkNotShowEmptyCategories ); |
|
121 if ( iShowEmptyCategories ) |
|
122 { |
|
123 providerType = ELmkShowEmptyCategories; |
|
124 } |
|
125 iListProvider = LmkListProviderFactory::CreateProviderL( iDb, |
|
126 ECategorySelector, providerType ); |
|
127 |
|
128 iListProvider->AddObserverL( *this ); |
|
129 iListProvider->InitializeL(); |
|
130 } |
|
131 } |
|
132 |
|
133 // ---------------------------------------------------- |
|
134 // CLmkDlgCategorySelectorImpl::ListProvider |
|
135 // ---------------------------------------------------- |
|
136 // |
|
137 const CLmkListProviderBase& CLmkDlgCategorySelectorImpl::ListProvider() const |
|
138 { |
|
139 __ASSERT_DEBUG( iListProvider, Panic( KLmkPanicNullMember ) ); |
|
140 return *iListProvider; |
|
141 } |
|
142 |
|
143 // ---------------------------------------------------- |
|
144 // CLmkDlgCategorySelectorImpl::GetDlgResources |
|
145 // ---------------------------------------------------- |
|
146 // |
|
147 void CLmkDlgCategorySelectorImpl::GetDlgResources( |
|
148 TBool aIsSingleSelector, |
|
149 TInt& aTitlePaneResource, |
|
150 TInt& aMenuBarResource, |
|
151 TInt& aDialogResource ) const |
|
152 { |
|
153 aTitlePaneResource = R_LMK_CATEGORY_SELECTOR_TITLE; |
|
154 aMenuBarResource = R_LMK_EMPTY_MENUBAR; |
|
155 |
|
156 if ( iSelectorImplParent ) |
|
157 { // category selector as a part of landmark selector |
|
158 aDialogResource = R_LMK_SELECTOR_OPEN_CANCEL_DLG; |
|
159 } |
|
160 else |
|
161 { |
|
162 if ( aIsSingleSelector ) |
|
163 { |
|
164 aDialogResource = R_LMK_SELECTOR_OK_CANCEL_DLG; |
|
165 } |
|
166 else |
|
167 { |
|
168 aDialogResource = R_LMK_CATEGORY_SELECTOR_OK_CANCEL_MULTI_DLG; |
|
169 } |
|
170 } |
|
171 } |
|
172 |
|
173 // ---------------------------------------------------- |
|
174 // CLmkDlgCategorySelectorImpl::HandleListProviderEvent |
|
175 // ---------------------------------------------------- |
|
176 // |
|
177 void CLmkDlgCategorySelectorImpl::HandleListProviderEvent( |
|
178 TLmkListProviderEventType aEvent ) |
|
179 { |
|
180 // Give event to the dialog as the first step since others |
|
181 // may then interact with the updated dialog: |
|
182 if ( iDialog ) |
|
183 { |
|
184 iDialog->HandleListProviderEvent( aEvent ); |
|
185 } |
|
186 |
|
187 // Base class implementation: |
|
188 CLmkDlgSelectorImplBase::HandleListProviderEvent( aEvent ); |
|
189 } |
|
190 |
|
191 // ---------------------------------------------------- |
|
192 // CLmkDlgCategorySelectorImpl::HandleListProviderError |
|
193 // ---------------------------------------------------- |
|
194 // |
|
195 void CLmkDlgCategorySelectorImpl::HandleListProviderError( TInt aError ) |
|
196 { |
|
197 // Base class implementation: |
|
198 CLmkDlgSelectorImplBase::HandleListProviderError( aError ); |
|
199 |
|
200 if ( iDialog ) |
|
201 { |
|
202 iDialog->HandleListProviderError( aError ); |
|
203 } |
|
204 } |
|
205 |
|
206 // End of File |