975 TInt ret = dlg->ExecuteLD(); |
968 TInt ret = dlg->ExecuteLD(); |
976 |
969 |
977 TUint32 currentAccesspoint(0); |
970 TUint32 currentAccesspoint(0); |
978 if ( !ret ) |
971 if ( !ret ) |
979 { |
972 { |
980 CleanupStack::PopAndDestroy(5); |
973 CleanupStack::PopAndDestroy(4); |
981 return EFalse; // user canceled "Always ask" dialog |
974 return EFalse; // user canceled "Always ask" dialog |
982 } |
975 } |
983 |
976 if(curSelection == ENsmlDefaultConnection || curSelection == ENsmlAlwaysAsk ) |
984 if ( curSelection == ENsmlAlwaysAsk ) |
|
985 { |
|
986 aItem.SetValue( alwaysask->Des() ); |
|
987 aItem.iNumberData = KErrNotFound; |
|
988 CleanupStack::PopAndDestroy(5); |
|
989 return ETrue; // user selected "Always ask" option |
|
990 } |
|
991 else if(curSelection == ENsmlDefaultConnection ) |
|
992 { |
977 { |
993 aItem.SetValue( destName->Des() ); |
978 aItem.SetValue( destName->Des() ); |
994 aItem.iNumberData = KErrGeneral; |
979 aItem.iNumberData = KErrGeneral; |
995 CleanupStack::PopAndDestroy(5); |
980 CleanupStack::PopAndDestroy(4); |
996 return ETrue; // user selected "default connection" option |
981 return ETrue; // user selected "default connection" option |
997 } |
982 } |
998 else |
983 else |
999 { |
984 { |
1000 CCommsDatabase* commDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); |
985 currentAccesspoint = aItem.iNumberData ; |
1001 CleanupStack::PushL( commDb ); |
|
1002 CApUtils* aputils = CApUtils::NewLC(*commDb); |
|
1003 currentAccesspoint = aItem.iNumberData ; |
|
1004 CleanupStack::PopAndDestroy( aputils ); |
|
1005 CleanupStack::PopAndDestroy( commDb ); |
|
1006 |
|
1007 FTRACE( RDebug::Print( |
986 FTRACE( RDebug::Print( |
1008 _L("[OMADM] CNSmlDMDlgProfileView::EditSettingItemAccessPointL: current ap (%d)"), |
987 _L("[OMADM] CNSmlDMDlgProfileView::EditSettingItemAccessPointL: current ap (%d)"), |
1009 currentAccesspoint ) ); |
988 currentAccesspoint ) ); |
1010 } |
989 } |
1011 |
990 TCmSettingSelection userSelection; |
1012 |
991 userSelection.iId = currentAccesspoint; |
1013 TInt apBearerFlags; |
992 userSelection.iResult = CMManager::EConnectionMethod; |
1014 if ( FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ) ) |
993 CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL(); |
1015 { |
994 CleanupStack::PushL(settings); |
1016 apBearerFlags = EApBearerTypeCSD | |
995 TUint listedItems = CMManager::EShowConnectionMethods; |
1017 EApBearerTypeGPRS | |
996 TBearerFilterArray filter; |
1018 EApBearerTypeHSCSD | |
997 TBool selected = settings->RunApplicationSettingsL(userSelection, |
1019 EApBearerTypeWLAN; |
998 listedItems, |
1020 } |
999 filter); |
1021 else |
1000 CleanupStack::PopAndDestroy(settings); |
1022 { |
1001 if (selected) { |
1023 apBearerFlags = EApBearerTypeGPRS | EApBearerTypeWLAN; |
1002 switch (userSelection.iResult) |
1024 } |
1003 { |
1025 |
1004 case CMManager::EConnectionMethod: |
1026 CApSettingsHandler* handler = CApSettingsHandler::NewLC( |
1005 { |
1027 ETrue, |
1006 |
1028 EApSettingsSelListIsPopUp, |
1007 SetAccessPointInfoL( userSelection.iId ); |
1029 EApSettingsSelMenuSelectNormal, |
1008 break; |
1030 KEApIspTypeAll, |
1009 } |
1031 apBearerFlags, |
1010 default: |
1032 KEApSortNameAscending ); |
1011 break; |
1033 |
1012 } |
1034 TInt retVal = KErrNone; |
1013 } |
1035 TUint32 selectedIap(0); |
1014 else |
1036 TRAP_IGNORE( retVal = handler->RunSettingsL( currentAccesspoint, |
1015 { |
1037 selectedIap ) ); |
1016 // Check end key handling etc? |
1038 CleanupStack::PopAndDestroy(handler); |
1017 //Keep previous selection |
1039 CleanupStack::PopAndDestroy(5); |
1018 } |
1040 |
1019 CleanupStack::PopAndDestroy(4); |
1041 if ( retVal & KApUiEventSelected ) |
|
1042 { |
|
1043 SetAccessPointInfoL( selectedIap ); |
|
1044 } |
|
1045 else if ( retVal == KApUiEventExitRequested ) |
|
1046 { |
|
1047 DoExitFromMenuL(); |
|
1048 } |
|
1049 else |
|
1050 { |
|
1051 //Keep previous selection |
|
1052 } |
|
1053 return ETrue; |
1020 return ETrue; |
1054 } |
1021 } |
1055 |
1022 |
1056 // ----------------------------------------------------------------------------- |
1023 // ----------------------------------------------------------------------------- |
1057 // CNSmlDMDlgProfileView::SetAccessPointInfoL |
1024 // CNSmlDMDlgProfileView::SetAccessPointInfoL |
1058 // ----------------------------------------------------------------------------- |
1025 // ----------------------------------------------------------------------------- |
1059 // |
1026 // |
1060 void CNSmlDMDlgProfileView::SetAccessPointInfoL( TUint aId ) |
1027 void CNSmlDMDlgProfileView::SetAccessPointInfoL( TUint aId ) |
1061 { |
1028 { |
1062 FLOG( "[OMADM] CNSmlDMDlgProfileView::SetAccessPointInfoL:"); |
1029 FLOG( "[OMADM] CNSmlDMDlgProfileView::SetAccessPointInfoL:"); |
1063 |
|
1064 CCommsDatabase* commDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); |
|
1065 CleanupStack::PushL( commDb ); |
|
1066 |
|
1067 TInt apBearerFilter; |
|
1068 |
|
1069 if ( FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ) ) |
|
1070 { |
|
1071 apBearerFilter = EApBearerTypeCSD | |
|
1072 EApBearerTypeGPRS | |
|
1073 EApBearerTypeHSCSD | |
|
1074 EApBearerTypeWLAN; |
|
1075 } |
|
1076 else |
|
1077 { |
|
1078 apBearerFilter = EApBearerTypeGPRS | EApBearerTypeWLAN; |
|
1079 } |
|
1080 CApSelect* apSelect = CApSelect::NewLC( *commDb, |
|
1081 KEApIspTypeAll, |
|
1082 apBearerFilter, |
|
1083 KEApSortUidAscending ); |
|
1084 |
|
1085 TBool retValue( EFalse ); |
1030 TBool retValue( EFalse ); |
1086 |
1031 RCmManager cmManager; |
1087 if ( apSelect->MoveToFirst() ) |
1032 cmManager.OpenLC(); |
1088 { |
1033 RCmConnectionMethod conn; |
1089 if ( aId == apSelect->Uid() ) |
1034 TRAPD(err, conn = cmManager.ConnectionMethodL( aId )); |
1090 { |
1035 if(err == KErrNone)//connection method exists |
1091 retValue = ETrue; |
1036 retValue = ETrue; |
1092 } |
1037 |
1093 while ( ( ! retValue ) && ( apSelect->MoveNext() ) ) |
1038 if (retValue ) |
1094 { |
1039 { |
1095 if ( aId == apSelect->Uid() ) |
1040 CleanupClosePushL( conn ); |
1096 { |
1041 HBufC* name = conn.GetStringAttributeL( CMManager::ECmName ); |
1097 retValue = ETrue; |
1042 Item( ENSmlAccessPoint )->SetValue( *name ); |
1098 } |
1043 delete name; |
1099 } |
1044 CleanupStack::PopAndDestroy( 1 ); // conn |
1100 } |
|
1101 |
|
1102 if ( retValue ) |
|
1103 { |
|
1104 CApUtils* aputils = CApUtils::NewLC(*commDb); |
|
1105 TRAP_IGNORE( aId = aputils->IapIdFromWapIdL( aId ) ); |
|
1106 |
|
1107 FTRACE(RDebug::Print(_L("accesspoint after IapIdFromWapIdL (%d)"), aId)); |
|
1108 |
|
1109 Item( ENSmlAccessPoint )->SetValue( apSelect->Name() ); |
|
1110 Item( ENSmlAccessPoint )->iNumberData = aId; |
1045 Item( ENSmlAccessPoint )->iNumberData = aId; |
1111 Item( ENSmlAccessPoint )->iWapAPInUse = EFalse; |
1046 Item( ENSmlAccessPoint )->iWapAPInUse = EFalse; |
1112 |
1047 } |
1113 CleanupStack::PopAndDestroy( aputils ); |
1048 else//connection method doesn't exist |
1114 } |
|
1115 else |
|
1116 { |
1049 { |
1117 HBufC* emptyText = |
1050 HBufC* emptyText = |
1118 iEikonEnv->AllocReadResourceLC(R_CMMANAGERUI_SETT_DEFAULT_CONNECTION); |
1051 iEikonEnv->AllocReadResourceLC(R_CMMANAGERUI_SETT_DEFAULT_CONNECTION); |
1119 Item( ENSmlAccessPoint )->SetValue( emptyText->Des() ); |
1052 Item( ENSmlAccessPoint )->SetValue( emptyText->Des() ); |
1120 Item( ENSmlAccessPoint )->iNumberData = KErrNotFound; |
1053 Item( ENSmlAccessPoint )->iNumberData = KErrNotFound; |
1121 Item( ENSmlAccessPoint )->iWapAPInUse = EFalse; |
1054 Item( ENSmlAccessPoint )->iWapAPInUse = EFalse; |
1122 CleanupStack::PopAndDestroy(emptyText); |
1055 CleanupStack::PopAndDestroy(emptyText); |
1123 } |
1056 } |
1124 |
1057 CleanupStack::PopAndDestroy( 1 ); //cmManager |
1125 CleanupStack::PopAndDestroy( apSelect ); |
|
1126 CleanupStack::PopAndDestroy( commDb ); |
|
1127 } |
1058 } |
1128 |
1059 |
1129 // ----------------------------------------------------------------------------- |
1060 // ----------------------------------------------------------------------------- |
1130 // CNSmlDMDlgProfileView::GetAccessPointInfoL |
1061 // CNSmlDMDlgProfileView::GetAccessPointInfoL |
1131 // ----------------------------------------------------------------------------- |
1062 // ----------------------------------------------------------------------------- |
1132 // |
1063 // |
1133 void CNSmlDMDlgProfileView::GetAccessPointInfoL( TInt aId ) |
1064 void CNSmlDMDlgProfileView::GetAccessPointInfoL( TInt aId ) |
1134 { |
1065 { |
1135 FTRACE( RDebug::Print( |
1066 FTRACE( RDebug::Print( |
1136 _L("[OMADM] CNSmlDMDlgProfileView::GetAccessPointInfoL: aId (%d)"), aId)); |
1067 _L("[OMADM] CNSmlDMDlgProfileView::GetAccessPointInfoL: aId (%d)"), aId)); |
1137 |
1068 |
1138 TInt err = KErrNone; |
1069 TInt err = KErrNotFound; |
1139 |
1070 TBool apExists = EFalse; |
1140 CCommsDatabase* commDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); |
1071 RCmManager cmManager; |
1141 CleanupStack::PushL( commDb ); |
1072 cmManager.OpenLC(); |
1142 CApUtils* aputils = CApUtils::NewLC( *commDb ); |
1073 RCmConnectionMethod conn; |
1143 |
1074 TRAP(err, conn = cmManager.ConnectionMethodL( aId )); |
1144 TBool apExists = EFalse; |
1075 if(err == KErrNone)//connection method exists |
1145 TRAP( err, apExists = aputils->IAPExistsL( aId ) ); |
1076 { |
1146 if ( aId == KErrNotFound ) |
1077 CleanupClosePushL( conn ); |
1147 { |
1078 apExists = ETrue; |
1148 HBufC* emptyText = |
1079 } |
1149 iEikonEnv->AllocReadResourceLC( R_ALWAYS_ASK_ALWAYS_ASK ); |
1080 if(!apExists || aId == KErrGeneral || aId == KErrNotFound ) |
1150 Item( ENSmlAccessPoint )->SetValue( emptyText->Des() ); |
1081 { |
1151 Item( ENSmlAccessPoint )->iNumberData = KErrNotFound; |
1082 HBufC* emptyText = |
1152 Item( ENSmlAccessPoint )->iWapAPInUse = EFalse; |
1083 iEikonEnv->AllocReadResourceLC(R_CMMANAGERUI_SETT_DEFAULT_CONNECTION); |
1153 CleanupStack::PopAndDestroy( emptyText ); |
1084 Item( ENSmlAccessPoint )->SetValue( emptyText->Des() ); |
1154 CleanupStack::PopAndDestroy( aputils ); |
1085 Item( ENSmlAccessPoint )->iNumberData = KErrGeneral; |
1155 CleanupStack::PopAndDestroy( commDb ); |
1086 Item( ENSmlAccessPoint )->iWapAPInUse = EFalse; |
1156 return; |
1087 CleanupStack::PopAndDestroy( emptyText ); |
1157 } |
1088 if(err == KErrNone)//connection method exists |
1158 else if(!apExists || aId == KErrGeneral) |
1089 { |
1159 { |
1090 CleanupStack::PopAndDestroy( 2 );//conn, cmManager |
1160 HBufC* emptyText = |
1091 } |
1161 iEikonEnv->AllocReadResourceLC(R_CMMANAGERUI_SETT_DEFAULT_CONNECTION); |
1092 else |
1162 Item( ENSmlAccessPoint )->SetValue( emptyText->Des() ); |
1093 CleanupStack::PopAndDestroy( 1 );//cmManager |
1163 Item( ENSmlAccessPoint )->iNumberData = KErrGeneral; |
1094 return; |
1164 Item( ENSmlAccessPoint )->iWapAPInUse = EFalse; |
1095 } |
1165 CleanupStack::PopAndDestroy( emptyText ); |
1096 else |
1166 CleanupStack::PopAndDestroy( aputils ); |
1097 { |
1167 CleanupStack::PopAndDestroy( commDb ); |
1098 HBufC* name = conn.GetStringAttributeL( CMManager::ECmName ); |
1168 return; |
1099 Item( ENSmlAccessPoint )->SetValue( *name ); |
1169 } |
1100 delete name; |
1170 else |
1101 Item( ENSmlAccessPoint )->iNumberData = aId; |
1171 {} |
1102 Item( ENSmlAccessPoint )->iWapAPInUse = ETrue; |
1172 // convert internet ap to Wap ap |
1103 } |
1173 TRAP( err, aId = aputils->WapIdFromIapIdL( aId ) ); |
1104 if(err == KErrNone)//connection method exists |
1174 CleanupStack::PopAndDestroy( aputils ); |
1105 { |
1175 |
1106 CleanupStack::PopAndDestroy( 2 );//conn, cmManager |
1176 if ( err != KErrNone ) |
1107 } |
1177 { |
1108 else |
1178 CleanupStack::PopAndDestroy( commDb ); |
1109 CleanupStack::PopAndDestroy( 1 ); |
1179 return; |
1110 |
1180 } |
1111 } |
1181 |
|
1182 TInt apBearerFilter; |
|
1183 |
|
1184 if ( FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ) ) |
|
1185 { |
|
1186 apBearerFilter = EApBearerTypeCSD | |
|
1187 EApBearerTypeGPRS | |
|
1188 EApBearerTypeHSCSD | |
|
1189 EApBearerTypeWLAN; |
|
1190 } |
|
1191 else |
|
1192 { |
|
1193 apBearerFilter = EApBearerTypeGPRS | EApBearerTypeWLAN; |
|
1194 } |
|
1195 CApSelect* selector = CApSelect::NewLC( |
|
1196 *commDb, |
|
1197 KEApIspTypeAll, |
|
1198 apBearerFilter, |
|
1199 KEApSortUidAscending); |
|
1200 |
|
1201 TBool found = EFalse; |
|
1202 |
|
1203 // find access point with id aId |
|
1204 if (selector->MoveToFirst()) |
|
1205 { |
|
1206 if (aId == (TInt)selector->Uid()) |
|
1207 { |
|
1208 found = ETrue; |
|
1209 } |
|
1210 while (!found && selector->MoveNext()) |
|
1211 { |
|
1212 if (aId == (TInt)selector->Uid()) |
|
1213 { |
|
1214 found = ETrue; |
|
1215 } |
|
1216 } |
|
1217 } |
|
1218 |
|
1219 if (found) |
|
1220 { |
|
1221 Item( ENSmlAccessPoint )->SetValue( selector->Name() ); |
|
1222 Item( ENSmlAccessPoint )->iNumberData = aId; |
|
1223 Item( ENSmlAccessPoint )->iWapAPInUse = ETrue; |
|
1224 } |
|
1225 else |
|
1226 { |
|
1227 HBufC* emptyText = |
|
1228 iEikonEnv->AllocReadResourceLC(R_CMMANAGERUI_SETT_DEFAULT_CONNECTION); |
|
1229 Item( ENSmlAccessPoint )->SetValue( emptyText->Des() ); |
|
1230 Item( ENSmlAccessPoint )->iNumberData = KErrNotFound; |
|
1231 CleanupStack::PopAndDestroy(emptyText); |
|
1232 } |
|
1233 |
|
1234 CleanupStack::PopAndDestroy(selector); |
|
1235 CleanupStack::PopAndDestroy(commDb); |
|
1236 |
|
1237 } |
|
1238 |
1112 |
1239 // ----------------------------------------------------------------------------- |
1113 // ----------------------------------------------------------------------------- |
1240 // CNSmlDMDlgProfileView::EditSettingItemListYesNoL |
1114 // CNSmlDMDlgProfileView::EditSettingItemListYesNoL |
1241 // ----------------------------------------------------------------------------- |
1115 // ----------------------------------------------------------------------------- |
1242 // |
1116 // |