コード例 #1
0
// ---------------------------------------------------------------------------
// Deletes service provider settings entry by service ID
// ---------------------------------------------------------------------------
//
TInt CSPSettingsEngine::DeleteEntryL( TServiceId aServiceId )
    {
    XSPSLOGSTRING2( "CSPSettingsEngine::DeleteEntryL(%d) - IN", aServiceId );

    TInt err = iCenRepUtils->DeleteEntryL( aServiceId );
    
    XSPSLOGSTRING2( "CSPSettingsEngine::DeleteEntryL(%d) - OUT", aServiceId );
    
    return err;
    }
コード例 #2
0
// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CSpsBackupHelperPerformer::ReadSettingsL()
    {
    XSPSLOGSTRING( "CSpsBackupHelperPerformer::ReadSettingsL IN" );
    RIdArray ids;
    CleanupClosePushL( ids );
    iServiceProviderSettings->FindServiceIdsL( ids );
    
    // Make sure that id's are in correct order!
    for( TInt i = 0; i < ids.Count(); i++ )
        {
        TRAP_IGNORE( 
            CSPEntry* entry = CSPEntry::NewLC();
            User::LeaveIfError( 
                iServiceProviderSettings->FindEntryL( ids[i], *entry ) );
            
            // Make sure that all properties are loaded
            entry->GetAllProperties(); 
            iEntries.AppendL( entry );
            CleanupStack::Pop( entry );
            )

        }
    
    XSPSLOGSTRING2( 
        "CSpsBackupHelperPerformer::ReadSettingsL Service count=%i", 
        iEntries.Count() );
    
    CleanupStack::PopAndDestroy( &ids );
    XSPSLOGSTRING( "CSpsBackupHelperPerformer::ReadSettingsL OUT" );
    }
コード例 #3
0
// ---------------------------------------------------------------------------
// 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;
    }
コード例 #4
0
// ---------------------------------------------------------------------------
// Deletes service properties
// ---------------------------------------------------------------------------
//
TInt CSPSettingsEngine::DeleteServicePropertiesL( TServiceId aServiceId,
                                                  const RPropertyNameArray& aNameArray  )
    {
    XSPSLOGSTRING2( 
        "CSPSettingsEngine::FindSubServicePropertyL( %d ) - IN", aServiceId );

    RArray<TUint32> nameArray;
    CleanupClosePushL( nameArray );
    TInt count = aNameArray.Count();
    
    for( TInt i = 0; i < count; i++ )
        {
        TUint32 name = (TUint32)( aNameArray[i] );
        User::LeaveIfError( nameArray.Append( name ) );
        }
        
    TInt id = (TInt)aServiceId;
    TInt err = iCenRepUtils->DeletePropertiesL( id, nameArray );
    
    CleanupStack::PopAndDestroy( &nameArray );
    
    XSPSLOGSTRING( "CSPSettingsEngine::FindSubServicePropertyL() - OUT" );
    
    return err;
    }
コード例 #5
0
// ---------------------------------------------------------------------------
// Returns count of stored service provider settings entries
// ---------------------------------------------------------------------------
//
TInt CSPSettingsEngine::SettingsCountL()
    {
    XSPSLOGSTRING( "CSPSettingsEngine::SettingsCount() - IN" );

    TInt result( 0 );

    TInt err = iCenRepUtils->EntryCountL( result );
    
    if( err == KErrNone )
        {
        if( result >= KSPPredefinedCount )
            {
            result--;
            }
        err = result;
        }
    else
        {
        err = 0;
        }
    
    XSPSLOGSTRING2( "CSPSettingsEngine::SettingsCount(%d) - OUT", result );

    return err;
    }
コード例 #6
0
// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CSpsBackupHelperPerformer::SetNextFreeServiceIdL( TInt aServiceId )
    {
    XSPSLOGSTRING2( "CSpsBackupHelperPerformer::SetNextFreeServiceIdL IN, %i", aServiceId );
    CRepository* cenrep = CRepository::NewLC( KCRUidSPSettings );
    
    User::LeaveIfError( cenrep->Set( KServiceIdCounter, aServiceId ) );
    
    CleanupStack::PopAndDestroy( cenrep );
    XSPSLOGSTRING( "CSpsBackupHelperPerformer::SetNextFreeServiceIdL OUT" );
    }
