changeset 61:ce8f13242339 tn5250

add 5250 config entries
author Carl Byington <carl@five-ten-sg.com>
date Fri, 13 Jun 2014 15:27:08 -0700
parents d9b27288a9d2
children aac8e0496ef9
files res/values/arrays.xml res/values/strings.xml res/xml/host_prefs.xml res/xml/preferences.xml src/com/five_ten_sg/connectbot/bean/HostBean.java src/com/five_ten_sg/connectbot/util/HostDatabase.java
diffstat 6 files changed, 193 insertions(+), 135 deletions(-) [+]
line wrap: on
line diff
--- a/res/values/arrays.xml	Wed Jun 11 15:44:59 2014 -0700
+++ b/res/values/arrays.xml	Fri Jun 13 15:27:08 2014 -0700
@@ -27,6 +27,13 @@
 		<item>screen</item>
 	</string-array>
 
+	<string-array name="list_5250_encryption_modes" translatable="false">
+		<item>NONE</item>
+		<item>SSLv2</item>
+		<item>SSLv3</item>
+		<item>TLS</item>
+	</string-array>
+
 	<string-array name="list_rotation" translatable="false">
 		<item>@string/list_rotation_default</item>
 		<item>@string/list_rotation_land</item>
--- a/res/values/strings.xml	Wed Jun 11 15:44:59 2014 -0700
+++ b/res/values/strings.xml	Fri Jun 13 15:27:08 2014 -0700
@@ -346,6 +346,9 @@
 	<!-- Monitor field title for host editor preference -->
 	<string name="hostpref_monitor_title">"Monitor Init String"</string>
 
+	<!-- Host 5250_encryption preference title -->
+	<string name="hostpref_5250_encryption_title">"Host 5250 Encryption"</string>
+
 	<!-- Host preference category title for x11 forwarding -->
 	<string name="hostpref_x11_forwarding">"X11 forwarding"</string>
 
--- a/res/xml/host_prefs.xml	Wed Jun 11 15:44:59 2014 -0700
+++ b/res/xml/host_prefs.xml	Fri Jun 13 15:27:08 2014 -0700
@@ -20,141 +20,155 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
 
-	<EditTextPreference
-		android:key="nickname"
-		android:title="@string/hostpref_nickname_title"
-		android:singleLine="true"
-		/>
+    <EditTextPreference
+        android:key="nickname"
+        android:title="@string/hostpref_nickname_title"
+        android:singleLine="true"
+        />
 
-	<ListPreference
-		android:key="color"
-		android:title="@string/hostpref_color_title"
-		android:entries="@array/list_colors"
-		android:entryValues="@array/list_color_values"
-		/>
+    <ListPreference
+        android:key="color"
+        android:title="@string/hostpref_color_title"
+        android:entries="@array/list_colors"
+        android:entryValues="@array/list_color_values"
+        />
 
-	<EditTextPreference
-		android:key="fontsize"
-		android:title="@string/hostpref_fontsize_title"
-		android:inputType="number"
-		android:singleLine="true"
-		/>
+    <EditTextPreference
+        android:key="fontsize"
+        android:title="@string/hostpref_fontsize_title"
+        android:inputType="number"
+        android:singleLine="true"
+        />
 
 <!--
-	<CheckBoxPreference
-		android:key="usekeys"
-		android:title="Use SSH keys"
-		/>
+    <CheckBoxPreference
+        android:key="usekeys"
+        android:title="Use SSH keys"
+        />
 -->
 
-	<ListPreference
-		android:key="pubkeyid"
-		android:title="@string/hostpref_pubkeyid_title"
-		android:entries="@array/list_pubkeyids"
-		android:entryValues="@array/list_pubkeyids_value"
-		/>
+    <ListPreference
+        android:key="pubkeyid"
+        android:title="@string/hostpref_pubkeyid_title"
+        android:entries="@array/list_pubkeyids"
+        android:entryValues="@array/list_pubkeyids_value"
+        />
 
-	<ListPreference
-		android:key="useauthagent"
-		android:title="@string/hostpref_authagent_title"
-		android:entries="@array/list_authagent"
-		android:entryValues="@array/list_authagent_values"
-		/>
+    <ListPreference
+        android:key="useauthagent"
+        android:title="@string/hostpref_authagent_title"
+        android:entries="@array/list_authagent"
+        android:entryValues="@array/list_authagent_values"
+        />
 
