SPARK-1822 - Add additional default properties to control GUI settings (#249)

* SPARK-1758 - Do not show UNFILED group if it's empty

* SPARK-1822 - Add additional default properties to control GUI settings
This commit is contained in:
Michael Klein
2016-11-01 08:39:08 -04:00
committed by wroot
parent 0983fa37b5
commit e51cb9c695
7 changed files with 94 additions and 50 deletions

View File

@ -109,6 +109,27 @@ DISABLE_AVATAR_TAB = false
# If true, disable the "Plugins" menu item # If true, disable the "Plugins" menu item
DISABLE_PLUGINS_MENU_ITEM = false DISABLE_PLUGINS_MENU_ITEM = false
# If true, disable the option to transfer files
DISABLE_FILE_XFER = false
# If true, disable the option to remove contacts and groups in roster
DISABLE_REMOVALS = false
# If true, disable the option to rename contacts and groups in roster
DISABLE_RENAMES = false
# If true, disable the options to move and copy contacts
DISABLE_MOVE_AND_COPY = false
# If true, disable the option to edit the profile
DISABLE_EDIT_PROFILE = false
# If true, disable the "View notes" option under "Actions"
DISABLE_VIEW_NOTES = false
# If true, disable the "View task list" option under "Actions"
DISABLE_VIEW_TASK_LIST = false
################################################# #################################################
################## File Transfer ################ ################## File Transfer ################
################################################# #################################################

View File

@ -19,6 +19,7 @@
*/ */
package org.jivesoftware.spark.filetransfer; package org.jivesoftware.spark.filetransfer;
import org.jivesoftware.resource.Default;
import org.jivesoftware.resource.Res; import org.jivesoftware.resource.Res;
import org.jivesoftware.spark.SparkManager; import org.jivesoftware.spark.SparkManager;
import org.jivesoftware.spark.ui.ChatRoom; import org.jivesoftware.spark.ui.ChatRoom;
@ -60,17 +61,18 @@ public class ChatRoomTransferDecorator implements KeyListener, FileDropListener,
chatRoom.getChatInputEditor().addKeyListener(this); chatRoom.getChatInputEditor().addKeyListener(this);
chatRoom.addClosingListener(this); chatRoom.addClosingListener(this);
// See if we should disable the ability to transfer files
if (!Default.getBoolean("DISABLE_FILE_XFER")) {
sendFileButton = UIComponentRegistry.getButtonFactory().createSendFileButton(); sendFileButton = UIComponentRegistry.getButtonFactory().createSendFileButton();
sendFileButton.setToolTipText(Res.getString("message.send.file.to.user")); sendFileButton.setToolTipText(Res.getString("message.send.file.to.user"));
chatRoom.addChatRoomButton(sendFileButton); chatRoom.addChatRoomButton(sendFileButton);
sendFileButton.addActionListener(this);
}
sendScreenShotButton = UIComponentRegistry.getButtonFactory().createScreenshotButton(); sendScreenShotButton = UIComponentRegistry.getButtonFactory().createScreenshotButton();
sendScreenShotButton.setToolTipText(Res.getString("message.send.picture")); sendScreenShotButton.setToolTipText(Res.getString("message.send.picture"));
chatRoom.addChatRoomButton(sendScreenShotButton); chatRoom.addChatRoomButton(sendScreenShotButton);
sendFileButton.addActionListener(this);
sendScreenShotButton.addActionListener(this); sendScreenShotButton.addActionListener(this);
} }

View File

