mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-30 12:32:17 -05:00
make number of secret keys imported part of ImportResult parcel
This commit is contained in:
parent
9122d43d0a
commit
6c428fa6b5
@ -139,10 +139,10 @@ public class PgpImportExport {
|
|||||||
// If there aren't even any keys, do nothing here.
|
// If there aren't even any keys, do nothing here.
|
||||||
if (entries == null || !entries.hasNext()) {
|
if (entries == null || !entries.hasNext()) {
|
||||||
return new ImportKeyResult(
|
return new ImportKeyResult(
|
||||||
ImportKeyResult.RESULT_FAIL_NOTHING, mProviderHelper.getLog(), 0, 0, 0);
|
ImportKeyResult.RESULT_FAIL_NOTHING, mProviderHelper.getLog(), 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int newKeys = 0, oldKeys = 0, badKeys = 0;
|
int newKeys = 0, oldKeys = 0, badKeys = 0, secret = 0;
|
||||||
|
|
||||||
int position = 0;
|
int position = 0;
|
||||||
double progSteps = 100.0 / num;
|
double progSteps = 100.0 / num;
|
||||||
@ -177,6 +177,9 @@ public class PgpImportExport {
|
|||||||
oldKeys += 1;
|
oldKeys += 1;
|
||||||
} else {
|
} else {
|
||||||
newKeys += 1;
|
newKeys += 1;
|
||||||
|
if (key.isSecret()) {
|
||||||
|
secret += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -213,7 +216,7 @@ public class PgpImportExport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ImportKeyResult(resultType, log, newKeys, oldKeys, badKeys);
|
return new ImportKeyResult(resultType, log, newKeys, oldKeys, badKeys, secret);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public abstract class OperationResults {
|
|||||||
|
|
||||||
public static class ImportKeyResult extends OperationResultParcel {
|
public static class ImportKeyResult extends OperationResultParcel {
|
||||||
|
|
||||||
public final int mNewKeys, mUpdatedKeys, mBadKeys;
|
public final int mNewKeys, mUpdatedKeys, mBadKeys, mSecret;
|
||||||
|
|
||||||
// At least one new key
|
// At least one new key
|
||||||
public static final int RESULT_OK_NEWKEYS = 2;
|
public static final int RESULT_OK_NEWKEYS = 2;
|
||||||
@ -76,14 +76,16 @@ public abstract class OperationResults {
|
|||||||
mNewKeys = source.readInt();
|
mNewKeys = source.readInt();
|
||||||
mUpdatedKeys = source.readInt();
|
mUpdatedKeys = source.readInt();
|
||||||
mBadKeys = source.readInt();
|
mBadKeys = source.readInt();
|
||||||
|
mSecret = source.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImportKeyResult(int result, OperationLog log,
|
public ImportKeyResult(int result, OperationLog log,
|
||||||
int newKeys, int updatedKeys, int badKeys) {
|
int newKeys, int updatedKeys, int badKeys, int secret) {
|
||||||
super(result, log);
|
super(result, log);
|
||||||
mNewKeys = newKeys;
|
mNewKeys = newKeys;
|
||||||
mUpdatedKeys = updatedKeys;
|
mUpdatedKeys = updatedKeys;
|
||||||
mBadKeys = badKeys;
|
mBadKeys = badKeys;
|
||||||
|
mSecret = secret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -92,6 +94,7 @@ public abstract class OperationResults {
|
|||||||
dest.writeInt(mNewKeys);
|
dest.writeInt(mNewKeys);
|
||||||
dest.writeInt(mUpdatedKeys);
|
dest.writeInt(mUpdatedKeys);
|
||||||
dest.writeInt(mBadKeys);
|
dest.writeInt(mBadKeys);
|
||||||
|
dest.writeInt(mSecret);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Creator<ImportKeyResult> CREATOR = new Creator<ImportKeyResult>() {
|
public static Creator<ImportKeyResult> CREATOR = new Creator<ImportKeyResult>() {
|
||||||
|
Loading…
Reference in New Issue
Block a user