Permalink
Browse files

Make some SSH parameters (globally) configurable

  • Loading branch information...
1 parent edf650a commit 3f45f6279390543a507af2bdf3295e38275e40ef @russellhaering russellhaering committed Dec 8, 2010
Showing with 20 additions and 1 deletion.
  1. +14 −0 res/xml/preferences.xml
  2. +6 −1 src/com/cloudkick/NodeViewActivity.java
View
@@ -28,4 +28,18 @@
android:title="OAuth Secret"
android:key="editSecret" />
</PreferenceCategory>
+ <PreferenceCategory android:title="SSH">
+ <EditTextPreference
+ android:name="User Name"
+ android:summary="The user name to use with SSH"
+ android:title="User Name"
+ android:key="sshUser"
+ android:defaultValue="root" />
+ <EditTextPreference
+ android:name="Port"
+ android:summary="The port to SSH to"
+ android:title="Port"
+ android:numeric="integer"
+ android:defaultValue="22" />
+ </PreferenceCategory>
</PreferenceScreen>
@@ -29,11 +29,13 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
+import android.preference.PreferenceManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -111,7 +113,10 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.do_connectbot:
- String uri = "ssh://root@" + node.ipAddress + ":22/#root";
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ String user = prefs.getString("sshUser", "root");
+ Integer port = new Integer(prefs.getString("sshPort", "22"));
+ String uri = "ssh://" + user + "@" + node.ipAddress + ":" + port + "/#" + user;
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
try {
startActivity(i);

0 comments on commit 3f45f62

Please sign in to comment.