aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2015-10-15 21:48:01 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2015-10-15 21:48:01 +0200
commit53680b621320512b44e961f0453043a31c40dfee (patch)
treefeff220dd5a59f2e89e4e89e8a7488e25bc767da /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util
parent52c6d8f8e03ab0047f5e8ed6f46273ac24a87205 (diff)
downloadopen-keychain-53680b621320512b44e961f0453043a31c40dfee.tar.gz
open-keychain-53680b621320512b44e961f0453043a31c40dfee.tar.bz2
open-keychain-53680b621320512b44e961f0453043a31c40dfee.zip
Cleanup, fix advanced sharing
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ExportHelper.java125
1 files changed, 0 insertions, 125 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ExportHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ExportHelper.java
deleted file mode 100644
index cc90c173f..000000000
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ExportHelper.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package org.sufficientlysecure.keychain.util;
-
-
-import java.io.File;
-
-import android.content.Intent;
-import android.net.Uri;
-import android.support.v4.app.FragmentActivity;
-
-import org.sufficientlysecure.keychain.Constants;
-import org.sufficientlysecure.keychain.R;
-import org.sufficientlysecure.keychain.operations.results.ExportResult;
-import org.sufficientlysecure.keychain.service.ExportKeyringParcel;
-import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
-
-public class ExportHelper
- implements CryptoOperationHelper.Callback <ExportKeyringParcel, ExportResult> {
- protected File mExportFile;
-
- FragmentActivity mActivity;
-
- private boolean mExportSecret;
- private long[] mMasterKeyIds;
-
- public ExportHelper(FragmentActivity activity) {
- super();
- this.mActivity = activity;
- }
-
- /** Show dialog where to export keys */
- public void showExportKeysDialog(final Long masterKeyId, final File exportFile,
- final boolean exportSecret) {
- mExportFile = exportFile;
-
- String title;
- if (masterKeyId == null) {
- // export all keys
- title = mActivity.getString(R.string.title_export_keys);
- } else {
- // export only key specified at data uri
- title = mActivity.getString(R.string.title_export_key);
- }
-
- String message;
- if (exportSecret) {
- message = mActivity.getString(masterKeyId == null
- ? R.string.specify_backup_dest_secret
- : R.string.specify_backup_dest_secret_single);
- } else {
- message = mActivity.getString(masterKeyId == null
- ? R.string.specify_backup_dest
- : R.string.specify_backup_dest_single);
- }
-
- // TODO: for valodim
-// FileHelper.saveDocumentDialog(new FileHelper.FileDialogCallback() {
-// @Override
-// public void onFileSelected(File file, boolean checked) {
-// mExportFile = file;
-// exportKeys(masterKeyId == null ? null : new long[] { masterKeyId }, exportSecret);
-// }
-// }, mActivity.getSupportFragmentManager(), title, message, exportFile, null);
- }
-
- // TODO: If ExportHelper requires pending data (see CryptoOPerationHelper), activities using
- // TODO: this class should be able to call mExportOpHelper.handleActivity
-
- /**
- * Export keys
- */
- public void exportKeys(long[] masterKeyIds, boolean exportSecret) {
- Log.d(Constants.TAG, "exportKeys started");
- mExportSecret = exportSecret;
- mMasterKeyIds = masterKeyIds; // if masterKeyIds is null it means export all
-
- CryptoOperationHelper<ExportKeyringParcel, ExportResult> exportOpHelper =
- new CryptoOperationHelper<>(1, mActivity, this, R.string.progress_exporting);
- exportOpHelper.cryptoOperation();
- }
-
- @Override
- public ExportKeyringParcel createOperationInput() {
- return new ExportKeyringParcel(null, mMasterKeyIds, mExportSecret, Uri.fromFile(mExportFile));
- }
-
- @Override
- final public void onCryptoOperationSuccess(ExportResult result) {
- // trigger scan of the created 'media' file so it shows up on MTP
- // http://stackoverflow.com/questions/13737261/nexus-4-not-showing-files-via-mtp
- mActivity.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(mExportFile)));
- result.createNotify(mActivity).show();
- }
-
- @Override
- public void onCryptoOperationCancelled() {
-
- }
-
- @Override
- public void onCryptoOperationError(ExportResult result) {
- result.createNotify(mActivity).show();
- }
-
- @Override
- public boolean onCryptoSetProgress(String msg, int progress, int max) {
- return false;
- }
-}