コード例 #1
0
void CPodcastModel::GetProxyInformationForConnectionL(TBool& aIsUsed, HBufC*& aProxyServerName, TUint32& aPort)
	{
	TInt iapId = GetIapId();
	CCommsDbTableView* table = iCommDB->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(COMMDB_ID), iapId);
	
	TUint32 iapService;
	HBufC* iapServiceType;
	table->ReadUintL(TPtrC(IAP_SERVICE), iapService);
	iapServiceType = table->ReadLongTextLC(TPtrC(IAP_SERVICE_TYPE));
	
	CCommsDbTableView* proxyTableView = iCommDB->OpenViewOnProxyRecordLC(iapService, *iapServiceType);
	TInt err = proxyTableView->GotoFirstRecord();
	if( err != KErrNone)
		{
		User::Leave(KErrNotFound);	
		}

	proxyTableView->ReadBoolL(TPtrC(PROXY_USE_PROXY_SERVER), aIsUsed);
	if(aIsUsed)
		{
		HBufC* serverName = proxyTableView->ReadLongTextLC(TPtrC(PROXY_SERVER_NAME));
		proxyTableView->ReadUintL(TPtrC(PROXY_PORT_NUMBER), aPort);
		aProxyServerName = serverName->AllocL();
		CleanupStack::PopAndDestroy(serverName);
		}
		
	CleanupStack::PopAndDestroy(proxyTableView);
	CleanupStack::PopAndDestroy(iapServiceType);
	CleanupStack::PopAndDestroy(table);
	}
コード例 #2
0
TInt CCommDbTest036_06::executeStepL()
	{
	CCommsDbTemplateRecord* templateRecord = CCommsDbTemplateRecord::NewL(iTheDb, TPtrC(DIAL_IN_ISP));
	CleanupStack::PushL(templateRecord);
	
	User::LeaveIfError(templateRecord->Modify());

	TBufC<KCommsDbSvrMaxFieldLength> inputString = _L("test string");
	templateRecord->WriteTextL(TPtrC(COMMDB_NAME), _L("Name"));
//	templateRecord->WriteTextL(TPtrC(ISP_IF_NAME), _L("SLIP"));
	templateRecord->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER), ETrue);
	templateRecord->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER), ETrue);
	templateRecord->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER), ETrue);
	templateRecord->WriteLongTextL(TPtrC(ISP_LOGIN_SCRIPT), inputString);
	User::LeaveIfError(templateRecord->StoreModifications());

	CleanupStack::PopAndDestroy(templateRecord);

	//Create a view on the DialInISP table, make a new record and change the value we set int he template

	CCommsDbTableView* tableView = iTheDb->OpenTableLC(TPtrC(DIAL_IN_ISP));
	TUint32 dummyId;
	//Create a new record, so we can be sure it is the same as the templated one
	User::LeaveIfError(tableView->InsertRecord(dummyId));
	tableView->WriteTextL(TPtrC(COMMDB_NAME), _L("Test ISP"));
//	tableView->WriteTextL(TPtrC(ISP_IF_NAME), _L("Test If"));
	tableView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER), EFalse);
	tableView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER), EFalse);
	tableView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER), EFalse);
	//Overwrite value set above in template
	TBufC<KCommsDbSvrMaxFieldLength> overwriteString = _L("new string");
	tableView->WriteLongTextL(TPtrC(ISP_LOGIN_SCRIPT), overwriteString);
	User::LeaveIfError(tableView->PutRecordChanges());

	//Retrieve the string we just set
	HBufC* retrievedString = tableView->ReadLongTextLC(TPtrC(ISP_LOGIN_SCRIPT));

	TInt ret(KErrNone);
	if(*retrievedString!=overwriteString)
		ret= KErrGeneral;

	CleanupStack::PopAndDestroy();	//retrievedString
	CleanupStack::PopAndDestroy(tableView);

	return ret;
	}
