mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Prevent users from hiding unintentionally.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@6836 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -12,6 +12,7 @@ package org.jivesoftware.spark.component;
|
||||
|
||||
import org.jdesktop.jdic.tray.SystemTray;
|
||||
import org.jdesktop.jdic.tray.TrayIcon;
|
||||
import org.jivesoftware.MainWindow;
|
||||
import org.jivesoftware.MainWindowListener;
|
||||
import org.jivesoftware.Spark;
|
||||
import org.jivesoftware.resource.Res;
|
||||
@ -23,17 +24,6 @@ import org.jivesoftware.spark.ui.PresenceListener;
|
||||
import org.jivesoftware.spark.ui.status.StatusBar;
|
||||
import org.jivesoftware.spark.ui.status.StatusItem;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
@ -50,6 +40,17 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
/**
|
||||
* Handles tray icon operations inside of Spark. Use to display incoming chat requests, incoming messages
|
||||
* and general notifications.
|
||||
@ -75,6 +76,8 @@ public final class Notifications implements ActionListener, MainWindowListener {
|
||||
|
||||
private JFrame hideWindow = null;
|
||||
|
||||
private long madeVisibleTime = 0;
|
||||
|
||||
/**
|
||||
* Creates a new instance of notifications.
|
||||
*/
|
||||
@ -239,6 +242,16 @@ public final class Notifications implements ActionListener, MainWindowListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Object o = e.getSource();
|
||||
if (!(o instanceof JMenuItem)) {
|
||||
MainWindow window = SparkManager.getMainWindow();
|
||||
if (window.isVisible() && window.getState() == Frame.NORMAL) {
|
||||
long now = System.currentTimeMillis();
|
||||
if (now - madeVisibleTime > 1000) {
|
||||
window.setVisible(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
madeVisibleTime = System.currentTimeMillis();
|
||||
showMainWindow();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user