Skip to content

Commit

Permalink
make click to dismiss optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Perry Nguyen committed Nov 2, 2009
1 parent 4c60570 commit ed32f56
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
Expand Up @@ -2,6 +2,8 @@ seconds: {0} seconds
neverString: Never
$label.autoDismissMail.text: Time to wait before auto-hiding mail notifications:

clickToDismiss.text: Click on a message to dismiss its alert

$label.mailLocation.text: Mail notifications screen location:
mTopLeft.text: Top Left
mTopRight.text: Top Right
Expand Down Expand Up @@ -37,6 +39,7 @@ $separator.2: 0, 7, 3, h, (20)
$label.autoDismissMail: 0, 8, w, h, 1.0, (0, 5, 0, 15)
autoHideTime: 2, 8, e, (0, 0, 0)

$spacer.1: 0, 9, 3, 0.0, 1.0
clickToDismiss: 0, 9, w, h, 2, 1.0, (0, 5, 0, 15)
$spacer.1: 0, 10, 3, 0.0, 1.0

$spacer.2: 3, 0, 1, 8, h, (3)
$spacer.2: 3, 0, 1, 10, h, (3)
3 changes: 2 additions & 1 deletion src/java/com/zimbra/app/systray/MessageListView.java
Expand Up @@ -482,7 +482,8 @@ public void mouseClicked(final MouseEvent e) {
Rectangle r = list.getCellBounds(index, index);
if (r.contains(e.getPoint())) {
list.setSelectedIndex(index);
if (dismissAction.isEnabled())
if (Prefs.getPrefs().getClickToDismiss() &&
dismissAction.isEnabled())
dismissAction.actionPerformed(null);
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/java/com/zimbra/app/systray/Prefs.java
Expand Up @@ -20,6 +20,7 @@ public enum ScreenLocation {

private final static String SYMMETRIC_ALGORITHM = "AES";

private final static String CLICK_DISMISS_KEY = "clickToDismiss";
private final static String AUTO_HIDE_KEY = "autoHideTime";
private final static String SOAP_DEBUG_KEY = "soapDebug";
private final static String ACCOUNTS_KEY = "accounts";
Expand Down Expand Up @@ -150,6 +151,14 @@ public boolean isSoundDisabled() {
return prefs.getBoolean(DISABLED_SOUND_KEY, false);
}

public void setClickToDismiss(boolean b) {
prefs.putBoolean(CLICK_DISMISS_KEY, b);
}

public boolean getClickToDismiss() {
return prefs.getBoolean(CLICK_DISMISS_KEY, false);
}

public void setSoapDebug(boolean b) {
prefs.putBoolean(SOAP_DEBUG_KEY, b);
}
Expand Down
10 changes: 10 additions & 0 deletions src/java/com/zimbra/app/systray/options/GeneralOptionsForm.java
Expand Up @@ -7,6 +7,7 @@

import javax.swing.ButtonGroup;
import javax.swing.JComboBox;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.JRadioButton;

Expand All @@ -20,6 +21,7 @@ public class GeneralOptionsForm extends ResourceBundleForm {
5, 10, 15, 30, 60, -1
};
private JPanel panel = new JPanel();
private JCheckBox clickToDismiss = new JCheckBox();
private JRadioButton mTopLeft = new JRadioButton();
private JRadioButton mTopRight = new JRadioButton();
private JRadioButton mCenter = new JRadioButton();
Expand Down Expand Up @@ -151,6 +153,14 @@ public void actionPerformed(ActionEvent e) {
autoHideTime.setSelectedIndex(idx != -1 ?
idx : AUTO_HIDE_TIMES.length - 1);
panel.add(autoHideTime, "autoHideTime");

clickToDismiss.setSelected(Prefs.getPrefs().getClickToDismiss());
clickToDismiss.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Prefs.getPrefs().setClickToDismiss(clickToDismiss.isSelected());
}
});
panel.add(clickToDismiss, "clickToDismiss");
}

private String[] generateTimeStrings() {
Expand Down

0 comments on commit ed32f56

Please sign in to comment.