📄 hushapplet.java
字号:
wasSent=true; } if (ccToSelfCheckbox.getState() && wasSent) { if (c.folderName().equals("sent")) listMessages("sent",0,true); listFolders(0,true); } c.done(); if (wasSent) { currentScreen = "listMessages"; mainLayout.show(main,currentScreen); clearCommands(); add(commands,commandsConstraints,selectAllButton,1,0); showSelectFunctionButtons(messagesSelected()>0,1); cBody.setText(" "); compose("","","","","",""); statusBar(spaces+"Message sent"+spaces); lockButtons(false); } else { clearCommands(); add(commands,commandsConstraints,backButton,0,0); add(commands,commandsConstraints,clearButton,1,0); add(commands,commandsConstraints,saveDraftButton,2,0); add(commands,commandsConstraints,sendButton,3,0); currentScreen = "compose"; mainLayout.show(main,currentScreen); lockButtons(false); } } catch (IOException e0) { clearCommands(); lockButtons(false); add(commands,commandsConstraints,backButton,0,0); add(commands,commandsConstraints,clearButton,1,0); add(commands,commandsConstraints,saveDraftButton,2,0); add(commands,commandsConstraints,sendButton,3,0); currentScreen = "compose"; mainLayout.show(main,currentScreen); error(); } } /* On click of the "Back" button */ else if (e.target==backButton) { // Return to list of messages in currently open folder clearCommands(); try { listMessages(c.folderName(),currentMessagePage,false); } catch (IOException ee) { /* can't happen */ } if (c.numberOfMessages()>0) add(commands,commandsConstraints,selectAllButton,0,0); currentScreen = "listMessages"; showSelectFunctionButtons(messagesSelected()>0,1); mainLayout.show(main,currentScreen); } /* On click of the "Reply" or "Forward" button */ else if (e.target==replyButton || e.target==forwardButton) { clearCommands(); add(commands,commandsConstraints,backButton,0,0); add(commands,commandsConstraints,clearButton,1,0); add(commands,commandsConstraints,saveDraftButton,2,0); add(commands,commandsConstraints,sendButton,3,0); StringBuffer mbody = new StringBuffer(c.body()); if (e.target==replyButton) { mbody.insert(0,">"); for (int x=0;x<mbody.length();x++) if (mbody.charAt(x)=='\n') mbody.insert(x+1,">"); String l="At "+c.date()+", "+c.from()+" wrote:\n\n"; String prefix = "Re: "; if (c.subject().regionMatches(true,0,"Re:",0,3)) prefix=""; if (c.replyTo().length()>0) compose(prefix+ c.subject().replace('\n',' '),"", c.replyTo().replace('\n',' '),"","",l+mbody.toString()); else compose(prefix+c.subject().replace('\n',' '),"", c.from().replace('\n',' '),"","", l+mbody.toString()); } else { String fm = new String("---------- Forwarded message ----------\n"); fm=fm+"Date: "+c.date()+"\nSubject: "+c.subject()+"\nFrom: "+c.from()+"\n"; if (c.replyTo().length()>0) fm=fm+"Reply-to: "+c.replyTo()+"\n"; fm=fm+"To: "+c.to()+"\n"; if (c.cc().length()>0) fm=fm+"Cc: "+c.cc()+"\n"; fm=fm+"\n"+c.body(); String suffix = ""; if (c.subject().indexOf("(fwd)")==-1) suffix=" (fwd)"; compose(c.subject().replace('\n',' ')+suffix,"","","","",fm); } cDate.setText("Date: "+new Date().toString()); currentScreen = "compose"; mainLayout.show(main,currentScreen); c.wipeMessage(); } /* On click of the "Delete" button */ else if (e.target==deleteButton || e.target==deleteButtonR) { if (currentScreen.equals("listFolders") && folderSelected[0]) statusBar(spaces+"Cannot delete inbox"+spaces); else { clearCommands(); lockButtons(true); if (currentScreen.equals("read")) confirmLabel.setText("Are you sure you want to delete this message?"); else confirmLabel.setText("Are you sure you want to delete the selection?"); add(commands,commandsConstraints,confirmLabel,0,0); add(commands,commandsConstraints,confirmDeleteButton,1,0); add(commands,commandsConstraints,cancelDeleteButton,2,0); commands.paintAll(commands.getGraphics()); } return true; } /* On click of "Ok" button for delete */ else if (e.target==confirmDeleteButton) { clearCommands(); /* Delete a folder */ if (currentScreen.equals("listFolders")) { add(commands,commandsConstraints, new Label("Deleting folder(s) " +" "),0,0); commands.paintAll(commands.getGraphics()); /* Copy folderlist to compensate for changes during multiple deletes */ String[] folderListCopy=new String[c.numberOfFolders()]; int numberOfFoldersCopy=c.numberOfFolders(); for (int x=0; x<c.numberOfFolders(); x++) folderListCopy[x]=c.folderName(x); try { c.use(); for (int x=0; x<numberOfFoldersCopy; x++) { if (folderSelected[x]) c.deleteFolder(folderListCopy[x]); } listFolders(0,true); c.done(); } catch (IOException e1) {error();} clearCommands(); add(commands,commandsConstraints,newFolderButton,0,0); add(commands,commandsConstraints,selectAllButton,1,0); showSelectFunctionButtons(false,2); lockButtons(false); } /* Delete a message */ else if (currentScreen.equals("listMessages")) { add(commands,commandsConstraints, new Label("Deleting message(s) " +" "),0,0); commands.paintAll(commands.getGraphics()); int deleteCount=0; /* Special variable to compensate for changes during multiple deletes */ try { c.use(); for (int x=0; x<c.numberOfMessages(); x++) if (messageSelected[x]) { c.deleteMessage(c.messageID(x)-deleteCount); deleteCount++; } listMessages(c.folderName(),0,true); listFolders(currentFolderPage,true); c.done(); } catch (IOException e2) {error();} clearCommands(); if (c.numberOfMessages()>0) { add(commands,commandsConstraints,selectAllButton,0,0); showSelectFunctionButtons(messagesSelected()>0,1); } lockButtons(false); } /* Delete a message off the read screen */ else if (currentScreen.equals("read")) { add(commands,commandsConstraints, new Label("Deleting message " +" "),0,0); commands.paintAll(commands.getGraphics()); try { c.use(); c.deleteMessage(c.messageID()); listMessages(c.folderName(),0,true); listFolders(currentFolderPage,true); c.done(); } catch (IOException ee) {error();} c.wipeMessage(); clearCommands(); if (c.numberOfMessages()>0) { add(commands,commandsConstraints,selectAllButton,0,0); showSelectFunctionButtons(messagesSelected()>0,1); } currentScreen = "listMessages"; lockButtons(false); mainLayout.show(main,currentScreen); } /* Delete an address */ else if (currentScreen.equals("addresses")) { lockButtons(true); add(commands,commandsConstraints, new Label("Deleting address "+ " "),0,0); commands.paintAll(commands.getGraphics()); try { c.use(); c.deleteAddress(c.nickname(markForDelete)); listAddresses(0,true); c.done(); } catch (IOException e3) {error();} clearCommands(); add(commands,commandsConstraints,newAddressButton,0,0); add(commands,commandsConstraints,showFingerprintButton,1,0); lockButtons(false); } else if (currentScreen.equals("compose")) { clearCommands(); add(commands,commandsConstraints,backButton,0,0); add(commands,commandsConstraints,clearButton,1,0); add(commands,commandsConstraints,saveDraftButton,2,0); add(commands,commandsConstraints,sendButton,3,0); compose("","","","","",""); lockButtons(false); } } /* On click of "Cancel" button for delete */ else if (e.target==cancelDeleteButton) { commands.remove(confirmLabel); commands.remove(confirmDeleteButton); commands.remove(cancelDeleteButton); if (currentScreen.equals("listFolders")) { add(commands,commandsConstraints,newFolderButton,0,0); add(commands,commandsConstraints,selectAllButton,1,0); showSelectFunctionButtons(foldersSelected()>0,2); } else if (currentScreen.equals("listMessages")) { add(commands,commandsConstraints,selectAllButton,0,0); showSelectFunctionButtons(messagesSelected()>0,1); } else if (currentScreen.equals("read")) { clearCommands(); add(commands,commandsConstraints,backButton,0,0); add(commands,commandsConstraints,replyButton,1,0); add(commands,commandsConstraints,forwardButton,2,0); add(commands,commandsConstraints,deleteButtonR,3,0); add(commands,commandsConstraints,saveButtonR,4,0); } else if (currentScreen.equals("compose")) { clearCommands(); add(commands,commandsConstraints,backButton,0,0); add(commands,commandsConstraints,clearButton,1,0); add(commands,commandsConstraints,saveDraftButton,2,0); add(commands,commandsConstraints,sendButton,3,0); } lockButtons(false); } /* On click of the "New Folder" button */ else if (e.target==newFolderButton) { clearCommands(); lockButtons(true); if (smallApplet) formatTextComponent(newFolderField = new TextField(18),true); else formatTextComponent(newFolderField = new TextField(26),true); add(commands,commandsConstraints,newNameLabel,0,0); add(commands,commandsConstraints,newFolderField,1,0); add(commands,commandsConstraints,smallNewFolderButton,2,0); add(commands,commandsConstraints,cancelNewFolderButton,3,0); commands.paintAll(commands.getGraphics()); newFolderField.requestFocus(); return true; } /* On enter of new name for folder */ else if (e.target==newFolderField || e.target==smallNewFolderButton) { String newFolderName=newFolderField.getText().trim(); if (validFolderName(newFolderName)) { for (int a=0;a<c.numberOfFolders();a++) { if (c.folderName(a).equals(newFolderName)) { statusBar(spaces+"That foldername already exists!"+spaces); ignoreLostFocus = true; newFolderField.requestFocus(); return true; } } clearCommands(); add(commands,commandsConstraints, new Label("Creating folder " +" "),0,0); commands.paintAll(commands.getGraphics()); int x; for (x=0;x<c.numberOfFolders();x++) if (folderSelected[x]) break; try { c.use(); c.newFolder(newFolderName); listFolders(currentFolderPage,true); c.done(); } catch (IOException e4) {error();} clearCommands(); add(commands,commandsConstraints,newFolderButton,0,0); add(commands,commandsConstraints,selectAllButton,1,0); showSelectFunctionButtons(foldersSelected()>0,2); lockButtons(false); } else { ignoreLostFocus=true; newFolderField.requestFocus(); } } /* On click of "Cancel" button for new folder */ else if (e.target==cancelNewFolderButton) { commands.remove(newNameLabel); commands.remove(newFolderField); commands.remove(smallNewFolderButton); commands.remove(cancelNewFolderButton); add(commands,commandsConstraints,newFolderButton,0,0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -