Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-apps-ConnectBot: Commit

packages/apps/ConnectBot


Commit MetaInfo

Revisionee1555b863d67286017aa8a6a99463b699c3fee9 (tree)
Time2010-08-11 19:43:43
AuthorKenny Root <kenny@the-...>
CommiterChih-Wei Huang

Log Message

Update to r512

Add a description for the service

Change Summary

Incremental Difference

--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2,7 +2,7 @@
22 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
33 package="org.connectbot"
44 android:versionName="1.7.0-rc1"
5- android:versionCode="302"
5+ android:versionCode="306"
66 android:installLocation="auto">
77
88 <application
@@ -34,7 +34,9 @@
3434 <activity android:name=".HelpTopicActivity" android:configChanges="keyboardHidden|orientation" />
3535 <activity android:name=".ColorsActivity" android:configChanges="keyboardHidden|orientation" />
3636
37- <service android:name="org.connectbot.service.TerminalManager" android:configChanges="keyboardHidden|orientation" />
37+ <service android:name="org.connectbot.service.TerminalManager"
38+ android:configChanges="keyboardHidden|orientation"
39+ android:description="@string/service_desc" />
3840
3941 <activity android:name=".ConsoleActivity" android:configChanges="keyboardHidden|orientation"
4042 android:theme="@style/NoTitle" android:windowSoftInputMode="stateAlwaysVisible|adjustResize"
Binary files /dev/null and b/res/drawable/button_ctrl.png differ
Binary files /dev/null and b/res/drawable/button_esc.png differ
--- a/res/layout/act_console.xml
+++ b/res/layout/act_console.xml
@@ -92,7 +92,7 @@
9292
9393 <Button
9494 android:id="@+id/console_prompt_no"
95- android:text="@string/no"
95+ android:text="@string/button_no"
9696 android:paddingTop="5dip"
9797 android:paddingBottom="10dip"
9898 android:paddingLeft="40dip"
@@ -106,7 +106,7 @@
106106
107107 <Button
108108 android:id="@+id/console_prompt_yes"
109- android:text="@string/yes"
109+ android:text="@string/button_yes"
110110 android:paddingTop="5dip"
111111 android:paddingBottom="10dip"
112112 android:paddingLeft="40dip"
@@ -119,16 +119,43 @@
119119
120120 </RelativeLayout>
121121
122- <ImageView
123- android:id="@+id/keyboard_button"
124- android:paddingRight="15dip"
125- android:paddingBottom="15dip"
126- android:layout_width="wrap_content"
122+ <RelativeLayout
123+ android:id="@+id/keyboard_group"
124+ android:layout_width="fill_parent"
127125 android:layout_height="wrap_content"
128126 android:layout_alignParentBottom="true"
129- android:layout_alignParentRight="true"
130- android:visibility="gone"
131- android:src="@+drawable/keyboard_icon"
132- />
127+ android:padding="15dip"
128+ android:visibility="gone">
129+
130+ <ImageView
131+ android:id="@+id/button_keyboard"
132+ android:layout_width="wrap_content"
133+ android:layout_height="wrap_content"
134+ android:layout_alignParentBottom="true"
135+ android:layout_alignParentRight="true"
136+ android:src="@+drawable/button_keyboard"
137+ />
138+
139+ <ImageView
140+ android:id="@+id/button_ctrl"
141+ android:paddingRight="15dip"
142+ android:layout_width="wrap_content"
143+ android:layout_height="wrap_content"
144+ android:layout_alignParentLeft="true"
145+ android:layout_alignParentBottom="true"
146+ android:src="@+drawable/button_ctrl"
147+ />
148+
149+ <ImageView
150+ android:id="@+id/button_esc"
151+ android:paddingRight="15dip"
152+ android:layout_width="wrap_content"
153+ android:layout_height="wrap_content"
154+ android:layout_toRightOf="@+id/button_ctrl"
155+ android:layout_alignParentBottom="true"
156+ android:src="@+drawable/button_esc"
157+ />
158+
159+ </RelativeLayout>
133160
134161 </RelativeLayout>
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -167,9 +167,9 @@
167167 <string name="pref_update_summary">最大頻率檢查ConnectBot更新</string>
168168
169169 <!-- Name for the preference that forces the service to stay running in the background.-->
170- <string name="pref_conn_persist_title">持續連線</string>
170+ <string name="pref_conn_persist_title">保持聯機</string>
171171 <!-- Summary for the preference that forces the service to stay running in the background. -->
172- <string name="pref_conn_persist_summary">在背景執行時仍強制停留在連線狀態</string>
172+ <string name="pref_conn_persist_summary">強制並保持連接在後台</string>
173173
174174 <!-- Name for the keyboard shortcuts preference -->
175175 <string name="pref_keymode_title">目錄快捷鍵</string>
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -20,6 +20,7 @@
2020
2121 <resources>
2222 <string name="app_desc">Simple, powerful, open-source SSH client.</string>
23+ <string name="service_desc">Maintains SSH connections and loaded pubkeys</string>
2324
2425 <!-- Window title for the Host List -->
2526 <string name="title_hosts_list">Hosts</string>
@@ -317,6 +318,11 @@
317318 <!-- Button that brings up the list of URLs on the current screen -->
318319 <string name="console_menu_urlscan">URL Scan</string>
319320
321+ <!-- Button label to answer "Yes" to a yes/no prompt -->
322+ <string name="button_yes">Yes</string>
323+ <!-- Button label to answer "No" to a yes/no prompt -->
324+ <string name="button_no">No</string>
325+
320326 <!-- Selection for a "local" port forward. E.g., connections to a port listening locally is forwarded to the remote end's listening port. -->
321327 <string name="portforward_local">Local</string>
322328 <!-- Selection for a "remote" port forward. E.g., connections to a port listening remotely is forwarded to the local end's listening port. -->
--- a/src/gnu/java/nio/charset/ByteCharset.java
+++ /dev/null
@@ -1,188 +0,0 @@
1-/* ByteCharset.java -- Abstract class for generic 1-byte encodings.
2- Copyright (C) 2005 Free Software Foundation, Inc.
3-
4-This file is part of GNU Classpath.
5-
6-GNU Classpath is free software; you can redistribute it and/or modify
7-it under the terms of the GNU General Public License as published by
8-the Free Software Foundation; either version 2, or (at your option)
9-any later version.
10-
11-GNU Classpath is distributed in the hope that it will be useful, but
12-WITHOUT ANY WARRANTY; without even the implied warranty of
13-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14-General Public License for more details.
15-
16-You should have received a copy of the GNU General Public License
17-along with GNU Classpath; see the file COPYING. If not, write to the
18-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19-02110-1301 USA.
20-
21-Linking this library statically or dynamically with other modules is
22-making a combined work based on this library. Thus, the terms and
23-conditions of the GNU General Public License cover the whole
24-combination.
25-
26-As a special exception, the copyright holders of this library give you
27-permission to link this library with independent modules to produce an
28-executable, regardless of the license terms of these independent
29-modules, and to copy and distribute the resulting executable under
30-terms of your choice, provided that you also meet, for each linked
31-independent module, the terms and conditions of the license of that
32-module. An independent module is a module which is not derived from
33-or based on this library. If you modify this library, you may extend
34-this exception to your version of the library, but you are not
35-obligated to do so. If you do not wish to do so, delete this
36-exception statement from your version. */
37-
38-package gnu.java.nio.charset;
39-
40-import java.nio.ByteBuffer;
41-import java.nio.CharBuffer;
42-import java.nio.charset.Charset;
43-import java.nio.charset.CharsetDecoder;
44-import java.nio.charset.CharsetEncoder;
45-import java.nio.charset.CoderResult;
46-
47-/**
48- * A generic encoding framework for single-byte encodings,
49- * utilizing a look-up table.
50- *
51- * This replaces the gnu.java.io.EncoderEightBitLookup class,
52- * created by Aron Renn.
53- *
54- * @author Sven de Marothy
55- */
56-abstract class ByteCharset extends Charset
57-{
58- protected char[] lookupTable;
59- /**
60- * Char to signify the character in the table is undefined
61- */
62- protected static final char NONE = (char)0xFFFD;
63-
64- ByteCharset (String canonicalName, String[] aliases)
65- {
66- super (canonicalName, aliases);
67- }
68-
69- /**
70- * Most western charsets include ASCII, but this should
71- * be overloaded for others.
72- */
73- public boolean contains (Charset cs)
74- {
75-// return cs instanceof US_ASCII || (cs.getClass() == getClass());
76- return cs.getClass() == cs.getClass();
77- }
78-
79- char[] getLookupTable()
80- {
81- return lookupTable;
82- }
83-
84- public CharsetDecoder newDecoder ()
85- {
86- return new Decoder (this);
87- }
88-
89- public CharsetEncoder newEncoder ()
90- {
91- return new Encoder (this);
92- }
93-
94- private static final class Decoder extends CharsetDecoder
95- {
96- private char[] lookup;
97-
98- // Package-private to avoid a trampoline constructor.
99- Decoder (ByteCharset cs)
100- {
101- super (cs, 1.0f, 1.0f);
102- lookup = cs.getLookupTable();
103- }
104-
105- protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out)
106- {
107- // TODO: Optimize this in the case in.hasArray() / out.hasArray()
108- while (in.hasRemaining ())
109- {
110- byte b = in.get ();
111- char c;
112-
113- if (!out.hasRemaining ())
114- {
115- in.position (in.position () - 1);
116- return CoderResult.OVERFLOW;
117- }
118-
119- if((c = lookup[(int) (b & 0xFF)]) == NONE);
120- // return CoderResult.unmappableForLength (1);
121- out.put (c);
122- }
123-
124- return CoderResult.UNDERFLOW;
125- }
126- }
127-
128- private static final class Encoder extends CharsetEncoder
129- {
130- private byte[] lookup;
131-
132- // Package-private to avoid a trampoline constructor.
133- Encoder (ByteCharset cs)
134- {
135- super (cs, 1.0f, 1.0f);
136-
137- char[] lookup_table = cs.getLookupTable();
138-
139- // Create the inverse look-up table.
140- // determine required size of encoding_table:
141- int max = 0;
142- for (int i = 0; i < lookup_table.length; i++)
143- {
144- int c = (int)lookup_table[i];
145- max = (c > max && c < NONE) ? c : max;
146- }
147-
148- lookup = new byte[max+1];
149-
150- for (int i = 0; i < lookup_table.length; i++)
151- {
152- int c = (int)lookup_table[i];
153- if (c != 0 && c < NONE)
154- {
155- lookup[c] = (byte)i;
156- }
157- }
158- }
159-
160- protected CoderResult encodeLoop (CharBuffer in, ByteBuffer out)
161- {
162- // TODO: Optimize this in the case in.hasArray() / out.hasArray()
163- while (in.hasRemaining ())
164- {
165- int c = (int)in.get ();
166-
167- if (!out.hasRemaining ())
168- {
169- in.position (in.position () - 1);
170- return CoderResult.OVERFLOW;
171- }
172-
173- // lookup byte encoding
174- byte b = (c < lookup.length) ? lookup[c] : (byte)0;
175-
176- if ((int)b != 0 || (int)c == 0)
177- {
178- out.put (b);
179- } else {
180- in.position (in.position () - 1);
181- return CoderResult.unmappableForLength (1);
182- }
183- }
184-
185- return CoderResult.UNDERFLOW;
186- }
187- }
188-}
--- a/src/gnu/java/nio/charset/Cp437.java
+++ /dev/null
@@ -1,90 +0,0 @@
1-/* Cp437.java -- Charset implementation for the Cp437 character set.
2- Copyright (C) 2005 Free Software Foundation, Inc.
3-
4-This file is part of GNU Classpath.
5-
6-GNU Classpath is free software; you can redistribute it and/or modify
7-it under the terms of the GNU General Public License as published by
8-the Free Software Foundation; either version 2, or (at your option)
9-any later version.
10-
11-GNU Classpath is distributed in the hope that it will be useful, but
12-WITHOUT ANY WARRANTY; without even the implied warranty of
13-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14-General Public License for more details.
15-
16-You should have received a copy of the GNU General Public License
17-along with GNU Classpath; see the file COPYING. If not, write to the
18-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19-02110-1301 USA.
20-
21-Linking this library statically or dynamically with other modules is
22-making a combined work based on this library. Thus, the terms and
23-conditions of the GNU General Public License cover the whole
24-combination.
25-
26-As a special exception, the copyright holders of this library give you
27-permission to link this library with independent modules to produce an
28-executable, regardless of the license terms of these independent
29-modules, and to copy and distribute the resulting executable under
30-terms of your choice, provided that you also meet, for each linked
31-independent module, the terms and conditions of the license of that
32-module. An independent module is a module which is not derived from
33-or based on this library. If you modify this library, you may extend
34-this exception to your version of the library, but you are not
35-obligated to do so. If you do not wish to do so, delete this
36-exception statement from your version. */
37-
38-package gnu.java.nio.charset;
39-
40-public class Cp437 extends ByteCharset
41-{
42- public static final String NAME = "CP437";
43-
44- /**
45- * This is the lookup table for this encoding
46- */
47- private static final char[] lookup =
48- {
49- 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
50- 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
51- 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
52- 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
53- 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
54- 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
55- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
56- 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
57- 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
58- 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
59- 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
60- 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
61- 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
62- 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
63- 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
64- 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
65- 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
66- 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
67- 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
68- 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
69- 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
70- 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
71- 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
72- 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
73- 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
74- 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
75- 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
76- 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
77- 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4,
78- 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
79- 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248,
80- 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
81- };
82-
83- public Cp437()
84- {
85- super("Cp437", new String[] {
86- });
87- lookupTable = lookup;
88- }
89-
90-} // class Cp437
--- a/src/org/connectbot/ConsoleActivity.java
+++ b/src/org/connectbot/ConsoleActivity.java
@@ -23,6 +23,7 @@ import java.util.List;
2323 import org.connectbot.bean.SelectionArea;
2424 import org.connectbot.service.PromptHelper;
2525 import org.connectbot.service.TerminalBridge;
26+import org.connectbot.service.TerminalKeyListener;
2627 import org.connectbot.service.TerminalManager;
2728 import org.connectbot.util.PreferenceConstants;
2829
@@ -116,7 +117,6 @@ public class ConsoleActivity extends Activity {
116117 private Animation slide_left_in, slide_left_out, slide_right_in, slide_right_out, fade_stay_hidden, fade_out_delayed;
117118
118119 private Animation keyboard_fade_in, keyboard_fade_out;
119- private ImageView keyboardButton;
120120 private float lastX, lastY;
121121
122122 private InputMethodManager inputManager;
@@ -130,6 +130,8 @@ public class ConsoleActivity extends Activity {
130130
131131 private Handler handler = new Handler();
132132
133+ private ImageView mKeyboardButton;
134+
133135 private ServiceConnection connection = new ServiceConnection() {
134136 public void onServiceConnected(ComponentName className, IBinder service) {
135137 bound = ((TerminalManager.TerminalBinder) service).getService();
@@ -347,15 +349,46 @@ public class ConsoleActivity extends Activity {
347349 keyboard_fade_out = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_out);
348350
349351 inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
350- keyboardButton = (ImageView) findViewById(R.id.keyboard_button);
351- keyboardButton.setOnClickListener(new OnClickListener() {
352+
353+ final RelativeLayout keyboardGroup = (RelativeLayout) findViewById(R.id.keyboard_group);
354+
355+ mKeyboardButton = (ImageView) findViewById(R.id.button_keyboard);
356+ mKeyboardButton.setOnClickListener(new OnClickListener() {
352357 public void onClick(View view) {
353358 View flip = findCurrentView(R.id.console_flip);
354359 if (flip == null)
355360 return;
356361
357362 inputManager.showSoftInput(flip, InputMethodManager.SHOW_FORCED);
358- keyboardButton.setVisibility(View.GONE);
363+ keyboardGroup.setVisibility(View.GONE);
364+ }
365+ });
366+
367+ final ImageView ctrlButton = (ImageView) findViewById(R.id.button_ctrl);
368+ ctrlButton.setOnClickListener(new OnClickListener() {
369+ public void onClick(View view) {
370+ View flip = findCurrentView(R.id.console_flip);
371+ if (flip == null) return;
372+ TerminalView terminal = (TerminalView)flip;
373+
374+ TerminalKeyListener handler = terminal.bridge.getKeyHandler();
375+ handler.metaPress(TerminalKeyListener.META_CTRL_ON);
376+
377+ keyboardGroup.setVisibility(View.GONE);
378+ }
379+ });
380+
381+ final ImageView escButton = (ImageView) findViewById(R.id.button_esc);
382+ escButton.setOnClickListener(new OnClickListener() {
383+ public void onClick(View view) {
384+ View flip = findCurrentView(R.id.console_flip);
385+ if (flip == null) return;
386+ TerminalView terminal = (TerminalView)flip;
387+
388+ TerminalKeyListener handler = terminal.bridge.getKeyHandler();
389+ handler.sendEscape();
390+
391+ keyboardGroup.setVisibility(View.GONE);
359392 }
360393 });
361394
@@ -519,21 +552,20 @@ public class ConsoleActivity extends Activity {
519552 lastX = event.getX();
520553 lastY = event.getY();
521554 } else if (event.getAction() == MotionEvent.ACTION_UP
522- && config.hardKeyboardHidden != Configuration.KEYBOARDHIDDEN_NO
523- && keyboardButton.getVisibility() == View.GONE
555+ && keyboardGroup.getVisibility() == View.GONE
524556 && event.getEventTime() - event.getDownTime() < CLICK_TIME
525557 && Math.abs(event.getX() - lastX) < MAX_CLICK_DISTANCE
526558 && Math.abs(event.getY() - lastY) < MAX_CLICK_DISTANCE) {
527- keyboardButton.startAnimation(keyboard_fade_in);
528- keyboardButton.setVisibility(View.VISIBLE);
559+ keyboardGroup.startAnimation(keyboard_fade_in);
560+ keyboardGroup.setVisibility(View.VISIBLE);
529561
530562 handler.postDelayed(new Runnable() {
531563 public void run() {
532- if (keyboardButton.getVisibility() == View.GONE)
564+ if (keyboardGroup.getVisibility() == View.GONE)
533565 return;
534566
535- keyboardButton.startAnimation(keyboard_fade_out);
536- keyboardButton.setVisibility(View.GONE);
567+ keyboardGroup.startAnimation(keyboard_fade_out);
568+ keyboardGroup.setVisibility(View.GONE);
537569 }
538570 }, KEYBOARD_DISPLAY_TIME);
539571 }
@@ -1006,6 +1038,8 @@ public class ConsoleActivity extends Activity {
10061038 bound.setResizeAllowed(true);
10071039
10081040 bound.hardKeyboardHidden = (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES);
1041+
1042+ mKeyboardButton.setVisibility(bound.hardKeyboardHidden ? View.VISIBLE : View.GONE);
10091043 }
10101044 }
10111045
--- a/src/org/connectbot/PubkeyListActivity.java
+++ b/src/org/connectbot/PubkeyListActivity.java
@@ -293,7 +293,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener {
293293 Log.d(TAG, String.format("Unlocked key '%s'", pubkey.getNickname()));
294294
295295 // save this key in memory
296- bound.addKey(pubkey, trileadKey);
296+ bound.addKey(pubkey, trileadKey, true);
297297
298298 updateHandler.sendEmptyMessage(-1);
299299 }
--- a/src/org/connectbot/service/ConnectionNotifier.java
+++ b/src/org/connectbot/service/ConnectionNotifier.java
@@ -152,13 +152,12 @@ public abstract class ConnectionNotifier {
152152
153153 @Override
154154 public void showRunningNotification(Service context) {
155-// context.startForeground(ONLINE_NOTIFICATION, newRunningNotification(context));
155+ context.startForeground(ONLINE_NOTIFICATION, newRunningNotification(context));
156156 }
157157
158158 @Override
159159 public void hideRunningNotification(Service context) {
160-// context.stopForeground(true);
160+ context.stopForeground(true);
161161 }
162-
163162 }
164163 }
--- a/src/org/connectbot/service/TerminalBridge.java
+++ b/src/org/connectbot/service/TerminalBridge.java
@@ -915,8 +915,6 @@ public class TerminalBridge implements VDUDisplay {
915915 color = manager.hostdb.getColorsForScheme(HostDatabase.DEFAULT_COLOR_SCHEME);
916916 }
917917
918- // This was taken from http://geekswithblogs.net/casualjim/archive/2005/12/01/61722.aspx
919- private final static String urlRegex = "(?:(?:ht|f)tp(?:s?)\\:\\/\\/|~/|/)?(?:\\w+:\\w+@)?(?:(?:[-\\w]+\\.)+(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?::[\\d]{1,5})?(?:(?:(?:/(?:[-\\w~!$+|.,=]|%[a-f\\d]{2})+)+|/)+|\\?|#)?(?:(?:\\?(?:[-\\w~!$+|.,*:]|%[a-f\\d{2}])+=(?:[-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)(?:&(?:[-\\w~!$+|.,*:]|%[a-f\\d{2}])+=(?:[-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)*)*(?:#(?:[-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)?";
920918 private static Pattern urlPattern = null;
921919
922920 /**
@@ -925,8 +923,36 @@ public class TerminalBridge implements VDUDisplay {
925923 public List<String> scanForURLs() {
926924 List<String> urls = new LinkedList<String>();
927925
928- if (urlPattern == null)
929- urlPattern = Pattern.compile(urlRegex);
926+ if (urlPattern == null) {
927+ // based on http://www.ietf.org/rfc/rfc2396.txt
928+ String scheme = "[A-Za-z][-+.0-9A-Za-z]*";
929+ String unreserved = "[-._~0-9A-Za-z]";
930+ String pctEncoded = "%[0-9A-Fa-f]{2}";
931+ String subDelims = "[!$&'()*+,;=]";
932+ String userinfo = "(?:" + unreserved + "|" + pctEncoded + "|" + subDelims + "|:)*";
933+ String h16 = "[0-9A-Fa-f]{1,4}";
934+ String decOctet = "(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])";
935+ String ipv4address = decOctet + "\\." + decOctet + "\\." + decOctet + "\\." + decOctet;
936+ String ls32 = "(?:" + h16 + ":" + h16 + "|" + ipv4address + ")";
937+ String ipv6address = "(?:(?:" + h16 + "){6}" + ls32 + ")";
938+ String ipvfuture = "v[0-9A-Fa-f]+.(?:" + unreserved + "|" + subDelims + "|:)+";
939+ String ipLiteral = "\\[(?:" + ipv6address + "|" + ipvfuture + ")\\]";
940+ String regName = "(?:" + unreserved + "|" + pctEncoded + "|" + subDelims + ")*";
941+ String host = "(?:" + ipLiteral + "|" + ipv4address + "|" + regName + ")";
942+ String port = "[0-9]*";
943+ String authority = "(?:" + userinfo + "@)?" + host + "(?::" + port + ")?";
944+ String pchar = "(?:" + unreserved + "|" + pctEncoded + "|" + subDelims + ")";
945+ String segment = pchar + "*";
946+ String pathAbempty = "(?:/" + segment + ")*";
947+ String segmentNz = pchar + "+";
948+ String pathAbsolute = "/(?:" + segmentNz + "(?:/" + segment + ")*)?";
949+ String pathRootless = segmentNz + "(?:/" + segment + ")*";
950+ String hierPart = "(?://" + authority + pathAbempty + "|" + pathAbsolute + "|" + pathRootless + ")";
951+ String query = "(?:" + pchar + "|/|\\?)*";
952+ String fragment = "(?:" + pchar + "|/|\\?)*";
953+ String uriRegex = scheme + ":" + hierPart + "(?:" + query + ")?(?:#" + fragment + ")?";
954+ urlPattern = Pattern.compile(uriRegex);
955+ }
930956
931957 char[] visibleBuffer = new char[buffer.height * buffer.width];
932958 for (int l = 0; l < buffer.height; l++)
--- a/src/org/connectbot/service/TerminalKeyListener.java
+++ b/src/org/connectbot/service/TerminalKeyListener.java
@@ -375,10 +375,10 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
375375 }
376376 } else {
377377 if ((metaState & META_CTRL_ON) != 0) {
378- ((vt320)buffer).keyTyped(vt320.KEY_ESCAPE, ' ', 0);
378+ sendEscape();
379379 metaState &= ~META_CTRL_ON;
380380 } else
381- metaState |= META_CTRL_ON;
381+ metaPress(META_CTRL_ON);
382382 }
383383
384384 bridge.redraw();
@@ -402,6 +402,9 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
402402 return false;
403403 }
404404
405+ public void sendEscape() {
406+ ((vt320)buffer).keyTyped(vt320.KEY_ESCAPE, ' ', 0);
407+ }
405408
406409 /**
407410 * @param key
@@ -453,7 +456,7 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
453456 *
454457 * @param code
455458 */
456- private void metaPress(int code) {
459+ public void metaPress(int code) {
457460 if ((metaState & (code << 1)) != 0) {
458461 metaState &= ~(code << 1);
459462 } else if ((metaState & code) != 0) {
--- a/src/org/connectbot/service/TerminalManager.java
+++ b/src/org/connectbot/service/TerminalManager.java
@@ -135,6 +135,7 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
135135 pubkeydb = new PubkeyDatabase(this);
136136
137137 // load all marked pubkeys into memory
138+ updateSavingKeys();
138139 List<PubkeyBean> pubkeys = pubkeydb.getAllStartPubkeys();
139140
140141 for (PubkeyBean pubkey : pubkeys) {
@@ -162,7 +163,6 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
162163
163164 connectivityManager = new ConnectivityReceiver(this, lockingWifi);
164165
165- updateSavingKeys();
166166 }
167167
168168 private void updateSavingKeys() {
@@ -364,7 +364,11 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
364364 }
365365
366366 public void addKey(PubkeyBean pubkey, Object trileadKey) {
367- if (!savingKeys)
367+ addKey(pubkey, trileadKey, false);
368+ }
369+
370+ public void addKey(PubkeyBean pubkey, Object trileadKey, boolean force) {
371+ if (!savingKeys && !force)
368372 return;
369373
370374 removeKey(pubkey.getNickname());
--- a/src/org/connectbot/util/PreferenceConstants.java
+++ b/src/org/connectbot/util/PreferenceConstants.java
@@ -26,7 +26,7 @@ import android.os.Build;
2626 public class PreferenceConstants {
2727 public static final boolean PRE_ECLAIR = (Integer.parseInt(Build.VERSION.SDK) <= 4);
2828 public static final boolean PRE_FROYO = PRE_ECLAIR ? true :
29- (Build.VERSION.SDK_INT <= 7);
29+ (Integer.parseInt(Build.VERSION.SDK) <= 7);
3030
3131 public static final String MEMKEYS = "memkeys";
3232 public static final String UPDATE = "update";
Show on old repository browser