mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
1) Update spark phone.
2) Have dial use other thread. 3) Update new spark ico. git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@7799 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Binary file not shown.
@ -21,6 +21,10 @@ import org.jivesoftware.spark.ui.rooms.ChatRoomImpl;
|
||||
import org.jivesoftware.spark.util.SwingWorker;
|
||||
import org.jivesoftware.sparkimpl.plugin.phone.JMFInit;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
@ -28,10 +32,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
/**
|
||||
* Handles general phone behavior in Spark. This allows for many different phone systems
|
||||
* to plug into Spark in a more elegant way.
|
||||
@ -180,33 +180,48 @@ public class PhoneManager implements ChatRoomListener, ContextMenuListener {
|
||||
}
|
||||
|
||||
|
||||
public void poppingUp(Object object, JPopupMenu popup) {
|
||||
public void poppingUp(Object object, final JPopupMenu popup) {
|
||||
if (!phones.isEmpty()) {
|
||||
if (object instanceof ContactItem) {
|
||||
ContactItem contactItem = (ContactItem)object;
|
||||
final ContactItem contactItem = (ContactItem)object;
|
||||
final List<Action> actions = new ArrayList<Action>();
|
||||
for (Phone phone : phones) {
|
||||
final Collection<Action> itemActions = phone.getPhoneActions(contactItem.getJID());
|
||||
for (Action action : itemActions) {
|
||||
actions.add(action);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (actions.size() > 0) {
|
||||
final JMenu dialMenu = new JMenu("Dial");
|
||||
dialMenu.setIcon(SparkRes.getImageIcon(SparkRes.DIAL_PHONE_IMAGE_16x16));
|
||||
|
||||
for (Action action : actions) {
|
||||
dialMenu.add(action);
|
||||
SwingWorker worker = new SwingWorker() {
|
||||
public Object construct() {
|
||||
for (Phone phone : phones) {
|
||||
final Collection<Action> itemActions = phone.getPhoneActions(contactItem.getJID());
|
||||
for (Action action : itemActions) {
|
||||
actions.add(action);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
int count = popup.getComponentCount();
|
||||
if (count > 2) {
|
||||
popup.insert(dialMenu, 2);
|
||||
}
|
||||
public void finished() {
|
||||
|
||||
if (actions.size() > 0) {
|
||||
final JMenu dialMenu = new JMenu("Dial");
|
||||
dialMenu.setIcon(SparkRes.getImageIcon(SparkRes.DIAL_PHONE_IMAGE_16x16));
|
||||
|
||||
for (Action action : actions) {
|
||||
dialMenu.add(action);
|
||||
}
|
||||
|
||||
int count = popup.getComponentCount();
|
||||
if (count > 2) {
|
||||
popup.insert(dialMenu, 2);
|
||||
}
|
||||
|
||||
popup.invalidate();
|
||||
popup.validate();
|
||||
popup.repaint();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
worker.start();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 284 KiB |
Reference in New Issue
Block a user