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