1849 iLogBus = aLogBus; |
1849 iLogBus = aLogBus; |
1850 } |
1850 } |
1851 #endif |
1851 #endif |
1852 |
1852 |
1853 // ----------------------------------------------------------------------------- |
1853 // ----------------------------------------------------------------------------- |
1854 // Removes an plugin instance from the provided application configuration |
1854 // ChspsMaintenanceHandler::IsViewConfiguration() |
|
1855 // ----------------------------------------------------------------------------- |
|
1856 // |
|
1857 TBool ChspsMaintenanceHandler::IsViewConfiguration( |
|
1858 ChspsDomNode& aPluginNode ) |
|
1859 { |
|
1860 TBool isView = EFalse; |
|
1861 |
|
1862 ChspsDomNode* confNode = |
|
1863 (ChspsDomNode*)aPluginNode.ChildNodes().FindByName( KConfigurationElement ); |
|
1864 if( confNode ) |
|
1865 { |
|
1866 ChspsDomAttribute* typeAttr = |
|
1867 (ChspsDomAttribute*)confNode->AttributeList().FindByName( KConfigurationAttrType ); |
|
1868 isView = ( typeAttr->Value().CompareF( KConfTypeView ) == 0 ); |
|
1869 } |
|
1870 return isView; |
|
1871 } |
|
1872 |
|
1873 // ----------------------------------------------------------------------------- |
|
1874 // ChspsMaintenanceHandler::RemoveConfigurationL() |
1855 // ----------------------------------------------------------------------------- |
1875 // ----------------------------------------------------------------------------- |
1856 // |
1876 // |
1857 TInt ChspsMaintenanceHandler::RemoveConfigurationL( |
1877 TInt ChspsMaintenanceHandler::RemoveConfigurationL( |
1858 ChspsODT& aAppODT, |
1878 ChspsODT& aAppODT, |
1859 const TInt aPluginId ) |
1879 const TInt aPluginId ) |
1860 { |
1880 { |
1861 TInt err = KErrNotFound; |
1881 TInt err = KErrNotFound; |
1862 |
1882 |
1863 // Find a plugin node with the provided id |
1883 // Find a plugin node with the provided id |
1864 ChspsDomNode *node = hspsServerUtil::FindPluginNodeL( aAppODT, aPluginId ); |
1884 ChspsDomNode *pluginNode = hspsServerUtil::FindPluginNodeL( aAppODT, aPluginId ); |
1865 if ( node ) |
1885 if ( pluginNode ) |
1866 { |
1886 { |
1867 // Get parent node |
1887 // Remove the node |
1868 ChspsDomNode *parentNode = node->Parent(); |
1888 err = RemoveConfigurationL( aAppODT, *pluginNode ); |
1869 if ( parentNode ) |
1889 } |
|
1890 |
|
1891 return err; |
|
1892 } |
|
1893 |
|
1894 // ----------------------------------------------------------------------------- |
|
1895 // Removes an plugin instance from the provided application configuration |
|
1896 // ----------------------------------------------------------------------------- |
|
1897 // |
|
1898 TInt ChspsMaintenanceHandler::RemoveConfigurationL( |
|
1899 ChspsODT& aAppODT, |
|
1900 ChspsDomNode& aPluginNode ) |
|
1901 { |
|
1902 TInt err = KErrNotFound; |
|
1903 |
|
1904 // Get parent node |
|
1905 ChspsDomNode *parentNode = aPluginNode.Parent(); |
|
1906 if ( parentNode ) |
|
1907 { |
|
1908 ChspsDomList& attrList = aPluginNode.AttributeList(); |
|
1909 |
|
1910 // Get uid attribute from the node |
|
1911 TInt pluginUid = 0; |
|
1912 ChspsDomAttribute* pluginUidAttr = |
|
1913 static_cast<ChspsDomAttribute*> ( attrList.FindByName(KPluginAttrUid) ); |
|
1914 if( !pluginUidAttr ) |
|
1915 { |
|
1916 #ifdef HSPS_LOG_ACTIVE |
|
1917 if( iLogBus ) |
|
1918 { |
|
1919 iLogBus->LogText( _L( "ChspsMaintenanceHandler::RemoveConfigurationL(): - Invalid XML" ) ); |
|
1920 } |
|
1921 #endif |
|
1922 |
|
1923 err = KErrGeneral; |
|
1924 } |
|
1925 else |
|
1926 { |
|
1927 // Convert uids from string to numeric format |
|
1928 const TDesC8& pluginUidValue = pluginUidAttr->Value(); |
|
1929 const TUid uid = hspsServerUtil::ConvertDescIntoUid(pluginUidValue); |
|
1930 if ( uid.iUid > 0 ) |
|
1931 { |
|
1932 pluginUid = uid.iUid; |
|
1933 // Override default status |
|
1934 err = KErrNone; |
|
1935 } |
|
1936 } |
|
1937 |
|
1938 // Store activity state for use after deletion. |
|
1939 TBool pluginWasActive = EFalse; |
|
1940 ChspsDomAttribute* pluginActivityAttr = |
|
1941 static_cast<ChspsDomAttribute*>( attrList.FindByName( KPluginAttrActive ) ); |
|
1942 if( pluginActivityAttr ) |
|
1943 { |
|
1944 if( pluginActivityAttr->Value().CompareF( KPluginActiveStateActive ) == 0 ) |
|
1945 { |
|
1946 pluginWasActive = ETrue; |
|
1947 } |
|
1948 } |
|
1949 |
|
1950 if ( !err ) |
1870 { |
1951 { |
1871 // Get uid attribute from the node |
1952 // If user is removing a view plugin |
1872 TInt pluginUid = 0; |
1953 if( IsViewConfiguration( aPluginNode ) ) |
1873 ChspsDomList& attrList = node->AttributeList(); |
1954 { |
1874 ChspsDomAttribute* pluginUidAttr = |
1955 // first all subplugins need to be removed, so that the application's resource array |
1875 static_cast<ChspsDomAttribute*> ( attrList.FindByName(KPluginAttrUid) ); |
1956 // (visible in ODT dump) contains only valid resources |
1876 if( !pluginUidAttr ) |
1957 ChspsDomNode* confNode = |
1877 { |
1958 (ChspsDomNode*)aPluginNode.ChildNodes().FindByName( KConfigurationElement ); |
1878 #ifdef HSPS_LOG_ACTIVE |
1959 if( confNode ) |
1879 if( iLogBus ) |
|
1880 { |
1960 { |
1881 iLogBus->LogText( _L( "ChspsMaintenanceHandler::RemoveConfigurationL(): - Invalid XML" ) ); |
1961 ChspsDomNode* controlNode = |
1882 } |
1962 (ChspsDomNode*)confNode->ChildNodes().FindByName( KControlElement ); |
1883 #endif |
1963 if( controlNode ) |
1884 |
1964 { |
1885 err = KErrGeneral; |
1965 ChspsDomNode *pluginsNode = |
1886 } |
1966 (ChspsDomNode*)controlNode->ChildNodes().FindByName( KPluginsElement ); |
1887 else |
1967 if( pluginsNode ) |
1888 { |
1968 { |
1889 // Convert uids from string to numeric format |
1969 RPointerArray<ChspsDomNode> nodeArray; |
1890 const TDesC8& pluginUidValue = pluginUidAttr->Value(); |
1970 CleanupClosePushL( nodeArray ); |
1891 const TUid uid = hspsServerUtil::ConvertDescIntoUid(pluginUidValue); |
|
1892 if ( uid.iUid > 0 ) |
|
1893 { |
|
1894 pluginUid = uid.iUid; |
|
1895 // Override default status |
|
1896 err = KErrNone; |
|
1897 } |
|
1898 } |
|
1899 |
|
1900 // Store activity state for use after deletion. |
|
1901 TBool pluginWasActive = EFalse; |
|
1902 ChspsDomAttribute* pluginActivityAttr = |
|
1903 static_cast<ChspsDomAttribute*>( attrList.FindByName( KPluginAttrActive ) ); |
|
1904 if( pluginActivityAttr ) |
|
1905 { |
|
1906 if( pluginActivityAttr->Value().CompareF( KPluginActiveStateActive ) == 0 ) |
|
1907 { |
|
1908 pluginWasActive = ETrue; |
|
1909 } |
|
1910 } |
|
1911 |
1971 |
1912 if ( !err ) |
1972 // Get plugin nodes |
1913 { |
1973 TInt pluginCount = pluginsNode->ChildNodes().Length(); |
1914 // Get number of plugin instances with the plugin uid |
1974 for( TInt pluginIndex=0; pluginIndex < pluginCount; pluginIndex++ ) |
1915 TInt instanceCount = 0; |
1975 { |
1916 GetPluginInstanceCountL( |
1976 nodeArray.Append( (ChspsDomNode*)pluginsNode->ChildNodes().Item( pluginIndex ) ); |
1917 aAppODT, |
1977 } |
1918 pluginUid, |
1978 |
1919 instanceCount ); |
1979 // Remove the nodes and related resources |
1920 |
1980 for( TInt pluginIndex=0; pluginIndex < pluginCount; pluginIndex++ ) |
1921 // Remove plugin resources form the application configuration: |
1981 { |
1922 // By default remove all plugin's resources from all instances |
1982 RemoveConfigurationL( aAppODT, *nodeArray[pluginIndex ] ); |
1923 // - otherwise, after upgrades, there might be various versions of the same resources |
1983 } |
1924 err = RemovePluginResourcesL( aAppODT, pluginUid ); |
1984 |
1925 if ( !err ) |
1985 nodeArray.Reset(); |
1926 { |
1986 CleanupStack::PopAndDestroy( 1, &nodeArray ); |
1927 // If the application configuration holds other instances of the same plugin |
1987 } |
1928 if ( instanceCount > 1 ) |
|
1929 { |
|
1930 // Put back the resources |
|
1931 AddPluginResourcesL( |
|
1932 aAppODT, |
|
1933 pluginUid ); |
|
1934 } |
1988 } |
1935 |
|
1936 // Remove the plugin node from parent node |
|
1937 parentNode->DeleteChild( node ); |
|
1938 } |
1989 } |
1939 } |
1990 } |
1940 |
1991 |
1941 // If plugin was succesfully deleted and was active -> |
1992 // Get number of plugin instances with the plugin uid |
1942 // need set another plugin active. |
1993 TInt instanceCount = 0; |
1943 // ( Choose to activate topmost item. ) |
1994 GetPluginInstanceCountL( |
1944 // ( Use depth of 1 to affect only one level. ) |
1995 aAppODT, |
1945 if ( !err && pluginWasActive ) |
1996 pluginUid, |
1946 { |
1997 instanceCount ); |
1947 const TInt KDepth = 1; |
1998 |
1948 hspsServerUtil::EditPluginNodeActivityL( parentNode, |
1999 // Remove plugin resources from the application configuration: |
1949 hspsServerUtil::EActivateFirst, |
2000 // By default remove all plugin's resources from all instances |
1950 KDepth ); |
2001 // - otherwise, after upgrades, there might be various versions of the same resources |
1951 } |
2002 err = RemovePluginResourcesL( aAppODT, pluginUid ); |
1952 } |
2003 if ( !err ) |
1953 } |
2004 { |
|
2005 // If the application configuration holds other instances of the same plugin |
|
2006 if ( instanceCount > 1 ) |
|
2007 { |
|
2008 // Put back the resources |
|
2009 AddPluginResourcesL( |
|
2010 aAppODT, |
|
2011 pluginUid ); |
|
2012 } |
|
2013 |
|
2014 // Remove the plugin node from the plugins node |
|
2015 parentNode->DeleteChild( &aPluginNode ); |
|
2016 } |
|
2017 } |
|
2018 |
|
2019 // If plugin was succesfully deleted and was active -> |
|
2020 // need set another plugin active. |
|
2021 // ( Choose to activate topmost item. ) |
|
2022 // ( Use depth of 1 to affect only one level. ) |
|
2023 if ( !err && pluginWasActive ) |
|
2024 { |
|
2025 const TInt KDepth = 1; |
|
2026 hspsServerUtil::EditPluginNodeActivityL( parentNode, |
|
2027 hspsServerUtil::EActivateFirst, |
|
2028 KDepth ); |
|
2029 } |
|
2030 } |
1954 |
2031 |
1955 return err; |
2032 return err; |
1956 } |
2033 } |
1957 |
2034 |
1958 //---------------------------------------------------------------------------- |
2035 //---------------------------------------------------------------------------- |
4601 CleanupStack::Pop( resourcesNode ); |
4678 CleanupStack::Pop( resourcesNode ); |
4602 resourcesNode->SetParent( confNode ); |
4679 resourcesNode->SetParent( confNode ); |
4603 |
4680 |
4604 } |
4681 } |
4605 |
4682 |
|
4683 // ----------------------------------------------------------------------------- |
|
4684 // ChspsMaintenanceHandler::ServiceRestoreConfigurationsL |
|
4685 // ----------------------------------------------------------------------------- |
|
4686 // |
|
4687 void ChspsMaintenanceHandler::ServiceRestoreConfigurationsL( const RMessage2& aMessage ) |
|
4688 { |
|
4689 ThspsServiceCompletedMessage ret = EhspsRestoreConfigurationsFailed; |
|
4690 |
|
4691 // using message pointer as a local variable because of synch call |
|
4692 RMessagePtr2 messagePtr = aMessage; |
|
4693 |
|
4694 // IPC slots: |
|
4695 // #0) output: externalized ChspsResult for error handling |
|
4696 // #1) input: ThspsParamRestoreConfigurations struct |
|
4697 ThspsParamRestoreConfigurations params; |
|
4698 TPckg<ThspsParamRestoreConfigurations> packagedStruct(params); |
|
4699 aMessage.ReadL(1, packagedStruct); |
|
4700 if ( params.appUid < 1 ) |
|
4701 { |
|
4702 User::Leave( KErrArgument ); |
|
4703 } |
|
4704 // Enable modification of owned configurations only |
|
4705 if( messagePtr.SecureId().iId != params.appUid ) |
|
4706 { |
|
4707 User::Leave( KErrAccessDenied ); |
|
4708 } |
|
4709 |
|
4710 TInt err = KErrNone; |
|
4711 if( iDefinitionRepository.Locked() ) |
|
4712 { |
|
4713 // Repository locked |
|
4714 err = KErrAccessDenied; |
|
4715 } |
|
4716 |
|
4717 if( !err ) |
|
4718 { |
|
4719 // Lock the Plugin Repository (a.k.a. Def.rep) |
|
4720 iDefinitionRepository.Lock(); |
|
4721 CleanupStack::PushL( TCleanupItem( UnlockRepository, &iDefinitionRepository ) ); |
|
4722 |
|
4723 // Get active root configuration for the client application |
|
4724 ChspsODT* appODT = ChspsODT::NewL(); |
|
4725 CleanupStack::PushL( appODT ); |
|
4726 iThemeServer.GetActivateAppConfigurationL( |
|
4727 params.appUid, |
|
4728 *appODT ); |
|
4729 |
|
4730 #ifdef HSPS_LOG_ACTIVE |
|
4731 if( iLogBus ) |
|
4732 { |
|
4733 iLogBus->LogText( |
|
4734 _L( "ChspsMaintenanceHandler::ServiceRestoreConfigurationsL(): - Dump before the changes:" ) |
|
4735 ); |
|
4736 ChspsOdtDump::Dump( *appODT, *iLogBus ); |
|
4737 } |
|
4738 #endif |
|
4739 |
|
4740 TInt err = KErrNone; |
|
4741 if ( !params.restoreAll ) |
|
4742 { |
|
4743 // Remove all widgets from the active view |
|
4744 err = RestoreActiveViewL( *appODT ); |
|
4745 } |
|
4746 |
|
4747 // As a backup, if restoration of the active view fails, |
|
4748 // or if all views but the locked view should be removed |
|
4749 if ( err || params.restoreAll ) |
|
4750 { |
|
4751 // Remove all views but the locked one and reset active view |
|
4752 RemoveUnlockedViewsL( *appODT ); |
|
4753 |
|
4754 // Remove all widgets from the active view |
|
4755 err = RestoreActiveViewL( *appODT ); |
|
4756 } |
|
4757 |
|
4758 #ifdef HSPS_LOG_ACTIVE |
|
4759 if( iLogBus ) |
|
4760 { |
|
4761 iLogBus->LogText( |
|
4762 _L( "ChspsMaintenanceHandler::ServiceRestoreConfigurationsL(): - Dump after the changes:" ) |
|
4763 ); |
|
4764 ChspsOdtDump::Dump( *appODT, *iLogBus ); |
|
4765 } |
|
4766 #endif |
|
4767 if( !err ) |
|
4768 { |
|
4769 // Stores the new application configuration into the repository |
|
4770 err = iDefinitionRepository.SetOdtL( *appODT ); |
|
4771 ret = EhspsRestoreConfigurationsSuccess; |
|
4772 } |
|
4773 |
|
4774 CleanupStack::PopAndDestroy( appODT ); |
|
4775 |
|
4776 // Unlock after the changes have been done |
|
4777 iDefinitionRepository.Unlock(); |
|
4778 CleanupStack::Pop(&iDefinitionRepository); |
|
4779 } |
|
4780 |
|
4781 // Error handling |
|
4782 iResult->iXuikonError = err; |
|
4783 |
|
4784 // complete the message |
|
4785 CompleteRequest( ret, messagePtr ); |
|
4786 } |
|
4787 |
|
4788 // ----------------------------------------------------------------------------- |
|
4789 // ChspsMaintenanceHandler::RestoreActiveViewL |
|
4790 // ----------------------------------------------------------------------------- |
|
4791 // |
|
4792 TInt ChspsMaintenanceHandler::RestoreActiveViewL( |
|
4793 ChspsODT& aAppODT ) |
|
4794 { |
|
4795 TInt err = KErrCorrupt; |
|
4796 |
|
4797 // Find active view node |
|
4798 ChspsDomNode* pluginNode = FindActiveView( aAppODT ); |
|
4799 if ( pluginNode ) |
|
4800 { |
|
4801 // Remove all plugins from the view configuration |
|
4802 err = RemovePluginConfigurationsL( |
|
4803 aAppODT, |
|
4804 *pluginNode ); |
|
4805 } |
|
4806 return err; |
|
4807 } |
|
4808 |
|
4809 // ----------------------------------------------------------------------------- |
|
4810 // ChspsMaintenanceHandler::FindActiveView |
|
4811 // ----------------------------------------------------------------------------- |
|
4812 // |
|
4813 ChspsDomNode* ChspsMaintenanceHandler::FindActiveView( |
|
4814 ChspsODT& aAppODT ) |
|
4815 { |
|
4816 ChspsDomNode* pluginNode = NULL; |
|
4817 |
|
4818 // Get 1st configuration element |
|
4819 ChspsDomNode* confNode = aAppODT.DomDocument().RootNode(); |
|
4820 if( confNode && confNode->Name().CompareF( KConfigurationElement ) == 0 ) |
|
4821 { |
|
4822 // Get control element |
|
4823 ChspsDomNode* controlNode = |
|
4824 (ChspsDomNode*)confNode->ChildNodes().FindByName( KControlElement ); |
|
4825 if( controlNode ) |
|
4826 { |
|
4827 // Get plugins element |
|
4828 ChspsDomNode* pluginsNode = |
|
4829 (ChspsDomNode*)controlNode->ChildNodes().FindByName( KPluginsElement ); |
|
4830 if( pluginsNode ) |
|
4831 { |
|
4832 // Find active plugin node under the plugins node |
|
4833 pluginNode = hspsServerUtil::GetActivePluginNode( pluginsNode ); |
|
4834 } |
|
4835 } |
|
4836 } |
|
4837 return pluginNode; |
|
4838 } |
|
4839 |
|
4840 // ----------------------------------------------------------------------------- |
|
4841 // ChspsMaintenanceHandler::RemovePluginConfigurationsL |
|
4842 // ----------------------------------------------------------------------------- |
|
4843 // |
|
4844 TInt ChspsMaintenanceHandler::RemovePluginConfigurationsL( |
|
4845 ChspsODT& aAppODT, |
|
4846 ChspsDomNode& aActivePluginNode ) |
|
4847 { |
|
4848 TInt err = KErrCorrupt; |
|
4849 |
|
4850 // Find a configuration node |
|
4851 ChspsDomNode* confNode = |
|
4852 (ChspsDomNode*)aActivePluginNode.ChildNodes().FindByName( KConfigurationElement ); |
|
4853 if( confNode ) |
|
4854 { |
|
4855 // Get control node |
|
4856 ChspsDomNode* controlNode = |
|
4857 (ChspsDomNode*)confNode->ChildNodes().FindByName( KControlElement ); |
|
4858 if( controlNode ) |
|
4859 { |
|
4860 // Find a plugins node |
|
4861 ChspsDomNode* pluginsNode = |
|
4862 (ChspsDomNode*)controlNode->ChildNodes().FindByName( KPluginsElement ); |
|
4863 if( pluginsNode ) |
|
4864 { |
|
4865 // Loop plugin nodes |
|
4866 err = KErrNone; |
|
4867 ChspsDomList& childNodes = pluginsNode->ChildNodes(); |
|
4868 for( TInt pluginIndex=childNodes.Length()-1; pluginIndex >= 0; pluginIndex-- ) |
|
4869 { |
|
4870 ChspsDomNode* pluginNode = (ChspsDomNode*)childNodes.Item( pluginIndex ); |
|
4871 if( pluginNode ) |
|
4872 { |
|
4873 // Remove the plugin configuration instance |
|
4874 err = RemoveConfigurationL( |
|
4875 aAppODT, |
|
4876 *pluginNode ); |
|
4877 if( err ) |
|
4878 { |
|
4879 break; |
|
4880 } |
|
4881 } |
|
4882 } |
|
4883 } |
|
4884 } |
|
4885 } |
|
4886 |
|
4887 return err; |
|
4888 } |
|
4889 |
|
4890 // ----------------------------------------------------------------------------- |
|
4891 // ChspsMaintenanceHandler::IsConfigurationLocked |
|
4892 // ----------------------------------------------------------------------------- |
|
4893 // |
|
4894 TBool ChspsMaintenanceHandler::IsConfigurationLocked( |
|
4895 ChspsDomNode& aConfNode ) |
|
4896 { |
|
4897 TBool isLocked = EFalse; |
|
4898 |
|
4899 ChspsDomList& attrList = aConfNode.AttributeList(); |
|
4900 ChspsDomAttribute* attr = |
|
4901 static_cast<ChspsDomAttribute*>( attrList.FindByName( KConfigurationAttrLocking ) ); |
|
4902 if( attr ) |
|
4903 { |
|
4904 isLocked = ( attr->Value().CompareF( KConfLockingLocked ) == 0 ); |
|
4905 } |
|
4906 |
|
4907 return isLocked; |
|
4908 } |
|
4909 |
|
4910 // ----------------------------------------------------------------------------- |
|
4911 // ChspsMaintenanceHandler::RemoveUnlockedViewsL |
|
4912 // ----------------------------------------------------------------------------- |
|
4913 // |
|
4914 void ChspsMaintenanceHandler::RemoveUnlockedViewsL( |
|
4915 ChspsODT& aAppODT ) |
|
4916 { |
|
4917 // Get 1st configuration element |
|
4918 ChspsDomNode* confNode = aAppODT.DomDocument().RootNode(); |
|
4919 if( !confNode || confNode->Name().CompareF( KConfigurationElement) != 0 ) |
|
4920 { |
|
4921 User::Leave( KErrCorrupt ); |
|
4922 } |
|
4923 |
|
4924 ChspsDomNode* controlNode = |
|
4925 (ChspsDomNode*)confNode->ChildNodes().FindByName( KControlElement ); |
|
4926 if( !controlNode ) |
|
4927 { |
|
4928 User::Leave( KErrCorrupt ); |
|
4929 } |
|
4930 |
|
4931 // Get plugins element |
|
4932 ChspsDomNode* pluginsNode = |
|
4933 (ChspsDomNode*)controlNode->ChildNodes().FindByName( KPluginsElement ); |
|
4934 if( !pluginsNode ) |
|
4935 { |
|
4936 User::Leave( KErrCorrupt ); |
|
4937 } |
|
4938 |
|
4939 // Find plugin nodes which should be removed |
|
4940 const TInt pluginCount = pluginsNode->ChildNodes().Length(); |
|
4941 if( pluginCount > 1 ) |
|
4942 { |
|
4943 // Array for nodes which should removed from the configuration |
|
4944 // (don't touch the appended objects) |
|
4945 RPointerArray<ChspsDomNode> nodeArray; |
|
4946 CleanupClosePushL( nodeArray ); |
|
4947 |
|
4948 // Remove all but one view |
|
4949 TBool foundLocked = EFalse; |
|
4950 for( TInt nodeIndex=0; nodeIndex < pluginCount; nodeIndex++ ) |
|
4951 { |
|
4952 ChspsDomNode* pluginNode = |
|
4953 (ChspsDomNode*)pluginsNode->ChildNodes().Item( nodeIndex ); |
|
4954 if( pluginNode ) |
|
4955 { |
|
4956 |
|
4957 ChspsDomNode* confNode = |
|
4958 (ChspsDomNode*)pluginNode->ChildNodes().FindByName( KConfigurationElement ); |
|
4959 if( confNode ) |
|
4960 { |
|
4961 TBool isLocked = IsConfigurationLocked( *confNode ); |
|
4962 |
|
4963 // If the plugin configuration hasn't been locked or |
|
4964 // if there are several locked plugin nodes then remove all the rest |
|
4965 if( !isLocked || foundLocked ) |
|
4966 { |
|
4967 // Mark for removal |
|
4968 nodeArray.Append( pluginNode ); |
|
4969 } |
|
4970 else |
|
4971 { |
|
4972 // If this is the 1st locked node |
|
4973 if( !foundLocked ) |
|
4974 { |
|
4975 foundLocked = ETrue; |
|
4976 } |
|
4977 } |
|
4978 } |
|
4979 } |
|
4980 } |
|
4981 |
|
4982 // If all the nodes were marked for removal |
|
4983 if( nodeArray.Count() > 0 && nodeArray.Count() == pluginCount ) |
|
4984 { |
|
4985 // Unmark the 1st node - remove from the array only |
|
4986 nodeArray.Remove( 0 ); |
|
4987 } |
|
4988 |
|
4989 // Remove rest |
|
4990 TInt err = KErrNone; |
|
4991 for( TInt nodeIndex=0; nodeIndex < nodeArray.Count(); nodeIndex++ ) |
|
4992 { |
|
4993 // Remove the plugin node, related resources and maintain activity information |
|
4994 err = RemoveConfigurationL( |
|
4995 aAppODT, |
|
4996 *nodeArray[nodeIndex] ); |
|
4997 if( err ) |
|
4998 { |
|
4999 #ifdef HSPS_LOG_ACTIVE |
|
5000 if( iLogBus ) |
|
5001 { |
|
5002 iLogBus->LogText( _L( "ChspsMaintenanceHandler::RemoveUnlockedViewsL(): - Restoring failed with %d code" ), err ); |
|
5003 } |
|
5004 #endif |
|
5005 } |
|
5006 |
|
5007 } |
|
5008 |
|
5009 nodeArray.Reset(); |
|
5010 CleanupStack::PopAndDestroy( 1, &nodeArray ); |
|
5011 } |
|
5012 } |
|
5013 |
4606 // end of file |
5014 // end of file |