contentstorage/casrv/cawidgetscanner/src/cawidgetscannerplugin.cpp
changeset 103 b99b84bcd2d1
parent 66 32469d7d46ff
child 109 e0aa398e6810
equal deleted inserted replaced
83:156f692b1687 103:b99b84bcd2d1
     1 /*
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2008 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 "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 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15  *
     8  *
    16 */
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  *
       
    16  */
    17 
    17 
    18 // INCLUDE FILES
    18 // INCLUDE FILES
    19 
    19 
    20 #include <ecom/implementationproxy.h>
    20 #include <ecom/implementationproxy.h>
    21 #include <sacls.h>
    21 #include <sacls.h>
    22 
    22 
    23 #include "cawidgetscannerplugin.h"
    23 #include "cawidgetscannerplugin.h"
    24 #include "cawidgetscannerparser.h"
       
    25 #include "cawidgetstoragehandler.h"
    24 #include "cawidgetstoragehandler.h"
    26 #include "cawidgetscannerinstallnotifier.h"
    25 #include "cawidgetscannerinstallnotifier.h"
    27 
       
    28 
    26 
    29 // Function used to return an instance of the proxy table.
    27 // Function used to return an instance of the proxy table.
    30 const TImplementationProxy ImplementationTable[] =
    28 const TImplementationProxy ImplementationTable[] =
    31     {
    29     {
    32     IMPLEMENTATION_PROXY_ENTRY(0x20028707, CCaWidgetScannerPlugin::NewL)
    30     IMPLEMENTATION_PROXY_ENTRY(0x20028707, CCaWidgetScannerPlugin::NewL)
    33     };
    31     };
    34 
    32 
       
    33 #ifdef COVERAGE_MEASUREMENT
       
    34 #pragma CTC SKIP
       
    35 #endif //COVERAGE_MEASUREMENT (proxy for instantiation)
    35 // ----------------------------------------------------------------------------
    36 // ----------------------------------------------------------------------------
    36 // ImplementationGroupProxy
    37 // 
    37 // Exported proxy for instantiation method resolution
       
    38 // ----------------------------------------------------------------------------
    38 // ----------------------------------------------------------------------------
    39 //
    39 //
    40 EXPORT_C const TImplementationProxy*
    40 EXPORT_C const TImplementationProxy*
    41 ImplementationGroupProxy( TInt& aTableCount )
    41 ImplementationGroupProxy( TInt& aTableCount )
    42     {
    42     {
    43     aTableCount = sizeof( ImplementationTable ) /
    43     aTableCount = sizeof( ImplementationTable ) / sizeof(TImplementationProxy);
    44     sizeof( TImplementationProxy );
       
    45     return ImplementationTable;
    44     return ImplementationTable;
    46     }
    45     }
       
    46 #ifdef COVERAGE_MEASUREMENT
       
    47 #pragma CTC ENDSKIP
       
    48 #endif //COVERAGE_MEASUREMENT
    47 
    49 
    48 // ============================ MEMBER FUNCTIONS ===============================
    50 // ============================ MEMBER FUNCTIONS ===============================
    49 
    51 
    50 // -----------------------------------------------------------------------------
    52 // ----------------------------------------------------------------------------
    51 // CCaWidgetScannerPlugin ::CCaWidgetScannerPlugin
    53 // 
    52 // C++ default constructor can NOT contain any code, that
    54 // ----------------------------------------------------------------------------
    53 // might leave.
       
    54 // -----------------------------------------------------------------------------
       
    55 //
    55 //
    56 CCaWidgetScannerPlugin::CCaWidgetScannerPlugin()
    56 CCaWidgetScannerPlugin::CCaWidgetScannerPlugin()
    57     {
    57     {
    58     }
    58     }
    59 
    59 
    60 // -----------------------------------------------------------------------------
    60 // ----------------------------------------------------------------------------
    61 // CCaWidgetScannerPlugin ::ConstructL
    61 // 
    62 // Symbian 2nd phase constructor can leave.
    62 // ----------------------------------------------------------------------------
    63 // -----------------------------------------------------------------------------
       
    64 //
    63 //
    65 void CCaWidgetScannerPlugin::ConstructL( TPluginParams* aPluginParams )
    64 void CCaWidgetScannerPlugin::ConstructL( TPluginParams* aPluginParams )
    66     {
    65     {
    67     User::LeaveIfError( iFs.Connect() );
    66     User::LeaveIfError( iFs.Connect() );
    68     iMmcWatcher = CCaMmcWatcher::NewL( iFs, this );
    67     iMmcWatcher = CCaMmcWatcher::NewL( iFs, this );
    69     iInstallNotifier = CCaWidgetScannerInstallNotifier::NewL( this,
    68     iInstallNotifier = CCaWidgetScannerInstallNotifier::NewL( this,
    70         KUidSystemCategory, KSAUidSoftwareInstallKeyValue );
    69             KUidSystemCategory, KSAUidSoftwareInstallKeyValue );
    71     iParser = CCaWidgetScannerParser::NewL( iFs );
       
    72     iStorageHandler = CCaWidgetStorageHandler::NewL(
    70     iStorageHandler = CCaWidgetStorageHandler::NewL(
    73             aPluginParams->storageProxy, iFs );
    71             aPluginParams->storageProxy, iFs );
    74     SynchronizeL();
    72     SynchronizeL();
    75     }
    73     }
    76 
    74 
    77 // -----------------------------------------------------------------------------
    75 // ----------------------------------------------------------------------------
    78 // CCaWidgetScannerPlugin ::NewL
    76 // 
    79 // Two-phased constructor.
    77 // ----------------------------------------------------------------------------
    80 // -----------------------------------------------------------------------------
       
    81 //
    78 //
    82 CCaWidgetScannerPlugin * CCaWidgetScannerPlugin::NewL(
    79 CCaWidgetScannerPlugin * CCaWidgetScannerPlugin::NewL(
    83         TPluginParams* aPluginParams )
    80         TPluginParams* aPluginParams )
    84     {
    81     {
    85     CCaWidgetScannerPlugin * self = NewLC( aPluginParams );
    82     CCaWidgetScannerPlugin * self = NewLC( aPluginParams );
    86     CleanupStack::Pop( self );
    83     CleanupStack::Pop( self );
    87     return self;
    84     return self;
    88     }
    85     }
    89 
    86 
    90 // -----------------------------------------------------------------------------
    87 // ----------------------------------------------------------------------------
    91 // CCaWidgetScannerPlugin ::NewLC
    88 // 
    92 // Two-phased constructor.
    89 // ----------------------------------------------------------------------------
    93 // -----------------------------------------------------------------------------
       
    94 //
    90 //
    95 CCaWidgetScannerPlugin * CCaWidgetScannerPlugin::NewLC(
    91 CCaWidgetScannerPlugin * CCaWidgetScannerPlugin::NewLC(
    96         TPluginParams* aPluginParams )
    92         TPluginParams* aPluginParams )
    97     {
    93     {
    98     CCaWidgetScannerPlugin * self = new( ELeave ) CCaWidgetScannerPlugin ( );
    94     CCaWidgetScannerPlugin * self = new ( ELeave ) CCaWidgetScannerPlugin();
    99     CleanupStack::PushL( self );
    95     CleanupStack::PushL( self );
   100     self->ConstructL( aPluginParams );
    96     self->ConstructL( aPluginParams );
   101     return self;
    97     return self;
   102     }
    98     }
   103 
    99 
   104 // -----------------------------------------------------------------------------
   100 // ----------------------------------------------------------------------------
   105 // Destructor
   101 // 
   106 // -----------------------------------------------------------------------------
   102 // ----------------------------------------------------------------------------
   107 //
   103 //
   108 CCaWidgetScannerPlugin::~CCaWidgetScannerPlugin ()
   104 CCaWidgetScannerPlugin::~CCaWidgetScannerPlugin()
   109     {
   105     {
   110     delete iMmcWatcher;
   106     delete iMmcWatcher;
   111     delete iInstallNotifier;
   107     delete iInstallNotifier;
   112     delete iParser;
       
   113     delete iStorageHandler;
   108     delete iStorageHandler;
   114     iFs.Close();
   109     iFs.Close();
   115     }
   110     }
   116 
   111 
   117 // ----------------------------------------------------------------------------
   112 // ----------------------------------------------------------------------------
   118 //
   113 //
   119 // ----------------------------------------------------------------------------
   114 // ----------------------------------------------------------------------------
   120 //
   115 //
   121 void CCaWidgetScannerPlugin::SynchronizeL()
   116 void CCaWidgetScannerPlugin::SynchronizeL()
   122     {
   117     {
   123     iStorageHandler->SynchronizeL( iParser->WidgetsScanL() );
   118     iStorageHandler->SynchronizeL();
   124     }
   119     }
   125 
   120 
   126 // ----------------------------------------------------------------------------
   121 // ----------------------------------------------------------------------------
   127 //
   122 //
   128 // ----------------------------------------------------------------------------
   123 // ----------------------------------------------------------------------------