diff options
author | Kenny Root <kenny@the-b.org> | 2008-11-10 07:51:52 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2008-11-10 07:51:52 +0000 |
commit | f59247218159edd56140c947f94a3833a34a58d4 (patch) | |
tree | ef3040bfa8fc870f628789973efab75a3b1987f9 | |
parent | 1e8503432cf5a5c981856528de285f5fdac6242a (diff) | |
download | connectbot-f59247218159edd56140c947f94a3833a34a58d4.tar.gz connectbot-f59247218159edd56140c947f94a3833a34a58d4.tar.bz2 connectbot-f59247218159edd56140c947f94a3833a34a58d4.zip |
* Deleted JCTerm source from repository
* Externalized some strings.
-rw-r--r-- | res/values/strings.xml | 11 | ||||
-rw-r--r-- | src/com/jcraft/jcterm/Emulator.java | 416 | ||||
-rw-r--r-- | src/com/jcraft/jcterm/EmulatorVT100.java | 634 | ||||
-rw-r--r-- | src/com/jcraft/jcterm/Term.java | 80 | ||||
-rw-r--r-- | src/org/connectbot/HostListActivity.java | 2 | ||||
-rw-r--r-- | src/org/connectbot/PubkeyListActivity.java | 19 |
6 files changed, 18 insertions, 1144 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index ca88622..e6f5eb4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -9,7 +9,6 @@ <string name="title_host_editor">Edit Host</string> <string name="title_password">Input Password</string> - <string name="title_pubkey">Public Keys</string> <string name="title_entropy">Gathering Entropy</string> <string name="resolve_edit">Edit Host</string> @@ -19,7 +18,6 @@ <string name="menu_insert">Add Host</string> <string name="menu_delete">Delete Host</string> <string name="menu_preferences">Preferences</string> - <string name="menu_pubkey">Pubkeys</string> <string name="menu_about">About</string> @@ -33,6 +31,13 @@ <string name="pubkey_list_empty">Tap "Menu" to create\nor import key pairs.</string> <string name="pubkey_unknown_format">Unknown format</string> <string name="pubkey_change_password">Change Password</string> + <string name="pubkey_list_pick">Pick from /sdcard</string> + <string name="pubkey_import_parse_problem">Problem parsing imported private key</string> + <string name="pubkey_unlock">Unlock key</string> + <string name="pubkey_failed_add">Bad password for key '%s'. Authentication failed.</string> + <string name="pubkey_memory_load">Load into memory</string> + <string name="pubkey_memory_unload">Unload from memory</string> + <string name="pubkey_load_on_start">Load key on start</string> <string name="portforward_list_empty">Tap "Menu" to create\nport forwards.</string> <string name="portforward_edit">Edit port forward</string> @@ -116,6 +121,8 @@ <string name="portforward_menu_add">Add port forward</string> <string name="list_format_error">Use the format 'username@hostname:port'</string> + + <string name="list_menu_pubkeys">Manage Pubkeys</string> <string name="list_menu_sortcolor">Sort by color</string> <string name="list_menu_sortname">Sort by name</string> <string name="list_menu_settings">Settings</string> diff --git a/src/com/jcraft/jcterm/Emulator.java b/src/com/jcraft/jcterm/Emulator.java deleted file mode 100644 index 7723738..0000000 --- a/src/com/jcraft/jcterm/Emulator.java +++ /dev/null @@ -1,416 +0,0 @@ -/* -*-mode:java; c-basic-offset:2; -*- */ -/* JCTerm - * Copyright (C) 2002,2007 ymnk, JCraft,Inc. - * - * Written by: ymnk<ymnk@jcaft.com> - * - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -package com.jcraft.jcterm; - -import java.io.InputStream; -import java.io.IOException; - -public abstract class Emulator{ - Term term=null; - InputStream in=null; - - public Emulator(Term term, InputStream in){ - this.term=term; - this.in=in; - } - - public abstract void start(); - - public abstract byte[] getCodeENTER(); - - public abstract byte[] getCodeUP(); - - public abstract byte[] getCodeDOWN(); - - public abstract byte[] getCodeRIGHT(); - - public abstract byte[] getCodeLEFT(); - - public abstract byte[] getCodeF1(); - - public abstract byte[] getCodeF2(); - - public abstract byte[] getCodeF3(); - - public abstract byte[] getCodeF4(); - - public abstract byte[] getCodeF5(); - - public abstract byte[] getCodeF6(); - - public abstract byte[] getCodeF7(); - - public abstract byte[] getCodeF8(); - - public abstract byte[] getCodeF9(); - - public abstract byte[] getCodeF10(); - - public abstract byte[] getCodeTAB(); - - public void reset(){ - term_width=term.getColumnCount(); - term_height=term.getRowCount(); - char_width=term.getCharWidth(); - char_height=term.getCharHeight(); - region_y1=1; - region_y2=term_height; - } - - byte[] buf=new byte[1024]; - int bufs=0; - int buflen=0; - - byte getChar() throws java.io.IOException{ - if(buflen==0){ - fillBuf(); - } - buflen--; - - // System.out.println("getChar: "+new Character((char)buf[bufs])+"["+Integer.toHexString(buf[bufs]&0xff)+"]"); - - return buf[bufs++]; - } - - void fillBuf() throws java.io.IOException{ - buflen=bufs=0; - buflen=in.read(buf, bufs, buf.length-bufs); - /* - System.out.println("fillBuf: "); - for(int i=0; i<buflen; i++){ - byte b=buf[i]; - System.out.print(new Character((char)b)+"["+Integer.toHexString(b&0xff)+"], "); - } - System.out.println(""); - */ - if(buflen<=0){ - buflen=0; - throw new IOException("fillBuf"); - } - } - - void pushChar(byte foo) throws java.io.IOException{ - //System.out.println("pushChar: "+new Character((char)foo)+"["+Integer.toHexString(foo&0xff)+"]"); - buflen++; - buf[--bufs]=foo; - } - - int getASCII(int len) throws java.io.IOException{ - //System.out.println("bufs="+bufs+", buflen="+buflen+", len="+len); - if(buflen==0){ - fillBuf(); - } - if(len>buflen) - len=buflen; - int foo=len; - byte tmp; - while(len>0){ - tmp=buf[bufs++]; - if(0x20<=tmp&&tmp<=0x7f){ - buflen--; - len--; - continue; - } - bufs--; - break; - } - //System.out.println(" return "+(foo-len)); - return foo-len; - } - - protected int term_width=80; - protected int term_height=24; - - protected int x=0; - protected int y=0; - - protected int char_width; - protected int char_height; - - private int region_y2; - private int region_y1; - - protected int tab=8; - - // Reverse scroll - protected void scroll_reverse(){ - term.draw_cursor(); - term.scroll_area(0, (region_y1-1)*char_height, term_width*char_width, - (region_y2-region_y1)*char_height, 0, char_height); - term.clear_area(x, y-char_height, term_width*char_width, y); - term.redraw(0, 0, term_width*char_width, term_height*char_height - -char_height); - //term.setCursor(x, y); - term.draw_cursor(); - } - - // Normal scroll one line - protected void scroll_forward(){ - term.draw_cursor(); - term.scroll_area(0, (region_y1-1)*char_height, term_width*char_width, - (region_y2-region_y1+1)*char_height, 0, -char_height); - term.clear_area(0, region_y2*char_height-char_height, - term_width*char_width, region_y2*char_height); - term.redraw(0, (region_y1-1)*char_height, term_width*char_width, (region_y2 - -region_y1+1) - *char_height); - term.draw_cursor(); - } - - // Save cursor position - protected void save_cursor(){ - // TODO - //System.out.println("save current cursor position"); - } - - // Enable alternate character set - protected void ena_acs(){ - // TODO - //System.out.println("enable alterate char set"); - } - - protected void exit_alt_charset_mode(){ - // TODO - //System.out.println("end alternate character set (P)"); - } - - protected void enter_alt_charset_mode(){ - // TODO - //System.out.println("start alternate character set (P)"); - } - - protected void reset_2string(){ - // TODO - // rs2(reset string) - } - - protected void exit_attribute_mode(){ - // TODO - //System.out.println("turn off all attributes"); - term.resetAllAttributes(); - } - - protected void exit_standout_mode(){ - term.resetAllAttributes(); - } - - protected void exit_underline_mode(){ - // TODO - } - - protected void enter_bold_mode(){ - term.setBold(); - } - - protected void enter_underline_mode(){ - term.setUnderline(); - } - - protected void enter_reverse_mode(){ - term.setReverse(); - } - - protected void change_scroll_region(int y1, int y2){ - region_y1=y1; - region_y2=y2; - } - - protected void cursor_address(int r, int c){ - term.draw_cursor(); - x=(c-1)*char_width; - y=r*char_height; - //System.out.println("setCourosr: "+x+" "+y); - term.setCursor(x, y); - term.draw_cursor(); - } - - protected void parm_down_cursor(int lines){ - term.draw_cursor(); - y+=(lines)*char_height; - term.setCursor(x, y); - term.draw_cursor(); - } - - protected void parm_left_cursor(int chars){ - term.draw_cursor(); - x-=(chars)*char_width; - term.setCursor(x, y); - term.draw_cursor(); - } - - protected void parm_right_cursor(int chars){ - term.draw_cursor(); - x+=(chars)*char_width; - term.setCursor(x, y); - term.draw_cursor(); - } - - protected void clr_eol(){ - term.draw_cursor(); - term.clear_area(x, y-char_height, term_width*char_width, y); - term.redraw(x, y-char_height, (term_width)*char_width-x, char_height); - term.draw_cursor(); - } - - protected void clr_bol(){ - term.draw_cursor(); - term.clear_area(0, y-char_height, x, y); - term.redraw(0, y-char_height, x, char_height); - term.draw_cursor(); - } - - protected void clr_eos(){ - term.draw_cursor(); - term.clear_area(x, y-char_height, term_width*char_width, term_height - *char_height); - term.redraw(x, y-char_height, term_width*char_width-x, term_height - *char_height-y+char_height); - term.draw_cursor(); - } - - protected void parm_up_cursor(int lines){ - term.draw_cursor(); - // x=0; - // y-=char_height; - y-=(lines)*char_height; - term.setCursor(x, y); - term.draw_cursor(); - } - - protected void bell(){ - term.beep(); - } - - protected void tab(){ - term.draw_cursor(); - x=(((x/char_width)/tab+1)*tab*char_width); - if(x>=term_width*char_width){ - x=0; - y+=char_height; - } - term.setCursor(x, y); - term.draw_cursor(); - } - - protected void carriage_return(){ - term.draw_cursor(); - x=0; - term.setCursor(x, y); - term.draw_cursor(); - } - - protected void cursor_left(){ - term.draw_cursor(); - x-=char_width; - if(x<0){ - y-=char_height; - x=term_width*char_width-char_width; - } - term.setCursor(x, y); - term.draw_cursor(); - } - - protected void cursor_down(){ - term.draw_cursor(); - y+=char_height; - term.setCursor(x, y); - term.draw_cursor(); - - check_region(); - } - - private byte[] b2=new byte[2]; - private byte[] b1=new byte[1]; - - protected void draw_text() throws java.io.IOException{ - - int rx; - int ry; - int w; - int h; - - check_region(); - - rx=x; - ry=y; - - byte b=getChar(); - term.draw_cursor(); - //System.out.print(new Character((char)b)+"["+Integer.toHexString(b&0xff)+"]"); - if((b&0x80)!=0){ - term.clear_area(x, y-char_height, x+char_width*2, y); - b2[0]=b; - b2[1]=getChar(); - term.drawString(new String(b2, 0, 2, "EUC-JP"), x, y); - x+=char_width; - x+=char_width; - w=char_width*2; - h=char_height; - } - else{ - pushChar(b); - int foo=getASCII(term_width-(x/char_width)); - if(foo!=0){ - //System.out.println("foo="+foo+" "+x+", "+(y-char_height)+" "+(x+foo*char_width)+" "+y+" "+buf+" "+bufs+" "+b+" "+buf[bufs-foo]); - //System.out.println("foo="+foo+" ["+new String(buf, bufs-foo, foo)); - term.clear_area(x, y-char_height, x+foo*char_width, y); - term.drawBytes(buf, bufs-foo, foo, x, y); - } - else{ - foo=1; - term.clear_area(x, y-char_height, x+foo*char_width, y); - b1[0]=getChar(); - term.drawBytes(b1, 0, foo, x, y); - //System.out.print("["+Integer.toHexString(bar[0]&0xff)+"]"); - } - x+=(char_width*foo); - w=char_width*foo; - h=char_height; - } - term.redraw(rx, ry-char_height, w, h); - term.setCursor(x, y); - term.draw_cursor(); - } - - private void check_region(){ - if(x>=term_width*char_width){ - //System.out.println("!! "+new Character((char)b)+"["+Integer.toHexString(b&0xff)+"]"); - x=0; - y+=char_height; - //System.out.println("@1: ry="+ry); - } - - if(y>region_y2*char_height){ - while(y>region_y2*char_height){ - y-=char_height; - } - term.draw_cursor(); - term.scroll_area(0, region_y1*char_height, term_width*char_width, - (region_y2-region_y1)*char_height, 0, -char_height); - term.clear_area(0, y-char_height, term_width*char_width, y); - term.redraw(0, 0, term_width*char_width, region_y2*char_height); - term.setCursor(x, y); - term.draw_cursor(); - } - } -} diff --git a/src/com/jcraft/jcterm/EmulatorVT100.java b/src/com/jcraft/jcterm/EmulatorVT100.java deleted file mode 100644 index cf2f96a..0000000 --- a/src/com/jcraft/jcterm/EmulatorVT100.java +++ /dev/null @@ -1,634 +0,0 @@ -/* -*-mode:java; c-basic-offset:2; -*- */ -/* JCTerm - * Copyright (C) 2002,2007 ymnk, JCraft,Inc. - * - * Written by: ymnk<ymnk@jcaft.com> - * - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -package com.jcraft.jcterm; - -import java.io.InputStream; - -public class EmulatorVT100 extends Emulator{ - - public EmulatorVT100(Term term, InputStream in){ - super(term, in); - } - - public void setInputStream(InputStream in){ - this.in=in; - } - - public void setTerm(Term term){ - this.term=term; - } - - public void start(){ - reset(); - - int[] intarg=new int[10]; - int intargi=0; - - x=0; - y=char_height; - - byte b; - - try{ - while(true){ - - b=getChar(); - - //System.out.println("@0: "+ new Character((char)b)+"["+Integer.toHexString(b&0xff)+"]"); - - //System.out.println("@0: ry="+ry); - - /* - outputs from infocmp on RedHat8.0 - # Reconstructed via infocmp from file: /usr/share/terminfo/v/vt100 - vt100|vt100-am|dec vt100 (w/advanced video), - am, msgr, xenl, xon, - cols#80, it#8, lines#24, vt#3, - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, - clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, - cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, - cuf=\E[%p1%dC, cuf1=\E[C$<2>, - cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, - cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, - enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, ka1=\EOq, - ka3=\EOs, kb2=\EOr, kbs=^H, kc1=\EOp, kc3=\EOn, kcub1=\EOD, - kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, kf0=\EOy, - kf1=\EOP, kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt, - kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, rc=\E8, - rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, - rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, - rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, - sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, - sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, - smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, - */ - /* - am terminal has automatic margnins - msgr safe to move while in standout mode - xenl newline ignored after 80 cols (concept) - xon terminal uses xon/xoff handshake - cols number of columns in a line - it tabs initially every # spaces - lines number of lines on screen of page - vt virstual terminal number(CB/unix) - acsc graphics charset pairs, based on vt100 - bel bell - blink turn on blinking - bold turn on bold(extra bright) mode - clear clear screen and home cursor(P*) - cr carriage return (P)(P*) - csr change region to line #1 to line #2(P) - cub move #1 characters to the left (P) - cub1 move left one space - cud down #1 lines (P*) - cud1 down one line - cuf move to #1 characters to the right. - cuf1 non-destructive space (move right one space) - cup move to row #1 columns #2 - cuu up #1 lines (P*) - cuu1 up one line - ed clear to end of screen (P*) - el clear to end of line (P) - el1 Clear to begining of line - enacs enable alterate char set - home home cursor (if no cup) - ht tab to next 8-space hardware tab stop - hts set a tab in every row, current columns - ind scroll text up - ka1 upper left of keypad - ka3 upper right of keypad - kb2 center of keypad - kbs backspace key - kc1 lower left of keypad - kc3 lower right of keypad - kcub1 left-arrow key - kcud1 down-arrow key - kcuf1 right-arrow key - kcuu1 up-arrow key - kent enter/sekd key - kf0 F0 function key - kf1 F1 function key - kf10 F10 function key - kf2 F2 function key - kf3 F3 function key - kf4 F4 function key - kf5 F5 function key - kf6 F6 function key - kf7 F7 function key - kf8 F8 function key - kf9 F9 function key - rc restore cursor to position of last save_cursor - rev turn on reverse video mode - ri scroll text down (P) - rmacs end alternate character set - rmam turn off automatic margins - rmkx leave 'keybroad_transmit' mode - rmso exit standout mode - rmul exit underline mode - rs2 reset string - sc save current cursor position (P) - sgr define video attribute #1-#9(PG9) - sgr0 turn off all attributes - smacs start alternate character set (P) - smam turn on automatic margins - smkx enter 'keyborad_transmit' mode - smso begin standout mode - smul begin underline mode - tbc clear all tab stops(P) - */ - if(b==0){ - continue; - } - - if(b==0x1b){ - b=getChar(); - - //System.out.println("@1: "+ new Character((char)b)+"["+Integer.toHexString(b&0xff)+"]"); - - if(b=='M'){ // sr \EM sr scroll text down (P) - scroll_reverse(); - continue; - } - - if(b=='D'){ // sf - scroll_forward(); - continue; - } - - if(b=='7'){ - save_cursor(); - continue; - } - - if(b=='('){ - b=getChar(); - if(b=='B'){ - b=getChar(); - if(b==0x1b){ - b=getChar(); - if(b==')'){ - b=getChar(); - if(b=='0'){ // enacs - ena_acs(); - continue; - } - else{ - pushChar((byte)'0'); - } - } - else{ - pushChar((byte)')'); - } - } - else{ - pushChar((byte)0x1b); - } - } - else{ - pushChar((byte)'B'); - } - } - - if(b=='>'){ - b=getChar(); // 0x1b - b=getChar(); // '[' - b=getChar(); // '?' - b=getChar(); // '3' - b=getChar(); // 'l' - b=getChar(); // 0x1b - b=getChar(); // '[' - b=getChar(); // '?' - b=getChar(); // '4' - b=getChar(); // 'l' - b=getChar(); // 0x1b - b=getChar(); // '[' - b=getChar(); // '?' - b=getChar(); // '5' - b=getChar(); // 'l' - b=getChar(); // 0x1b - b=getChar(); // '[' - b=getChar(); // '?' - b=getChar(); // '7' - b=getChar(); // 'h' - b=getChar(); // 0x1b - b=getChar(); // '[' - b=getChar(); // '?' - b=getChar(); // '8' - b=getChar(); // 'h' - - reset_2string(); - continue; - } - - if(b!='['){ - System.out.print("@11: "+new Character((char)b)+"[" - +Integer.toHexString(b&0xff)+"]"); - pushChar(b); - continue; - } - - //System.out.print("@2: "+ new Character((char)b)+"["+Integer.toHexString(b&0xff)+"]"); - - intargi=0; - intarg[intargi]=0; - int digit=0; - - while(true){ - b=getChar(); - //System.out.print("#"+new Character((char)b)+"["+Integer.toHexString(b&0xff)+"]"); - if(b==';'){ - if(digit>0){ - intargi++; - intarg[intargi]=0; - digit=0; - } - continue; - } - - if('0'<=b&&b<='9'){ - intarg[intargi]=intarg[intargi]*10+(b-'0'); - digit++; - continue; - } - - pushChar(b); - break; - } - - b=getChar(); - - //System.out.print("@4: "+ new Character((char)b)+"["+Integer.toHexString(b&0xff)+"]"); - - if(b=='m'){ - /* - b=getChar(); - if(b=='$'){ - b=getChar(); // < - b=getChar(); // 2 - b=getChar(); // > - } - else{ - pushChar(b); - } - */ - - if(digit==0&&intargi==0){ - b=getChar(); - if(b==0x0f){ // sgr0 - exit_attribute_mode(); - continue; - } - else{ // rmso, rmul - exit_underline_mode(); - exit_standout_mode(); - pushChar(b); - continue; - } - } - - for(int i=0; i<=intargi; i++){ - Object fg=null; - Object bg=null; - Object tmp=null; - - switch(intarg[i]){ - case 0: // Reset all attributes - exit_standout_mode(); - continue; - case 1: // Bright // bold - enter_bold_mode(); - continue; - case 2: // Dim - break; - case 4: // Underline - enter_underline_mode(); - continue; - case 5: // Blink - case 8: // Hidden - break; - case 7: // reverse - enter_reverse_mode(); - continue; - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - tmp=term.getColor(intarg[i]-30); - if(tmp!=null) - fg=tmp; - break; - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - tmp=term.getColor(intarg[i]-40); - if(tmp!=null) - bg=tmp; - break; - default: - break; - } - if(fg!=null) - term.setForeGround(fg); - if(bg!=null) - term.setBackGround(bg); - } - //System.out.println("fg: "+fg+" bg: "+bg); - continue; - } - - if(b=='r'){ // csr - change_scroll_region(intarg[0], intarg[1]); - //System.out.println("r: "+region_y1+", "+region_y2+", intargi="+intargi); - continue; - } - - if(b=='H'){ // cup - /* - b=getChar(); - if(b!='$'){ // home - pushChar(b); - } - else{ - b=getChar(); // < - b=getChar(); // 5 - b=getChar(); // > - } - */ - - if(digit==0&&intargi==0){ - intarg[0]=intarg[1]=1; - } - - //System.out.println("H: "+region_y1+", "+region_y2+", intargi="+intargi); - cursor_address(intarg[0], intarg[1]); - continue; - } - - if(b=='B'){ // cud - parm_down_cursor(intarg[0]); - continue; - } - - if(b=='D'){ // cub - parm_left_cursor(intarg[0]); - continue; - } - - if(b=='C'){ // cuf - if(digit==0&&intargi==0){ - intarg[0]=1; - } - parm_right_cursor(intarg[0]); - continue; - } - - if(b=='K'){ // el - /* - b=getChar(); // - if(b=='$'){ - b=getChar(); // < - b=getChar(); // 3 - b=getChar(); // > - } - else{ - pushChar(b); - } - */ - - if(digit==0&&intargi==0){ // el - clr_eol(); - } - else{ // el1 - clr_bol(); - } - continue; - } - - if(b=='J'){ - //for(int i=0; i<intargi; i++){ System.out.print(intarg[i]+" ");} - //System.out.println(intarg[0]+"<- intargi="+intargi); - clr_eos(); - continue; - } - - if(b=='A'){ // cuu - if(digit==0&&intargi==0){ - intarg[0]=1; - } - parm_up_cursor(intarg[0]); - continue; - } - - if(b=='?'){ - b=getChar(); - if(b=='1'){ - b=getChar(); - if(b=='l'||b=='h'){ - b=getChar(); - if(b==0x1b){ - b=getChar(); - if(b=='>'|| // rmkx , leave 'keybroad_transmit' mode - b=='='){ // smkx , enter 'keyborad_transmit' mode - // TODO - continue; - } - } - } - else if(b=='h'){ - b=getChar(); - if(b==0x1b){ - b=getChar(); - if(b=='='){ // smkx enter 'keyborad_transmit' mode - continue; - } - } - } - } - else if(b=='7'){ - b=getChar(); - if(b=='h'){ // smam - // TODO - //System.out.println("turn on automatic magins"); - continue; - } - else if(b=='l'){ // rmam - // TODO - //System.out.println("turn off automatic magins"); - continue; - } - pushChar(b); - b='7'; - } - else{ - } - } - - if(b=='h'){ // kh \Eh home key - continue; - } - - System.out.println("unknown "+Integer.toHexString(b&0xff)+" " - +new Character((char)b)+", "+intarg[0]+", "+intarg[1]+", " - +intarg[2]+",intargi="+intargi); - continue; - } - - if(b==0x07){ // bel ^G - bell(); - continue; - } - - if(b==0x09){ // ht(^I) - tab(); - continue; - } - - if(b==0x0f){ // rmacs ^O // end alternate character set (P) - exit_alt_charset_mode(); - continue; - } - - if(b==0x0e){ // smacs ^N // start alternate character set (P) - enter_alt_charset_mode(); - continue; - } - - if(b==0x0d){ - carriage_return(); - continue; - } - - if(b==0x08){ - cursor_left(); - continue; - } - - if(b==0x0a){ // '\n' - //System.out.println("x="+x+",y="+y); - cursor_down(); - //check_region(); - continue; - } - - if(b!=0x0a){ // !'\n' - pushChar(b); - draw_text(); - continue; - } - } - } - catch(Exception e){ - } - } - - private static byte[] ENTER= {(byte)0x0d}; - private static byte[] UP= {(byte)0x1b, (byte)0x4f, (byte)0x41}; - private static byte[] DOWN= {(byte)0x1b, (byte)0x4f, (byte)0x42}; - private static byte[] RIGHT= {(byte)0x1b, (byte)/*0x5b*/0x4f, (byte)0x43}; - private static byte[] LEFT= {(byte)0x1b, (byte)/*0x5b*/0x4f, (byte)0x44}; - private static byte[] F1= {(byte)0x1b, (byte)0x4f, (byte)'P'}; - private static byte[] F2= {(byte)0x1b, (byte)0x4f, (byte)'Q'}; - private static byte[] F3= {(byte)0x1b, (byte)0x4f, (byte)'R'}; - private static byte[] F4= {(byte)0x1b, (byte)0x4f, (byte)'S'}; - private static byte[] F5= {(byte)0x1b, (byte)0x4f, (byte)'t'}; - private static byte[] F6= {(byte)0x1b, (byte)0x4f, (byte)'u'}; - private static byte[] F7= {(byte)0x1b, (byte)0x4f, (byte)'v'}; - private static byte[] F8= {(byte)0x1b, (byte)0x4f, (byte)'I'}; - private static byte[] F9= {(byte)0x1b, (byte)0x4f, (byte)'w'}; - private static byte[] F10= {(byte)0x1b, (byte)0x4f, (byte)'x'}; - private static byte[] tab= {(byte)0x09}; - - public byte[] getCodeENTER(){ - return ENTER; - } - - public byte[] getCodeUP(){ - return UP; - } - - public byte[] getCodeDOWN(){ - return DOWN; - } - - public byte[] getCodeRIGHT(){ - return RIGHT; - } - - public byte[] getCodeLEFT(){ - return LEFT; - } - - public byte[] getCodeF1(){ - return F1; - } - - public byte[] getCodeF2(){ - return F2; - } - - public byte[] getCodeF3(){ - return F3; - } - - public byte[] getCodeF4(){ - return F4; - } - - public byte[] getCodeF5(){ - return F5; - } - - public byte[] getCodeF6(){ - return F6; - } - - public byte[] getCodeF7(){ - return F7; - } - - public byte[] getCodeF8(){ - return F8; - } - - public byte[] getCodeF9(){ - return F9; - } - - public byte[] getCodeF10(){ - return F10; - } - - public byte[] getCodeTAB(){ - return tab; - } -} diff --git a/src/com/jcraft/jcterm/Term.java b/src/com/jcraft/jcterm/Term.java deleted file mode 100644 index c574509..0000000 --- a/src/com/jcraft/jcterm/Term.java +++ /dev/null @@ -1,80 +0,0 @@ -/* -*-mode:java; c-basic-offset:2; -*- */ -/* JCTerm - * Copyright (C) 2002,2007 ymnk, JCraft,Inc. - * - * Written by: ymnk<ymnk@jcaft.com> - * - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License - * as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -package com.jcraft.jcterm; - -import java.io.InputStream; -import java.io.OutputStream; - -public interface Term{ - - void start(InputStream in, OutputStream out); - - int getRowCount(); - - int getColumnCount(); - - int getCharWidth(); - - int getCharHeight(); - - void setCursor(int x, int y); - - void clear(); - - void draw_cursor(); - - void redraw(int x, int y, int width, int height); - - //void redraw(); - void clear_area(int x1, int y1, int x2, int y2); - - void scroll_area(int x, int y, int w, int h, int dx, int dy); - - void drawBytes(byte[] buf, int s, int len, int x, int y); - - void drawString(String str, int x, int y); - - void beep(); - - void setDefaultForeGround(Object foreground); - - void setDefaultBackGround(Object background); - - void setForeGround(Object foreground); - - void setBackGround(Object background); - - void setBold(); - - void setUnderline(); - - void setReverse(); - - void resetAllAttributes(); - - int getTermWidth(); - - int getTermHeight(); - - Object getColor(int index); -} diff --git a/src/org/connectbot/HostListActivity.java b/src/org/connectbot/HostListActivity.java index f931111..805c7b1 100644 --- a/src/org/connectbot/HostListActivity.java +++ b/src/org/connectbot/HostListActivity.java @@ -355,7 +355,7 @@ public class HostListActivity extends ListActivity { } }); - MenuItem keys = menu.add("Manage keys"); + MenuItem keys = menu.add(R.string.list_menu_pubkeys); keys.setIcon(android.R.drawable.ic_lock_lock); keys.setIntent(new Intent(HostListActivity.this, PubkeyListActivity.class)); diff --git a/src/org/connectbot/PubkeyListActivity.java b/src/org/connectbot/PubkeyListActivity.java index 9fd7e86..332d452 100644 --- a/src/org/connectbot/PubkeyListActivity.java +++ b/src/org/connectbot/PubkeyListActivity.java @@ -236,7 +236,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener { // prompt user to select any file from the sdcard root new AlertDialog.Builder(PubkeyListActivity.this) - .setTitle("Pick from /sdcard") + .setTitle(R.string.pubkey_list_pick) .setItems(namesList, new OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { // find the exact file selected @@ -256,7 +256,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener { } catch(Exception e) { Log.e(TAG, "Problem parsing imported private key", e); - Toast.makeText(PubkeyListActivity.this, "Problem parsing imported private key", Toast.LENGTH_LONG).show(); + Toast.makeText(PubkeyListActivity.this, R.string.pubkey_import_parse_problem, Toast.LENGTH_LONG).show(); } } }) @@ -278,18 +278,15 @@ public class PubkeyListActivity extends ListActivity implements EventListener { new AlertDialog.Builder(PubkeyListActivity.this) .setView(view) - .setPositiveButton("Unlock key", new DialogInterface.OnClickListener() { + .setPositiveButton(R.string.pubkey_unlock, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { handleAddKey(c, passwordField.getText().toString()); } }) - .setNegativeButton("Cancel", null).create().show(); + .setNegativeButton(android.R.string.cancel, null).create().show(); } else { handleAddKey(c, null); - } - - } protected void handleAddKey(Cursor c, String password) { @@ -302,7 +299,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener { try { trileadKey = PEMDecoder.decode(new String(raw).toCharArray(), password); } catch(Exception e) { - String message = String.format("Bad password for key '%s'. Authentication failed.", keyNickname); + String message = getResources().getString(R.string.pubkey_failed_add, keyNickname); Log.e(TAG, message, e); Toast.makeText(PubkeyListActivity.this, message, Toast.LENGTH_LONG); } @@ -315,7 +312,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener { privKey = PubkeyUtils.decodePrivate(c.getBlob(COL_PRIVATE), c.getString(COL_TYPE), password); pubKey = PubkeyUtils.decodePublic(c.getBlob(COL_PUBLIC), c.getString(COL_TYPE)); } catch (Exception e) { - String message = String.format("Bad password for key '%s'. Authentication failed.", keyNickname); + String message = getResources().getString(R.string.pubkey_failed_add, keyNickname); Log.e(TAG, message, e); Toast.makeText(PubkeyListActivity.this, message, Toast.LENGTH_LONG); } @@ -363,7 +360,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener { final boolean loaded = bound.isKeyLoaded(nickname); final boolean onstart = (cursor.getInt(COL_STARTUP) == 1); - MenuItem load = menu.add(loaded ? "Unload from memory" : "Load into memory"); + MenuItem load = menu.add(loaded ? R.string.pubkey_memory_unload : R.string.pubkey_memory_load); load.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { if(loaded) { @@ -377,7 +374,7 @@ public class PubkeyListActivity extends ListActivity implements EventListener { } }); - onstartToggle = menu.add("Load key on start"); + onstartToggle = menu.add(R.string.pubkey_load_on_start); onstartToggle.setEnabled((encrypted == 0)); onstartToggle.setCheckable(true); onstartToggle.setChecked(onstart); |