-	<EditTextPreference
-		android:key="postlogin"
-		android:title="@string/hostpref_postlogin_title"
-		android:summary="@string/hostpref_postlogin_summary"
-		/>
+    <EditTextPreference
+        android:key="postlogin"
+        android:title="@string/hostpref_postlogin_title"
+        android:summary="@string/hostpref_postlogin_summary"
+        />
 
-	<CheckBoxPreference
-		android:key="compression"
-		android:title="@string/hostpref_compression_title"
-		android:summary="@string/hostpref_compression_summary"
-		/>
+    <CheckBoxPreference
+        android:key="compression"
+        android:title="@string/hostpref_compression_title"
+        android:summary="@string/hostpref_compression_summary"
+        />
 
-	<EditTextPreference
-		android:key="httpproxy"
-		android:title="@string/hostpref_httpproxy_title"
-		android:summary="@string/hostpref_httpproxy_summary"
-		android:inputType="textUri"
-		/>
+    <EditTextPreference
+        android:key="httpproxy"
+        android:title="@string/hostpref_httpproxy_title"
+        android:summary="@string/hostpref_httpproxy_summary"
+        android:inputType="textUri"
+        />
 
-	<CheckBoxPreference
-		android:key="wantsession"
-		android:title="@string/hostpref_wantsession_title"
-		android:summary="@string/hostpref_wantsession_summary"
-		/>
+    <CheckBoxPreference
+        android:key="wantsession"
+        android:title="@string/hostpref_wantsession_title"
+        android:summary="@string/hostpref_wantsession_summary"
+        />
 
-	<CheckBoxPreference
-		android:key="stayconnected"
-		android:title="@string/hostpref_stayconnected_title"
-		android:summary="@string/hostpref_stayconnected_summary"
-		/>
+    <CheckBoxPreference
+        android:key="stayconnected"
+        android:title="@string/hostpref_stayconnected_title"
+        android:summary="@string/hostpref_stayconnected_summary"
+        />
 
-	<ListPreference
-		android:key="delkey"
-		android:title="@string/hostpref_delkey_title"
-		android:summary="@string/hostpref_delkey_summary"
-		android:entries="@array/list_delkey"
-		android:entryValues="@array/list_delkey_values"
-		/>
+    <ListPreference
+        android:key="delkey"
+        android:title="@string/hostpref_delkey_title"
+        android:summary="@string/hostpref_delkey_summary"
+        android:entries="@array/list_delkey"
+        android:entryValues="@array/list_delkey_values"
+        />
+
+    <ListPreference
+        android:key="encoding"
+        android:title="@string/hostpref_encoding_title"
+        android:summary="@string/hostpref_encoding_summary"
+        />
+
+    <PreferenceCategory
+        android:title="@string/hostpref_connection_category">
 
-	<ListPreference
-		android:key="encoding"
-		android:title="@string/hostpref_encoding_title"
-		android:summary="@string/hostpref_encoding_summary"
-		/>
+        <EditTextPreference
+            android:key="username"
+            android:title="@string/hostpref_username_title"
+            android:singleLine="true"
+            />
 
-	<PreferenceCategory
-		android:title="@string/hostpref_connection_category">
+        <EditTextPreference
+            android:key="hostname"
+            android:title="@string/hostpref_hostname_title"
+            android:singleLine="true"
+            />
 
-		<EditTextPreference
-			android:key="username"
-			android:title="@string/hostpref_username_title"
-			android:singleLine="true"
-			/>
+        <EditTextPreference
+            android:key="port"
+            android:title="@string/hostpref_port_title"
+            android:numeric="integer"
+            />
 
-		<EditTextPreference
-			android:key="hostname"
-			android:title="@string/hostpref_hostname_title"
-			android:singleLine="true"
-			/>
+        <EditTextPreference
+            android:key="monitor"
+            android:title="@string/hostpref_monitor_title"
+            android:singleLine="true"
+            />
 
-		<EditTextPreference
-			android:key="port"
-			android:title="@string/hostpref_port_title"
-			android:numeric="integer"
-			/>
+        <EditTextPreference
+            android:key="hostemulation"
+            android:title="@string/hostpref_emulation_title"
+            android:singleLine="true"
+            />
 
-		<EditTextPreference
-			android:key="monitor"
-			android:title="@string/hostpref_monitor_title"
-			android:singleLine="true"
-			/>
-	</PreferenceCategory>
+        <ListPreference
+            android:key="encryption5250"
+            android:title="@string/hostpref_5250_encryption_title"
+			android:entries="@array/list_5250_encryption_modes"
+			android:entryValues="@array/list_5250_encryption_modes"
+            />
+    </PreferenceCategory>
 
