/**
The 2nd phase constructor. Attaches to the property, completes the async 
request to cause the RunL method to be called for the first time and check
if there has already been an update to the property.

@leave If a error happens, it leaves with one of the system error codes.
*/
void CLbsInternalPosStatusWatcher::ConstructL()
	{
    // Get the CategoryUid from the cenrep file owned by LbsRoot.
    TInt category;
    CRepository* rep = CRepository::NewLC(KLbsCenRepUid);

    // attach to the property
	if (iType == ELbsPositioningStatusMO)
		{
		// Mobile Originated Status P&S Property
        User::LeaveIfError(rep->Get(KMoPositioningStatusAPIKey, category));
        TSecureId propOwnerSecureId(category);
		User::LeaveIfError(iProperty.Attach(propOwnerSecureId, KLbsMoPositioningStatusKey, EOwnerThread));
		}
	else if (iType == ELbsPositioningStatusNI)
		{
		// Network Initiated Status P&S Property
        User::LeaveIfError(rep->Get(KNiPositioningStatusAPIKey, category));
        TSecureId propOwnerSecureId(category);
		User::LeaveIfError(iProperty.Attach(propOwnerSecureId, KLbsNiPositioningStatusKey, EOwnerThread));
		}
	else
		{
		// Any other value indicates a programming error
		User::Leave(KErrArgument);
		}

    CleanupStack::PopAndDestroy(rep);

    CActiveScheduler::Add(this);
    // initial subscription and process current property value
    RunL();
	}
// ---------------------------------------------------------------------------
// T_NATFWTraversalAdapter::GetIAPSettingsL
// Gets one IAP settings entry
// ---------------------------------------------------------------------------
//
void T_NATFWTraversalAdapter::GetIAPSettingsL( TUint32 aIAPKey, 
    CNATFWIAPSpecificItem& aItem )
    {
    // Central Repository for NAT-FW Traversal settings
    CRepository* rep = CRepository::NewLC( KCRUidUNSAFProtocols );
    
    TUint32 key( KErrNone );
    // select domain 
    key = ( KUNSAFProtocolsIAPIdMask^( aIAPKey ) );
    key |= KUNSAFProtocolsIAPTableMask;
    // set key id
    aItem.SetIAPKey( aIAPKey );
    TInt tmp( 0 );
    rep->Get( KUNSAFProtocolsIAPIdMask|key, tmp);
    aItem.SetIAPId( tmp ) ;
    tmp = KErrNotFound;
    rep->Get( KUNSAFProtocolsIntervalUDPMask|key, tmp );
    aItem.SetIntervalUDP( tmp ) ;
    tmp = KErrNotFound;
    rep->Get( KUNSAFProtocolsIntervalTCPMask|key, tmp );
    aItem.SetIntervalTCP( tmp ) ;
    tmp = KErrNotFound;
    rep->Get( KUNSAFProtocolsSTUNRetransmitTimerMask|key, tmp );
    aItem.SetSTUNRetransmitTimer( tmp );
    CleanupStack::PopAndDestroy( rep );
    }
/**
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4059
@SYMTestCaseDesc Test that settings information can be selectively overridden on many ROFS
layers when the keyspace is not represented on the CORE layer
@SYMTestPriority High
@SYMTestActions Open keyspace 0x10286559.  This keyspace is represented by two txt files.
The keyspace file names in the source have been mangled in a similar way to that
which would be expected on the device (eg. abcd1234.txt, abcd1234.txt[01-00], abcd1234.txt[02-00] etc.
@SYMTestExpectedResults Ensure that the final value of the setting is as specified in the final ROFS
layer.  Ie that there is no panic with EMultiRofsPanicGlobalOverride.
@SYMREQ REQ11401
*/
LOCAL_C void NoCoreKeyspaceL()
{
    TheTest.Next(_L( " @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4059 " ));

    CRepository* rep;
    User::LeaveIfNull(rep = CRepository::NewLC(KUidKeyspace10));

    TInt settingValueInt = 0;
    TReal settingValueReal = 0.0;
    TBuf<20> settingValueStr;
    TInt valsequal = 0;

    //
    rep->Get(KKeyOne, settingValueInt);
    TEST2(settingValueInt, KKeyspace10Setting1Value);

    //
    rep->Get(KKeyTwo, settingValueReal);
    valsequal = settingValueReal - KKeyspace10Setting2Value;
    TEST2(valsequal, 0);

    //
    rep->Get(KKeyThree, settingValueStr);
    valsequal = settingValueStr.Compare(KKeyspace10Setting3Value);
    TEST2(valsequal, 0);

    CleanupStack::PopAndDestroy(rep);
}
Esempio n. 4
0
// ---------------------------------------------------------------------------
// CSsmPolicyBase::ResetLimitReachedL
// ---------------------------------------------------------------------------
//
TBool CSsmPolicyBase::ResetLimitReachedL()
    {
    FUNC_LOG;

    CRepository* repository = CRepository::NewL( iUtil->CrUid( KCRUidSsmStartupPolicy ) );
    CleanupStack::PushL( repository );

    TInt count;
    User::LeaveIfError( repository->Get( KSsmStartupErrorResetCounter, count ) );

    INFO_1( "Reset count is %d", count );

    TInt limit;
    User::LeaveIfError( repository->Get( KSsmStartupErrorResetLimit, limit ) );

    INFO_1( "Reset limit is %d", limit );

    const TBool retVal = ( count >= limit );

    if ( count < limit )
        {
        count++;
        User::LeaveIfError( repository->Set( KSsmStartupErrorResetCounter, count ) );
        }

    CleanupStack::PopAndDestroy( repository );
    return retVal;
    }
