diff options
author | mar-v-in <github@rvin.mooo.com> | 2014-06-22 16:31:28 +0200 |
---|---|---|
committer | mar-v-in <github@rvin.mooo.com> | 2014-06-22 16:31:28 +0200 |
commit | 79fb23b095fba273d77066204ee44d2b8d1edf8d (patch) | |
tree | 69aa452c547cb6bc6b882abf6d8e22836bfb2303 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java | |
parent | 313e571a61e22a7152e32366d747114233d25b6e (diff) | |
download | open-keychain-79fb23b095fba273d77066204ee44d2b8d1edf8d.tar.gz open-keychain-79fb23b095fba273d77066204ee44d2b8d1edf8d.tar.bz2 open-keychain-79fb23b095fba273d77066204ee44d2b8d1edf8d.zip |
Improve file more, Part 1
- Use Uris where it makes sense, Use File class to clarify it's a file (and not whatever else a string could be)
- Show sdcard in side menu in storage API #665
- Propose filename with gpg ending when storing it using the storage API #665
- Don't show output dialog on Android 4.4 #665
- Only show filename on Android < 4.4 #665
TODO:
- File deletion for Android < 4.4
- Testing (especially with Android < 4.4)
- Batch-encryption
- UI
- Temporary content provider (see #665 discussion)
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java index cae6cf043..f9111d885 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java @@ -18,43 +18,23 @@ package org.sufficientlysecure.keychain.ui.dialog; import android.app.Dialog; -import android.app.ProgressDialog; import android.content.DialogInterface; -import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.os.Message; -import android.os.Messenger; import android.provider.DocumentsContract; import android.support.v4.app.DialogFragment; import android.support.v4.app.FragmentActivity; -import android.widget.Toast; +import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.service.KeychainIntentService; -import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; +import org.sufficientlysecure.keychain.helper.FileHelper; public class DeleteFileDialogFragment extends DialogFragment { - private static final String ARG_DELETE_FILE = "delete_file"; private static final String ARG_DELETE_URI = "delete_uri"; /** * Creates new instance of this delete file dialog fragment */ - public static DeleteFileDialogFragment newInstance(String deleteFile) { - DeleteFileDialogFragment frag = new DeleteFileDialogFragment(); - Bundle args = new Bundle(); - - args.putString(ARG_DELETE_FILE, deleteFile); - - frag.setArguments(args); - - return frag; - } - - /** - * Creates new instance of this delete file dialog fragment - */ public static DeleteFileDialogFragment newInstance(Uri deleteUri) { DeleteFileDialogFragment frag = new DeleteFileDialogFragment(); Bundle args = new Bundle(); @@ -74,14 +54,14 @@ public class DeleteFileDialogFragment extends DialogFragment { final FragmentActivity activity = getActivity(); final Uri deleteUri = getArguments().containsKey(ARG_DELETE_URI) ? getArguments().<Uri>getParcelable(ARG_DELETE_URI) : null; - final String deleteFile = getArguments().getString(ARG_DELETE_FILE); + String deleteFilename = FileHelper.getFilename(getActivity(), deleteUri); CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(activity); alert.setIcon(R.drawable.ic_dialog_alert_holo_light); alert.setTitle(R.string.warning); - alert.setMessage(this.getString(R.string.file_delete_confirmation, deleteFile)); + alert.setMessage(this.getString(R.string.file_delete_confirmation, deleteFilename)); alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @@ -89,12 +69,14 @@ public class DeleteFileDialogFragment extends DialogFragment { public void onClick(DialogInterface dialog, int id) { dismiss(); - if (deleteUri != null) { + if (Constants.KITKAT) { // We can not securely delete Documents, so just use usual delete on them - DocumentsContract.deleteDocument(getActivity().getContentResolver(), deleteUri); - return; + if (DocumentsContract.deleteDocument(getActivity().getContentResolver(), deleteUri)) return; } + // TODO!!! We can't delete files from Uri without trying to find it's real path + + /* // Send all information needed to service to edit key in other thread Intent intent = new Intent(activity, KeychainIntentService.class); @@ -102,7 +84,6 @@ public class DeleteFileDialogFragment extends DialogFragment { Bundle data = new Bundle(); intent.setAction(KeychainIntentService.ACTION_DELETE_FILE_SECURELY); - data.putString(KeychainIntentService.DELETE_FILE, deleteFile); intent.putExtra(KeychainIntentService.EXTRA_DATA, data); ProgressDialogFragment deletingDialog = ProgressDialogFragment.newInstance( @@ -134,6 +115,7 @@ public class DeleteFileDialogFragment extends DialogFragment { // start service with intent activity.startService(intent); + */ } }); alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { |