Skip to content

Commit

Permalink
Implement the file explorer dialog to select the SSH Public Key file …
Browse files Browse the repository at this point in the history
…for the SSH/SCP File Synchronizer
  • Loading branch information
matburt committed Dec 8, 2012
1 parent 85375f6 commit b84e8e6
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
22 changes: 21 additions & 1 deletion res/layout/wizard_ssh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@
android:inputType="textPassword"
android:password="true"
android:singleLine="true"/>
<TextView
android:paddingTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ssh_inform_choose_pub_file"
android:textSize="20dp"/>
<Button
android:layout_marginTop="20dp"
android:id="@+id/wizard_ssh_choose_pub_file"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ssh_choose_file_button"
android:textSize="20dp"/>
<TextView
android:id="@+id/wizard_ssh_pub_file_actual"
android:paddingTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="20dp"/>
<TextView
android:paddingTop="10dp"
android:layout_width="wrap_content"
Expand Down Expand Up @@ -103,4 +123,4 @@
/>
<include layout="@layout/wizard_navbar_last"/>
</LinearLayout>
</ScrollView>
</ScrollView>
4 changes: 3 additions & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
<string name="log_in_to_ubuntuone">Log in to Ubuntu One</string>
<string name="log_in_to_webdav">Log in to your WebDAV server</string>
<string name="log_in_to_ssh">Log in to your SSH server</string>
<string name="ssh_inform_choose_pub_file">OR select a file containing your public key (requires a file explorer program to be installed)</string>
<string name="ssh_choose_file_button">Select your public key file</string>
<string name="null_sync_description">This is a capture only synchronizer. It will not attempt to synchronize to any source.</string>
<string name="dropbox_login_info">This will redirect you to a login form. After logging in it will return you to this screen to continue.</string>
<string name="url">URL</string>
Expand Down Expand Up @@ -194,4 +196,4 @@
<string name="title_index_file_path">Full local path to index.org</string>
<string name="summary_web_url">Full URL path to your index.org file</string>

</resources>
</resources>
25 changes: 25 additions & 0 deletions src/com/matburt/mobileorg/Settings/WizardActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
Expand Down Expand Up @@ -124,6 +125,8 @@ public void handleMessage(Message msg)
EditText sshPath;
EditText sshHost;
EditText sshPort;
TextView sshPubFileActual;
Button sshPubFileSelect;
Button sshLoginButton;
//page 3 variables
ListView folderList;
Expand Down Expand Up @@ -247,6 +250,16 @@ void createNullConfig() {
wizard.setDoneButtonOnClickListener(new FinishWizardButtonListener());
wizard.enablePage(1);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if(resultCode==RESULT_OK){
String filePath = data.getData().getPath();
sshPubFileActual.setText(filePath);
}
}
}

void createSSHConfig() {
wizard.removePagesAfter(1);
Expand All @@ -256,6 +269,18 @@ void createSSHConfig() {
sshPath = (EditText) wizard.findViewById(R.id.wizard_ssh_path);
sshHost = (EditText) wizard.findViewById(R.id.wizard_ssh_host);
sshPort = (EditText) wizard.findViewById(R.id.wizard_ssh_port);
sshPubFileActual = (TextView) wizard.findViewById(R.id.wizard_ssh_pub_file_actual);
sshPubFileSelect = (Button)wizard.findViewById(R.id.wizard_ssh_choose_pub_file);
sshPubFileSelect.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
startActivityForResult(intent,1);
} catch (Exception e) { }
}
});
webdavLoginButton = (Button) wizard.findViewById(R.id.wizard_ssh_login_button);
doneButton = (Button) findViewById(R.id.wizard_done_button);
webdavLoginButton.setOnClickListener(new OnClickListener() {
Expand Down

0 comments on commit b84e8e6

Please sign in to comment.