|
1 /* |
|
2 * Copyright (c) 2002-2010 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: Category Settings View (Edit Categories View) Class Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 |
|
20 #include <aknlists.h> |
|
21 #include <aknview.h> |
|
22 // For RD_AVKON_UNBRANCH |
|
23 #include <bldvariant.hrh> |
|
24 #include <AknDef.h> |
|
25 #include <landmarks.rsg> |
|
26 #include <lmkui.rsg> |
|
27 #include "landmarks.hrh" |
|
28 //#include "Landmarks.hlp.hrh" |
|
29 #include <csxhelp/lm.hlp.hrh> |
|
30 #include "CLmkAppUi.h" |
|
31 #include "CLmkDocument.h" |
|
32 #include "CLmkUiUtils.h" |
|
33 #include "CLmkAppCategorySettingsImpl.h" |
|
34 #include "CLmkCategorySettingsView.h" |
|
35 #include "CLmkCategorySettingsContainer.h" |
|
36 #include <lmkerrors.h> |
|
37 |
|
38 #if defined(_DEBUG) |
|
39 // CONSTANTS |
|
40 namespace |
|
41 { |
|
42 _LIT( KPanicText, "CLmkCategorySettingsContainer" ); |
|
43 |
|
44 void Panic( TPanicCode aReason ) |
|
45 { |
|
46 User::Panic( KPanicText, aReason ); |
|
47 } |
|
48 } // namespace |
|
49 #endif |
|
50 // ================= MEMBER FUNCTIONS ======================= |
|
51 // ---------------------------------------------------------------------------- |
|
52 // CLmkCategorySettingsContainer::NewL |
|
53 // ---------------------------------------------------------------------------- |
|
54 // |
|
55 |
|
56 // FOr landscape support |
|
57 CLmkCategorySettingsContainer* CLmkCategorySettingsContainer::NewL( |
|
58 MLmkKeyProcessor& aKeyProcessor, MObjectProvider* aParent, |
|
59 const TRect& aRect, CAknView& aView) |
|
60 { |
|
61 CLmkCategorySettingsContainer* self = |
|
62 new (ELeave) CLmkCategorySettingsContainer(aKeyProcessor, aView); |
|
63 CleanupStack::PushL(self); |
|
64 self->SetMopParent(aParent); |
|
65 self->ConstructL(aRect); |
|
66 CleanupStack::Pop(); // self |
|
67 return self; |
|
68 } |
|
69 |
|
70 // ---------------------------------------------------------------------------- |
|
71 // CLmkCategorySettingsContainer::CLmkCategorySettingsContainer |
|
72 // ---------------------------------------------------------------------------- |
|
73 // |
|
74 CLmkCategorySettingsContainer::CLmkCategorySettingsContainer( |
|
75 MLmkKeyProcessor& aKeyProcessor, CAknView& aView) : |
|
76 CLmkBaseContainer(aKeyProcessor, KLM_HLP_EDIT_CATEGORIES), iView(aView), |
|
77 iCurrentIndex(0) |
|
78 { |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------- |
|
82 // CLmkCategorySettingsContainer::ConstructL |
|
83 // Symbian 2nd phase constructor can leave. |
|
84 // --------------------------------------------------------- |
|
85 // |
|
86 void CLmkCategorySettingsContainer::ConstructL(const TRect& aRect) |
|
87 { |
|
88 CLmkBaseContainer::BaseConstructL(); |
|
89 CreateWindowL(); |
|
90 |
|
91 CreateNaviPaneL(0); |
|
92 CLmkUiUtils::ChangeTitlePaneL( R_LMK_CATEGORY_SETTINGS_TITLE); |
|
93 |
|
94 CLmkAppUi* lmkAppUi = static_cast<CLmkAppUi*> (ViewAppUi()); |
|
95 CPosLandmarkDatabase& db = lmkAppUi->Document().LmDbL(); |
|
96 CLmkSender& sender = lmkAppUi->LmkSender(); |
|
97 |
|
98 iSelector = CLmkAppCategorySettingsImpl::NewL(db, sender, EFalse); |
|
99 iSelector->SetMskObserver(this); |
|
100 iListBox = &(iSelector->CreateListBoxL(this, EAknCtDoubleGraphicListBox, |
|
101 #ifdef RD_SCALABLE_UI_V2 |
|
102 EAknListBoxStylusMarkableList, |
|
103 #else |
|
104 EAknListBoxMarkableList, |
|
105 #endif //RD_SCALABLE_UI_V2 |
|
106 R_LMK_EMPTY_NO_CATEGORIES, R_LMK_GUIDE_NEW_CATEGORY)); |
|
107 |
|
108 // enable scroll arrows |
|
109 CEikScrollBarFrame* sBFrame = iListBox->CreateScrollBarFrameL(ETrue); |
|
110 sBFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, |
|
111 CEikScrollBarFrame::EAuto); |
|
112 |
|
113 SetRect(aRect); |
|
114 ActivateL(); |
|
115 } |
|
116 |
|
117 // ---------------------------------------------------------------------------- |
|
118 // CLmkCategorySettingsContainer::~CLmkCategorySettingsContainer |
|
119 // ---------------------------------------------------------------------------- |
|
120 // |
|
121 CLmkCategorySettingsContainer::~CLmkCategorySettingsContainer() |
|
122 { |
|
123 } |
|
124 |
|
125 // ---------------------------------------------------------------------------- |
|
126 // CLmkCategorySettingsContainer::SelectorImpl |
|
127 // ---------------------------------------------------------------------------- |
|
128 // |
|
129 CLmkAppCategorySettingsImpl& CLmkCategorySettingsContainer::SelectorImpl() |
|
130 { |
|
131 return *static_cast<CLmkAppCategorySettingsImpl*> (iSelector); |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------- |
|
135 // CLmkCategorySettingsContainer::ListBox() |
|
136 // --------------------------------------------------------- |
|
137 // |
|
138 CEikTextListBox& CLmkCategorySettingsContainer::ListBox() |
|
139 { |
|
140 __ASSERT_DEBUG(iListBox, Panic(KLmkPanicNullMember)); |
|
141 return *iListBox; |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------- |
|
145 // CLmkCategorySettingsContainer::OfferKeyEventL() |
|
146 // --------------------------------------------------------- |
|
147 // |
|
148 TKeyResponse CLmkCategorySettingsContainer::OfferKeyEventL( |
|
149 const TKeyEvent& aKeyEvent, TEventCode aType) |
|
150 { |
|
151 if (aType == EEventKey && aKeyEvent.iCode == EKeyBackspace |
|
152 && MenuBar()->ItemSpecificCommandsEnabled()) |
|
153 { |
|
154 CLmkAppSelectorImplBase& selector = SelectorImpl(); |
|
155 TInt markedCount(selector.ListMarkedItemCountL()); |
|
156 //TInt visibleCount( selector.ListVisibleItemCount() ); |
|
157 // if there is atleast one landmark and only one or less |
|
158 // is market then EKeyOK means edit command |
|
159 if (markedCount > 0) |
|
160 { |
|
161 selector.ProcessCommandL(ELmkCmdDeleteCat); |
|
162 return EKeyWasConsumed; |
|
163 } |
|
164 } |
|
165 return CLmkBaseContainer::OfferKeyEventL(aKeyEvent, aType); |
|
166 } |
|
167 |
|
168 // --------------------------------------------------------- |
|
169 // CLmkCategorySettingsContainer::SizeChanged() |
|
170 // Called by framework when the view size is changed |
|
171 // --------------------------------------------------------- |
|
172 // |
|
173 void CLmkCategorySettingsContainer::SizeChanged() |
|
174 { |
|
175 __ASSERT_DEBUG(iListBox, Panic(KLmkPanicNullMember)); |
|
176 iListBox->SetRect(Rect()); |
|
177 } |
|
178 |
|
179 // --------------------------------------------------------- |
|
180 // CLmkCategorySettingsContainer::CountComponentControls() const |
|
181 // --------------------------------------------------------- |
|
182 // |
|
183 TInt CLmkCategorySettingsContainer::CountComponentControls() const |
|
184 { |
|
185 //only one control allways |
|
186 return 1; // return nbr of controls inside this container |
|
187 } |
|
188 |
|
189 // --------------------------------------------------------- |
|
190 // CLmkCategorySettingsContainer::ComponentControl(TInt aIndex) const |
|
191 // --------------------------------------------------------- |
|
192 // |
|
193 CCoeControl* CLmkCategorySettingsContainer::ComponentControl(TInt /*aIndex*/) const |
|
194 { |
|
195 return iListBox; |
|
196 } |
|
197 |
|
198 // --------------------------------------------------------- |
|
199 // CLmkCategorySettingsContainer::MenuBar |
|
200 // --------------------------------------------------------- |
|
201 // |
|
202 CEikMenuBar* CLmkCategorySettingsContainer::MenuBar() |
|
203 { |
|
204 return ViewAppUi()->View(TUid::Uid(ELmkCategorySettingsView))->MenuBar(); |
|
205 } |
|
206 |
|
207 // --------------------------------------------------------- |
|
208 // CLmkCategorySettingsContainer::ContextSpecificMenuBar |
|
209 // --------------------------------------------------------- |
|
210 // |
|
211 TInt CLmkCategorySettingsContainer::ContextSpecificMenuBar() |
|
212 { |
|
213 return R_LMK_CATEGORY_SETTINGS_OK_MENUBAR; |
|
214 } |
|
215 |
|
216 // --------------------------------------------------------- |
|
217 // CLmkCategorySettingsContainer::OptionsMenuBar |
|
218 // --------------------------------------------------------- |
|
219 // |
|
220 TInt CLmkCategorySettingsContainer::OptionsMenuBar() |
|
221 { |
|
222 return R_LMK_CATEGORY_SETTINGS_MENUBAR; |
|
223 } |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 //CLmkCategorySettingsContainer::HandleResourceChange |
|
227 // ----------------------------------------------------------------------------- |
|
228 // |
|
229 void CLmkCategorySettingsContainer::HandleResourceChange(TInt aType) |
|
230 { |
|
231 CCoeControl::HandleResourceChange(aType); |
|
232 if (aType == KEikDynamicLayoutVariantSwitch || (aType |
|
233 == KAknsMessageSkinChange)) |
|
234 { |
|
235 (static_cast<CLmkCategorySettingsView *> (&iView))->Update(); |
|
236 } |
|
237 if (iListBox) |
|
238 { |
|
239 iListBox->DrawNow(); |
|
240 } |
|
241 } |
|
242 |
|
243 // ---------------------------------------------------------------------------- |
|
244 // CLmkCategorySettingsContainer::FocusChanged() |
|
245 // ---------------------------------------------------------------------------- |
|
246 // |
|
247 void CLmkCategorySettingsContainer::FocusChanged(TDrawNow aDrawNow) |
|
248 { |
|
249 if (iListBox) |
|
250 { |
|
251 iListBox->SetFocus(IsFocused(), aDrawNow); |
|
252 } |
|
253 } |
|
254 // ---------------------------------------------------------------------------- |
|
255 // CLmkCategorySettingsContainer::UpdateMskContainer() |
|
256 // ---------------------------------------------------------------------------- |
|
257 // |
|
258 void CLmkCategorySettingsContainer::UpdateMskContainerL() |
|
259 { |
|
260 CLmkBaseView* view = reinterpret_cast<CLmkBaseView*> (&iView); |
|
261 view->UpdateMskViewL(EContextMenu); |
|
262 } |
|
263 |
|
264 // ---------------------------------------------------------------------------- |
|
265 // CLmkCategorySettingsContainer::ResolveMskDisplayItem() |
|
266 // ---------------------------------------------------------------------------- |
|
267 // |
|
268 TLmkMskDispItem CLmkCategorySettingsContainer::ResolveMskDisplayItem() |
|
269 { |
|
270 TLmkMskDispItem dispItem = EContextMenu; |
|
271 if (SelectorImpl().ListVisibleItemCount() == 0) |
|
272 { |
|
273 dispItem = ENoMsk; |
|
274 } |
|
275 return dispItem; |
|
276 } |
|
277 |
|
278 #ifdef RD_SCALABLE_UI_V2 |
|
279 // --------------------------------------------------------- |
|
280 // CLmkCategorySettingsContainer::SetListBoxObserver |
|
281 // --------------------------------------------------------- |
|
282 // |
|
283 void CLmkCategorySettingsContainer::SetListBoxObserver(MEikListBoxObserver* aObserver) |
|
284 { |
|
285 __ASSERT_DEBUG( aObserver, Panic( KLmkPanicNullMember ) ); |
|
286 iListBox->SetListBoxObserver(aObserver); |
|
287 } |
|
288 |
|
289 // --------------------------------------------------------- |
|
290 // CLmkCategorySettingsContainer::HandlePoineteventL |
|
291 // --------------------------------------------------------- |
|
292 // |
|
293 void CLmkCategorySettingsContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
294 { |
|
295 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
296 // if(aPointerEvent.iType == TPointerEvent::EButton1Up) |
|
297 // { |
|
298 // TInt currIndex1 = iListBox->CurrentItemIndex(); |
|
299 // if( currIndex1 >=0 ) |
|
300 // { |
|
301 // CEikMenuBar* menubar = MenuBar(); |
|
302 // if ( menubar ) |
|
303 // { |
|
304 // menubar->SetContextMenuTitleResourceId(R_LMK_CATEGORY_SETTINGS_OK_MENUBAR); |
|
305 // TRAP_IGNORE( menubar->TryDisplayContextMenuBarL() ); |
|
306 // } |
|
307 // } |
|
308 // } |
|
309 } |
|
310 #endif//RD_SCALABLE_UI_V2 |
|
311 // End of File |