Pass through of master key id in SaveKeyringResult
This commit is contained in:
@@ -29,6 +29,8 @@ import com.github.johnpersano.supertoasts.util.OnClickWrapper;
|
||||
import com.github.johnpersano.supertoasts.util.Style;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
||||
import org.sufficientlysecure.keychain.ui.LogDisplayActivity;
|
||||
import org.sufficientlysecure.keychain.ui.LogDisplayFragment;
|
||||
@@ -49,18 +51,21 @@ public abstract class OperationResults {
|
||||
public static final int RESULT_WITH_WARNINGS = 16;
|
||||
|
||||
// No keys to import...
|
||||
public static final int RESULT_FAIL_NOTHING = 32 +1;
|
||||
public static final int RESULT_FAIL_NOTHING = 32 + 1;
|
||||
|
||||
public boolean isOkBoth() {
|
||||
return (mResult & (RESULT_OK_NEWKEYS | RESULT_OK_UPDATED))
|
||||
== (RESULT_OK_NEWKEYS | RESULT_OK_UPDATED);
|
||||
}
|
||||
|
||||
public boolean isOkNew() {
|
||||
return (mResult & RESULT_OK_NEWKEYS) == RESULT_OK_NEWKEYS;
|
||||
}
|
||||
|
||||
public boolean isOkUpdated() {
|
||||
return (mResult & RESULT_OK_UPDATED) == RESULT_OK_UPDATED;
|
||||
}
|
||||
|
||||
public boolean isFailNothing() {
|
||||
return (mResult & RESULT_FAIL_NOTHING) == RESULT_FAIL_NOTHING;
|
||||
}
|
||||
@@ -124,7 +129,7 @@ public abstract class OperationResults {
|
||||
if (this.isOkBoth()) {
|
||||
str = activity.getResources().getQuantityString(
|
||||
R.plurals.import_keys_added_and_updated_1, mNewKeys, mNewKeys);
|
||||
str += " "+ activity.getResources().getQuantityString(
|
||||
str += " " + activity.getResources().getQuantityString(
|
||||
R.plurals.import_keys_added_and_updated_2, mUpdatedKeys, mUpdatedKeys, withWarnings);
|
||||
} else if (isOkUpdated()) {
|
||||
str = activity.getResources().getQuantityString(
|
||||
@@ -188,7 +193,7 @@ public abstract class OperationResults {
|
||||
public final Long mRingMasterKeyId;
|
||||
|
||||
public EditKeyResult(int result, OperationLog log,
|
||||
UncachedKeyRing ring) {
|
||||
UncachedKeyRing ring) {
|
||||
super(result, log);
|
||||
mRing = ring;
|
||||
mRingMasterKeyId = ring != null ? ring.getMasterKeyId() : null;
|
||||
@@ -224,8 +229,12 @@ public abstract class OperationResults {
|
||||
|
||||
public static class SaveKeyringResult extends OperationResultParcel {
|
||||
|
||||
public SaveKeyringResult(int result, OperationLog log) {
|
||||
public final Long mRingMasterKeyId;
|
||||
|
||||
public SaveKeyringResult(int result, OperationLog log,
|
||||
CanonicalizedKeyRing ring) {
|
||||
super(result, log);
|
||||
mRingMasterKeyId = ring != null ? ring.getMasterKeyId() : null;
|
||||
}
|
||||
|
||||
// Some old key was updated
|
||||
@@ -240,6 +249,26 @@ public abstract class OperationResults {
|
||||
return (mResult & UPDATED) == UPDATED;
|
||||
}
|
||||
|
||||
public SaveKeyringResult(Parcel source) {
|
||||
super(source);
|
||||
mRingMasterKeyId = source.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeLong(mRingMasterKeyId);
|
||||
}
|
||||
|
||||
public static Creator<SaveKeyringResult> CREATOR = new Creator<SaveKeyringResult>() {
|
||||
public SaveKeyringResult createFromParcel(final Parcel source) {
|
||||
return new SaveKeyringResult(source);
|
||||
}
|
||||
|
||||
public SaveKeyringResult[] newArray(final int size) {
|
||||
return new SaveKeyringResult[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user