@ -1382,11 +1382,17 @@ moveToOffline(moveToOfflineContactItem);
if (!group.isSharedGroup()) { if (!group.isSharedGroup()) {
popup.addSeparator(); popup.addSeparator();
popup.add(delete);
popup.add(rename); // See if we should disable the "Delete" menu option
if (!Default.getBoolean("DISABLE_REMOVALS")) popup.add(delete);
// See if we should disable the "Rename" menu option
if (!Default.getBoolean("DISABLE_RENAMES")) popup.add(rename);
} }
popup.addSeparator(); // Only display a horizontal separator if at least one of those options is present
if (!Default.getBoolean("DISABLE_REMOVALS") || !Default.getBoolean("DISABLE_RENAMES")) popup.addSeparator();
popup.add(expand); popup.add(expand);
popup.add(collapse); popup.add(collapse);
@ -1499,16 +1505,15 @@ moveToOffline(moveToOfflineContactItem);
} }
}; };
// See if we should disable the option to transfer files
if (!Default.getBoolean("DISABLE_FILE_XFER")) {
sendAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.DOCUMENT_16x16)); sendAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.DOCUMENT_16x16));
sendAction.putValue(Action.NAME, Res.getString("menuitem.send.a.file")); sendAction.putValue(Action.NAME, Res.getString("menuitem.send.a.file"));
if ((item.getPresence() != null) && Enterprise.containsFeature(Enterprise.FILE_TRANSFER_FEATURE)) popup.add(sendAction);
if ((item.getPresence() != null) && Enterprise.containsFeature(Enterprise.FILE_TRANSFER_FEATURE)) {
popup.add(sendAction);
} }
popup.addSeparator(); popup.addSeparator();
String groupName = item.getGroupName(); String groupName = item.getGroupName();
ContactGroup contactGroup = getContactGroup(groupName); ContactGroup contactGroup = getContactGroup(groupName);
@ -1551,13 +1556,13 @@ moveToOffline(moveToOfflineContactItem);
} }
} }
// See if we should disable the option to remove a contact
if (!contactGroup.isSharedGroup() && !isInSharedGroup) { if (!Default.getBoolean("DISABLE_REMOVALS")) {
popup.add(removeAction); if (!contactGroup.isSharedGroup() && !isInSharedGroup) popup.add(removeAction);
} }
popup.add(renameMenu); // See if we should disable the option to rename a contact
if (!Default.getBoolean("DISABLE_RENAMES")) popup.add(renameMenu);
Action viewProfile = new AbstractAction() { Action viewProfile = new AbstractAction() {
private static final long serialVersionUID = -2562731455090634805L; private static final long serialVersionUID = -2562731455090634805L;

View File

@ -149,7 +149,10 @@ public class StatusBar extends JPanel implements VCardListener {
} }
} ); } );
// Show profile on double click of image label // See if we should disable the option to edit the profile if clicking on the Avatar image
if (!Default.getBoolean("DISABLE_EDIT_PROFILE")) {
// Show profile when clicking on Avatar image
imageLabel.addMouseListener(new MouseAdapter() { imageLabel.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent mouseEvent) { public void mouseClicked(MouseEvent mouseEvent) {
if (mouseEvent.getClickCount() == 1) { if (mouseEvent.getClickCount() == 1) {
@ -168,6 +171,8 @@ public class StatusBar extends JPanel implements VCardListener {
} }
}); });
}
final TimerTask task = new SwingTimerTask() { final TimerTask task = new SwingTimerTask() {
public void doRun() { public void doRun() {
SparkManager.getVCardManager().addVCardListener(SparkManager.getWorkspace().getStatusBar()); SparkManager.getVCardManager().addVCardListener(SparkManager.getWorkspace().getStatusBar());

View File

@ -141,20 +141,24 @@ public class ContactListAssistantPlugin implements Plugin {
if (contactItems.size() == 1) { if (contactItems.size() == 1) {
// Add right after the rename item. // Add right after the rename item.
if (index != -1) { if (index != -1) {
// See if we should disable the "Move to" and "Copy to" menu options
if (!Default.getBoolean("DISABLE_MOVE_AND_COPY")) {
popup.add(moveToMenu, index + 1); popup.add(moveToMenu, index + 1);
popup.add(copyToMenu, index + 2); popup.add(copyToMenu, index + 2);
} }
} }
}
else if (contactItems.size() > 1) { else if (contactItems.size() > 1) {
// See if we should disable the "Move to" and "Copy to" menu options
if (!Default.getBoolean("DISABLE_MOVE_AND_COPY")) {
popup.addSeparator(); popup.addSeparator();
popup.add(moveToMenu); popup.add(moveToMenu);
popup.add(copyToMenu); popup.add(copyToMenu);
}
// Clean up the extra separator if "Broadcast" menu items are disabled // Clean up the extra separator if "Broadcast" menu items are disabled
if (!Default.getBoolean("DISABLE_BROADCAST_MENU_ITEM")) popup.addSeparator(); if (!Default.getBoolean("DISABLE_BROADCAST_MENU_ITEM")) popup.addSeparator();
} }
} }
} }

View File

@ -20,6 +20,7 @@
package org.jivesoftware.sparkimpl.plugin.scratchpad; package org.jivesoftware.sparkimpl.plugin.scratchpad;
import org.jdesktop.swingx.calendar.DateUtils; import org.jdesktop.swingx.calendar.DateUtils;
import org.jivesoftware.resource.Default;
import org.jivesoftware.resource.Res; import org.jivesoftware.resource.Res;
import org.jivesoftware.resource.SparkRes; import org.jivesoftware.resource.SparkRes;
import org.jivesoftware.spark.SparkManager; import org.jivesoftware.spark.SparkManager;
@ -115,9 +116,12 @@ public class ScratchPadPlugin implements Plugin {
// Add To toolbar // Add To toolbar
final JMenu actionsMenu = SparkManager.getMainWindow().getMenuByName(Res.getString("menuitem.actions")); final JMenu actionsMenu = SparkManager.getMainWindow().getMenuByName(Res.getString("menuitem.actions"));
actionsMenu.addSeparator(); actionsMenu.addSeparator();
actionsMenu.add(taskMenu);
actionsMenu.add(notesMenu);
// See if we should disable the "View task list" option under "Actions"
if (!Default.getBoolean("DISABLE_VIEW_TASK_LIST")) actionsMenu.add(taskMenu);
// See if we should disable the "View notes" option under "Actions"
if (!Default.getBoolean("DISABLE_VIEW_NOTES")) actionsMenu.add(notesMenu);
// Start notifications. // Start notifications.
new TaskNotification(); new TaskNotification();

View File

@ -19,6 +19,7 @@
*/ */
package org.jivesoftware.sparkimpl.profile; package org.jivesoftware.sparkimpl.profile;
import org.jivesoftware.resource.Default;
import org.jivesoftware.resource.Res; import org.jivesoftware.resource.Res;
import org.jivesoftware.resource.SparkRes; import org.jivesoftware.resource.SparkRes;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
@ -228,7 +229,9 @@ public class VCardManager {
int size = contactsMenu.getMenuComponentCount(); int size = contactsMenu.getMenuComponentCount();
communicatorMenu.insert(editProfileMenu, 1); // See if we should disable the "Edit my profile" option under "File"
if (!Default.getBoolean("DISABLE_EDIT_PROFILE")) communicatorMenu.insert(editProfileMenu, 1);
editProfileMenu.addActionListener( e -> { editProfileMenu.addActionListener( e -> {
SwingWorker vcardLoaderWorker = new SwingWorker() { SwingWorker vcardLoaderWorker = new SwingWorker() {
public Object construct() { public Object construct() {