From 0ad6d3c55478622bb00ac5ebf36b2485976ce20b Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Sun, 6 Nov 2016 06:33:17 -0500 Subject: [PATCH] SPARK-1516 - Spark should not let open profile edit by clicking the avatar if profile changing is disabled (#258) * SPARK-1758 - Do not show UNFILED group if it's empty * SPARK-1822 - Add additional default properties to control GUI settings * SPARK-1822 - Add additional default properties to control GUI settings * SPARK-1516 - Spark should not let open profile edit by clicking the avatar if profile changing is disabled * SPARK-1827 - Shouldn't allow broadcast to selected users when it is disabled in Client Control * SPARK-1822 - Add additional default properties to control GUI settings * SPARK-1516 - Spark should not let open profile edit by clicking the avatar if profile changing is disabled --- .../spark/ui/status/StatusBar.java | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/java/org/jivesoftware/spark/ui/status/StatusBar.java b/src/java/org/jivesoftware/spark/ui/status/StatusBar.java index d73644e7..dbdb6e60 100644 --- a/src/java/org/jivesoftware/spark/ui/status/StatusBar.java +++ b/src/java/org/jivesoftware/spark/ui/status/StatusBar.java @@ -152,31 +152,6 @@ public class StatusBar extends JPanel implements VCardListener { } } ); - // See if we should disable the option to edit the profile if clicking on the Avatar image - // NOTE: There seems to be a bug where the enterprise VCARD_FEATURE is always returned as boolean 'true' - - if (!Default.getBoolean("DISABLE_EDIT_PROFILE") && Enterprise.containsFeature(Enterprise.VCARD_FEATURE)) { - // Show profile when clicking on Avatar image - imageLabel.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent mouseEvent) { - if (mouseEvent.getClickCount() == 1) { - VCardManager vcardManager = SparkManager.getVCardManager(); - VCardEditor editor = new VCardEditor(); - editor.editProfile(vcardManager.getVCard(), SparkManager.getWorkspace()); - } - } - - public void mouseEntered(MouseEvent e) { - imageLabel.setCursor(GraphicUtils.HAND_CURSOR); - } - - public void mouseExited(MouseEvent e) { - imageLabel.setCursor(GraphicUtils.DEFAULT_CURSOR); - } - }); - - } - final TimerTask task = new SwingTimerTask() { public void doRun() { SparkManager.getVCardManager().addVCardListener(SparkManager.getWorkspace().getStatusBar()); @@ -198,6 +173,7 @@ public class StatusBar extends JPanel implements VCardListener { } imageLabel.setBorder(null); revalidate(); + allowProfileEditing(); } public CommandPanel getCommandPanel() @@ -715,4 +691,28 @@ public class StatusBar extends JPanel implements VCardListener { : PresenceManager.getAvailablePresence(); } + public void allowProfileEditing() { + // Allow profile editing ONLY if both client-side and server-side settings permit it + if (Default.getBoolean("DISABLE_EDIT_PROFILE") || !Enterprise.containsFeature(Enterprise.VCARD_FEATURE)) return; + + // Go ahead and show the profile when clicking on the Avatar image + imageLabel.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent mouseEvent) { + if (mouseEvent.getClickCount() == 1) { + VCardManager vcardManager = SparkManager.getVCardManager(); + VCardEditor editor = new VCardEditor(); + editor.editProfile(vcardManager.getVCard(), SparkManager.getWorkspace()); + } + } + + public void mouseEntered(MouseEvent e) { + imageLabel.setCursor(GraphicUtils.HAND_CURSOR); + } + + public void mouseExited(MouseEvent e) { + imageLabel.setCursor(GraphicUtils.DEFAULT_CURSOR); + } + }); + } + }