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
|
@Override
|
||||||
public void poppingUp(Object object, JPopupMenu popup) {
|
public void poppingUp(Object object, JPopupMenu popup) {
|
||||||
|
|
||||||
final PrivacyManager pManager = PrivacyManager.getInstance();
|
if (object instanceof ContactItem)
|
||||||
|
{
|
||||||
|
final PrivacyManager pManager = PrivacyManager.getInstance();
|
||||||
|
|
||||||
if (pManager.hasActiveList())
|
if (pManager.hasActiveList())
|
||||||
{
|
{
|
||||||
final SparkPrivacyList activeList = pManager.getActiveList();
|
final SparkPrivacyList activeList = pManager.getActiveList();
|
||||||
|
|
||||||
|
|
||||||
final ContactItem item = (ContactItem) object;
|
final ContactItem item = (ContactItem) object;
|
||||||
JMenuItem blockMenu;
|
JMenuItem blockMenu;
|
||||||
|
|
||||||
if ( activeList.isBlockedItem(item.getJID()) ) {
|
if ( activeList.isBlockedItem(item.getJID()) ) {
|
||||||
blockMenu = new JMenuItem(Res.getString("menuitem.unblock.contact"), SparkRes.getImageIcon(SparkRes.UNBLOCK_CONTACT_16x16));
|
blockMenu = new JMenuItem(Res.getString("menuitem.unblock.contact"), SparkRes.getImageIcon(SparkRes.UNBLOCK_CONTACT_16x16));
|
||||||
blockMenu.addActionListener(new ActionListener() { //unblock contact
|
blockMenu.addActionListener(new ActionListener() { //unblock contact
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent ae) {
|
public void actionPerformed(ActionEvent ae) {
|
||||||
if ( item != null ) {
|
if ( item != null ) {
|
||||||
activeList.removeItem(((ContactItem) item).getJID()); //Add to block list
|
activeList.removeItem(((ContactItem) item).getJID()); //Add to block list
|
||||||
activeList.save();
|
activeList.save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
} else {
|
||||||
} else {
|
blockMenu = new JMenuItem(Res.getString("menuitem.block.contact"), SparkRes.getImageIcon(SparkRes.BLOCK_CONTACT_16x16));
|
||||||
blockMenu = new JMenuItem(Res.getString("menuitem.block.contact"), SparkRes.getImageIcon(SparkRes.BLOCK_CONTACT_16x16));
|
blockMenu.addActionListener(new ActionListener() { //Block contact
|
||||||
blockMenu.addActionListener(new ActionListener() { //Block contact
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent ae) {
|
public void actionPerformed(ActionEvent ae) {
|
||||||
if ( item != null ) {
|
if ( item != null ) {
|
||||||
PrivacyItem pItem = new PrivacyItem(Type.jid.toString(), false, activeList.getNewItemOrder());
|
PrivacyItem pItem = new PrivacyItem(Type.jid.toString(), false, activeList.getNewItemOrder());
|
||||||
pItem.setFilterMessage(true);
|
pItem.setFilterMessage(true);
|
||||||
pItem.setFilterPresence_out(true);
|
pItem.setFilterPresence_out(true);
|
||||||
pItem.setValue(item.getJID());
|
pItem.setValue(item.getJID());
|
||||||
|
|
||||||
activeList.addItem(pItem); //Add to block list
|
activeList.addItem(pItem); //Add to block list
|
||||||
activeList.save();
|
activeList.save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
popup.add(blockMenu);
|
popup.add(blockMenu);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user