changeset 84:8f23b05a51f7

convert ctrl keys to virtual keys; use proper android home directory
author Carl Byington <carl@five-ten-sg.com>
date Mon, 16 Jun 2014 11:25:37 -0700
parents 4ccfde0bc506
children 53de03150941
files src/com/five_ten_sg/connectbot/transport/TN5250.java src/org/tn5250j/GlobalConfigure.java src/org/tn5250j/framework/transport/SSL/SSLImplementation.java
diffstat 3 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/transport/TN5250.java	Mon Jun 16 10:43:30 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/transport/TN5250.java	Mon Jun 16 11:25:37 2014 -0700
@@ -70,6 +70,7 @@
 
 
     class vt320x5250 extends vt320 {
+        private HashMap<Integer, Integer> controls;
         private HashMap<Integer, String> mnemonics;
 
         public vt320x5250() {
@@ -78,6 +79,12 @@
 
         public vt320x5250(int width, int height) {
             super(width, height);
+            controls = new HashMap<Integer, Integer>();
+            controls.put(0x08, KEY_BACK_SPACE);
+            controls.put(0x09, KEY_TAB);
+            controls.put(0x0d, KEY_ENTER);
+            controls.put(0x1b, KEY_ESCAPE);
+
             mnemonics = new HashMap<Integer, String>();
             mnemonics.put(KEY_PAUSE       , "[attn]");
             mnemonics.put(KEY_F1          , "[pf1]");
@@ -144,8 +151,13 @@
         }
         @Override
         public void write(int b) {
-            if (bridge.monitor != null) bridge.monitor.hostData(b);
-            screen52.sendKeys(new String(new byte[] {(byte)b}));
+            if (controls.containsKey(b)) {
+                keyPressed(controls.get(b), ' ', 0);
+            }
+            else {
+                if (bridge.monitor != null) bridge.monitor.hostData(b);
+                screen52.sendKeys(new String(new byte[] {(byte)b}));
+            }
         }
         @Override
         public void keyPressed(int keyCode, char keyChar, int modifiers) {
--- a/src/org/tn5250j/GlobalConfigure.java	Mon Jun 16 10:43:30 2014 -0700
+++ b/src/org/tn5250j/GlobalConfigure.java	Mon Jun 16 11:25:37 2014 -0700
@@ -472,11 +472,11 @@
     }
 
     /**
-     * Private helper to return the settings directory
+     * helper to return the settings directory
      *
      * @return
      */
-    private String settingsDirectory() {
+    public String settingsDirectory() {
         return settingsFolder() + File.separator;
 
     }
--- a/src/org/tn5250j/framework/transport/SSL/SSLImplementation.java	Mon Jun 16 10:43:30 2014 -0700
+++ b/src/org/tn5250j/framework/transport/SSL/SSLImplementation.java	Mon Jun 16 11:25:37 2014 -0700
@@ -84,8 +84,7 @@
 	public void init(String sslType) {
 		try {
 			Log.d(TAG,"Initializing User KeyStore");
-			userKsPath = System.getProperty("user.home") + File.separator
-					+ GlobalConfigure.TN5250J_FOLDER + File.separator + "keystore";
+			userKsPath = GlobalConfigure.settingsDirectory() + "keystore";
 			File userKsFile = new File(userKsPath);
 			userks = KeyStore.getInstance(KeyStore.getDefaultType());
 			userks.load(userKsFile.exists() ? new FileInputStream(userKsFile)