-	<PreferenceCategory
-	    android:title="@string/hostpref_x11_forwarding">
+
+    <PreferenceCategory
+        android:title="@string/hostpref_x11_forwarding">
 
-		<CheckBoxPreference
-			android:key="wantx11forward"
-			android:title="@string/hostpref_wantx11forward_title"
-			android:summary="@string/hostpref_wantx11forward_summary"
-		/>
+        <CheckBoxPreference
+            android:key="wantx11forward"
+            android:title="@string/hostpref_wantx11forward_title"
+            android:summary="@string/hostpref_wantx11forward_summary"
+        />
 
-		<EditTextPreference
-		    android:key="x11host"
-		    android:title="@string/hostpref_x11host_title"
-		    android:singleLine="true"
-		    />
+        <EditTextPreference
+            android:key="x11host"
+            android:title="@string/hostpref_x11host_title"
+            android:singleLine="true"
+            />
 
-		<EditTextPreference
-		    android:key="x11port"
-		    android:title="@string/hostpref_x11port_title"
-		    android:numeric="integer"
-		    />
+        <EditTextPreference
+            android:key="x11port"
+            android:title="@string/hostpref_x11port_title"
+            android:numeric="integer"
+            />
 
-	</PreferenceCategory>
+    </PreferenceCategory>
 
 </PreferenceScreen>
--- a/res/xml/preferences.xml	Wed Jun 11 15:44:59 2014 -0700
+++ b/res/xml/preferences.xml	Fri Jun 13 15:27:08 2014 -0700
@@ -52,7 +52,7 @@
 			android:summary="@string/pref_emulation_summary"
 			android:entries="@array/list_emulation_modes"
 			android:entryValues="@array/list_emulation_modes"
-			android:defaultValue="screen"
+			android:defaultValue="xterm"
 			/>
 
 		<EditTextPreference
--- a/src/com/five_ten_sg/connectbot/bean/HostBean.java	Wed Jun 11 15:44:59 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/bean/HostBean.java	Fri Jun 13 15:27:08 2014 -0700
@@ -29,31 +29,33 @@
     public static final String BEAN_NAME = "host";
 
     /* Database fields */
-    private long id = -1;
-    private String nickname = null;
-    private String username = null;
-    private String hostname = null;
-    private int port = 22;
-    private String protocol = "ssh";
-    private String hostKeyAlgo = null;
-    private byte[] hostKey = null;
-    private long lastConnect = -1;
-    private String color;
+    private long    id = -1;
+    private String  nickname = null;
+    private String  username = null;
+    private String  hostname = null;
+    private int     port = 22;
+    private String  protocol = "ssh";
+    private String  hostKeyAlgo = null;
+    private byte[]  hostKey = null;
+    private long    lastConnect = -1;
+    private String  color;
     private boolean useKeys = true;
-    private String useAuthAgent = HostDatabase.AUTHAGENT_NO;
-    private String postLogin = null;
-    private long pubkeyId = -1;
+    private String  useAuthAgent = HostDatabase.AUTHAGENT_NO;
+    private String  postLogin = null;
+    private long    pubkeyId = -1;
     private boolean wantSession = true;
-    private String delKey = HostDatabase.DELKEY_DEL;
-    private int fontSize = -1;
+    private String  delKey = HostDatabase.DELKEY_DEL;
+    private int     fontSize = -1;
     private boolean compression = false;
-    private String httpproxy = null;
-    private String encoding = HostDatabase.ENCODING_DEFAULT;
+    private String  httpproxy = null;
+    private String  encoding = HostDatabase.ENCODING_DEFAULT;
     private boolean stayConnected = false;
     private boolean wantX11Forward = false;
-    private String x11Host = "localhost";
-    private int x11Port = 6000;
-    private String monitor = null;
+    private String  x11Host = "localhost";
+    private int     x11Port = 6000;
+    private String  monitor = null;
+    private String  hostemulation = null;
+    private String  encryption5250 = null;
 
     public HostBean() {
     }
@@ -252,6 +254,22 @@
         this.monitor = monitor;
     }
 
