Changeset 608
- Timestamp:
- 01/15/10 22:13:25 (2 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 14 edited
-
LogicMail/res/org/logicprobe/LogicMail/LogicMail.rrc (modified) (4 diffs)
-
LogicMail/res/org/logicprobe/LogicMail/LogicMail.rrh (modified) (1 diff)
-
LogicMail/src/org/logicprobe/LogicMail/conf/ConnectionConfig.java (modified) (7 diffs)
-
LogicMail/src/org/logicprobe/LogicMail/conf/GlobalConfig.java (modified) (10 diffs)
-
LogicMail/src/org/logicprobe/LogicMail/mail/imap/ImapClient.java (modified) (4 diffs)
-
LogicMail/src/org/logicprobe/LogicMail/mail/pop/PopClient.java (modified) (4 diffs)
-
LogicMail/src/org/logicprobe/LogicMail/mail/smtp/SmtpClient.java (modified) (4 diffs)
-
LogicMail/src/org/logicprobe/LogicMail/ui/AccountConfigScreen.java (modified) (10 diffs)
-
LogicMail/src/org/logicprobe/LogicMail/ui/AccountConfigWizard.java (modified) (11 diffs)
-
LogicMail/src/org/logicprobe/LogicMail/ui/GlobalConfigScreen.java (modified) (8 diffs)
-
LogicMail/src/org/logicprobe/LogicMail/ui/OutgoingConfigScreen.java (modified) (6 diffs)
-
LogicMail/src/org/logicprobe/LogicMail/util/Connection.java (modified) (20 diffs)
-
LogicMail/src/org/logicprobe/LogicMail/util/ConnectionBB42.java (added)
-
LogicMail/src/org/logicprobe/LogicMail/util/UtilFactory.java (added)
-
LogicMail/src/org/logicprobe/LogicMail/util/UtilFactoryBB42.java (added)
-
LogicMailTests/src/org/logicprobe/LogicMail/conf/AccountConfigTest.java (modified) (3 diffs)
-
LogicMailTests/src/org/logicprobe/LogicMail/conf/GlobalConfigTest.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail.rrc
r599 r608 31 31 CONFIG_ACCOUNT_SERVER#0="Server:"; 32 32 CONFIG_ACCOUNT_TITLE#0="Account"; 33 CONFIG_ACCOUNT_TRANSPORT_USE_GLOBAL#0="Use global"; 33 34 CONFIG_ACCOUNT_USEMDSPROXY#0="Use MDS proxy"; 34 35 CONFIG_ACCOUNT_USERNAME#0="Username:"; 35 36 CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="Connection debugging"; 37 CONFIG_GLOBAL_ENABLE_WIFI#0="Use WiFi if available"; 36 38 CONFIG_GLOBAL_HIDE_DELETED_MESSAGES#0="Hide deleted messages"; 37 39 CONFIG_GLOBAL_HOSTNAME#0="Hostname:"; … … 45 47 CONFIG_GLOBAL_MESSAGE_FORMAT_PLAIN_TEXT#0="Plain Text"; 46 48 CONFIG_GLOBAL_MESSAGE_ORDER#0="Message order:"; 49 CONFIG_GLOBAL_NETWORK_TRANSPORT#0="Connection method:"; 47 50 CONFIG_GLOBAL_OVERRIDE_HOSTNAME#0="Override hostname"; 48 51 CONFIG_GLOBAL_SECTION_MESSAGE_DISPLAY#0="Message display"; … … 51 54 CONFIG_GLOBAL_SETTINGS#0="Global settings"; 52 55 CONFIG_GLOBAL_TITLE#0="Global"; 56 CONFIG_GLOBAL_TRANSPORT_AUTO#0="Auto"; 57 CONFIG_GLOBAL_TRANSPORT_DIRECT_TCP#0="Direct TCP"; 58 CONFIG_GLOBAL_TRANSPORT_MDS#0="MDS"; 59 CONFIG_GLOBAL_TRANSPORT_WAP2#0="WAP 2.0"; 53 60 CONFIG_GLOBAL_UNICODE_NORMALIZATION#0="Unicode normalization"; 54 61 CONFIG_GLOBAL_WIFI_MODE#0="WiFi mode:"; … … 69 76 EMAILADDRESSBOOKEDIT_ALERT_NO_ADDRESS#0="The selected contact has no email address!"; 70 77 EMAILADDRESSBOOKEDIT_WHICH_ADDRESS#0="Which address?"; 78 ERROR_UNABLE_TO_OPEN_CONNECTION#0="Unable to open connection"; 71 79 ERROR_UNKNOWN#0="Unknown error"; 72 80 FILESAVEDIALOG_NAME#0="Name:"; -
trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail.rrh
r599 r608 194 194 MESSAGE_NO_ACCOUNTS_HAVE_SENDERS#0=195; 195 195 CONFIG_ACCOUNT_IMAP_ONLY_SUBSCRIBED_FOLDERS#0=196; 196 CONFIG_GLOBAL_NETWORK_TRANSPORT#0=197; 197 CONFIG_GLOBAL_ENABLE_WIFI#0=198; 198 CONFIG_GLOBAL_TRANSPORT_AUTO#0=199; 199 CONFIG_GLOBAL_TRANSPORT_DIRECT_TCP#0=200; 200 CONFIG_GLOBAL_TRANSPORT_MDS#0=201; 201 CONFIG_GLOBAL_TRANSPORT_WAP2#0=202; 202 CONFIG_ACCOUNT_TRANSPORT_USE_GLOBAL#0=203; 203 ERROR_UNABLE_TO_OPEN_CONNECTION#0=204; -
trunk/LogicMail/src/org/logicprobe/LogicMail/conf/ConnectionConfig.java
r518 r608 35 35 import java.io.DataOutput; 36 36 import java.io.IOException; 37 37 38 import org.logicprobe.LogicMail.util.Serializable; 38 39 import org.logicprobe.LogicMail.util.SerializableHashtable; … … 50 51 private int serverSecurity; 51 52 private int serverPort; 52 private boolean deviceSide; 53 private int transportType; 54 private boolean enableWiFi; 55 56 /** Use the transport specified in the global configuration */ 57 public static final int TRANSPORT_GLOBAL = 0; 58 /** Use the Direct TCP transport */ 59 public static final int TRANSPORT_DIRECT_TCP = 10; 60 /** Use the MDS transport */ 61 public static final int TRANSPORT_MDS = 20; 62 /** Use the WAP 2.0 transport */ 63 public static final int TRANSPORT_WAP2 = 30; 64 /** Automatically select the transport type */ 65 public static final int TRANSPORT_AUTO = 9999; 53 66 54 67 /** Connection is not encrypted */ … … 92 105 serverSecurity = SECURITY_NONE; 93 106 serverPort = 110; 94 deviceSide = false; 107 transportType = TRANSPORT_GLOBAL; 108 enableWiFi = false; 95 109 } 96 110 … … 168 182 169 183 /** 170 * Gets whether the connection is device side. 171 * 172 * @return The device side mode 173 */ 174 public boolean getDeviceSide() { 175 return deviceSide; 176 } 177 178 /** 179 * Sets whether the connection is device side. 180 * 181 * @param deviceSide The new device side mode 182 */ 183 public void setDeviceSide(boolean deviceSide) { 184 this.deviceSide = deviceSide; 185 } 186 184 * Gets the preferred network transport type. 185 * 186 * @return the preferred network transport type 187 */ 188 public int getTransportType() { 189 return transportType; 190 } 191 192 /** 193 * Sets the preferred network transport type. 194 * 195 * @param transportType the new preferred network transport type 196 */ 197 public void setTransportType(int transportType) { 198 this.transportType = transportType; 199 } 200 201 /** 202 * Gets whether to use WiFi if available. 203 * 204 * @return whether to use WiFi if available 205 */ 206 public boolean getEnableWiFi() { 207 return enableWiFi; 208 } 209 210 /** 211 * Sets whether to use WiFi if available. 212 * 213 * @param enableWiFi whether to use WiFi if available 214 */ 215 public void setEnableWiFi(boolean enableWiFi) { 216 this.enableWiFi = enableWiFi; 217 } 218 187 219 /* (non-Javadoc) 188 220 * @see org.logicprobe.LogicMail.util.Serializable#serialize(java.io.DataOutput) 189 221 */ 190 final publicvoid serialize(DataOutput output) throws IOException {222 public final void serialize(DataOutput output) throws IOException { 191 223 output.writeLong(uniqueId); 192 224 SerializableHashtable table = new SerializableHashtable(); … … 198 230 * @see org.logicprobe.LogicMail.util.Serializable#deserialize(java.io.DataInput) 199 231 */ 200 final publicvoid deserialize(DataInput input) throws IOException {232 public final void deserialize(DataInput input) throws IOException { 201 233 setDefaults(); 202 234 uniqueId = input.readLong(); … … 218 250 table.put("account_serverSecurity", new Integer(serverSecurity)); 219 251 table.put("account_serverPort", new Integer(serverPort)); 220 table.put("account_deviceSide", new Boolean(deviceSide)); 252 table.put("account_transportType", new Integer(transportType)); 253 table.put("account_enableWiFi", new Boolean(enableWiFi)); 221 254 } 222 255 … … 247 280 serverPort = ((Integer)value).intValue(); 248 281 } 249 value = table.get("account_deviceSide"); 282 value = table.get("account_transportType"); 283 if(value instanceof Integer) { 284 transportType = ((Integer)value).intValue(); 285 } 286 value = table.get("account_enableWiFi"); 250 287 if(value instanceof Boolean) { 251 deviceSide= ((Boolean)value).booleanValue();288 enableWiFi = ((Boolean)value).booleanValue(); 252 289 } 253 290 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/conf/GlobalConfig.java
r597 r608 49 49 private long uniqueId; 50 50 51 /** WiFi support is disabled, best for non-WiFi devices */52 final public static int WIFI_DISABLED = 0;53 54 /** Prompt for WiFi use whenever establishing a connection */55 final public static int WIFI_PROMPT = 1;56 57 /** Always use WiFi */58 final public static int WIFI_ALWAYS = 2;59 60 51 /** Prefer plain text display for messages */ 61 final public static int MESSAGE_DISPLAY_PLAIN_TEXT = 0; 62 52 public static final int MESSAGE_DISPLAY_PLAIN_TEXT = 0; 63 53 /** Prefer HTML display for messages */ 64 final public staticint MESSAGE_DISPLAY_HTML = 1;54 public static final int MESSAGE_DISPLAY_HTML = 1; 65 55 66 56 /** language code to use for the UI, or null for system default */ 67 57 private String languageCode; 68 69 58 /** true to enable Unicode normalization */ 70 59 private boolean unicodeNormalization; 71 72 60 /** Preferred message display format */ 73 61 private int messageDisplayFormat; 74 75 62 /** Number of message headers to retrieve */ 76 63 private int retMsgCount; 77 78 64 /** True for ascending, false for descending */ 79 65 private boolean dispOrder; 80 81 66 /** Root URL for local file storage */ 82 67 private String localDataLocation = ""; 83 84 /** Mode for WiFi support */85 private int wifiMode;86 68 /** Preferred network transport type */ 69 private int transportType; 70 /** Whether WiFi should be used if available */ 71 private boolean enableWiFi; 87 72 /** Connection debugging */ 88 73 private boolean connDebug; 89 90 74 /** Hide deleted messages */ 91 75 private boolean hideDeletedMsg; 92 93 76 /** Local host name override */ 94 77 private String localHostname; 95 78 96 79 public static String FILE_URL_PREFIX = "file:///"; 97 80 98 81 /** 99 82 * Instantiates a new global configuration. … … 126 109 this.retMsgCount = 30; 127 110 this.dispOrder = false; 128 this.wifiMode = GlobalConfig.WIFI_DISABLED; 111 this.transportType = ConnectionConfig.TRANSPORT_AUTO; 112 this.enableWiFi = true; 129 113 this.hideDeletedMsg = true; 130 114 this.localHostname = ""; … … 245 229 return localDataLocation; 246 230 } 247 248 /** 249 * Gets the WiFi connection mode. 250 * 251 * @return The WiFi connection mode 252 */ 253 public int getWifiMode() { 254 return wifiMode; 255 } 256 257 /** 258 * Sets the WiFi connection mode. 259 * 260 * @param wifiMode The WiFi connection mode 261 */ 262 public void setWifiMode(int wifiMode) { 263 this.wifiMode = wifiMode; 231 232 /** 233 * Gets the preferred network transport type. 234 * 235 * @return the preferred network transport type 236 */ 237 public int getTransportType() { 238 return transportType; 239 } 240 241 /** 242 * Sets the preferred network transport type. 243 * 244 * @param transportType the new preferred network transport type 245 */ 246 public void setTransportType(int transportType) { 247 this.transportType = transportType; 248 } 249 250 /** 251 * Gets whether to use WiFi if available. 252 * 253 * @return whether to use WiFi if available 254 */ 255 public boolean getEnableWiFi() { 256 return enableWiFi; 257 } 258 259 /** 260 * Sets whether to use WiFi if available. 261 * 262 * @param enableWiFi whether to use WiFi if available 263 */ 264 public void setEnableWiFi(boolean enableWiFi) { 265 this.enableWiFi = enableWiFi; 264 266 } 265 267 … … 332 334 table.put("global_dispOrder", new Boolean(dispOrder)); 333 335 table.put("global_localDataLocation", localDataLocation); 334 table.put("global_wifiMode", new Integer(wifiMode)); 336 table.put("global_transportType", new Integer(transportType)); 337 table.put("global_enableWiFi", new Boolean(enableWiFi)); 335 338 table.put("global_connDebug", new Boolean(connDebug)); 336 339 table.put("global_hideDeletedMsg", new Boolean(hideDeletedMsg)); … … 353 356 354 357 value = table.get("global_languageCode"); 355 if(value != null && valueinstanceof String) {358 if(value instanceof String) { 356 359 languageCode = (String)value; 357 360 } 358 359 361 value = table.get("global_unicodeNormalization"); 360 if(value != null && valueinstanceof Boolean) {362 if(value instanceof Boolean) { 361 363 unicodeNormalization = ((Boolean)value).booleanValue(); 362 364 } 363 364 365 value = table.get("global_messageDisplayFormat"); 365 if ( (value != null) &&value instanceof Integer) {366 if (value instanceof Integer) { 366 367 messageDisplayFormat = ((Integer) value).intValue(); 367 368 } 368 369 369 value = table.get("global_retMsgCount"); 370 if ( (value != null) &&value instanceof Integer) {370 if (value instanceof Integer) { 371 371 retMsgCount = ((Integer) value).intValue(); 372 372 } 373 374 373 value = table.get("global_dispOrder"); 375 if ( (value != null) &&value instanceof Boolean) {374 if (value instanceof Boolean) { 376 375 dispOrder = ((Boolean) value).booleanValue(); 377 376 } 378 379 377 value = table.get("global_localDataLocation"); 380 if ( (value != null) &&value instanceof String) {378 if (value instanceof String) { 381 379 setLocalDataLocation((String)value); 382 380 } … … 387 385 } 388 386 } 389 390 value = table.get("global_wifiMode"); 391 if ((value != null) && value instanceof Integer) { 392 wifiMode = ((Integer) value).intValue(); 393 if ((wifiMode < 0) || (wifiMode > 2)) { 394 wifiMode = GlobalConfig.WIFI_DISABLED; 395 } 396 } 397 387 value = table.get("account_transportType"); 388 if(value instanceof Integer) { 389 transportType = ((Integer)value).intValue(); 390 } 391 value = table.get("account_enableWiFi"); 392 if(value instanceof Boolean) { 393 enableWiFi = ((Boolean)value).booleanValue(); 394 } 398 395 value = table.get("global_connDebug"); 399 if ( (value != null) &&value instanceof Boolean) {396 if (value instanceof Boolean) { 400 397 connDebug = ((Boolean) value).booleanValue(); 401 398 } 402 403 399 value = table.get("global_hideDeletedMsg"); 404 if ( (value != null) &&value instanceof Boolean) {400 if (value instanceof Boolean) { 405 401 hideDeletedMsg = ((Boolean) value).booleanValue(); 406 402 } 407 408 403 value = table.get("global_localHostname"); 409 if ( (value != null) &&value instanceof String) {404 if (value instanceof String) { 410 405 localHostname = (String) value; 411 406 } … … 418 413 return uniqueId; 419 414 } 420 415 421 416 /** 422 417 * Checks provided filesystem root to make sure it exists, … … 437 432 fsRoot = fsRoot.substring(p + 1, q + 1); 438 433 } 439 434 440 435 // Add the prefix 441 436 url = FILE_URL_PREFIX + fsRoot; 442 437 443 438 // Append the necessary elements, creating directories as necessary 444 439 if(url.indexOf("Card/") != -1) { … … 447 442 if(!conn.exists()) { conn.mkdir(); } 448 443 url = conn.getURL(); conn.close(); 449 444 450 445 conn = (FileConnection)Connector.open(url + "logicmail/"); 451 446 if(!conn.exists()) { conn.mkdir(); } … … 460 455 if(!conn.exists()) { conn.mkdir(); } 461 456 url = conn.getURL(); conn.close(); 462 457 463 458 conn = (FileConnection)Connector.open(url + "user/"); 464 459 if(!conn.exists()) { conn.mkdir(); } 465 460 url = conn.getURL(); conn.close(); 466 461 467 462 conn = (FileConnection)Connector.open(url + "logicmail/"); 468 463 if(!conn.exists()) { conn.mkdir(); } -
trunk/LogicMail/src/org/logicprobe/LogicMail/mail/imap/ImapClient.java
r599 r608 62 62 import org.logicprobe.LogicMail.message.UnsupportedPart; 63 63 import org.logicprobe.LogicMail.util.Connection; 64 import org.logicprobe.LogicMail.util.UtilFactory; 64 65 import org.logicprobe.LogicMail.util.DataStore; 65 66 import org.logicprobe.LogicMail.util.DataStoreFactory; … … 125 126 public ImapClient(GlobalConfig globalConfig, ImapConfig accountConfig) { 126 127 this.accountConfig = accountConfig; 127 connection = new Connection( 128 accountConfig.getServerName(), 129 accountConfig.getServerPort(), 130 accountConfig.getServerSecurity() == ConnectionConfig.SECURITY_SSL, 131 accountConfig.getDeviceSide()); 128 connection = UtilFactory.getInstance().createConnection(accountConfig); 132 129 imapProtocol = new ImapProtocol(connection); 133 130 username = accountConfig.getServerUser(); … … 152 149 if(!isConnected()) { 153 150 // Rebuild the connection to include new settings 154 connection = new Connection( 155 accountConfig.getServerName(), 156 accountConfig.getServerPort(), 157 accountConfig.getServerSecurity() == ConnectionConfig.SECURITY_SSL, 158 accountConfig.getDeviceSide()); 151 connection = UtilFactory.getInstance().createConnection(accountConfig); 159 152 imapProtocol = new ImapProtocol(connection); 160 153 } … … 257 250 if(configChanged) { 258 251 // Rebuild the connection to include new settings 259 connection = new Connection( 260 accountConfig.getServerName(), 261 accountConfig.getServerPort(), 262 accountConfig.getServerSecurity() == ConnectionConfig.SECURITY_SSL, 263 accountConfig.getDeviceSide()); 252 connection = UtilFactory.getInstance().createConnection(accountConfig); 264 253 imapProtocol = new ImapProtocol(connection); 265 254 configChanged = false; -
trunk/LogicMail/src/org/logicprobe/LogicMail/mail/pop/PopClient.java
r582 r608 58 58 import org.logicprobe.LogicMail.message.MimeMessagePart; 59 59 import org.logicprobe.LogicMail.util.Connection; 60 import org.logicprobe.LogicMail.util.UtilFactory; 60 61 import org.logicprobe.LogicMail.util.MailMessageParser; 61 62 import org.logicprobe.LogicMail.util.StringParser; … … 92 93 this.globalConfig = globalConfig; 93 94 this.accountConfig = accountConfig; 94 connection = new Connection( 95 accountConfig.getServerName(), 96 accountConfig.getServerPort(), 97 accountConfig.getServerSecurity() == ConnectionConfig.SECURITY_SSL, 98 accountConfig.getDeviceSide()); 95 connection = UtilFactory.getInstance().createConnection(accountConfig); 99 96 popProtocol = new PopProtocol(connection); 100 97 username = accountConfig.getServerUser(); … … 123 120 if(!isConnected()) { 124 121 // Rebuild the connection to include new settings 125 connection = new Connection( 126 accountConfig.getServerName(), 127 accountConfig.getServerPort(), 128 accountConfig.getServerSecurity() == ConnectionConfig.SECURITY_SSL, 129 accountConfig.getDeviceSide()); 122 connection = UtilFactory.getInstance().createConnection(accountConfig); 130 123 popProtocol = new PopProtocol(connection); 131 124 } … … 206 199 if(configChanged) { 207 200 // Rebuild the connection to include new settings 208 connection = new Connection( 209 accountConfig.getServerName(), 210 accountConfig.getServerPort(), 211 accountConfig.getServerSecurity() == ConnectionConfig.SECURITY_SSL, 212 accountConfig.getDeviceSide()); 201 connection = UtilFactory.getInstance().createConnection(accountConfig); 213 202 popProtocol = new PopProtocol(connection); 214 203 configChanged = false; -
trunk/LogicMail/src/org/logicprobe/LogicMail/mail/smtp/SmtpClient.java
r481 r608 43 43 import org.logicprobe.LogicMail.message.MessageMimeConverter; 44 44 import org.logicprobe.LogicMail.util.Connection; 45 import org.logicprobe.LogicMail.util.UtilFactory; 45 46 import org.logicprobe.LogicMail.util.MailMessageParser; 46 47 … … 79 80 this.globalConfig = globalConfig; 80 81 this.outgoingConfig = outgoingConfig; 81 connection = new Connection( 82 outgoingConfig.getServerName(), 83 outgoingConfig.getServerPort(), 84 outgoingConfig.getServerSecurity() == ConnectionConfig.SECURITY_SSL, 85 outgoingConfig.getDeviceSide()); 82 connection = UtilFactory.getInstance().createConnection(outgoingConfig); 86 83 smtpProtocol = new SmtpProtocol(connection); 87 84 … … 107 104 if (!isConnected()) { 108 105 // Rebuild the connection to include new settings 109 connection = new Connection( 110 outgoingConfig.getServerName(), 111 outgoingConfig.getServerPort(), 112 outgoingConfig.getServerSecurity() == ConnectionConfig.SECURITY_SSL, 113 outgoingConfig.getDeviceSide()); 106 connection = UtilFactory.getInstance().createConnection(outgoingConfig); 114 107 smtpProtocol = new SmtpProtocol(connection); 115 108 } else { … … 179 172 if (configChanged) { 180 173 // Rebuild the connection to include new settings 181 connection = new Connection( 182 outgoingConfig.getServerName(), 183 outgoingConfig.getServerPort(), 184 outgoingConfig.getServerSecurity() == ConnectionConfig.SECURITY_SSL, 185 outgoingConfig.getDeviceSide()); 174 connection = UtilFactory.getInstance().createConnection(outgoingConfig); 186 175 smtpProtocol = new SmtpProtocol(connection); 187 176 configChanged = false; -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/AccountConfigScreen.java
r601 r608 77 77 private BasicEditField serverUserField; 78 78 private PasswordEditField serverPassField; 79 private CheckboxField useMdsField;80 79 private ObjectChoiceField identityField; 81 80 private ObjectChoiceField outgoingServerField; … … 86 85 private LabelField draftFolderChoiceLabel; 87 86 private LabelField draftFolderChoiceButtonLabel; 87 88 // Advanced settings fields (both) 89 private ObjectChoiceField networkTransportChoiceField; 90 private CheckboxField enableWiFiCheckboxField; 88 91 89 92 // Advanced settings fields (IMAP) … … 155 158 }}; 156 159 157 initFields();158 159 IdentityConfig selectedIdentityConfig = this.accountConfig.getIdentityConfig();160 if(selectedIdentityConfig != null) {161 identityField.setSelectedIndex(selectedIdentityConfig);162 }163 164 OutgoingConfig selectedOutgoingConfig = this.accountConfig.getOutgoingConfig();165 if(selectedOutgoingConfig != null) {166 outgoingServerField.setSelectedIndex(selectedOutgoingConfig);167 }160 initFields(); 161 162 IdentityConfig selectedIdentityConfig = this.accountConfig.getIdentityConfig(); 163 if(selectedIdentityConfig != null) { 164 identityField.setSelectedIndex(selectedIdentityConfig); 165 } 166 167 OutgoingConfig selectedOutgoingConfig = this.accountConfig.getOutgoingConfig(); 168 if(selectedOutgoingConfig != null) { 169 outgoingServerField.setSelectedIndex(selectedOutgoingConfig); 170 } 168 171 } 169 172 … … 254 257 accountConfig.getServerPass(), 255 258 256, TextField.NO_NEWLINE); 256 useMdsField = new CheckboxField(257 resources.getString(LogicMailResource.CONFIG_ACCOUNT_USEMDSPROXY),258 !accountConfig.getDeviceSide());259 259 identityField = new ObjectChoiceField( 260 260 resources.getString(LogicMailResource.CONFIG_ACCOUNT_IDENTITY) + ' ', … … 270 270 manager.add(serverUserField); 271 271 manager.add(serverPassField); 272 manager.add(useMdsField);273 272 manager.add(new LabelField()); 274 273 manager.add(identityField); 275 274 manager.add(outgoingServerField); 276 275 manager.add(new LabelField()); 276 277 277 return manager; 278 278 } … … 303 303 private Manager initFieldsAdvanced() { 304 304 Manager manager = new VerticalFieldManager(); 305 306 String[] transportChoices = { 307 resources.getString(LogicMailResource.CONFIG_ACCOUNT_TRANSPORT_USE_GLOBAL), 308 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_AUTO), 309 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_DIRECT_TCP), 310 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_MDS), 311 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_WAP2) 312 }; 313 networkTransportChoiceField = new ObjectChoiceField( 314 resources.getString(LogicMailResource.CONFIG_GLOBAL_NETWORK_TRANSPORT), 315 transportChoices, 316 getTransportChoice(accountConfig.getTransportType())); 317 networkTransportChoiceField.setChangeListener(fieldChangeListener); 318 319 enableWiFiCheckboxField = new CheckboxField( 320 resources.getString(LogicMailResource.CONFIG_GLOBAL_ENABLE_WIFI), 321 accountConfig.getEnableWiFi()); 322 if(networkTransportChoiceField.getSelectedIndex() == 0) { 323 enableWiFiCheckboxField.setChecked(false); 324 enableWiFiCheckboxField.setEditable(false); 325 } 326 327 manager.add(networkTransportChoiceField); 328 manager.add(enableWiFiCheckboxField); 329 305 330 if(accountConfig instanceof ImapConfig) { 306 331 ImapConfig imapConfig = (ImapConfig)accountConfig; … … 368 393 } 369 394 } 395 else if(field == networkTransportChoiceField) { 396 if(networkTransportChoiceField.getSelectedIndex() == 0) { 397 enableWiFiCheckboxField.setChecked(false); 398 enableWiFiCheckboxField.setEditable(false); 399 } 400 else { 401 enableWiFiCheckboxField.setChecked(true); 402 enableWiFiCheckboxField.setEditable(true); 403 } 404 } 370 405 } 371 406 … … 457 492 } 458 493 494 private static int getTransportChoice(int transportSetting) { 495 int result; 496 switch(transportSetting) { 497 case ConnectionConfig.TRANSPORT_GLOBAL: 498 result = 0; 499 break; 500 case ConnectionConfig.TRANSPORT_AUTO: 501 result = 1; 502 break; 503 case ConnectionConfig.TRANSPORT_DIRECT_TCP: 504 result = 2; 505 break; 506 case ConnectionConfig.TRANSPORT_MDS: 507 result = 3; 508 break; 509 case ConnectionConfig.TRANSPORT_WAP2: 510 result = 4; 511 break; 512 default: 513 result = 0; 514 break; 515 } 516 return result; 517 } 518 519 private static int getTransportSetting(int transportChoice) { 520 int result; 521 switch(transportChoice) { 522 case 0: 523 result = ConnectionConfig.TRANSPORT_GLOBAL; 524 break; 525 case 1: 526 result = ConnectionConfig.TRANSPORT_AUTO; 527 break; 528 case 2: 529 result = ConnectionConfig.TRANSPORT_DIRECT_TCP; 530 break; 531 case 3: 532 result = ConnectionConfig.TRANSPORT_MDS; 533 break; 534 case 4: 535 result = ConnectionConfig.TRANSPORT_WAP2; 536 break; 537 default: 538 result = ConnectionConfig.TRANSPORT_GLOBAL; 539 break; 540 } 541 return result; 542 } 543 459 544 /** 460 545 * Determines if this screen is dirty. … … 510 595 this.accountConfig.setServerUser(serverUserField.getText()); 511 596 this.accountConfig.setServerPass(serverPassField.getText()); 512 this.accountConfig.setDeviceSide(!useMdsField.getChecked());513 597 514 598 IdentityConfig selectedIdentityConfig = (IdentityConfig)identityField.getChoice(identityField.getSelectedIndex()); … … 535 619 this.accountConfig.setDraftMailbox(selectedDraftFolder); 536 620 621 this.accountConfig.setTransportType(getTransportSetting(networkTransportChoiceField.getSelectedIndex())); 622 this.accountConfig.setEnableWiFi(enableWiFiCheckboxField.getChecked()); 623 537 624 if(accountConfig instanceof ImapConfig) { 538 625 ImapConfig imapConfig = (ImapConfig)accountConfig; -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/AccountConfigWizard.java
r606 r608 17 17 import net.rim.device.api.ui.component.BasicEditField; 18 18 import net.rim.device.api.ui.component.PasswordEditField; 19 import net.rim.device.api.ui.component.CheckboxField;20 19 import net.rim.device.api.ui.component.ObjectChoiceField; 21 20 import net.rim.device.api.ui.component.LabelField; … … 76 75 }}; 77 76 78 identityChoiceField = new ObjectChoiceField(79 resources.getString(LogicMailResource.WIZARD_SCREEN_NEW_ACCOUNT_SELECT_IDENTITY),80 identityChoices, 0);81 identityChoiceField.setChangeListener(fieldChangeListener);82 83 identityNameEditField = new EditField(resources.getString(LogicMailResource.WIZARD_SCREEN_NEW_ACCOUNT_IDENTITY) + ' ', "");84 identityNameEditField.setChangeListener(fieldChangeListener);85 86 nameEditField = new EditField(resources.getString(LogicMailResource.WIZARD_SCREEN_NEW_ACCOUNT_YOUR_NAME) + ' ', "");87 nameEditField.setChangeListener(fieldChangeListener);88 89 emailAddressEditField = new EmailAddressEditField(resources.getString(LogicMailResource.WIZARD_SCREEN_NEW_ACCOUNT_EMAIL_ADDRESS) + ' ', "");90 emailAddressEditField.setChangeListener(fieldChangeListener);91 92 commentsField = new RichTextField(resources.getString(LogicMailResource.WIZARD_SCREEN_NEW_ACCOUNT_COMMENTS));93 commentsField.setFont(this.getFont().derive(Font.ITALIC));94 95 add(identityChoiceField);96 add(identityNameEditField);97 add(nameEditField);98 add(emailAddressEditField);99 add(new LabelField());100 add(commentsField);101 102 populateIdentityItems();103 validateData();77 identityChoiceField = new ObjectChoiceField( 78 resources.getString(LogicMailResource.WIZARD_SCREEN_NEW_ACCOUNT_SELECT_IDENTITY), 79 identityChoices, 0); 80 identityChoiceField.setChangeListener(fieldChangeListener); 81 82 identityNameEditField = new EditField(resources.getString(LogicMailResource.WIZARD_SCREEN_NEW_ACCOUNT_IDENTITY) + ' ', ""); 83 identityNameEditField.setChangeListener(fieldChangeListener); 84 85 nameEditField = new EditField(resources.getString(LogicMailResource.WIZARD_SCREEN_NEW_ACCOUNT_YOUR_NAME) + ' ', ""); 86 nameEditField.setChangeListener(fieldChangeListener); 87 88 emailAddressEditField = new EmailAddressEditField(resources.getString(LogicMailResource.WIZARD_SCREEN_NEW_ACCOUNT_EMAIL_ADDRESS) + ' ', ""); 89 emailAddressEditField.setChangeListener(fieldChangeListener); 90 91 commentsField = new RichTextField(resources.getString(LogicMailResource.WIZARD_SCREEN_NEW_ACCOUNT_COMMENTS)); 92 commentsField.setFont(this.getFont().derive(Font.ITALIC)); 93 94 add(identityChoiceField); 95 add(identityNameEditField); 96 add(nameEditField); 97 add(emailAddressEditField); 98 add(new LabelField()); 99 add(commentsField); 100 101 populateIdentityItems(); 102 validateData(); 104 103 } 105 104 … … 235 234 private ObjectChoiceField securityChoiceField; 236 235 private BasicEditField portEditField; 237 private CheckboxField useMdsCheckboxField;238 236 239 237 protected void initFields() { … … 243 241 }}; 244 242 245 descriptionLabelField = new LabelField(resources.getString(LogicMailResource.WIZARD_SCREEN_MAIL_SERVER_QUESTION)); 246 247 nameEditField = new HostnameEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_SERVER) + ' ', ""); 248 nameEditField.setChangeListener(fieldChangeListener); 249 250 securityChoiceField = new ObjectChoiceField( 251 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY), 252 new Object[] { 253 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_NEVER), 254 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_TLS_IF_AVAILABLE), 255 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_TLS), 256 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_SSL)}, 257 ConnectionConfig.SECURITY_NONE); 258 securityChoiceField.setChangeListener(fieldChangeListener); 259 260 portEditField = new BasicEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_PORT) + ' ', Integer.toString(143)); 261 portEditField.setFilter(TextFilter.get(TextFilter.NUMERIC)); 262 portEditField.setChangeListener(fieldChangeListener); 263 264 useMdsCheckboxField = new CheckboxField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_USEMDSPROXY), true); 265 266 add(descriptionLabelField); 267 add(nameEditField); 268 add(securityChoiceField); 269 add(portEditField); 270 add(useMdsCheckboxField); 243 descriptionLabelField = new LabelField(resources.getString(LogicMailResource.WIZARD_SCREEN_MAIL_SERVER_QUESTION)); 244 245 nameEditField = new HostnameEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_SERVER) + ' ', ""); 246 nameEditField.setChangeListener(fieldChangeListener); 247 248 securityChoiceField = new ObjectChoiceField( 249 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY), 250 new Object[] { 251 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_NEVER), 252 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_TLS_IF_AVAILABLE), 253 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_TLS), 254 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_SSL)}, 255 ConnectionConfig.SECURITY_NONE); 256 securityChoiceField.setChangeListener(fieldChangeListener); 257 258 portEditField = new BasicEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_PORT) + ' ', Integer.toString(143)); 259 portEditField.setFilter(TextFilter.get(TextFilter.NUMERIC)); 260 portEditField.setChangeListener(fieldChangeListener); 261 262 add(descriptionLabelField); 263 add(nameEditField); 264 add(securityChoiceField); 265 add(portEditField); 271 266 } 272 267 … … 302 297 accountConfig.setServerSecurity(securityChoiceField.getSelectedIndex()); 303 298 accountConfig.setServerPort(Integer.parseInt(portEditField.getText())); 304 accountConfig.set DeviceSide(!useMdsCheckboxField.getChecked());299 accountConfig.setTransportType(ConnectionConfig.TRANSPORT_GLOBAL); 305 300 } 306 301 }; … … 342 337 private ObjectChoiceField securityChoiceField; 343 338 private BasicEditField portEditField; 344 private CheckboxField useMdsCheckboxField;345 339 346 340 protected void initFields() { … … 359 353 }}; 360 354 361 outgoingChoiceField = new ObjectChoiceField( 362 resources.getString(LogicMailResource.WIZARD_SCREEN_OUTGOING_QUESTION), 363 outgoingChoices, 0); 364 outgoingChoiceField.setChangeListener(fieldChangeListener); 365 366 nameEditField = new HostnameEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_SERVER) + ' ', ""); 367 nameEditField.setChangeListener(fieldChangeListener); 368 369 securityChoiceField = new ObjectChoiceField( 370 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY), 371 new Object[] { 372 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_NEVER), 373 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_TLS_IF_AVAILABLE), 374 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_TLS), 375 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_SSL)}, 376 ConnectionConfig.SECURITY_NONE); 377 securityChoiceField.setChangeListener(fieldChangeListener); 378 379 portEditField = new BasicEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_PORT) + ' ', Integer.toString(25)); 380 portEditField.setFilter(TextFilter.get(TextFilter.NUMERIC)); 381 portEditField.setChangeListener(fieldChangeListener); 382 383 useMdsCheckboxField = new CheckboxField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_USEMDSPROXY), true); 384 385 add(outgoingChoiceField); 386 add(nameEditField); 387 add(securityChoiceField); 388 add(portEditField); 389 add(useMdsCheckboxField); 390 391 populateOutgoingItems(); 392 validateData(); 355 outgoingChoiceField = new ObjectChoiceField( 356 resources.getString(LogicMailResource.WIZARD_SCREEN_OUTGOING_QUESTION), 357 outgoingChoices, 0); 358 outgoingChoiceField.setChangeListener(fieldChangeListener); 359 360 nameEditField = new HostnameEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_SERVER) + ' ', ""); 361 nameEditField.setChangeListener(fieldChangeListener); 362 363 securityChoiceField = new ObjectChoiceField( 364 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY), 365 new Object[] { 366 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_NEVER), 367 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_TLS_IF_AVAILABLE), 368 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_TLS), 369 resources.getString(LogicMailResource.CONFIG_ACCOUNT_SECURITY_SSL)}, 370 ConnectionConfig.SECURITY_NONE); 371 securityChoiceField.setChangeListener(fieldChangeListener); 372 373 portEditField = new BasicEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_PORT) + ' ', Integer.toString(25)); 374 portEditField.setFilter(TextFilter.get(TextFilter.NUMERIC)); 375 portEditField.setChangeListener(fieldChangeListener); 376 377 add(outgoingChoiceField); 378 add(nameEditField); 379 add(securityChoiceField); 380 add(portEditField); 381 382 populateOutgoingItems(); 383 validateData(); 393 384 } 394 385 … … 424 415 securityChoiceField.setSelectedIndex(outgoingConfig.getServerSecurity()); 425 416 portEditField.setText(Integer.toString(outgoingConfig.getServerPort())); 426 useMdsCheckboxField.setChecked(!outgoingConfig.getDeviceSide());427 417 428 418 nameEditField.setEditable(false); 429 419 securityChoiceField.setEditable(false); 430 420 portEditField.setEditable(false); 431 useMdsCheckboxField.setEditable(false);432 421 } 433 422 else { … … 435 424 securityChoiceField.setSelectedIndex(ConnectionConfig.SECURITY_NONE); 436 425 portEditField.setText("25"); 437 useMdsCheckboxField.setChecked(true);438 426 439 427 nameEditField.setEditable(true); 440 428 securityChoiceField.setEditable(true); 441 429 portEditField.setEditable(true); 442 useMdsCheckboxField.setEditable(true);443 430 } 444 431 } … … 465 452 outgoingConfig.setServerSecurity(securityChoiceField.getSelectedIndex()); 466 453 outgoingConfig.setServerPort(Integer.parseInt(portEditField.getText())); 467 outgoingConfig.set DeviceSide(!useMdsCheckboxField.getChecked());454 outgoingConfig.setTransportType(ConnectionConfig.TRANSPORT_GLOBAL); 468 455 outgoingCreated = true; 469 456 } … … 488 475 }}; 489 476 490 descriptionLabelField = new LabelField(resources.getString(LogicMailResource.WIZARD_SCREEN_OUTGOING_AUTHENTICATION_QUESTION));491 492 String authTypes[] = {493 resources.getString(LogicMailResource.MENUITEM_NONE),494 "PLAIN", "LOGIN", "CRAM-MD5" };495 authChoiceField =496 new ObjectChoiceField(resources.getString(LogicMailResource.CONFIG_OUTGOING_AUTHENTICATION) + ' ', authTypes, 0);497 authChoiceField.setChangeListener(fieldChangeListener);498 499 userEditField = new BasicEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_USERNAME) + ' ', "");500 501 passEditField = new PasswordEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_PASSWORD) + ' ', "");502 503 commentsSpacerLabel = new LabelField();504 commentsField = new RichTextField(resources.getString(LogicMailResource.WIZARD_SCREEN_OUTGOING_AUTHENTICATION_COMMENTS));505 commentsField.setFont(this.getFont().derive(Font.ITALIC));506 507 add(descriptionLabelField);508 add(authChoiceField);509 setInputValid(true);477 descriptionLabelField = new LabelField(resources.getString(LogicMailResource.WIZARD_SCREEN_OUTGOING_AUTHENTICATION_QUESTION)); 478 479 String authTypes[] = { 480 resources.getString(LogicMailResource.MENUITEM_NONE), 481 "PLAIN", "LOGIN", "CRAM-MD5" }; 482 authChoiceField = 483 new ObjectChoiceField(resources.getString(LogicMailResource.CONFIG_OUTGOING_AUTHENTICATION) + ' ', authTypes, 0); 484 authChoiceField.setChangeListener(fieldChangeListener); 485 486 userEditField = new BasicEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_USERNAME) + ' ', ""); 487 488 passEditField = new PasswordEditField(resources.getString(LogicMailResource.CONFIG_ACCOUNT_PASSWORD) + ' ', ""); 489 490 commentsSpacerLabel = new LabelField(); 491 commentsField = new RichTextField(resources.getString(LogicMailResource.WIZARD_SCREEN_OUTGOING_AUTHENTICATION_COMMENTS)); 492 commentsField.setFont(this.getFont().derive(Font.ITALIC)); 493 494 add(descriptionLabelField); 495 add(authChoiceField); 496 setInputValid(true); 510 497 } 511 498 -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/GlobalConfigScreen.java
r570 r608 42 42 import org.logicprobe.LogicMail.LogicMailResource; 43 43 import org.logicprobe.LogicMail.PlatformInfo; 44 import org.logicprobe.LogicMail.conf.ConnectionConfig; 44 45 import org.logicprobe.LogicMail.conf.GlobalConfig; 45 46 import org.logicprobe.LogicMail.conf.MailSettings; … … 65 66 private ObjectChoiceField displayOrderChoiceField; 66 67 private CheckboxField hideDeletedMessagesCheckboxField; 67 private ObjectChoiceField wifiModeChoiceField; 68 private ObjectChoiceField networkTransportChoiceField; 69 private CheckboxField enableWiFiCheckboxField; 68 70 private ObjectChoiceField localDataLocationChoiceLabel; 69 71 private CheckboxField connectionDebuggingCheckboxField; … … 72 74 73 75 public GlobalConfigScreen() { 74 super( "LogicMail- " +76 super(resources.getString(LogicMailResource.APPNAME) + " - " + 75 77 resources.getString(LogicMailResource.CONFIG_GLOBAL_TITLE)); 76 78 … … 194 196 existingConfig.getHideDeletedMsg()); 195 197 196 String[] wifiModes = { 197 resources.getString(LogicMailResource.MENUITEM_DISABLED), 198 resources.getString(LogicMailResource.MENUITEM_PROMPT), 199 resources.getString(LogicMailResource.MENUITEM_ALWAYS) 198 199 String[] transportChoices = { 200 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_AUTO), 201 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_DIRECT_TCP), 202 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_MDS), 203 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_WAP2) 200 204 }; 201 wifiModeChoiceField = new ObjectChoiceField( 202 resources.getString(LogicMailResource.CONFIG_GLOBAL_WIFI_MODE) + ' ', 203 wifiModes, 204 existingConfig.getWifiMode()); 205 205 networkTransportChoiceField = new ObjectChoiceField( 206 resources.getString(LogicMailResource.CONFIG_GLOBAL_NETWORK_TRANSPORT), 207 transportChoices, 208 getTransportChoice(existingConfig.getTransportType())); 209 210 enableWiFiCheckboxField = new CheckboxField( 211 resources.getString(LogicMailResource.CONFIG_GLOBAL_ENABLE_WIFI), 212 existingConfig.getEnableWiFi()); 213 206 214 localDataLocationChoiceLabel = new ObjectChoiceField( 207 215 resources.getString(LogicMailResource.CONFIG_GLOBAL_LOCAL_DATA_LOCATION) + ' ', … … 231 239 existingConfig.getConnDebug()); 232 240 233 234 241 add(new LabeledSeparatorField( 235 242 resources.getString(LogicMailResource.CONFIG_GLOBAL_SECTION_MESSAGE_DISPLAY), … … 243 250 resources.getString(LogicMailResource.CONFIG_GLOBAL_SECTION_NETWORKING), 244 251 Field.NON_FOCUSABLE | LabeledSeparatorField.TOP_BORDER | LabeledSeparatorField.BOTTOM_BORDER)); 245 add(wifiModeChoiceField); 252 add(networkTransportChoiceField); 253 add(enableWiFiCheckboxField); 246 254 add(overrideHostnameCheckboxField); 247 255 add(localHostnameEditField); … … 256 264 } 257 265 266 private static int getTransportChoice(int transportSetting) { 267 int result; 268 switch(transportSetting) { 269 case ConnectionConfig.TRANSPORT_AUTO: 270 result = 0; 271 break; 272 case ConnectionConfig.TRANSPORT_DIRECT_TCP: 273 result = 1; 274 break; 275 case ConnectionConfig.TRANSPORT_MDS: 276 result = 2; 277 break; 278 case ConnectionConfig.TRANSPORT_WAP2: 279 result = 3; 280 break; 281 default: 282 result = 0; 283 break; 284 } 285 return result; 286 } 287 288 private static int getTransportSetting(int transportChoice) { 289 int result; 290 switch(transportChoice) { 291 case 0: 292 result = ConnectionConfig.TRANSPORT_AUTO; 293 break; 294 case 1: 295 result = ConnectionConfig.TRANSPORT_DIRECT_TCP; 296 break; 297 case 2: 298 result = ConnectionConfig.TRANSPORT_MDS; 299 break; 300 case 3: 301 result = ConnectionConfig.TRANSPORT_WAP2; 302 break; 303 default: 304 result = ConnectionConfig.TRANSPORT_AUTO; 305 break; 306 } 307 return result; 308 } 309 258 310 public void fieldChanged(Field field, int context) { 259 311 if (field == overrideHostnameCheckboxField) { … … 301 353 config.setHideDeletedMsg(hideDeletedMessagesCheckboxField.getChecked()); 302 354 303 config.setWifiMode(wifiModeChoiceField.getSelectedIndex()); 355 config.setTransportType(getTransportSetting(networkTransportChoiceField.getSelectedIndex())); 356 357 config.setEnableWiFi(enableWiFiCheckboxField.getChecked()); 304 358 305 359 int fsRootIndex = localDataLocationChoiceLabel.getSelectedIndex(); -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/OutgoingConfigScreen.java
r595 r608 38 38 import net.rim.device.api.ui.component.CheckboxField; 39 39 import net.rim.device.api.ui.component.Dialog; 40 import net.rim.device.api.ui.component.LabelField; 40 41 import net.rim.device.api.ui.component.ObjectChoiceField; 41 42 import net.rim.device.api.ui.component.PasswordEditField; … … 60 61 private BasicEditField serverUserField; 61 62 private PasswordEditField serverPassField; 62 private CheckboxField useMdsField; 63 private ObjectChoiceField networkTransportChoiceField; 64 private CheckboxField enableWiFiCheckboxField; 63 65 64 66 private boolean acctSaved; … … 134 136 outgoingConfig.getServerPass()); 135 137 136 useMdsField = new CheckboxField( 137 resources.getString(LogicMailResource.CONFIG_ACCOUNT_USEMDSPROXY), 138 !outgoingConfig.getDeviceSide()); 138 String[] transportChoices = { 139 resources.getString(LogicMailResource.CONFIG_ACCOUNT_TRANSPORT_USE_GLOBAL), 140 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_AUTO), 141 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_DIRECT_TCP), 142 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_MDS), 143 resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_WAP2) 144 }; 145 networkTransportChoiceField = new ObjectChoiceField( 146 resources.getString(LogicMailResource.CONFIG_GLOBAL_NETWORK_TRANSPORT), 147 transportChoices, 148 getTransportChoice(outgoingConfig.getTransportType())); 149 networkTransportChoiceField.setChangeListener(new FieldChangeListener() { 150 public void fieldChanged(Field field, int context) { 151 networkTransportChoiceField_FieldChanged(field, context); 152 } 153 }); 154 enableWiFiCheckboxField = new CheckboxField( 155 resources.getString(LogicMailResource.CONFIG_GLOBAL_ENABLE_WIFI), 156 outgoingConfig.getEnableWiFi()); 157 if(networkTransportChoiceField.getSelectedIndex() == 0) { 158 enableWiFiCheckboxField.setChecked(false); 159 enableWiFiCheckboxField.setEditable(false); 160 } 139 161 140 162 headerFieldManager = new BorderedFieldManager(BorderedFieldManager.BOTTOM_BORDER_NONE); … … 148 170 contentFieldManager.add(serverUserField); 149 171 contentFieldManager.add(serverPassField); 150 contentFieldManager.add(useMdsField); 172 contentFieldManager.add(new LabelField()); 173 contentFieldManager.add(networkTransportChoiceField); 174 contentFieldManager.add(enableWiFiCheckboxField); 151 175 152 176 add(headerFieldManager); 153 177 add(contentFieldManager); 154 178 } 155 179 156 180 private void serverSecurityField_FieldChanged(Field field, int context) { 157 181 if(serverSecurityField.getSelectedIndex() == ConnectionConfig.SECURITY_SSL) { … … 176 200 serverPassField.setText(""); 177 201 } 202 } 203 204 private void networkTransportChoiceField_FieldChanged(Field field, int context) { 205 if(networkTransportChoiceField.getSelectedIndex() == 0) { 206 enableWiFiCheckboxField.setChecked(false); 207 enableWiFiCheckboxField.setEditable(false); 208 } 209 else { 210 enableWiFiCheckboxField.setChecked(true); 211 enableWiFiCheckboxField.setEditable(true); 212 } 213 } 214 215 private static int getTransportChoice(int transportSetting) { 216 int result; 217 switch(transportSetting) { 218 case ConnectionConfig.TRANSPORT_GLOBAL: 219 result = 0; 220 break; 221 case ConnectionConfig.TRANSPORT_AUTO: 222 result = 1; 223 break; 224 case ConnectionConfig.TRANSPORT_DIRECT_TCP: 225 result = 2; 226 break; 227 case ConnectionConfig.TRANSPORT_MDS: 228 result = 3; 229 break; 230 case ConnectionConfig.TRANSPORT_WAP2: 231 result = 4; 232 break; 233 default: 234 result = 0; 235 break; 236 } 237 return result; 238 } 239 240 private static int getTransportSetting(int transportChoice) { 241 int result; 242 switch(transportChoice) { 243 case 0: 244 result = ConnectionConfig.TRANSPORT_GLOBAL; 245 break; 246 case 1: 247 result = ConnectionConfig.TRANSPORT_AUTO; 248 break; 249 case 2: 250 result = ConnectionConfig.TRANSPORT_DIRECT_TCP; 251 break; 252 case 3: 253 result = ConnectionConfig.TRANSPORT_MDS; 254 break; 255 case 4: 256 result = ConnectionConfig.TRANSPORT_WAP2; 257 break; 258 default: 259 result = ConnectionConfig.TRANSPORT_GLOBAL; 260 break; 261 } 262 return result; 178 263 } 179 264 … … 206 291 this.outgoingConfig.setServerUser(serverUserField.getText()); 207 292 this.outgoingConfig.setServerPass(serverPassField.getText()); 208 this.outgoingConfig.setDeviceSide(!useMdsField.getChecked()); 293 this.outgoingConfig.setTransportType(getTransportSetting(networkTransportChoiceField.getSelectedIndex())); 294 this.outgoingConfig.setEnableWiFi(enableWiFiCheckboxField.getChecked()); 209 295 this.outgoingConfig.setUseAuth(useAuthField.getSelectedIndex()); 210 296 if(useAuthField.getSelectedIndex() > 0) { -
trunk/LogicMail/src/org/logicprobe/LogicMail/util/Connection.java
r477 r608 61 61 62 62 import net.rim.device.api.crypto.tls.tls10.TLS10Connection; 63 import net.rim.device.api.i18n.ResourceBundle; 63 64 import net.rim.device.api.system.EventLogger; 64 import net.rim.device.api.ui.UiApplication;65 import net.rim.device.api.ui.component.Dialog;66 65 import net.rim.device.api.util.DataBuffer; 67 66 import net.rim.device.cldc.io.ssl.TLSException; 68 67 69 68 import org.logicprobe.LogicMail.AppInfo; 69 import org.logicprobe.LogicMail.LogicMailResource; 70 import org.logicprobe.LogicMail.conf.ConnectionConfig; 70 71 import org.logicprobe.LogicMail.conf.GlobalConfig; 71 72 import org.logicprobe.LogicMail.conf.MailSettings; … … 77 78 import java.io.OutputStream; 78 79 79 import java.util.Vector;80 81 import javax.microedition.io.Connector;82 80 import javax.microedition.io.SocketConnection; 83 81 import javax.microedition.io.StreamConnection; … … 102 100 * is the only way to get rid of compile-time dependencies on these classes. 103 101 */ 104 public class Connection { 102 public abstract class Connection { 103 protected static ResourceBundle resources = ResourceBundle.getBundle(LogicMailResource.BUNDLE_ID, LogicMailResource.BUNDLE_NAME); 104 105 /** Select everything except WiFi */ 106 protected static final int TRANSPORT_AUTO = 0xFE; 107 /** Select WiFi */ 108 protected static final int TRANSPORT_WIFI = 0x01; 109 /** Select Direct TCP */ 110 protected static final int TRANSPORT_DIRECT_TCP = 0x02; 111 /** Select MDS */ 112 protected static final int TRANSPORT_MDS = 0x04; 113 /** Select WAP 2.0 */ 114 protected static final int TRANSPORT_WAP2 = 0x08; 115 105 116 /** 106 117 * Byte array holding carriage return and line feed … … 108 119 private static final byte[] CRLF = new byte[] { 13, 10 }; 109 120 110 /** 111 * Holds a list of open connections 112 */ 113 private static Vector openConnections = new Vector(); 114 private String serverName; 115 private int serverPort; 116 private boolean useSSL; 117 private boolean deviceSide; 121 private static UtilFactory connectionFactory; 122 protected String serverName; 123 protected int serverPort; 124 protected boolean useSSL; 125 protected int transports; 118 126 private StreamConnection socket; 119 127 private String localAddress; 120 pr ivateGlobalConfig globalConfig;128 protected GlobalConfig globalConfig; 121 129 protected InputStream input; 122 130 protected OutputStream output; 123 pr ivateboolean useWiFi;131 protected boolean useWiFi; 124 132 private int fakeAvailable = -1; 125 133 private int bytesSent = 0; 126 134 private int bytesReceived = 0; 127 135 128 136 /** 129 137 * Provides a buffer used for incoming data. … … 136 144 DataBuffer resultBuffer = new DataBuffer(); 137 145 138 public Connection(String serverName, int serverPort, boolean useSSL, 139 boolean deviceSide) { 140 this.serverName = serverName; 141 this.serverPort = serverPort; 142 this.useSSL = useSSL; 143 this.deviceSide = deviceSide; 146 /** 147 * Initializes a new connection object. 148 * 149 * @param connectionConfig Configuration data for the connection 150 */ 151 protected Connection(ConnectionConfig connectionConfig) { 152 this.globalConfig = MailSettings.getInstance().getGlobalConfig(); 153 154 this.serverName = connectionConfig.getServerName(); 155 this.serverPort = connectionConfig.getServerPort(); 156 this.useSSL = (connectionConfig.getServerSecurity() == ConnectionConfig.SECURITY_SSL); 157 158 int transportType; 159 boolean enableWiFi; 160 if(connectionConfig.getTransportType() == ConnectionConfig.TRANSPORT_GLOBAL) { 161 transportType = globalConfig.getTransportType(); 162 enableWiFi = globalConfig.getEnableWiFi(); 163 } 164 else { 165 transportType = connectionConfig.getTransportType(); 166 enableWiFi = connectionConfig.getEnableWiFi(); 167 } 168 169 // Populate the bit-flags for the selected transport types 170 // based on the configuration parameters. 171 switch(transportType) { 172 case ConnectionConfig.TRANSPORT_AUTO: 173 transports = Connection.TRANSPORT_AUTO; 174 break; 175 case ConnectionConfig.TRANSPORT_DIRECT_TCP: 176 transports = Connection.TRANSPORT_DIRECT_TCP; 177 break; 178 case ConnectionConfig.TRANSPORT_MDS: 179 transports = Connection.TRANSPORT_MDS; 180 break; 181 case ConnectionConfig.TRANSPORT_WAP2: 182 transports = Connection.TRANSPORT_WAP2; 183 break; 184 default: 185 // Should only get here in rare cases of invalid configuration 186 // data, so we select full automatic with WiFi. 187 transports = Connection.TRANSPORT_AUTO; 188 enableWiFi = true; 189 break; 190 } 191 if(enableWiFi) { transports |= Connection.TRANSPORT_WIFI; } 192 144 193 this.input = null; 145 194 this.output = null; 146 195 this.socket = null; 147 this.globalConfig = MailSettings.getInstance().getGlobalConfig(); 148 } 149 196 } 197 198 /** 199 * Sets the connection factory reference. 200 * 201 * @param connectionFactory connection factory reference 202 */ 203 static void setConnectionFactory(UtilFactory connectionFactory) { 204 Connection.connectionFactory = connectionFactory; 205 } 206 150 207 /** 151 208 * Opens a connection. … … 155 212 close(); 156 213 } 157 158 synchronized (openConnections) { 159 if (!openConnections.contains(this)) { 160 openConnections.addElement(this); 161 } 162 } 163 164 String protocolStr = (useSSL ? "ssl" : "socket"); 165 166 // This parameter, which allows bypassing the MDS proxy, should probably 167 // be a global user configurable option 168 String paramStr = (deviceSide ? ";deviceside=true" : ""); 169 170 useWiFi = false; 171 172 if (globalConfig.getWifiMode() == GlobalConfig.WIFI_PROMPT) { 173 UiApplication.getUiApplication().invokeAndWait(new Runnable() { 174 public void run() { 175 useWiFi = (Dialog.ask(Dialog.D_YES_NO, 176 "Connect through WiFi?") == Dialog.YES); 177 } 178 }); 179 } else if (globalConfig.getWifiMode() == GlobalConfig.WIFI_ALWAYS) { 180 useWiFi = true; 181 } 182 183 if (useWiFi) { 184 paramStr = paramStr + ";interface=wifi"; 185 } 186 187 String connectStr = protocolStr + "://" + serverName + ":" + 188 serverPort + paramStr; 189 190 if (EventLogger.getMinimumLevel() >= EventLogger.INFORMATION) { 191 String msg = "Opening connection:\r\n" + connectStr + "\r\n"; 192 EventLogger.logEvent(AppInfo.GUID, msg.getBytes(), 193 EventLogger.INFORMATION); 194 } 195 196 socket = (StreamConnection) Connector.open(connectStr, 197 Connector.READ_WRITE, true); 214 215 connectionFactory.addOpenConnection(this); 216 217 socket = openStreamConnection(); 218 if(socket == null) { 219 throw new IOException(resources.getString(LogicMailResource.ERROR_UNABLE_TO_OPEN_CONNECTION)); 220 } 221 198 222 input = socket.openDataInputStream(); 199 223 output = socket.openDataOutputStream(); … … 201 225 bytesSent = 0; 202 226 bytesReceived = 0; 203 227 204 228 if (EventLogger.getMinimumLevel() >= EventLogger.INFORMATION) { 205 229 String msg = "Connection established:\r\n" + "Socket: " + 206 socket.getClass().toString() + "\r\n" + "Local address: " +207 localAddress + "\r\n";230 socket.getClass().toString() + "\r\n" + "Local address: " + 231 localAddress + "\r\n"; 208 232 EventLogger.logEvent(AppInfo.GUID, msg.getBytes(), 209 EventLogger.INFORMATION); 210 } 211 } 233 EventLogger.INFORMATION); 234 } 235 } 236 237 /** 238 * Open a stream connection. 239 * This method should encapsulate all platform-specific logic for opening 240 * network connections. 241 * 242 * @return the stream connection 243 * 244 * @throws IOException Signals that an I/O exception has occurred. 245 */ 246 protected abstract StreamConnection openStreamConnection() throws IOException; 212 247 213 248 /** … … 242 277 } 243 278 244 synchronized (openConnections) { 245 if (openConnections.contains(this)) { 246 openConnections.removeElement(this); 247 } 248 } 279 connectionFactory.removeOpenConnection(this); 249 280 250 281 EventLogger.logEvent(AppInfo.GUID, "Connection closed".getBytes(), 251 EventLogger.INFORMATION); 252 } 253 254 /** 255 * Determine whether open connections exist 256 * 257 * @return True if there are open connections 258 */ 259 public static boolean hasOpenConnections() { 260 boolean result; 261 262 synchronized (openConnections) { 263 result = !openConnections.isEmpty(); 264 } 265 266 return result; 267 } 268 269 /** 270 * Close all open connections 271 */ 272 public static void closeAllConnections() { 273 synchronized (openConnections) { 274 int size = openConnections.size(); 275 276 for (int i = 0; i < size; i++) { 277 try { 278 ((Connection) openConnections.elementAt(i)).close(); 279 } catch (IOException e) { 280 } 281 } 282 283 openConnections.removeAllElements(); 284 } 282 EventLogger.INFORMATION); 285 283 } 286 284 … … 324 322 */ 325 323 public int getBytesSent() { 326 return bytesSent;327 } 328 324 return bytesSent; 325 } 326 329 327 /** 330 328 * Gets the number of bytes that have been received since the … … 338 336 */ 339 337 public int getBytesReceived() { 340 return bytesReceived;341 } 342 338 return bytesReceived; 339 } 340 343 341 /** 344 342 * Sends a string to the server. This method is used internally for … … 360 358 if (globalConfig.getConnDebug()) { 361 359 EventLogger.logEvent(AppInfo.GUID, "[SEND]".getBytes(), 362 EventLogger.DEBUG_INFO);360 EventLogger.DEBUG_INFO); 363 361 } 364 362 … … 386 384 if (globalConfig.getConnDebug()) { 387 385 EventLogger.logEvent(AppInfo.GUID, 388 ("[SEND] " + s.substring(i, j)).getBytes(),389 EventLogger.DEBUG_INFO);386 ("[SEND] " + s.substring(i, j)).getBytes(), 387 EventLogger.DEBUG_INFO); 390 388 } 391 389 … … 420 418 if (globalConfig.getConnDebug()) { 421 419 EventLogger.logEvent(AppInfo.GUID, ("[SEND CMD] " + s).getBytes(), 422 EventLogger.DEBUG_INFO);420 EventLogger.DEBUG_INFO); 423 421 } 424 422 … … 427 425 bytesSent += 2; 428 426 } else { 429 byte[] buf = (s + "\r\n").getBytes();427 byte[] buf = (s + "\r\n").getBytes(); 430 428 output.write(buf); 431 429 bytesSent += buf.length; … … 448 446 if (globalConfig.getConnDebug()) { 449 447 EventLogger.logEvent(AppInfo.GUID, 450 ("[SEND RAW]\r\n" + s).getBytes(), EventLogger.DEBUG_INFO);448 ("[SEND RAW]\r\n" + s).getBytes(), EventLogger.DEBUG_INFO); 451 449 } 452 450 453 451 output.write(buf, 0, buf.length); 454 452 bytesSent += buf.length; 455 453 456 454 output.flush(); 457 455 } … … 530 528 while (true) { 531 529 int actual = input.read(buffer, count, 1); 532 530 533 531 /** 534 532 * If -1 is returned, the InputStream is already closed, … … 539 537 if (actual == -1) { 540 538 EventLogger.logEvent(AppInfo.GUID, 541 "Unable to read from socket, closing connection".getBytes(),542 EventLogger.INFORMATION);539 "Unable to read from socket, closing connection".getBytes(), 540 EventLogger.INFORMATION); 543 541 544 542 try { … … 567 565 // approach which screws up on mid-line LFs. (DK) 568 566 else { 569 bytesReceived += actual;570 567 bytesReceived += actual; 568 571 569 byte b = buffer[count]; 572 570 readBytes++; … … 606 604 if (globalConfig.getConnDebug()) { 607 605 EventLogger.logEvent(AppInfo.GUID, 608 ("[RECV] " + result).getBytes(),609 EventLogger.DEBUG_INFO);606 ("[RECV] " + result).getBytes(), 607 EventLogger.DEBUG_INFO); 610 608 } 611 609 … … 619 617 } 620 618 621 /**622 * Switches the underlying connection to SSL mode, as commonly done after623 * sending a <tt>STARTTLS</tt> command to the server.624 *625 * @throws IOException Signals that an I/O exception has occurred.626 */627 public void startTLS() throws IOException {628 // Shortcut the method if we're already in SSL mode629 if(socket instanceof TLS10Connection) { return; }630 631 try {632 TLS10Connection tlsSocket = new TLS10Connection(633 new StreamConnectionWrapper(634 socket,635 (DataInputStream)input,636 (DataOutputStream)output),637 serverName + ':' + serverPort,638 true);639 640 socket = tlsSocket;641 input = socket.openDataInputStream();642 output = socket.openDataOutputStream();643 } catch (IOException e) {619 /** 620 * Switches the underlying connection to SSL mode, as commonly done after 621 * sending a <tt>STARTTLS</tt> command to the server. 622 * 623 * @throws IOException Signals that an I/O exception has occurred. 624 */ 625 public void startTLS() throws IOException { 626 // Shortcut the method if we're already in SSL mode 627 if(socket instanceof TLS10Connection) { return; } 628 629 try { 630 TLS10Connection tlsSocket = new TLS10Connection( 631 new StreamConnectionWrapper( 632 socket, 633 (DataInputStream)input, 634 (DataOutputStream)output), 635 serverName + ':' + serverPort, 636 true); 637 638 socket = tlsSocket; 639 input = socket.openDataInputStream(); 640 output = socket.openDataOutputStream(); 641 } catch (IOException e) { 644 642 EventLogger.logEvent(AppInfo.GUID, 645 643 ("Unable to switch to TLS mode: " + e.getMessage()).getBytes(), EventLogger.ERROR); 646 644 throw new IOException("Unable to switch to TLS mode"); 647 } catch (TLSException e) {645 } catch (TLSException e) { 648 646 EventLogger.logEvent(AppInfo.GUID, 649 647 ("Unable to switch to TLS mode: " + e.getMessage()).getBytes(), EventLogger.ERROR); 650 648 throw new IOException("Unable to switch to TLS mode"); 651 }652 }653 654 /**655 * Decorator to wrap an existing stream connection so its I/O streams656 * can be reopened without throwing exceptions.657 */658 private static class StreamConnectionWrapper implements StreamConnection {659 private StreamConnection stream;660 private DataInputStream dataInputStream;661 private DataOutputStream dataOutputStream;662 663 public StreamConnectionWrapper(StreamConnection stream, DataInputStream dataInputStream, DataOutputStream dataOutputStream) {664 this.stream = stream;665 this.dataInputStream = dataInputStream;666 this.dataOutputStream = dataOutputStream;667 }668 669 public DataInputStream openDataInputStream() throws IOException {670 return dataInputStream;671 }672 public InputStream openInputStream() throws IOException {673 return dataInputStream;674 }675 public void close() throws IOException {676 stream.close();677 }678 public DataOutputStream openDataOutputStream() throws IOException {679 return dataOutputStream;680 }681 public OutputStream openOutputStream() throws IOException {682 return dataOutputStream;683 }684 }649 } 650 } 651 652 /** 653 * Decorator to wrap an existing stream connection so its I/O streams 654 * can be reopened without throwing exceptions. 655 */ 656 private static class StreamConnectionWrapper implements StreamConnection { 657 private StreamConnection stream; 658 private DataInputStream dataInputStream; 659 private DataOutputStream dataOutputStream; 660 661 public StreamConnectionWrapper(StreamConnection stream, DataInputStream dataInputStream, DataOutputStream dataOutputStream) { 662 this.stream = stream; 663 this.dataInputStream = dataInputStream; 664 this.dataOutputStream = dataOutputStream; 665 } 666 667 public DataInputStream openDataInputStream() throws IOException { 668 return dataInputStream; 669 } 670 public InputStream openInputStream() throws IOException { 671 return dataInputStream; 672 } 673 public void close() throws IOException { 674 stream.close(); 675 } 676 public DataOutputStream openDataOutputStream() throws IOException { 677 return dataOutputStream; 678 } 679 public OutputStream openOutputStream() throws IOException { 680 return dataOutputStream; 681 } 682 } 685 683 } -
trunk/LogicMailTests/src/org/logicprobe/LogicMail/conf/AccountConfigTest.java
r482 r608 96 96 assertEquals("", instance.getServerPass()); 97 97 assertEquals(143, instance.getServerPort()); 98 assertTrue(!instance.getDeviceSide()); 98 assertEquals(ConnectionConfig.TRANSPORT_GLOBAL, instance.getTransportType()); 99 assertTrue(!instance.getEnableWiFi()); 99 100 } 100 101 … … 109 110 instance.setServerPass("12345"); 110 111 instance.setServerPort(995); 111 instance.setDeviceSide(true); 112 instance.setTransportType(ConnectionConfig.TRANSPORT_DIRECT_TCP); 113 instance.setEnableWiFi(true); 112 114 113 115 // Serialize … … 127 129 assertEquals("12345", instance.getServerPass()); 128 130 assertEquals(995, instance.getServerPort()); 129 assertTrue(instance.getDeviceSide()); 131 assertEquals(ConnectionConfig.TRANSPORT_DIRECT_TCP, instance.getTransportType()); 132 assertTrue(instance.getEnableWiFi()); 130 133 } catch (Throwable t) { 131 134 fail("Exception thrown during test: "+t.toString()); -
trunk/LogicMailTests/src/org/logicprobe/LogicMail/conf/GlobalConfigTest.java
r350 r608 93 93 assertEquals(30, instance.getRetMsgCount()); 94 94 assertTrue(!instance.getDispOrder()); 95 assertEquals(0, instance.getWifiMode()); 95 assertEquals(ConnectionConfig.TRANSPORT_AUTO, instance.getTransportType()); 96 assertTrue(instance.getEnableWiFi()); 96 97 assertTrue(instance.getHideDeletedMsg()); 97 98 } … … 103 104 instance.setRetMsgCount(20); 104 105 instance.setDispOrder(true); 105 instance.setWifiMode(1); 106 instance.setTransportType(ConnectionConfig.TRANSPORT_DIRECT_TCP); 107 instance.setEnableWiFi(false); 106 108 instance.setHideDeletedMsg(false); 107 109 … … 118 120 assertEquals(20, instance.getRetMsgCount()); 119 121 assertTrue(instance.getDispOrder()); 120 assertEquals(1, instance.getWifiMode()); 122 assertEquals(ConnectionConfig.TRANSPORT_DIRECT_TCP, instance.getTransportType()); 123 assertTrue(!instance.getEnableWiFi()); 121 124 assertTrue(!instance.getHideDeletedMsg()); 122 125 } catch (Throwable t) {
Note: See TracChangeset
for help on using the changeset viewer.