コード例 #7
0
// ---------------------------------------------------------------------------
// Find service provider settings entry by service ID
// ---------------------------------------------------------------------------
//
 TInt CSPSettingsEngine::FindEntryL( TServiceId aServiceId, CSPEntry& aEntry )
    {
    XSPSLOGSTRING2( "CSPSettingsEngine::FindEntryL( %d ) - IN", aServiceId );
    
    RIpAppPropArray array;
    TCleanupItem cleanup( CSPSettingsEngine::CleanupPointerArray, &array );
    CleanupStack::PushL( cleanup );

    TInt err = iCenRepUtils->FindEntryL( aServiceId, array );
    
    if( err == KErrNone )
        {
        TInt count = array.Count();

        for( TInt i = 0; i < count; i++ )
            {
            CCenRepDatabaseProperty* property = array[i];
            
            if( property->GetName() == EServiceName )
                {
                User::LeaveIfError( aEntry.SetServiceName( property->GetDesValue() ) );
                }
            else
                {
                CSPProperty* spProperty = CSPProperty::NewLC();
                User::LeaveIfError( spProperty->SetName( (TServicePropertyName)( property->GetName() )));
                User::LeaveIfError( spProperty->SetValue( property->GetDesValue() ));
                
                User::LeaveIfError( aEntry.AddPropertyL( *spProperty ));
                CleanupStack::PopAndDestroy( spProperty );
                }
            }
        }
    CleanupStack::PopAndDestroy( &array );
    
    aEntry.SetServiceId( aServiceId );
    
    XSPSLOGSTRING2( "CSPSettingsEngine::FindEntryL( %d ) - OUT", aServiceId );
    
    return err;
    }
コード例 #8
0
// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
TInt CSpsBackupHelperPerformer::NextFreeServiceIdL()
    {
    XSPSLOGSTRING( "CSpsBackupHelperPerformer::NextFreeServiceIdL IN" );
    TInt ret(0);
    CRepository* cenrep = CRepository::NewLC( KCRUidSPSettings );
    
    User::LeaveIfError( cenrep->Get( KServiceIdCounter, ret ) );
    
    CleanupStack::PopAndDestroy( cenrep );
    XSPSLOGSTRING2( "CSpsBackupHelperPerformer::NextFreeServiceIdL OUT, %i", ret );
    return ret;
    }
コード例 #9
0
// ---------------------------------------------------------------------------
// Add or update properties of service provider settings entry
// ---------------------------------------------------------------------------
//
TInt CSPSettingsEngine::AddOrUpdatePropertiesL( TServiceId aServiceId,
                                                const RPropertyArray& aPropertyArray )
    {
    XSPSLOGSTRING2( "CSPSettingsEngine::AddOrUpdatePropertiesL(%d) - IN", aServiceId );

    // construct RIpAppPropArray
    RIpAppPropArray array;
    TCleanupItem cleanup( CSPSettingsEngine::CleanupPointerArray, &array );
    CleanupStack::PushL( cleanup );
    
    ConvertSpArrayToCenRepArrayL( aPropertyArray, array );
    
    TInt err = iCenRepUtils->AddOrUpdatePropertiesL( aServiceId, array );    

    CleanupStack::PopAndDestroy( &array );
    
    XSPSLOGSTRING2( 
        "CSPSettingsEngine::AddOrUpdatePropertiesL(%d) - OUT", aServiceId );
        
    return err;
    }
コード例 #10
0
// ---------------------------------------------------------------------------
// Search property of service provider settings entry by property name
// ---------------------------------------------------------------------------
//
TInt CSPSettingsEngine::FindPropertyL( TServiceId aServiceId, 
                                       TServicePropertyName aPropertyName, 
                                       CSPProperty& aProperty )
    {
    XSPSLOGSTRING2( "CSPSettingsEngine::FindPropertyL(%d) - IN", aServiceId );

    CCenRepDatabaseProperty* cenrepProperty = CCenRepDatabaseProperty::NewLC();
    TInt err = iCenRepUtils->FindPropertyL( aServiceId, aPropertyName, *cenrepProperty );
    
    if( err == KErrNone )
        {
        User::LeaveIfError( aProperty.SetName( aPropertyName ) );
        User::LeaveIfError( aProperty.SetValue( cenrepProperty->GetDesValue()));
        }
        
    CleanupStack::PopAndDestroy( cenrepProperty );
    
    XSPSLOGSTRING2( "CSPSettingsEngine::FindPropertyL(%d) - OUT", aServiceId );
    
    return err;
    }
