From c97166a9f2314706ea7760272b15b320b9fd5401 Mon Sep 17 00:00:00 2001 From: Wolf Posdorfer Date: Tue, 22 Mar 2011 12:39:27 +0000 Subject: [PATCH] SPARK-1258 more customization settings include: Remove Advanced Configuration from LoginWindow Disable Spark Updates HelpMenu->UserGuide Location configurable Disable HelpMenu->UserGuide HelpMenu->HelpForum Location configurable HelpMenu->HelpForum Text configurable Disable HelpMenu->HelpForum git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12161 b35dd754-fafc-0310-a699-88a17e54d16e --- src/java/org/jivesoftware/LoginDialog.java | 10 ++- src/java/org/jivesoftware/MainWindow.java | 80 +++++++++++-------- src/java/org/jivesoftware/Spark.java | 4 +- .../org/jivesoftware/resource/Default.java | 7 +- .../jivesoftware/resource/default.properties | 53 +++++++++--- .../sparkimpl/updater/CheckUpdates.java | 2 +- 6 files changed, 101 insertions(+), 55 deletions(-) diff --git a/src/java/org/jivesoftware/LoginDialog.java b/src/java/org/jivesoftware/LoginDialog.java index b101729c..db4ba275 100644 --- a/src/java/org/jivesoftware/LoginDialog.java +++ b/src/java/org/jivesoftware/LoginDialog.java @@ -328,15 +328,17 @@ public final class LoginDialog { savePasswordBox.addActionListener(this); autoLoginBox.addActionListener(this); - if (!Default.getBoolean(Default.ACCOUNT_DISABLED)) { buttonPanel.add(createAccountButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, - GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); + GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); } + + if(!Default.getBoolean(Default.ADVANCED_DISABLED)){ buttonPanel.add(advancedButton, - new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, - GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); + new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, + GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); + } buttonPanel.add(loginButton, new GridBagConstraints(3, 0, 4, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); diff --git a/src/java/org/jivesoftware/MainWindow.java b/src/java/org/jivesoftware/MainWindow.java index 06306901..5c41caed 100644 --- a/src/java/org/jivesoftware/MainWindow.java +++ b/src/java/org/jivesoftware/MainWindow.java @@ -93,7 +93,7 @@ public final class MainWindow extends ChatFrame implements ActionListener { private JCheckBoxMenuItem alwaysOnTopItem; private final JMenuItem menuAbout = new JMenuItem(SparkRes.getImageIcon(SparkRes.INFORMATION_IMAGE)); - private final JMenuItem helpMenuItem = new JMenuItem(); + private final JMenuItem sparkforumItem = new JMenuItem(); private final JMenuBar mainWindowBar = new JMenuBar(); @@ -475,11 +475,14 @@ public final class MainWindow extends ChatFrame implements ActionListener { viewErrors.putValue(Action.NAME, Res.getString("menuitem.view.logs")); final Action viewHelpGuideAction = new AbstractAction() { + + final String url = Default.getString(Default.HELP_USER_GUIDE); private static final long serialVersionUID = 2680369963282231348L; public void actionPerformed(ActionEvent actionEvent) { try { - BrowserLauncher.openURL("http://www.igniterealtime.org/builds/spark/docs/spark_user_guide.pdf"); + + BrowserLauncher.openURL(url); } catch (Exception e) { Log.error("Unable to load online help.", e); @@ -487,15 +490,17 @@ public final class MainWindow extends ChatFrame implements ActionListener { } }; - //EventQueue.invokeLater(new Runnable() { - // public void run() { - - if (!Spark.isCustomBuild()) { - viewHelpGuideAction.putValue(Action.NAME, Res.getString("menuitem.user.guide")); - viewHelpGuideAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_QUESTION)); - helpMenu.add(viewHelpGuideAction); - helpMenu.add(helpMenuItem); - } + + if (!Default.getBoolean("HELP_USER_GUIDE_DISABLED")) { + viewHelpGuideAction.putValue(Action.NAME, + Res.getString("menuitem.user.guide")); + viewHelpGuideAction.putValue(Action.SMALL_ICON, + SparkRes.getImageIcon(SparkRes.SMALL_QUESTION)); + helpMenu.add(viewHelpGuideAction); + } + if (!Default.getBoolean("HELP_FORUM_DISABLED")) { + helpMenu.add(sparkforumItem); + } // Build Help Menu helpMenu.add(updateMenu); @@ -507,38 +512,43 @@ public final class MainWindow extends ChatFrame implements ActionListener { ResourceUtils.resButton(preferenceMenuItem, Res.getString("menuitem.preferences")); ResourceUtils.resButton(helpMenu, Res.getString("menuitem.help")); ResourceUtils.resButton(menuAbout, Res.getString("menuitem.about")); - ResourceUtils.resButton(helpMenuItem, Res.getString("menuitem.online.help")); + if (Default.getString("HELP_FORUM_TEXT").length() > 0) { + ResourceUtils.resButton(sparkforumItem, Default.getString("HELP_FORUM_TEXT")); + } else { + ResourceUtils.resButton(sparkforumItem, Res.getString("menuitem.online.help")); + } // Register shutdown with the exit menu. - exitMenuItem.addActionListener(new AbstractAction() { - private static final long serialVersionUID = -2301236575241532698L; + exitMenuItem.addActionListener(new AbstractAction() { + private static final long serialVersionUID = -2301236575241532698L; - public void actionPerformed(ActionEvent e) { - shutdown(); - } - }); + public void actionPerformed(ActionEvent e) { + shutdown(); + } + }); - helpMenuItem.addActionListener(new AbstractAction() { - private static final long serialVersionUID = -1423433460333010339L; + sparkforumItem.addActionListener(new AbstractAction() { + private static final long serialVersionUID = -1423433460333010339L; - public void actionPerformed(ActionEvent e) { - try { - BrowserLauncher.openURL("http://www.igniterealtime.org/forum/forum.jspa?forumID=49"); - } - catch (Exception browserException) { - Log.error("Error launching browser:", browserException); - } - } - }); + final String url = Default.getString("HELP_FORUM"); + + public void actionPerformed(ActionEvent e) { + try { + BrowserLauncher.openURL(url); + } catch (Exception browserException) { + Log.error("Error launching browser:", browserException); + } + } + }); // Show About Box - menuAbout.addActionListener(new AbstractAction() { - private static final long serialVersionUID = -7173666373051354502L; + menuAbout.addActionListener(new AbstractAction() { + private static final long serialVersionUID = -7173666373051354502L; - public void actionPerformed(ActionEvent e) { - showAboutBox(); - } - }); + public void actionPerformed(ActionEvent e) { + showAboutBox(); + } + }); // Execute spark update checker after one minute. final TimerTask task = new SwingTimerTask() { diff --git a/src/java/org/jivesoftware/Spark.java b/src/java/org/jivesoftware/Spark.java index eebc123f..d1a2d8b5 100644 --- a/src/java/org/jivesoftware/Spark.java +++ b/src/java/org/jivesoftware/Spark.java @@ -405,8 +405,8 @@ public final class Spark { return System.getProperties().getProperty("user.home"); } - public static boolean isCustomBuild() { - return Default.getBoolean("CUSTOM"); + public static boolean disableUpdatesOnCustom() { + return Default.getBoolean("DISABLE_UPDATES"); } public static void setApplicationFont(Font f) { diff --git a/src/java/org/jivesoftware/resource/Default.java b/src/java/org/jivesoftware/resource/Default.java index 3ca4982c..8decb564 100644 --- a/src/java/org/jivesoftware/resource/Default.java +++ b/src/java/org/jivesoftware/resource/Default.java @@ -44,7 +44,7 @@ public class Default { public static final String SHOW_POWERED_BY = "SHOW_POWERED_BY"; public static final String TOP_BOTTOM_BACKGROUND_IMAGE = "TOP_BOTTOM_BACKGROUND_IMAGE"; public static final String BRANDED_IMAGE = "BRANDED_IMAGE"; - public static final String CUSTOM = "CUSTOM"; + public static final String DISABLE_UPDATES = "DISABLE_UPDATES"; public static final String SECONDARY_BACKGROUND_IMAGE = "SECONDARY_BACKGROUND_IMAGE"; public static final String HOVER_TEXT_COLOR = "HOVER_TEXT_COLOR"; public static final String TEXT_COLOR = "TEXT_COLOR"; @@ -63,7 +63,8 @@ public class Default { public static final String DEFAULT_LOOK_AND_FEEL = "DEFAULT_LOOK_AND_FEEL"; public static final String INSTALL_PLUGINS_DISABLED = "INSTALL_PLUGINS_DISABLED"; public static final String DEINSTALL_PLUGINS_DISABLED = "DEINSTALL_PLUGINS_DISABLED"; - + public static final String ADVANCED_DISABLED = "ADVANCED_DISABLED"; + public static final String HELP_USER_GUIDE = "HELP_USER_GUIDE"; static ClassLoader cl = SparkRes.class.getClassLoader(); @@ -88,7 +89,7 @@ public class Default { } public static boolean getBoolean(String propertyName) { - return prb.getString(propertyName).equals("true"); + return getString(propertyName).equals("true"); } public static ImageIcon getImageIcon(String imageName) { diff --git a/src/java/org/jivesoftware/resource/default.properties b/src/java/org/jivesoftware/resource/default.properties index d0f74d03..4c89e298 100644 --- a/src/java/org/jivesoftware/resource/default.properties +++ b/src/java/org/jivesoftware/resource/default.properties @@ -1,3 +1,6 @@ +################################################# +################# Login Window ################# +################################################# # The Login image # suggested image dimensions 244 x 188 pixels MAIN_IMAGE = images/spark.png @@ -7,19 +10,33 @@ LOGIN_DIALOG_BACKGROUND_IMAGE = images/login_dialog_background.png TOP_BOTTOM_BACKGROUND_IMAGE = images/top_bottom_background_image.png SECONDARY_BACKGROUND_IMAGE = images/steel.png +# Specify a fixed Hostname +# Changing the Hostname will also be prohibited if set +HOST_NAME = +# Proxy Settings +PROXY_HOST = +PROXY_PORT = + +# Remove account creation Button from Loginwindow +ACCOUNT_DISABLED = +# Remove Advanced Configuration Button from Loginwindow +ADVANCED_DISABLED = + + # Branding only # Branded images appear in the Top-Right corner, and must be included in the classpath # place them in src/resource/images and path will be "images/file.jpg" BRANDED_IMAGE = -# Specify a fixed Hostname -# Changing the Hostname will also be prohibited if set -HOST_NAME = SHOW_POWERED_BY = -# if Custom build = true, there will be no references anywhere to igniterealtime.org -CUSTOM = +# Disables updateability, you should set this, if you have a custom Spark-build +DISABLE_UPDATES = +################################################# +################## Main Window ################## +################################################# + # Roster Management HOVER_TEXT_COLOR = TEXT_COLOR = @@ -30,12 +47,10 @@ CONTACT_GROUP_END_COLOR = TAB_START_COLOR = TAB_END_COLOR = -# Proxy Settings -PROXY_HOST = -PROXY_PORT = -# Remove account creation Button from Loginwindow -ACCOUNT_DISABLED = +################################################# +################ Settings Window ################ +################################################# # Disables adding of contacts ADD_CONTACT_DISABLED = @@ -49,6 +64,24 @@ LOOK_AND_FEEL_DISABLED = # If Setting this you should also consider disabling the above DEFAULT_LOOK_AND_FEEL = +# Sets the Location of the Userguide +#Default is http://www.igniterealtime.org/builds/spark/docs/spark_user_guide.pdf +HELP_USER_GUIDE = http://www.igniterealtime.org/builds/spark/docs/spark_user_guide.pdf +HELP_USER_GUIDE_DISABLED = +# Sets the Location of the Help-Forum +#Default is http://www.igniterealtime.org/forum/forum.jspa?forumID=49 +HELP_FORUM = http://www.igniterealtime.org/forum/forum.jspa?forumID=49 +HELP_FORUM_DISABLED = +# Following Text will be displayed instead of "Spark forum" +# leave blank for default +HELP_FORUM_TEXT = + + +################################################# +################ Plugins ################ +################################################# + + # Disable Installing of Plugins # set true if you want to disable installing of Plugins INSTALL_PLUGINS_DISABLED = diff --git a/src/java/org/jivesoftware/sparkimpl/updater/CheckUpdates.java b/src/java/org/jivesoftware/sparkimpl/updater/CheckUpdates.java index 5184bd54..ee6eac71 100644 --- a/src/java/org/jivesoftware/sparkimpl/updater/CheckUpdates.java +++ b/src/java/org/jivesoftware/sparkimpl/updater/CheckUpdates.java @@ -98,7 +98,7 @@ public class CheckUpdates { } public SparkVersion newBuildAvailable() { - if (!sparkPluginInstalled && !Spark.isCustomBuild()) { + if (!sparkPluginInstalled && !Spark.disableUpdatesOnCustom()) { // Handle Jivesoftware.org update return isNewBuildAvailableFromJivesoftware(); }