webengine/widgetregistry/Server/src/WidgetMMCHandler.cpp
changeset 36 0ed94ceaa377
parent 0 dd21522fd290
child 37 cb62a4f66ebe
equal deleted inserted replaced
32:9a9a761f03f1 36:0ed94ceaa377
     1 /*
     1 /*
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8 *
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    74     LOG_CONSTRUCTL;
    74     LOG_CONSTRUCTL;
    75     if ( KErrNone != ScanDrives( iDriveFlags ) )
    75     if ( KErrNone != ScanDrives( iDriveFlags ) )
    76         {
    76         {
    77         iDriveFlags = 0;
    77         iDriveFlags = 0;
    78         }
    78         }
       
    79     iDeltaDriveFlags = 0;
       
    80     iApaAppListNotifier = CApaAppListNotifier::NewL(this,CActive::EPriorityStandard);
    79     }
    81     }
    80 
    82 
    81 // ============================================================================
    83 // ============================================================================
    82 // CWidgetMMCHandler::~CWidgetMMCHandler()
    84 // CWidgetMMCHandler::~CWidgetMMCHandler()
    83 // destructor
    85 // destructor
   120         if ( KErrNone == ScanDrives( driveFlags ) )
   122         if ( KErrNone == ScanDrives( driveFlags ) )
   121           {
   123           {
   122             LOG1( " iDriveFlags 0x%x", iDriveFlags );
   124             LOG1( " iDriveFlags 0x%x", iDriveFlags );
   123             LOG1( "  driveFlags 0x%x", driveFlags );
   125             LOG1( "  driveFlags 0x%x", driveFlags );
   124             deltaDriveFlags = iDriveFlags ^ driveFlags;
   126             deltaDriveFlags = iDriveFlags ^ driveFlags;
       
   127             iDeltaDriveFlags = deltaDriveFlags;
   125             LOG1( " deltaDriveFlags 0x%x", deltaDriveFlags );
   128             LOG1( " deltaDriveFlags 0x%x", deltaDriveFlags );
   126             iDriveFlags = driveFlags;
   129             iDriveFlags = driveFlags;
   127           }
       
   128         if ( deltaDriveFlags )
       
   129           {
       
   130             LOG( " mmc start internalize" );
       
   131 
       
   132             LOG( " delay for appArch to sync with card" );
       
   133             // delay for appArch to sync with card (if don't wait then
       
   134             // when query AppArch about installed widgets, it doesn't
       
   135             // report any on card)
       
   136             User::After( 8000000 ); // 8 sec in microseconds
       
   137 
       
   138             TBool dirtyFlag = EFalse;
       
   139             TRAPD( error,
       
   140                    iRegistry->InternalizeL( dirtyFlag ) );
       
   141             LOG1( " mmc end internalize, error %d", error );
       
   142             if ( KErrNone == error )
       
   143                 {
       
   144                 LOG( " mmc notification internalize completed" );
       
   145                 // internalize consistency enforcement may have altered
       
   146                 // registry
       
   147                 if ( dirtyFlag )
       
   148                     {
       
   149                     TRAP_IGNORE( iRegistry->ExternalizeL(); );
       
   150                     }
       
   151                 }
       
   152           }
   130           }
   153       }
   131       }
   154     LOG( "MMC notification done" );
   132     LOG( "MMC notification done" );
   155     LOG_CLOSE;
   133     LOG_CLOSE;
   156 
   134 
   230         }
   208         }
   231     LOG1( "ScanDrives done, error %d", error );
   209     LOG1( "ScanDrives done, error %d", error );
   232     LOG_CLOSE;
   210     LOG_CLOSE;
   233     return error;
   211     return error;
   234     }
   212     }
       
   213 
       
   214 void CWidgetMMCHandler::HandleAppListEvent(TInt aEvent)
       
   215     {
       
   216     TBool dirtyFlag = EFalse;
       
   217     TInt parseError = KErrNone;
       
   218     
       
   219     if ( iDeltaDriveFlags )
       
   220         {
       
   221         // Assume usual case and things are consistent
       
   222         // and the registry entry file can be parsed and used.
       
   223         TRAPD( error, iRegistry->InternalizeL( ETrue,
       
   224                                     ETrue,
       
   225                                     dirtyFlag,
       
   226                                     parseError ) );
       
   227         if ( KErrNone == error )
       
   228             {
       
   229             // internalize consistency enforcement may have altered registry
       
   230             if ( dirtyFlag )
       
   231                 {
       
   232                 TRAP_IGNORE( iRegistry->ExternalizeL(); );
       
   233                 }
       
   234             }
       
   235         iDeltaDriveFlags = 0;
       
   236         }
       
   237     }