+    public String getHostEmulation() {
+        return this.hostemulation;
+    }
+
+    public void setHostEmulation(String hostemulation) {
+        this.hostemulation = hostemulation;
+    }
+
+    public String getEncryption5250() {
+        return this.encryption5250;
+    }
+
+    public void setEncryption5250(String encryption5250) {
+        this.encryption5250 = encryption5250;
+    }
+
     @Override
     public ContentValues getValues() {
         ContentValues values = new ContentValues();
@@ -279,6 +297,8 @@
         values.put(HostDatabase.FIELD_HOST_X11HOST, x11Host);
         values.put(HostDatabase.FIELD_HOST_X11PORT, x11Port);
         values.put(HostDatabase.FIELD_HOST_MONITOR, monitor);
+        values.put(HostDatabase.FIELD_HOST_EMULATION, emulation);
+        values.put(HostDatabase.FIELD_HOST_ENCRYPTION5250, encryption5250);
         return values;
     }
 
--- a/src/com/five_ten_sg/connectbot/util/HostDatabase.java	Wed Jun 11 15:44:59 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/util/HostDatabase.java	Fri Jun 13 15:27:08 2014 -0700
@@ -73,6 +73,8 @@
     public final static String FIELD_HOST_X11HOST = "x11host";
     public final static String FIELD_HOST_X11PORT = "x11port";
     public final static String FIELD_HOST_MONITOR = "monitor";
+    public final static String FIELD_HOST_EMULATION = "emulation";
+    public final static String FIELD_HOST_ENCRYPTION5250 = "encryption5250";
 
     public final static String TABLE_PORTFORWARDS = "portforwards";
     public final static String FIELD_PORTFORWARD_HOSTID = "hostid";
@@ -179,7 +181,9 @@
                    + FIELD_HOST_WANTX11FORWARD + " TEXT DEFAULT '" + Boolean.toString(false) + "', "
                    + FIELD_HOST_X11HOST + " TEXT DEFAULT '" + X11HOST_DEFAULT + "', "
                    + FIELD_HOST_X11PORT + " INTEGER DEFAULT " + X11PORT_DEFAULT + ", "
-                   + FIELD_HOST_MONITOR + " TEXT)");
+                   + FIELD_HOST_MONITOR + " TEXT, "
+                   + FIELD_HOST_EMULATION + " TEXT, "
+                   + FIELD_HOST_ENCRYPTION5250 + " TEXT)");
         db.execSQL("CREATE TABLE " + TABLE_PORTFORWARDS
                    + " (_id INTEGER PRIMARY KEY, "
                    + FIELD_PORTFORWARD_HOSTID + " INTEGER, "
@@ -290,6 +294,12 @@
             case 24:
                 db.execSQL("ALTER TABLE " + TABLE_HOSTS
                            + " ADD COLUMN " + FIELD_HOST_MONITOR + " TEXT");
+
+            case 25:
+                db.execSQL("ALTER TABLE " + TABLE_HOSTS
+                           + " ADD COLUMN " + FIELD_HOST_EMULATION + " TEXT");
+                db.execSQL("ALTER TABLE " + TABLE_HOSTS
+                           + " ADD COLUMN " + FIELD_HOST_ENCRYPTION5250 + " TEXT");
         }
     }
 
@@ -403,7 +413,9 @@
                   COL_WANTX11FORWARD = c.getColumnIndexOrThrow(FIELD_HOST_WANTX11FORWARD),
                   COL_X11HOST = c.getColumnIndexOrThrow(FIELD_HOST_X11HOST),
                   COL_X11PORT = c.getColumnIndexOrThrow(FIELD_HOST_X11PORT),
-                  COL_MONITOR = c.getColumnIndexOrThrow(FIELD_HOST_MONITOR);
+                  COL_MONITOR = c.getColumnIndexOrThrow(FIELD_HOST_MONITOR),
+                  COL_EMULATION = c.getColumnIndexOrThrow(FIELD_HOST_EMULATION),
+                  COL_ENCRYPTION5250 = c.getColumnIndexOrThrow(FIELD_HOST_ENCRYPTION5250);
 
         while (c.moveToNext()) {
             HostBean host = new HostBean();
@@ -430,6 +442,8 @@
             host.setX11Host(c.getString(COL_X11HOST));
             host.setX11Port(c.getInt(COL_X11PORT));
             host.setMonitor(c.getString(COL_MONITOR));
+            host.setEmulation(c.getString(COL_EMULATION));
+            host.setEncryption5250(c.getString(COL_ENCRYPTION5250));
             hosts.add(host);
         }