18
|
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: Provides LM compass view's container class methods.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
#include <aknlists.h>
|
|
20 |
#include <aknview.h>
|
|
21 |
#include <eikmenub.h>
|
|
22 |
#include <aknsfld.h>
|
|
23 |
#include <layoutmetadata.cdl.h> // To Check TOUCH Support
|
|
24 |
// For RD_AVKON_UNBRANCH
|
|
25 |
#include <bldvariant.hrh>
|
|
26 |
#include <AknDef.h>
|
|
27 |
#include <landmarks.rsg>
|
|
28 |
#include "CLmkAppUi.h"
|
|
29 |
#include "CLmkUiUtils.h"
|
|
30 |
#include "CLmkSender.h"
|
|
31 |
#include <csxhelp/lm.hlp.hrh>
|
|
32 |
#include "CLmkByLmView.h"
|
|
33 |
#include "CLmkByLmContainer.h"
|
|
34 |
#include "CLmkAppLmSelectorImpl.h"
|
|
35 |
#include "landmarks.hrh"
|
|
36 |
#include <lmkui.rsg>
|
|
37 |
#include "Debug.h"
|
|
38 |
|
|
39 |
// ----------- Touch feedback additions start
|
|
40 |
#ifdef RD_TACTILE_FEEDBACK
|
|
41 |
#include <touchfeedback.h>
|
|
42 |
#endif //RD_TACTILE_FEEDBACK
|
|
43 |
// ----------- Touch feedback additions end
|
|
44 |
|
|
45 |
// ================= MEMBER FUNCTIONS =======================
|
|
46 |
// ----------------------------------------------------------------------------
|
|
47 |
// CLmkByLmContainer::NewL
|
|
48 |
// ----------------------------------------------------------------------------
|
|
49 |
//
|
|
50 |
CLmkByLmContainer* CLmkByLmContainer::NewL(MLmkKeyProcessor& aKeyProcessor,
|
|
51 |
MObjectProvider* aParent, const TRect& aRect, CAknView& aView)
|
|
52 |
{
|
|
53 |
CLmkByLmContainer* self = new (ELeave) CLmkByLmContainer(aKeyProcessor,
|
|
54 |
aView);
|
|
55 |
CleanupStack::PushL(self);
|
|
56 |
self->SetMopParent(aParent);
|
|
57 |
self->ConstructL(aRect);
|
|
58 |
CleanupStack::Pop(); // self
|
|
59 |
return self;
|
|
60 |
}
|
|
61 |
|
|
62 |
// ----------------------------------------------------------------------------
|
|
63 |
// CLmkByLmContainer::ConstructL
|
|
64 |
// ----------------------------------------------------------------------------
|
|
65 |
//
|
|
66 |
void CLmkByLmContainer::ConstructL(const TRect& aRect)
|
|
67 |
{
|
|
68 |
CLmkLbWithFilterContainer::ConstructL(aRect);
|
|
69 |
iFindBox->SetObserver(this);
|
|
70 |
}
|
|
71 |
|
|
72 |
// ----------------------------------------------------------------------------
|
|
73 |
// CLmkByLmContainer::CLmkByLmContainer
|
|
74 |
// ----------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
CLmkByLmContainer::CLmkByLmContainer(MLmkKeyProcessor& aKeyProcessor,
|
|
77 |
CAknView& aView) :
|
|
78 |
CLmkLbWithFilterContainer(aKeyProcessor, KLM_HLP_LM_BY_NAME),
|
|
79 |
iView(aView)
|
|
80 |
{
|
|
81 |
iIsEditorOpened = EFalse;
|
|
82 |
iHandlePointerEvent = ETrue;
|
|
83 |
}
|
|
84 |
// ----------------------------------------------------------------------------
|
|
85 |
// CLmkByLmContainer::~CLmkByLmContainer
|
|
86 |
// ----------------------------------------------------------------------------
|
|
87 |
//
|
|
88 |
CLmkByLmContainer::~CLmkByLmContainer()
|
|
89 |
{
|
|
90 |
}
|
|
91 |
|
|
92 |
// ----------------------------------------------------------------------------
|
|
93 |
// CLmkByLmContainer::SetupTitlePaneL
|
|
94 |
// ----------------------------------------------------------------------------
|
|
95 |
//
|
|
96 |
void CLmkByLmContainer::SetupTitlePaneL()
|
|
97 |
{
|
|
98 |
CLmkUiUtils::ChangeTitlePaneL( R_LMK_BYLM_VIEW_TITLE);
|
|
99 |
}
|
|
100 |
|
|
101 |
// ----------------------------------------------------------------------------
|
|
102 |
// CLmkByLmContainer::SetupSelectorAndListL
|
|
103 |
// ----------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
void CLmkByLmContainer::SetupSelectorAndListL(CPosLandmarkDatabase& aDb,
|
|
106 |
CLmkSender& aSender)
|
|
107 |
{
|
|
108 |
iSelector = CLmkAppLmSelectorImpl::NewL(aDb, aSender, ETrue);
|
|
109 |
iSelector->SetMskObserver(this);
|
|
110 |
iListBox = &(iSelector->CreateListBoxL(this, EAknCtSingleGraphicListBox,
|
|
111 |
#ifdef RD_SCALABLE_UI_V2
|
|
112 |
EAknListBoxStylusMarkableList,
|
|
113 |
#else
|
|
114 |
EAknListBoxMarkableList,
|
|
115 |
#endif //RD_SCALABLE_UI_V2
|
|
116 |
R_LMK_EMPTY_NO_LANDMARKS, R_LMK_GUIDE_NEW_LANDMARK));
|
|
117 |
}
|
|
118 |
|
|
119 |
// ----------------------------------------------------------------------------
|
|
120 |
// CLmkByLmContainer::SetupNaviPaneL
|
|
121 |
// ----------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
void CLmkByLmContainer::SetupNaviPaneL()
|
|
124 |
{
|
|
125 |
iNaviDeco = CreateNaviPaneL(R_LMK_TAB_GROUP);
|
|
126 |
ActivateTabL(*iNaviDeco, ELmkByLmView);
|
|
127 |
}
|
|
128 |
|
|
129 |
// ----------------------------------------------------------------------------
|
|
130 |
// CLmkByLmContainer::OfferKeyEventL
|
|
131 |
// ----------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
TKeyResponse CLmkByLmContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,
|
|
134 |
TEventCode aType)
|
|
135 |
{
|
|
136 |
DEBUG( CLmkByLmContainer::OfferKeyEventL entered );
|
|
137 |
DEBUG2( aKeyEvent.iCode=%d aKeyEvent.iScanCode=%d,
|
|
138 |
aKeyEvent.iCode,
|
|
139 |
aKeyEvent.iScanCode
|
|
140 |
);
|
|
141 |
DEBUG3( aKeyEvent.iModifiers=%d aKeyEvent.iRepeats=%d aType=%d,
|
|
142 |
aKeyEvent.iModifiers,
|
|
143 |
aKeyEvent.iRepeats,
|
|
144 |
aType
|
|
145 |
);
|
|
146 |
|
|
147 |
TBool shiftKeyPressed = (aKeyEvent.iModifiers & EModifierShift)
|
|
148 |
|| (aKeyEvent.iModifiers & EModifierLeftShift)
|
|
149 |
|| (aKeyEvent.iModifiers & EModifierRightShift);
|
|
150 |
|
|
151 |
if (aKeyEvent.iScanCode == EStdKeyUpArrow || aKeyEvent.iScanCode
|
|
152 |
== EStdKeyDownArrow)
|
|
153 |
{
|
|
154 |
if (aType == EEventKey)
|
|
155 |
{
|
|
156 |
if (iListBox->OfferKeyEventL(aKeyEvent, aType) == EKeyWasConsumed)
|
|
157 |
{
|
|
158 |
if (shiftKeyPressed)
|
|
159 |
UpdateMskContainerL();
|
|
160 |
return EKeyWasConsumed;
|
|
161 |
}
|
|
162 |
}
|
|
163 |
return EKeyWasNotConsumed;
|
|
164 |
}
|
|
165 |
|
|
166 |
CLmkAppSelectorImplBase& selector = SelectorImpl();
|
|
167 |
TInt markedCount(selector.ListMarkedItemCountL());
|
|
168 |
TInt visibleCount(selector.ListVisibleItemCount());
|
|
169 |
DEBUG1( CLmkByLmContainer::OfferKeyEventL markedCount=%d,markedCount );
|
|
170 |
DEBUG1( CLmkByLmContainer::OfferKeyEventL visibleCount=%d,visibleCount );
|
|
171 |
|
|
172 |
if (aKeyEvent.iCode == EKeyOK && !shiftKeyPressed && aType == EEventKey)
|
|
173 |
{
|
|
174 |
DEBUG( CLmkByLmContainer::OfferKeyEventL EKeyOK );
|
|
175 |
if (visibleCount > 0 && markedCount < 1)
|
|
176 |
{
|
|
177 |
DEBUG( CLmkByLmContainer::OfferKeyEventL EKeyOK ELmkCmdOpenLm );
|
|
178 |
// Launch landmark viewer here
|
|
179 |
selector.ProcessCommandL(ELmkCmdOpenLm);
|
|
180 |
iIsEditorOpened = ETrue;
|
|
181 |
return EKeyWasConsumed;
|
|
182 |
}
|
|
183 |
else
|
|
184 |
{
|
|
185 |
DEBUG( CLmkByLmContainer::OfferKeyEventL EKeyOK show menubar );
|
|
186 |
CEikMenuBar* menubar =
|
|
187 |
static_cast<CAknViewAppUi*> (iAvkonAppUi)->View(
|
|
188 |
TUid::Uid(ELmkByLmView))->MenuBar();
|
|
189 |
if (menubar)
|
|
190 |
{
|
|
191 |
menubar->SetMenuTitleResourceId(R_LMK_OK_MENUBAR);
|
|
192 |
|
|
193 |
menubar->StopDisplayingMenuBar();
|
|
194 |
TRAPD(err, menubar->TryDisplayMenuBarL());
|
|
195 |
DEBUG1( CLmkByLmContainer::OfferKeyEventL menubar->TryDisplayMenuBarL() = %d,err );
|
|
196 |
// set ordinary menubar back even in case of error
|
|
197 |
menubar->SetMenuTitleResourceId(R_LMK_BYLM_MENUBAR);
|
|
198 |
User::LeaveIfError( err);
|
|
199 |
}
|
|
200 |
|
|
201 |
return EKeyWasConsumed;
|
|
202 |
}
|
|
203 |
}
|
|
204 |
else if (shiftKeyPressed && aType == EEventKeyUp)
|
|
205 |
{
|
|
206 |
UpdateMskContainerL();
|
|
207 |
}
|
|
208 |
else
|
|
209 |
{
|
|
210 |
DEBUG( CLmkByLmContainer::OfferKeyEventL send event key & other keys handling );
|
|
211 |
// 'send' eveny key processing
|
|
212 |
if (visibleCount > 0 && markedCount < 1)
|
|
213 |
{
|
|
214 |
// Check TOUCH Support
|
|
215 |
if (aKeyEvent.iCode == EKeyPhoneSend
|
|
216 |
&& (!Layout_Meta_Data::IsPenEnabled()))
|
|
217 |
{
|
|
218 |
selector.ProcessCommandL(ELmkCmdCall);
|
|
219 |
}
|
|
220 |
}
|
|
221 |
if (iIsEditorOpened)
|
|
222 |
{
|
|
223 |
DEBUG( CLmkByLmContainer::OfferKeyEventL iIsEditorOpened entered );
|
|
224 |
SelectorImpl().HandleListProviderEvent(ELmkEventListReady);
|
|
225 |
}
|
|
226 |
}
|
|
227 |
iIsEditorOpened = EFalse;
|
|
228 |
DEBUG( CLmkByLmContainer::OfferKeyEventL end );
|
|
229 |
return CLmkLbWithFilterContainer::OfferKeyEventL(aKeyEvent, aType);
|
|
230 |
}
|
|
231 |
|
|
232 |
// ----------------------------------------------------------------------------
|
|
233 |
// CLmkByLmContainer::HandleControlEventL()
|
|
234 |
// Called by framework when the view size is changed
|
|
235 |
// ----------------------------------------------------------------------------
|
|
236 |
//
|
|
237 |
|
|
238 |
void CLmkByLmContainer::HandleControlEventL(CCoeControl* aControl,
|
|
239 |
TCoeEvent aEventType)
|
|
240 |
{
|
|
241 |
if (aEventType == EEventStateChanged && aControl == iFindBox)
|
|
242 |
{
|
|
243 |
SelectorImpl().ProcessCommandL(ELmkCmdFindBoxSearchAfresh);
|
|
244 |
}
|
|
245 |
}
|
|
246 |
|
|
247 |
// -----------------------------------------------------------------------------
|
|
248 |
//CLmkByLmContainer::HandleResourceChange
|
|
249 |
// -----------------------------------------------------------------------------
|
|
250 |
//
|
|
251 |
void CLmkByLmContainer::HandleResourceChange(TInt aType)
|
|
252 |
{
|
|
253 |
CCoeControl::HandleResourceChange(aType);
|
|
254 |
if (aType == KEikDynamicLayoutVariantSwitch)
|
|
255 |
{
|
|
256 |
(static_cast<CLmkByLmView *> (&iView))->Update();
|
|
257 |
}
|
|
258 |
|
|
259 |
if (iListBox)
|
|
260 |
{
|
|
261 |
iListBox->DrawNow();
|
|
262 |
}
|
|
263 |
if (iFindBox && iFindBox->IsVisible())
|
|
264 |
{
|
|
265 |
iFindBox->DrawNow();
|
|
266 |
}
|
|
267 |
}
|
|
268 |
|
|
269 |
// ----------------------------------------------------------------------------
|
|
270 |
// CLmkByLmContainer::GetSelectedLandmarksL
|
|
271 |
// ----------------------------------------------------------------------------
|
|
272 |
//
|
|
273 |
TInt CLmkByLmContainer::GetSelectedLandmarksL(
|
|
274 |
RPointerArray<CPosLandmark> &aArray)
|
|
275 |
{
|
|
276 |
return (static_cast<CLmkAppLmSelectorImpl*> (iSelector))->GetSelectedLandmarksL(
|
|
277 |
aArray);
|
|
278 |
}
|
|
279 |
|
|
280 |
// ----------------------------------------------------------------------------
|
|
281 |
// CLmkByLmContainer::IsLandmarkEmptyL
|
|
282 |
// ----------------------------------------------------------------------------
|
|
283 |
//
|
|
284 |
TBool CLmkByLmContainer::IsLandmarkDataEmptyL(CPosLandmark* aLandmark)
|
|
285 |
{
|
|
286 |
return (static_cast<CLmkAppLmSelectorImpl*> (iSelector))->IsLandmarkDataEmptyL(
|
|
287 |
aLandmark);
|
|
288 |
}
|
|
289 |
|
|
290 |
// ----------------------------------------------------------------------------
|
|
291 |
// CLmkByLmContainer::FocusChanged()
|
|
292 |
// ----------------------------------------------------------------------------
|
|
293 |
//
|
|
294 |
void CLmkByLmContainer::FocusChanged(TDrawNow aDrawNow)
|
|
295 |
{
|
|
296 |
if (iListBox)
|
|
297 |
{
|
|
298 |
iListBox->SetFocus(IsFocused(), aDrawNow);
|
|
299 |
}
|
|
300 |
if (iFindBox && iFindBox->IsVisible())
|
|
301 |
{
|
|
302 |
iFindBox->SetFocus(IsFocused(), aDrawNow);
|
|
303 |
}
|
|
304 |
}
|
|
305 |
|
|
306 |
// ----------------------------------------------------------------------------
|
|
307 |
// CLmkByLmContainer::IsEditorOpened()
|
|
308 |
// ----------------------------------------------------------------------------
|
|
309 |
//
|
|
310 |
TBool CLmkByLmContainer::IsEditorOpened()
|
|
311 |
{
|
|
312 |
return iIsEditorOpened;
|
|
313 |
}
|
|
314 |
|
|
315 |
// ----------------------------------------------------------------------------
|
|
316 |
// CLmkByLmContainer::SetEditorOpenedBool()
|
|
317 |
// ----------------------------------------------------------------------------
|
|
318 |
//
|
|
319 |
void CLmkByLmContainer::SetEditorOpenedBool(TBool aBoolvalue)
|
|
320 |
{
|
|
321 |
iIsEditorOpened = aBoolvalue;
|
|
322 |
}
|
|
323 |
|
|
324 |
// ----------------------------------------------------------------------------
|
|
325 |
// CLmkByLmContainer::UpdateMskContainerL()
|
|
326 |
// ----------------------------------------------------------------------------
|
|
327 |
//
|
|
328 |
void CLmkByLmContainer::UpdateMskContainerL()
|
|
329 |
{
|
|
330 |
CLmkBaseView* view = reinterpret_cast<CLmkBaseView*> (&iView);
|
|
331 |
view->UpdateMskViewL(ResolveMskDisplayItem());
|
|
332 |
}
|
|
333 |
|
|
334 |
// ---------------------------------------------------------
|
|
335 |
// CLmkByLmContainer::MenuBar
|
|
336 |
// ---------------------------------------------------------
|
|
337 |
//
|
|
338 |
CEikMenuBar* CLmkByLmContainer::MenuBar()
|
|
339 |
{
|
|
340 |
return ViewAppUi()->View(TUid::Uid(ELmkByLmView))->MenuBar();
|
|
341 |
}
|
|
342 |
|
|
343 |
// ---------------------------------------------------------
|
|
344 |
// CLmkByLmContainer::ContextSpecificMenuBar
|
|
345 |
// ---------------------------------------------------------
|
|
346 |
//
|
|
347 |
TInt CLmkByLmContainer::ContextSpecificMenuBar()
|
|
348 |
{
|
|
349 |
return R_LMK_OK_MENUBAR;
|
|
350 |
}
|
|
351 |
|
|
352 |
// ---------------------------------------------------------
|
|
353 |
// CLmkByLmContainer::SetHandlePointerEventBool
|
|
354 |
// ---------------------------------------------------------
|
|
355 |
//
|
|
356 |
void CLmkByLmContainer::SetHandlePointerEventBool(TBool aBoolValue)
|
|
357 |
{
|
|
358 |
iHandlePointerEvent = aBoolValue;
|
|
359 |
}
|
|
360 |
|
|
361 |
#ifdef RD_SCALABLE_UI_V2
|
|
362 |
// ---------------------------------------------------------
|
|
363 |
// CLmkByLmContainer::HandlePoineteventL
|
|
364 |
// ---------------------------------------------------------
|
|
365 |
//
|
|
366 |
void CLmkByLmContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
|
|
367 |
{
|
|
368 |
CCoeControl::HandlePointerEventL(aPointerEvent);
|
|
369 |
}
|
|
370 |
|
|
371 |
#endif//RD_SCALABLE_UI_V2
|
|
372 |
// End of File
|