mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-26 00:48:51 -05:00
use sub results in import
This commit is contained in:
parent
6699917279
commit
34345cf237
@ -117,10 +117,12 @@ public class PgpImportExport {
|
|||||||
public ImportKeyResult importKeyRings(Iterator<ParcelableKeyRing> entries, int num) {
|
public ImportKeyResult importKeyRings(Iterator<ParcelableKeyRing> entries, int num) {
|
||||||
updateProgress(R.string.progress_importing, 0, 100);
|
updateProgress(R.string.progress_importing, 0, 100);
|
||||||
|
|
||||||
|
OperationLog log = new OperationLog();
|
||||||
|
|
||||||
// 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, 0,
|
ImportKeyResult.RESULT_FAIL_NOTHING, log, 0, 0, 0, 0,
|
||||||
new long[]{});
|
new long[]{});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +158,7 @@ public class PgpImportExport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SaveKeyringResult result;
|
SaveKeyringResult result;
|
||||||
|
mProviderHelper.clearLog();
|
||||||
if (key.isSecret()) {
|
if (key.isSecret()) {
|
||||||
result = mProviderHelper.saveSecretKeyRing(key,
|
result = mProviderHelper.saveSecretKeyRing(key,
|
||||||
new ProgressScaler(mProgressable, (int)(position*progSteps), (int)((position+1)*progSteps), 100));
|
new ProgressScaler(mProgressable, (int)(position*progSteps), (int)((position+1)*progSteps), 100));
|
||||||
@ -176,6 +179,8 @@ public class PgpImportExport {
|
|||||||
importedMasterKeyIds.add(key.getMasterKeyId());
|
importedMasterKeyIds.add(key.getMasterKeyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.add(result, 1);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(Constants.TAG, "Encountered bad key on import!", e);
|
Log.e(Constants.TAG, "Encountered bad key on import!", e);
|
||||||
++badKeys;
|
++badKeys;
|
||||||
@ -187,7 +192,6 @@ public class PgpImportExport {
|
|||||||
position++;
|
position++;
|
||||||
}
|
}
|
||||||
|
|
||||||
OperationLog log = mProviderHelper.getLog();
|
|
||||||
int resultType = 0;
|
int resultType = 0;
|
||||||
// special return case: no new keys at all
|
// special return case: no new keys at all
|
||||||
if (badKeys == 0 && newKeys == 0 && oldKeys == 0) {
|
if (badKeys == 0 && newKeys == 0 && oldKeys == 0) {
|
||||||
|
@ -641,7 +641,7 @@ public abstract class OperationResult implements Parcelable {
|
|||||||
|
|
||||||
public void add(OperationResult subResult, int indent) {
|
public void add(OperationResult subResult, int indent) {
|
||||||
OperationLog subLog = subResult.getLog();
|
OperationLog subLog = subResult.getLog();
|
||||||
mParcels.add(new SubLogEntryParcel(subResult, subLog.getLast().mType, indent, subLog.getLast().mParameters));
|
mParcels.add(new SubLogEntryParcel(subResult, subLog.getFirst().mType, indent, subLog.getFirst().mParameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
@ -678,6 +678,13 @@ public abstract class OperationResult implements Parcelable {
|
|||||||
return mParcels.isEmpty();
|
return mParcels.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LogEntryParcel getFirst() {
|
||||||
|
if (mParcels.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return mParcels.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
public LogEntryParcel getLast() {
|
public LogEntryParcel getLast() {
|
||||||
if (mParcels.isEmpty()) {
|
if (mParcels.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user