/*
Helper function to get the startup boot count and maximum boot attempts limit 
from the central repository
*/
void CGsaStatePolicyStartup::GetStartupCountAndMaxbootLimitL(TInt &aBootcount, TInt &aResetLimit)
	{
	CRepository* repository = CRepository::NewLC( KCRUidSsmStartupPolicy );
	User::LeaveIfError( repository->Get( KSsmStartupErrorResetLimit, aResetLimit ) );
	DEBUGPRINT2( _L("Reset limit is %d"), aResetLimit );
	User::LeaveIfError( repository->Get( KSsmStartupErrorResetCounter, aBootcount ) );
	DEBUGPRINT2( _L("Reset count is %d"), aBootcount );
	CleanupStack::Pop(repository);
	}
// ---------------------------------------------------------
// TXdmSettingsApi::CollectionNamesL
//
// ---------------------------------------------------------
//
EXPORT_C CDesCArray* TXdmSettingsApi::CollectionNamesLC( RArray<TInt>& aSettingIds )
{
#ifdef _DEBUG
    WriteToLog( _L8( "TXdmSettingsApi::CollectionNamesL()" ) );
#endif
    TInt error = KErrNone;
    CDesCArrayFlat* propertySet = new ( ELeave ) CDesCArrayFlat( 10 );
    CleanupStack::PushL( propertySet );
    CRepository* repository = CRepository::NewL( KCRUidXdmEngine );
    CleanupStack::PushL( repository );
    RArray<TUint32> nameKeys = FindByTypeL( repository, EXdmPropName );
    CleanupClosePushL( nameKeys );
    RArray<TUint32> idKeys = FindByTypeL( repository, EXdmPropSettingsId );
    CleanupClosePushL( idKeys );
#ifdef _DEBUG
    WriteToLog( _L8( "  ID key count: %d" ), idKeys.Count() );
    WriteToLog( _L8( "  Name key count: %d" ), nameKeys.Count() );
#endif
    TInt count = nameKeys.Count();
    if( count > 0 )
    {
        TInt numId = 0;
        HBufC* name = NULL;
        TBuf<10> identifier;
        for( TInt i = 0; i < count; i++ )
        {
            identifier.Zero();
            name = HBufC::NewLC( NCentralRepositoryConstants::KMaxUnicodeStringLength );
            TPtr desc( name->Des());
            error = repository->Get( nameKeys[i], desc );
            error = repository->Get( idKeys[i], identifier );
            if( error == KErrNone && desc.Length() > 0 && identifier.Length() > 0 )
            {
#ifdef _DEBUG
                HBufC8* eightName = HBufC8::NewLC( desc.Length() );
                TPtr8 eightDesc( eightName->Des() );
                eightDesc.Copy( desc );
                WriteToLog( _L8( " Collection no. %d - Name: %S  ID: %S" ), i, &eightDesc, &identifier );
                CleanupStack::PopAndDestroy();  //eightName
#endif
                propertySet->AppendL( desc );
                TLex id( identifier );
                error = id.Val( numId );
                aSettingIds.Append( error == KErrNone ? numId : error );
            }
            else
            {
#ifdef _DEBUG
                WriteToLog( _L8( " Fetching of the name no. %d failed with: %d" ), i, error );
#endif
            }
            CleanupStack::PopAndDestroy();  //name
        }
    }
    CleanupStack::PopAndDestroy( 3 );   //idKeys, nameKeys, repository
    return propertySet;
}
void CIAUpdateUiConfigData::ConstructL()
    {
    IAUPDATE_TRACE("[IAUPDATE]  CIAUpdateUiConfigData::ConstructL begin");
    CRepository* cenrep = CRepository::NewL( KCRUidIAUpdateSettings ); 
    CleanupStack::PushL( cenrep );
    User::LeaveIfError( cenrep->Get( KIAUpdateGridRefreshDeltaHours , iGridRefreshDeltaHours ) );
    User::LeaveIfError( cenrep->Get( KIAUpdateQueryHistoryDelayHours, iQueryHistoryDelayHours ) );
    IAUPDATE_TRACE("[IAUPDATE]  CIAUpdateUiConfigData::ConstructL 3");
    CleanupStack::PopAndDestroy( cenrep );
    }
