aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-04-09 13:57:56 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-04-09 13:57:56 +0200
commita4b7daf266b037c6a39cef0586aadedf32861ad5 (patch)
tree8446f6aae86530a8546caa99af6f9bac4f095370 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations
parentd27925ad19b6800658a69670ceaed261776ba6d3 (diff)
parentdcaac4f85f07efff2fdfd8a2eec9ba8ee758659c (diff)
downloadopen-keychain-a4b7daf266b037c6a39cef0586aadedf32861ad5.tar.gz
open-keychain-a4b7daf266b037c6a39cef0586aadedf32861ad5.tar.bz2
open-keychain-a4b7daf266b037c6a39cef0586aadedf32861ad5.zip
Merge branch 'development' into linked-identities
Conflicts: OpenKeychain/build.gradle OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java20
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/ImportKeyResult.java7
2 files changed, 16 insertions, 11 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java
index 20dba95e9..f2516f1bd 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java
@@ -168,7 +168,7 @@ public class ImportExportOperation extends BaseOperation {
return new ImportKeyResult(ImportKeyResult.RESULT_FAIL_NOTHING, log);
}
- int newKeys = 0, oldKeys = 0, badKeys = 0, secret = 0;
+ int newKeys = 0, updatedKeys = 0, badKeys = 0, secret = 0;
ArrayList<Long> importedMasterKeyIds = new ArrayList<>();
boolean cancelled = false;
@@ -302,7 +302,7 @@ public class ImportExportOperation extends BaseOperation {
if (!result.success()) {
badKeys += 1;
} else if (result.updated()) {
- oldKeys += 1;
+ updatedKeys += 1;
importedMasterKeyIds.add(key.getMasterKeyId());
} else {
newKeys += 1;
@@ -333,7 +333,9 @@ public class ImportExportOperation extends BaseOperation {
}
// Special: make sure new data is synced into contacts
- ContactSyncAdapterService.requestSync();
+ // disabling sync right now since it reduces speed while multi-threading
+ // so, we expect calling functions to take care of it. KeychainIntentService handles this
+ //ContactSyncAdapterService.requestSync();
// convert to long array
long[] importedMasterKeyIdsArray = new long[importedMasterKeyIds.size()];
@@ -348,18 +350,18 @@ public class ImportExportOperation extends BaseOperation {
}
// special return case: no new keys at all
- if (badKeys == 0 && newKeys == 0 && oldKeys == 0) {
+ if (badKeys == 0 && newKeys == 0 && updatedKeys == 0) {
resultType = ImportKeyResult.RESULT_FAIL_NOTHING;
} else {
if (newKeys > 0) {
resultType |= ImportKeyResult.RESULT_OK_NEWKEYS;
}
- if (oldKeys > 0) {
+ if (updatedKeys > 0) {
resultType |= ImportKeyResult.RESULT_OK_UPDATED;
}
if (badKeys > 0) {
resultType |= ImportKeyResult.RESULT_WITH_ERRORS;
- if (newKeys == 0 && oldKeys == 0) {
+ if (newKeys == 0 && updatedKeys == 0) {
resultType |= ImportKeyResult.RESULT_ERROR;
}
}
@@ -369,15 +371,15 @@ public class ImportExportOperation extends BaseOperation {
}
// Final log entry, it's easier to do this individually
- if ( (newKeys > 0 || oldKeys > 0) && badKeys > 0) {
+ if ( (newKeys > 0 || updatedKeys > 0) && badKeys > 0) {
log.add(LogType.MSG_IMPORT_PARTIAL, 1);
- } else if (newKeys > 0 || oldKeys > 0) {
+ } else if (newKeys > 0 || updatedKeys > 0) {
log.add(LogType.MSG_IMPORT_SUCCESS, 1);
} else {
log.add(LogType.MSG_IMPORT_ERROR, 1);
}
- return new ImportKeyResult(resultType, log, newKeys, oldKeys, badKeys, secret,
+ return new ImportKeyResult(resultType, log, newKeys, updatedKeys, badKeys, secret,
importedMasterKeyIdsArray);
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/ImportKeyResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/ImportKeyResult.java
index af9f67114..1438ad698 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/ImportKeyResult.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/ImportKeyResult.java
@@ -162,7 +162,7 @@ public class ImportKeyResult extends OperationResult {
if (isOkWithErrors()) {
// definitely switch to warning-style message in this case!
duration = 0;
- style = Style.ERROR;
+ style = Style.WARN;
str += " " + activity.getResources().getQuantityString(
R.plurals.import_keys_with_errors, mBadKeys, mBadKeys);
}
@@ -175,7 +175,10 @@ public class ImportKeyResult extends OperationResult {
? R.string.import_error_nothing_cancelled
: R.string.import_error_nothing);
} else {
- str = activity.getResources().getQuantityString(R.plurals.import_error, mBadKeys);
+ str = activity.getResources().getQuantityString(
+ R.plurals.import_error,
+ mBadKeys,
+ mBadKeys);
}
}