Mercurial > 510Connectbot
comparison src/com/five_ten_sg/connectbot/HostListActivity.java @ 192:f0b9ea35711a
read deployment.connections on startup for global preferences also
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 02 Jul 2014 18:06:59 -0700 |
parents | 398503d13f35 |
children | 8f0cdfc63378 |
comparison
equal
deleted
inserted
replaced
191:2e4ab8c33851 | 192:f0b9ea35711a |
---|---|
412 String [] parts = line.split("="); | 412 String [] parts = line.split("="); |
413 if (parts.length != 2) continue; | 413 if (parts.length != 2) continue; |
414 if (values == null) values = new ContentValues(); | 414 if (values == null) values = new ContentValues(); |
415 values.put(parts[0], parts[1]); | 415 values.put(parts[0], parts[1]); |
416 } | 416 } |
417 HostBean host = TransportFactory.findHost(hostdb, uri); | 417 if (uri.getScheme().equals("global")) { |
418 if (host == null) { | 418 SharedPreferences.Editor editor = prefs.edit(); |
419 host = TransportFactory.getTransport(uri.getScheme()).createHost(uri); | 419 HashMap<String,String> types = new HashMap<String,String>(); |
420 host.setColor(HostDatabase.COLOR_GRAY); | 420 types.put("memkeys", "boolean"); |
421 host.setPubkeyId(HostDatabase.PUBKEYID_ANY); | 421 types.put("update", "string"); |
422 hostdb.saveHost(host); | 422 types.put("connPersist", "boolean"); |
423 types.put("emulation", "string"); | |
424 types.put("scrollback", "integer"); | |
425 types.put("rotation", "string"); | |
426 types.put("shiftfkeys", "boolean"); | |
427 types.put("ctrlfkeys", "boolean"); | |
428 types.put("volumefont", "boolean"); | |
429 types.put("keymode", "string"); | |
430 types.put("camera", "string"); | |
431 types.put("volup", "string"); | |
432 types.put("voldn", "string"); | |
433 types.put("search", "string"); | |
434 types.put("ptt", "string"); | |
435 types.put("keepalive", "boolean"); | |
436 types.put("wifilock", "boolean"); | |
437 types.put("bumpyarrows", "boolean"); | |
438 types.put("extended_longpress", "boolean"); | |
439 types.put("ctrl_string", "string"); | |
440 types.put("picker_string", "string"); | |
441 types.put("picker_keep_open", "boolean"); | |
442 types.put("list_custom_keymap", "string"); | |
443 types.put("bell", "boolean"); | |
444 types.put("bellVolume", "float"); | |
445 types.put("bellVibrate", "boolean"); | |
446 types.put("bellNotification", "boolean"); | |
447 types.put("default_font_size", "float"); | |
448 types.put("default_fsize_width", "integer"); | |
449 types.put("default_fsize_height", "integer"); | |
450 types.put("screen_capture_folder", "string"); | |
451 types.put("screen_capture_popup", "boolean"); | |
452 types.put("file_dialog", "string"); | |
453 types.put("download_folder", "string"); | |
454 types.put("remote_upload_folder", "string"); | |
455 types.put("upload_dest_prompt", "boolean"); | |
456 types.put("background_file_transfer", "boolean"); | |
457 types.put("debug_keycodes", "boolean"); | |
458 for (String key : values.keySet()) { | |
459 if (types.containsKey(key)) { | |
460 Char stype = types.get(key)[0]; | |
461 switch (stype) { | |
462 case 'b': | |
463 editor.putBoolean(values.getAsBoolean(key); | |
464 break; | |
465 | |
466 case 'i': | |
467 editor.putInteger(values.getAsInteger(key)); | |
468 break; | |
469 | |
470 case 'f': | |
471 editor.putFloat(values.getAsFloat(key)); | |
472 break; | |
473 | |
474 case 's': | |
475 editor.putString(values.getAsString(key)) | |
476 break; | |
477 } | |
478 } | |
479 } | |
480 editor.commit(); | |
423 } | 481 } |
424 host = TransportFactory.findHost(hostdb, uri); | 482 else { |
425 if (host == null) continue; | 483 HostBean host = TransportFactory.findHost(hostdb, uri); |
426 if (values == null) continue; | 484 if (host == null) { |
427 SQLiteDatabase db = hostdb.getWritableDatabase(); | 485 host = TransportFactory.getTransport(uri.getScheme()).createHost(uri); |
428 db.update(HostDatabase.TABLE_HOSTS, values, "_id = ?", new String[] { String.valueOf(host.getId()) }); | 486 host.setColor(HostDatabase.COLOR_GRAY); |
429 db.close(); | 487 host.setPubkeyId(HostDatabase.PUBKEYID_ANY); |
488 hostdb.saveHost(host); | |
489 } | |
490 host = TransportFactory.findHost(hostdb, uri); | |
491 if (host == null) continue; | |
492 if (values == null) continue; | |
493 SQLiteDatabase db = hostdb.getWritableDatabase(); | |
494 db.update(HostDatabase.TABLE_HOSTS, values, "_id = ?", new String[] { String.valueOf(host.getId()) }); | |
495 db.close(); | |
496 } | |
430 } | 497 } |
431 reader.close(); | 498 reader.close(); |
432 (new File(fn)).delete(); | 499 (new File(fn)).delete(); |
433 } | 500 } |
434 catch (Exception e) { | 501 catch (Exception e) { |