コード例 #11
0
// ---------------------------------------------------------------------------
// IsPreferredTelephonyVoIP - API method
// Returns ETrue if following items are ON:
//      Common Voip (Feature Manager)
//      Dynamic VoIP (Telephony settings)
//      Preferred telephony (Rich call settings)
//  + there is at least one SIP-VoIP profile stored
// ---------------------------------------------------------------------------
//
EXPORT_C TBool CSPSettingsVoIPUtils::IsPreferredTelephonyVoIP() const
    {
    XSPSLOGSTRING( 
        "CSPSettingsVoIPUtils::IsPreferredTelephonyVoIP() - IN" );

    // Check that VoIP is supported
    TBool voipSupported( IsVoIPSupported() );
    
    XSPSLOGSTRING2( 
        "CSPSettingsVoIPUtils::VoipSupported: %d",voipSupported );

    // Check the preferred telephony
    TBool voipPreferred( EFalse );
    TRAP_IGNORE( voipPreferred = IsPreferredTelephonyVoIPL() );
    
    XSPSLOGSTRING2( 
        "CSPSettingsVoIPUtils::VoipPreferred: %d", voipPreferred );

    XSPSLOGSTRING( 
        "CSPSettingsVoIPUtils::IsPreferredTelephonyVoIP() - OUT" );
    return voipPreferred && voipSupported;
    }
コード例 #12
0
// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CSpsBackupHelperPerformer::FinalizeRestoreL()
    {
    XSPSLOGSTRING( "CSpsBackupHelperPerformer::FinalizeRestoreL IN" );
    
    // Determine how many settings exists after factory settings
    TUint nextFreeServiceId = NextFreeServiceIdL();
    
    // Restore old settings
    // Make sure that id's are in correct order!
    for( TInt i = 0; i < iEntries.Count(); i++ )
        {
        // Start inputting restored settings from next free serviceid
        if( iEntries[i]->GetServiceId() == nextFreeServiceId )
            {
            // Service id to be inserver is same as next free serviceid
            nextFreeServiceId = iEntries[i]->GetServiceId();
            iServiceProviderSettings->AddEntryL( *iEntries[i] );
            nextFreeServiceId++; // Entry added
            }
        else if( iEntries[i]->GetServiceId() > nextFreeServiceId )
            {
            // Change inserted service id when service id is larger
            // than current service count.
            // This is done since backed up settings can be non linear
            SetNextFreeServiceIdL( iEntries[i]->GetServiceId() );
            nextFreeServiceId = iEntries[i]->GetServiceId();
            iServiceProviderSettings->AddEntryL( *iEntries[i] );
            nextFreeServiceId++; // Entry added
            }
        
        }
    
    XSPSLOGSTRING2( 
        "CSpsBackupHelperPerformer::FinalizeRestoreL Next free serviceid=%i", 
        nextFreeServiceId );
    
    XSPSLOGSTRING( "CSpsBackupHelperPerformer::FinalizeRestoreL OUT" );
    }
コード例 #13
0
// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
TInt CSPSettingsEngine::FindSubServicePropertiesL( TServiceId aServiceId, 
    TSPItemType aPropertyType,
    RPropertyArray& aPropertyArray )
    {
    XSPSLOGSTRING2( 
        "CSPSettingsEngine::FindSubServicePropertiesL( %d ) - IN", aServiceId );

    RPropertyNameArray nameArray;
    CleanupClosePushL( nameArray );
    
    PropertyNameArrayFromItemTypeL( aPropertyType, nameArray );
    TInt count = nameArray.Count();
    TInt id = (TInt) aServiceId;
    
    CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
    
    for( TInt i = 0; i < count; i++ )
        {
        TUint32 name = nameArray[i];
        TInt err = iCenRepUtils->FindPropertyL( id, name, *property );
        if( err == KErrNone )
            {
            CSPProperty* spProperty = CSPProperty::NewLC();
            User::LeaveIfError( spProperty->SetName( (TServicePropertyName)(property->GetName())) );
            User::LeaveIfError( spProperty->SetValue( property->GetDesValue() ));
            
            User::LeaveIfError( aPropertyArray.Append( spProperty ));
            CleanupStack::Pop( spProperty );
            }
        }
        
    CleanupStack::PopAndDestroy( property );
    CleanupStack::PopAndDestroy( &nameArray );
    
    XSPSLOGSTRING( "CSPSettingsEngine::FindSubServicePropertiesL() - OUT" );
    
    return KErrNone;
    }