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
This commit is contained in:
Michael Klein
2016-11-06 06:33:17 -05:00
committed by wroot
parent 0545b790fc
commit 0ad6d3c554

View File

@ -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);
}
});
}
}