diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-10-04 23:16:58 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-10-04 23:18:07 +0200 |
commit | 015291eb61e39987cad42c0f9b0f98d24b6dbf99 (patch) | |
tree | 0d38efc41b462d886ad68e898aff0b68e2c34b7c /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java | |
parent | bad8aeea781bad8db11d8d2df9cfc7ca579f6adc (diff) | |
parent | fbf993e6211d03308d62a3edf270f9d5a8783fb2 (diff) | |
download | open-keychain-015291eb61e39987cad42c0f9b0f98d24b6dbf99.tar.gz open-keychain-015291eb61e39987cad42c0f9b0f98d24b6dbf99.tar.bz2 open-keychain-015291eb61e39987cad42c0f9b0f98d24b6dbf99.zip |
Merge branch 'jacobshack-certify' of github.com:open-keychain/open-keychain into jacobshack-certify
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java index 16ebd6aca..ad50ecd3d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java @@ -31,6 +31,7 @@ import android.widget.ListView; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.service.results.GetKeyResult; import org.sufficientlysecure.keychain.util.ParcelableFileCache.IteratorWithSize; import org.sufficientlysecure.keychain.util.Preferences; import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry; @@ -285,48 +286,60 @@ public class ImportKeysListFragment extends ListFragment implements setListShownNoAnimation(true); } - Exception error = data.getError(); - // free old cached key data mCachedKeyData = null; + GetKeyResult getKeyResult = (GetKeyResult) data.getOperationResult(); switch (loader.getId()) { case LOADER_ID_BYTES: - if (error == null) { + if (getKeyResult.success()) { // No error mCachedKeyData = ((ImportKeysListLoader) loader).getParcelableRings(); - } else if (error instanceof ImportKeysListLoader.NoValidKeysException) { - Notify.showNotify(getActivity(), R.string.error_import_no_valid_keys, Notify.Style.ERROR); - } else if (error instanceof ImportKeysListLoader.NonPgpPartException) { - Notify.showNotify(getActivity(), - ((ImportKeysListLoader.NonPgpPartException) error).getCount() + " " + getResources(). - getQuantityString(R.plurals.error_import_non_pgp_part, - ((ImportKeysListLoader.NonPgpPartException) error).getCount()), - Notify.Style.OK - ); } else { - Notify.showNotify(getActivity(), R.string.error_generic_report_bug, Notify.Style.ERROR); + getKeyResult.createNotify(getActivity()).show(); } +// if (error == null) { +// // No error +// mCachedKeyData = ((ImportKeysListLoader) loader).getParcelableRings(); +// } else if (error instanceof ImportKeysListLoader.NoValidKeysException) { +// Notify.showNotify(getActivity(), R.string.error_import_no_valid_keys, Notify.Style.ERROR); +// } else if (error instanceof ImportKeysListLoader.NonPgpPartException) { +// Notify.showNotify(getActivity(), +// ((ImportKeysListLoader.NonPgpPartException) error).getCount() + " " + getResources(). +// getQuantityString(R.plurals.error_import_non_pgp_part, +// ((ImportKeysListLoader.NonPgpPartException) error).getCount()), +// Notify.Style.OK +// ); +// } else { +// Notify.showNotify(getActivity(), R.string.error_generic_report_bug, Notify.Style.ERROR); +// } break; case LOADER_ID_CLOUD: - if (error == null) { + if (getKeyResult.success()) { // No error - } else if (error instanceof Keyserver.QueryTooShortException) { - Notify.showNotify(getActivity(), R.string.error_query_too_short, Notify.Style.ERROR); - } else if (error instanceof Keyserver.TooManyResponsesException) { - Notify.showNotify(getActivity(), R.string.error_too_many_responses, Notify.Style.ERROR); - } else if (error instanceof Keyserver.QueryTooShortOrTooManyResponsesException) { - Notify.showNotify(getActivity(), R.string.error_too_short_or_too_many_responses, Notify.Style.ERROR); - } else if (error instanceof Keyserver.QueryFailedException) { - Log.d(Constants.TAG, - "Unrecoverable keyserver query error: " + error.getLocalizedMessage()); - String alert = getActivity().getString(R.string.error_searching_keys); - alert = alert + " (" + error.getLocalizedMessage() + ")"; - Notify.showNotify(getActivity(), alert, Notify.Style.ERROR); + } else { + getKeyResult.createNotify(getActivity()).show(); } + + +// if (error == null) { +// // No error +// } else if (error instanceof Keyserver.QueryTooShortException) { +// Notify.showNotify(getActivity(), R.string.error_query_too_short, Notify.Style.ERROR); +// } else if (error instanceof Keyserver.TooManyResponsesException) { +// Notify.showNotify(getActivity(), R.string.error_too_many_responses, Notify.Style.ERROR); +// } else if (error instanceof Keyserver.QueryTooShortOrTooManyResponsesException) { +// Notify.showNotify(getActivity(), R.string.error_too_short_or_too_many_responses, Notify.Style.ERROR); +// } else if (error instanceof Keyserver.QueryFailedException) { +// Log.d(Constants.TAG, +// "Unrecoverable keyserver query error: " + error.getLocalizedMessage()); +// String alert = getActivity().getString(R.string.error_searching_keys); +// alert = alert + " (" + error.getLocalizedMessage() + ")"; +// Notify.showNotify(getActivity(), alert, Notify.Style.ERROR); +// } break; default: |