Esempio n. 8
0
/**
@SYMTestCaseID 	 SYSLIB-CENTRALREPOSITORY-CT-3343
@SYMTestCaseDesc Restore factory Settings from Install file.
@SYMTestPriority High
@SYMTestActions  Ensure that the repository file only exists in the Install directory.
				 Open the repository and modify a setting.  Force RFS
				 and check that the repository is restored against the Install file
@SYMTestExpectedResults The test repository should be reset against the Install file
@SYMDEF 		 PDEF099108
*/
LOCAL_C void RFSInstallOnlyL()
	{

	TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-3343 ResetAllRepositoriesTestL "));
	TInt r;
	TReal realVal;
	TBuf<20> strVal;

	//restore all test files - this ensures we have a repository file
	//only on the c:
	RestoreRFSTestFilesL(EInstallOnly);

	TheTest.Next(_L("Open repository to ensure server is running"));
	CRepository* repository = CRepository::NewLC(KUidRfsRepositoryInstallOnlyDefaultFile);

	TheTest.Next(_L("Modify a Setting"));
	r = repository->Set(KReal1, KReal1_UpdatedValue);
	TEST2(r, KErrNone);

	//verify the update
	r = repository->Get(KReal1, realVal);
	TEST2(r, KErrNone);
	TEST(realVal == KReal1_UpdatedValue);

	// Close repository
	CleanupStack::PopAndDestroy(repository);

	//Kill the server
	TheTest.Next(_L("Kill the server process"));
	_LIT( KCentralRepositoryServerName, "Centralrepositorysrv");
	r = KillProcess(KCentralRepositoryServerName);
	TEST2(r,KErrNone);

	User::After(KGeneralDelay);

	//Restart the server in soft reset mode to force a
	//repository reset
	TheTest.Next(_L("Manually start central respository"));
	ReStartServerInSoftResetMode();

	//Open the repository
	repository = CRepository::NewLC(KUidRfsRepositoryInstallOnlyDefaultFile);

	//verify that the Real value has been reset against the value in the install
	//repository file
	TheTest.Next(_L("Get 'Modified' value"));
	r = repository->Get(KReal1, realVal);
	TEST2(r, KErrNone);
	TEST(realVal == KReal1_InstallValue);

	// Close repository
	CleanupStack::PopAndDestroy(repository);

	TheTest.End();
	}
void CLogServDatabaseMarshall::ReadRepositoryFileConfigurationL(TLogConfig& aConfig, CRepository& repository) const
	{
	TInt maxLogSize;
	TInt maxRecentLogSize;
	TInt maxEventAge;
	//	
	User::LeaveIfError(repository.Get(KMaxLogSizeRepKey, maxLogSize));
	aConfig.iMaxLogSize = static_cast<TLogSize> (maxLogSize);
	User::LeaveIfError(repository.Get(KMaxRecentLogSizeRepKey, maxRecentLogSize));
	aConfig.iMaxRecentLogSize = static_cast<TLogRecentSize> (maxRecentLogSize);
	User::LeaveIfError(repository.Get(KMaxEventAgeRepKey, maxEventAge));
	aConfig.iMaxEventAge = static_cast<TLogAge> (maxEventAge);	
	}
