omads/omadsappui/AspSyncUtil/src/AspUtil.cpp
branchRCL_3
changeset 10 b922b9936679
parent 8 ad0f53516d84
child 14 2bbcc0756c6d
equal deleted inserted replaced
8:ad0f53516d84 10:b922b9936679
    31 #include <ApUtils.h>   // CApUtils
    31 #include <ApUtils.h>   // CApUtils
    32 #include <avkon.rsg>
    32 #include <avkon.rsg>
    33 #include <hlplch.h>    // HlpLauncher
    33 #include <hlplch.h>    // HlpLauncher
    34 
    34 
    35 #include <MuiuMsvUiServiceUtilities.h> // for MsvUiServiceUtilities
    35 #include <MuiuMsvUiServiceUtilities.h> // for MsvUiServiceUtilities
       
    36 #include <NsmlOperatorDataCRKeys.h> // KCRUidOperatorDatasyncInternalKeys
    36 
    37 
    37 
    38 
    38 #include "AspUtil.h"
    39 #include "AspUtil.h"
    39 #include "AspDialogUtil.h"
    40 #include "AspDialogUtil.h"
    40 #include "AspResHandler.h"
    41 #include "AspResHandler.h"
   343 		}
   344 		}
   344 
   345 
   345 	return id;
   346 	return id;
   346 	}
   347 	}
   347 
   348 
   348 
   349 // -----------------------------------------------------------------------------
       
   350 // TUtil::ProviderIdFromAppId
       
   351 //
       
   352 // -----------------------------------------------------------------------------
       
   353 //
       
   354 TInt TUtil::ProviderIdFromAppId(TInt aApplicationId, TBool aOperatorProfile)
       
   355     {
       
   356     TInt id=KErrNotFound;
       
   357 
       
   358     if (aOperatorProfile)
       
   359         {
       
   360         id = OperatorProviderIdFromAppId( aApplicationId );
       
   361         }
       
   362     else
       
   363         {
       
   364         id = ProviderIdFromAppId( aApplicationId );
       
   365         }
       
   366     return id;
       
   367     }
       
   368 
       
   369 // -----------------------------------------------------------------------------
       
   370 // TUtil::OperatorProviderIdFromAppId
       
   371 //
       
   372 // -----------------------------------------------------------------------------
       
   373 //
       
   374 TInt TUtil::OperatorProviderIdFromAppId(TInt aApplicationId)
       
   375     {
       
   376     TInt id = KErrNotFound;
       
   377     CRepository* repository = NULL;
       
   378     
       
   379     TInt err = KErrNotFound;
       
   380     TRAP(err, repository = CRepository::NewL(KCRUidOperatorDatasyncInternalKeys));
       
   381     if (err == KErrNone)
       
   382         {
       
   383         switch (aApplicationId)
       
   384             {
       
   385              // Operator specific version of Contacts adapter is supported
       
   386             case EApplicationIdContact:
       
   387                 {
       
   388                 err = repository->Get(KNsmlOpDsOperatorAdapterUid, id);
       
   389                 break;
       
   390                 }
       
   391             default:
       
   392                 {
       
   393                 id = ProviderIdFromAppId(aApplicationId);
       
   394                 break;
       
   395                 }
       
   396             }
       
   397          delete repository;
       
   398         }
       
   399 
       
   400     if ( (id == KErrNotFound) || (err != KErrNone) )
       
   401         {
       
   402         // Use default adapter
       
   403         id = ProviderIdFromAppId(aApplicationId);        
       
   404         }
       
   405     return id;
       
   406     }
       
   407         
   349 // -----------------------------------------------------------------------------
   408 // -----------------------------------------------------------------------------
   350 // TUtil::AppIdFromProviderId
   409 // TUtil::AppIdFromProviderId
   351 //
   410 //
   352 // -----------------------------------------------------------------------------
   411 // -----------------------------------------------------------------------------
   353 //
   412 //
   369 		}
   428 		}
   370 	if (aAdapterId == KUidNSmlAdapterNote.iUid)
   429 	if (aAdapterId == KUidNSmlAdapterNote.iUid)
   371 		{
   430 		{
   372 		id = EApplicationIdNote;
   431 		id = EApplicationIdNote;
   373 		}
   432 		}
   374 
   433 	if (id == KErrNotFound) // Check if this operator specific adapter
       
   434 	    {
       
   435 	    id = AppIdFromOperatorSpecificProviderId( aAdapterId );
       
   436 	    }
   375 	return id;
   437 	return id;
   376 	}
   438 	}
       
   439 
       
   440 // -----------------------------------------------------------------------------
       
   441 // TUtil::AppIdFromOperatorSpecificProviderId
       
   442 //
       
   443 // -----------------------------------------------------------------------------
       
   444 //
       
   445 TInt TUtil::AppIdFromOperatorSpecificProviderId(TInt aAdapterId)
       
   446     {
       
   447     TInt id=KErrNotFound;
       
   448     CRepository* repository = NULL;
       
   449     
       
   450     TRAPD(err, repository = CRepository::NewL(KCRUidOperatorDatasyncInternalKeys));
       
   451     if (err == KErrNone)
       
   452         {
       
   453         TInt operatorContactsProvider = KErrNotFound;
       
   454         err = repository->Get(KNsmlOpDsOperatorAdapterUid, operatorContactsProvider);
       
   455         
       
   456         if ( err == KErrNone && aAdapterId == operatorContactsProvider )
       
   457             {
       
   458             id = EApplicationIdContact;
       
   459             }
       
   460         delete repository;
       
   461         }
       
   462     return id;
       
   463     }
   377 
   464 
   378 
   465 
   379 // -----------------------------------------------------------------------------
   466 // -----------------------------------------------------------------------------
   380 // TUtil::IsToDay
   467 // TUtil::IsToDay
   381 //
   468 //