Mercurial > 510Connectbot
changeset 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 | 2e4ab8c33851 |
children | 8f0cdfc63378 |
files | res/values/arrays.xml res/values/strings.xml res/xml/preferences.xml src/com/five_ten_sg/connectbot/HostListActivity.java |
diffstat | 4 files changed, 84 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/res/values/arrays.xml Wed Jul 02 16:32:28 2014 -0700 +++ b/res/values/arrays.xml Wed Jul 02 18:06:59 2014 -0700 @@ -57,6 +57,7 @@ <item>@string/list_hwbutton_ctrla</item> <item>@string/list_hwbutton_esc_a</item> <item>@string/list_hwbutton_monitor</item> + <item>@string/list_hwbutton_soft_function_keys</item> <item>@string/list_hwbutton_none</item> </string-array> @@ -70,6 +71,7 @@ <item>Ctrl+A</item> <item>Esc+A</item> <item>Monitor Key</item> + <item>Soft Function Keypad</item> <item>None</item> </string-array>
--- a/res/values/strings.xml Wed Jul 02 16:32:28 2014 -0700 +++ b/res/values/strings.xml Wed Jul 02 18:06:59 2014 -0700 @@ -478,6 +478,8 @@ <string name="list_hwbutton_esc_a">"Esc+A"</string> <!-- Selection to indicate pressing a hardware button should notify the monitor. --> <string name="list_hwbutton_monitor">"Monitor Key"</string> + <!-- Selection to indicate pressing a hardware button should bring up the soft function key pad. --> + <string name="list_hwbutton_soft_function_keys">"Soft Function Keypad"</string> <!-- Selection to indicate pressing a hardware button should send nothing at all. --> <string name="list_hwbutton_none">"None"</string>
--- a/res/xml/preferences.xml Wed Jul 02 16:32:28 2014 -0700 +++ b/res/xml/preferences.xml Wed Jul 02 18:06:59 2014 -0700 @@ -250,7 +250,7 @@ android:title="@string/pref_default_font_size" android:summary="@string/pref_default_font_size_summary" android:defaultValue="0" - android:numeric="integer" + android:numeric="decimal" /> <EditTextPreference
--- 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();