Changeset 287
- Timestamp:
- 09/27/08 03:46:42 PM (3 months ago)
- Location:
- branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail
- Files:
-
- 3 modified
-
conf/GlobalConfig.java (modified) (5 diffs)
-
mail/smtp/SmtpClient.java (modified) (1 diff)
-
ui/GlobalConfigScreen.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail/conf/GlobalConfig.java
r191 r287 60 60 /** Hide deleted messages */ 61 61 private boolean hideDeletedMsg; 62 /** Local host name override */ 63 private String localHostname; 62 64 63 65 /** WiFi support is disabled, best for non-WiFi devices */ … … 90 92 this.wifiMode = GlobalConfig.WIFI_DISABLED; 91 93 this.hideDeletedMsg = true; 94 this.localHostname = ""; 92 95 } 93 96 … … 155 158 this.hideDeletedMsg = hideDeletedMsg; 156 159 } 157 160 161 public String getLocalHostname() { 162 return this.localHostname; 163 } 164 165 public void setLocalHostname(String localHostname) { 166 this.localHostname = localHostname; 167 } 168 158 169 public void serialize(DataOutputStream output) throws IOException { 159 170 output.writeLong(uniqueId); … … 169 180 table.put("global_connDebug", new Boolean(connDebug)); 170 181 table.put("global_hideDeletedMsg", new Boolean(hideDeletedMsg)); 182 table.put("global_localHostname", localHostname); 171 183 172 184 table.serialize(output); … … 214 226 hideDeletedMsg = ((Boolean)value).booleanValue(); 215 227 } 228 value = table.get("global_localHostname"); 229 if(value != null && value instanceof String) { 230 localHostname = (String)value; 231 } 216 232 } 217 233 -
branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail/mail/smtp/SmtpClient.java
r282 r287 89 89 // Eat the initial server response 90 90 connection.receive(); 91 String hostname = System.getProperty("microedition.hostname"); 92 if(hostname == null) { 93 hostname = connection.getLocalAddress(); 91 92 String hostname = globalConfig.getLocalHostname(); 93 if(hostname.length() == 0) { 94 hostname = System.getProperty("microedition.hostname"); 95 if(hostname == null) { 96 hostname = connection.getLocalAddress(); 97 } 94 98 } 95 99 -
branches/LogicMail-1.0/LogicMail/src/org/logicprobe/LogicMail/ui/GlobalConfigScreen.java
r192 r287 57 57 private CheckboxField fldConnDebug; 58 58 private CheckboxField fldHideDeletedMsg; 59 private CheckboxField fldOverrideHostname; 60 private BasicEditField fldLocalHostname; 59 61 private ButtonField btSave; 62 private String localHostname; 60 63 61 64 public GlobalConfigScreen() { … … 64 67 mailSettings = MailSettings.getInstance(); 65 68 GlobalConfig config = mailSettings.getGlobalConfig(); 66 69 localHostname = config.getLocalHostname(); 70 67 71 add(new RichTextField("Global settings:", Field.NON_FOCUSABLE)); 68 72 … … 100 104 add(fldPopMaxLines); 101 105 106 boolean overrideHostname = localHostname.length() > 0; 107 fldOverrideHostname = new CheckboxField("Override hostname", overrideHostname); 108 fldOverrideHostname.setChangeListener(this); 109 add(fldOverrideHostname); 110 111 if(overrideHostname) { 112 fldLocalHostname = new BasicEditField(" Hostname: ", localHostname); 113 } 114 else { 115 String hostname = System.getProperty("microedition.hostname"); 116 fldLocalHostname = new BasicEditField(" Hostname: ", ((hostname != null) ? hostname : "localhost")); 117 fldLocalHostname.setEditable(false); 118 } 119 add(fldLocalHostname); 120 102 121 fldConnDebug = new CheckboxField("Connection debugging", config.getConnDebug()); 103 122 add(fldConnDebug); … … 113 132 if(field == btSave) { 114 133 onClose(); 134 } 135 else if(field == fldOverrideHostname) { 136 if(fldOverrideHostname.getChecked()) { 137 fldLocalHostname.setText(localHostname); 138 fldLocalHostname.setEditable(true); 139 } 140 else { 141 String hostname = System.getProperty("microedition.hostname"); 142 fldLocalHostname.setText((hostname != null) ? hostname : "localhost"); 143 fldLocalHostname.setEditable(false); 144 } 115 145 } 116 146 } … … 141 171 config.setPopMaxLines(Integer.parseInt(fldPopMaxLines.getText())); 142 172 } catch (Exception e) { } 173 174 if(fldOverrideHostname.getChecked()) { 175 config.setLocalHostname(fldLocalHostname.getText().trim()); 176 } 177 else { 178 config.setLocalHostname(""); 179 } 180 143 181 config.setConnDebug(fldConnDebug.getChecked()); 144 182 mailSettings.saveSettings();