// -----------------------------------------------------------------------------
// CProfileExtraTonesImpl::InternalizeL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CProfileExtraTonesImpl::InternalizeL( CRepository& aCenRep,
        TInt aProfileId )
{
    delete iIMMessageAlertTone;
    iIMMessageAlertTone = NULL;

    TFileName toneFile;

    // IM Message alert tone
    User::LeaveIfError(
        aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngImTone,
                     aProfileId ), toneFile ) );
    iIMMessageAlertTone = toneFile.AllocL();

    delete iEmailAlertTone;
    iEmailAlertTone = NULL;

    // E-mail alert tone
    User::LeaveIfError(
        aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngEmailTone,
                     aProfileId ), toneFile ) );
    iEmailAlertTone = toneFile.AllocL();

    delete iVideoCallRingingTone;
    iVideoCallRingingTone = NULL;

    // Video call ringing tone
    User::LeaveIfError(
        aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngVideoCallTone,
                     aProfileId ), toneFile ) );
    iVideoCallRingingTone = toneFile.AllocL();

    delete iReminderTone;
    iReminderTone = NULL;

    // Reminder tone
    User::LeaveIfError(
        aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngReminderTone,
                     aProfileId ), toneFile ) );
    iReminderTone = toneFile.AllocL();

    delete iClockAlarmTone;
    iClockAlarmTone = NULL;

    // Clock alarm tone
    User::LeaveIfError(
        aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngClockAlarmTone,
                     aProfileId ), toneFile ) );
    iClockAlarmTone = toneFile.AllocL();
}
Esempio n. 11
0
// ---------------------------------------------------------------------------
// CSsmLangSelCmd::GetIndividualSettingsFromCentRepL
//
// ---------------------------------------------------------------------------
//
void CSsmLangSelCmd::GetIndividualSettingsFromCentRepL( TInt& aRegion, TInt& aCollation )
    {
    FUNC_LOG;
    CRepository* cenrep = CRepository::NewL( KCRUidCommonEngineKeys );
    CleanupStack::PushL( cenrep );
    
    //Get the last selected Region from central repository
    User::LeaveIfError(cenrep->Get( KGSRegion, aRegion));   
        
    //Get the last selected Collation from central repository
    User::LeaveIfError(cenrep->Get( KGSCollation, aCollation));    
    
    INFO_2( "Last selected region %d and collation %d", aRegion, aCollation );
    CleanupStack::PopAndDestroy( cenrep );
    }
void CSecurityPolicy::ConstructL()
{

    // opening Central Repository and reading keys for security policy folder and file
    CRepository* repository = CRepository::NewLC(KCRUidJavaSecurityPolicy);

    HBufC* folderBuf = HBufC::NewLC(NCentralRepositoryConstants::KMaxUnicodeStringLength);
    TPtr secPolicyFolder(folderBuf->Des());

    HBufC* fileBuf = HBufC::NewLC(NCentralRepositoryConstants::KMaxUnicodeStringLength);
    TPtr secPolicyFile(fileBuf->Des());

    // Load the security policy file path and name
    User::LeaveIfError(repository->Get(KPolicyFolder, secPolicyFolder));
    User::LeaveIfError(repository->Get(KPolicyFile, secPolicyFile));

    RFs fs;

    User::LeaveIfError(fs.Connect());
    CleanupClosePushL(fs);

    // constructing path to security policy file
    HBufC* policyFileName    = HBufC::NewLC(secPolicyFolder.Length() + secPolicyFile.Length() + KPolicyFileSuffix().Length());
    TPtr   policyFileNamePtr = policyFileName->Des();

    policyFileNamePtr += secPolicyFolder;
    policyFileNamePtr += secPolicyFile;
    policyFileNamePtr += KPolicyFileSuffix();

    // opening the .xpf file
    RFile policyFile;

    User::LeaveIfError(policyFile.Open(fs, *policyFileName, EFileShareReadersOnly));

    // parsing the .xpf file and constructing SecurityPolicy object
    CXPFParser* xpfp = MIDP::CXPFParser::NewLC(policyFile, *this);

    xpfp->ParseL();

    // cleanup
    CleanupStack::PopAndDestroy(xpfp);
    CleanupStack::PopAndDestroy(policyFileName);
    CleanupStack::PopAndDestroy();  // fs
    CleanupStack::PopAndDestroy(fileBuf);
    CleanupStack::PopAndDestroy(folderBuf);
    CleanupStack::PopAndDestroy(repository);

}
// EPOC default constructor can leave.
void CPositionRequest::ConstructL()
    {
    TCallBack timeoutCallBack(HandleTimeOut, this);
    iTimeoutTimer = CPosCallbackTimer::NewL(timeoutCallBack);

    TCallBack trackingCallBack(TrackingCallback, this);
    iTrackingTimer = CPosCallbackTimer::NewL(trackingCallBack);

    iModuleSettings.PosModules().GetModuleInfoL(
        iPositionerParams.iImplementationUid, 
        iModuleInfo);
        
    if (!iModuleInfo.IsAvailable())
        {
        User::Leave(KErrNotFound);
        }

    // Get the CategoryUid from the cenrep file owned by LbsRoot.
    CRepository* rep = CRepository::NewLC(KLbsCenRepUid);
    TInt posStatusCategory;
    TInt err = rep->Get(KMoPositioningStatusAPIKey, posStatusCategory);
    User::LeaveIfError(err);
    CleanupStack::PopAndDestroy(rep);
    iPosStatusCategory = TUid::Uid(posStatusCategory);
    
    LoadPositionerL();
    }
