Changeset 475
- Timestamp:
- 07/27/09 17:36:53 (3 years ago)
- Location:
- branches/LogicMail-1.1/LogicMail
- Files:
-
- 1 added
- 2 edited
-
LogicMail.jdp (modified) (1 diff)
-
src/org/logicprobe/LogicMail/LogicMail_it.rrc (added)
-
src/org/logicprobe/LogicMail/ui/GlobalConfigScreen.java (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/LogicMail-1.1/LogicMail/LogicMail.jdp
r445 r475 51 51 src\org\logicprobe\LogicMail\LogicMail_es.rrc 52 52 src\org\logicprobe\LogicMail\LogicMail_fr.rrc 53 src\org\logicprobe\LogicMail\LogicMail_it.rrc 53 54 src\org\logicprobe\LogicMail\LogicMail_nl.rrc 54 55 src\org\logicprobe\LogicMail\LogicMail_vi.rrc -
branches/LogicMail-1.1/LogicMail/src/org/logicprobe/LogicMail/ui/GlobalConfigScreen.java
r445 r475 8 8 * 9 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer. 11 11 * 2. Redistributions in binary form must reproduce the above copyright 12 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution. 14 14 * 3. Neither the name of the project nor the names of its 15 15 * contributors may be used to endorse or promote products derived … … 29 29 * OF THE POSSIBILITY OF SUCH DAMAGE. 30 30 */ 31 32 31 package org.logicprobe.LogicMail.ui; 33 32 … … 42 41 import net.rim.device.api.ui.component.SeparatorField; 43 42 import net.rim.device.api.ui.text.TextFilter; 43 44 44 import org.logicprobe.LogicMail.LogicMailResource; 45 import org.logicprobe.LogicMail.conf.GlobalConfig; 45 46 import org.logicprobe.LogicMail.conf.MailSettings; 46 import org.logicprobe.LogicMail.conf.GlobalConfig; 47 47 48 48 49 /** 49 50 * Configuration screen 50 51 */ 51 public class GlobalConfigScreen extends BaseCfgScreen implements FieldChangeListener { 52 public class GlobalConfigScreen extends BaseCfgScreen 53 implements FieldChangeListener { 52 54 private MailSettings mailSettings; 53 55 private ObjectChoiceField fldLanguage; … … 65 67 private ButtonField btSave; 66 68 private String localHostname; 67 68 69 private String[] languageChoices; 69 70 private String[] languageCodes; 70 71 71 72 public GlobalConfigScreen() { 72 73 super("LogicMail - " + … … 74 75 75 76 mailSettings = MailSettings.getInstance(); 77 76 78 GlobalConfig config = mailSettings.getGlobalConfig(); 77 79 localHostname = config.getLocalHostname(); 78 79 add(new RichTextField(resources.getString(LogicMailResource.CONFIG_GLOBAL_GLOBAL_SETTINGS), Field.NON_FOCUSABLE)); 80 81 add(new RichTextField(resources.getString( 82 LogicMailResource.CONFIG_GLOBAL_GLOBAL_SETTINGS), 83 Field.NON_FOCUSABLE)); 80 84 81 85 languageChoices = new String[] { 82 86 "BlackBerry", // System default 83 "Dansk", // Danish: da 84 "Deutsch", // German: de 85 "English", // English: en 86 "Español", // Spanish: es 87 "Français", // French: fr 88 "Nederlands", // Dutch: nl 87 "Dansk", // Danish: da 88 "Deutsch", // German: de 89 "English", // English: en 90 "Español", // Spanish: es 91 "Français", // French: fr 92 "Italiano", // Italian: it 93 "Nederlands", // Dutch: nl 89 94 "Ti\u00ea\u0301ng Vi\u00ea\u0323t", // Vietnamese: vi 90 95 "\u4E2D\u6587", // Chinese: zh 91 };96 }; 92 97 languageCodes = new String[] { 93 98 "", // System default … … 97 102 "es", // Spanish 98 103 "fr", // French 104 "it", // Italian 99 105 "nl", // Dutch 100 106 "vi", // Vietnamese 101 107 "zh", // Chinese 102 };103 108 }; 109 104 110 String languageCode = config.getLanguageCode(); 105 111 int languageIndex = 0; 106 if(languageCode != null && languageCode.length() != 0) { 107 for(int i=0; i<languageCodes.length; i++) { 108 if(languageCodes[i].equals(languageCode)) { 112 113 if ((languageCode != null) && (languageCode.length() != 0)) { 114 for (int i = 0; i < languageCodes.length; i++) { 115 if (languageCodes[i].equals(languageCode)) { 109 116 languageIndex = i; 117 110 118 break; 111 119 } 112 120 } 113 121 } 114 115 fldLanguage = new ObjectChoiceField(" " + resources.getString(LogicMailResource.CONFIG_GLOBAL_LANGUAGE), languageChoices, languageIndex); 122 123 fldLanguage = new ObjectChoiceField(" " + 124 resources.getString(LogicMailResource.CONFIG_GLOBAL_LANGUAGE), 125 languageChoices, languageIndex); 116 126 add(fldLanguage); 117 118 fldUnicodeNormalization = new CheckboxField(resources.getString(LogicMailResource.CONFIG_GLOBAL_UNICODE_NORMALIZATION), config.getUnicodeNormalization()); 127 128 fldUnicodeNormalization = new CheckboxField(resources.getString( 129 LogicMailResource.CONFIG_GLOBAL_UNICODE_NORMALIZATION), 130 config.getUnicodeNormalization()); 119 131 add(fldUnicodeNormalization); 120 121 fldRetMsgCount = new BasicEditField(" " + resources.getString(LogicMailResource.CONFIG_GLOBAL_MESSAGE_COUNT) + ' ', 122 Integer.toString(config.getRetMsgCount())); 132 133 fldRetMsgCount = new BasicEditField(" " + 134 resources.getString( 135 LogicMailResource.CONFIG_GLOBAL_MESSAGE_COUNT) + ' ', 136 Integer.toString(config.getRetMsgCount())); 123 137 fldRetMsgCount.setFilter(TextFilter.get(TextFilter.NUMERIC)); 124 138 add(fldRetMsgCount); 125 139 126 String[] orderTypes = { 127 resources.getString(LogicMailResource.MENUITEM_ORDER_ASCENDING), 128 resources.getString(LogicMailResource.MENUITEM_ORDER_DESCENDING) 129 }; 130 if(!config.getDispOrder()) 131 fldDispOrder = new ObjectChoiceField(" " + resources.getString(LogicMailResource.CONFIG_GLOBAL_MESSAGE_ORDER) + ' ', orderTypes, 0); 132 else 133 fldDispOrder = new ObjectChoiceField(" " + resources.getString(LogicMailResource.CONFIG_GLOBAL_MESSAGE_ORDER) + ' ', orderTypes, 1); 140 String[] orderTypes = { 141 resources.getString(LogicMailResource.MENUITEM_ORDER_ASCENDING), 142 resources.getString(LogicMailResource.MENUITEM_ORDER_DESCENDING) 143 }; 144 145 if (!config.getDispOrder()) { 146 fldDispOrder = new ObjectChoiceField(" " + 147 resources.getString( 148 LogicMailResource.CONFIG_GLOBAL_MESSAGE_ORDER) + ' ', 149 orderTypes, 0); 150 } else { 151 fldDispOrder = new ObjectChoiceField(" " + 152 resources.getString( 153 LogicMailResource.CONFIG_GLOBAL_MESSAGE_ORDER) + ' ', 154 orderTypes, 1); 155 } 156 134 157 add(fldDispOrder); 135 158 136 fldHideDeletedMsg = new CheckboxField(resources.getString(LogicMailResource.CONFIG_GLOBAL_HIDE_DELETED_MESSAGES), config.getHideDeletedMsg()); 159 fldHideDeletedMsg = new CheckboxField(resources.getString( 160 LogicMailResource.CONFIG_GLOBAL_HIDE_DELETED_MESSAGES), 161 config.getHideDeletedMsg()); 137 162 add(fldHideDeletedMsg); 138 163 139 String[] wifiModes = { 140 resources.getString(LogicMailResource.MENUITEM_DISABLED), 141 resources.getString(LogicMailResource.MENUITEM_PROMPT), 142 resources.getString(LogicMailResource.MENUITEM_ALWAYS) 143 }; 144 fldWifiMode = new ObjectChoiceField(" " + resources.getString(LogicMailResource.CONFIG_GLOBAL_WIFI_MODE) + ' ', wifiModes, config.getWifiMode()); 164 String[] wifiModes = { 165 resources.getString(LogicMailResource.MENUITEM_DISABLED), 166 resources.getString(LogicMailResource.MENUITEM_PROMPT), 167 resources.getString(LogicMailResource.MENUITEM_ALWAYS) 168 }; 169 fldWifiMode = new ObjectChoiceField(" " + 170 resources.getString(LogicMailResource.CONFIG_GLOBAL_WIFI_MODE) + 171 ' ', wifiModes, config.getWifiMode()); 145 172 add(fldWifiMode); 146 147 add(new RichTextField(resources.getString(LogicMailResource.CONFIG_GLOBAL_IMAP_SETTINGS), Field.NON_FOCUSABLE)); 148 fldImapMaxMsgSize = new BasicEditField(" " + resources.getString(LogicMailResource.CONFIG_ACCOUNT_IMAP_DOWNLOAD_LIMIT) + ' ', Integer.toString(config.getImapMaxMsgSize()/1024)); 173 174 add(new RichTextField(resources.getString( 175 LogicMailResource.CONFIG_GLOBAL_IMAP_SETTINGS), 176 Field.NON_FOCUSABLE)); 177 fldImapMaxMsgSize = new BasicEditField(" " + 178 resources.getString( 179 LogicMailResource.CONFIG_ACCOUNT_IMAP_DOWNLOAD_LIMIT) + 180 ' ', Integer.toString(config.getImapMaxMsgSize() / 1024)); 149 181 fldImapMaxMsgSize.setFilter(TextFilter.get(TextFilter.NUMERIC)); 150 182 add(fldImapMaxMsgSize); 151 152 fldImapMaxFolderDepth = new BasicEditField(" " + resources.getString(LogicMailResource.CONFIG_ACCOUNT_IMAP_FOLDER_LIMIT) + ' ', Integer.toString(config.getImapMaxFolderDepth())); 183 184 fldImapMaxFolderDepth = new BasicEditField(" " + 185 resources.getString( 186 LogicMailResource.CONFIG_ACCOUNT_IMAP_FOLDER_LIMIT) + ' ', 187 Integer.toString(config.getImapMaxFolderDepth())); 153 188 fldImapMaxFolderDepth.setFilter(TextFilter.get(TextFilter.NUMERIC)); 154 189 add(fldImapMaxFolderDepth); 155 190 156 add(new RichTextField(resources.getString(LogicMailResource.CONFIG_GLOBAL_POP_SETTINGS), Field.NON_FOCUSABLE)); 157 fldPopMaxLines = new BasicEditField(" " + resources.getString(LogicMailResource.CONFIG_ACCOUNT_POP_DOWNLOAD_LIMIT) + ' ', Integer.toString(config.getPopMaxLines())); 191 add(new RichTextField(resources.getString( 192 LogicMailResource.CONFIG_GLOBAL_POP_SETTINGS), 193 Field.NON_FOCUSABLE)); 194 fldPopMaxLines = new BasicEditField(" " + 195 resources.getString( 196 LogicMailResource.CONFIG_ACCOUNT_POP_DOWNLOAD_LIMIT) + ' ', 197 Integer.toString(config.getPopMaxLines())); 158 198 fldPopMaxLines.setFilter(TextFilter.get(TextFilter.NUMERIC)); 159 199 add(fldPopMaxLines); 160 200 161 201 boolean overrideHostname = localHostname.length() > 0; 162 fldOverrideHostname = new CheckboxField(resources.getString(LogicMailResource.CONFIG_GLOBAL_OVERRIDE_HOSTNAME), overrideHostname); 202 fldOverrideHostname = new CheckboxField(resources.getString( 203 LogicMailResource.CONFIG_GLOBAL_OVERRIDE_HOSTNAME), 204 overrideHostname); 163 205 fldOverrideHostname.setChangeListener(this); 164 206 add(fldOverrideHostname); 165 166 if(overrideHostname) { 167 fldLocalHostname = new BasicEditField(" " + resources.getString(LogicMailResource.CONFIG_GLOBAL_HOSTNAME) + ' ', localHostname); 168 } 169 else { 207 208 if (overrideHostname) { 209 fldLocalHostname = new BasicEditField(" " + 210 resources.getString( 211 LogicMailResource.CONFIG_GLOBAL_HOSTNAME) + ' ', 212 localHostname); 213 } else { 170 214 String hostname = System.getProperty("microedition.hostname"); 171 fldLocalHostname = new BasicEditField(" " + resources.getString(LogicMailResource.CONFIG_GLOBAL_HOSTNAME) + ' ', ((hostname != null) ? hostname : "localhost")); 215 fldLocalHostname = new BasicEditField(" " + 216 resources.getString( 217 LogicMailResource.CONFIG_GLOBAL_HOSTNAME) + ' ', 218 ((hostname != null) ? hostname : "localhost")); 172 219 fldLocalHostname.setEditable(false); 173 220 } 221 174 222 add(fldLocalHostname); 175 176 fldConnDebug = new CheckboxField(resources.getString(LogicMailResource.CONFIG_GLOBAL_CONNECTION_DEBUGGING), config.getConnDebug()); 223 224 fldConnDebug = new CheckboxField(resources.getString( 225 LogicMailResource.CONFIG_GLOBAL_CONNECTION_DEBUGGING), 226 config.getConnDebug()); 177 227 add(fldConnDebug); 178 228 179 229 add(new SeparatorField()); 180 230 181 btSave = new ButtonField(resources.getString(LogicMailResource.MENUITEM_SAVE), Field.FIELD_HCENTER); 231 btSave = new ButtonField(resources.getString( 232 LogicMailResource.MENUITEM_SAVE), Field.FIELD_HCENTER); 182 233 btSave.setChangeListener(this); 183 234 add(btSave); … … 185 236 186 237 public void fieldChanged(Field field, int context) { 187 if (field == btSave) {238 if (field == btSave) { 188 239 onClose(); 189 } 190 else if(field == fldOverrideHostname) { 191 if(fldOverrideHostname.getChecked()) { 240 } else if (field == fldOverrideHostname) { 241 if (fldOverrideHostname.getChecked()) { 192 242 fldLocalHostname.setText(localHostname); 193 243 fldLocalHostname.setEditable(true); 194 } 195 else { 244 } else { 196 245 String hostname = System.getProperty("microedition.hostname"); 197 fldLocalHostname.setText((hostname != null) ? hostname : "localhost"); 246 fldLocalHostname.setText((hostname != null) ? hostname 247 : "localhost"); 198 248 fldLocalHostname.setEditable(false); 199 249 } … … 205 255 206 256 String languageCode = languageCodes[fldLanguage.getSelectedIndex()]; 207 if(languageCode != null && languageCode.length() != 0) { 257 258 if ((languageCode != null) && (languageCode.length() != 0)) { 208 259 try { 209 260 Locale.setDefault(Locale.get(languageCode)); 210 261 config.setLanguageCode(languageCode); 211 } catch (Exception e) { }212 }213 else {262 } catch (Exception e) { 263 } 264 } else { 214 265 Locale.setDefault(Locale.getDefault()); 215 266 config.setLanguageCode(""); 216 267 } 217 268 218 269 config.setUnicodeNormalization(fldUnicodeNormalization.getChecked()); 219 270 220 271 try { 221 272 config.setRetMsgCount(Integer.parseInt(fldRetMsgCount.getText())); 222 } catch (Exception e) { } 223 224 if(fldDispOrder.getSelectedIndex() == 0) 273 } catch (Exception e) { 274 } 275 276 if (fldDispOrder.getSelectedIndex() == 0) { 225 277 config.setDispOrder(false); 226 else278 } else { 227 279 config.setDispOrder(true); 280 } 228 281 229 282 config.setHideDeletedMsg(fldHideDeletedMsg.getChecked()); … … 232 285 233 286 try { 234 config.setImapMaxMsgSize(Integer.parseInt(fldImapMaxMsgSize.getText())*1024); 235 } catch (Exception e) { } 287 config.setImapMaxMsgSize(Integer.parseInt( 288 fldImapMaxMsgSize.getText()) * 1024); 289 } catch (Exception e) { 290 } 291 236 292 try { 237 config.setImapMaxFolderDepth(Integer.parseInt(fldImapMaxFolderDepth.getText())); 238 } catch (Exception e) { } 293 config.setImapMaxFolderDepth(Integer.parseInt( 294 fldImapMaxFolderDepth.getText())); 295 } catch (Exception e) { 296 } 297 239 298 try { 240 299 config.setPopMaxLines(Integer.parseInt(fldPopMaxLines.getText())); 241 } catch (Exception e) { } 242 243 if(fldOverrideHostname.getChecked()) { 300 } catch (Exception e) { 301 } 302 303 if (fldOverrideHostname.getChecked()) { 244 304 config.setLocalHostname(fldLocalHostname.getText().trim()); 245 } 246 else { 305 } else { 247 306 config.setLocalHostname(""); 248 307 } 249 308 250 309 config.setConnDebug(fldConnDebug.getChecked()); 251 310 mailSettings.saveSettings();
Note: See TracChangeset
for help on using the changeset viewer.
