SPARK-1258

DISABLE_EXIT
DISABLE_GROUP_ADD

SPARK-1257
when changing from JavaDefault to Substance redecorate Titlebars
(note that not all JavaDefaultSkins support this fully(e.g. cde/motif), restart in that case
corrected loading of Metal,Nimbus and CDE/Motif


git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12162 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Wolf Posdorfer
2011-03-22 13:28:34 +00:00
committed by wolf.posdorfer
parent c97166a9f2
commit 78f8e6435a
6 changed files with 39 additions and 17 deletions

View File

@ -285,7 +285,9 @@ public final class MainWindow extends ChatFrame implements ActionListener {
Log.error(ex);
}
// Close application.
System.exit(1);
if(!Default.getBoolean("DISABLE_EXIT"))
System.exit(1);
}
/**
@ -415,8 +417,8 @@ public final class MainWindow extends ChatFrame implements ActionListener {
}
connectMenu.add(alwaysOnTopItem);
connectMenu.addSeparator();
if(!Default.getBoolean("DISABLE_EXIT"))
connectMenu.addSeparator();
//EventQueue.invokeLater(new Runnable() {
// public void run() {
@ -437,13 +439,13 @@ public final class MainWindow extends ChatFrame implements ActionListener {
}
});
if (Spark.isWindows() || Spark.isLinux()) {
if ((Spark.isWindows() || Spark.isLinux()) && !Default.getBoolean("DISABLE_EXIT")) {
connectMenu.add(logoutMenuItem);
connectMenu.add(logoutWithStatus);
connectMenu.addSeparator();
}
if (!Spark.isMac()) {
if (!Spark.isMac() && !Default.getBoolean("DISABLE_EXIT")) {
connectMenu.add(exitMenuItem);
}

View File

@ -211,17 +211,15 @@ public final class Spark {
private void loadLookAndFeel() {
final LocalPreferences preferences = SettingsManager.getLocalPreferences();
final String laf;
if(Default.getString(Default.DEFAULT_LOOK_AND_FEEL).length()>0)
{
if (Default.getString(Default.DEFAULT_LOOK_AND_FEEL).length() > 0) {
laf = Default.getString(Default.DEFAULT_LOOK_AND_FEEL);
}
else
{
} else if (preferences.getLookAndFeel().length() > 0) {
laf = preferences.getLookAndFeel();
} else {
laf = UIManager.getSystemLookAndFeelClassName();
}
try {
String classname = UIManager.getSystemLookAndFeelClassName();
if (laf.toLowerCase().contains("substance")) {
EventQueue.invokeLater(new Runnable() {
public void run() {
@ -239,7 +237,12 @@ public final class Spark {
});
} else {
try {
UIManager.setLookAndFeel(classname);
if(Spark.isWindows()) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
UIManager.setLookAndFeel(laf);
} catch (Exception e) {
e.printStackTrace();

View File

@ -32,6 +32,9 @@ SHOW_POWERED_BY =
# Disables updateability, you should set this, if you have a custom Spark-build
DISABLE_UPDATES =
#If true, Spark cannot shut down
DISABLE_EXIT =
#################################################
################## Main Window ##################
@ -54,6 +57,8 @@ TAB_END_COLOR =
# Disables adding of contacts
ADD_CONTACT_DISABLED =
# Disables adding contact groups
ADD_CONTACT_GROUP_DISABLED =
# Change Password Disabled
CHANGE_PASSWORD_DISABLED =

View File

@ -1423,7 +1423,9 @@ public final class ContactList extends JPanel implements ActionListener,
popup.add(addContactMenu);
}
popup.add(addContactGroupMenu);
if(!Default.getBoolean("ADD_CONTACT_GROUP_DISABLED")){
popup.add(addContactGroupMenu);
}
popup.addSeparator();
fireContextMenuListenerPopup(popup, group);
@ -1929,7 +1931,10 @@ public final class ContactList extends JPanel implements ActionListener,
if (!Default.getBoolean(Default.ADD_CONTACT_DISABLED)) {
contactsMenu.add(addContactsMenu);
}
contactsMenu.add(addContactGroupMenu);
if(!Default.getBoolean("ADD_CONTACT_GROUP_DISABLED")){
contactsMenu.add(addContactGroupMenu);
}
addContactsMenu.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new RosterDialog().showRosterDialog();

View File

@ -37,7 +37,9 @@ import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
@ -198,6 +200,8 @@ public class ThemePanel extends JPanel {
SwingUtilities.updateComponentTreeUI(_thispanel.getParent());
SwingUtilities.updateComponentTreeUI(SparkManager.getMainWindow());
SwingUtilities.updateComponentTreeUI(SparkManager.getChatManager().getChatContainer());
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
_thispanel.invalidate();
_thispanel.repaint();
_thispanel.validate();

View File

@ -152,8 +152,10 @@ public class SysTrayPlugin implements Plugin, NativeHandler, MessageEventNotific
}
});
if (Spark.isWindows()) {
popupMenu.add(logoutMenu);
if (Spark.isWindows()) {
if(!Default.getBoolean("DISABLE_EXIT"))
popupMenu.add(logoutMenu);
logoutMenu.addActionListener(new AbstractAction() {
private static final long serialVersionUID = 1L;
@ -172,7 +174,8 @@ public class SysTrayPlugin implements Plugin, NativeHandler, MessageEventNotific
SparkManager.getMainWindow().shutdown();
}
});
popupMenu.add(exitMenu);
if(!Default.getBoolean("DISABLE_EXIT"))
popupMenu.add(exitMenu);
/**
* If connection closed set offline tray image