hide "show chat history" button if chat history is disabled
Description
Environment
Activity
apply this patch to remove the icon from the context menu
Index: src/java/org/jivesoftware/sparkimpl/plugin/transcripts/ChatTranscriptPlugin.java
===================================================================
— src/java/org/jivesoftware/sparkimpl/plugin/transcripts/ChatTranscriptPlugin.java (revision 10653)
+++ src/java/org/jivesoftware/sparkimpl/plugin/transcripts/ChatTranscriptPlugin.java (working copy)
@@ -77,9 +77,10 @@
notificationDateFormatter = new SimpleDateFormat(dateFormat);
messageDateFormatter = new SimpleDateFormat(timeFormat);
-
final ContactList contactList = SparkManager.getWorkspace().getContactList();
-
+
+ final LocalPreferences localPreferences = SettingsManager.getLocalPreferences();
+
+ final ContactList contactList = SparkManager.getWorkspace().getContactList();
final Action viewHistoryAction = new AbstractAction() {
public void actionPerformed(ActionEvent actionEvent) {
@@ -96,7 +97,9 @@
contactList.addContextMenuListener(new ContextMenuListener() {
public void poppingUp(Object object, JPopupMenu popup) {
if (object instanceof ContactItem) {
popup.add(viewHistoryAction);
+ if (localPreferences.isChatHistoryEnabled()) {
+ popup.add(viewHistoryAction);
+ }
}
}
there is still "View Contact History" in contact's context menu
The button is always displayed, it would be nice if one would also hide it if no chat history is yet available but as this requires a file access it may be better to ignore this case and display an empty history.
But as soon as the history is disabled it makes no sense to open a window to display no history. If I remember right the button is not available in the chat window but in the roster window within the popup menu.