diff src/com/five_ten_sg/connectbot/util/HostDatabase.java @ 123:446dbcf606eb

add more 5250 config items; ignore drawing outside the screen
author Carl Byington <carl@five-ten-sg.com>
date Thu, 19 Jun 2014 08:28:23 -0700
parents 07c7055cc124
children 6eab98e58bed
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/util/HostDatabase.java	Wed Jun 18 19:00:34 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/util/HostDatabase.java	Thu Jun 19 08:28:23 2014 -0700
@@ -46,7 +46,7 @@
     public final static String TAG = "ConnectBot.HostDatabase";
 
     public final static String DB_NAME = "hosts";
-    public final static int DB_VERSION = 26;
+    public final static int DB_VERSION = 27;
 
     public final static String TABLE_HOSTS = "hosts";
     public final static String FIELD_HOST_NICKNAME = "nickname";
@@ -75,6 +75,11 @@
     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 FIELD_HOST_LIBRARY5250 = "library5250";
+    public final static String FIELD_HOST_MENU5250 = "menu5250";
+    public final static String FIELD_HOST_PROGRAM5250 = "program5250";
+    public final static String CATEGORY_5250 = "5250";
+    public final static String CATEGORY_X11 = "x11";
 
     public final static String TABLE_PORTFORWARDS = "portforwards";
     public final static String FIELD_PORTFORWARD_HOSTID = "hostid";
@@ -183,7 +188,10 @@
                    + FIELD_HOST_X11PORT + " INTEGER DEFAULT " + X11PORT_DEFAULT + ", "
                    + FIELD_HOST_MONITOR + " TEXT, "
                    + FIELD_HOST_EMULATION + " TEXT, "
-                   + FIELD_HOST_ENCRYPTION5250 + " TEXT)");
+                   + FIELD_HOST_ENCRYPTION5250 + " TEXT, "
+                   + FIELD_HOST_LIBRARY5250 + " TEXT, "
+                   + FIELD_HOST_MENU5250 + " TEXT, "
+                   + FIELD_HOST_PROGRAM5250 + " TEXT)");
         db.execSQL("CREATE TABLE " + TABLE_PORTFORWARDS
                    + " (_id INTEGER PRIMARY KEY, "
                    + FIELD_PORTFORWARD_HOSTID + " INTEGER, "
@@ -300,6 +308,14 @@
                            + " ADD COLUMN " + FIELD_HOST_EMULATION + " TEXT");
                 db.execSQL("ALTER TABLE " + TABLE_HOSTS
                            + " ADD COLUMN " + FIELD_HOST_ENCRYPTION5250 + " TEXT");
+
+            case 26:
+                db.execSQL("ALTER TABLE " + TABLE_HOSTS
+                           + " ADD COLUMN " + FIELD_HOST_LIBRARY5250 + " TEXT");
+                db.execSQL("ALTER TABLE " + TABLE_HOSTS
+                           + " ADD COLUMN " + FIELD_HOST_MENU5250 + " TEXT");
+                db.execSQL("ALTER TABLE " + TABLE_HOSTS
+                           + " ADD COLUMN " + FIELD_HOST_PROGRAM5250 + " TEXT");
         }
     }
 
@@ -416,6 +432,9 @@
                   COL_MONITOR = c.getColumnIndexOrThrow(FIELD_HOST_MONITOR),
                   COL_EMULATION = c.getColumnIndexOrThrow(FIELD_HOST_EMULATION),
                   COL_ENCRYPTION5250 = c.getColumnIndexOrThrow(FIELD_HOST_ENCRYPTION5250);
+                  COL_LIBRARY5250 = c.getColumnIndexOrThrow(FIELD_HOST_LIBRARY5250);
+                  COL_MENU5250 = c.getColumnIndexOrThrow(FIELD_HOST_MENU5250);
+                  COL_PROGRAM5250 = c.getColumnIndexOrThrow(FIELD_HOST_PROGRAM5250);
 
         while (c.moveToNext()) {
             HostBean host = new HostBean();
@@ -444,6 +463,9 @@
             host.setMonitor(c.getString(COL_MONITOR));
             host.setHostEmulation(c.getString(COL_EMULATION));
             host.setEncryption5250(c.getString(COL_ENCRYPTION5250));
+            host.setLibrary(c.getString(COL_LIBRARY5250));
+            host.setInitialMenu(c.getString(COL_MENU5250));
+            host.setProgram(c.getString(COL_PROGRAM5250));
             hosts.add(host);
         }