Mercurial > 510Connectbot
diff 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 |
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/HostListActivity.java Wed Jul 02 16:32:28 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/HostListActivity.java Wed Jul 02 18:06:59 2014 -0700 @@ -414,19 +414,86 @@ if (values == null) values = new ContentValues(); values.put(parts[0], parts[1]); } - HostBean host = TransportFactory.findHost(hostdb, uri); - if (host == null) { - host = TransportFactory.getTransport(uri.getScheme()).createHost(uri); - host.setColor(HostDatabase.COLOR_GRAY); - host.setPubkeyId(HostDatabase.PUBKEYID_ANY); - hostdb.saveHost(host); + if (uri.getScheme().equals("global")) { + SharedPreferences.Editor editor = prefs.edit(); + HashMap<String,String> types = new HashMap<String,String>(); + types.put("memkeys", "boolean"); + types.put("update", "string"); + types.put("connPersist", "boolean"); + types.put("emulation", "string"); + types.put("scrollback", "integer"); + types.put("rotation", "string"); + types.put("shiftfkeys", "boolean"); + types.put("ctrlfkeys", "boolean"); + types.put("volumefont", "boolean"); + types.put("keymode", "string"); + types.put("camera", "string"); + types.put("volup", "string"); + types.put("voldn", "string"); + types.put("search", "string"); + types.put("ptt", "string"); + types.put("keepalive", "boolean"); + types.put("wifilock", "boolean"); + types.put("bumpyarrows", "boolean"); + types.put("extended_longpress", "boolean"); + types.put("ctrl_string", "string"); + types.put("picker_string", "string"); + types.put("picker_keep_open", "boolean"); + types.put("list_custom_keymap", "string"); + types.put("bell", "boolean"); + types.put("bellVolume", "float"); + types.put("bellVibrate", "boolean"); + types.put("bellNotification", "boolean"); + types.put("default_font_size", "float"); + types.put("default_fsize_width", "integer"); + types.put("default_fsize_height", "integer"); + types.put("screen_capture_folder", "string"); + types.put("screen_capture_popup", "boolean"); + types.put("file_dialog", "string"); + types.put("download_folder", "string"); + types.put("remote_upload_folder", "string"); + types.put("upload_dest_prompt", "boolean"); + types.put("background_file_transfer", "boolean"); + types.put("debug_keycodes", "boolean"); + for (String key : values.keySet()) { + if (types.containsKey(key)) { + Char stype = types.get(key)[0]; + switch (stype) { + case 'b': + editor.putBoolean(values.getAsBoolean(key); + break; + + case 'i': + editor.putInteger(values.getAsInteger(key)); + break; + + case 'f': + editor.putFloat(values.getAsFloat(key)); + break; + + case 's': + editor.putString(values.getAsString(key)) + break; + } + } + } + editor.commit(); } - host = TransportFactory.findHost(hostdb, uri); - if (host == null) continue; - if (values == null) continue; - SQLiteDatabase db = hostdb.getWritableDatabase(); - db.update(HostDatabase.TABLE_HOSTS, values, "_id = ?", new String[] { String.valueOf(host.getId()) }); - db.close(); + else { + HostBean host = TransportFactory.findHost(hostdb, uri); + if (host == null) { + host = TransportFactory.getTransport(uri.getScheme()).createHost(uri); + host.setColor(HostDatabase.COLOR_GRAY); + host.setPubkeyId(HostDatabase.PUBKEYID_ANY); + hostdb.saveHost(host); + } + host = TransportFactory.findHost(hostdb, uri); + if (host == null) continue; + if (values == null) continue; + SQLiteDatabase db = hostdb.getWritableDatabase(); + db.update(HostDatabase.TABLE_HOSTS, values, "_id = ?", new String[] { String.valueOf(host.getId()) }); + db.close(); + } } reader.close(); (new File(fn)).delete();