- Timestamp:
- 05/30/09 17:10:16 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/CompositionScreen.java
r439 r446 46 46 import org.logicprobe.LogicMail.conf.AccountConfig; 47 47 import org.logicprobe.LogicMail.conf.IdentityConfig; 48 import org.logicprobe.LogicMail.conf.MailSettings; 48 49 import org.logicprobe.LogicMail.message.Message; 49 50 import org.logicprobe.LogicMail.message.MessageContent; … … 63 64 import org.logicprobe.LogicMail.model.MessageNodeListener; 64 65 import org.logicprobe.LogicMail.util.EventObjectRunnable; 66 import org.logicprobe.LogicMail.util.UnicodeNormalizer; 65 67 66 68 … … 76 78 private AccountNode accountNode; 77 79 private AccountConfig accountConfig; 80 private UnicodeNormalizer unicodeNormalizer; 78 81 79 82 private BorderedFieldManager recipientsFieldManager; … … 129 132 this.accountConfig = accountNode.getAccountConfig(); 130 133 this.identityConfig = accountConfig.getIdentityConfig(); 134 if(MailSettings.getInstance().getGlobalConfig().getUnicodeNormalization()) { 135 unicodeNormalizer = UnicodeNormalizer.getInstance(); 136 } 131 137 132 138 initFields(); … … 155 161 this.accountConfig = accountNode.getAccountConfig(); 156 162 this.identityConfig = accountConfig.getIdentityConfig(); 163 if(MailSettings.getInstance().getGlobalConfig().getUnicodeNormalization()) { 164 unicodeNormalizer = UnicodeNormalizer.getInstance(); 165 } 157 166 158 167 initFields(); … … 217 226 if(content instanceof TextContent) { 218 227 messageEditField.insert("\r\n"); 219 messageEditField.insert( ((TextContent)content).getText());228 messageEditField.insert(normalize(((TextContent)content).getText())); 220 229 messageEditField.setCursorPosition(0); 221 230 } … … 223 232 224 233 // Set the subject 225 subjectEditField.setText( message.getSubject());234 subjectEditField.setText(normalize(message.getSubject())); 226 235 227 236 // Set the recipients … … 229 238 if (recipients != null) { 230 239 for (i = 0; i < recipients.length; i++) { 231 insertRecipientField(EmailAddressBookEditField.ADDRESS_TO).setText( recipients[i].toString());240 insertRecipientField(EmailAddressBookEditField.ADDRESS_TO).setText(normalize(recipients[i].toString())); 232 241 } 233 242 } … … 236 245 if (recipients != null) { 237 246 for (i = 0; i < recipients.length; i++) { 238 insertRecipientField(EmailAddressBookEditField.ADDRESS_CC).setText( recipients[i].toString());247 insertRecipientField(EmailAddressBookEditField.ADDRESS_CC).setText(normalize(recipients[i].toString())); 239 248 } 240 249 } … … 243 252 if (recipients != null) { 244 253 for (i = 0; i < recipients.length; i++) { 245 insertRecipientField(EmailAddressBookEditField.ADDRESS_BCC).setText( recipients[i].toString());254 insertRecipientField(EmailAddressBookEditField.ADDRESS_BCC).setText(normalize(recipients[i].toString())); 246 255 } 247 256 } … … 263 272 264 273 private void initFields() { 265 266 274 recipientsFieldManager = new BorderedFieldManager( 267 275 Manager.NO_HORIZONTAL_SCROLL … … 566 574 return super.keyChar(key, status, time); 567 575 } 576 577 /** 578 * Run the Unicode normalizer on the provide string, 579 * only if normalization is enabled in the configuration. 580 * If normalization is disabled, this method returns 581 * the input unmodified. 582 * 583 * @param input Input string 584 * @return Normalized string 585 */ 586 private String normalize(String input) { 587 if(unicodeNormalizer == null) { 588 return input; 589 } 590 else { 591 return unicodeNormalizer.normalize(input); 592 } 593 } 568 594 }
Note: See TracChangeset
for help on using the changeset viewer.
