diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/org/connectbot/ConsoleActivity.java | 17 | ||||
-rw-r--r-- | src/org/connectbot/PubkeyListActivity.java | 6 | ||||
-rw-r--r-- | src/org/connectbot/service/TerminalBridge.java | 7 | ||||
-rw-r--r-- | src/org/connectbot/util/PubkeyDatabase.java | 2 | ||||
-rw-r--r-- | src/org/connectbot/util/UpdateHelper.java | 36 |
5 files changed, 52 insertions, 16 deletions
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java index 27afffa..b1cf8b5 100644 --- a/src/org/connectbot/ConsoleActivity.java +++ b/src/org/connectbot/ConsoleActivity.java @@ -500,16 +500,17 @@ public class ConsoleActivity extends Activity { return false; case MotionEvent.ACTION_UP: // copy selected area to clipboard - int top = Math.min(copySource.top, copySource.bottom), - bottom = Math.max(copySource.top, copySource.bottom), + int adjust = 0; //copySource.bridge.buffer.windowBase - copySource.bridge.buffer.screenBase; + int top = Math.min(copySource.top, copySource.bottom) + adjust, + bottom = Math.max(copySource.top, copySource.bottom) + adjust, left = Math.min(copySource.left, copySource.right), right = Math.max(copySource.left, copySource.right); // perform actual buffer copy int size = (right - left) * (bottom - top); StringBuffer buffer = new StringBuffer(size); - for(int y = top; y <= bottom; y++) { - for(int x = left; x <= right; x++) { + for(int y = top; y < bottom; y++) { + for(int x = left; x < right; x++) { // only copy printable chars char c = copySource.bridge.buffer.getChar(x, y); if(c < 32 || c >= 127) c = ' '; @@ -524,6 +525,7 @@ public class ConsoleActivity extends Activity { case MotionEvent.ACTION_CANCEL: // make sure we clear any highlighted area copySource.resetSelected(); + copySource.invalidate(); copying = false; return true; } @@ -675,7 +677,7 @@ public class ConsoleActivity extends Activity { resize = menu.add(R.string.console_menu_resize); resize.setIcon(android.R.drawable.ic_menu_crop); - resize.setEnabled(activeTerminal); + resize.setEnabled(activeTerminal && authenticated); resize.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { final TerminalView terminal = (TerminalView)view; @@ -690,7 +692,7 @@ public class ConsoleActivity extends Activity { terminal.forceSize(width, height); } - }).create().show(); + }).setNegativeButton(R.string.button_cancel, null).create().show(); return true; } @@ -743,7 +745,8 @@ public class ConsoleActivity extends Activity { copy.setEnabled(activeTerminal && authenticated); paste.setEnabled(clipboard.hasText() && activeTerminal && authenticated); tunnel.setEnabled(activeTerminal && authenticated); - + resize.setEnabled(activeTerminal && authenticated); + return true; } diff --git a/src/org/connectbot/PubkeyListActivity.java b/src/org/connectbot/PubkeyListActivity.java index b7fd9ae..14c75f5 100644 --- a/src/org/connectbot/PubkeyListActivity.java +++ b/src/org/connectbot/PubkeyListActivity.java @@ -438,6 +438,12 @@ public class PubkeyListActivity extends ListActivity implements EventListener { .setMessage(getString(R.string.delete_message, nickname)) .setPositiveButton(R.string.delete_pos, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { + + // dont forget to remove from in-memory + if(loaded) + bound.removeKey(nickname); + + // delete from backend database and update gui pubkeydb.deletePubkey(id); updateHandler.sendEmptyMessage(-1); } diff --git a/src/org/connectbot/service/TerminalBridge.java b/src/org/connectbot/service/TerminalBridge.java index 48ad9d9..bb1ae20 100644 --- a/src/org/connectbot/service/TerminalBridge.java +++ b/src/org/connectbot/service/TerminalBridge.java @@ -348,7 +348,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal } protected boolean tryPublicKey(String username, String keyNickname, Object trileadKey) throws IOException { - outputLine(String.format("Attempting 'publickey' with key '%s' [%s]...", keyNickname, trileadKey.toString())); + //outputLine(String.format("Attempting 'publickey' with key '%s' [%s]...", keyNickname, trileadKey.toString())); boolean success = connection.authenticateWithPublicKey(username, trileadKey); if(!success) outputLine(String.format("Authentication method 'publickey' with key '%s' failed", keyNickname)); @@ -376,11 +376,10 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal // if explicit pubkey defined for this host, then prompt for password as needed // otherwise just try all in-memory keys held in terminalmanager - outputLine("Attempting 'publickey' authentication"); if (pubkeyId == HostDatabase.PUBKEYID_ANY) { // try each of the in-memory keys - outputLine("Trying any loaded SSH keys"); + outputLine("Attempting 'publickey' authentication with any in-memory SSH keys"); for(String nickname : manager.loadedPubkeys.keySet()) { Object trileadKey = manager.loadedPubkeys.get(nickname); if(this.tryPublicKey(this.username, nickname, trileadKey)) { @@ -390,7 +389,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal } } else { - outputLine("Host settings requested a specific SSH key"); + outputLine("Attempting 'publickey' authentication with a specific SSH key"); // use a specific key for this host, as requested Cursor cursor = manager.pubkeydb.getPubkey(pubkeyId); if (cursor.moveToFirst()) diff --git a/src/org/connectbot/util/PubkeyDatabase.java b/src/org/connectbot/util/PubkeyDatabase.java index d3fa3d2..fa838e1 100644 --- a/src/org/connectbot/util/PubkeyDatabase.java +++ b/src/org/connectbot/util/PubkeyDatabase.java @@ -148,7 +148,7 @@ public class PubkeyDatabase extends SQLiteOpenHelper { return db.query(TABLE_PUBKEYS, new String[] { "_id", FIELD_PUBKEY_NICKNAME, FIELD_PUBKEY_TYPE, FIELD_PUBKEY_PRIVATE, FIELD_PUBKEY_PUBLIC, FIELD_PUBKEY_ENCRYPTED, FIELD_PUBKEY_STARTUP }, - FIELD_PUBKEY_STARTUP + " = 1", null, null, null, null); + FIELD_PUBKEY_STARTUP + " = 1 AND " + FIELD_PUBKEY_ENCRYPTED + " = 0", null, null, null, null); } diff --git a/src/org/connectbot/util/UpdateHelper.java b/src/org/connectbot/util/UpdateHelper.java index fc8233e..973e087 100644 --- a/src/org/connectbot/util/UpdateHelper.java +++ b/src/org/connectbot/util/UpdateHelper.java @@ -30,11 +30,15 @@ import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.content.res.Resources; import android.net.Uri; import android.os.Handler; import android.os.Message; +import android.preference.PreferenceManager; import android.util.Log; /** @@ -93,11 +97,35 @@ public class UpdateHelper implements Runnable { } - // place version information in user-agent string to be used later - this.userAgent = String.format("%s/%s (%d)", packageName, versionName, versionCode); + // decide if we really need to check for update + Resources res = context.getResources(); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + + String frequency = prefs.getString(res.getString(R.string.pref_update), res.getString(R.string.list_update_daily)); + long lastChecked = prefs.getLong(res.getString(R.string.pref_lastchecked), 0); + long now = (System.currentTimeMillis() / 1000); + long passed = now - lastChecked; - // spawn thread to check for update - new Thread(this).start(); + boolean shouldCheck = false; + if(frequency.equals(res.getString(R.string.list_update_daily))) { + shouldCheck = (passed > 60 * 60 * 24); + } else if(frequency.equals(res.getString(R.string.list_update_weekly))) { + shouldCheck = (passed > 60 * 60 * 24 * 7); + } + + // place version information in user-agent string to be used later + this.userAgent = String.format("%s/%s (%d, freq=%s)", packageName, versionName, versionCode, frequency); + + if(shouldCheck) { + // spawn thread to check for update + new Thread(this).start(); + + // update our last-checked time + Editor editor = prefs.edit(); + editor.putLong(res.getString(R.string.pref_lastchecked), now); + editor.commit(); + + } } |