diff options
author | Alex Fong <alexfongg@gmail.com> | 2016-04-17 13:33:41 +0800 |
---|---|---|
committer | Alex Fong <alexfongg@gmail.com> | 2016-05-05 07:57:20 +0800 |
commit | 9d35dcb0e924a7f8afcfcaa86752efb40799a456 (patch) | |
tree | 714afde7c89352bed3757470e8d59272052dae9b /OpenKeychain/src | |
parent | f43edcdd7afb1692fab1239c54c3cd535506c9e1 (diff) | |
download | open-keychain-9d35dcb0e924a7f8afcfcaa86752efb40799a456.tar.gz open-keychain-9d35dcb0e924a7f8afcfcaa86752efb40799a456.tar.bz2 open-keychain-9d35dcb0e924a7f8afcfcaa86752efb40799a456.zip |
Added warning dialog for importing keys
Diffstat (limited to 'OpenKeychain/src')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java | 27 | ||||
-rw-r--r-- | OpenKeychain/src/main/res/values/strings.xml | 2 |
2 files changed, 29 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index 7d2d30c35..6b3e12761 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -18,6 +18,7 @@ package org.sufficientlysecure.keychain.ui; import android.app.Activity; +import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; @@ -38,6 +39,7 @@ import org.sufficientlysecure.keychain.operations.results.ImportKeyResult; import org.sufficientlysecure.keychain.service.ImportKeyringParcel; import org.sufficientlysecure.keychain.ui.base.BaseActivity; import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper; +import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.util.Log; @@ -342,6 +344,31 @@ public class ImportKeysActivity extends BaseActivity return; } + showWarningDialog(); + } + + private void showWarningDialog() { + CustomAlertDialogBuilder warningDialog = new CustomAlertDialogBuilder(this); + warningDialog.setTitle(R.string.import_warning_title). + setMessage(R.string.import_warning).setCancelable(true); + warningDialog.setPositiveButton(R.string.btn_import, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + executeImport(); + } + }); + warningDialog.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + } + }); + warningDialog.show(); + } + + private void executeImport() { + FragmentManager fragMan = getSupportFragmentManager(); + ImportKeysListFragment keyListFragment = (ImportKeysListFragment) fragMan.findFragmentByTag(TAG_FRAG_LIST); + mOperationHelper = new CryptoOperationHelper<>( 1, this, this, R.string.progress_importing ); diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 2a44307f8..b15bd5775 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -526,6 +526,8 @@ <string name="import_qr_code_too_short_fingerprint">"Fingerprint is too short!"</string> <string name="import_qr_code_button">"Scan QR Code"</string> <string name="import_qr_code_text">"Place your camera over the QR Code!"</string> + <string name="import_warning_title">"Warning"</string> + <string name="import_warning">"Imported keys will overwrite existing keys that have the same IDs!"</string> <!-- Import from URL --> <string name="import_url_warn_no_search_parameter">"No search query defined. You can still manually search on this keyserver."</string> |