|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * Implementation of the portal button for WidgetManager |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <aknlayoutscalable_apps.cdl.h> |
|
21 #include <aknlayoutscalable_avkon.cdl.h> |
|
22 #include <layoutmetadata.cdl.h> |
|
23 #include <aknbutton.h> |
|
24 #include <AknsDrawUtils.h> |
|
25 #include <AknBidiTextUtils.h> |
|
26 #include <AknsFrameBackgroundControlContext.h> |
|
27 #include <gulicon.h> |
|
28 #include <avkon.mbg> |
|
29 #include <widgetmanager.mbg> |
|
30 #include <apgcli.h> |
|
31 #include <apgtask.h> |
|
32 #include <widgetregistryclient.h> // widgetreqistry |
|
33 #include <bacline.h> |
|
34 #include <escapeutils.h> |
|
35 #include <browserlauncher.h> |
|
36 #include <centralrepository.h> |
|
37 |
|
38 #include "wmimageconverter.h" |
|
39 #include "wmportalbutton.h" |
|
40 #include "wmcommon.h" |
|
41 #include "wmplugin.h" |
|
42 #include "wmresourceloader.h" |
|
43 #include "wmmaincontainer.h" |
|
44 #include "wmconfiguration.h" |
|
45 #include "wmprocessmonitor.h" |
|
46 |
|
47 // CONSTANTS |
|
48 |
|
49 // MEMBER FUNCTIONS |
|
50 |
|
51 // --------------------------------------------------------- |
|
52 // CWmPortalButton::NewL |
|
53 // --------------------------------------------------------- |
|
54 // |
|
55 CWmPortalButton* CWmPortalButton::NewL( |
|
56 const CCoeControl* aParent, |
|
57 TInt aPortalButtonIndex ) |
|
58 { |
|
59 CWmPortalButton* self = new (ELeave) CWmPortalButton( |
|
60 KAknButtonTextInsideFrame, aPortalButtonIndex ); |
|
61 |
|
62 CleanupStack::PushL( self ); |
|
63 |
|
64 CWmMainContainer* mainContainer = |
|
65 static_cast <CWmMainContainer*>( |
|
66 const_cast <CCoeControl*>( aParent ) ); |
|
67 |
|
68 self->ConstructL( mainContainer, |
|
69 mainContainer->Configuration().PortalButtonText( aPortalButtonIndex ), |
|
70 mainContainer->Configuration().PortalButtonIcon( aPortalButtonIndex ) ); |
|
71 |
|
72 CleanupStack::Pop( self ); |
|
73 return self; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------- |
|
77 // CWmPortalButton::~CWmPortalButton |
|
78 // --------------------------------------------------------- |
|
79 // |
|
80 CWmPortalButton::~CWmPortalButton() |
|
81 { |
|
82 delete iButtonIcon; |
|
83 delete iButtonIconMask; |
|
84 |
|
85 // if MAknIconFileProvider was used to create image from icon string |
|
86 // then it'll try accessing imageconverter after bitmap deletion |
|
87 // for de-reference open file count, so it should be deleted last. |
|
88 delete iImageConverter; |
|
89 delete iProcessMonitor; |
|
90 delete iBrowserLauncher; |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------- |
|
94 // CWmPortalButton::CWmPortalButton |
|
95 // --------------------------------------------------------- |
|
96 // |
|
97 CWmPortalButton::CWmPortalButton( |
|
98 const TInt aFlags, |
|
99 TInt aPortalButtonIndex ) |
|
100 :CAknButton( aFlags ), |
|
101 iPortalButtonIndex( aPortalButtonIndex ) |
|
102 { |
|
103 iButtonIcon = NULL; |
|
104 iButtonIconMask = NULL; |
|
105 iProcessMonitor = NULL; |
|
106 iBrowserLauncher = NULL; |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------- |
|
110 // CWmPortalButton::ConstructL |
|
111 // --------------------------------------------------------- |
|
112 // |
|
113 void CWmPortalButton::ConstructL( |
|
114 CWmMainContainer* aParent, |
|
115 const TDesC& aText, |
|
116 const TDesC& aIcon ) |
|
117 { |
|
118 if ( !aParent ) |
|
119 { |
|
120 User::Leave( KErrArgument ); |
|
121 } |
|
122 SetContainerWindowL( *aParent ); |
|
123 |
|
124 // Obtain pointer to main container. |
|
125 iWmMainContainer = aParent; |
|
126 |
|
127 // construct the button |
|
128 CAknButton::ConstructL( NULL, NULL, NULL, NULL, aText, KNullDesC, 0 ); |
|
129 |
|
130 SetFrameAndCenterIds( |
|
131 KAknsIIDQsnFrButtonNormal, |
|
132 KAknsIIDQsnFrButtonCenterNormal, |
|
133 KAknsIIDQsnFrButtonPressed, |
|
134 KAknsIIDQsnFrButtonCenterPressed, |
|
135 KAknsIIDQsnFrButtonInactive, |
|
136 KAknsIIDQsnFrButtonCenterInactive, |
|
137 KAknsIIDQsnFrButtonPressed, |
|
138 KAknsIIDQsnFrButtonCenterPressed, |
|
139 KAknsIIDQsnFrButtonInactive, |
|
140 KAknsIIDQsnFrButtonCenterInactive ); |
|
141 |
|
142 // start image converter for the icon |
|
143 iImageConverter = CWmImageConverter::NewL(); |
|
144 TSize iconsize( LayoutIconSize() ); |
|
145 iImageConverter->HandleIconString( |
|
146 iconsize, |
|
147 aIcon, |
|
148 iButtonIcon, |
|
149 iButtonIconMask ); |
|
150 // observe our own press events |
|
151 SetObserver( this ); |
|
152 |
|
153 SetFocusing( ETrue ); |
|
154 SetRequestExit( ETrue ); // notification request for button up event |
|
155 |
|
156 // ready to be drawn |
|
157 ActivateL(); |
|
158 } |
|
159 |
|
160 // --------------------------------------------------------- |
|
161 // CWmPortalButton::ExecuteL |
|
162 // --------------------------------------------------------- |
|
163 // |
|
164 void CWmPortalButton::ExecuteL() |
|
165 { |
|
166 if ( iPortalButtonIndex == 0 ) |
|
167 { |
|
168 // OVI button |
|
169 if ( !iProcessMonitor ) |
|
170 { |
|
171 iProcessMonitor = CWmProcessMonitor::NewL(); |
|
172 } |
|
173 // if process monitor is active laucher was allready started. |
|
174 // this is for ignoring multiple button presses |
|
175 if ( !iProcessMonitor->IsActive() ) |
|
176 { |
|
177 RunOviL( iWmMainContainer->Configuration() ); |
|
178 } |
|
179 } |
|
180 else if ( iPortalButtonIndex == 1 ) |
|
181 { |
|
182 // OPERATOR button |
|
183 // if this leaves it means we need to start browser |
|
184 // becouse application info was not given |
|
185 TRAPD( err, RunOperatorApplicationL( |
|
186 iWmMainContainer->Configuration() ) ) |
|
187 if ( err != KErrNone ) |
|
188 { |
|
189 StartBrowserL( |
|
190 iWmMainContainer->Configuration().PortalButtonBrowserUrl( |
|
191 iPortalButtonIndex ) ); |
|
192 } |
|
193 } |
|
194 else |
|
195 { |
|
196 // Not supported |
|
197 User::Leave( KErrGeneral ); |
|
198 } |
|
199 } |
|
200 |
|
201 // --------------------------------------------------------- |
|
202 // CWmPortalButton::RunOviL |
|
203 // --------------------------------------------------------- |
|
204 // |
|
205 void CWmPortalButton::RunOviL( CWmConfiguration& aConf ) |
|
206 { |
|
207 RApaLsSession session; |
|
208 User::LeaveIfError( session.Connect() ); |
|
209 CleanupClosePushL( session ); |
|
210 |
|
211 //get app info |
|
212 TApaAppInfo appInfo; |
|
213 TUid launchUid; |
|
214 launchUid = aConf.PortalButtonClientUid( iPortalButtonIndex ); |
|
215 |
|
216 if ( session.GetAppInfo( appInfo, launchUid ) == KErrNone ) |
|
217 { |
|
218 // Form parameter |
|
219 HBufC* param = HBufC::NewLC( aConf.PortalButtonClientParam( iPortalButtonIndex ).Length() ); |
|
220 param->Des().Copy( aConf.PortalButtonClientParam( iPortalButtonIndex ) ); |
|
221 |
|
222 // do the launch |
|
223 RProcess process; |
|
224 User::LeaveIfError( process.Create( appInfo.iFullName, *param ) ); |
|
225 |
|
226 iProcessMonitor->Monitor( process ); |
|
227 process.Resume(); |
|
228 |
|
229 CleanupStack::PopAndDestroy( param ); |
|
230 } |
|
231 |
|
232 CleanupStack::PopAndDestroy( &session ); |
|
233 } |
|
234 |
|
235 // --------------------------------------------------------- |
|
236 // CWmPortalButton::StartBrowserL |
|
237 // --------------------------------------------------------- |
|
238 // |
|
239 void CWmPortalButton::StartBrowserL( const TDesC& aUrl ) |
|
240 { |
|
241 // already running/or request launch or url is empty |
|
242 if ( iBrowserLauncher || !aUrl.Length() ) { return; } |
|
243 |
|
244 _LIT( KUrlPrefix, "4 "); |
|
245 HBufC* param = HBufC::NewLC( aUrl.Length() + KUrlPrefix().Length() ); |
|
246 param->Des().Append( KUrlPrefix ); |
|
247 param->Des().Append( aUrl ); |
|
248 |
|
249 // Create browser launcher |
|
250 CBrowserLauncher* launcher = CBrowserLauncher::NewLC(); |
|
251 |
|
252 // Asynchronous operation to launch the browser with given URL |
|
253 launcher->LaunchBrowserEmbeddedL( |
|
254 *param, NULL, this, NULL ); |
|
255 |
|
256 CleanupStack::Pop( launcher ); |
|
257 iBrowserLauncher = launcher; |
|
258 launcher = NULL; |
|
259 |
|
260 CleanupStack::PopAndDestroy( param ); |
|
261 } |
|
262 |
|
263 // --------------------------------------------------------- |
|
264 // CWmPortalButton::HandleServerAppExit |
|
265 // --------------------------------------------------------- |
|
266 // |
|
267 void CWmPortalButton::HandleServerAppExit( TInt aReason ) |
|
268 { |
|
269 MAknServerAppExitObserver::HandleServerAppExit( aReason ); |
|
270 delete iBrowserLauncher; |
|
271 iBrowserLauncher = NULL; |
|
272 } |
|
273 |
|
274 // --------------------------------------------------------- |
|
275 // CWmPortalButton::HandleControlEventL |
|
276 // --------------------------------------------------------- |
|
277 // |
|
278 void CWmPortalButton::HandleControlEventL( CCoeControl* aControl, |
|
279 TCoeEvent aEventType ) |
|
280 { |
|
281 if ( aControl == this ) |
|
282 { |
|
283 if ( aEventType == EEventStateChanged || |
|
284 aEventType == ELongPressEndedEvent || |
|
285 aEventType == EEventRequestCancel ) |
|
286 { |
|
287 DrawDeferred(); |
|
288 } |
|
289 // execute portal action when button pressed (short or long press) |
|
290 if ( aEventType == EEventRequestExit ) |
|
291 { |
|
292 SetFocus( EFalse ); |
|
293 DrawNow(); |
|
294 ExecuteL(); |
|
295 } |
|
296 } |
|
297 } |
|
298 |
|
299 // --------------------------------------------------------- |
|
300 // CWmPortalButton::HandlePointerEventL |
|
301 // --------------------------------------------------------- |
|
302 // |
|
303 void CWmPortalButton::HandlePointerEventL( |
|
304 const TPointerEvent& aPointerEvent ) |
|
305 { |
|
306 CAknButton::HandlePointerEventL( aPointerEvent ); |
|
307 |
|
308 // remove focus from button if button is released outside rect |
|
309 if ( aPointerEvent.iType == TPointerEvent::EDrag ) |
|
310 { |
|
311 TBool wasFoucused( IsFocused() ); |
|
312 SetFocus( Rect().Contains( aPointerEvent.iPosition ) ); |
|
313 if ( wasFoucused != IsFocused() ){ DrawNow(); } |
|
314 } |
|
315 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
316 { |
|
317 SetFocus( EFalse ); // remove focus when button released. |
|
318 } |
|
319 } |
|
320 |
|
321 |
|
322 // --------------------------------------------------------- |
|
323 // CWmPortalButton::LayoutIconSize |
|
324 // --------------------------------------------------------- |
|
325 // |
|
326 TSize CWmPortalButton::LayoutIconSize() const |
|
327 { |
|
328 TBool landscape = Layout_Meta_Data::IsLandscapeOrientation(); |
|
329 TAknLayoutRect imageLayout; |
|
330 if ( iWmMainContainer->Configuration().PortalButtonCount() == 1 ) |
|
331 { |
|
332 imageLayout.LayoutRect( Rect(), AknLayoutScalable_Apps:: |
|
333 wgtman_btn_pane_g1( landscape ? 1 : 0).LayoutLine() ); |
|
334 } |
|
335 else |
|
336 { |
|
337 TInt variety = (landscape ? 5 : 4); |
|
338 imageLayout.LayoutRect( Rect(), AknLayoutScalable_Apps |
|
339 ::wgtman_btn_pane_g1( variety ).LayoutLine() ); |
|
340 } |
|
341 |
|
342 return imageLayout.Rect().Size(); |
|
343 } |
|
344 |
|
345 // --------------------------------------------------------- |
|
346 // CWmPortalButton::SizeChanged |
|
347 // --------------------------------------------------------- |
|
348 // |
|
349 void CWmPortalButton::SizeChanged() |
|
350 { |
|
351 CAknButton::SizeChanged(); |
|
352 |
|
353 SetTextVerticalAlignment( CAknButton::ECenter ); |
|
354 |
|
355 // resize icon |
|
356 if ( iButtonIcon && iButtonIconMask ) |
|
357 { |
|
358 iImageConverter->UpdateImageSize( |
|
359 LayoutIconSize(), |
|
360 iWmMainContainer->Configuration().PortalButtonIcon( |
|
361 iPortalButtonIndex ), |
|
362 *iButtonIcon, |
|
363 *iButtonIconMask ); |
|
364 } |
|
365 |
|
366 TBool landscape = Layout_Meta_Data::IsLandscapeOrientation(); |
|
367 SetTextAndIconAlignment( |
|
368 landscape ? CAknButton::EIconOverText : CAknButton::EIconBeforeText ); |
|
369 } |
|
370 |
|
371 // --------------------------------------------------------- |
|
372 // CWmPortalButton::Draw |
|
373 // --------------------------------------------------------- |
|
374 // |
|
375 void CWmPortalButton::Draw( const TRect& /*aRect*/ ) const |
|
376 { |
|
377 TRect rect = Rect(); |
|
378 |
|
379 TAknLayoutRect centerLayout; |
|
380 centerLayout.LayoutRect( rect, |
|
381 AknLayoutScalable_Avkon::toolbar_button_pane_g1().LayoutLine() ); |
|
382 TRect innerRect = centerLayout.Rect(); |
|
383 |
|
384 CWindowGc& gc = SystemGc(); |
|
385 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
386 |
|
387 TAknsItemID frameId = ( KAknsIIDQsnFrButtonNormal ); |
|
388 TAknsItemID frameCenterId = ( KAknsIIDQsnFrButtonCenterNormal ); |
|
389 |
|
390 if ( iButtonPressed ) |
|
391 { |
|
392 frameId = ( KAknsIIDQsnFrButtonPressed ); |
|
393 frameCenterId = ( KAknsIIDQsnFrButtonCenterPressed ); |
|
394 } |
|
395 else if ( IsDimmed() ) |
|
396 { |
|
397 frameId = KAknsIIDQsnFrButtonInactive; |
|
398 frameCenterId = KAknsIIDQsnFrButtonCenterInactive; |
|
399 } |
|
400 else if ( IsFocused() ) |
|
401 { |
|
402 frameId = KAknsIIDQsnFrButtonHighlight; |
|
403 frameCenterId = KAknsIIDQsnFrButtonHighlightCenter; |
|
404 } |
|
405 |
|
406 iBgContext->SetFrame( frameId ); |
|
407 iBgContext->SetCenter( frameCenterId ); |
|
408 iBgContext->SetFrameRects( rect, innerRect ); |
|
409 |
|
410 if ( !AknsDrawUtils::Background( skin, iBgContext, NULL, |
|
411 gc, rect, KAknsDrawParamNoClearUnderImage ) ) |
|
412 { |
|
413 gc.SetBrushColor( KRgbRed ); |
|
414 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
415 gc.DrawRect( rect ); |
|
416 } |
|
417 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
418 |
|
419 CAknButtonState* state = State(); |
|
420 if ( state ) |
|
421 { |
|
422 TBool landscape = Layout_Meta_Data::IsLandscapeOrientation(); |
|
423 |
|
424 // draw image if one exists |
|
425 if ( iButtonIcon && iButtonIconMask ) |
|
426 { |
|
427 TAknLayoutRect imageLayout; |
|
428 if ( iWmMainContainer->Configuration().PortalButtonCount() == 1 ) |
|
429 { |
|
430 imageLayout.LayoutRect( rect, AknLayoutScalable_Apps:: |
|
431 wgtman_btn_pane_g1( landscape ? 3 : 0).LayoutLine() ); |
|
432 } |
|
433 else |
|
434 { |
|
435 TInt variety = (landscape ? 7 : 4); |
|
436 imageLayout.LayoutRect( rect, AknLayoutScalable_Apps |
|
437 ::wgtman_btn_pane_g1( variety ).LayoutLine() ); |
|
438 } |
|
439 |
|
440 gc.DrawBitmapMasked( |
|
441 imageLayout.Rect(), |
|
442 iButtonIcon, |
|
443 TRect(TPoint( 0, 0 ), iButtonIcon->SizeInPixels() ), |
|
444 iButtonIconMask, |
|
445 EFalse ); |
|
446 } |
|
447 |
|
448 // draw text if portrait |
|
449 if ( !landscape ) |
|
450 { |
|
451 TAknTextComponentLayout leftLayout; |
|
452 TInt variety = |
|
453 ((iWmMainContainer->Configuration().PortalButtonCount()== 2)? 4:0 ); |
|
454 leftLayout = AknLayoutScalable_Apps::wgtman_btn_pane_t1( variety ); |
|
455 DrawText( gc, state->Text(), leftLayout, 1 ); |
|
456 } |
|
457 } |
|
458 } |
|
459 |
|
460 // --------------------------------------------------------- |
|
461 // CWmPortalButton::DrawText |
|
462 // --------------------------------------------------------- |
|
463 // |
|
464 void CWmPortalButton::DrawText( |
|
465 CWindowGc& aGc, |
|
466 const TDesC& aText, |
|
467 TAknTextComponentLayout& aLayout, |
|
468 TInt aMargin ) const |
|
469 { |
|
470 TAknLayoutText layoutText; |
|
471 layoutText.LayoutText(Rect(), aLayout.LayoutLine() ); |
|
472 |
|
473 const CFont* font = layoutText.Font(); |
|
474 TRect textRect = layoutText.TextRect(); |
|
475 |
|
476 aGc.UseFont( font ); |
|
477 |
|
478 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
479 |
|
480 TRgb textColor; |
|
481 TInt err = AknsUtils::GetCachedColor( |
|
482 skin, |
|
483 textColor, |
|
484 KAknsIIDQsnTextColors, |
|
485 EAknsCIQsnTextColorsCG63 ); |
|
486 if ( err != KErrNone ) |
|
487 { |
|
488 textColor = layoutText.Color(); |
|
489 } |
|
490 aGc.SetPenColor( textColor); |
|
491 |
|
492 // Layout data not correct, add some space for text |
|
493 textRect.iBr.iX += aMargin; |
|
494 textRect.iTl.iX -= aMargin; |
|
495 |
|
496 // buffer for visually ordered text |
|
497 TBuf<255 + KAknBidiExtraSpacePerLine> visualText; |
|
498 TInt clipWidth = textRect.Width(); |
|
499 |
|
500 // bidi processing - using AknBidiTextUtils. |
|
501 AknBidiTextUtils::ConvertToVisualAndClip( |
|
502 aText, |
|
503 visualText, |
|
504 *font, |
|
505 clipWidth, |
|
506 clipWidth ); |
|
507 |
|
508 TInt baselineOffset = 0; |
|
509 switch ( iVerticalAlignment ) |
|
510 { |
|
511 case ETop: |
|
512 baselineOffset = font->AscentInPixels(); |
|
513 break; |
|
514 |
|
515 case EBottom: |
|
516 baselineOffset = textRect.Height(); |
|
517 break; |
|
518 |
|
519 default: // centered |
|
520 baselineOffset = font->AscentInPixels() + |
|
521 ( textRect.Height() - font->AscentInPixels() ) / 2; |
|
522 } |
|
523 |
|
524 aGc.DrawText( visualText, textRect, |
|
525 baselineOffset, layoutText.Align() ); |
|
526 } |
|
527 |
|
528 // --------------------------------------------------------- |
|
529 // CWmPortalButton::RunOperatorApplicationL |
|
530 // --------------------------------------------------------- |
|
531 // |
|
532 void CWmPortalButton::RunOperatorApplicationL( CWmConfiguration& aConf ) |
|
533 { |
|
534 CWmConfiguration::TOpAppType type = aConf.PortalButtonApplicationType( 1 ); |
|
535 if ( type == CWmConfiguration::EUnknown || |
|
536 type >= CWmConfiguration::EReserved ) |
|
537 { |
|
538 // Leave if not found |
|
539 User::Leave( KErrArgument ); |
|
540 } |
|
541 |
|
542 switch( type ) |
|
543 { |
|
544 case CWmConfiguration::ES60: |
|
545 case CWmConfiguration::EQt: |
|
546 { |
|
547 TUid uid = KNullUid; |
|
548 aConf.PortalButtonApplicationId( 1, uid ); |
|
549 StartProcessL( uid, aConf.PortalButtonClientParam( 1 ) ); |
|
550 } |
|
551 break; |
|
552 case CWmConfiguration::ECwrt: |
|
553 { |
|
554 TUid uid = KNullUid; |
|
555 aConf.PortalButtonApplicationId( 1, uid ); |
|
556 StartWidgetL( uid, aConf.PortalButtonClientParam( 1 ) ); |
|
557 } |
|
558 break; |
|
559 case CWmConfiguration::EWrt: |
|
560 { |
|
561 TUid uid = KNullUid; |
|
562 aConf.PortalButtonApplicationId( 1, uid ); |
|
563 StartWidgetL( uid, KNullDesC ); |
|
564 } |
|
565 break; |
|
566 case CWmConfiguration::EJava: |
|
567 { |
|
568 TBuf<NCentralRepositoryConstants::KMaxUnicodeStringLength> appId; |
|
569 aConf.PortalButtonApplicationId( 1, appId ); |
|
570 //TODO: |
|
571 } |
|
572 break; |
|
573 } |
|
574 } |
|
575 |
|
576 // --------------------------------------------------------- |
|
577 // CWmPortalButton::StartProcessL |
|
578 // --------------------------------------------------------- |
|
579 // |
|
580 void CWmPortalButton::StartProcessL( TUid aUid, const TDesC& aParam ) |
|
581 { |
|
582 RApaLsSession session; |
|
583 User::LeaveIfError( session.Connect() ); |
|
584 CleanupClosePushL( session ); |
|
585 |
|
586 //get app info |
|
587 TApaAppInfo appInfo; |
|
588 User::LeaveIfError( session.GetAppInfo( appInfo, aUid ) ); |
|
589 // do the launch |
|
590 RProcess process; |
|
591 User::LeaveIfError( process.Create( appInfo.iFullName, aParam ) ); |
|
592 process.Resume(); |
|
593 |
|
594 CleanupStack::PopAndDestroy( &session ); |
|
595 } |
|
596 |
|
597 // --------------------------------------------------------- |
|
598 // CWmPortalButton::StartWidgetL |
|
599 // --------------------------------------------------------- |
|
600 // |
|
601 void CWmPortalButton::StartWidgetL( TUid aAppUid, const TDesC& aParams ) |
|
602 { |
|
603 if ( aAppUid == KNullUid ) |
|
604 User::Leave( KErrArgument ); |
|
605 |
|
606 HBufC* params = aParams.AllocLC(); |
|
607 |
|
608 RApaLsSession appArc; |
|
609 User::LeaveIfError( appArc.Connect() ); |
|
610 CleanupClosePushL( appArc ); |
|
611 |
|
612 TThreadId threadId; |
|
613 User::LeaveIfError( appArc.StartDocument( *params, aAppUid, threadId ) ); |
|
614 |
|
615 CleanupStack::PopAndDestroy( &appArc ); |
|
616 CleanupStack::PopAndDestroy( params ); |
|
617 } |
|
618 |
|
619 // End of file |