28 #include <widgetmanagerview.rsg> |
28 #include <widgetmanagerview.rsg> |
29 #include <hscontentcontroller.h> |
29 #include <hscontentcontroller.h> |
30 #include <AknUtils.h> |
30 #include <AknUtils.h> |
31 #include <avkon.rsg> |
31 #include <avkon.rsg> |
32 #include <layoutmetadata.cdl.h> |
32 #include <layoutmetadata.cdl.h> |
33 |
33 #include <widgetmanager.mbg> |
34 #include "wmplugin.h" |
34 #include "wmplugin.h" |
35 #include "widgetmanager.hrh" |
35 #include "widgetmanager.hrh" |
36 #include "wmmaincontainerview.h" |
36 #include "wmmaincontainerview.h" |
37 #include "wmresourceloader.h" |
37 #include "wmresourceloader.h" |
38 #include "wmmaincontainer.h" |
38 #include "wmmaincontainer.h" |
39 #include "wmspbgcleaner.h" |
39 #include "wmspbgcleaner.h" |
40 |
40 #include "wmconfiguration.h" |
|
41 #include "wmimageconverter.h" |
|
42 #include "wmstore.h" |
|
43 |
41 // --------------------------------------------------------- |
44 // --------------------------------------------------------- |
42 // CWmMainContainerView::CWmMainContainerView() |
45 // CWmMainContainerView::CWmMainContainerView() |
43 // --------------------------------------------------------- |
46 // --------------------------------------------------------- |
44 // |
47 // |
45 CWmMainContainerView::CWmMainContainerView( |
48 CWmMainContainerView::CWmMainContainerView( |
53 // --------------------------------------------------------- |
56 // --------------------------------------------------------- |
54 // CWmMainContainerView::~CWmMainContainerView() |
57 // CWmMainContainerView::~CWmMainContainerView() |
55 // --------------------------------------------------------- |
58 // --------------------------------------------------------- |
56 // |
59 // |
57 CWmMainContainerView::~CWmMainContainerView() |
60 CWmMainContainerView::~CWmMainContainerView() |
58 { |
61 { |
59 if ( iWmMainContainer != NULL ) |
62 if ( iWmMainContainer != NULL ) |
60 { |
63 { |
61 AppUi()->RemoveFromStack( iWmMainContainer ); |
64 AppUi()->RemoveFromStack( iWmMainContainer ); |
62 |
65 |
63 delete iWmMainContainer; |
66 delete iWmMainContainer; |
125 { |
128 { |
126 if ( !iWmMainContainer->ClosingDown() ) |
129 if ( !iWmMainContainer->ClosingDown() ) |
127 { |
130 { |
128 switch ( aCommand ) |
131 switch ( aCommand ) |
129 { |
132 { |
130 case EWmMainContainerViewOpenPortalMenuItemCommand: |
133 case EAknSoftkeySelect: |
131 HandleOpenMenuItemSelectedL(); |
|
132 break; |
|
133 case EWmMainContainerViewAddMenuItemCommand: |
134 case EWmMainContainerViewAddMenuItemCommand: |
134 HandleAddMenuItemSelectedL(); |
135 HandleAddMenuItemSelectedL(); |
135 break; |
136 break; |
136 case EWmMainContainerViewLaunchMenuItemCommand: |
137 case EWmMainContainerViewLaunchMenuItemCommand: |
137 HandleLaunchMenuItemSelectedL(); |
138 HandleLaunchMenuItemSelectedL(); |
160 break; |
161 break; |
161 } |
162 } |
162 case EWmMainContainerViewWiddetDetailsMenuItemCommand: |
163 case EWmMainContainerViewWiddetDetailsMenuItemCommand: |
163 HandleDetailsMenuItemSelectedL(); |
164 HandleDetailsMenuItemSelectedL(); |
164 break; |
165 break; |
165 case EAknSoftkeySelect: |
166 case EWmStoreCommand: |
|
167 { |
166 if ( iWmMainContainer ) |
168 if ( iWmMainContainer ) |
167 iWmMainContainer->SelectL(); |
169 iWmMainContainer->HandleStoreCommandL(); |
|
170 } |
168 break; |
171 break; |
169 case EAknSoftkeyCancel: // flow through |
172 case EAknSoftkeyCancel: // flow through |
170 case EEikCmdCanceled: |
173 case EEikCmdCanceled: |
171 { |
174 { |
172 HandleDeactivateFindPaneL(); |
175 HandleDeactivateFindPaneL(); |
186 const TVwsViewId& aPrevViewId, |
189 const TVwsViewId& aPrevViewId, |
187 TUid /*aCustomMessageId*/, |
190 TUid /*aCustomMessageId*/, |
188 const TDesC8& /*aCustomMessage*/ ) |
191 const TDesC8& /*aCustomMessage*/ ) |
189 { |
192 { |
190 // setup status pane layout |
193 // setup status pane layout |
191 StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ); |
194 TInt layoutResourceId = ( (iWmPlugin.Configuration().StoreCount() ) ? |
|
195 R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT : |
|
196 R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ); |
|
197 StatusPane()->SwitchLayoutL( layoutResourceId ); |
|
198 |
|
199 // ToDo: Support for msk in all layout is ongoing, when available in |
|
200 // sdk use next line and get rid of above. |
|
201 |
|
202 //StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ); |
|
203 |
192 // apply changes |
204 // apply changes |
193 StatusPane()->ApplyCurrentSettingsL(); |
205 StatusPane()->ApplyCurrentSettingsL(); |
194 // disable transparancy |
206 // disable transparancy |
195 StatusPane()->EnableTransparent( EFalse ); |
207 StatusPane()->EnableTransparent( EFalse ); |
196 // create container |
208 // create container |
206 |
218 |
207 iWmSpBgCleaner->DrawNow(); |
219 iWmSpBgCleaner->DrawNow(); |
208 StatusPane()->DrawNow(); |
220 StatusPane()->DrawNow(); |
209 |
221 |
210 // update cba |
222 // update cba |
211 if ( Layout_Meta_Data::IsMSKEnabled() ) |
223 if ( !AknLayoutUtils::MSKEnabled() || |
|
224 iWmPlugin.Configuration().StoreCount() == 0 ) |
212 { |
225 { |
213 CEikButtonGroupContainer* bgc( Cba() ); |
226 CEikButtonGroupContainer* bgc( Cba() ); |
214 CEikCba* cba = static_cast< CEikCba* >( bgc->ButtonGroup() ); |
227 CEikCba* cba = static_cast< CEikCba* >( bgc->ButtonGroup() ); |
215 cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT ); |
228 cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
216 bgc->SetBoundingRect( TRect() ); |
229 bgc->SetBoundingRect( TRect() ); |
217 cba->DrawNow(); |
230 cba->DrawNow(); |
|
231 } |
|
232 else if ( AknLayoutUtils::MSKEnabled() ) |
|
233 { |
|
234 UpdateMSKIconL(); |
218 } |
235 } |
219 |
236 |
220 // create container |
237 // create container |
221 if ( iWmMainContainer == NULL ) |
238 if ( iWmMainContainer == NULL ) |
222 { |
239 { |
307 !iWmMainContainer->CanDoSort() ); |
324 !iWmMainContainer->CanDoSort() ); |
308 aMenuPane->SetItemDimmed( EWmMainContainerViewHelpMenuItemCommand, |
325 aMenuPane->SetItemDimmed( EWmMainContainerViewHelpMenuItemCommand, |
309 !iWmMainContainer->CanDoHelp() ); |
326 !iWmMainContainer->CanDoHelp() ); |
310 aMenuPane->SetItemDimmed( EWmMainContainerViewUninstallMenuItemCommand, |
327 aMenuPane->SetItemDimmed( EWmMainContainerViewUninstallMenuItemCommand, |
311 !iWmMainContainer->CanDoUninstall() ); |
328 !iWmMainContainer->CanDoUninstall() ); |
312 if ( !iWmMainContainer->PortalSelected() ) |
|
313 aMenuPane->DeleteMenuItem( EWmMainContainerViewOpenPortalMenuItemCommand ); |
|
314 if ( !iWmMainContainer->WidgetSelected() ) |
329 if ( !iWmMainContainer->WidgetSelected() ) |
315 aMenuPane->DeleteMenuItem( EWmMainContainerViewAddMenuItemCommand ); |
330 aMenuPane->DeleteMenuItem( EWmMainContainerViewAddMenuItemCommand ); |
316 } |
331 } |
317 } |
|
318 |
|
319 // --------------------------------------------------------- |
|
320 // CWmMainContainerView::HandleOpenMenuItemSelectedL |
|
321 // --------------------------------------------------------- |
|
322 // |
|
323 TBool CWmMainContainerView::HandleOpenMenuItemSelectedL() |
|
324 { |
|
325 if ( iWmMainContainer && iWmMainContainer->PortalSelected() ) |
|
326 { |
|
327 iWmMainContainer->OpenPortalL(); |
|
328 } |
|
329 return ETrue; |
|
330 } |
332 } |
331 |
333 |
332 // --------------------------------------------------------- |
334 // --------------------------------------------------------- |
333 // CWmMainContainerView::HandleDetailsMenuItemSelectedL |
335 // CWmMainContainerView::HandleDetailsMenuItemSelectedL |
334 // --------------------------------------------------------- |
336 // --------------------------------------------------------- |
429 } |
431 } |
430 return ETrue; |
432 return ETrue; |
431 } |
433 } |
432 |
434 |
433 // --------------------------------------------------------- |
435 // --------------------------------------------------------- |
434 // CWmMainContainerView::HandleForegroundEventL |
436 // CWmMainContainerView::UpdateMSKIconL |
435 // --------------------------------------------------------- |
437 // --------------------------------------------------------- |
436 // |
438 // |
437 void CWmMainContainerView::HandleForegroundEventL( TBool aForeground ) |
439 void CWmMainContainerView::UpdateMSKIconL() |
438 { |
440 { |
439 CAknView::HandleForegroundEventL( aForeground ); |
441 CEikButtonGroupContainer* bgc( Cba() ); |
440 if ( iWmMainContainer ) |
442 CEikCba* cba = static_cast< CEikCba* >( bgc->ButtonGroup() ); |
441 { |
443 TFileName fileName( iWmPlugin.ResourceLoader().IconFilePath() ); |
442 iWmMainContainer->ProcessForegroundEvent( aForeground ); |
444 TAknsItemID skinId = KAknsIIDQgnMenuOviStore; |
443 } |
445 TInt bitmapId( EMbmWidgetmanagerQgn_menu_ovistore ); |
|
446 TInt maskId( EMbmWidgetmanagerQgn_menu_ovistore_mask ); |
|
447 |
|
448 if ( iWmPlugin.Configuration().StoreCount() > 1 ) |
|
449 { |
|
450 skinId = KAknsIIDQgnPropLmShopping; |
|
451 bitmapId = EMbmWidgetmanagerQgn_menu_shopping; |
|
452 maskId = EMbmWidgetmanagerQgn_menu_shopping_mask; |
|
453 } |
|
454 else |
|
455 { |
|
456 const RPointerArray<CWmConfItem>& storeConfArray = |
|
457 iWmPlugin.Configuration().StoreConfArray(); |
|
458 CWmConfItem* confItem( storeConfArray[0] ); |
|
459 |
|
460 if ( confItem && |
|
461 confItem->Id() != CWmStore::EOvi && |
|
462 confItem->Icon().Length() ) |
|
463 { |
|
464 CWmImageConverter* imageConverter = CWmImageConverter::NewL(); |
|
465 CleanupStack::PushL( imageConverter ); |
|
466 |
|
467 // parse icon str |
|
468 // TODO: now only mif&skin are supported. Later when API is there |
|
469 // we can add support for rest icon types |
|
470 TBool res = imageConverter->ParseIconString( |
|
471 confItem->Icon(), skinId, bitmapId, maskId, fileName ); |
|
472 |
|
473 CleanupStack::PopAndDestroy( imageConverter ); |
|
474 |
|
475 if ( !res ) |
|
476 { |
|
477 // use default shopping icon |
|
478 skinId = KAknsIIDQgnPropLmShopping; |
|
479 bitmapId = EMbmWidgetmanagerQgn_menu_shopping; |
|
480 maskId = EMbmWidgetmanagerQgn_menu_shopping_mask; |
|
481 fileName.Copy( iWmPlugin.ResourceLoader().IconFilePath() ); |
|
482 } |
|
483 } |
|
484 } |
|
485 |
|
486 cba->UpdateMSKIconL( |
|
487 skinId, |
|
488 fileName, |
|
489 bitmapId, |
|
490 maskId, |
|
491 ETrue ); |
|
492 bgc->SetBoundingRect( TRect() ); |
|
493 cba->DrawNow(); |
444 } |
494 } |
445 |
495 |
446 // End of file |
496 // End of file |