encodingChange = false; sameMachine = false;
fullScreen = viewer.fullScreen.getValue();
menuKey = Keysyms.F8;
- options = new OptionsDialog(this, this);
+ options = new OptionsDialog(this);
options.initDialog();
clipboardDialog = new ClipboardDialog(this);
firstUpdate = true; pendingUpdate = false;
public void serverCutText(String str, int len) {
setContents(str);
- Clipboard cb = null;
- if (!cc.viewer.applet)
- cb = Toolkit.getDefaultToolkit().getSystemClipboard();
- if (cb != null) {
- StringSelection ss = new StringSelection(str);
- try {
- cb.setContents(ss, ss);
- } catch(Exception e) {
- vlog.debug(e.toString());
+ SecurityManager sm = System.getSecurityManager();
+ try {
+ if (sm != null) sm.checkSystemClipboardAccess();
+ Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
+ if (cb != null) {
+ StringSelection ss = new StringSelection(str);
+ try {
+ cb.setContents(ss, ss);
+ } catch(Exception e) {
+ vlog.debug(e.toString());
+ }
}
+ } catch(SecurityException e) {
+ System.err.println("Cannot access the system clipboard");
}
}
String oldContents = "";
synchronized public void checkClipboard() {
- Clipboard cb = null;
- if (!cc.viewer.applet)
- cb = Toolkit.getDefaultToolkit().getSystemClipboard();
- if (cb != null && cc.viewer.sendClipboard.getValue()) {
- Transferable t = cb.getContents(null);
- if ((t != null) && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
- try {
- String newContents = (String)t.getTransferData(DataFlavor.stringFlavor);
- if (newContents != null && !newContents.equals(oldContents)) {
- cc.writeClientCutText(newContents, newContents.length());
- oldContents = newContents;
- cc.clipboardDialog.setContents(newContents);
+ SecurityManager sm = System.getSecurityManager();
+ try {
+ if (sm != null) sm.checkSystemClipboardAccess();
+ Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
+ if (cb != null && cc.viewer.sendClipboard.getValue()) {
+ Transferable t = cb.getContents(null);
+ if ((t != null) && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
+ try {
+ String newContents = (String)t.getTransferData(DataFlavor.stringFlavor);
+ if (newContents != null && !newContents.equals(oldContents)) {
+ cc.writeClientCutText(newContents, newContents.length());
+ oldContents = newContents;
+ cc.clipboardDialog.setContents(newContents);
+ }
+ } catch (java.lang.Exception e) {
+ System.out.println("Exception getting clipboard data: " + e.getMessage());
}
- } catch (java.lang.Exception e) {
- System.out.println("Exception getting clipboard data: " + e.getMessage());
}
}
+ } catch(SecurityException e) {
+ System.err.println("Cannot access the system clipboard");
}
}
com/jcraft/jzlib/*.class \
com/tigervnc/vncviewer/tigervnc.png \
com/tigervnc/vncviewer/tigervnc.ico
+ rm -f tigervnc.keystore
+ keytool -genkey -alias TigerVNC -keystore tigervnc.keystore -keyalg RSA \
+ -storepass tigervnc -keypass tigervnc -validity 7300 \
+ -dname "CN=TigerVNC, OU=Software Development, O=The TigerVNC Project, L=Austin, S=Texas, C=US"
+ jarsigner -keystore tigervnc.keystore -storepass tigervnc -keypass tigervnc \
+ $(ARCHIVE) TigerVNC
+ rm -f tigervnc.keystore
+
$(TIMESTAMP):
$(shell cat $(MANIFEST) > $(TIMESTAMP))
boolean autoScale = false;
boolean fixedRatioScale = false;
- boolean applet = false;
- public OptionsDialog(OptionsDialogCallback cb_, CConn cc_) {
+ public OptionsDialog(OptionsDialogCallback cb_) {
super(false);
cb = cb_;
- CConn cc = cc_;
- applet = cc.viewer.applet;
setResizable(false);
setTitle("VNC Viewer Options");
- if (!applet)
- defaults = new UserPrefs("vncviewer");
+ defaults = new UserPrefs("vncviewer");
getContentPane().setLayout(
new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));
addGBComponent(cfSaveAsButton,configPanel, 0, 2, 1, 1, 0, 0, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, new Insets(4,8,4,8));
cfReloadButton.setEnabled(false);
cfSaveButton.setEnabled(false);
- cfSaveAsButton.setEnabled(!applet);
+ //cfSaveAsButton.setEnabled(!applet);
JPanel defaultsPanel = new JPanel(new GridBagLayout());
defaultsPanel.setBorder(BorderFactory.createTitledBorder("Defaults"));
addGBComponent(configPanel,DefaultsPanel, 0, 0, 1, GridBagConstraints.REMAINDER, 0, 0, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.PAGE_START, new Insets(4,4,4,4));
addGBComponent(defaultsPanel,DefaultsPanel, 1, 0, 1, GridBagConstraints.REMAINDER, 0, 0, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.PAGE_START, new Insets(4,4,4,4));
- defReloadButton.setEnabled(!applet);
- defSaveButton.setEnabled(!applet);
+ //defReloadButton.setEnabled(!applet);
+ //defSaveButton.setEnabled(!applet);
// security tab
SecPanel=new JPanel(new GridBagLayout());
endDialog();
} else if (s instanceof JButton && (JButton)s == defSaveButton) {
try {
- if (!applet)
- defaults.Save();
+ defaults.Save();
} catch (java.lang.Exception x) { }
} else if (s instanceof JButton && (JButton)s == ca) {
JFileChooser fc = new JFileChooser();
mediumColour.setEnabled(!autoSelect.isSelected());
lowColour.setEnabled(!autoSelect.isSelected());
veryLowColour.setEnabled(!autoSelect.isSelected());
- if (!applet)
- defaults.setPref("autoSelect",(autoSelect.isSelected()) ? "on" : "off");
+ defaults.setPref("autoSelect",(autoSelect.isSelected()) ? "on" : "off");
}
if (s instanceof JCheckBox && (JCheckBox)s == customCompressLevel) {
compressLevel.setEnabled(customCompressLevel.isSelected());
- if (!applet)
- defaults.setPref("customCompressLevel",(customCompressLevel.isSelected()) ? "on" : "off");
+ defaults.setPref("customCompressLevel",(customCompressLevel.isSelected()) ? "on" : "off");
}
if (s instanceof JCheckBox && (JCheckBox)s == noJpeg) {
qualityLevel.setEnabled(noJpeg.isSelected());
- if (!applet)
- defaults.setPref("noJpeg",(noJpeg.isSelected()) ? "on" : "off");
+ defaults.setPref("noJpeg",(noJpeg.isSelected()) ? "on" : "off");
}
if (s instanceof JComboBox && (JComboBox)s == scalingFactor) {
autoScale = fixedRatioScale = false;
}
}
if (s instanceof JCheckBox && (JCheckBox)s == sendLocalUsername) {
- if (!applet)
- defaults.setPref("sendLocalUsername",(sendLocalUsername.isSelected()) ? "on" : "off");
+ defaults.setPref("sendLocalUsername",(sendLocalUsername.isSelected()) ? "on" : "off");
}
if (s instanceof JCheckBox && (JCheckBox)s == secVeNCrypt) {
encNone.setEnabled(secVeNCrypt.isSelected());
}
public void endDialog() {
- if (ok && !cc.viewer.applet) {
- options.defaults.setPref("encryption",(encryption.getSelectedIndex()==1) ? "off" : "on");
- if (!server.getSelectedItem().toString().equals("")) {
- String t = (options.defaults.getString("server")==null) ? "" : options.defaults.getString("server");
- StringTokenizer st = new StringTokenizer(t, ",");
- StringBuffer sb = new StringBuffer().append((String)server.getSelectedItem());
- while (st.hasMoreTokens()) {
- String s = st.nextToken();
- if (!s.equals((String)server.getSelectedItem()) && !s.equals("")) {
- sb.append(',');
- sb.append(s);
+ if (ok) {
+ try {
+ options.defaults.setPref("encryption",(encryption.getSelectedIndex()==1) ? "off" : "on");
+ if (!server.getSelectedItem().toString().equals("")) {
+ String t = (options.defaults.getString("server")==null) ? "" : options.defaults.getString("server");
+ StringTokenizer st = new StringTokenizer(t, ",");
+ StringBuffer sb = new StringBuffer().append((String)server.getSelectedItem());
+ while (st.hasMoreTokens()) {
+ String s = st.nextToken();
+ if (!s.equals((String)server.getSelectedItem()) && !s.equals("")) {
+ sb.append(',');
+ sb.append(s);
+ }
}
+ options.defaults.setPref("server", sb.toString());
}
- options.defaults.setPref("server", sb.toString());
- }
- try {
options.defaults.Save();
- } catch (java.lang.Exception x) { }
+ } catch (java.io.IOException e) {
+ System.out.println(e.toString());
+ } catch(java.security.AccessControlException e) {
+ System.out.println(e.toString());
+ }
}
done = true;
if (modal) {
public UserPrefs(String appName_) {
appName = appName_;
- systemprops=System.getProperties();
+ try {
+ systemprops=System.getProperties();
+ } catch(java.security.AccessControlException e) {
+ System.out.println("Cannot access system properties");
+ }
// This is guaranteed as always being some valid directory,
// according to spec.
prefFile= getHomeDir()+getFileSeperator()+
"."+appName;
try {
load(new java.io.FileInputStream(prefFile));
+ } catch(java.security.AccessControlException e) {
+ System.out.println("Cannot access system properties");
} catch (Exception err) {
if(err instanceof java.io.FileNotFoundException) {
try {
*/
final public static String getHomeDir() {
String homeDir = null;
- String os = System.getProperty("os.name");
- try {
- if (os.startsWith("Windows")) {
- // JRE prior to 1.5 cannot reliably determine USERPROFILE
- // return user.home and hope it's right...
- if (Integer.parseInt(System.getProperty("java.version").split("\\.")[1]) < 5) {
- homeDir = System.getProperty("user.home");
+ try {
+ String os = System.getProperty("os.name");
+ try {
+ if (os.startsWith("Windows")) {
+ // JRE prior to 1.5 cannot reliably determine USERPROFILE
+ // return user.home and hope it's right...
+ if (Integer.parseInt(System.getProperty("java.version").split("\\.")[1]) < 5) {
+ try {
+ homeDir = System.getProperty("user.home");
+ } catch(java.security.AccessControlException e) {
+ System.out.println("Cannot access user.home system property");
+ }
+ } else {
+ homeDir = System.getenv("USERPROFILE");
+ }
} else {
- homeDir = System.getenv("USERPROFILE");
+ try {
+ homeDir = FileSystemView.getFileSystemView().
+ getDefaultDirectory().getCanonicalPath();
+ } catch(java.security.AccessControlException e) {
+ System.out.println("Cannot access system property");
+ }
}
- } else {
- homeDir = FileSystemView.getFileSystemView().
- getDefaultDirectory().getCanonicalPath();
+ } catch (Exception e) {
+ e.printStackTrace();
}
- } catch (Exception e) {
- e.printStackTrace();
- }
+ } catch(java.security.AccessControlException e) {
+ System.out.println("Cannot access os.name system property");
+ }
return homeDir;
}
final private String getUserName() {
- String userName = (String) System.getProperties().get("user.name");
+ String userName = null;
+ try {
+ userName = (String) System.getProperties().get("user.name");
+ } catch(java.security.AccessControlException e) {
+ System.out.println("Cannot access user.name system property");
+ }
return userName;
}
final public static String getFileSeperator() {
- String seperator = System.getProperties().get("file.separator").toString();
+ String seperator = null;
+ try {
+ seperator = System.getProperties().get("file.separator").toString();
+ } catch(java.security.AccessControlException e) {
+ System.out.println("Cannot access file.separator system property");
+ }
return seperator;
}
<APPLET CODE=com.tigervnc.vncviewer.VncViewer ARCHIVE=VncViewer.jar
WIDTH=$APPLETWIDTH HEIGHT=$APPLETHEIGHT>
<param name=PORT value=$PORT>
-$PARAMS
</APPLET>
<BR>
<A href="http://www.tigervnc.org/">TigerVNC site</A>