diff --git a/src/commercial/sparkphone.jar b/src/commercial/sparkphone.jar index def764e6..bcd82b13 100644 Binary files a/src/commercial/sparkphone.jar and b/src/commercial/sparkphone.jar differ diff --git a/src/java/org/jivesoftware/Spark.java b/src/java/org/jivesoftware/Spark.java index 908cc58a..4ff6c463 100644 --- a/src/java/org/jivesoftware/Spark.java +++ b/src/java/org/jivesoftware/Spark.java @@ -16,6 +16,13 @@ import org.jivesoftware.resource.Default; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow; import org.jivesoftware.spark.util.log.Log; +import org.jivesoftware.sparkimpl.settings.local.LocalPreferences; +import org.jivesoftware.sparkimpl.settings.local.SettingsManager; + +import java.awt.Color; +import java.awt.Font; +import java.io.File; +import java.io.IOException; import javax.swing.BorderFactory; import javax.swing.JFrame; @@ -23,11 +30,6 @@ import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; -import java.awt.Color; -import java.awt.Font; -import java.io.File; -import java.io.IOException; - /** * In many cases, you will need to know the structure of the Spark installation, such as the directory structures, what * type of system Spark is running on, and also the arguments which were passed into Spark on startup. The Spark @@ -103,12 +105,15 @@ public final class Spark { } } + final LocalPreferences preferences = SettingsManager.getLocalPreferences(); + boolean useSystemLookAndFeel = preferences.useSystemLookAndFeel(); + try { String classname = UIManager.getSystemLookAndFeelClassName(); if (classname.indexOf("Windows") != -1) { try { - if (isVista()) { + if (useSystemLookAndFeel) { UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel()); } else { @@ -124,7 +129,12 @@ public final class Spark { UIManager.setLookAndFeel(classname); } else { - UIManager.setLookAndFeel(new com.jgoodies.looks.plastic.Plastic3DLookAndFeel()); + if (useSystemLookAndFeel) { + UIManager.setLookAndFeel(classname); + } + else { + UIManager.setLookAndFeel(new com.jgoodies.looks.plastic.Plastic3DLookAndFeel()); + } } // Update install ui properties. @@ -229,7 +239,7 @@ public final class Spark { return value; } - public void setArgument(String arguments){ + public void setArgument(String arguments) { argument = arguments; } diff --git a/src/java/org/jivesoftware/resource/spark.properties b/src/java/org/jivesoftware/resource/spark.properties index 9330eeaa..ecbd366c 100644 --- a/src/java/org/jivesoftware/resource/spark.properties +++ b/src/java/org/jivesoftware/resource/spark.properties @@ -15,7 +15,7 @@ LOGIN_DIALOG_LOGIN_TITLE = Spark LOGIN_DIALOG_AUTHENTICATING = Authenticating... #MainWindow -MAIN_IMAGE = images/message.png +MAIN_IMAGE = images/spark-16x16.png MAIN_IMAGE_ICO = images/icon_16.ico MAIN_ICNS_FILE = images/message.icns SMALL_CHECK = images/smallCheck.png diff --git a/src/java/org/jivesoftware/spark/ui/ChatContainer.java b/src/java/org/jivesoftware/spark/ui/ChatContainer.java index d87635ba..5afcade0 100644 --- a/src/java/org/jivesoftware/spark/ui/ChatContainer.java +++ b/src/java/org/jivesoftware/spark/ui/ChatContainer.java @@ -362,7 +362,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C chatFrame.setState(Frame.NORMAL); chatFrame.setVisible(true); } - else if (chatFrame.isVisible() && !chatFrame.isFocusOwner()) { + else if (chatFrame.isVisible() && !chatFrame.isInFocus()) { startFlashing(component); } else if (chatFrame.isVisible() && chatFrame.getState() == Frame.ICONIFIED) { @@ -442,7 +442,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C } // Handle when chat frame is visible but the Contact List is not. - else if (chatFrame.isVisible() && !SparkManager.getMainWindow().isVisible() && !chatFrame.isFocusOwner()) { + else if (chatFrame.isVisible() && !SparkManager.getMainWindow().isVisible() && !chatFrame.isInFocus()) { startFlashing(chatRoom); } else if (!chatFrame.isVisible()) { diff --git a/src/java/org/jivesoftware/spark/ui/themes/ThemePanel.java b/src/java/org/jivesoftware/spark/ui/themes/ThemePanel.java index 8398a5f4..015532e4 100644 --- a/src/java/org/jivesoftware/spark/ui/themes/ThemePanel.java +++ b/src/java/org/jivesoftware/spark/ui/themes/ThemePanel.java @@ -21,6 +21,14 @@ import org.jivesoftware.sparkimpl.plugin.emoticons.EmoticonManager; import org.jivesoftware.sparkimpl.settings.local.LocalPreferences; import org.jivesoftware.sparkimpl.settings.local.SettingsManager; +import java.awt.Color; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; @@ -31,14 +39,6 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.text.BadLocationException; -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; - /** * ThemePanel is used for the setting of TranscriptWindows and Emoticon packs. */ @@ -57,6 +57,8 @@ public class ThemePanel extends JPanel { private JCheckBox emoticonCheckBox; private JFileChooser fc; + private JCheckBox systemLookAndFeelBox; + /** * Construct UI */ @@ -76,10 +78,13 @@ public class ThemePanel extends JPanel { transcript = new TranscriptWindow(); + systemLookAndFeelBox = new JCheckBox(); + // Set ResourceUtils ResourceUtils.resLabel(messageStyleLabel, messageStyleBox, Res.getString("label.message.style") + ":"); ResourceUtils.resLabel(emoticonsLabel, emoticonBox, Res.getString("label.emoticons") + ":"); ResourceUtils.resButton(emoticonCheckBox, Res.getString("checkbox.enable.emoticons")); + ResourceUtils.resButton(systemLookAndFeelBox, Res.getString("checkbox.use.system.look.and.feel")); ResourceUtils.resButton(addThemeButton, "&Add..."); ResourceUtils.resButton(addEmoticonButton, "A&dd..."); @@ -105,6 +110,7 @@ public class ThemePanel extends JPanel { add(emoticonBox, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); add(addEmoticonButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(emoticonCheckBox, new GridBagConstraints(0, 3, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + add(systemLookAndFeelBox, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); // Activate live one. LocalPreferences pref = SettingsManager.getLocalPreferences(); @@ -137,6 +143,8 @@ public class ThemePanel extends JPanel { showSelectedEmoticon(); emoticonCheckBox.setSelected(pref.areEmoticonsEnabled()); + + systemLookAndFeelBox.setSelected(pref.useSystemLookAndFeel()); } /** @@ -206,6 +214,10 @@ public class ThemePanel extends JPanel { return emoticonCheckBox.isSelected(); } + public boolean useSystemLookAndFeel() { + return systemLookAndFeelBox.isSelected(); + } + /** * Adds a new Emoticon pack to Spark. */ diff --git a/src/java/org/jivesoftware/spark/ui/themes/ThemePreference.java b/src/java/org/jivesoftware/spark/ui/themes/ThemePreference.java index 40dfa19e..be72ed2f 100644 --- a/src/java/org/jivesoftware/spark/ui/themes/ThemePreference.java +++ b/src/java/org/jivesoftware/spark/ui/themes/ThemePreference.java @@ -41,7 +41,7 @@ public class ThemePreference implements Preference { } public String getTooltip() { - return "Change the appearance of your conversations."; + return "Change the appearance of Spark."; } public String getListName() { @@ -79,12 +79,12 @@ public class ThemePreference implements Preference { } public void commit() { - final String theme = panel.getSelectedTheme(); final String pack = panel.getSelectedEmoticonPack(); boolean emotEnabled = panel.areEmoticonsEnabled(); LocalPreferences pref = SettingsManager.getLocalPreferences(); pref.setEmoticonPack(pack); pref.setEmoticonsEnabled(emotEnabled); + pref.setUseSystemLookAndFeel(panel.useSystemLookAndFeel()); } diff --git a/src/java/org/jivesoftware/sparkimpl/settings/local/LocalPreferences.java b/src/java/org/jivesoftware/sparkimpl/settings/local/LocalPreferences.java index e0451aad..70f3da42 100644 --- a/src/java/org/jivesoftware/sparkimpl/settings/local/LocalPreferences.java +++ b/src/java/org/jivesoftware/sparkimpl/settings/local/LocalPreferences.java @@ -535,6 +535,14 @@ public class LocalPreferences { return getBoolean("emoticonsEnabled", true); } + public void setUseSystemLookAndFeel(boolean sysLAF) { + setBoolean("useSystemLookAndFeel", sysLAF); + } + + public boolean useSystemLookAndFeel() { + return getBoolean("useSystemLookAndFeel", false); + } + private boolean getBoolean(String property, boolean defaultValue) { return Boolean.parseBoolean(props.getProperty(property, Boolean.toString(defaultValue))); } diff --git a/src/resources/i18n/spark_i18n.properties b/src/resources/i18n/spark_i18n.properties index 225cbfd7..d6e2f39a 100644 --- a/src/resources/i18n/spark_i18n.properties +++ b/src/resources/i18n/spark_i18n.properties @@ -92,6 +92,7 @@ ## Added key: 'label.emoticons' ## Added key: 'checkbox.enable.emoticons' ## Added key: 'message.unable.to.retrieve.last.activity' +## Added key: 'checkbox.use.system.look.and.feel' ok = Ok @@ -188,6 +189,7 @@ checkbox.split.chat.window = Dock &Windows (Requires Spark restart) checkbox.tabs.on.top = &Chat tabs appear on top (Requires Spark restart) checkbox.allow.buzz = Allow users to buz&z you. checkbox.enable.emoticons = Enable Em&oticons +checkbox.use.system.look.and.feel = Use System Look And &Feel (Requires Spark restart) label.user.on.public.network = User is on a public network