Mercurial > 510Connectbot
comparison 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 |
comparison
equal
deleted
inserted
replaced
122:52b1d0ee27b1 | 123:446dbcf606eb |
---|---|
44 public class HostDatabase extends RobustSQLiteOpenHelper { | 44 public class HostDatabase extends RobustSQLiteOpenHelper { |
45 | 45 |
46 public final static String TAG = "ConnectBot.HostDatabase"; | 46 public final static String TAG = "ConnectBot.HostDatabase"; |
47 | 47 |
48 public final static String DB_NAME = "hosts"; | 48 public final static String DB_NAME = "hosts"; |
49 public final static int DB_VERSION = 26; | 49 public final static int DB_VERSION = 27; |
50 | 50 |
51 public final static String TABLE_HOSTS = "hosts"; | 51 public final static String TABLE_HOSTS = "hosts"; |
52 public final static String FIELD_HOST_NICKNAME = "nickname"; | 52 public final static String FIELD_HOST_NICKNAME = "nickname"; |
53 public final static String FIELD_HOST_PROTOCOL = "protocol"; | 53 public final static String FIELD_HOST_PROTOCOL = "protocol"; |
54 public final static String FIELD_HOST_USERNAME = "username"; | 54 public final static String FIELD_HOST_USERNAME = "username"; |
73 public final static String FIELD_HOST_X11HOST = "x11host"; | 73 public final static String FIELD_HOST_X11HOST = "x11host"; |
74 public final static String FIELD_HOST_X11PORT = "x11port"; | 74 public final static String FIELD_HOST_X11PORT = "x11port"; |
75 public final static String FIELD_HOST_MONITOR = "monitor"; | 75 public final static String FIELD_HOST_MONITOR = "monitor"; |
76 public final static String FIELD_HOST_EMULATION = "emulation"; | 76 public final static String FIELD_HOST_EMULATION = "emulation"; |
77 public final static String FIELD_HOST_ENCRYPTION5250 = "encryption5250"; | 77 public final static String FIELD_HOST_ENCRYPTION5250 = "encryption5250"; |
78 public final static String FIELD_HOST_LIBRARY5250 = "library5250"; | |
79 public final static String FIELD_HOST_MENU5250 = "menu5250"; | |
80 public final static String FIELD_HOST_PROGRAM5250 = "program5250"; | |
81 public final static String CATEGORY_5250 = "5250"; | |
82 public final static String CATEGORY_X11 = "x11"; | |
78 | 83 |
79 public final static String TABLE_PORTFORWARDS = "portforwards"; | 84 public final static String TABLE_PORTFORWARDS = "portforwards"; |
80 public final static String FIELD_PORTFORWARD_HOSTID = "hostid"; | 85 public final static String FIELD_PORTFORWARD_HOSTID = "hostid"; |
81 public final static String FIELD_PORTFORWARD_NICKNAME = "nickname"; | 86 public final static String FIELD_PORTFORWARD_NICKNAME = "nickname"; |
82 public final static String FIELD_PORTFORWARD_TYPE = "type"; | 87 public final static String FIELD_PORTFORWARD_TYPE = "type"; |
181 + FIELD_HOST_WANTX11FORWARD + " TEXT DEFAULT '" + Boolean.toString(false) + "', " | 186 + FIELD_HOST_WANTX11FORWARD + " TEXT DEFAULT '" + Boolean.toString(false) + "', " |
182 + FIELD_HOST_X11HOST + " TEXT DEFAULT '" + X11HOST_DEFAULT + "', " | 187 + FIELD_HOST_X11HOST + " TEXT DEFAULT '" + X11HOST_DEFAULT + "', " |
183 + FIELD_HOST_X11PORT + " INTEGER DEFAULT " + X11PORT_DEFAULT + ", " | 188 + FIELD_HOST_X11PORT + " INTEGER DEFAULT " + X11PORT_DEFAULT + ", " |
184 + FIELD_HOST_MONITOR + " TEXT, " | 189 + FIELD_HOST_MONITOR + " TEXT, " |
185 + FIELD_HOST_EMULATION + " TEXT, " | 190 + FIELD_HOST_EMULATION + " TEXT, " |
186 + FIELD_HOST_ENCRYPTION5250 + " TEXT)"); | 191 + FIELD_HOST_ENCRYPTION5250 + " TEXT, " |
192 + FIELD_HOST_LIBRARY5250 + " TEXT, " | |
193 + FIELD_HOST_MENU5250 + " TEXT, " | |
194 + FIELD_HOST_PROGRAM5250 + " TEXT)"); | |
187 db.execSQL("CREATE TABLE " + TABLE_PORTFORWARDS | 195 db.execSQL("CREATE TABLE " + TABLE_PORTFORWARDS |
188 + " (_id INTEGER PRIMARY KEY, " | 196 + " (_id INTEGER PRIMARY KEY, " |
189 + FIELD_PORTFORWARD_HOSTID + " INTEGER, " | 197 + FIELD_PORTFORWARD_HOSTID + " INTEGER, " |
190 + FIELD_PORTFORWARD_NICKNAME + " TEXT, " | 198 + FIELD_PORTFORWARD_NICKNAME + " TEXT, " |
191 + FIELD_PORTFORWARD_TYPE + " TEXT NOT NULL DEFAULT " + PORTFORWARD_LOCAL + ", " | 199 + FIELD_PORTFORWARD_TYPE + " TEXT NOT NULL DEFAULT " + PORTFORWARD_LOCAL + ", " |
298 case 25: | 306 case 25: |
299 db.execSQL("ALTER TABLE " + TABLE_HOSTS | 307 db.execSQL("ALTER TABLE " + TABLE_HOSTS |
300 + " ADD COLUMN " + FIELD_HOST_EMULATION + " TEXT"); | 308 + " ADD COLUMN " + FIELD_HOST_EMULATION + " TEXT"); |
301 db.execSQL("ALTER TABLE " + TABLE_HOSTS | 309 db.execSQL("ALTER TABLE " + TABLE_HOSTS |
302 + " ADD COLUMN " + FIELD_HOST_ENCRYPTION5250 + " TEXT"); | 310 + " ADD COLUMN " + FIELD_HOST_ENCRYPTION5250 + " TEXT"); |
311 | |
312 case 26: | |
313 db.execSQL("ALTER TABLE " + TABLE_HOSTS | |
314 + " ADD COLUMN " + FIELD_HOST_LIBRARY5250 + " TEXT"); | |
315 db.execSQL("ALTER TABLE " + TABLE_HOSTS | |
316 + " ADD COLUMN " + FIELD_HOST_MENU5250 + " TEXT"); | |
317 db.execSQL("ALTER TABLE " + TABLE_HOSTS | |
318 + " ADD COLUMN " + FIELD_HOST_PROGRAM5250 + " TEXT"); | |
303 } | 319 } |
304 } | 320 } |
305 | 321 |
306 /** | 322 /** |
307 * Touch a specific host to update its "last connected" field. | 323 * Touch a specific host to update its "last connected" field. |
414 COL_X11HOST = c.getColumnIndexOrThrow(FIELD_HOST_X11HOST), | 430 COL_X11HOST = c.getColumnIndexOrThrow(FIELD_HOST_X11HOST), |
415 COL_X11PORT = c.getColumnIndexOrThrow(FIELD_HOST_X11PORT), | 431 COL_X11PORT = c.getColumnIndexOrThrow(FIELD_HOST_X11PORT), |
416 COL_MONITOR = c.getColumnIndexOrThrow(FIELD_HOST_MONITOR), | 432 COL_MONITOR = c.getColumnIndexOrThrow(FIELD_HOST_MONITOR), |
417 COL_EMULATION = c.getColumnIndexOrThrow(FIELD_HOST_EMULATION), | 433 COL_EMULATION = c.getColumnIndexOrThrow(FIELD_HOST_EMULATION), |
418 COL_ENCRYPTION5250 = c.getColumnIndexOrThrow(FIELD_HOST_ENCRYPTION5250); | 434 COL_ENCRYPTION5250 = c.getColumnIndexOrThrow(FIELD_HOST_ENCRYPTION5250); |
435 COL_LIBRARY5250 = c.getColumnIndexOrThrow(FIELD_HOST_LIBRARY5250); | |
436 COL_MENU5250 = c.getColumnIndexOrThrow(FIELD_HOST_MENU5250); | |
437 COL_PROGRAM5250 = c.getColumnIndexOrThrow(FIELD_HOST_PROGRAM5250); | |
419 | 438 |
420 while (c.moveToNext()) { | 439 while (c.moveToNext()) { |
421 HostBean host = new HostBean(); | 440 HostBean host = new HostBean(); |
422 host.setId(c.getLong(COL_ID)); | 441 host.setId(c.getLong(COL_ID)); |
423 host.setNickname(c.getString(COL_NICKNAME)); | 442 host.setNickname(c.getString(COL_NICKNAME)); |
442 host.setX11Host(c.getString(COL_X11HOST)); | 461 host.setX11Host(c.getString(COL_X11HOST)); |
443 host.setX11Port(c.getInt(COL_X11PORT)); | 462 host.setX11Port(c.getInt(COL_X11PORT)); |
444 host.setMonitor(c.getString(COL_MONITOR)); | 463 host.setMonitor(c.getString(COL_MONITOR)); |
445 host.setHostEmulation(c.getString(COL_EMULATION)); | 464 host.setHostEmulation(c.getString(COL_EMULATION)); |
446 host.setEncryption5250(c.getString(COL_ENCRYPTION5250)); | 465 host.setEncryption5250(c.getString(COL_ENCRYPTION5250)); |
466 host.setLibrary(c.getString(COL_LIBRARY5250)); | |
467 host.setInitialMenu(c.getString(COL_MENU5250)); | |
468 host.setProgram(c.getString(COL_PROGRAM5250)); | |
447 hosts.add(host); | 469 hosts.add(host); |
448 } | 470 } |
449 | 471 |
450 return hosts; | 472 return hosts; |
451 } | 473 } |