Changeset 625


Ignore:
Timestamp:
01/31/10 17:16:45 (2 years ago)
Author:
octorian
Message:

Rewrote the top-level configuration screen to include global items, removed the global configuration screen, and implemented transitions for the configuration screens.

Location:
trunk
Files:
6 added
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail.rrc

    r615 r625  
    3131CONFIG_ACCOUNT_SERVER#0="Server:"; 
    3232CONFIG_ACCOUNT_TITLE#0="Account"; 
    33 CONFIG_ACCOUNT_TRANSPORT_USE_GLOBAL#0="Use global"; 
    34 CONFIG_ACCOUNT_USEMDSPROXY#0="Use MDS proxy"; 
     33CONFIG_ACCOUNT_TRANSPORT_USE_GLOBAL#0="Default"; 
    3534CONFIG_ACCOUNT_USERNAME#0="Username:"; 
    3635CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="Connection debugging"; 
     
    5958CONFIG_GLOBAL_TRANSPORT_WAP2#0="WAP 2.0"; 
    6059CONFIG_GLOBAL_UNICODE_NORMALIZATION#0="Unicode normalization"; 
    61 CONFIG_GLOBAL_WIFI_MODE#0="WiFi mode:"; 
    6260CONFIG_IDENTITIES#0="Identities"; 
    6361CONFIG_IDENTITY_EMAIL_ADDRESS#0="E-Mail address:"; 
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail.rrh

    r615 r625  
    2828CONFIG_ACCOUNT_USERNAME#0=25; 
    2929CONFIG_ACCOUNT_PASSWORD#0=26; 
    30 CONFIG_ACCOUNT_USEMDSPROXY#0=27; 
    3130MENUITEM_SAVE#0=28; 
    3231CONFIG_ACCOUNT_IDENTITY#0=29; 
     
    4948MENUITEM_PROMPT#0=47; 
    5049MENUITEM_ALWAYS#0=48; 
    51 CONFIG_GLOBAL_WIFI_MODE#0=49; 
    5250CONFIG_ACCOUNT_IMAP_DOWNLOAD_LIMIT#0=52; 
    5351CONFIG_ACCOUNT_IMAP_FOLDER_LIMIT#0=53; 
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail_da.rrc

    r545 r625  
    2525CONFIG_ACCOUNT_SERVER#0="Server:"; 
    2626CONFIG_ACCOUNT_TITLE#0="Konto"; 
    27 CONFIG_ACCOUNT_USEMDSPROXY#0="Brug MDS proxy"; 
    2827CONFIG_ACCOUNT_USERNAME#0="Brugernavn:"; 
    2928CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="Fejlsøgning af forbindelse"; 
     
    3837CONFIG_GLOBAL_TITLE#0="Global"; 
    3938CONFIG_GLOBAL_UNICODE_NORMALIZATION#0="Unicode normalisering"; 
    40 CONFIG_GLOBAL_WIFI_MODE#0="WiFi tilstand:"; 
    4139CONFIG_IDENTITIES#0="Identiteter"; 
    4240CONFIG_IDENTITY_EMAIL_ADDRESS#0="E-mail addresse:"; 
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail_de.rrc

    r545 r625  
    2525CONFIG_ACCOUNT_SERVER#0="Server:"; 
    2626CONFIG_ACCOUNT_TITLE#0="Account"; 
    27 CONFIG_ACCOUNT_USEMDSPROXY#0="MDS proxy verwenden"; 
    2827CONFIG_ACCOUNT_USERNAME#0="Benutzername:"; 
    2928CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="Verbindungs-Debugging"; 
     
    3635CONFIG_GLOBAL_SETTINGS#0="Globale Einstellungen"; 
    3736CONFIG_GLOBAL_TITLE#0="Global"; 
    38 CONFIG_GLOBAL_WIFI_MODE#0="WiFi modus:"; 
    3937CONFIG_IDENTITIES#0="Identitäten"; 
    4038CONFIG_IDENTITY_EMAIL_ADDRESS#0="E-Mail Adresse:"; 
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail_es.rrc

    r545 r625  
    2525CONFIG_ACCOUNT_SERVER#0="Servidor:"; 
    2626CONFIG_ACCOUNT_TITLE#0="Cuenta"; 
    27 CONFIG_ACCOUNT_USEMDSPROXY#0="Usar proxy MDS"; 
    2827CONFIG_ACCOUNT_USERNAME#0="Usuario:"; 
    2928CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="Depuración de conexión"; 
     
    3837CONFIG_GLOBAL_TITLE#0="Global"; 
    3938CONFIG_GLOBAL_UNICODE_NORMALIZATION#0="Normalización Unicode"; 
    40 CONFIG_GLOBAL_WIFI_MODE#0="Modo WiFi:"; 
    4139CONFIG_IDENTITIES#0="Identidades"; 
    4240CONFIG_IDENTITY_EMAIL_ADDRESS#0="Dirección de E-Mail:"; 
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail_fr.rrc

    r545 r625  
    2525CONFIG_ACCOUNT_SERVER#0="Serveur:"; 
    2626CONFIG_ACCOUNT_TITLE#0="Compte"; 
    27 CONFIG_ACCOUNT_USEMDSPROXY#0="Utiliser le proxy MDS"; 
    2827CONFIG_ACCOUNT_USERNAME#0="Nom d'utilisateur:"; 
    2928CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="Debugger la connexion"; 
     
    3635CONFIG_GLOBAL_SETTINGS#0="Paramètres Globaux"; 
    3736CONFIG_GLOBAL_TITLE#0="Global"; 
    38 CONFIG_GLOBAL_WIFI_MODE#0="Mode WiFi:"; 
    3937CONFIG_IDENTITIES#0="Identités"; 
    4038CONFIG_IDENTITY_EMAIL_ADDRESS#0="Adresse e-mail:"; 
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail_it.rrc

    r545 r625  
    2525CONFIG_ACCOUNT_SERVER#0="Server:"; 
    2626CONFIG_ACCOUNT_TITLE#0="Profilo"; 
    27 CONFIG_ACCOUNT_USEMDSPROXY#0="Usa MDS proxy"; 
    2827CONFIG_ACCOUNT_USERNAME#0="Nome utente:"; 
    2928CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="Debug connessione"; 
     
    4039CONFIG_GLOBAL_TITLE#0="Globale"; 
    4140CONFIG_GLOBAL_UNICODE_NORMALIZATION#0="Normalizzazione Unicode"; 
    42 CONFIG_GLOBAL_WIFI_MODE#0="Modalità WiFi:"; 
    4341CONFIG_IDENTITIES#0="Identità"; 
    4442CONFIG_IDENTITY_EMAIL_ADDRESS#0="Indirizzo E-Mail:"; 
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail_nl.rrc

    r545 r625  
    2020CONFIG_ACCOUNT_SERVER#0="Server:"; 
    2121CONFIG_ACCOUNT_TITLE#0="Account"; 
    22 CONFIG_ACCOUNT_USEMDSPROXY#0="Gebruik MDS proxy"; 
    2322CONFIG_ACCOUNT_USERNAME#0="Gebruikersnaam:"; 
    2423CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="Verbinding onderzoeken"; 
     
    3130CONFIG_GLOBAL_SETTINGS#0="Algemene instellingen"; 
    3231CONFIG_GLOBAL_TITLE#0="Algemeen"; 
    33 CONFIG_GLOBAL_WIFI_MODE#0="WiFi mode:"; 
    3432CONFIG_IDENTITIES#0="Identiteiten"; 
    3533CONFIG_IDENTITY_EMAIL_ADDRESS#0="E-Mail adres:"; 
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail_vi.rrc

    r545 r625  
    2525CONFIG_ACCOUNT_SERVER#0="Máy chu\u0309:"; 
    2626CONFIG_ACCOUNT_TITLE#0="Tài khoa\u0309n"; 
    27 CONFIG_ACCOUNT_USEMDSPROXY#0="Dùng MDS proxy"; 
    2827CONFIG_ACCOUNT_USERNAME#0="Username:"; 
    2928CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="Connection debugging"; 
     
    3635CONFIG_GLOBAL_SETTINGS#0="Cài \u0111\u0103\u0323t chung"; 
    3736CONFIG_GLOBAL_TITLE#0="Global"; 
    38 CONFIG_GLOBAL_WIFI_MODE#0="Mâ\u0323t khâ\u0309u:"; 
    3937CONFIG_IDENTITIES#0="Các hô\u0300 s\u01A1"; 
    4038CONFIG_IDENTITY_EMAIL_ADDRESS#0="\u0110i\u0323a chi\u0309 E-Mail:"; 
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail_zh.rrc

    r545 r625  
    3030CONFIG_ACCOUNT_SERVER#0="\u670D\u52A1\u5668\uFF1A"; 
    3131CONFIG_ACCOUNT_TITLE#0="\u8D26\u53F7"; 
    32 CONFIG_ACCOUNT_USEMDSPROXY#0="\u4F7F\u7528MDS\u4EE3\u7406\u670D\u52A1\u5668"; 
    3332CONFIG_ACCOUNT_USERNAME#0="\u7528\u6237\u540D\uFF1A"; 
    3433CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="\u8C03\u8BD5\u8FDE\u63A5"; 
     
    4544CONFIG_GLOBAL_TITLE#0="\u5168\u5C40"; 
    4645CONFIG_GLOBAL_UNICODE_NORMALIZATION#0="\u6807\u51C6\u5316Unicode"; 
    47 CONFIG_GLOBAL_WIFI_MODE#0="WiFi\u65B9\u5F0F\uFF1A"; 
    4846CONFIG_IDENTITIES#0="\u6807\u8BC6"; 
    4947CONFIG_IDENTITY_EMAIL_ADDRESS#0="\u90AE\u4EF6\u5730\u5740\uFF1A"; 
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail_zh_CN.rrc

    r545 r625  
    3030CONFIG_ACCOUNT_SERVER#0="\u670D\u52A1\u5668\uFF1A"; 
    3131CONFIG_ACCOUNT_TITLE#0="\u8D26\u53F7"; 
    32 CONFIG_ACCOUNT_USEMDSPROXY#0="\u4F7F\u7528MDS\u4EE3\u7406\u670D\u52A1\u5668"; 
    3332CONFIG_ACCOUNT_USERNAME#0="\u7528\u6237\u540D\uFF1A"; 
    3433CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="\u8C03\u8BD5\u8FDE\u63A5"; 
     
    4544CONFIG_GLOBAL_TITLE#0="\u5168\u5C40"; 
    4645CONFIG_GLOBAL_UNICODE_NORMALIZATION#0="\u6807\u51C6\u5316Unicode"; 
    47 CONFIG_GLOBAL_WIFI_MODE#0="WiFi\u65B9\u5F0F\uFF1A"; 
    4846CONFIG_IDENTITIES#0="\u6807\u8BC6"; 
    4947CONFIG_IDENTITY_EMAIL_ADDRESS#0="\u90AE\u4EF6\u5730\u5740\uFF1A"; 
  • trunk/LogicMail/src/org/logicprobe/LogicMail/ui/ConfigScreen.java

    r624 r625  
    3232package org.logicprobe.LogicMail.ui; 
    3333 
    34 import java.util.Hashtable; 
     34import net.rim.device.api.i18n.Locale; 
     35import net.rim.device.api.system.Bitmap; 
     36import net.rim.device.api.ui.DrawStyle; 
    3537import net.rim.device.api.ui.Field; 
     38import net.rim.device.api.ui.FieldChangeListener; 
    3639import net.rim.device.api.ui.Graphics; 
    3740import net.rim.device.api.ui.Keypad; 
    3841import net.rim.device.api.ui.MenuItem; 
    3942import net.rim.device.api.ui.UiApplication; 
     43import net.rim.device.api.ui.component.BasicEditField; 
     44import net.rim.device.api.ui.component.CheckboxField; 
    4045import net.rim.device.api.ui.component.Dialog; 
     46import net.rim.device.api.ui.component.ListField; 
    4147import net.rim.device.api.ui.component.Menu; 
    42 import net.rim.device.api.ui.component.TreeField; 
    43 import net.rim.device.api.ui.component.TreeFieldCallback; 
     48import net.rim.device.api.ui.component.ObjectChoiceField; 
     49import net.rim.device.api.ui.component.ObjectListField; 
     50import net.rim.device.api.ui.component.TextField; 
     51import net.rim.device.api.ui.container.VerticalFieldManager; 
     52import net.rim.device.api.ui.text.TextFilter; 
    4453 
    4554import org.logicprobe.LogicMail.LogicMailResource; 
     55import org.logicprobe.LogicMail.PlatformInfo; 
    4656import org.logicprobe.LogicMail.conf.AccountConfig; 
    4757import org.logicprobe.LogicMail.conf.ConnectionConfig; 
     
    6171public class ConfigScreen extends AbstractConfigScreen { 
    6272    private MailSettings mailSettings; 
    63     private int globalId; 
    64     private int identitiesId; 
    65     private int accountsId; 
    66     private int outgoingId; 
    67     private Hashtable identityIndexMap; 
    68     private Hashtable accountIndexMap; 
    69     private Hashtable outgoingIndexMap; 
    70  
    71     private TreeField configTreeField; 
     73    private GlobalConfig existingGlobalConfig; 
     74    private String localHostname; 
     75    private String[] languageChoices; 
     76    private String[] languageCodes; 
     77    private String[] fileSystemRoots; 
     78    private String[] fileSystemRootChoices; 
     79    private int selectedFileSystemRootIndex; 
     80     
     81    int separatorHeight; 
     82     
     83    // Account management 
     84    private VerticalFieldManager identityFieldManager; 
     85    private ObjectListField identityListField; 
     86    private VerticalFieldManager accountFieldManager; 
     87    private ObjectListField accountListField; 
     88    private VerticalFieldManager outgoingFieldManager; 
     89    private ObjectListField outgoingListField; 
     90     
     91    // Message Display 
     92    private VerticalFieldManager messageDisplayFieldManager; 
     93    private ObjectChoiceField messageDisplayChoiceField; 
     94    private BasicEditField messageCountEditField; 
     95    private ObjectChoiceField displayOrderChoiceField; 
     96    private CheckboxField hideDeletedMessagesCheckboxField; 
     97     
     98    // Networking 
     99    private VerticalFieldManager networkingFieldManager; 
     100    private ObjectChoiceField networkTransportChoiceField; 
     101    private CheckboxField enableWiFiCheckboxField; 
     102    private CheckboxField overrideHostnameCheckboxField; 
     103    private BasicEditField localHostnameEditField; 
     104 
     105    // Other 
     106    private VerticalFieldManager otherFieldManager; 
     107    private ObjectChoiceField localDataLocationChoiceLabel; 
     108    private CheckboxField connectionDebuggingCheckboxField; 
     109    private CheckboxField unicodeNormalizationCheckboxField; 
     110    private ObjectChoiceField languageChoiceField; 
    72111 
    73112    private MenuItem selectItem; 
     
    87126    public ConfigScreen() { 
    88127        super(resources.getString(LogicMailResource.APPNAME) + " - " + resources.getString(LogicMailResource.CONFIG_TITLE)); 
     128         
    89129        mailSettings = MailSettings.getInstance(); 
    90         identityIndexMap = new Hashtable(); 
    91         accountIndexMap = new Hashtable(); 
    92         outgoingIndexMap = new Hashtable(); 
    93  
     130        existingGlobalConfig = mailSettings.getGlobalConfig(); 
     131         
     132        localHostname = existingGlobalConfig.getLocalHostname(); 
     133         
     134        initLanguageChoices(); 
     135        initFileSystemChoices(); 
     136 
     137        separatorHeight = getFont().getHeight() / 2; 
     138         
    94139        initFields(); 
    95140        initMenuItems(); 
     
    104149    } 
    105150 
     151    private void initFileSystemChoices() { 
     152        // Populate fileSystemRoots with a list of all 
     153        // available and writable storage devices 
     154        String selectedFileSystemRoot = existingGlobalConfig.getLocalDataLocation(); 
     155        selectedFileSystemRootIndex = 0; 
     156         
     157        fileSystemRoots = PlatformInfo.getInstance().getFilesystemRoots(); 
     158        fileSystemRootChoices = new String[fileSystemRoots.length + 1]; 
     159        for(int i=0; i<fileSystemRoots.length; i++) { 
     160            String root = fileSystemRoots[i]; 
     161            if(selectedFileSystemRoot != null && selectedFileSystemRoot.indexOf(root) != -1) { 
     162                selectedFileSystemRootIndex = i; 
     163            } 
     164            if(root.indexOf("Card/") != -1) { 
     165                fileSystemRootChoices[i] = 
     166                    resources.getString(LogicMailResource.CONFIG_GLOBAL_LOCAL_DATA_MEDIA_CARD); 
     167            } 
     168            else if(root.indexOf("store/") != -1) { 
     169                fileSystemRootChoices[i] = 
     170                    resources.getString(LogicMailResource.CONFIG_GLOBAL_LOCAL_DATA_DEVICE_MEMORY); 
     171            } 
     172            else { 
     173                int p = root.indexOf('/', GlobalConfig.FILE_URL_PREFIX.length() - 1); 
     174                int q = root.indexOf('/', p + 1); 
     175                if(p != -1 && q != -1 && p < q) { 
     176                    fileSystemRootChoices[i] = root.substring(p + 1, q); 
     177                } 
     178                else { 
     179                    fileSystemRootChoices[i] = root; 
     180                } 
     181            } 
     182        } 
     183        fileSystemRootChoices[fileSystemRootChoices.length - 1] = 
     184            resources.getString(LogicMailResource.CONFIG_GLOBAL_LOCAL_DATA_DISABLED); 
     185        if(selectedFileSystemRoot == null) { 
     186            selectedFileSystemRootIndex = fileSystemRootChoices.length - 1; 
     187        } 
     188    } 
     189 
     190    private void initLanguageChoices() { 
     191        languageChoices = new String[] { 
     192                "BlackBerry",   // System default 
     193                "Dansk",        // Danish: da 
     194                "Deutsch",      // German: de 
     195                "English",      // English: en 
     196                "Espa\u00f1ol", // Spanish: es 
     197                "Fran\u00e7ais",// French: fr 
     198                "Italiano",     // Italian: it 
     199                "Nederlands",   // Dutch: nl 
     200                "Ti\u00ea\u0301ng Vi\u00ea\u0323t", // Vietnamese: vi 
     201                "\u4E2D\u6587", // Chinese: zh 
     202        }; 
     203        languageCodes = new String[] { 
     204                "",   // System default 
     205                "da", // Danish 
     206                "de", // German 
     207                "en", // English 
     208                "es", // Spanish 
     209                "fr", // French 
     210                "it", // Italian 
     211                "nl", // Dutch 
     212                "vi", // Vietnamese 
     213                "zh", // Chinese 
     214        }; 
     215    } 
     216 
    106217    /** 
    107218     * Initializes the fields. 
    108219     */ 
    109220    private void initFields() { 
    110         configTreeField = FieldFactory.getInstance().getScreenTreeField( 
    111                 new TreeFieldCallback() { 
    112                     public void drawTreeItem(TreeField treeField, Graphics graphics, int node, int y, int width, int indent) { 
    113                         configTreeFieldDrawTreeItem(treeField, graphics, node, y, width, indent); 
    114                     } 
    115                 }, 
    116                 Field.FOCUSABLE); 
    117         configTreeField.setDefaultExpanded(true); 
    118         configTreeField.setIndentWidth(20); 
    119  
    120         globalId = configTreeField.addChildNode(0, new ConfigTreeNode(resources.getString(LogicMailResource.CONFIG_GLOBAL_SETTINGS))); 
    121         identitiesId = configTreeField.addSiblingNode(globalId, new ConfigTreeNode(resources.getString(LogicMailResource.CONFIG_IDENTITIES))); 
    122         accountsId = configTreeField.addSiblingNode(identitiesId, new ConfigTreeNode(resources.getString(LogicMailResource.CONFIG_ACCOUNTS))); 
    123         outgoingId = configTreeField.addSiblingNode(accountsId, new ConfigTreeNode(resources.getString(LogicMailResource.CONFIG_OUTGOING_SERVERS))); 
    124  
    125         add(configTreeField); 
    126     } 
    127  
     221        initAccountFields(); 
     222        initMessageDisplayFields(); 
     223        initNetworkingFields(); 
     224        initOtherFields(); 
     225    } 
     226 
     227    private void initAccountFields() { 
     228        identityFieldManager = new VerticalFieldManager(); 
     229        identityFieldManager.add(new LabeledSeparatorField( 
     230                resources.getString(LogicMailResource.CONFIG_IDENTITIES), 
     231                Field.NON_FOCUSABLE | LabeledSeparatorField.TOP_BORDER | LabeledSeparatorField.BOTTOM_BORDER)); 
     232        identityListField = new AccountListField(); 
     233        identityListField.setEmptyString(resources.getFamily(), LogicMailResource.MENUITEM_ADD_IDENTITY, DrawStyle.HCENTER); 
     234        identityFieldManager.add(identityListField); 
     235        identityFieldManager.add(new BlankSeparatorField(separatorHeight)); 
     236        add(identityFieldManager); 
     237         
     238        accountFieldManager = new VerticalFieldManager(); 
     239        accountFieldManager.add(new LabeledSeparatorField( 
     240                resources.getString(LogicMailResource.CONFIG_ACCOUNTS), 
     241                Field.NON_FOCUSABLE | LabeledSeparatorField.TOP_BORDER | LabeledSeparatorField.BOTTOM_BORDER)); 
     242        accountListField = new AccountListField(); 
     243        accountListField.setEmptyString(resources.getFamily(), LogicMailResource.MENUITEM_ADD_ACCOUNT, DrawStyle.HCENTER); 
     244        accountFieldManager.add(accountListField); 
     245        accountFieldManager.add(new BlankSeparatorField(separatorHeight)); 
     246        add(accountFieldManager); 
     247         
     248        outgoingFieldManager = new VerticalFieldManager(); 
     249        outgoingFieldManager.add(new LabeledSeparatorField( 
     250                resources.getString(LogicMailResource.CONFIG_OUTGOING_SERVERS), 
     251                Field.NON_FOCUSABLE | LabeledSeparatorField.TOP_BORDER | LabeledSeparatorField.BOTTOM_BORDER)); 
     252        outgoingListField = new AccountListField(); 
     253        outgoingListField.setEmptyString(resources.getFamily(), LogicMailResource.MENUITEM_ADD_OUTGOING_SERVER, DrawStyle.HCENTER); 
     254        outgoingFieldManager.add(outgoingListField); 
     255        outgoingFieldManager.add(new BlankSeparatorField(separatorHeight)); 
     256        add(outgoingFieldManager); 
     257    } 
     258     
     259    private static class AccountListField extends ObjectListField { 
     260        private static Bitmap chevronIcon = Bitmap.getBitmapResource("chevron_right_black_10x16.png"); 
     261        private static Bitmap chevronIconHighlighted = Bitmap.getBitmapResource("chevron_right_white_10x16.png"); 
     262         
     263        private boolean isFocus; 
     264         
     265        protected void onFocus(int direction) { 
     266            isFocus = true; 
     267            super.onFocus(direction); 
     268            invalidate(); 
     269        } 
     270         
     271        protected void onUnfocus() { 
     272            isFocus = false; 
     273            super.onUnfocus(); 
     274            invalidate(); 
     275        } 
     276         
     277        public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width) { 
     278            int yPos = (getRowHeight() / 2) - 8; 
     279            if(isFocus && index == getSelectedIndex()) { 
     280                graphics.drawBitmap(width - 15, yPos, 10, 16, chevronIconHighlighted, 0, 0); 
     281            } 
     282            else { 
     283                graphics.drawBitmap(width - 15, yPos, 10, 16, chevronIcon, 0, 0); 
     284            } 
     285            super.drawListRow(listField, graphics, index, y, width - 25); 
     286        } 
     287    } 
     288     
     289    private void initMessageDisplayFields() { 
     290        messageDisplayFieldManager = new VerticalFieldManager(); 
     291         
     292        messageDisplayChoiceField = new ObjectChoiceField( 
     293                resources.getString(LogicMailResource.CONFIG_GLOBAL_MESSAGE_FORMAT), 
     294                new String[] { 
     295                    resources.getString(LogicMailResource.CONFIG_GLOBAL_MESSAGE_FORMAT_PLAIN_TEXT), 
     296                "HTML" }, 
     297                existingGlobalConfig.getMessageDisplayFormat()); 
     298 
     299        messageCountEditField = new BasicEditField( 
     300                resources.getString(LogicMailResource.CONFIG_GLOBAL_MESSAGE_COUNT) + ' ', 
     301                Integer.toString(existingGlobalConfig.getRetMsgCount()), 16, TextField.NO_NEWLINE); 
     302        messageCountEditField.setFilter(TextFilter.get(TextFilter.NUMERIC)); 
     303 
     304        String[] orderTypes = { 
     305                resources.getString(LogicMailResource.MENUITEM_ORDER_ASCENDING), 
     306                resources.getString(LogicMailResource.MENUITEM_ORDER_DESCENDING) 
     307        }; 
     308 
     309        if (existingGlobalConfig.getDispOrder()) { 
     310            displayOrderChoiceField = new ObjectChoiceField( 
     311                    resources.getString(LogicMailResource.CONFIG_GLOBAL_MESSAGE_ORDER) + ' ', 
     312                    orderTypes, 0); 
     313        } else { 
     314            displayOrderChoiceField = new ObjectChoiceField( 
     315                    resources.getString(LogicMailResource.CONFIG_GLOBAL_MESSAGE_ORDER) + ' ', 
     316                    orderTypes, 1); 
     317        } 
     318 
     319        hideDeletedMessagesCheckboxField = new CheckboxField( 
     320                resources.getString(LogicMailResource.CONFIG_GLOBAL_HIDE_DELETED_MESSAGES), 
     321                existingGlobalConfig.getHideDeletedMsg()); 
     322         
     323        messageDisplayFieldManager.add(new LabeledSeparatorField( 
     324                resources.getString(LogicMailResource.CONFIG_GLOBAL_SECTION_MESSAGE_DISPLAY), 
     325                Field.NON_FOCUSABLE | LabeledSeparatorField.TOP_BORDER | LabeledSeparatorField.BOTTOM_BORDER)); 
     326        messageDisplayFieldManager.add(messageDisplayChoiceField); 
     327        messageDisplayFieldManager.add(messageCountEditField); 
     328        messageDisplayFieldManager.add(displayOrderChoiceField); 
     329        messageDisplayFieldManager.add(hideDeletedMessagesCheckboxField); 
     330        messageDisplayFieldManager.add(new BlankSeparatorField(separatorHeight)); 
     331        add(messageDisplayFieldManager); 
     332    } 
     333     
     334    private void initNetworkingFields() { 
     335        networkingFieldManager = new VerticalFieldManager(); 
     336         
     337        String[] transportChoices = { 
     338                resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_AUTO), 
     339                resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_DIRECT_TCP), 
     340                resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_MDS), 
     341                resources.getString(LogicMailResource.CONFIG_GLOBAL_TRANSPORT_WAP2) 
     342        }; 
     343        networkTransportChoiceField = new ObjectChoiceField( 
     344                resources.getString(LogicMailResource.CONFIG_GLOBAL_NETWORK_TRANSPORT), 
     345                transportChoices, 
     346                getTransportChoice(existingGlobalConfig.getTransportType())); 
     347         
     348        enableWiFiCheckboxField = new CheckboxField( 
     349                resources.getString(LogicMailResource.CONFIG_GLOBAL_ENABLE_WIFI), 
     350                existingGlobalConfig.getEnableWiFi()); 
     351 
     352        boolean overrideHostname = localHostname.length() > 0; 
     353        overrideHostnameCheckboxField = new CheckboxField( 
     354                resources.getString(LogicMailResource.CONFIG_GLOBAL_OVERRIDE_HOSTNAME), 
     355                overrideHostname); 
     356        overrideHostnameCheckboxField.setChangeListener(new FieldChangeListener() { 
     357            public void fieldChanged(Field field, int context) { 
     358                overrideHostnameCheckboxFieldChanged(field, context); 
     359            } 
     360        }); 
     361 
     362        if (overrideHostname) { 
     363            localHostnameEditField = new BasicEditField( 
     364                    resources.getString(LogicMailResource.CONFIG_GLOBAL_HOSTNAME) + ' ', 
     365                    localHostname, 256, TextField.NO_NEWLINE); 
     366        } else { 
     367            String hostname = System.getProperty("microedition.hostname"); 
     368            localHostnameEditField = new HostnameEditField( 
     369                    resources.getString(LogicMailResource.CONFIG_GLOBAL_HOSTNAME) + ' ', 
     370                    ((hostname != null) ? hostname : "localhost")); 
     371            localHostnameEditField.setEditable(false); 
     372        } 
     373         
     374        networkingFieldManager.add(new LabeledSeparatorField( 
     375                resources.getString(LogicMailResource.CONFIG_GLOBAL_SECTION_NETWORKING), 
     376                Field.NON_FOCUSABLE | LabeledSeparatorField.TOP_BORDER | LabeledSeparatorField.BOTTOM_BORDER)); 
     377        networkingFieldManager.add(networkTransportChoiceField); 
     378        networkingFieldManager.add(enableWiFiCheckboxField); 
     379        networkingFieldManager.add(overrideHostnameCheckboxField); 
     380        networkingFieldManager.add(localHostnameEditField); 
     381        networkingFieldManager.add(new BlankSeparatorField(separatorHeight)); 
     382        add(networkingFieldManager); 
     383    } 
     384     
     385    private void initOtherFields() { 
     386        otherFieldManager = new VerticalFieldManager(); 
     387         
     388        localDataLocationChoiceLabel = new ObjectChoiceField( 
     389                resources.getString(LogicMailResource.CONFIG_GLOBAL_LOCAL_DATA_LOCATION) + ' ', 
     390                fileSystemRootChoices, 
     391                selectedFileSystemRootIndex); 
     392         
     393        String languageCode = existingGlobalConfig.getLanguageCode(); 
     394        int languageIndex = 0; 
     395        if(languageCode != null && languageCode.length() != 0) { 
     396            for(int i=0; i<languageCodes.length; i++) { 
     397                if(languageCodes[i].equals(languageCode)) { 
     398                    languageIndex = i; 
     399                    break; 
     400                } 
     401            } 
     402        } 
     403        languageChoiceField = new ObjectChoiceField( 
     404                resources.getString(LogicMailResource.CONFIG_GLOBAL_LANGUAGE), 
     405                languageChoices, 
     406                languageIndex); 
     407 
     408        unicodeNormalizationCheckboxField = new CheckboxField( 
     409                resources.getString(LogicMailResource.CONFIG_GLOBAL_UNICODE_NORMALIZATION), 
     410                existingGlobalConfig.getUnicodeNormalization()); 
     411 
     412        connectionDebuggingCheckboxField = new CheckboxField( 
     413                resources.getString(LogicMailResource.CONFIG_GLOBAL_CONNECTION_DEBUGGING), 
     414                existingGlobalConfig.getConnDebug()); 
     415         
     416        otherFieldManager.add(new LabeledSeparatorField( 
     417                resources.getString(LogicMailResource.CONFIG_GLOBAL_SECTION_OTHER), 
     418                Field.NON_FOCUSABLE | LabeledSeparatorField.TOP_BORDER | LabeledSeparatorField.BOTTOM_BORDER)); 
     419        otherFieldManager.add(localDataLocationChoiceLabel); 
     420        otherFieldManager.add(languageChoiceField); 
     421        otherFieldManager.add(unicodeNormalizationCheckboxField); 
     422        otherFieldManager.add(connectionDebuggingCheckboxField); 
     423        otherFieldManager.add(new BlankSeparatorField(separatorHeight)); 
     424        add(otherFieldManager); 
     425    } 
     426     
    128427    private void initMenuItems() { 
    129428        selectItem = new MenuItem(resources, LogicMailResource.MENUITEM_EDIT, 300100, 1) { 
     
    137436            } 
    138437        }; 
    139         moveDownItem = new MenuItem(resources, LogicMailResource.MENUITEM_MOVE_DOWN, 300300, 1020) { 
     438        moveDownItem = new MenuItem(resources, LogicMailResource.MENUITEM_MOVE_DOWN, 300250, 1020) { 
    140439            public void run() { 
    141440                moveSelectedNodeDown(); 
     441            } 
     442        }; 
     443        deleteIdentityItem = new MenuItem(resources, LogicMailResource.MENUITEM_DELETE_IDENTITY, 300310, 4000) { 
     444            public void run() { 
     445                deleteSelectedIdentity(); 
     446            } 
     447        }; 
     448        deleteAccountItem = new MenuItem(resources, LogicMailResource.MENUITEM_DELETE_ACCOUNT, 300320, 4000) { 
     449            public void run() { 
     450                deleteSelectedAccount(); 
     451            } 
     452        }; 
     453        deleteOutgoingItem = new MenuItem(resources, LogicMailResource.MENUITEM_DELETE_OUTGOING_SERVER, 300330, 4000) { 
     454            public void run() { 
     455                deleteSelectedOutgoingServer(); 
    142456            } 
    143457        }; 
     
    147461            } 
    148462        }; 
    149         addIdentityItem = new MenuItem(resources, LogicMailResource.MENUITEM_ADD_IDENTITY, 400200, 4000) { 
     463        addIdentityItem = new MenuItem(resources, LogicMailResource.MENUITEM_ADD_IDENTITY, 400210, 4000) { 
    150464            public void run() { 
    151465                addIdentity(); 
    152466            } 
    153467        }; 
    154         deleteIdentityItem = new MenuItem(resources, LogicMailResource.MENUITEM_DELETE_IDENTITY, 400250, 4000) { 
    155             public void run() { 
    156                 deleteSelectedIdentity(); 
    157             } 
    158         }; 
    159         addAccountItem = new MenuItem(resources, LogicMailResource.MENUITEM_ADD_ACCOUNT, 400300, 4000) { 
     468        addAccountItem = new MenuItem(resources, LogicMailResource.MENUITEM_ADD_ACCOUNT, 400220, 4000) { 
    160469            public void run() { 
    161470                addAccount(); 
    162471            } 
    163472        }; 
    164         deleteAccountItem = new MenuItem(resources, LogicMailResource.MENUITEM_DELETE_ACCOUNT, 400350, 4000) { 
    165             public void run() { 
    166                 deleteSelectedAccount(); 
    167             } 
    168         }; 
    169         addOutgoingItem = new MenuItem(resources, LogicMailResource.MENUITEM_ADD_OUTGOING_SERVER, 400400, 4000) { 
     473        addOutgoingItem = new MenuItem(resources, LogicMailResource.MENUITEM_ADD_OUTGOING_SERVER, 400230, 4000) { 
    170474            public void run() { 
    171475                addOutgoingServer(); 
    172476            } 
    173477        }; 
    174         deleteOutgoingItem = new MenuItem(resources, LogicMailResource.MENUITEM_DELETE_OUTGOING_SERVER, 400450, 4000) { 
    175             public void run() { 
    176                 deleteSelectedOutgoingServer(); 
    177             } 
    178         }; 
    179     } 
    180  
    181     /** 
    182      * Draws tree items in the TreeField 
    183      *  
    184      * @param treeField the tree field 
    185      * @param graphics the graphics 
    186      * @param node the node 
    187      * @param y the y 
    188      * @param width the width 
    189      * @param indent the indent 
    190      */ 
    191     public void configTreeFieldDrawTreeItem(TreeField treeField, Graphics graphics, int node, int y, int width, int indent) { 
    192         Object cookie = treeField.getCookie(node); 
    193         graphics.drawText(cookie.toString(), indent + 2, y, Graphics.ELLIPSIS, width); 
     478    } 
     479     
     480    private static int getTransportChoice(int transportSetting) { 
     481        int result; 
     482        switch(transportSetting) { 
     483        case ConnectionConfig.TRANSPORT_AUTO: 
     484            result = 0; 
     485            break; 
     486        case ConnectionConfig.TRANSPORT_DIRECT_TCP: 
     487            result = 1; 
     488            break; 
     489        case ConnectionConfig.TRANSPORT_MDS: 
     490            result = 2; 
     491            break; 
     492        case ConnectionConfig.TRANSPORT_WAP2: 
     493            result = 3; 
     494            break; 
     495        default: 
     496            result = 0; 
     497            break; 
     498        } 
     499        return result; 
     500    } 
     501     
     502    private static int getTransportSetting(int transportChoice) { 
     503        int result; 
     504        switch(transportChoice) { 
     505        case 0: 
     506            result = ConnectionConfig.TRANSPORT_AUTO; 
     507            break; 
     508        case 1: 
     509            result = ConnectionConfig.TRANSPORT_DIRECT_TCP; 
     510            break; 
     511        case 2: 
     512            result = ConnectionConfig.TRANSPORT_MDS; 
     513            break; 
     514        case 3: 
     515            result = ConnectionConfig.TRANSPORT_WAP2; 
     516            break; 
     517        default: 
     518            result = ConnectionConfig.TRANSPORT_AUTO; 
     519            break; 
     520        } 
     521        return result; 
     522    } 
     523     
     524    public void overrideHostnameCheckboxFieldChanged(Field field, int context) { 
     525        if (overrideHostnameCheckboxField.getChecked()) { 
     526            localHostnameEditField.setText(localHostname); 
     527            localHostnameEditField.setEditable(true); 
     528        } else { 
     529            String hostname = System.getProperty("microedition.hostname"); 
     530            localHostnameEditField.setText((hostname != null) ? hostname 
     531                    : "localhost"); 
     532            localHostnameEditField.setEditable(false); 
     533        } 
     534    } 
     535 
     536    private ObjectListField getSelectedListField() { 
     537        if(identityFieldManager.isFocus()) { 
     538            return identityListField; 
     539        } 
     540        else if(accountFieldManager.isFocus()) { 
     541            return accountListField; 
     542        } 
     543        else if(outgoingFieldManager.isFocus()) { 
     544            return outgoingListField; 
     545        } 
     546        else { 
     547            return null; 
     548        } 
    194549    } 
    195550 
     
    198553     */ 
    199554    protected void makeMenu(Menu menu, int instance) { 
    200         int id = configTreeField.getCurrentNode(); 
    201  
    202         Object cookie; 
    203         Object rawCookie = configTreeField.getCookie(id); 
    204         if(rawCookie instanceof ConfigTreeNode) { 
    205             cookie = ((ConfigTreeNode)rawCookie).cookie; 
    206         } 
    207         else { 
    208             cookie = null; 
    209         } 
    210  
    211         if(id != identitiesId && id != accountsId && id != outgoingId) { 
    212             menu.add(selectItem); 
    213             if(cookie instanceof ConnectionConfig) { 
    214                 if(configTreeField.getPreviousSibling(id) != -1) { 
     555        ObjectListField selectedListField = getSelectedListField(); 
     556         
     557        if(selectedListField != null) { 
     558            int index = selectedListField.getSelectedIndex(); 
     559            if(index != -1) { 
     560                menu.add(selectItem); 
     561                if(index < selectedListField.getSize() - 1) { 
     562                    menu.add(moveDownItem); 
     563                } 
     564                else if(index > 0) { 
    215565                    menu.add(moveUpItem); 
    216566                } 
    217                 if(configTreeField.getNextSibling(id) != -1) { 
    218                     menu.add(moveDownItem); 
    219                 } 
    220             } 
    221         } 
    222  
    223         if(id == identitiesId) { 
    224             menu.add(addIdentityItem); 
    225         } 
    226         else if(cookie instanceof IdentityConfig) { 
    227             menu.add(addIdentityItem); 
    228             menu.add(deleteIdentityItem); 
    229         } 
    230         else if(id == accountsId) { 
    231             menu.add(newAccountWizardItem); 
    232             menu.add(addAccountItem); 
    233         } 
    234         else if(cookie instanceof AccountConfig) { 
    235             menu.add(newAccountWizardItem); 
    236             menu.add(addAccountItem); 
    237             menu.add(deleteAccountItem); 
    238         } 
    239         else if(id == outgoingId) { 
    240             menu.add(addOutgoingItem); 
    241         } 
    242         else if(cookie instanceof OutgoingConfig) { 
    243             menu.add(addOutgoingItem); 
    244             menu.add(deleteOutgoingItem); 
    245         } 
     567            } 
     568             
     569            if(selectedListField == identityListField) { 
     570                menu.add(addIdentityItem); 
     571                if(identityListField.getSize() > 0) { 
     572                    menu.add(deleteIdentityItem); 
     573                } 
     574            } 
     575            else if(selectedListField == accountListField) { 
     576                menu.add(newAccountWizardItem); 
     577                menu.add(addAccountItem); 
     578                if(accountListField.getSize() > 0) { 
     579                    menu.add(deleteAccountItem); 
     580                } 
     581            } 
     582            else if(selectedListField == outgoingListField) { 
     583                menu.add(addOutgoingItem); 
     584                if(outgoingListField.getSize() > 0) { 
     585                    menu.add(deleteOutgoingItem); 
     586                } 
     587            } 
     588        } 
     589         
    246590        super.makeMenu(menu, instance); 
    247591    } 
     
    253597        boolean retval = false; 
    254598        switch(key) { 
    255         case Keypad.KEY_SPACE: 
    256             toggleSelectedNode(); 
    257             retval = true; 
    258             break; 
    259599        case Keypad.KEY_ENTER: 
    260600            openSelectedNode(); 
     
    271611        return openSelectedNode(); 
    272612    } 
    273  
    274     /** 
    275      * Toggle selected node's expansion state 
    276      */ 
    277     private void toggleSelectedNode() { 
    278         int curNode = configTreeField.getCurrentNode(); 
    279  
    280         // Make sure a node is selected 
    281         if(curNode == -1) { 
    282             return; 
    283         } 
    284  
    285         // Make sure the selected node has children 
    286         if(configTreeField.getFirstChild(curNode) == -1) { 
    287             return; 
    288         } 
    289  
    290         // Toggle the expansion state of the current node 
    291         configTreeField.setExpanded(curNode, !configTreeField.getExpanded(curNode)); 
    292     } 
    293  
     613     
    294614    /** 
    295615     * Open selected node. 
     
    299619    private boolean openSelectedNode() { 
    300620        boolean result = false; 
    301         int curNode = configTreeField.getCurrentNode(); 
    302         if(curNode == globalId) { 
    303             UiApplication.getUiApplication().pushScreen(new GlobalConfigScreen()); 
    304             result = true; 
    305         } 
    306         else { 
    307             int parentNode = configTreeField.getParent(curNode); 
    308             Object cookie = ((ConfigTreeNode)configTreeField.getCookie(curNode)).cookie; 
    309             if(parentNode == identitiesId) { 
    310                 IdentityConfig identityConfig = (IdentityConfig)cookie; 
     621 
     622        ObjectListField selectedListField = getSelectedListField(); 
     623 
     624        if(selectedListField == identityListField) { 
     625            int index = identityListField.getSelectedIndex(); 
     626            if(index != -1) { 
     627                IdentityConfig identityConfig = (IdentityConfig)identityListField.get(identityListField, index); 
    311628                IdentityConfigScreen identityConfigScreen = new IdentityConfigScreen(identityConfig); 
     629                ScreenFactory.getInstance().attachScreenTransition(identityConfigScreen, ScreenFactory.TRANSITION_SLIDE); 
    312630                UiApplication.getUiApplication().pushModalScreen(identityConfigScreen); 
    313631                if(identityConfigScreen.configSaved()) { 
    314632                    mailSettings.saveSettings(); 
    315633                } 
    316                 result = true; 
    317             } 
    318             else if(parentNode == accountsId) { 
    319                 AccountConfig acctConfig = (AccountConfig)cookie; 
    320                 AccountConfigScreen accountConfigScreen = new AccountConfigScreen(acctConfig); 
     634            } 
     635            else { 
     636                addIdentity(); 
     637            } 
     638            result = true; 
     639        } 
     640        else if(selectedListField == accountListField) { 
     641            int index = accountListField.getSelectedIndex(); 
     642            if(index != -1) { 
     643                AccountConfig accountConfig = (AccountConfig)accountListField.get(accountListField, index); 
     644                AccountConfigScreen accountConfigScreen = new AccountConfigScreen(accountConfig); 
     645                ScreenFactory.getInstance().attachScreenTransition(accountConfigScreen, ScreenFactory.TRANSITION_SLIDE); 
    321646                UiApplication.getUiApplication().pushModalScreen(accountConfigScreen); 
    322647                if(accountConfigScreen.acctSaved()) { 
    323648                    mailSettings.saveSettings(); 
    324649                } 
    325                 result = true; 
    326             } 
    327             else if(parentNode == outgoingId) { 
    328                 OutgoingConfig outgoingConfig = (OutgoingConfig)cookie; 
     650            } 
     651            else { 
     652                addAccount(); 
     653            } 
     654            result = true; 
     655        } 
     656        else if(selectedListField == outgoingListField) { 
     657            int index = outgoingListField.getSelectedIndex(); 
     658            if(index != -1) { 
     659                OutgoingConfig outgoingConfig = (OutgoingConfig)outgoingListField.get(outgoingListField, index); 
    329660                OutgoingConfigScreen outgoingConfigScreen = new OutgoingConfigScreen(outgoingConfig); 
     661                ScreenFactory.getInstance().attachScreenTransition(outgoingConfigScreen, ScreenFactory.TRANSITION_SLIDE); 
    330662                UiApplication.getUiApplication().pushModalScreen(outgoingConfigScreen); 
    331663                if(outgoingConfigScreen.acctSaved()) { 
    332664                    mailSettings.saveSettings(); 
    333665                } 
    334                 result = true; 
    335             } 
     666            } 
     667            else { 
     668                addOutgoingServer(); 
     669            } 
     670            result = true; 
    336671        } 
    337672        return result; 
     
    339674 
    340675    private void moveSelectedNodeUp() { 
    341         int curNode = configTreeField.getCurrentNode(); 
    342         if(curNode == -1) { return; } 
    343         int prevNode = configTreeField.getPreviousSibling(curNode); 
    344         if(prevNode == -1) { return; } 
    345  
    346         Object cookie = ((ConfigTreeNode)configTreeField.getCookie(curNode)).cookie; 
    347         Object prevCookie = ((ConfigTreeNode)configTreeField.getCookie(prevNode)).cookie; 
     676        Object cookie = null; 
     677        Object prevCookie = null; 
     678        ObjectListField selectedListField = getSelectedListField(); 
     679        if(selectedListField != null) { 
     680            int index = selectedListField.getSelectedIndex(); 
     681            if(index > 0) { 
     682                prevCookie = selectedListField.get(selectedListField, index - 1); 
     683                cookie = selectedListField.get(selectedListField, index); 
     684            } 
     685        } 
     686        if(cookie == null || prevCookie == null) { return; } 
    348687 
    349688        boolean result = false; 
     
    354693 
    355694            int curConfigIndex = mailSettings.indexOfIdentityConfig(curConfig); 
    356             mailSettings.removeAccountConfig(curConfigIndex); 
     695            mailSettings.removeIdentityConfig(curConfigIndex); 
    357696 
    358697            int prevConfigIndex = mailSettings.indexOfIdentityConfig(prevConfig); 
     
    376715 
    377716            int curConfigIndex = mailSettings.indexOfOutgoingConfig(curConfig); 
    378             mailSettings.removeAccountConfig(curConfigIndex); 
     717            mailSettings.removeOutgoingConfig(curConfigIndex); 
    379718 
    380719            int prevConfigIndex = mailSettings.indexOfOutgoingConfig(prevConfig); 
     
    389728 
    390729    private void moveSelectedNodeDown() { 
    391         int curNode = configTreeField.getCurrentNode(); 
    392         if(curNode == -1) { return; } 
    393         int nextNode = configTreeField.getNextSibling(curNode); 
    394         if(nextNode == -1) { return; } 
    395  
    396         Object cookie = ((ConfigTreeNode)configTreeField.getCookie(curNode)).cookie; 
    397         Object nextCookie = ((ConfigTreeNode)configTreeField.getCookie(nextNode)).cookie; 
     730        Object cookie = null; 
     731        Object nextCookie = null; 
     732        ObjectListField selectedListField = getSelectedListField(); 
     733        if(selectedListField != null) { 
     734            int index = selectedListField.getSelectedIndex(); 
     735            if(index < selectedListField.getSize() - 1) { 
     736                cookie = selectedListField.get(selectedListField, index); 
     737                nextCookie = selectedListField.get(selectedListField, index + 1); 
     738            } 
     739        } 
     740        if(cookie == null || nextCookie == null) { return; } 
    398741 
    399742        boolean result = false; 
     
    404747 
    405748            int curConfigIndex = mailSettings.indexOfIdentityConfig(curConfig); 
    406             mailSettings.removeAccountConfig(curConfigIndex); 
     749            mailSettings.removeIdentityConfig(curConfigIndex); 
    407750 
    408751            int nextConfigIndex = mailSettings.indexOfIdentityConfig(nextConfig); 
     
    426769 
    427770            int curConfigIndex = mailSettings.indexOfOutgoingConfig(curConfig); 
    428             mailSettings.removeAccountConfig(curConfigIndex); 
     771            mailSettings.removeOutgoingConfig(curConfigIndex); 
    429772 
    430773            int nextConfigIndex = mailSettings.indexOfOutgoingConfig(nextConfig); 
     
    442785     */ 
    443786    private void buildAccountsList() { 
    444         Object curCookie; 
    445         int curNode = configTreeField.getCurrentNode(); 
    446         if(curNode != -1) { 
    447             curCookie = ((ConfigTreeNode)configTreeField.getCookie(curNode)).cookie; 
    448         } 
    449         else { 
    450             curCookie = null; 
    451         } 
    452  
     787        // Identities 
    453788        int numIdentities = mailSettings.getNumIdentities(); 
    454         identityIndexMap.clear(); 
     789        while(identityListField.getSize() != 0) { 
     790            identityListField.delete(0); 
     791        } 
     792         
     793        IdentityConfig identityConfig; 
     794        for(int i = 0; i < numIdentities; i++) { 
     795            identityConfig = mailSettings.getIdentityConfig(i); 
     796            identityListField.insert(i, identityConfig); 
     797        } 
     798         
     799        // Accounts 
    455800        int numAccounts = mailSettings.getNumAccounts(); 
    456         accountIndexMap.clear(); 
     801        while(accountListField.getSize() != 0) { 
     802            accountListField.delete(0); 
     803        } 
     804         
     805        AccountConfig acctConfig; 
     806        for(int i = 0; i < numAccounts; i++) { 
     807            acctConfig = mailSettings.getAccountConfig(i); 
     808            accountListField.insert(i, acctConfig); 
     809        } 
     810         
     811        // Outgoing servers 
    457812        int numOutgoing = mailSettings.getNumOutgoing(); 
    458         outgoingIndexMap.clear(); 
    459         int id; 
    460         while((id = configTreeField.getFirstChild(identitiesId)) != -1) { 
    461             configTreeField.deleteSubtree(id); 
    462         } 
    463         while((id = configTreeField.getFirstChild(accountsId)) != -1) { 
    464             configTreeField.deleteSubtree(id); 
    465         } 
    466         while((id = configTreeField.getFirstChild(outgoingId)) != -1) { 
    467             configTreeField.deleteSubtree(id); 
    468         } 
    469  
    470         IdentityConfig identityConfig; 
    471         for(int i = numIdentities-1; i >= 0; i--) { 
    472             identityConfig = mailSettings.getIdentityConfig(i); 
    473             configTreeField.addChildNode(identitiesId, new ConfigTreeNode(identityConfig)); 
    474             identityIndexMap.put(identityConfig, new Integer(i)); 
    475         } 
    476  
    477         AccountConfig acctConfig; 
    478         for(int i = numAccounts-1; i >= 0; i--) { 
    479             acctConfig = mailSettings.getAccountConfig(i); 
    480             configTreeField.addChildNode(accountsId, new ConfigTreeNode(acctConfig)); 
    481             accountIndexMap.put(acctConfig, new Integer(i)); 
     813        while(outgoingListField.getSize() != 0) { 
     814            outgoingListField.delete(0); 
    482815        } 
    483816 
    484817        OutgoingConfig outgoingConfig; 
    485         for(int i = numOutgoing-1; i >= 0; i--) { 
     818        for(int i = 0; i < numOutgoing; i++) { 
    486819            outgoingConfig = mailSettings.getOutgoingConfig(i); 
    487             configTreeField.addChildNode(outgoingId, new ConfigTreeNode(outgoingConfig)); 
    488             outgoingIndexMap.put(outgoingConfig, new Integer(i)); 
    489         } 
    490  
    491         if(curCookie != null) { 
    492             int node = configTreeField.nextNode(0, 0, true); 
    493             while(node != -1) { 
    494                 if(((ConfigTreeNode)configTreeField.getCookie(node)).cookie == curCookie) { 
    495                     configTreeField.setCurrentNode(node); 
    496                     break; 
    497                 } 
    498                 else { 
    499                     node = configTreeField.nextNode(node, 0, true); 
    500                 } 
    501             } 
     820            outgoingListField.insert(i, outgoingConfig); 
    502821        } 
    503822    } 
     
    528847     */ 
    529848    private void deleteSelectedIdentity() { 
    530         IdentityConfig identityConfig = 
    531             (IdentityConfig)((ConfigTreeNode)configTreeField.getCookie(configTreeField.getCurrentNode())).cookie; 
    532  
    533         int index = ((Integer)identityIndexMap.get(identityConfig)).intValue(); 
     849        // Assume that all the focus checking has been done prior to 
     850        // this method being called. 
     851        int index = identityListField.getSelectedIndex(); 
     852         
    534853        int response = Dialog.ask(Dialog.D_DELETE); 
    535854        if(response == Dialog.DELETE) { 
    536855            mailSettings.removeIdentityConfig(index); 
    537             configTreeField.deleteSubtree(configTreeField.getCurrentNode()); 
    538             identityIndexMap.remove(identityConfig); 
     856            identityListField.delete(index); 
    539857            mailSettings.saveSettings(); 
    540858        } 
     
    567885     */ 
    568886    private void deleteSelectedAccount() { 
    569         AccountConfig acctConfig = 
    570             (AccountConfig)((ConfigTreeNode)configTreeField.getCookie(configTreeField.getCurrentNode())).cookie; 
    571  
    572         int index = ((Integer)accountIndexMap.get(acctConfig)).intValue(); 
     887        // Assume that all the focus checking has been done prior to 
     888        // this method being called. 
     889        int index = accountListField.getSelectedIndex(); 
     890         
    573891        int response = Dialog.ask(Dialog.D_DELETE); 
    574892        if(response == Dialog.DELETE) { 
    575893            mailSettings.removeAccountConfig(index); 
    576             configTreeField.deleteSubtree(configTreeField.getCurrentNode()); 
    577             accountIndexMap.remove(acctConfig); 
     894            accountListField.delete(index); 
    578895            mailSettings.saveSettings(); 
    579896        } 
     
    597914     */ 
    598915    private void deleteSelectedOutgoingServer() { 
    599         OutgoingConfig outgoingConfig = 
    600             (OutgoingConfig)((ConfigTreeNode)configTreeField.getCookie(configTreeField.getCurrentNode())).cookie; 
    601  
    602         int index = ((Integer)outgoingIndexMap.get(outgoingConfig)).intValue(); 
     916        // Assume that all the focus checking has been done prior to 
     917        // this method being called. 
     918        int index = outgoingListField.getSelectedIndex(); 
     919         
    603920        int response = Dialog.ask(Dialog.D_DELETE); 
    604921        if(response == Dialog.DELETE) { 
    605922            mailSettings.removeOutgoingConfig(index); 
    606             configTreeField.deleteSubtree(configTreeField.getCurrentNode()); 
    607             outgoingIndexMap.remove(outgoingConfig); 
     923            outgoingListField.delete(index); 
    608924            mailSettings.saveSettings(); 
    609925        } 
    610926    } 
    611927 
    612     private static class ConfigTreeNode implements TreeFieldNode { 
    613         public Object cookie; 
    614  
    615         public ConfigTreeNode(Object cookie) { 
    616             this.cookie = cookie; 
    617         } 
    618  
    619         public String toString() { 
    620             return cookie.toString(); 
    621         } 
    622  
    623         public boolean isNodeSelectable() { 
    624             if((cookie instanceof GlobalConfig) 
    625                     || (cookie instanceof IdentityConfig) 
    626                     || (cookie instanceof AccountConfig) 
    627                     || (cookie instanceof OutgoingConfig)) { 
    628                 return true; 
    629             } 
    630             else { 
    631                 return false; 
    632             } 
    633         } 
     928    public void save() { 
     929        GlobalConfig config = mailSettings.getGlobalConfig(); 
     930 
     931        String languageCode = languageCodes[languageChoiceField.getSelectedIndex()]; 
     932        if(languageCode != null && languageCode.length() != 0) { 
     933            try { 
     934                Locale.setDefault(Locale.get(languageCode)); 
     935                config.setLanguageCode(languageCode); 
     936            } catch (Exception e) { } 
     937        } 
     938        else { 
     939            Locale.setDefault(Locale.getDefault()); 
     940            config.setLanguageCode(""); 
     941        } 
     942 
     943        config.setUnicodeNormalization(unicodeNormalizationCheckboxField.getChecked()); 
     944 
     945        config.setMessageDisplayFormat(messageDisplayChoiceField.getSelectedIndex()); 
     946 
     947        try { 
     948            config.setRetMsgCount(Integer.parseInt(messageCountEditField.getText())); 
     949        } catch (Exception e) { } 
     950 
     951        if (displayOrderChoiceField.getSelectedIndex() == 0) { 
     952            config.setDispOrder(true); 
     953        } else { 
     954            config.setDispOrder(false); 
     955        } 
     956 
     957        config.setHideDeletedMsg(hideDeletedMessagesCheckboxField.getChecked()); 
     958 
     959        config.setTransportType(getTransportSetting(networkTransportChoiceField.getSelectedIndex())); 
     960         
     961        config.setEnableWiFi(enableWiFiCheckboxField.getChecked()); 
     962 
     963        int fsRootIndex = localDataLocationChoiceLabel.getSelectedIndex(); 
     964        String url; 
     965        if(fsRootIndex > fileSystemRoots.length) { 
     966            url = null; 
     967        } 
     968        else { 
     969            url = fileSystemRoots[fsRootIndex]; 
     970        } 
     971        config.setLocalDataLocation(url); 
     972 
     973        if (overrideHostnameCheckboxField.getChecked()) { 
     974            config.setLocalHostname(localHostnameEditField.getText().trim()); 
     975        } else { 
     976            config.setLocalHostname(""); 
     977        } 
     978 
     979        config.setConnDebug(connectionDebuggingCheckboxField.getChecked()); 
     980        mailSettings.saveSettings(); 
    634981    } 
    635982} 
  • trunk/LogicMail/src/org/logicprobe/LogicMail/ui/ScreenFactory.java

    r560 r625  
    3030 */ 
    3131package org.logicprobe.LogicMail.ui; 
     32 
     33import net.rim.device.api.ui.Screen; 
    3234 
    3335import org.logicprobe.LogicMail.PlatformInfo; 
     
    7274    } 
    7375 
     76    /** Constant for a fade transition. */ 
     77    public static final int TRANSITION_FADE = 1; 
     78    /** Constant for a slide transition. */ 
     79    public static final int TRANSITION_SLIDE = 2; 
     80    /** Constant for a wipe transition. */ 
     81    public static final int TRANSITION_WIPE = 3; 
     82    /** Constant for a zoom transition. */ 
     83    public static final int TRANSITION_ZOOM = 4; 
     84    /** Constant for no transition. */ 
     85    public static final int TRANSITION_NONE = 5; 
     86     
     87    public abstract void attachScreenTransition(Screen screen, int transitionType); 
     88     
     89    public abstract void clearScreenTransition(Screen screen); 
     90     
    7491    public abstract StandardScreen getMailHomeScreen(NavigationController navigationController, MailRootNode mailRootNode); 
    7592 
  • trunk/LogicMail/src/org/logicprobe/LogicMail/ui/ScreenFactoryBB42.java

    r486 r625  
    3131package org.logicprobe.LogicMail.ui; 
    3232 
     33import net.rim.device.api.ui.Screen; 
     34 
    3335import org.logicprobe.LogicMail.model.AccountNode; 
    3436import org.logicprobe.LogicMail.model.MailRootNode; 
     
    3941 
    4042        public ScreenFactoryBB42() { 
     43        } 
     44         
     45        public void attachScreenTransition(Screen screen, int transitionType) { 
     46            // Screen transitions are not supported on this platform version 
     47        } 
     48         
     49        public void clearScreenTransition(Screen screen) { 
     50        // Screen transitions are not supported on this platform version 
    4151        } 
    4252         
Note: See TracChangeset for help on using the changeset viewer.