KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > gui > composer > action > EncryptMessageAction


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14
//
15
//All Rights Reserved.
16
package org.columba.mail.gui.composer.action;
17
18 import java.awt.event.ActionEvent JavaDoc;
19 import java.util.logging.Logger JavaDoc;
20
21 import org.columba.core.gui.action.AbstractSelectableAction;
22 import org.columba.mail.config.AccountItem;
23 import org.columba.mail.config.SecurityItem;
24 import org.columba.mail.gui.composer.ComposerController;
25 import org.columba.mail.gui.composer.ComposerModel;
26 import org.columba.mail.resourceloader.MailImageLoader;
27 import org.columba.mail.util.MailResourceLoader;
28
29
30 /**
31  * @author frd
32  *
33  * To change this generated comment go to
34  * Window>Preferences>Java>Code Generation>Code and Comments
35  */

36 public class EncryptMessageAction extends AbstractSelectableAction {
37
38     /** JDK 1.4+ logging framework logger, used for logging. */
39     private static final Logger JavaDoc LOG = Logger.getLogger("org.columba.mail.gui.composer.action");
40
41     public EncryptMessageAction(ComposerController composerController) {
42         super(composerController,
43             MailResourceLoader.getString("menu", "composer",
44                 "menu_message_encrypt"));
45
46         // tooltip text
47
putValue(SHORT_DESCRIPTION,
48             MailResourceLoader.getString("menu", "composer",
49                 "menu_message_encrypt").replaceAll("&", ""));
50
51         // small icon for menu
52
putValue(SMALL_ICON, MailImageLoader.getSmallIcon("lock.png"));
53         
54         ComposerModel model = composerController.getModel();
55         AccountItem account = model.getAccountItem();
56         SecurityItem pgp = account.getPGPItem();
57    
58         setState(pgp.getBooleanWithDefault("always_encrypt", false));
59         
60         //setEnabled(false);
61
}
62
63     /* (non-Javadoc)
64      * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
65      */

66     public void actionPerformed(ActionEvent JavaDoc evt) {
67         LOG.info("start encryption...");
68
69         ComposerModel model = (ComposerModel) ((ComposerController) getFrameMediator()).getModel();
70         model.setEncryptMessage(getState());
71     }
72 }
73
Popular Tags