mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
SPARK-1375 fix right click menu when privacy list is active and multiple users are selected
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12494 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
committed by
holger.bergunde
parent
c1c3e9793c
commit
6d8acb7bdf
@ -127,50 +127,53 @@ public class PrivacyPlugin implements Plugin {
|
||||
@Override
|
||||
public void poppingUp(Object object, JPopupMenu popup) {
|
||||
|
||||
final PrivacyManager pManager = PrivacyManager.getInstance();
|
||||
if (object instanceof ContactItem)
|
||||
{
|
||||
final PrivacyManager pManager = PrivacyManager.getInstance();
|
||||
|
||||
if (pManager.hasActiveList())
|
||||
{
|
||||
final SparkPrivacyList activeList = pManager.getActiveList();
|
||||
if (pManager.hasActiveList())
|
||||
{
|
||||
final SparkPrivacyList activeList = pManager.getActiveList();
|
||||
|
||||
|
||||
final ContactItem item = (ContactItem) object;
|
||||
JMenuItem blockMenu;
|
||||
final ContactItem item = (ContactItem) object;
|
||||
JMenuItem blockMenu;
|
||||
|
||||
if ( activeList.isBlockedItem(item.getJID()) ) {
|
||||
blockMenu = new JMenuItem(Res.getString("menuitem.unblock.contact"), SparkRes.getImageIcon(SparkRes.UNBLOCK_CONTACT_16x16));
|
||||
blockMenu.addActionListener(new ActionListener() { //unblock contact
|
||||
if ( activeList.isBlockedItem(item.getJID()) ) {
|
||||
blockMenu = new JMenuItem(Res.getString("menuitem.unblock.contact"), SparkRes.getImageIcon(SparkRes.UNBLOCK_CONTACT_16x16));
|
||||
blockMenu.addActionListener(new ActionListener() { //unblock contact
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ae) {
|
||||
if ( item != null ) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ae) {
|
||||
if ( item != null ) {
|
||||
activeList.removeItem(((ContactItem) item).getJID()); //Add to block list
|
||||
activeList.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
blockMenu = new JMenuItem(Res.getString("menuitem.block.contact"), SparkRes.getImageIcon(SparkRes.BLOCK_CONTACT_16x16));
|
||||
blockMenu.addActionListener(new ActionListener() { //Block contact
|
||||
});
|
||||
} else {
|
||||
blockMenu = new JMenuItem(Res.getString("menuitem.block.contact"), SparkRes.getImageIcon(SparkRes.BLOCK_CONTACT_16x16));
|
||||
blockMenu.addActionListener(new ActionListener() { //Block contact
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ae) {
|
||||
if ( item != null ) {
|
||||
PrivacyItem pItem = new PrivacyItem(Type.jid.toString(), false, activeList.getNewItemOrder());
|
||||
pItem.setFilterMessage(true);
|
||||
pItem.setFilterPresence_out(true);
|
||||
pItem.setValue(item.getJID());
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ae) {
|
||||
if ( item != null ) {
|
||||
PrivacyItem pItem = new PrivacyItem(Type.jid.toString(), false, activeList.getNewItemOrder());
|
||||
pItem.setFilterMessage(true);
|
||||
pItem.setFilterPresence_out(true);
|
||||
pItem.setValue(item.getJID());
|
||||
|
||||
activeList.addItem(pItem); //Add to block list
|
||||
activeList.save();
|
||||
activeList.addItem(pItem); //Add to block list
|
||||
activeList.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
popup.add(blockMenu);
|
||||
}
|
||||
popup.add(blockMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user