widgets/widgetsidchecker/src/widgetsidchecker.cpp
changeset 65 5bfc169077b2
parent 42 d39add9822e2
child 66 cacf6ee57968
equal deleted inserted replaced
42:d39add9822e2 65:5bfc169077b2
     1 /*
       
     2 * Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     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 *
       
    16 */
       
    17 #include "widgetsidchecker.h"
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <e32const.h>
       
    21 #include <ecom/implementationproxy.h>
       
    22 #include <f32file.h>
       
    23 #include <w32std.h>
       
    24 #include <apgtask.h>
       
    25 //#include <eikenv.h>
       
    26 #include <s32file.h>
       
    27 
       
    28 //WidgetRegistry.EXE[10282f06]0001
       
    29 //const TUid KWidgetRegistry = { 0x10282F06 };
       
    30 //0x10282F06
       
    31 //hb
       
    32 //#include <WidgetRegistryClient.h>
       
    33 //////////////////////////////
       
    34 // ECOM Implementation Table
       
    35 //////////////////////////////
       
    36 
       
    37 
       
    38 TBool E32Dll()
       
    39 	{
       
    40 	return (ETrue);
       
    41 	}
       
    42 
       
    43 const TImplementationProxy ImplementationTable[] =
       
    44 	{
       
    45 		IMPLEMENTATION_PROXY_ENTRY(0x10281FC0, CWidgetSidChecker::NewL)
       
    46 	};
       
    47 
       
    48 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
    49 	{
       
    50 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
    51 	return ImplementationTable;
       
    52 	}
       
    53 
       
    54 //////////////////////////////
       
    55 // CWidgetSidChecker
       
    56 //////////////////////////////
       
    57 
       
    58 CWidgetSidChecker* CWidgetSidChecker::NewL()
       
    59 	{
       
    60 	CWidgetSidChecker* self = new(ELeave) CWidgetSidChecker();
       
    61 	return self;
       
    62 	}
       
    63 
       
    64     CWidgetSidChecker::CWidgetSidChecker()
       
    65     {
       
    66 	}
       
    67 	
       
    68 
       
    69 CWidgetSidChecker::~CWidgetSidChecker()
       
    70 	{
       
    71 	iClientSession.Close();
       
    72 	}
       
    73 
       
    74 TBool CWidgetSidChecker::AppRegisteredAt(const TUid& aSid, TDriveUnit /*aDrive*/)
       
    75     {
       
    76       TFindProcess findProcess (_L("widgetregistry*"));
       
    77       TFullName result;       
       
    78       if(findProcess.Next(result) == KErrNone )
       
    79         {
       
    80         TBool res = AppRegisteredAtL(aSid);
       
    81         return res;
       
    82         }
       
    83       return EFalse;      
       
    84     }
       
    85 	
       
    86 
       
    87 TBool CWidgetSidChecker::AppRegisteredAtL( TUid aSid )
       
    88     {
       
    89     TBuf<KMaxFileName> aWidgetBundleId;
       
    90     TBool res = EFalse;
       
    91     
       
    92     User::LeaveIfError( iClientSession.Connect() );    
       
    93     iClientSession.GetWidgetBundleId(aSid, aWidgetBundleId);
       
    94     //check if the widget exists by querying to WidgetRegisrty return ETrue if exists else return EFalse
       
    95     if(iClientSession.WidgetExistsL( aWidgetBundleId ) )    
       
    96       res = ETrue;
       
    97     else
       
    98       res = EFalse;
       
    99     
       
   100     iClientSession.Disconnect();
       
   101     return res;
       
   102     }
       
   103 	
       
   104 void CWidgetSidChecker::SetRescanCallBackL(const TCallBack &/*aCallBack*/)
       
   105 	{
       
   106 	return;
       
   107 	}
       
   108 
       
   109 // End of file