66 |
66 |
67 // LOCAL CONSTANTS AND MACROS |
67 // LOCAL CONSTANTS AND MACROS |
68 _LIT8( KEventPluginUnInstalled, "PluginUninstalled" ); |
68 _LIT8( KEventPluginUnInstalled, "PluginUninstalled" ); |
69 _LIT8( KEventRootConfActivated, "AppConfActivated" ); |
69 _LIT8( KEventRootConfActivated, "AppConfActivated" ); |
70 _LIT8( KEventPluginUpdated, "PluginUpdated" ); |
70 _LIT8( KEventPluginUpdated, "PluginUpdated" ); |
71 _LIT8( KEventPluginActivated, "PluginActivated" ); |
|
72 _LIT8( KEventPluginInstalled, "PluginInstalled" ); |
71 _LIT8( KEventPluginInstalled, "PluginInstalled" ); |
73 _LIT8( KEventPluginAdded, "PluginAdded" ); |
|
74 _LIT8( KEventPluginRemoved, "PluginRemoved" ); |
|
75 _LIT8( KEventPluginReplaced, "PluginReplaced" ); |
|
76 |
|
77 _LIT8( KAi3Uid, "0x102750f0" ); |
|
78 |
72 |
79 _LIT8( KEmptyWidgetUid, "0x2001F47F" ); |
73 _LIT8( KEmptyWidgetUid, "0x2001F47F" ); |
80 _LIT8( KDownload, "Editor/DownloadCaption" ); |
74 _LIT8( KDownload, "Editor/DownloadCaption" ); |
81 |
75 |
82 _LIT8( KSingle, "single" ); |
76 _LIT8( KSingle, "single" ); |
217 { |
211 { |
218 CXnViewData& viewData( aViewManager.ActiveViewData() ); |
212 CXnViewData& viewData( aViewManager.ActiveViewData() ); |
219 |
213 |
220 if ( aPredicate ) |
214 if ( aPredicate ) |
221 { |
215 { |
222 CXnPluginData& plugin( viewData.Plugin( aPredicate ) ); |
216 CXnPluginData* plugin( viewData.Plugin( aPredicate ) ); |
223 |
217 |
224 if ( !plugin.Occupied() ) |
218 if ( plugin && !plugin->Occupied() ) |
225 { |
219 { |
226 return &plugin; |
220 return plugin; |
227 } |
221 } |
228 } |
222 } |
229 |
223 |
230 RPointerArray< CXnNode >& nodes( aViewManager.PluginNodes() ); |
224 RPointerArray< CXnNode >& nodes( aViewManager.PluginNodes() ); |
231 |
225 |
232 for ( TInt i = 0; i < nodes.Count(); i++ ) |
226 for ( TInt i = 0; i < nodes.Count(); i++ ) |
233 { |
227 { |
234 CXnNode* node( nodes[i] ); |
228 CXnNode* node( nodes[i] ); |
235 |
229 |
236 CXnPluginData& plugin( viewData.Plugin( node ) ); |
230 CXnPluginData* plugin( viewData.Plugin( node ) ); |
237 |
231 |
238 if ( !plugin.Occupied() ) |
232 if ( plugin && !plugin->Occupied() ) |
239 { |
233 { |
240 return &plugin; |
234 return plugin; |
241 } |
235 } |
242 } |
236 } |
243 |
237 |
244 return NULL; |
238 return NULL; |
245 } |
239 } |
592 |
586 |
593 // --------------------------------------------------------------------------- |
587 // --------------------------------------------------------------------------- |
594 // CXnEditor::ReplaceWidgetL |
588 // CXnEditor::ReplaceWidgetL |
595 // --------------------------------------------------------------------------- |
589 // --------------------------------------------------------------------------- |
596 // |
590 // |
597 void CXnEditor::ReplaceWidgetL( CHsContentInfo& aContentInfo, TBool aUseHsps ) |
591 void CXnEditor::ReplaceWidgetL( CHsContentInfo& aContentInfo ) |
598 { |
592 { |
599 RPointerArray< CXnPluginData > plugins; |
593 RPointerArray< CXnPluginData > plugins; |
600 CleanupClosePushL( plugins ); |
594 CleanupClosePushL( plugins ); |
601 |
595 |
602 iViewManager.PluginDataL( plugins, ETrue ); |
596 iViewManager.PluginDataL( plugins, ETrue ); |
607 { |
601 { |
608 CXnPluginData* plugin( plugins[i] ); |
602 CXnPluginData* plugin( plugins[i] ); |
609 |
603 |
610 if( plugin->PluginId() == aContentInfo.PluginId() ) |
604 if( plugin->PluginId() == aContentInfo.PluginId() ) |
611 { |
605 { |
|
606 if ( aContentInfo.Type() == KNullDesC8 ) |
|
607 { |
|
608 aContentInfo.SetTypeL( plugin->Type() ); |
|
609 } |
|
610 |
|
611 if ( aContentInfo.PublisherId() == KNullDesC ) |
|
612 { |
|
613 aContentInfo.SetPublisherIdL( plugin->PublisherName() ); |
|
614 } |
612 match = plugin; |
615 match = plugin; |
613 break; |
616 break; |
614 } |
617 } |
615 } |
618 } |
616 |
619 |
617 if( match ) |
620 if( match ) |
618 { |
621 { |
619 iViewManager.ReplaceWidgetToPluginL( aContentInfo, *match, aUseHsps ); |
622 iViewManager.ReplaceWidgetToPluginL( aContentInfo, *match ); |
620 } |
623 } |
621 |
624 |
622 CleanupStack::PopAndDestroy( &plugins ); |
625 CleanupStack::PopAndDestroy( &plugins ); |
623 } |
626 } |
624 |
627 |
812 if ( !aNode ) |
815 if ( !aNode ) |
813 { |
816 { |
814 return; |
817 return; |
815 } |
818 } |
816 |
819 |
817 CXnPluginData& plugin( iViewManager.ActiveViewData().Plugin( aNode ) ); |
820 CXnPluginData* plugin( iViewManager.ActiveViewData().Plugin( aNode ) ); |
818 |
821 |
819 if( plugin.Removable() ) |
822 if( plugin && plugin->Removable() ) |
820 { |
823 { |
821 TRAPD( err, err = iViewManager.UnloadWidgetFromPluginL( plugin ) ); |
824 TRAPD( err, err = iViewManager.UnloadWidgetFromPluginL( *plugin ) ); |
822 |
825 |
823 if ( err != KErrNone ) |
826 if ( err != KErrNone ) |
824 { |
827 { |
825 HBufC* msg = StringLoader::LoadLC( |
828 HBufC* msg = StringLoader::LoadLC( |
826 R_QTN_HS_OPERATION_FAILED_NO_DISK ); |
829 R_QTN_HS_OPERATION_FAILED_NO_DISK ); |
848 CDesC8ArrayFlat* ids = new ( ELeave ) CDesC8ArrayFlat( 6 ); |
851 CDesC8ArrayFlat* ids = new ( ELeave ) CDesC8ArrayFlat( 6 ); |
849 CleanupStack::PushL( ids ); |
852 CleanupStack::PushL( ids ); |
850 |
853 |
851 for ( TInt i = 0; i < aPluginArray->Count(); i++ ) |
854 for ( TInt i = 0; i < aPluginArray->Count(); i++ ) |
852 { |
855 { |
853 CXnPluginData& plugin( viewData.Plugin( ( *aPluginArray )[i] ) ); |
856 CXnPluginData* plugin( viewData.Plugin( ( *aPluginArray )[i] ) ); |
854 |
857 if ( plugin ) |
855 const TDesC8& id( plugin.PluginId() ); |
858 { |
856 |
859 const TDesC8& id( plugin->PluginId() ); |
857 if ( id != KNullDesC8 ) |
860 |
858 { |
861 if ( id != KNullDesC8 ) |
859 ids->AppendL( id ); |
862 { |
860 } |
863 ids->AppendL( id ); |
861 } |
864 } |
|
865 } |
|
866 } |
862 |
867 |
863 iHspsWrapper->MovePluginsL( configurationId, *ids ); |
868 iHspsWrapper->MovePluginsL( configurationId, *ids ); |
864 |
869 |
865 CleanupStack::PopAndDestroy( ids ); |
870 CleanupStack::PopAndDestroy( ids ); |
866 } |
871 } |
876 return NULL; |
881 return NULL; |
877 } |
882 } |
878 |
883 |
879 RPointerArray< CPublisherInfo >& publisherInfo( |
884 RPointerArray< CPublisherInfo >& publisherInfo( |
880 iPublisherMap->PublisherInfo() ); |
885 iPublisherMap->PublisherInfo() ); |
881 |
886 |
882 const TDesC& widgetName( aContentInfo.Name() ); |
|
883 const TDesC& publisherId( aContentInfo.PublisherId() ); |
887 const TDesC& publisherId( aContentInfo.PublisherId() ); |
884 |
888 |
885 CPublisherInfo* info = NULL; |
889 CPublisherInfo* info = NULL; |
886 |
890 |
887 for ( TInt i = 0; i < publisherInfo.Count(); i++ ) |
891 for ( TInt i = 0; i < publisherInfo.Count(); i++ ) |
888 { |
892 { |
889 info = publisherInfo[i]; |
893 CPublisherInfo* temp = publisherInfo[i]; |
890 |
894 |
891 if ( info->WidgetName() == widgetName && |
895 if ( temp->PublisherId() == publisherId ) |
892 info->PublisherId() == publisherId ) |
896 { |
893 { |
897 info = temp; |
894 break; |
898 break; |
895 } |
899 } |
896 } |
900 } |
897 |
901 |
898 return info; |
902 return info; |
1423 // CXnEditor::NotifyViewDeactivatedL |
1427 // CXnEditor::NotifyViewDeactivatedL |
1424 // --------------------------------------------------------------------------- |
1428 // --------------------------------------------------------------------------- |
1425 // |
1429 // |
1426 void CXnEditor::NotifyViewDeactivatedL( const CXnViewData& /*aViewData*/) |
1430 void CXnEditor::NotifyViewDeactivatedL( const CXnViewData& /*aViewData*/) |
1427 { |
1431 { |
|
1432 iTargetPlugin = NULL; |
1428 } |
1433 } |
1429 |
1434 |
1430 // --------------------------------------------------------------------------- |
1435 // --------------------------------------------------------------------------- |
1431 // CXnEditor::SetWallpaperL |
1436 // CXnEditor::SetWallpaperL |
1432 // --------------------------------------------------------------------------- |
1437 // --------------------------------------------------------------------------- |
1470 // |
1475 // |
1471 TInt CXnEditor::HandleNotifyL( |
1476 TInt CXnEditor::HandleNotifyL( |
1472 const TDesC8& aEvent, |
1477 const TDesC8& aEvent, |
1473 const TDesC8& /*aAppConfUid*/, |
1478 const TDesC8& /*aAppConfUid*/, |
1474 const TDesC8& aPluginName, |
1479 const TDesC8& aPluginName, |
1475 const TDesC8& aOrigUid, |
1480 const TDesC8& /*aOrigUid*/, |
1476 const TDesC8& aPluginUid, |
1481 const TDesC8& aPluginUid, |
1477 const TDesC8& aPluginId ) |
1482 const TDesC8& aPluginId ) |
1478 { |
1483 { |
1479 // Someone else has modified the configuration. Handle UI side here. |
1484 if ( aEvent == KEventPluginUnInstalled ) |
1480 if( aEvent == KEventPluginAdded || |
|
1481 aEvent == KEventPluginRemoved || |
|
1482 aEvent == KEventPluginReplaced ) |
|
1483 { |
|
1484 if( aOrigUid != KNullDesC8 && |
|
1485 aOrigUid != KAi3Uid ) |
|
1486 { |
|
1487 CHsContentInfo* info = CHsContentInfo::NewLC(); |
|
1488 |
|
1489 info->SetNameL( aPluginName ); |
|
1490 info->SetUidL( aPluginUid ); |
|
1491 info->SetPluginIdL( aPluginId ); |
|
1492 |
|
1493 ReplaceWidgetL( *info, EFalse ); |
|
1494 |
|
1495 CleanupStack::PopAndDestroy( info ); |
|
1496 } |
|
1497 } |
|
1498 else if ( aEvent == KEventPluginUnInstalled ) |
|
1499 { |
1485 { |
1500 CHsContentInfo* info = CHsContentInfo::NewLC(); |
1486 CHsContentInfo* info = CHsContentInfo::NewLC(); |
1501 |
1487 |
1502 info->SetNameL( aPluginName ); |
1488 info->SetNameL( aPluginName ); |
1503 info->SetUidL( aPluginUid ); |
1489 info->SetUidL( aPluginUid ); |
1605 // get installed widgets from HSPS (type: "widget") |
1588 // get installed widgets from HSPS (type: "widget") |
1606 HSPSPluginsL( array, KKeyWidget ); |
1589 HSPSPluginsL( array, KKeyWidget ); |
1607 // get installed widgets from HSPS |
1590 // get installed widgets from HSPS |
1608 TemplatedWidgetsL( array ); |
1591 TemplatedWidgetsL( array ); |
1609 |
1592 |
1610 FilterWidgetListL( aArray, EFalse ); |
1593 FilterWidgetListL( aArray, ETrue ); |
1611 |
1594 |
1612 return KErrNone; |
1595 return KErrNone; |
|
1596 } |
|
1597 |
|
1598 // ----------------------------------------------------------------------------- |
|
1599 // from MHsContentController |
|
1600 // ----------------------------------------------------------------------------- |
|
1601 // |
|
1602 TInt CXnEditor::WidgetListL( CHsContentInfo& aInfo, CHsContentInfoArray& aArray ) |
|
1603 { |
|
1604 TInt err( KErrNone ); |
|
1605 RPointerArray< CXnPluginData > widgets; |
|
1606 CleanupClosePushL( widgets ); |
|
1607 |
|
1608 if ( aInfo.Type() == KApplication ) |
|
1609 { |
|
1610 if ( aInfo.Uid().CompareF( iViewManager.ActiveAppData().PluginUid() ) == 0 ) |
|
1611 { |
|
1612 // Get widgets included in active application configuration |
|
1613 err = iViewManager.PluginDataL( KNullDesC8(), widgets ); |
|
1614 } |
|
1615 else |
|
1616 { |
|
1617 // Invalid application configuration |
|
1618 err = KErrArgument; |
|
1619 } |
|
1620 } |
|
1621 else if ( aInfo.Type() == KView ) |
|
1622 { |
|
1623 // Get widgets included in a view |
|
1624 err = iViewManager.PluginDataL( aInfo.PluginId(), widgets ); |
|
1625 } |
|
1626 else |
|
1627 { |
|
1628 err = KErrArgument; |
|
1629 } |
|
1630 |
|
1631 if ( !err ) |
|
1632 { |
|
1633 // Get installed widget content infos |
|
1634 RPointerArray< CHsContentInfo > array; |
|
1635 CleanupClosePushL( array ); |
|
1636 HSPSPluginsL( array, KKeyWidget ); |
|
1637 TemplatedWidgetsL( array ); |
|
1638 |
|
1639 // Create content info for each found widget |
|
1640 for ( TInt i = 0; i < widgets.Count(); i++ ) |
|
1641 { |
|
1642 CHsContentInfo* info = CreateContentInfoLC( *widgets[i], array ); |
|
1643 if ( info ) |
|
1644 { |
|
1645 aArray.Array().AppendL( info ); |
|
1646 CleanupStack::Pop( info ); |
|
1647 } |
|
1648 } |
|
1649 CleanupStack::PopAndDestroy(); // array |
|
1650 } |
|
1651 |
|
1652 CleanupStack::PopAndDestroy(); // widgets |
|
1653 |
|
1654 return err; |
1613 } |
1655 } |
1614 |
1656 |
1615 // ----------------------------------------------------------------------------- |
1657 // ----------------------------------------------------------------------------- |
1616 // from MHsContentController |
1658 // from MHsContentController |
1617 // ----------------------------------------------------------------------------- |
1659 // ----------------------------------------------------------------------------- |
1656 { |
1698 { |
1657 // malformed content info |
1699 // malformed content info |
1658 return KErrArgument; |
1700 return KErrArgument; |
1659 } |
1701 } |
1660 |
1702 |
1661 if ( !aInfo.CanBeAdded() ) |
1703 // the widget can not be added. Return proper error code |
1662 { |
1704 if ( IsCurrentViewFull() ) |
1663 // the widget can not be added. Return proper error code |
1705 { |
1664 if ( IsCurrentViewFull() ) |
1706 return KHsErrorViewFull; |
1665 { |
1707 } |
1666 return KHsErrorViewFull; |
1708 else if ( !aInfo.CanBeAdded() ) |
1667 } |
1709 { |
1668 else |
1710 return KHsErrorMaxInstanceCountExceeded; |
1669 { |
1711 } |
1670 return KHsErrorMaxInstanceCountExceeded; |
1712 |
1671 } |
|
1672 } |
|
1673 |
1713 |
1674 CXnPluginData* plugin( NULL ); |
1714 CXnPluginData* plugin( NULL ); |
1675 |
1715 |
1676 if( iTargetPlugin ) |
1716 if( iTargetPlugin ) |
1677 { |
1717 { |
1827 { |
1867 { |
1828 CHspsConfiguration* view( iHspsWrapper->GetPluginConfigurationL( plugin->PluginId() ) ); |
1868 CHspsConfiguration* view( iHspsWrapper->GetPluginConfigurationL( plugin->PluginId() ) ); |
1829 CleanupStack::PushL( view ); |
1869 CleanupStack::PushL( view ); |
1830 |
1870 |
1831 aInfo.SetNameL( view->PluginInfo().Name() ); |
1871 aInfo.SetNameL( view->PluginInfo().Name() ); |
|
1872 aInfo.SetPluginIdL( plugin->PluginId() ); |
1832 aInfo.SetUidL( view->PluginInfo().Uid() ); |
1873 aInfo.SetUidL( view->PluginInfo().Uid() ); |
1833 aInfo.SetTypeL( view->PluginInfo().Type() ); |
1874 aInfo.SetTypeL( view->PluginInfo().Type() ); |
1834 aInfo.SetDescriptionL( view->PluginInfo().Description() ); |
1875 aInfo.SetDescriptionL( view->PluginInfo().Description() ); |
1835 aInfo.SetIconPathL( view->PluginInfo().LogoIcon() ); |
1876 aInfo.SetIconPathL( view->PluginInfo().LogoIcon() ); |
1836 |
1877 |
1871 |
1912 |
1872 CleanupStack::PopAndDestroy( app ); |
1913 CleanupStack::PopAndDestroy( app ); |
1873 return err; |
1914 return err; |
1874 } |
1915 } |
1875 |
1916 |
|
1917 // ----------------------------------------------------------------------------- |
|
1918 // CXnEditor::CreateContentInfoLC |
|
1919 // ----------------------------------------------------------------------------- |
|
1920 // |
|
1921 CHsContentInfo* CXnEditor::CreateContentInfoLC( CXnPluginData& aPlugin, |
|
1922 RPointerArray< CHsContentInfo >& aInfos ) |
|
1923 { |
|
1924 CHsContentInfo* contentInfo( NULL ); |
|
1925 if ( aPlugin.Occupied() ) |
|
1926 { |
|
1927 for ( TInt i = 0; i < aInfos.Count() && !contentInfo; i++ ) |
|
1928 { |
|
1929 CHsContentInfo* info = aInfos[i]; |
|
1930 if ( aPlugin.PluginUid().CompareF( info->Uid() ) == 0 && |
|
1931 ( ( aPlugin.PublisherName().Length() == 0 ) || |
|
1932 ( aPlugin.PublisherName().CompareF( info->PublisherId() ) == 0 ) ) ) |
|
1933 { |
|
1934 contentInfo = info->CloneL(); |
|
1935 CleanupStack::PushL( contentInfo ); |
|
1936 contentInfo->SetPluginIdL( aPlugin.PluginId() ); |
|
1937 } |
|
1938 } |
|
1939 } |
|
1940 return contentInfo; |
|
1941 } |
|
1942 |
1876 // End of file |
1943 // End of file |