void HbSensorListener::checkCenrepValue()
{
#ifdef Q_OS_SYMBIAN
    CRepository *repository = 0;
    TRAPD(err, repository = CRepository::NewL(KHbSensorCenrepUid));
    if (err) {
        qWarning("HbSensorListener::checkCenrepValue; repository->NewL fails, error code = %d", err);
    } else {
        TInt value = 0;
        TInt err = repository->Get(KHbSensorCenrepKey, value);
        if (err == KErrNone) {
            cenrepValueChanged(value, false);
        } else {
            qWarning("HbSensorListener::checkCenrepValue: repository->Get fails, error code = %d", err);
        }
    delete repository;
    }
    if (!mNotifyHandler) {
        TRAPD(err, mNotifyHandler = HbSensorNotifyHandler::NewL(*this));
        if (err) {
            qWarning("HbSensorListener::HbSensorListener: HbSensorNotifyHandler::NewL failed = %d", err);
        } else {
            TRAPD(err, mNotifyHandler->startObservingL());
            if (err) {
                qWarning("HbSensorListener::HbSensorListener: mNotifyHandler->startObservingL failed = %d", err);
            }
        }
    }
#else
    QSettings mSettings("Nokia", "HbStartUpDeskTopSensors");
    bool enable = mSettings.value("SensorsEnabled").toBool();
    mSettingsEnabled = enable;
    enableSensors(enable, false);
#endif
}
// ---------------------------------------------------------------------------
// Get Preferred Service - Actual implementation
// ---------------------------------------------------------------------------
//
void CSPSettingsVoIPUtils::DoGetPreferredServiceL( 
    TUint& aServiceId ) const
    {
    XSPSLOGSTRING( 
        "CSPSettingsVoIPUtils::DoGetPreferredServiceL() - IN" );
    
    if ( !IsVoIPSupportedL() )
        {
        // Voip not supported
        User::Leave( KErrNotSupported );
        }
    
    // Get the preferred service id
    CRepository* repository = CRepository::NewLC( KCRUidRichCallSettings );
    TInt value(0);
    User::LeaveIfError( repository->Get( KRCSPSPreferredService, value ) );
    CleanupStack::PopAndDestroy( repository );
    
    
    XSPSLOGSTRING2( 
        "CSPSettingsVoIPUtils::DoGetPreferredServiceL() service:%d",value );
    if ( 0 == value )
        {
        // Preferred service not setted.
        User::Leave( KErrNotFound );
        }

    aServiceId = value;
    }
Esempio n. 16
0
// ----------------------------------------------------------------------------------------
// CDMUtilServer::GetCertFromCentRep
// ----------------------------------------------------------------------------------------
TInt CDMUtilServer::GetCertFromCentRep()
    {
	RDEBUG("CDMUtilServer::GetCertFromCentRep");
	TInt result = KErrNone;
	
#ifdef __TARM_SYMBIAN_CONVERGENCY
	result = iNotifier.GetCert( iCertInfo );
	if ( result != KErrNone ) 
		{
		RDEBUG_2("**** CDMUtilServer::GetCertFromCentRep ... NOT FOUND: %d", result );
		result = KErrNotFound;
		}
#else	
    TCertInfo info;
	CRepository *rep = NULL;
	TRAP( result, rep = CRepository::NewL ( KCRUidPolicyManagementUtilInternalKeys ) );
	if (result == KErrNone )
		{
		TPckg<TCertInfo> pcert( iCertInfo );
		TInt len( 0 );
		result = rep->Get( KSyncMLSessionCertificate, pcert, len );
		delete rep;
		if ( len == 0 ) 
			{
			RDEBUG("**** CDMUtilServer::GetCertFromCentRep ... NOT FOUND");
			result = KErrNotFound;
			}
		}
#endif	

	return result;
    }
