aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-09-23 16:19:01 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-09-23 16:19:01 +0200
commitda1779816b8afc29d9c5efc38971346804ad191e (patch)
tree16a68c8203dc23514922910d745955bd57e47169 /OpenKeychain
parentbf9a708e84646e51151d315a48aa33b5b9b0c69e (diff)
downloadopen-keychain-da1779816b8afc29d9c5efc38971346804ad191e.tar.gz
open-keychain-da1779816b8afc29d9c5efc38971346804ad191e.tar.bz2
open-keychain-da1779816b8afc29d9c5efc38971346804ad191e.zip
take failed keys into account in importkeyresult notification
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/ImportKeyResult.java13
-rw-r--r--OpenKeychain/src/main/res/values/strings.xml4
2 files changed, 16 insertions, 1 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/ImportKeyResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/ImportKeyResult.java
index ec9c424cf..3c07e8667 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/ImportKeyResult.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/results/ImportKeyResult.java
@@ -61,6 +61,10 @@ public class ImportKeyResult extends OperationResult {
return (mResult & RESULT_OK_UPDATED) == RESULT_OK_UPDATED;
}
+ public boolean isOkWithErrors() {
+ return (mResult & RESULT_WITH_ERRORS) == RESULT_WITH_ERRORS;
+ }
+
public boolean isFailNothing() {
return (mResult & RESULT_FAIL_NOTHING) == RESULT_FAIL_NOTHING;
}
@@ -129,7 +133,7 @@ public class ImportKeyResult extends OperationResult {
}
// New and updated keys
- if (this.isOkBoth()) {
+ if (isOkBoth()) {
str = activity.getResources().getQuantityString(
R.plurals.import_keys_added_and_updated_1, mNewKeys, mNewKeys);
str += " " + activity.getResources().getQuantityString(
@@ -145,6 +149,13 @@ public class ImportKeyResult extends OperationResult {
color = Style.RED;
str = "internal error";
}
+ if (isOkWithErrors()) {
+ // definitely switch to warning-style message in this case!
+ duration = 0;
+ color = Style.RED;
+ str += " " + activity.getResources().getQuantityString(
+ R.plurals.import_keys_with_errors, mBadKeys);
+ }
} else {
duration = 0;
diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml
index 01b461316..c77c50b72 100644
--- a/OpenKeychain/src/main/res/values/strings.xml
+++ b/OpenKeychain/src/main/res/values/strings.xml
@@ -394,6 +394,10 @@
<item quantity="one">"Successfully updated key%2$s."</item>
<item quantity="other">"Successfully updated %1$d keys%2$s."</item>
</plurals>
+ <plurals name="import_keys_with_errors">
+ <item quantity="one">"Import failed for one key."</item>
+ <item quantity="other">"Import failed for %d keys."</item>
+ </plurals>
<string name="view_log">"View Log"</string>
<string name="import_error_nothing">"Nothing to import."</string>
<string name="import_error_nothing_cancelled">"Import cancelled."</string>