set correct upload status for newly created keys

This commit is contained in:
Vincent Breitmoser
2017-09-22 01:24:51 +02:00
parent 318005dbb6
commit 2cd995526e

View File

@@ -82,13 +82,14 @@ public class EditKeyOperation extends BaseReadWriteOperation<SaveKeyringParcel>
}
// Perform actual modification (or creation)
boolean isNewKey = saveParcel.getMasterKeyId() == null;
PgpEditKeyResult modifyResult;
{
PgpKeyOperation keyOperations =
new PgpKeyOperation(new ProgressScaler(mProgressable, 10, 60, 100), mCancelled);
// If a key id is specified, fetch and edit
if (saveParcel.getMasterKeyId() != null) {
if (!isNewKey) {
try {
log.add(LogType.MSG_ED_FETCHING, 1,
@@ -165,6 +166,10 @@ public class EditKeyOperation extends BaseReadWriteOperation<SaveKeyringParcel>
SaveKeyringResult saveResult = mKeyWritableRepository.saveSecretKeyRing(ring);
log.add(saveResult, 1);
if (isNewKey) {
mKeyWritableRepository.renewKeyLastUpdatedTime(ring.getMasterKeyId(), saveParcel.isShouldUpload());
}
// If the save operation didn't succeed, exit here
if (!saveResult.success()) {
return new EditKeyResult(EditKeyResult.RESULT_ERROR, log, null);