webengine/widgetinstaller/Src/WidgetInstaller.cpp
branchRCL_3
changeset 93 79859ed3eea9
parent 92 e1bea15f9a39
child 94 919f36ff910f
equal deleted inserted replaced
92:e1bea15f9a39 93:79859ed3eea9
    26 #include <libxml2_globals.h>
    26 #include <libxml2_globals.h>
    27 #include <libc/stdlib.h>
    27 #include <libc/stdlib.h>
    28 #include <libxml2_parser.h>
    28 #include <libxml2_parser.h>
    29 #include <libxml2_tree.h>
    29 #include <libxml2_tree.h>
    30 
    30 
    31 #include "browser_platform_variant.hrh"
    31 #include "Browser_platform_variant.hrh"
    32 
    32 
    33 #ifdef BRDO_SYMBIAN_LIBXML_FF
    33 #ifdef BRDO_SYMBIAN_LIBXML_FF
    34 #include <xmlengxestd.h>
    34 #include <xmlengxestd.h>
    35 #endif
    35 #endif
    36 
    36 
    62 // TODO MW has a hard dependency to APP domain. Not very good...
    62 // TODO MW has a hard dependency to APP domain. Not very good...
    63 // TODO Hard-coded UID.
    63 // TODO Hard-coded UID.
    64 _LIT( KWidgetAppDir, "\\private\\10282822\\" );
    64 _LIT( KWidgetAppDir, "\\private\\10282822\\" );
    65 _LIT( KBackSlash, "\\" );
    65 _LIT( KBackSlash, "\\" );
    66 // todo: other keystring.dat for preference
    66 // todo: other keystring.dat for preference
    67 _LIT(KWidgetPref, "prefs.dat*");
    67 _LIT(KWidgetPref, "prefs.dat");
    68 
    68 
    69 
    69 
    70 // =========================== MEMBER FUNCTIONS ===============================
    70 // =========================== MEMBER FUNCTIONS ===============================
    71 
    71 
    72 
    72 
   124     for ( TInt i( 0 ); i < EWidgetPropertyIdCount; ++i )
   124     for ( TInt i( 0 ); i < EWidgetPropertyIdCount; ++i )
   125         {
   125         {
   126         CWidgetPropertyValue* value = CWidgetPropertyValue::NewL();
   126         CWidgetPropertyValue* value = CWidgetPropertyValue::NewL();
   127         User::LeaveIfError( iPropertyValues.Insert( value, i ) );
   127         User::LeaveIfError( iPropertyValues.Insert( value, i ) );
   128         }
   128         }
   129     *(iPropertyValues[EWidgetPropertyListVersion]) = KWidgetPropertyListVersion71;
   129     *(iPropertyValues[EWidgetPropertyListVersion]) = WIDGETPROPERTYLISTVERSION;
   130 
   130 
   131 #ifdef _DEBUG
   131 #ifdef _DEBUG
   132     _LIT(KDir, "WidgetBUR");
   132     _LIT(KDir, "WidgetBUR");
   133     _LIT(KFile, "WidgetBURInstaller.log");
   133     _LIT(KFile, "WidgetBURInstaller.log");
   134     TInt err( 0 );
   134     TInt err( 0 );
   470                         *(backupPropertyValues[propId]) = 1;
   470                         *(backupPropertyValues[propId]) = 1;
   471                         }        
   471                         }        
   472                     break;
   472                     break;
   473                     
   473                     
   474                     case EWidgetPropTypeInt:
   474                     case EWidgetPropTypeInt:
   475                         {
   475                     TLex toInt( value->Des() );
   476                         TLex toInt( value->Des() );
   476                     TInt k;
   477                         TInt k;
   477                     if ( KErrNone != toInt.Val( k ) )
   478                         if ( KErrNone != toInt.Val( k ) )
   478                        {
   479                             {
   479                        User::Leave( KErrCorrupt );
   480                             User::Leave( KErrCorrupt );
   480                        }
   481                             }
   481                     if ( propId ==  EBlanketPermGranted )
   482                         if ( propId ==  EBlanketPermGranted )
   482                         backupBlanketPerm = k;        
   483                             backupBlanketPerm = k;
       
   484                         }
       
   485                     break;                    
   483                     break;                    
   486 					          
   484 					          
   487 					          case EWidgetPropTypeString:
   485 					          case EWidgetPropTypeString:
   488                     *(backupPropertyValues[propId]) = *value; 
   486                     *(backupPropertyValues[propId]) = *value; 
   489                     break;
   487                     break;
   776             }
   774             }
   777         }
   775         }
   778 
   776 
   779     //////////////////////////////////////////////////////////////////////////////////////////////////
   777     //////////////////////////////////////////////////////////////////////////////////////////////////
   780     // delete "\private\[WidgetUIUid]\bundleID\prefs.dat"
   778     // delete "\private\[WidgetUIUid]\bundleID\prefs.dat"
   781     CFileMan* fileManager = CFileMan::NewL( iRfs );
       
   782     CleanupStack::PushL( fileManager );
       
   783     	 
       
   784     TFileName   widgetPref( *newDir );
   779     TFileName   widgetPref( *newDir );
   785     widgetPref.Append(KWidgetPref);
   780     widgetPref.Append(KWidgetPref);
   786     
   781     err = iRfs.Delete( widgetPref );
   787 	err = fileManager->Delete(widgetPref);
       
   788     CleanupStack::PopAndDestroy( fileManager );  // fileMananger       	
       
   789     // it's ok not to have pref.dat
   782     // it's ok not to have pref.dat
   790     if( err != KErrNone && err != KErrNotFound )
   783     if( err != KErrNone && err != KErrNotFound )
   791         {
   784         {
   792         User::Leave( err );
   785         User::Leave( err );
   793         }
   786         }
   872 EXPORT_C void CWidgetInstaller::DeregisterWidgetL( const TUid& aUid )
   865 EXPORT_C void CWidgetInstaller::DeregisterWidgetL( const TUid& aUid )
   873     {
   866     {
   874     iAppManager->DeregisterWidgetL( aUid );
   867     iAppManager->DeregisterWidgetL( aUid );
   875     }
   868     }
   876 
   869 
   877 EXPORT_C void CWidgetInstaller::DeregisterWidgetsL( const RArray<TUid>& aUidList)
       
   878 	{
       
   879 	iAppManager->DeregisterWidgetsL( aUidList );
       
   880 	}
       
   881 	
       
   882 // ============================================================================
   870 // ============================================================================
   883 // CWidgetInstaller::RunError()
   871 // CWidgetInstaller::RunError()
   884 // It is called by WidgetActiveCallback when InstallL leaves.
   872 // It is called by WidgetActiveCallback when InstallL leaves.
   885 //
   873 //
   886 // @since 3.2
   874 // @since 3.2
  1180     for ( ; i < EWidgetPropertyIdCount; ++i )
  1168     for ( ; i < EWidgetPropertyIdCount; ++i )
  1181         {
  1169         {
  1182         CWidgetPropertyValue* value = CWidgetPropertyValue::NewL();
  1170         CWidgetPropertyValue* value = CWidgetPropertyValue::NewL();
  1183         User::LeaveIfError( propertyValues->Insert( value, i ) );
  1171         User::LeaveIfError( propertyValues->Insert( value, i ) );
  1184         }
  1172         }
  1185     *(*propertyValues)[EWidgetPropertyListVersion] =  KWidgetPropertyListVersion71;
  1173     *(*propertyValues)[EWidgetPropertyListVersion] = WIDGETPROPERTYLISTVERSION;
  1186     // UID
  1174     // UID
  1187     *(*propertyValues)[EUid] = aUid.iUid;
  1175     *(*propertyValues)[EUid] = aUid.iUid;
  1188     // size
  1176     // size
  1189     TInt64 bundleRootSize = GetDirSizeL( aWidgetPath );
  1177     TInt64 bundleRootSize = GetDirSizeL( aWidgetPath );
  1190     if ( 0 == bundleRootSize )
  1178     if ( 0 == bundleRootSize )