diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-11-15 05:41:14 +0100 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-11-15 23:25:39 +0100 |
commit | c4599798f9807c0cc692e1b08355892136ab317c (patch) | |
tree | fdfe6498c700a91c8a41bcd4a2f30260b63a3c1a /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui | |
parent | bb79b44e7f9ecd7f0c8d646df14ab63091b9b85a (diff) | |
download | open-keychain-c4599798f9807c0cc692e1b08355892136ab317c.tar.gz open-keychain-c4599798f9807c0cc692e1b08355892136ab317c.tar.bz2 open-keychain-c4599798f9807c0cc692e1b08355892136ab317c.zip |
fix delete file securely method and use for delete original file
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java index c45a641e0..000de6e40 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java @@ -800,33 +800,18 @@ public class DecryptListFragment // we can only ever delete a file once, if we got this far either it's gone or it will never work mCanDelete = false; - if ("file".equals(uri.getScheme())) { - File file = new File(uri.getPath()); - if (file.delete()) { + try { + int deleted = FileHelper.deleteFileSecurely(activity, uri); + if (deleted > 0) { Notify.create(activity, R.string.file_delete_ok, Style.OK).show(); } else { Notify.create(activity, R.string.file_delete_none, Style.WARN).show(); } - return; + } catch (Exception e) { + Log.e(Constants.TAG, "exception deleting file", e); + Notify.create(activity, R.string.file_delete_exception, Style.ERROR).show(); } - if ("content".equals(uri.getScheme())) { - try { - int deleted = activity.getContentResolver().delete(uri, null, null); - if (deleted > 0) { - Notify.create(activity, R.string.file_delete_ok, Style.OK).show(); - } else { - Notify.create(activity, R.string.file_delete_none, Style.WARN).show(); - } - } catch (Exception e) { - Log.e(Constants.TAG, "exception deleting file", e); - Notify.create(activity, R.string.file_delete_exception, Style.ERROR).show(); - } - return; - } - - Notify.create(activity, R.string.file_delete_exception, Style.ERROR).show(); - } public class DecryptFilesAdapter extends RecyclerView.Adapter<ViewHolder> { |