コード例 #3
0
// -----------------------------------------------------------------------------
// COMASuplSettings::ConvertIAPNameToIdL
// 
// -----------------------------------------------------------------------------
TBool COMASuplSettings::ConvertIAPNameToIdL(const TDesC& aIAPName, TUint32& aIAPId)
	{
		TBool result = EFalse;
	
		CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
		CleanupStack::PushL(commDb);
		CCommsDbTableView* tableView = commDb->OpenIAPTableViewMatchingBearerSetLC(ECommDbBearerCSD|ECommDbBearerGPRS,
											ECommDbConnectionDirectionOutgoing);
	   	TInt retval = tableView->GotoFirstRecord();
	   	while ((retval == KErrNone) && (!result))
	   	{
	      HBufC * iap_name = tableView->ReadLongTextLC( TPtrC( COMMDB_NAME) );

	      if (iap_name && (iap_name->Compare(aIAPName) == 0))
	        {
	           	tableView->ReadUintL(TPtrC(COMMDB_ID), aIAPId);
	            result = ETrue;
	       	}
	       CleanupStack::PopAndDestroy(); // iap_name
	       retval = tableView->GotoNextRecord();
	   	}
		CleanupStack::PopAndDestroy(2);//delete tableView and commDb
		return result;
	}
コード例 #4
0
   bool GetProxy( char*& aHost, uint32& aPort, const int32 aIAP )
   { 
# ifdef NAV2_CLIENT_SERIES60_V2
      CCommsDatabase * comdb = CCommsDatabase::NewL();
# else
      CCommsDatabase * comdb = CCommsDatabase::NewL( EDatabaseTypeUnspecified );
# endif
      CleanupStack::PushL( comdb );
   
      // First get the IAP
      CCommsDbTableView* iaptable = comdb->OpenViewMatchingUintLC( TPtrC( IAP ), 
                                                                TPtrC( COMMDB_ID ), aIAP );
      TInt iapres = iaptable->GotoFirstRecord();
      bool found = false;
      if ( iapres == KErrNone ) {
         HBufC* iap_name = iaptable->ReadLongTextLC( TPtrC( COMMDB_NAME) );
         uint32 iap_service = 0;
         iaptable->ReadUintL( TPtrC( IAP_SERVICE ), iap_service );
            
         // The current IAP exists!
         HBufC* iap_type = iaptable->ReadLongTextLC( TPtrC( IAP_SERVICE_TYPE ) );
      
         // Find Proxy for ISP (and same service type)
         CCommsDbTableView* proxytable = comdb->OpenViewMatchingUintLC( TPtrC( PROXIES ), 
                                                                     TPtrC( PROXY_ISP ), iap_service );
         TInt dretval= proxytable->GotoFirstRecord();
         while ( dretval == KErrNone && !found ) {
            // Check if matching proxy service type
            HBufC* proxy_service_type = proxytable->ReadLongTextLC( TPtrC( PROXY_SERVICE_TYPE ) );
            if ( proxy_service_type != NULL &&
               proxy_service_type->CompareC( *iap_type ) == 0 ) 
            {
               // Match!
               // PROXY_USE_PROXY_SERVER 
               TBool proxy_use_proxy_server = 0;
               proxytable->ReadBoolL( TPtrC( PROXY_USE_PROXY_SERVER ), proxy_use_proxy_server );
# ifdef NAV2_CLIENT_SERIES60_V2
               if ( proxy_use_proxy_server ) {
# endif
               // PROXY_SERVER_NAME - Name of the proxy server
               HBufC* proxy_server_name = proxytable->ReadLongTextLC( 
               TPtrC( PROXY_SERVER_NAME ) );
               if ( proxy_server_name ) {
                  found = true;
                  // Convert to something we can use.
                  aHost = WFTextUtil::TDesCToUtf8L( proxy_server_name->Des() );
                  proxytable->ReadUintL( TPtrC( PROXY_PORT_NUMBER ), aPort );
               
                  // Sanity on port
                  if ( aPort == 9201 ) {
                     // We don't talk wap
                     // XXX: Or no proxy at all?
                     aPort = 8080;
                  } else if ( aPort == 0 ) {
                     // Not valid => no proxy
                     found = false;
                     delete [] aHost;
                     aHost = NULL;
                  }
               } // End if have proxy_server_name
                     
               CleanupStack::PopAndDestroy( proxy_server_name );
# ifdef NAV2_CLIENT_SERIES60_V2
               } // End if proxy_use_proxy_server is true
# endif
            } // End if service type matches
            CleanupStack::PopAndDestroy( proxy_service_type );
            dretval = proxytable->GotoNextRecord(); // next proxy
         } // End while all proxies

         // XXX: Perhaps "IAP_SERVICE_TYPE" table -> [GPRS|ISP]_IP_GATEWAY 
         // especially in s60v1
         CleanupStack::PopAndDestroy( proxytable );
         CleanupStack::PopAndDestroy( iap_type );
         CleanupStack::PopAndDestroy( iap_name );
      } // End if the current IAP is found
      
      CleanupStack::PopAndDestroy( iaptable );
      CleanupStack::PopAndDestroy( comdb );
     
      return found;   
   }
