01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
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;
19: import java.util.logging.Logger;
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: * @author frd
31: *
32: * To change this generated comment go to
33: * Window>Preferences>Java>Code Generation>Code and Comments
34: */
35: public class EncryptMessageAction extends AbstractSelectableAction {
36:
37: /** JDK 1.4+ logging framework logger, used for logging. */
38: private static final Logger LOG = Logger
39: .getLogger("org.columba.mail.gui.composer.action");
40:
41: public EncryptMessageAction(ComposerController composerController) {
42: super (composerController, MailResourceLoader.getString("menu",
43: "composer", "menu_message_encrypt"));
44:
45: // tooltip text
46: putValue(SHORT_DESCRIPTION, MailResourceLoader.getString(
47: "menu", "composer", "menu_message_encrypt").replaceAll(
48: "&", ""));
49:
50: // small icon for menu
51: putValue(SMALL_ICON, MailImageLoader.getSmallIcon("lock.png"));
52:
53: ComposerModel model = composerController.getModel();
54: AccountItem account = model.getAccountItem();
55: SecurityItem pgp = account.getPGPItem();
56:
57: setState(pgp.getBooleanWithDefault("always_encrypt", false));
58:
59: //setEnabled(false);
60: }
61:
62: /* (non-Javadoc)
63: * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
64: */
65: public void actionPerformed(ActionEvent evt) {
66: LOG.info("start encryption...");
67:
68: ComposerModel model = (ComposerModel) ((ComposerController) getFrameMediator())
69: .getModel();
70: model.setEncryptMessage(getState());
71: }
72: }
|