void CMFPreviewHandlerBase::ReadDefaultToneL()
    {
    CRepository* cenrep = CRepository::NewLC( KCRUidProfileEngine );

    User::LeaveIfError( cenrep->Get( KProEngDefaultRingingTone, iDefaultTone ) );
    CleanupStack::PopAndDestroy( cenrep );
    }
// ============================================================================
// CWidgetUIConfigHandler::ParseValidateBundleMetadataL
// Parse the widget info file and create widget entry
// check for required keys and values
//
// @since 3.1
// @param aBuffer The buffer contains widget info file content.
// @param aPropertyValues output filled with parsed values from buf
// ============================================================================
//
void CWidgetUIConfigHandler::ParseValidateBundleMetadataL(
    TPtr8 aBuffer,
    RPointerArray<CWidgetPropertyValue>& aPropertyValues,
    RFs& aFileSession )
    {
    /*
      steps: 1. parse bundle metadata (ex., info.plist) and put
      results in aPropertyValues; 2. validate the metadata 2a. are
      required keys present? 2b. are values sane?

      leaves: 1. doesn't parse -> KErrCorrupt; 2. DTD not Nokia and
      cenrep key KWidgetInstallerStrictMode is 1 -> KErrNotSupported;
      3. key type bool but child element not true or false ->
      KErrCorrupt; 4. key type integer but child element not integer
      -> KErrCorrupt; 5. key type integer and child element integer
      but unparsable integer value -> KErrCorrupt; 6. key type string
      and child element not string -> KErrCorrupt; 7. key type string
      and child element string but does not contain text ->
      KErrCorrupt; 8. required keys not present -> KErrNotSupported
      9. key values not sane -> KErrNotSupported; 10. Heap allocation
      failure -> KErrNoMem
    */

    TInt nokiaOnly = 0;
    TRAP_IGNORE(
        CRepository* rep = CRepository::NewL( TUid::Uid( KSWInstWidgetUIUid ) );
        rep->Get( KWidgetInstallerStrictMode, nokiaOnly );
        delete rep; );
Esempio n. 19
0
void RAlfClientBase::CompleteAsynchConstructionL()
    {
    if (iApa)
        {    
        delete iCmdLine;
        iCmdLine = 0; 
        iApa->Close();
        delete iApa;
        iApa = 0;

        TName serverName;
            ConstructServerName( 
            serverName, 
            TUid::Uid(KAlfAppServerInterfaceUid3), 
            KAlfAppServerInterfaceUid3 );
        ConnectExistingByNameL( serverName );
        }
    else
        {
    	TInt value = 0;
        CRepository* repo = CRepository::NewLC(KCRUidThemes);
        User::LeaveIfError(repo->Get(KThemesAnimBackgroundSupport, value));
        CleanupStack::PopAndDestroy();
#if !defined(__WINS__)
        if (!value)
            {         
            RProcess image;
            User::LeaveIfError(image.Create(KBgAnimExeName,KNullDesC));
            image.Resume();
            image.Close();
            }
#endif
        }
	       
    }
Esempio n. 20
0
// -----------------------------------------------------------------------------
//GetCenrepKeyL
// -----------------------------------------------------------------------------
//	
LOCAL_C void GetCenrepKeyL(TDes8& aValue)
    {
    FLOG( _L( "[Provisioning] WPAdapterUtil GetCenrepKeyL" ) );
    CRepository* rep = NULL;
    TInt errorStatus = KErrNone;

    TRAPD( errVal, rep = CRepository::NewL(KCRUidOMAProvisioningLV));

    if(errVal == KErrNone)
        {
        errorStatus = rep->Get( KOMAProvOriginatorContent ,aValue );
        }
    else
        {
        errorStatus = errVal;
        }

    if(rep)
        {
        delete rep;
        }

    if(errorStatus != KErrNone )
        {
        User::Leave(errorStatus);
        }
    FLOG( _L( "[Provisioning] WPAdapterUtil GetCenrepKeyL: done" ) );
    }
TVerdict CDeleteLastConnectedDevice::doTestStepL()
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 * Our implementation only gets called if the base class doTestStepPreambleL() did
 * not leave. That being the case, the current test result value will be EPass.
 */
	{
	if (TestStepResult()==EPass)
		{
#ifdef SYMBIAN_LOCATION_BTGPSCONFIG
		// Bluetooth GPS PSY is using the new configuration API to store HW information
		// simply clear the list
		
		SetTestStepResult(EPass);

		CLbsBtGpsConfig* config = CLbsBtGpsConfig::NewL();
		CleanupStack::PushL(config);
		
		User::LeaveIfError(config->EmptyDeviceList());
		
		CleanupStack::PopAndDestroy(config);
		
	    _LIT(KDeviceRemoved, "Cleared Bluetooth GPS PSY device list" );
		INFO_PRINTF1(KDeviceRemoved); 
#else
		// Bluetooth GPS PSY is using cenrep to store HW information  
		
		// This step removes any last known device information from the BT GPS PSY
		TUid KCRUidBtGpsPsy = { 0x101FE999 };
		SetTestStepResult(EPass);
		CRepository* settings = CRepository::NewL(KCRUidBtGpsPsy);
		
	    TInt err = settings->Set(KBluetoothGpsPsyDeviceAddressValidity, 0);
		
	    TInt isValid;
	    err |= settings->Get(KBluetoothGpsPsyDeviceAddressValidity, isValid);
	   
	    TBTSockAddr dummyAddr;
       
		TBuf<KMaxSockAddrSize> addressBuffer;
		addressBuffer.Copy(dummyAddr);
		err |= settings->Set(KBluetoothGpsPsyDeviceAddress , addressBuffer);
		err |= settings->Set(KDevNotifCenrepHwKey,addressBuffer);
	  
		if(isValid==0)
	    	{
		    _LIT(KDeviceInvalidated, "Device is invalidated" );
			INFO_PRINTF1(KDeviceInvalidated); 
	    	}
	    if((err!=KErrNone)||(isValid))
	    	{
		    _LIT(KErrorOccurred, "Error or device is still valid. Error is %d and isValid is %d");
			INFO_PRINTF3(KErrorOccurred,err,isValid);
	    	SetTestStepResult(EFail); 
	    	}
#endif
		}
	  return TestStepResult();
 	}
Esempio n. 22
0
void QKeyMapperPrivate::updateInputLanguage()
{
#ifdef Q_WS_S60
    TInt err;
    CRepository *repo;
    const TUid KCRUidAknFep = TUid::Uid(0x101F876D);
    const TUint32 KAknFepInputTxtLang = 0x00000005;
    TRAP(err, repo = CRepository::NewL(KCRUidAknFep));
    if (err != KErrNone)
        return;

    TInt symbianLang;
    err = repo->Get(KAknFepInputTxtLang, symbianLang);
    delete repo;
    if (err != KErrNone)
        return;

    QString qtLang = QString::fromAscii(qt_symbianLocaleName(symbianLang));
    keyboardInputLocale = QLocale(qtLang);
    keyboardInputDirection = (TBidiText::ScriptDirectionality(TLanguage(symbianLang)) == TBidiText::ERightToLeft)
            ? Qt::RightToLeft : Qt::LeftToRight;
#else
    keyboardInputLocale = QLocale();
    keyboardInputDirection = Qt::LeftToRight;
#endif
}
// -----------------------------------------------------------------------------
// CSuplPsyPositioner::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CSuplPsyPositioner::ConstructL( TAny* aConstructionParameters )
    {
    TRACESTRING( "CSuplPsyPositioner::ConstructL start" )
    // Calling BaseConstructL is required by Positioning Plug-in API.
    BaseConstructL( aConstructionParameters );

    // Get instance of request manager, and register to it
    iRequestManager = CSuplPsyRequestManager::RegisterL( *this );

    CRepository *repository = CRepository::NewL(KCRUidSuplPsy);

    TInt keyValue;

    TInt ret = repository->Get(KSuplPsyAllowedAccuracy, keyValue);
   
    if (ret == KErrNone)
        {            
        if (keyValue <= 0)
            {            
            TRACESTRING( "CSuplPsyPositioner::ConstructL, invalid value in the configuration " )
    	    iAllowedAccr = 0;
            }
        else		
    	    iAllowedAccr = keyValue;
        }
    else
    	iAllowedAccr = 0;

	
   	TRACESTRING2( "Allowes Accurracy...:%d", iAllowedAccr )
    delete repository;
    repository = NULL;
    TRACESTRING( "CSuplPsyPositioner::ConstructL end" )
    }
void CHttpCacheManager::GetOperatorCacheConfigL( CRepository& aRepository, TBool& aOpCacheEnabled, TInt& aOpCacheSize, TDes& aOpCacheFolder )
    {
    // Operator Cache
    aOpCacheEnabled = FeatureManager::FeatureSupported(KFeatureIdOperatorCache);
    if( aOpCacheEnabled )
        {
        TInt tempOpCacheSize;
        if( aRepository.Get(KOperatorCacheSize, tempOpCacheSize) == KErrNone )
            aOpCacheSize = tempOpCacheSize;

        // op cache folder
        TFileName tempOpCacheFolder;
        if( aRepository.Get(KOperatorCacheFolder, tempOpCacheFolder) == KErrNone )
            aOpCacheFolder.Copy( tempOpCacheFolder );
        }
    HttpCacheUtil::EnsureTrailingSlash( aOpCacheFolder );
    }
Esempio n. 25
0
TInt TCmdUNSAFTimers::Read( CRepository& aRepository,
							const TUint32& aKey,
							TDes8& aKeyValue ) const
    {
    TBuf8<1> tmp;
    TInt actualLength = 0;
    // This Get call returns KErrOverflow, but it doesn't matter as we are only
    // interested in actualLength.
    aRepository.Get( aKey, tmp, actualLength );

	if ( actualLength <= 0 || actualLength > aKeyValue.MaxLength() )
		{
		return KErrOverflow;
		}

    return aRepository.Get( aKey, aKeyValue );
    }
Esempio n. 26
0
void RLbsNetworkPositionUpdates::GetCategoryUidL(TUint32 aKey, TUid& aCategoryUid)
	{
	TInt category;
	CRepository* rep = CRepository::NewLC(KLbsCenRepUid);
	User::LeaveIfError(rep->Get(aKey, category));
	aCategoryUid = TUid::Uid(category);
	CleanupStack::PopAndDestroy(rep);
	}
/*
 * @return value of Common Data Set in Central Repository.
 */
TInt CT_LbsSimulationPsyPosTp400::TrpModeL() const
	{
	// Get the Common Data Set setting from Central Repository
	CRepository* repository = CRepository::NewLC(KCRUidSimulationPSY);
	TInt commonDataSet = 0;
	User::LeaveIfError(repository->Get(KCRKeySimPSYCommonDataSet, commonDataSet));
	CleanupStack::PopAndDestroy(repository);
	return commonDataSet;
	}
// -----------------------------------------------------------------------------
// COMASUPLProtocolManager::GetNetworkModeL
// Logs
// -----------------------------------------------------------------------------
TInt COMASUPLProtocolManager::GetNetworkModeL()
	{	
	TInt networkMode;
	// get network mode
	CRepository* centralRepository = CRepository::NewLC(KCRUidCoreApplicationUIs);
	User::LeaveIfError(centralRepository->Get(KCoreAppUIsNetworkConnectionAllowed, networkMode));
    CleanupStack::PopAndDestroy(centralRepository);
    return networkMode;
	}
/**
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4060
@SYMTestCaseDesc Test that new settings can be added in subsequent ROFS layers
@SYMTestPriority High
@SYMTestActions Open keyspace 0x10286558.  This keyspace is represented by two txt files.  The
keyspace file names in the source have been mangled in a similar way to that which would be
expected on the device (eg. abcd1234.txt, abcd1234.txt[01-00], abcd1234.txt[02-00] etc.
@SYMTestExpectedResults Ensure that the final value of the setting is as specified in the final
ROFS layer that touched that setting.
@SYMREQ REQ11398
*/
LOCAL_C void REQ11398L()
{
    TheTest.Next(_L( " @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-4060 " ));

    CRepository* rep;
    User::LeaveIfNull(rep = CRepository::NewLC(KUidKeyspace9));
    TInt settingValueInt = 0;

    // tests that the core value is not modified
    rep->Get(KKeyOne, settingValueInt);
    TEST2(settingValueInt, KKeyspace9Setting1Value);

    // tests that the core value is modified by the ROFS layer
    rep->Get(KKeyTwo, settingValueInt);
    TEST2(settingValueInt, KKeyspace9Setting2Value);

    CleanupStack::PopAndDestroy(rep);
}
Esempio n. 30
0
// Default charset is wrong when language is English on a China phone
TInt CImConvertCharconv::GetSystemCharsetFromCenRepL(TDes8& aMimeCharSet)
	{
	// Open the repository
	CRepository* repository = CRepository::NewL(KUidMsgEmailGeneralCenRep);
	// Read the value
	TInt err = repository->Get(EEmailGeneralCharSetId, aMimeCharSet);
	delete repository;
	return err;
	}