aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeapo <mohamed@zenadi.com>2014-10-30 22:32:19 +0100
committerzeapo <mohamed@zenadi.com>2014-10-30 22:32:19 +0100
commit64481bcb45892adac0786eab0674db7261dccf21 (patch)
treeea0e5bef8344287766ab66ac8d931c692ea14eee
parent005f0b6b7bc7c8971a28937e542a0adff33d8353 (diff)
fixes an issue where the password was always added on the root
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java11
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordStore.java9
2 files changed, 18 insertions, 2 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
index fa97fcc4..2262b7d3 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
@@ -186,6 +186,17 @@ public class PasswordFragment extends Fragment{
pathStack.pop();
}
+ /**
+ * gets the current directory
+ * @return the current directory
+ */
+ public File getCurrentDir() {
+ if (pathStack.isEmpty())
+ return PasswordRepository.getWorkTree();
+ else
+ return pathStack.peek();
+ }
+
public boolean isNotEmpty() {
return !passListStack.isEmpty();
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
index 62bf3d4f..f479347f 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
@@ -359,7 +359,7 @@ public class PasswordStore extends ActionBarActivity {
try {
Intent intent = new Intent(this, PgpHandler.class);
intent.putExtra("PGP-ID", FileUtils.readFileToString(PasswordRepository.getFile("/.gpg-id")));
- intent.putExtra("FILE_PATH", this.currentDir.getAbsolutePath());
+ intent.putExtra("FILE_PATH", getCurrentDir().getAbsolutePath());
intent.putExtra("Operation", "ENCRYPT");
startActivityForResult(intent, PgpHandler.REQUEST_CODE_ENCRYPT);
} catch (Exception e) {
@@ -429,7 +429,12 @@ public class PasswordStore extends ActionBarActivity {
}
private File getCurrentDir() {
- return new File(((PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList")).getArguments().getString("Path"));
+ PasswordFragment plist;
+ if (null !=
+ (plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) {
+ return plist.getCurrentDir();
+ }
+ return null;
}
protected void onActivityResult(int requestCode, int resultCode,