コード例 #5
0
void CIAPSettingItem::CompleteConstructionL()
{
   _LIT(KmRouter, "mroute");

   CArrayPtr<CAknEnumeratedText> * iaps = new(ELeave) CArrayPtrSeg<CAknEnumeratedText>(10);
   CleanupStack::PushL(iaps);
   CArrayPtr<HBufC> * poppedUp = new(ELeave) CArrayPtrSeg<HBufC>(10);
   CleanupStack::PushL(poppedUp);

   CAknEnumeratedTextPopupSettingItem::CompleteConstructionL();

   // The selection of IAP that indicates "always ask"
   HBufC * buf;
   buf = CEikonEnv::Static()->AllocReadResourceL( R_SETTINGS_IAP_ALWAYS_ASK );
   iaps->AppendL(new(ELeave) CAknEnumeratedText(-1, buf ));
   // The selection of IAP that indicates "system default is only shown in
   // development mode, not in release mode.
   if ( ! iRelease ) {
      buf = CEikonEnv::Static()->AllocReadResourceL( R_SETTINGS_IAP_SYSTEM_DEFAULT );
      iaps->AppendL(new(ELeave) CAknEnumeratedText(-2, buf ));
   }


#ifdef NAV2_CLIENT_SERIES60_V2
   CCommsDatabase * comdb = CCommsDatabase::NewL();
#else
   CCommsDatabase * comdb = CCommsDatabase::NewL(EDatabaseTypeUnspecified);
#endif
   CleanupStack::PushL(comdb);
   CCommsDbTableView * iaptable = comdb->OpenTableLC( TPtrC( IAP ) );

   TInt retval;
   retval = iaptable->GotoFirstRecord();

   // display all IAPs except mrouter
   while (retval == KErrNone) {
      HBufC * iap_name = iaptable->ReadLongTextLC( TPtrC( COMMDB_NAME) );
      if ( KErrNotFound == iap_name->FindF(KmRouter) ) {
         TUint32 iap_id;
         iaptable->ReadUintL( TPtrC( COMMDB_ID), iap_id );
         iaps->AppendL(new(ELeave) CAknEnumeratedText(iap_id, iap_name ));
      }
      CleanupStack::Pop(iap_name);   // FIXME - Is this right? Does AppendL take over ownership of the iap name?
      retval = iaptable->GotoNextRecord();
   }

   CleanupStack::PopAndDestroy(iaptable);
   CleanupStack::PopAndDestroy(comdb);

   SetEnumeratedTextArrays(iaps, poppedUp);
   CleanupStack::Pop(poppedUp);
   CleanupStack::Pop(iaps);

   // Does the (old) specified iap still exist? Default to 
   // "always ask" otherwise.
   if (IndexFromValue(ExternalValue()) < 0) {
      SetInternalValue(-1);
      SetExternalValue(-1);
   }


}