⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mujmail.java

📁 手机邮箱撒的方式方式方式的
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
            // Loads mails into all mailboxe in serial way
            userMailBoxes.loadBoxes();
            //#else
//#             // We have to asynchronous load standard mail boxes
//#             Thread boxLoader = new Thread() {
//#                 public void run() {
//#                     loadDefaulFolders();
//#                 }
//#             };
//#             boxLoader.start();
            //#endif

            Properties.showStartupAlerts(alert); // Show warnings about abilities of your mobile

            // We have to load accounts every time, even if no acocunt exists -> Synchronisation
            //    We have to set flag that accounts are loaded to be able add new user folders
            //    Otherwise if no account on start exists, creating User folder will block
            getAccountSettings().loadAccounts();
            // show an account form initialized by default values
            if (showAccountForm) {
                getAccountSettings().showAccount("DEFAULT_INIT");
                return;
            }
            // Toto Test
            if ( getMenu() != null ) {
                    getMenu().setSelectedTab(Menu.ACTION);
                    getMenu().refresh(Menu.ACTION, !showAccountForm);
            } else {
                System.out.println("MujMail.myStartApplication() - menu is null");
            }
        } else {
            myDisplay.setCurrent(lastDisplay);
        } //show the original display before that
        } catch ( Throwable t ) {
            System.out.println("MujMail.myStartApplication() - exception");
            t.printStackTrace();
        }
    }

    
    
    public synchronized void commandAction(Command c, Displayable d) {
        if (DEBUG) System.out.println("DEBUG MujMai.commandAction - start");
        if (c == getSettings().back) {
            settings.loadSettings();
            myDisplay.setCurrent(getMenu());
        } else if (c == getSettings().ok) {
            getSettings().saveSettings(true);
        }

        if (d == clearDBSelect) {
            if (c == clearDBSelect.OK) {
                clearDBSelect.clearDataBases(false, false);
            } else {
                myDisplay.setCurrent(getMenu());
            }
        } else if (d == getAccountSettings()) {
            if (c == getAccountSettings().back) {
            	//This function has to be called as it refreshes the menu
            	mainMenu();
            } else if (c == getAccountSettings().ok) {
                getAccountSettings().saveAccount(getMenu().getSelectedAccount(), null);
            }
        } else if (d == sendMail) {
            //#ifdef MUJMAIL_FS
            if (c == sendMail.getAttachementsAdder().attach) {
                sendMail.getAttachementsAdder().attachFileSelection();
            }
            
            if (c == sendMail.getAttachementsAdder().remove) {
                sendMail.getAttachementsAdder().removeAllAttachments();
            }
            //#endif
            if (c == sendMail.bc) {
                sendMail.addBc();
            } else if (c == sendMail.send) {
                sendMail.selectedField = null;
                OutBox box = (c == sendMail.draft) ? draft : outBox;
                if (box.isBusy()) {
                    alert.setAlert(null, sendMail, Lang.get(Lang.ALRT_SYS_BUSY), MyAlert.DEFAULT, AlertType.INFO);
                } else {
                    myDisplay.setCurrent(box);
                    box.sendSingle(box.addOutMail(sendMail));
                }
            } else if (c == sendMail.sendLater || c == sendMail.draft) {
                sendMail.selectedField = null;
                OutBox box = (c == sendMail.draft) ? draft : outBox;
                if (box.isBusy()) {
                    alert.setAlert(null, sendMail, Lang.get(Lang.ALRT_SYS_BUSY), MyAlert.DEFAULT, AlertType.INFO);
                } else {
                    if (sendMail.mode != SendMail.NORMAL) {
                        myDisplay.setCurrent(sendMail.callBox);
                    }
                    box.addOutMail(sendMail);
                    mainMenu();
                }
            } else if (c == sendMail.editBody) {
                sendMail.editBody();
            } else if (c == sendMail.clear) {
                sendMail.clear();
            } else if (c == sendMail.cancel) {
                sendMail.selectedField = null;
                if (sendMail.mode != SendMail.NORMAL) {
                    if (sendMail.mode == SendMail.FORWARD) {
                        sendMail.delete(sendMail.size() - 1);
                    }
                    sendMail.clear();
                    sendMail.mode = SendMail.NORMAL;
                }

                sendMail.showNextScreen();
            } else if (c == sendMail.addRcp) {
                getAddressBook().addEmails(sendMail);
            } else if (c == sendMail.preview) {
                mailForm.previewMessage();
            } else if (c == sendMail.chooseAccount) {
                sendMail.chooseAccounts();
            } 
        } else if (d == sendMail.editbodyTB) {
            if (c == sendMail.updateBody) {
                sendMail.updateBody();
            } else if (c == sendMail.cancelBody) {
                sendMail.cancelBody();
            }
        } else if (d == sendMail.accountsForm) {
            if (c == sendMail.ok) {
                sendMail.selectFromAccount();
            } else if (c == sendMail.cancel) {
                myDisplay.setCurrent(sendMail);
            }
        } else if (d == mailForm) {
            if (c == mailForm.back) {
                if (mailForm.getContext() == MailForm.MODE_BASIC) {
                    mailForm.back();
                } // it was an attachment's detail so return to attachment list
                else {
                    myDisplay.setCurrent(mailForm.attchList);
                }
            } else if (c == mailForm.listAttachments) {
                mailForm.listAttachments();
            } else if (c == mailForm.showAddresses) {
                mailForm.listMailAddr();
            } else if (c == mailForm.showHeader) {
                mailForm.showHeader(mailForm.msgHeader, mailForm);
            //#ifdef MUJMAIL_FS
            } else if (c == mailForm.exportToFS) {
                mailForm.exportToFilesystem();
            //#endif
            } else if (c == mailForm.forward) { 
                System.out.println("Forward from mailForm");
                sendMail.initForward(mailForm.callBox, mailForm);
            } //else if (c == mailForm.edit) {
                //commandAction(mailForm.callBox.edit, mailForm.callBox);
            //}
            else if (c == mailForm.edit) {
                MessageHeader om = mailForm.msgHeader;
                if (om != null) {
                    sendMail.edit(om, mailForm);
                }
            } else if (c == mailForm.reply) {
                if (getInBox().getSelectedIndex() < getInBox().getStorage().getSize()) {
                    sendMail.reply(getInBox().getSelectedHeader());
                }
            } else if (c == mailForm.quotedReply) {
                if (getInBox().getSelectedIndex() < getInBox().getStorage().getSize()) {
                    sendMail.quotedReply(getInBox().getSelectedHeader());
                }
            } else if (c == mailForm.replyAll) {
                if (getInBox().getSelectedIndex() < getInBox().getStorage().getSize()) {
                    sendMail.replyAll(getInBox().getSelectedHeader());
                }
            } else if (c == mailForm.delete) {
                myDisplay.setCurrent(mailForm.callBox);
                mailForm.callBox.commandAction(mailForm.callBox.delete, mailForm.callBox);
            }

        } else if (d == mailForm.mailAdrList) {
            if (c == mailForm.back) {
                myDisplay.setCurrent(mailForm);
            } else if (c == mailForm.addMailToBook) {
                mailForm.saveContacts();
            }
        } else if (d == mailForm.attchList) {
            if (c == mailForm.back) {
                if (mailForm.getContext() == MailForm.MODE_LIST) {
                    mailForm.back();
                } else {
                    mailForm.setContext(MailForm.MODE_BASIC);
                    myDisplay.setCurrent(mailForm);
                }
            } else if (c == mailForm.deleteAttachment) {
                mailForm.deleteBodyPart((byte) (mailForm.attchList.getSelectedIndex()));
            } else if (c == mailForm.redownAttchment) {
                mailForm.regetAndList(getInBox().getSelectedHeader(),
                        (byte) (mailForm.attchList.getSelectedIndex()));
            } else if (c == mailForm.showAddresses) {
                mailForm.listMailAddr();
            //#ifdef MUJMAIL_FS
            } else if (c == mailForm.exportBPToFS) {
                mailForm.exportBPToFS((byte) mailForm.attchList.getSelectedIndex());
            //#endif
            } else if (c == mailForm.displayAsText) {
                mailForm.viewBodyPart((byte) (mailForm.attchList.getSelectedIndex()), MailForm.BPViewingModes.AS_TEXT);
            } else if (c == mailForm.viewConverted) {
            	mailForm.viewBodyPart((byte) (mailForm.attchList.getSelectedIndex()), MailForm.BPViewingModes.CONVERTED );
            } else {
                mailForm.viewBodyPart((byte) (mailForm.attchList.getSelectedIndex()), MailForm.BPViewingModes.NOT_SPECIFIED);
            }
        } else if (d == mailForm.headerForm) {
            if (c == mailForm.back) {
                mailForm.setContext(MailForm.MODE_BASIC);
                mailForm.showPreviousScreen();
            }
        } else if (d == getAddressBook()) {
            if (c == getAddressBook().add) {
                getAddressBook().showCntForm(null);
            } else if (c == getAddressBook().delete) {
                getAddressBook().delete(getAddressBook().getSelectedIndex(), false);
            } else if (c == getAddressBook().edit) {
                getAddressBook().edit(getAddressBook().getSelectedIndex());
            } else if (c == getAddressBook().delAll) {
                getAddressBook().deleteAll(false);
            } else if (c == getAddressBook().view) {
                getAddressBook().view(getAddressBook().getSelectedIndex());
            } else if (c == getAddressBook().sendMail) {
                getAddressBook().sendMail(getAddressBook().getSelectedIndex());
            } else if (c == getAddressBook().mark) {
                getAddressBook().markEmail(getAddressBook().getSelectedIndex());
            } else if (c == getAddressBook().done) {
                getAddressBook().pasteEmails();
            } else if (c == getAddressBook().flipRcps) {
                getAddressBook().flipRecipients();
            } else if (c == getAddressBook().back) {
                getAddressBook().back();
            }
        } else if (d == getAddressBook().cntForm) {
            if (c == getAddressBook().cfBack) {
                myDisplay.setCurrent(getAddressBook());
            } else if (c == getAddressBook().cfSave) {
                getAddressBook().saveContactForm();
            }
        } else if (d == getAddressBook().viewForm) {
            myDisplay.setCurrent(getAddressBook());
        } else if (d == getSettings().sortForm) {
            if (c == getSettings().ok) {
                getSettings().saveSortSettings( getSettings().sortForm.box);
                final Enumeration enum1 = getSettings().sortForm.box.getStorage().getEnumeration();
                MessageHeader messageHeader;
                final Vector/*<MessageHeader>*/ messageHeaders = new Vector();
                while ( enum1.hasMoreElements() ) {
                	messageHeader = (MessageHeader)enum1.nextElement();
                	messageHeaders.addElement( messageHeader );
                }
                TheBox sortedBox = getSettings().sortForm.box; 
                sortedBox.setStorage( Algorithm.getAlgorithm().invoke( messageHeaders ) );
                sortedBox.resort();
                if ( sortedBox instanceof InBox ) {
                    ((InBox)sortedBox).setCurFirstUnread();
                }
            }
            myDisplay.setCurrent(getSettings().sortForm.box);
        } else if (d == about) {
            if (c == about.feedBack) {
                sendMail.subject.setString("mujMail feedback");
                sendMail.to.setString("support@mujMail.org");
                sendMail.writeMail(d);
            } else {
                myDisplay.setCurrent(getMenu());
            }
        } else if (d == alert.alertWindow) {
            MyAlert.AlertJob al = alert.lastJob;
            switch (al.mode) {
                case MyAlert.DB_CLEAR_CONFIRM:
                    if (c == alert.OK) {
                        if (al.callObject == getAddressBook()) {
                            getAddressBook().deleteAll(true);
                        } else if (al.callObject == getAccountSettings()) {
                            getAccountSettings().deleteAll(true);
                        } else if (al.callObject == clearDBSelect) {
                            clearDBSelect.clearDataBases(true, false);
                        } else {
                            ((TheBox) al.callObject).deleteAllMailsFromBoxAndDB(true);
                        }
                    }
                    break;
                case MyAlert.DEL_CONFIRM:
                    if (c == alert.OK) {
                        if (al.callObject == getAccountSettings()) {
                            getAccountSettings().deleteAccount(getMenu().getSelectedAccount(), true);
                        } else if (al.callObject == getAddressBook()) {
                            getAddressBook().delete(getAddressBook().getSelectedIndex(), true);
                        }
                    }
                    break;
                case MyAlert.EXIT_BUSY_CONFIRM:
                    if (c == alert.OK) {
                        destroyApp(false);
                    }
                    break;
                case MyAlert.DEFAULT:
                    break;
            }
            myDisplay.setCurrent(alert);
        }

    }
   
    /// Disconnect from connected servers (SMTP, POP..)
    public void discServers(boolean forcedClose) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -