cmmanager/cmmgr/cmmpluginbase/src/ccmpluginbaseeng.cpp
changeset 32 5c4486441ae6
parent 30 8dde790cab74
child 40 c5b848e6c7d1
equal deleted inserted replaced
31:c16e04725da3 32:5c4486441ae6
    31 
    31 
    32 
    32 
    33 using namespace CMManager;
    33 using namespace CMManager;
    34 using namespace CommsDat;
    34 using namespace CommsDat;
    35 
    35 
    36 const TInt KApMaxConnNameLength = 30;
    36 const TInt KApMaxConnNameLength = 50;
    37 _LIT( KFormatPostfix, "%02d" );
    37 _LIT( KFormatPostfix, "%02d" );
    38 _LIT( KFormatLargePostfix, "%d" );
    38 _LIT( KFormatLargePostfix, "%d" );
    39 _LIT( KFormatNameWithPostfix, "%S(%S)" );
    39 _LIT( KFormatNameWithPostfix, "%S(%S)" );
    40 _LIT( KFormatNoPostfix, "%S" );
    40 _LIT( KFormatNoPostfix, "%S" );
    41 const TInt KMaxPostfixLength = 5;
    41 const TInt KMaxPostfixLength = 5;
   928         }
   928         }
   929 
   929 
   930     CopyAttributes( iapRecord, proxyRecord );
   930     CopyAttributes( iapRecord, proxyRecord );
   931     CheckIfNameModifiedL( iapRecord, proxyRecord );
   931     CheckIfNameModifiedL( iapRecord, proxyRecord );
   932 
   932 
   933     if ( proxyRecord->iUseProxyServer )
   933     delete iProxyRecord;
   934         {
   934     iProxyRecord = NULL;
   935         delete iProxyRecord;
   935 
   936         iProxyRecord = NULL;
   936     iProxyRecord = static_cast<CCDProxiesRecord*>(
   937 
   937             CCDRecordBase::CreateCopyRecordL( *proxyRecord ) );
   938         iProxyRecord = static_cast<CCDProxiesRecord*>(
   938     iProxyRecord->SetElementId( proxyRecord->ElementId() );
   939                 CCDRecordBase::CreateCopyRecordL( *proxyRecord ) );
   939 
   940         iProxyRecord->SetElementId( proxyRecord->ElementId() );
   940     if ( !iProxyRecord->RecordId() )
   941 
   941         {
   942         if ( !iProxyRecord->RecordId() )
   942         // New proxy setting -> create new record.
   943             {
   943         iProxyRecord->iService = iServiceRecord->RecordId();
   944             // New proxy setting -> create new record.
   944         iProxyRecord->iServiceType.SetL( iIapRecord->iServiceType );
   945             iProxyRecord->iService = iServiceRecord->RecordId();
   945 
   946             iProxyRecord->iServiceType.SetL( iIapRecord->iServiceType );
   946         // By default protocol is set to "http".
   947 
   947         if ( TPtrC( proxyRecord->iProtocolName ).Length() == 0 )
   948             // By default protocol is set to "http".
   948             {
   949             if ( TPtrC( proxyRecord->iProtocolName ).Length() == 0 )
   949             iProxyRecord->iProtocolName.SetL( KDefProxyProtocolName );
   950                 {
   950             }
   951                 iProxyRecord->iProtocolName.SetL( KDefProxyProtocolName );
   951 
   952                 }
   952         iProxyRecord->SetRecordId( KCDNewRecordRequest );
   953 
   953         iProxyRecord->StoreL( iSession );
   954             iProxyRecord->SetRecordId( KCDNewRecordRequest );
   954         CopyRecordFieldsL( *iProxyRecord, *proxyRecord );
   955             iProxyRecord->StoreL( iSession );
   955         proxyRecord->SetElementId( iProxyRecord->ElementId() );
   956             proxyRecord->SetElementId( iProxyRecord->ElementId() );
       
   957             proxyRecord->iService = iServiceRecord->RecordId();
       
   958             proxyRecord->iServiceType.SetL( iIapRecord->iServiceType );
       
   959             }
       
   960         else
       
   961             // Already existing record -> update only.
       
   962             {
       
   963             iProxyRecord->ModifyL( iSession );
       
   964             }
       
   965         }
   956         }
   966     else
   957     else
   967         {
   958         // Already existing record -> update only.
   968         if ( iProxyRecord->RecordId() )
   959         {
   969             {
   960         iProxyRecord->ModifyL( iSession );
   970             iProxyRecord->DeleteL( iSession );
       
   971             }
       
   972         }
   961         }
   973 
   962 
   974     OstTraceFunctionExit0( CCMPLUGINBASEENG_UPDATEPROXYRECORDL_EXIT );
   963     OstTraceFunctionExit0( CCMPLUGINBASEENG_UPDATEPROXYRECORDL_EXIT );
   975     }
   964     }
   976 
   965 
  1963     CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>( aProxyRecord );
  1952     CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord*>( aProxyRecord );
  1964 
  1953 
  1965     proxyRecord->iServerName.SetL( aProxyServer );
  1954     proxyRecord->iServerName.SetL( aProxyServer );
  1966     if ( !aProxyServer.Length() )
  1955     if ( !aProxyServer.Length() )
  1967         {
  1956         {
  1968         proxyRecord->iPortNumber = 0;
       
  1969         proxyRecord->iUseProxyServer = EFalse;
  1957         proxyRecord->iUseProxyServer = EFalse;
  1970         }
  1958         }
  1971     else
  1959     else
  1972         {
  1960         {
  1973         proxyRecord->iUseProxyServer = ETrue;
  1961         proxyRecord->iUseProxyServer = ETrue;
  2328                     aAttribute,
  2316                     aAttribute,
  2329                     aClientPluginInstance->iGenRecordArray,
  2317                     aClientPluginInstance->iGenRecordArray,
  2330                     aClientPluginInstance->iBearerSpecRecordArray ) );
  2318                     aClientPluginInstance->iBearerSpecRecordArray ) );
  2331             if ( err )
  2319             if ( err )
  2332                 {
  2320                 {
       
  2321                 retVal = EFalse;
       
  2322                 }
       
  2323             }
       
  2324             break;
       
  2325         case ECmChargeCardUsageEnabled:
       
  2326             {
       
  2327             retVal = EFalse;
       
  2328             }
       
  2329             break;
       
  2330         case ECmLocationUsageEnabled:
       
  2331             {
       
  2332             retVal = iLocationEnabled;
       
  2333             }
       
  2334             break;
       
  2335         case ECmCoverage:
       
  2336             // By default the plugin has no network coverage.
       
  2337             {
       
  2338             TRAPD( err, retVal = GetBearerBoolAttributeL(
       
  2339                     aAttribute,
       
  2340                     aClientPluginInstance->iGenRecordArray,
       
  2341                     aClientPluginInstance->iBearerSpecRecordArray ) );
       
  2342             if ( err )
       
  2343                 {
  2333                 if ( err == KErrNotFound )
  2344                 if ( err == KErrNotFound )
  2334                     {
  2345                     {
  2335                     retVal = EFalse;
  2346                     retVal = EFalse;
  2336                     }
  2347                     }
  2337                 else
  2348                 else
  2339                     User::Leave( err );
  2350                     User::Leave( err );
  2340                     }
  2351                     }
  2341                 }
  2352                 }
  2342             }
  2353             }
  2343             break;
  2354             break;
  2344         case ECmChargeCardUsageEnabled:
       
  2345             {
       
  2346             retVal = EFalse;
       
  2347             }
       
  2348             break;
       
  2349         case ECmLocationUsageEnabled:
       
  2350             {
       
  2351             retVal = iLocationEnabled;
       
  2352             }
       
  2353             break;
       
  2354         case ECmCoverage:
       
  2355             // By default the plugin has no network coverage.
       
  2356             {
       
  2357             TRAPD( err, retVal = GetBearerBoolAttributeL(
       
  2358                     aAttribute,
       
  2359                     aClientPluginInstance->iGenRecordArray,
       
  2360                     aClientPluginInstance->iBearerSpecRecordArray ) );
       
  2361             if ( err )
       
  2362                 {
       
  2363                 if ( err == KErrNotFound )
       
  2364                     {
       
  2365                     retVal = EFalse;
       
  2366                     }
       
  2367                 else
       
  2368                     {
       
  2369                     User::Leave( err );
       
  2370                     }
       
  2371                 }
       
  2372             }
       
  2373             break;
       
  2374         case ECmMetaHighlight:
  2355         case ECmMetaHighlight:
  2375             {
  2356             {
  2376             CCDIAPMetadataRecord* metadataRecord = static_cast<CCDIAPMetadataRecord*>(
  2357             CCDIAPMetadataRecord* metadataRecord = static_cast<CCDIAPMetadataRecord*>(
  2377                     aClientPluginInstance->iGenRecordArray[KMetaDataRecordIndex] );
  2358                     aClientPluginInstance->iGenRecordArray[KMetaDataRecordIndex] );
  2378             retVal = metadataRecord->iMetadata & EMetaHighlight;
  2359             retVal = metadataRecord->iMetadata & EMetaHighlight;
  2385             retVal = metadataRecord->iMetadata & EMetaHiddenAgent;
  2366             retVal = metadataRecord->iMetadata & EMetaHiddenAgent;
  2386             }
  2367             }
  2387             break;
  2368             break;
  2388         case ECmVirtual:
  2369         case ECmVirtual:
  2389             {
  2370             {
  2390             retVal = EFalse;
  2371             // This is bearer specific attribute  
       
  2372             TRAPD( err, retVal = GetBearerInfoBoolL( aAttribute ) );
       
  2373             if ( err )
       
  2374                 {
       
  2375                 retVal = EFalse;
       
  2376                 }
  2391             }
  2377             }
  2392             break;
  2378             break;
  2393         case ECmWapIPSecurity:
  2379         case ECmWapIPSecurity:
  2394             {
  2380             {
  2395             retVal = static_cast<CCDWAPIPBearerRecord*>(
  2381             retVal = static_cast<CCDWAPIPBearerRecord*>(