Changeset 629


Ignore:
Timestamp:
02/03/10 17:50:05 (2 years ago)
Author:
octorian
Message:

Added basic configurable prompts. (still need checkboxes on prompt dialogs)

Location:
trunk/LogicMail
Files:
6 edited

Legend:

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

    r625 r629  
    3535CONFIG_GLOBAL_CONNECTION_DEBUGGING#0="Connection debugging"; 
    3636CONFIG_GLOBAL_ENABLE_WIFI#0="Use WiFi if available"; 
     37CONFIG_GLOBAL_EXPUNGE_ALWAYS#0="Always"; 
     38CONFIG_GLOBAL_EXPUNGE_BEHAVIOR#0="Remove deleted messages?"; 
     39CONFIG_GLOBAL_EXPUNGE_NEVER#0="Never"; 
     40CONFIG_GLOBAL_EXPUNGE_PROMPT#0="Prompt"; 
    3741CONFIG_GLOBAL_HIDE_DELETED_MESSAGES#0="Hide deleted messages"; 
    3842CONFIG_GLOBAL_HOSTNAME#0="Hostname:"; 
     
    4852CONFIG_GLOBAL_NETWORK_TRANSPORT#0="Connection method:"; 
    4953CONFIG_GLOBAL_OVERRIDE_HOSTNAME#0="Override hostname"; 
     54CONFIG_GLOBAL_PROMPT_ON_MESSAGE_DELETE#0="Prompt on message delete?"; 
    5055CONFIG_GLOBAL_SECTION_MESSAGE_DISPLAY#0="Message display"; 
    5156CONFIG_GLOBAL_SECTION_NETWORKING#0="Networking"; 
  • trunk/LogicMail/res/org/logicprobe/LogicMail/LogicMail.rrh

    r625 r629  
    201201ERROR_UNABLE_TO_OPEN_CONNECTION#0=204; 
    202202MENUITEM_SAVE_DRAFT#0=205; 
     203CONFIG_GLOBAL_PROMPT_ON_MESSAGE_DELETE#0=206; 
     204CONFIG_GLOBAL_EXPUNGE_BEHAVIOR#0=207; 
     205CONFIG_GLOBAL_EXPUNGE_PROMPT#0=208; 
     206CONFIG_GLOBAL_EXPUNGE_ALWAYS#0=209; 
     207CONFIG_GLOBAL_EXPUNGE_NEVER#0=210; 
  • trunk/LogicMail/src/org/logicprobe/LogicMail/conf/GlobalConfig.java

    r628 r629  
    5454    /** Global data storage settings. */ 
    5555    public static final int CHANGE_TYPE_DATA = 0x02; 
     56    /** Global prompt settings. */ 
     57    public static final int CHANGE_TYPE_PROMPTS = 0x04; 
    5658    /** Global other settings. */ 
    57     public static final int CHANGE_TYPE_OTHER = 0x04; 
     59    public static final int CHANGE_TYPE_OTHER = 0x08; 
    5860 
    5961    /** Prefer plain text display for messages */ 
     
    6264    public static final int MESSAGE_DISPLAY_HTML = 1; 
    6365 
     66    public static final int EXPUNGE_PROMPT = 0; 
     67    public static final int EXPUNGE_ALWAYS = 1; 
     68    public static final int EXPUNGE_NEVER = 2; 
     69     
    6470    /** language code to use for the UI, or null for system default */ 
    6571    private String languageCode; 
     
    8490    /** Local host name override */ 
    8591    private String localHostname; 
     92    /** Whether to prompt on deleting messages. */ 
     93    private boolean promptOnDelete; 
     94    /** The expunge-related behavior when leaving a mailbox. */ 
     95    private int expungeMode; 
    8696 
    8797    public static String FILE_URL_PREFIX = "file:///"; 
     
    122132        this.localHostname = ""; 
    123133        this.localDataLocation = ""; 
     134        this.promptOnDelete = true; 
     135        this.expungeMode = GlobalConfig.EXPUNGE_PROMPT; 
    124136        changeType = 0; 
    125137    } 
     
    362374    } 
    363375 
     376    /** 
     377     * Gets whether to prompt on message delete. 
     378     *  
     379     * @return the prompt on delete setting 
     380     */ 
     381    public boolean getPromptOnDelete() { 
     382        return promptOnDelete; 
     383    } 
     384     
     385    /** 
     386     * Sets whether to prompt on message delete. 
     387     *  
     388     * @param promptOnDelete the new prompt on delete setting 
     389     */ 
     390    public void setPromptOnDelete(boolean promptOnDelete) { 
     391        if(this.promptOnDelete != promptOnDelete) { 
     392            this.promptOnDelete = promptOnDelete; 
     393            changeType |= CHANGE_TYPE_PROMPTS; 
     394        } 
     395    } 
     396 
     397    /** 
     398     * Gets the expunge mode. 
     399     *  
     400     * @return the expunge mode 
     401     */ 
     402    public int getExpungeMode() { 
     403        return expungeMode; 
     404    } 
     405     
     406    /** 
     407     * Sets the expunge mode. 
     408     *  
     409     * @param expungeMode the new expunge mode 
     410     */ 
     411    public void setExpungeMode(int expungeMode) { 
     412        if(this.expungeMode != expungeMode) { 
     413            this.expungeMode = expungeMode; 
     414            changeType |= CHANGE_TYPE_PROMPTS; 
     415        } 
     416    } 
     417     
    364418    /* (non-Javadoc) 
    365419     * @see org.logicprobe.LogicMail.util.Serializable#serialize(java.io.DataOutput) 
     
    381435        table.put("global_hideDeletedMsg", new Boolean(hideDeletedMsg)); 
    382436        table.put("global_localHostname", localHostname); 
     437        table.put("global_promptOnDelete", new Boolean(promptOnDelete)); 
     438        table.put("global_expungeMode", new Integer(expungeMode)); 
    383439 
    384440        table.serialize(output); 
     
    447503        if (value instanceof String) { 
    448504            localHostname = (String) value; 
     505        } 
     506        value = table.get("global_promptOnDelete"); 
     507        if(value instanceof Boolean) { 
     508            promptOnDelete = ((Boolean)value).booleanValue(); 
     509        } 
     510        value = table.get("global_expungeMode"); 
     511        if(value instanceof Integer) { 
     512            expungeMode = ((Integer)value).intValue(); 
    449513        } 
    450514        changeType = 0; 
  • trunk/LogicMail/src/org/logicprobe/LogicMail/ui/ConfigScreen.java

    r628 r629  
    9595    private ObjectChoiceField displayOrderChoiceField; 
    9696    private CheckboxField hideDeletedMessagesCheckboxField; 
     97    private CheckboxField promptOnDeleteCheckboxField; 
     98    private ObjectChoiceField expungeModeChoiceField; 
    9799     
    98100    // Networking 
     
    336338                existingGlobalConfig.getHideDeletedMsg()); 
    337339         
     340        promptOnDeleteCheckboxField = new CheckboxField( 
     341                resources.getString(LogicMailResource.CONFIG_GLOBAL_PROMPT_ON_MESSAGE_DELETE), 
     342                existingGlobalConfig.getPromptOnDelete()); 
     343         
     344        expungeModeChoiceField = new ObjectChoiceField( 
     345                resources.getString(LogicMailResource.CONFIG_GLOBAL_EXPUNGE_BEHAVIOR), 
     346                new Object[] { 
     347                    resources.getString(LogicMailResource.CONFIG_GLOBAL_EXPUNGE_PROMPT), 
     348                    resources.getString(LogicMailResource.CONFIG_GLOBAL_EXPUNGE_ALWAYS), 
     349                    resources.getString(LogicMailResource.CONFIG_GLOBAL_EXPUNGE_NEVER) 
     350                }, 
     351                existingGlobalConfig.getExpungeMode()); 
     352 
    338353        messageDisplayFieldManager.add(new LabeledSeparatorField( 
    339354                resources.getString(LogicMailResource.CONFIG_GLOBAL_SECTION_MESSAGE_DISPLAY), 
     
    343358        messageDisplayFieldManager.add(displayOrderChoiceField); 
    344359        messageDisplayFieldManager.add(hideDeletedMessagesCheckboxField); 
     360        messageDisplayFieldManager.add(promptOnDeleteCheckboxField); 
     361        messageDisplayFieldManager.add(expungeModeChoiceField); 
    345362        messageDisplayFieldManager.add(new BlankSeparatorField(separatorHeight)); 
    346363        add(messageDisplayFieldManager); 
     
    972989        config.setHideDeletedMsg(hideDeletedMessagesCheckboxField.getChecked()); 
    973990 
     991        config.setPromptOnDelete(promptOnDeleteCheckboxField.getChecked()); 
     992        config.setExpungeMode(expungeModeChoiceField.getSelectedIndex()); 
     993         
    974994        config.setTransportType(getTransportSetting(networkTransportChoiceField.getSelectedIndex())); 
    975995         
  • trunk/LogicMail/src/org/logicprobe/LogicMail/ui/MailboxScreen.java

    r615 r629  
    4747 
    4848import org.logicprobe.LogicMail.LogicMailResource; 
     49import org.logicprobe.LogicMail.conf.GlobalConfig; 
    4950import org.logicprobe.LogicMail.conf.MailSettings; 
    5051import org.logicprobe.LogicMail.model.MailboxNode; 
     
    248249        if(mailboxNode.getParentAccount().hasExpunge() 
    249250                && mailboxNode.hasDeletedMessages()) { 
    250             // Prompt for expunge if possible and supported 
    251             int choice = Dialog.ask( 
    252                     Dialog.D_YES_NO, 
    253                     resources.getString(LogicMailResource.MAILBOX_EXPUNGE_PROMPT), 
    254                     Dialog.YES); 
    255              
    256             // Request expunge if desired 
    257             if(choice == Dialog.YES) { 
     251            int expungeMode = MailSettings.getInstance().getGlobalConfig().getExpungeMode(); 
     252            if(expungeMode == GlobalConfig.EXPUNGE_PROMPT) { 
     253                // Prompt for expunge if possible and supported 
     254                int choice = Dialog.ask( 
     255                        Dialog.D_YES_NO, 
     256                        resources.getString(LogicMailResource.MAILBOX_EXPUNGE_PROMPT), 
     257                        Dialog.YES); 
     258 
     259                // Request expunge if desired 
     260                if(choice == Dialog.YES) { 
     261                    mailboxNode.expungeDeletedMessages(); 
     262                } 
     263            } 
     264            else if(expungeMode == GlobalConfig.EXPUNGE_ALWAYS) { 
    258265                mailboxNode.expungeDeletedMessages(); 
    259266            } 
    260267        } 
    261          
     268 
    262269        // Close the screen 
    263270        screen.close(); 
  • trunk/LogicMail/src/org/logicprobe/LogicMail/ui/MessageActions.java

    r620 r629  
    328328     */ 
    329329    public void deleteMessage(MessageNode messageNode) { 
    330         if(Dialog.ask(Dialog.D_YES_NO, resources.getString(LogicMailResource.MAILBOX_DELETE_PROMPT)) == Dialog.YES) { 
    331                 messageNode.deleteMessage(); 
     330        if(MailSettings.getInstance().getGlobalConfig().getPromptOnDelete()) { 
     331            if(Dialog.ask(Dialog.D_YES_NO, resources.getString(LogicMailResource.MAILBOX_DELETE_PROMPT)) == Dialog.YES) { 
     332                messageNode.deleteMessage(); 
     333            } 
     334        } 
     335        else { 
     336            messageNode.deleteMessage(); 
    332337        } 
    333338    } 
Note: See TracChangeset for help on using the changeset viewer.