|
1 /* |
|
2 * Copyright (c) 2007-2008 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 blid startup view class methods. |
|
15 * |
|
16 */ |
|
17 |
|
18 // SYSTEM INCLUDES |
|
19 #include <aknmessagequerydialog.h> //CAknMessageQueryDialog |
|
20 #include <StringLoader.h> |
|
21 #include <aknconsts.h> |
|
22 #include <blid.rsg> |
|
23 #include <akntitle.h> |
|
24 #include <aknnavide.h> |
|
25 #include <eikspane.h> |
|
26 #include <aknlayoutscalable_apps.cdl.h> |
|
27 #include <layoutmetadata.cdl.h> |
|
28 #include <blid.mbg> |
|
29 |
|
30 // HTK includes |
|
31 #include <alf/alfenv.h> |
|
32 #include <alf/alfanchorlayout.h> |
|
33 #include <alf/alftextvisual.h> |
|
34 #include <alf/alftextstyle.h> |
|
35 #include <alf/alfborderbrush.h> |
|
36 #include <alf/alfbrusharray.h> |
|
37 #include <alf/alfevent.h> |
|
38 #include <alf/alftransformation.h> |
|
39 #include <alf/alftexture.h> |
|
40 #include <alf/alfdecklayout.h> |
|
41 #include <alf/alfutil.h> |
|
42 #include <alf/alfimageloaderutil.h> |
|
43 #include <alf/alfimagevisual.h> |
|
44 |
|
45 #include "Blid.hrh" |
|
46 |
|
47 // USER INCLUDES |
|
48 #include "CBlidMainControl.h" |
|
49 #include "CBlidEng.h" |
|
50 #include "CBlidDocument.h" |
|
51 #include "MBlidLocation.h" |
|
52 #include "CBlidBaseView.h" |
|
53 #include "CBlidBaseContainer.h" |
|
54 #include "bliduiconsts.h" |
|
55 #include "BlidNotes.h" |
|
56 #include "CBlidLocSettingLauncher.h" |
|
57 #include "Debug.h" |
|
58 |
|
59 TInt CBlidMainControl::iPSYTimeoutCount = 0; |
|
60 |
|
61 TInt MessageQueryCallBack(TAny* aPtr); |
|
62 |
|
63 const TInt KTimerValue = 200000; |
|
64 |
|
65 // ================= MEMBER FUNCTIONS ======================= |
|
66 // --------------------------------------------------------- |
|
67 // CBlidMainControl::NewL() |
|
68 // Two phased constructor |
|
69 // --------------------------------------------------------- |
|
70 // |
|
71 CBlidMainControl* CBlidMainControl::NewL(CAlfEnv& aEnv, const TRect& aRect, |
|
72 CBlidBaseView& aView) |
|
73 { |
|
74 CBlidMainControl* self = new (ELeave) CBlidMainControl(aEnv, aView); |
|
75 CleanupStack::PushL(self); |
|
76 self->ConstructL(aRect); |
|
77 CleanupStack::Pop(self); |
|
78 return self; |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------- |
|
82 //CBlidMainControl::CBlidMainControl() |
|
83 // First phase constructor, can not leave |
|
84 // --------------------------------------------------------- |
|
85 // |
|
86 CBlidMainControl::CBlidMainControl(CAlfEnv& aEnv, CBlidBaseView& aView) : |
|
87 CAlfControl(), iEnv(aEnv), iView(aView), isAccessoryRequired(EFalse) |
|
88 { |
|
89 iOnlineMode = EFalse; |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------- |
|
93 // CBlidMainControl::ConstructL() |
|
94 // Second phase constructor, may leave |
|
95 // --------------------------------------------------------- |
|
96 // |
|
97 void CBlidMainControl::ConstructL(const TRect& /*aRect*/) |
|
98 { |
|
99 CAlfControl::ConstructL(iEnv); |
|
100 |
|
101 iMainLayout = CAlfAnchorLayout::AddNewL(*this); |
|
102 iSearchTextVisual = CAlfTextVisual::AddNewL(*this, iMainLayout); |
|
103 iAnimationVisual = CAlfImageVisual::AddNewL(*this, iMainLayout); |
|
104 |
|
105 iDisplayIcon = 1; |
|
106 iPeriodic = CPeriodic::NewL(0); // neutral priority |
|
107 if (!iPeriodic->IsActive()) |
|
108 { |
|
109 iPeriodic->Start(TTimeIntervalMicroSeconds32(KTimerValue), |
|
110 TTimeIntervalMicroSeconds32(KTimerValue), TCallBack(Tick, |
|
111 this)); |
|
112 } |
|
113 |
|
114 UpdateDisplayLayoutL(); |
|
115 CreateSearchingTextL(); |
|
116 CreateAnimationL(); |
|
117 UpdateAnimation(); |
|
118 |
|
119 iLauncher = NULL; |
|
120 isSettingsLaunched = EFalse; |
|
121 |
|
122 //start requesting |
|
123 CBlidEng* engine = iView.BlidDocument()->Engine(); |
|
124 iLocation = engine->LocationModel(); |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------- |
|
128 // CBlidMainControl::Tick() |
|
129 // Timer callback function, to update image in animation |
|
130 // --------------------------------------------------------- |
|
131 // |
|
132 TInt CBlidMainControl::Tick(TAny* aObject) |
|
133 { |
|
134 ((CBlidMainControl*) aObject)->UpdateAnimation(); // cast, and call non-static function |
|
135 return KErrNone; |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------- |
|
139 // CBlidMainControl::CreateSearchingTextL() |
|
140 // Function to create search text visual |
|
141 // --------------------------------------------------------- |
|
142 // |
|
143 void CBlidMainControl::CreateSearchingTextL() |
|
144 { |
|
145 /* Layout Hierarchy |
|
146 main_blid2_pane -> blid2_search_pane -> blid2_search_pane_t1 |
|
147 */ |
|
148 |
|
149 // Get the text font |
|
150 |
|
151 TInt typefaceStyleId = iEnv.TextStyleManager().CreatePlatformTextStyleL( |
|
152 EAknLogicalFontPrimarySmallFont, EAlfTextStyleNormal); |
|
153 CAlfTextStyle* style1 = |
|
154 iEnv.TextStyleManager().TextStyle(typefaceStyleId); |
|
155 style1->SetBold(ETrue); |
|
156 // Set the text font size in pixel |
|
157 style1->SetTextPaneHeightInPixels(26, ETrue); |
|
158 |
|
159 TRgb rgb; |
|
160 // Fetch the skin color |
|
161 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), rgb, |
|
162 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG1); |
|
163 |
|
164 iSearchTextVisual->SetColor(rgb); |
|
165 HBufC* noteText = StringLoader::LoadLC(R_BLID_NOTE_SEARCHING_ANIMATION, |
|
166 CEikonEnv::Static()); |
|
167 iSearchTextVisual->SetTextL(*noteText); |
|
168 iSearchTextVisual->SetTextStyle(style1->Id()); |
|
169 iSearchTextVisual->SetAlign(EAlfAlignHCenter, EAlfAlignVCenter); |
|
170 CleanupStack::PopAndDestroy(noteText); //noteText |
|
171 |
|
172 } |
|
173 |
|
174 // --------------------------------------------------------- |
|
175 // CBlidMainControl::CreateAnimationL() |
|
176 // Creates image visuals for animation |
|
177 // --------------------------------------------------------- |
|
178 // |
|
179 void CBlidMainControl::CreateAnimationL() |
|
180 { |
|
181 /* Layout Hierarchy |
|
182 main_blid2_pane -> blid2_search_pane -> blid2_search_pane_g1 |
|
183 */ |
|
184 |
|
185 // code to load svg icon |
|
186 MAlfBitmapProvider* provider = NULL; |
|
187 |
|
188 // first creste the image loader utils and then call SetSize. |
|
189 iView.ImageLoaderUtils()->SetSize(iAnimationRect.Size()); |
|
190 |
|
191 // then create the bitmap provider |
|
192 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( |
|
193 KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file |
|
194 iView.ImagePathName(), // mif file name with path. |
|
195 EMbmBlidQgn_graf_blid_startup_01, // bitmap id defiened in mbg file |
|
196 EMbmBlidQgn_graf_blid_startup_01_mask); // bitmap mask id defiened in mbg file |
|
197 // now using that bitmap provider create the texture. |
|
198 CAlfTexture & texture1 = iEnv.TextureManager().CreateTextureL( |
|
199 KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); |
|
200 iTextures.Append(&texture1); |
|
201 |
|
202 // then create the bitmap provider |
|
203 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( |
|
204 KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file |
|
205 iView.ImagePathName(), // mif file name with path. |
|
206 EMbmBlidQgn_graf_blid_startup_02, // bitmap id defiened in mbg file |
|
207 EMbmBlidQgn_graf_blid_startup_02_mask); // bitmap mask id defiened in mbg file |
|
208 // now using that bitmap provider create the texture. |
|
209 CAlfTexture & texture2 = iEnv.TextureManager().CreateTextureL( |
|
210 KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); |
|
211 iTextures.Append(&texture2); |
|
212 |
|
213 // then create the bitmap provider |
|
214 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( |
|
215 KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file |
|
216 iView.ImagePathName(), // mif file name with path. |
|
217 EMbmBlidQgn_graf_blid_startup_03, // bitmap id defiened in mbg file |
|
218 EMbmBlidQgn_graf_blid_startup_03_mask); // bitmap mask id defiened in mbg file |
|
219 // now using that bitmap provider create the texture. |
|
220 CAlfTexture & texture3 = iEnv.TextureManager().CreateTextureL( |
|
221 KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); |
|
222 iTextures.Append(&texture3); |
|
223 |
|
224 // then create the bitmap provider |
|
225 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( |
|
226 KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file |
|
227 iView.ImagePathName(), // mif file name with path. |
|
228 EMbmBlidQgn_graf_blid_startup_04, // bitmap id defiened in mbg file |
|
229 EMbmBlidQgn_graf_blid_startup_04_mask); // bitmap mask id defiened in mbg file |
|
230 // now using that bitmap provider create the texture. |
|
231 CAlfTexture & texture4 = iEnv.TextureManager().CreateTextureL( |
|
232 KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); |
|
233 iTextures.Append(&texture4); |
|
234 |
|
235 // then create the bitmap provider |
|
236 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( |
|
237 KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file |
|
238 iView.ImagePathName(), // mif file name with path. |
|
239 EMbmBlidQgn_graf_blid_startup_05, // bitmap id defiened in mbg file |
|
240 EMbmBlidQgn_graf_blid_startup_05_mask); // bitmap mask id defiened in mbg file |
|
241 // now using that bitmap provider create the texture. |
|
242 CAlfTexture & texture5 = iEnv.TextureManager().CreateTextureL( |
|
243 KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); |
|
244 iTextures.Append(&texture5); |
|
245 |
|
246 // then create the bitmap provider |
|
247 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( |
|
248 KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file |
|
249 iView.ImagePathName(), // mif file name with path. |
|
250 EMbmBlidQgn_graf_blid_startup_06, // bitmap id defiened in mbg file |
|
251 EMbmBlidQgn_graf_blid_startup_06_mask); // bitmap mask id defiened in mbg file |
|
252 // now using that bitmap provider create the texture. |
|
253 CAlfTexture & texture6 = iEnv.TextureManager().CreateTextureL( |
|
254 KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); |
|
255 iTextures.Append(&texture6); |
|
256 |
|
257 // then create the bitmap provider |
|
258 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( |
|
259 KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file |
|
260 iView.ImagePathName(), // mif file name with path. |
|
261 EMbmBlidQgn_graf_blid_startup_07, // bitmap id defiened in mbg file |
|
262 EMbmBlidQgn_graf_blid_startup_07_mask); // bitmap mask id defiened in mbg file |
|
263 // now using that bitmap provider create the texture. |
|
264 CAlfTexture & texture7 = iEnv.TextureManager().CreateTextureL( |
|
265 KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); |
|
266 iTextures.Append(&texture7); |
|
267 |
|
268 // then create the bitmap provider |
|
269 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( |
|
270 KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file |
|
271 iView.ImagePathName(), // mif file name with path. |
|
272 EMbmBlidQgn_graf_blid_startup_08, // bitmap id defiened in mbg file |
|
273 EMbmBlidQgn_graf_blid_startup_08_mask); // bitmap mask id defiened in mbg file |
|
274 // now using that bitmap provider create the texture. |
|
275 CAlfTexture & texture8 = iEnv.TextureManager().CreateTextureL( |
|
276 KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); |
|
277 iTextures.Append(&texture8); |
|
278 |
|
279 } |
|
280 |
|
281 // --------------------------------------------------------- |
|
282 // CBlidMainControl::UpdateAnimation |
|
283 // updates the animation image |
|
284 // --------------------------------------------------------- |
|
285 // |
|
286 void CBlidMainControl::UpdateAnimation() |
|
287 { |
|
288 if (KNumOfStartUpIcon > iDisplayIcon) |
|
289 { |
|
290 iDisplayIcon++; |
|
291 } |
|
292 else |
|
293 { |
|
294 iDisplayIcon = 1; |
|
295 } |
|
296 iAnimationVisual->SetImage(TAlfImage(*iTextures[iDisplayIcon - 1]));//N |
|
297 } |
|
298 |
|
299 // ---------------------------------------------------- |
|
300 // CBlidMainControl::~CBlidMainControl |
|
301 // Destructor |
|
302 // Frees reserved resources |
|
303 // ---------------------------------------------------- |
|
304 // |
|
305 CBlidMainControl::~CBlidMainControl() |
|
306 { |
|
307 iTextures.Reset(); |
|
308 iTextures.Close(); |
|
309 delete iLauncher; |
|
310 delete iHeadPaneText; |
|
311 delete iMsgQueryText; |
|
312 delete iLinkText; |
|
313 delete iMsgQText; |
|
314 delete iPeriodic; |
|
315 } |
|
316 |
|
317 // --------------------------------------------------------- |
|
318 // CBlidMainControl::UpdateL |
|
319 // Updates the view after getting update from location model |
|
320 // --------------------------------------------------------- |
|
321 // |
|
322 void CBlidMainControl::UpdateL() |
|
323 { |
|
324 TInt result = 0; |
|
325 DEBUG1(" CBlidMainControl::UpdateL iErrorCode ::%d", iErrorCode ); |
|
326 |
|
327 if (!iView.IsSatViewActive() && iOnlineMode) |
|
328 { |
|
329 |
|
330 if (iView.IsForeGroundApp()) |
|
331 { |
|
332 iView.ActivateSatelliteViewL(); |
|
333 } |
|
334 } |
|
335 TInt retVal = iLocation->CheckGPSAvailability(); |
|
336 // Check GPS device availability |
|
337 DEBUG1(" CBlidMainControl::CheckGPSAvailability code ::%d", retVal ); |
|
338 switch (iErrorCode) |
|
339 { |
|
340 case KErrTimedOut: |
|
341 { |
|
342 if (retVal == 1) |
|
343 { |
|
344 /* |
|
345 GPS device connected but position information |
|
346 available but not of good quality |
|
347 */ |
|
348 if (iView.IsForeGroundApp()) |
|
349 { |
|
350 iView.ActivateSatelliteViewL(); |
|
351 } |
|
352 } |
|
353 break; |
|
354 } |
|
355 case KErrNotFound: |
|
356 // No module (PSY) selected or invalid PSY |
|
357 { |
|
358 iOnlineMode = EFalse; |
|
359 if (iView.IsForeGroundApp()) |
|
360 { |
|
361 iLocation->StopRequesting(); |
|
362 TCallBack callback(MessageQueryCallBack, this); |
|
363 result |
|
364 = DispMsgQueryWithLinkL(R_BLID_NOGPS_FOUND, |
|
365 R_BLID_NOGPS_FOUND_TEXT, |
|
366 R_BLID_SELECT_POSITIONING_METHOD, ETrue, |
|
367 callback); |
|
368 if (result == EBlidSoftkeyRetry) |
|
369 { |
|
370 iLocation->StartRequesting(); |
|
371 } |
|
372 else if (result == EAknSoftkeyOk) |
|
373 { |
|
374 iView.ExitMainApplicationL(EEikCmdExit); |
|
375 } |
|
376 } |
|
377 break; |
|
378 } |
|
379 case KPositionPartialUpdate: |
|
380 { |
|
381 if (iView.IsForeGroundApp()) |
|
382 { |
|
383 iView.ActivateSatelliteViewL(); |
|
384 } |
|
385 break; |
|
386 } |
|
387 case KErrArgument: |
|
388 // The positioning module is unable to support the requested type |
|
389 default: |
|
390 { |
|
391 iOnlineMode = EFalse; |
|
392 |
|
393 if (retVal == 0) |
|
394 { |
|
395 if (iLocation->IsSatCapablePsyAvailable()) |
|
396 { |
|
397 iLocation->StopRequesting(); |
|
398 iOnlineMode = EFalse; |
|
399 TCallBack callback(MessageQueryCallBack, this); |
|
400 result = DispMsgQueryWithLinkL(R_BLID_NOPSY_ENABLED, |
|
401 R_BLID_ERROR_NO_PSY, |
|
402 R_BLID_SELECT_POSITIONING_METHOD, ETrue, |
|
403 callback); |
|
404 if (result == EBlidSoftkeyRetry) |
|
405 { |
|
406 iLocation->StartRequesting(); |
|
407 } |
|
408 else if (result == EAknSoftkeyOk) |
|
409 { |
|
410 iView.ExitMainApplicationL(EEikCmdExit); |
|
411 } |
|
412 } |
|
413 // no GPS device note |
|
414 // GPS un-available |
|
415 else if (iView.IsForeGroundApp()) |
|
416 { |
|
417 iLocation->StopRequesting(); |
|
418 TCallBack callback(MessageQueryCallBack, this); |
|
419 isAccessoryRequired = ETrue; |
|
420 result = DispMsgQueryWithLinkL(R_BLID_NOGPS_FOUND, |
|
421 R_BLID_NOGPS_AVAILABLE_TEXT, |
|
422 R_BLID_SELECT_POSITIONING_METHOD, EFalse, |
|
423 callback); |
|
424 if (result == EAknSoftkeyOk) |
|
425 { |
|
426 iView.ExitMainApplicationL(EEikCmdExit); |
|
427 } |
|
428 } |
|
429 else |
|
430 { |
|
431 BlidNotes::iGPSUnavailableDisplayed = ETrue; |
|
432 } |
|
433 CBlidBaseContainer::SetGPSAvailability(EFalse); |
|
434 } |
|
435 break; |
|
436 |
|
437 } |
|
438 } |
|
439 } |
|
440 |
|
441 // ---------------------------------------------------- |
|
442 // CBlidMainControl::MakeTitleL |
|
443 // Sets the title to string represented by resource |
|
444 // ---------------------------------------------------- |
|
445 // |
|
446 void CBlidMainControl::MakeTitleL(TInt aResourceText) |
|
447 { |
|
448 HBufC* buffer = StringLoader::LoadLC(aResourceText); |
|
449 CAknTitlePane* title = |
|
450 static_cast<CAknTitlePane*> (StatusPane()-> ControlL(TUid::Uid( |
|
451 EEikStatusPaneUidTitle))); |
|
452 CleanupStack::Pop(); //buffer |
|
453 title->SetText(buffer); // Takes ownership of buf |
|
454 } |
|
455 |
|
456 // ---------------------------------------------------- |
|
457 // CBlidMainControl::StatusPane |
|
458 // Returns the status pane |
|
459 // ---------------------------------------------------- |
|
460 // |
|
461 CEikStatusPane* CBlidMainControl::StatusPane() const |
|
462 { |
|
463 return CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
464 } |
|
465 |
|
466 // ---------------------------------------------------- |
|
467 // CBlidMainControl::SetErrorCode |
|
468 // Sets the error code |
|
469 // ---------------------------------------------------- |
|
470 // |
|
471 void CBlidMainControl::SetErrorCode(const TInt aErrorCode) |
|
472 { |
|
473 iErrorCode = aErrorCode; |
|
474 } |
|
475 |
|
476 // ---------------------------------------------------- |
|
477 // CBlidMainControl::SetOnlineMode |
|
478 // Sets the online mode |
|
479 // ---------------------------------------------------- |
|
480 // |
|
481 void CBlidMainControl::SetOnlineMode(const TBool aOnlineMode) |
|
482 { |
|
483 iOnlineMode = aOnlineMode; |
|
484 } |
|
485 |
|
486 // ---------------------------------------------------- |
|
487 // CBlidMainControl::DispMsgQueryWithLinkL() |
|
488 // Displays the message query with a link |
|
489 // ---------------------------------------------------- |
|
490 // |
|
491 TInt CBlidMainControl::DispMsgQueryWithLinkL(TInt aHeadingText, |
|
492 TInt aMsgQueryText, TInt aLinkText, TBool aLinkShow, |
|
493 TCallBack aCallBack) |
|
494 { |
|
495 CEikonEnv* env = CEikonEnv::Static(); |
|
496 if (!iHeadPaneText) |
|
497 { |
|
498 iHeadPaneText = env->AllocReadResourceL(aHeadingText); |
|
499 } |
|
500 |
|
501 if (!iMsgQueryText) |
|
502 { |
|
503 iMsgQueryText = env->AllocReadResourceL(aMsgQueryText); |
|
504 } |
|
505 |
|
506 if (!iLinkText) |
|
507 { |
|
508 iLinkText = env->AllocReadResourceL(aLinkText); |
|
509 } |
|
510 if (!iMsgQText) |
|
511 { |
|
512 if (aLinkShow != EFalse) |
|
513 { |
|
514 iMsgQText = HBufC::NewL(iMsgQueryText->Length() |
|
515 + KNewLine().Length() + KOpeningLinkTag().Length() |
|
516 + iLinkText->Length() + KClosingLinkTag().Length()); |
|
517 } |
|
518 else |
|
519 { |
|
520 iMsgQText = HBufC::NewL(iMsgQueryText->Length() |
|
521 + KNewLine().Length() + KOpeningLinkTag().Length()); |
|
522 } |
|
523 } |
|
524 |
|
525 iMsgQText->Des().Copy(*iMsgQueryText); |
|
526 iMsgQText->Des().Append(KNewLine); |
|
527 if (!isAccessoryRequired) |
|
528 { |
|
529 iMsgQText->Des().Append(KOpeningLinkTag); |
|
530 iMsgQText->Des().Append(*iLinkText); |
|
531 iMsgQText->Des().Append(KClosingLinkTag); |
|
532 } |
|
533 else |
|
534 { |
|
535 iMsgQText->Des().Append(_L( " ")); |
|
536 } |
|
537 ////////////////////////////////////////////////////// |
|
538 CAknMessageQueryDialog* msgDlg = CAknMessageQueryDialog::NewL(*iMsgQText); |
|
539 |
|
540 // if we remove this if part it will give CONE8 panic |
|
541 if (iDialog) |
|
542 { |
|
543 delete iDialog; |
|
544 iDialog = NULL; |
|
545 } |
|
546 |
|
547 iDialog = msgDlg; |
|
548 |
|
549 msgDlg->PrepareLC(R_BLID_MESSAGE_QUERY_DIALOG); // Pushed dialog is popped inside RunLD |
|
550 |
|
551 msgDlg->Heading()->SetTextL(*iHeadPaneText); |
|
552 |
|
553 msgDlg->SetLink(aCallBack); |
|
554 |
|
555 if (!isAccessoryRequired) |
|
556 { |
|
557 msgDlg->ButtonGroupContainer().SetCommandSetL( |
|
558 R_BLID_INFOPOPUP_SOFTKEYS_RETRY__EXIT); |
|
559 } |
|
560 else |
|
561 { |
|
562 msgDlg->ButtonGroupContainer().SetCommandSetL( |
|
563 R_BLID_INFOPOPUP_SOFTKEYS_EXIT); |
|
564 } |
|
565 isDialogLaunched = ETrue; |
|
566 TInt retval = msgDlg->RunLD(); |
|
567 if (isDialogLaunched) |
|
568 { |
|
569 msgDlg = NULL; |
|
570 iDialog = NULL; |
|
571 isDialogLaunched = EFalse; |
|
572 return retval; |
|
573 } |
|
574 return -1; |
|
575 } |
|
576 |
|
577 // ---------------------------------------------------- |
|
578 // CBlidMainControl::CreateNaviPaneL |
|
579 // Creates navigation pane |
|
580 // ---------------------------------------------------- |
|
581 // |
|
582 void CBlidMainControl::CreateNaviPaneL() |
|
583 { |
|
584 CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
585 // Fetch pointer to the default navi pane control |
|
586 CAknNavigationControlContainer* naviPane = |
|
587 static_cast<CAknNavigationControlContainer*> (sp->ControlL( |
|
588 TUid::Uid(EEikStatusPaneUidNavi))); |
|
589 |
|
590 naviPane->PushDefaultL(EFalse); |
|
591 } |
|
592 |
|
593 // ---------------------------------------------------- |
|
594 // CBlidMainControl::LaunchPositioningSettingsViewL |
|
595 // Launches positioning settings view |
|
596 // ---------------------------------------------------- |
|
597 // |
|
598 void CBlidMainControl::LaunchPositioningSettingsViewL() |
|
599 { |
|
600 if (!iLauncher) |
|
601 { |
|
602 iLauncher = CBlidLocSettingsLauncher::NewL(); |
|
603 } |
|
604 iLauncher->SetControl(this); |
|
605 isSettingsLaunched = ETrue; |
|
606 iLauncher->LaunchL(); |
|
607 } |
|
608 |
|
609 // ---------------------------------------------------- |
|
610 // CBlidMainControl::DeleteDialogResource |
|
611 // Seletes the dialog resources |
|
612 // ---------------------------------------------------- |
|
613 // |
|
614 void CBlidMainControl::DeleteDialogResource() |
|
615 { |
|
616 if (isSettingsLaunched) |
|
617 { |
|
618 delete iHeadPaneText; |
|
619 iHeadPaneText = NULL; |
|
620 |
|
621 delete iMsgQueryText; |
|
622 iMsgQueryText = NULL; |
|
623 |
|
624 delete iLinkText; |
|
625 iLinkText = NULL; |
|
626 |
|
627 delete iMsgQText; |
|
628 iMsgQText = NULL; |
|
629 } |
|
630 } |
|
631 |
|
632 // ---------------------------------------------------- |
|
633 // CBlidMainControl::UpdateDisplayLayoutL |
|
634 // Updates the display layout in response to a change in app resource |
|
635 // ---------------------------------------------------- |
|
636 // |
|
637 void CBlidMainControl::UpdateDisplayLayoutL() |
|
638 { |
|
639 /* Layout Hierarchy |
|
640 main_blid2_pane -> blid2_search_pane -> blid2_search_pane_t1 |
|
641 |
|
642 main_blid2_pane -> blid2_search_pane -> blid2_search_pane_g1 |
|
643 */ |
|
644 |
|
645 TAknLayoutRect mainBlid2Pane; |
|
646 TAknLayoutRect blid2SearchPane; |
|
647 TAknLayoutRect blid2SearchPaneG1; |
|
648 TAknLayoutText blid2SearchPaneT1; |
|
649 //TRect animationRect; |
|
650 TInt variety; |
|
651 |
|
652 if (Layout_Meta_Data::IsLandscapeOrientation()) |
|
653 { |
|
654 variety = 1; |
|
655 } |
|
656 else |
|
657 { |
|
658 variety = 0; |
|
659 } |
|
660 /////////////// recalculate text rect ///////////////////////// |
|
661 TRect rect; |
|
662 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); |
|
663 mainBlid2Pane.LayoutRect(rect, |
|
664 AknLayoutScalable_Apps::main_blid2_pane().LayoutLine()); |
|
665 |
|
666 blid2SearchPane.LayoutRect(mainBlid2Pane.Rect(), |
|
667 AknLayoutScalable_Apps::blid2_search_pane(variety).LayoutLine()); |
|
668 |
|
669 blid2SearchPaneT1.LayoutText( |
|
670 blid2SearchPane.Rect(), |
|
671 AknLayoutScalable_Apps::blid2_search_pane_t1(variety).LayoutLine()); |
|
672 |
|
673 /////////////// recalculate animation rect ///////////////////////// |
|
674 blid2SearchPaneG1.LayoutRect( |
|
675 blid2SearchPane.Rect(), |
|
676 AknLayoutScalable_Apps::blid2_search_pane_g1(variety).LayoutLine()); |
|
677 iAnimationRect = blid2SearchPaneG1.Rect(); |
|
678 |
|
679 TAlfRealPoint topTextPoint(blid2SearchPaneT1.TextRect().iTl); |
|
680 TAlfRealPoint bottomTextPoint(blid2SearchPaneT1.TextRect().iBr); |
|
681 |
|
682 //Anchor for searching Text |
|
683 iMainLayout->SetAnchor(EAlfAnchorTopLeft, 0, EAlfAnchorOriginLeft, |
|
684 EAlfAnchorOriginTop, EAlfAnchorMetricAbsolute, |
|
685 EAlfAnchorMetricAbsolute, TAlfTimedPoint(topTextPoint.iX, |
|
686 topTextPoint.iY)); |
|
687 iMainLayout->SetAnchor(EAlfAnchorBottomRight, 0, EAlfAnchorOriginLeft, |
|
688 EAlfAnchorOriginTop, EAlfAnchorMetricAbsolute, |
|
689 EAlfAnchorMetricAbsolute, TAlfTimedPoint(bottomTextPoint.iX, |
|
690 bottomTextPoint.iY)); |
|
691 |
|
692 TAlfRealPoint topAnimationPoint(iAnimationRect.iTl); |
|
693 TAlfRealPoint bottomAnimationPoint(iAnimationRect.iBr); |
|
694 |
|
695 //Anchor for animation |
|
696 iMainLayout->SetAnchor(EAlfAnchorTopLeft, 1, EAlfAnchorOriginLeft, |
|
697 EAlfAnchorOriginTop, EAlfAnchorMetricAbsolute, |
|
698 EAlfAnchorMetricAbsolute, TAlfTimedPoint(topAnimationPoint.iX, |
|
699 topAnimationPoint.iY)); |
|
700 iMainLayout->SetAnchor(EAlfAnchorBottomRight, 1, EAlfAnchorOriginLeft, |
|
701 EAlfAnchorOriginTop, EAlfAnchorMetricAbsolute, |
|
702 EAlfAnchorMetricAbsolute, TAlfTimedPoint(bottomAnimationPoint.iX, |
|
703 bottomAnimationPoint.iY)); |
|
704 |
|
705 } |
|
706 |
|
707 // ----------------------------------------------------------------------------- |
|
708 // CBlidMainControl::MessageQueryCallBack() |
|
709 // Called when link is clicked on message query dialog |
|
710 // ----------------------------------------------------------------------------- |
|
711 // |
|
712 TInt MessageQueryCallBack(TAny* aPtr) |
|
713 { |
|
714 CBlidMainControl* ptr = static_cast<CBlidMainControl*> (aPtr); |
|
715 if (ptr) |
|
716 { |
|
717 TRAP_IGNORE( ptr->LaunchPositioningSettingsViewL() ); |
|
718 if (ptr->iDialog) |
|
719 { |
|
720 TRAP_IGNORE( ptr->iDialog->ProcessCommandL( 3001 ) ); |
|
721 } |
|
722 } |
|
723 return KErrNone; |
|
724 } |
|
725 //End Of File |
|
726 |