mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-24 07:58:50 -05:00
work on OperationResultParcel
This commit is contained in:
parent
03d103af07
commit
36ef8a9a62
@ -38,8 +38,8 @@ import org.spongycastle.bcpg.UserIDPacket;
|
||||
import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.spongycastle.openpgp.PGPSignature;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.EditKeyResult;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm;
|
||||
|
@ -46,7 +46,7 @@ import org.spongycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
|
||||
import org.spongycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
|
||||
import org.spongycastle.util.Strings;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.results.EditKeyResult;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm;
|
||||
@ -75,7 +75,7 @@ public class UncachedKeyringCanonicalizeTest {
|
||||
UncachedKeyRing ring;
|
||||
ArrayList<RawPacket> onlyA = new ArrayList<RawPacket>();
|
||||
ArrayList<RawPacket> onlyB = new ArrayList<RawPacket>();
|
||||
OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();
|
||||
OperationResult.OperationLog log = new OperationResult.OperationLog();
|
||||
PGPSignatureSubpacketGenerator subHashedPacketsGen;
|
||||
PGPSecretKey secretKey;
|
||||
|
||||
@ -303,7 +303,7 @@ public class UncachedKeyringCanonicalizeTest {
|
||||
parcel.mAddUserIds.add("trix");
|
||||
PgpKeyOperation op = new PgpKeyOperation(null);
|
||||
|
||||
OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();
|
||||
OperationResult.OperationLog log = new OperationResult.OperationLog();
|
||||
UncachedKeyRing foreign = op.createSecretKeyRing(parcel).getRing();
|
||||
|
||||
Assert.assertNotNull("initial test key creation must succeed", foreign);
|
||||
@ -532,7 +532,7 @@ public class UncachedKeyringCanonicalizeTest {
|
||||
|
||||
private static void injectEverywhere(UncachedKeyRing ring, byte[] packet) throws Exception {
|
||||
|
||||
OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();
|
||||
OperationResult.OperationLog log = new OperationResult.OperationLog();
|
||||
|
||||
byte[] encodedRing = ring.getEncoded();
|
||||
|
||||
|
@ -32,7 +32,7 @@ import org.spongycastle.bcpg.SecretKeyPacket;
|
||||
import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.spongycastle.util.Strings;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.results.EditKeyResult;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm;
|
||||
@ -77,7 +77,7 @@ public class UncachedKeyringMergeTest {
|
||||
UncachedKeyRing ringA, ringB;
|
||||
ArrayList<RawPacket> onlyA = new ArrayList<RawPacket>();
|
||||
ArrayList<RawPacket> onlyB = new ArrayList<RawPacket>();
|
||||
OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();
|
||||
OperationResult.OperationLog log = new OperationResult.OperationLog();
|
||||
PgpKeyOperation op;
|
||||
SaveKeyringParcel parcel;
|
||||
|
||||
@ -99,7 +99,7 @@ public class UncachedKeyringMergeTest {
|
||||
parcel.mNewPassphrase = "";
|
||||
PgpKeyOperation op = new PgpKeyOperation(null);
|
||||
|
||||
OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();
|
||||
OperationResult.OperationLog log = new OperationResult.OperationLog();
|
||||
|
||||
EditKeyResult result = op.createSecretKeyRing(parcel);
|
||||
staticRingA = result.getRing();
|
||||
@ -115,7 +115,7 @@ public class UncachedKeyringMergeTest {
|
||||
parcel.mNewPassphrase = "";
|
||||
PgpKeyOperation op = new PgpKeyOperation(null);
|
||||
|
||||
OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();
|
||||
OperationResult.OperationLog log = new OperationResult.OperationLog();
|
||||
EditKeyResult result = op.createSecretKeyRing(parcel);
|
||||
staticRingB = result.getRing();
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.service.results.DecryptVerifyResult;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
|
||||
import org.sufficientlysecure.keychain.util.InputData;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.ProgressScaler;
|
||||
|
@ -33,9 +33,9 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.ImportKeyResult;
|
||||
import org.sufficientlysecure.keychain.service.results.SaveKeyringResult;
|
||||
import org.sufficientlysecure.keychain.util.IterableIterator;
|
||||
|
@ -46,10 +46,10 @@ import org.spongycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
|
||||
import org.spongycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.EditKeyResult;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm;
|
||||
@ -949,7 +949,7 @@ public class PgpKeyOperation {
|
||||
|
||||
progress(R.string.progress_done, 100);
|
||||
log.add(LogLevel.OK, LogType.MSG_MF_SUCCESS, indent);
|
||||
return new EditKeyResult(OperationResultParcel.RESULT_OK, log, new UncachedKeyRing(sKR));
|
||||
return new EditKeyResult(OperationResult.RESULT_OK, log, new UncachedKeyRing(sKR));
|
||||
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,9 @@ import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.SignEncryptResult;
|
||||
import org.sufficientlysecure.keychain.util.InputData;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
@ -34,12 +34,11 @@ import org.spongycastle.openpgp.PGPSignatureList;
|
||||
import org.spongycastle.openpgp.PGPUtil;
|
||||
import org.spongycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator;
|
||||
import org.spongycastle.util.Strings;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
|
||||
import org.sufficientlysecure.keychain.util.IterableIterator;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
|
@ -55,9 +55,9 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.Keys;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds;
|
||||
import org.sufficientlysecure.keychain.remote.AccountSettings;
|
||||
import org.sufficientlysecure.keychain.remote.AppSettings;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.ConsolidateResult;
|
||||
import org.sufficientlysecure.keychain.service.results.SaveKeyringResult;
|
||||
import org.sufficientlysecure.keychain.util.ParcelableFileCache;
|
||||
|
@ -32,7 +32,6 @@ import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||
import org.openintents.openpgp.util.OpenPgpApi;
|
||||
import org.sufficientlysecure.keychain.nfc.NfcActivity;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase.Tables;
|
||||
import org.sufficientlysecure.keychain.service.results.DecryptVerifyResult;
|
||||
@ -45,7 +44,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.remote.ui.RemoteServiceActivity;
|
||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogEntryParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogEntryParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.SignEncryptResult;
|
||||
import org.sufficientlysecure.keychain.ui.ImportKeysActivity;
|
||||
import org.sufficientlysecure.keychain.ui.ViewKeyActivity;
|
||||
|
@ -30,7 +30,10 @@ import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.ActionBarHelper;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.remote.AccountSettings;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.SingletonResult;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
public class AccountSettingsActivity extends ActionBarActivity {
|
||||
@ -105,9 +108,10 @@ public class AccountSettingsActivity extends ActionBarActivity {
|
||||
private void save() {
|
||||
new ProviderHelper(this).updateApiAccount(mAccountUri, mAccountSettingsFragment.getAccSettings());
|
||||
// TODO: show "account saved" instead of "operation succeeded"
|
||||
OperationResultParcel result = new OperationResultParcel(OperationResultParcel.RESULT_OK, null);
|
||||
SingletonResult result = new SingletonResult(
|
||||
SingletonResult.RESULT_OK, LogLevel.OK, LogType.MSG_ACC_SAVED);
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(OperationResultParcel.EXTRA_RESULT, result);
|
||||
intent.putExtra(SingletonResult.EXTRA_RESULT, result);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
@ -115,8 +119,8 @@ public class AccountSettingsActivity extends ActionBarActivity {
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
// if a result has been returned, display a notify
|
||||
if (data != null && data.hasExtra(OperationResultParcel.EXTRA_RESULT)) {
|
||||
OperationResultParcel result = data.getParcelableExtra(OperationResultParcel.EXTRA_RESULT);
|
||||
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
|
||||
OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
|
||||
result.createNotify(this).show();
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
@ -33,7 +33,7 @@ import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.remote.AccountSettings;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.results.SaveKeyringResult;
|
||||
import org.sufficientlysecure.keychain.ui.CreateKeyActivity;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.KeyValueSpinnerAdapter;
|
||||
@ -171,8 +171,8 @@ public class AccountSettingsFragment extends Fragment {
|
||||
switch (requestCode) {
|
||||
case REQUEST_CODE_CREATE_KEY: {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
if (data != null && data.hasExtra(OperationResultParcel.EXTRA_RESULT)) {
|
||||
SaveKeyringResult result = data.getParcelableExtra(OperationResultParcel.EXTRA_RESULT);
|
||||
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
|
||||
SaveKeyringResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
|
||||
mSelectKeySpinner.setSelectedKeyId(result.mRingMasterKeyId);
|
||||
} else {
|
||||
Log.e(Constants.TAG, "missing result!");
|
||||
|
@ -32,7 +32,7 @@ import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.remote.AppSettings;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
public class AppSettingsActivity extends ActionBarActivity {
|
||||
@ -158,8 +158,8 @@ public class AppSettingsActivity extends ActionBarActivity {
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
// if a result has been returned, display a notify
|
||||
if (data != null && data.hasExtra(OperationResultParcel.EXTRA_RESULT)) {
|
||||
OperationResultParcel result = data.getParcelableExtra(OperationResultParcel.EXTRA_RESULT);
|
||||
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
|
||||
OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
|
||||
result.createNotify(this).show();
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
@ -55,10 +55,10 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRingData;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
|
||||
import org.sufficientlysecure.keychain.service.results.ConsolidateResult;
|
||||
import org.sufficientlysecure.keychain.service.results.EditKeyResult;
|
||||
import org.sufficientlysecure.keychain.service.results.ImportKeyResult;
|
||||
@ -813,9 +813,9 @@ public class KeychainIntentService extends IntentService implements Progressable
|
||||
}
|
||||
}
|
||||
|
||||
private void sendMessageToHandler(Integer arg1, OperationResultParcel data) {
|
||||
private void sendMessageToHandler(Integer arg1, OperationResult data) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(OperationResultParcel.EXTRA_RESULT, data);
|
||||
bundle.putParcelable(OperationResult.EXTRA_RESULT, data);
|
||||
sendMessageToHandler(arg1, null, bundle);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.service.results;
|
||||
|
||||
public class ConsolidateResult extends OperationResultParcel {
|
||||
public class ConsolidateResult extends OperationResult {
|
||||
|
||||
public ConsolidateResult(int result, OperationLog log) {
|
||||
super(result, log);
|
||||
|
@ -23,7 +23,7 @@ import android.os.Parcel;
|
||||
import org.openintents.openpgp.OpenPgpMetadata;
|
||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||
|
||||
public class DecryptVerifyResult extends OperationResultParcel {
|
||||
public class DecryptVerifyResult extends OperationResult {
|
||||
|
||||
// the fourth bit indicates a "data pending" result! (it's also a form of non-success)
|
||||
public static final int RESULT_PENDING = RESULT_ERROR +8;
|
||||
|
@ -23,7 +23,7 @@ import android.os.Parcel;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
||||
|
||||
public class EditKeyResult extends OperationResultParcel {
|
||||
public class EditKeyResult extends OperationResult {
|
||||
|
||||
private transient UncachedKeyRing mRing;
|
||||
public final long mRingMasterKeyId;
|
||||
|
@ -34,7 +34,7 @@ import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.LogDisplayActivity;
|
||||
import org.sufficientlysecure.keychain.ui.LogDisplayFragment;
|
||||
|
||||
public class ImportKeyResult extends OperationResultParcel {
|
||||
public class ImportKeyResult extends OperationResult {
|
||||
|
||||
public final int mNewKeys, mUpdatedKeys, mBadKeys, mSecret;
|
||||
|
||||
@ -109,7 +109,7 @@ public class ImportKeyResult extends OperationResultParcel {
|
||||
int duration, color;
|
||||
|
||||
// Not an overall failure
|
||||
if ((resultType & OperationResultParcel.RESULT_ERROR) == 0) {
|
||||
if ((resultType & OperationResult.RESULT_ERROR) == 0) {
|
||||
String withWarnings;
|
||||
|
||||
duration = Duration.EXTRA_LONG;
|
||||
|
@ -52,7 +52,7 @@ import java.util.List;
|
||||
* TODO ideally, this class should be abstract, and all actual results of a specific subclass
|
||||
*
|
||||
*/
|
||||
public class OperationResultParcel implements Parcelable {
|
||||
public abstract class OperationResult implements Parcelable {
|
||||
|
||||
public static final String EXTRA_RESULT = "operation_result";
|
||||
|
||||
@ -71,12 +71,12 @@ public class OperationResultParcel implements Parcelable {
|
||||
/// A list of log entries tied to the operation result.
|
||||
final OperationLog mLog;
|
||||
|
||||
public OperationResultParcel(int result, OperationLog log) {
|
||||
public OperationResult(int result, OperationLog log) {
|
||||
mResult = result;
|
||||
mLog = log;
|
||||
}
|
||||
|
||||
public OperationResultParcel(Parcel source) {
|
||||
public OperationResult(Parcel source) {
|
||||
mResult = source.readInt();
|
||||
mLog = new OperationLog();
|
||||
mLog.addAll(source.createTypedArrayList(LogEntryParcel.CREATOR));
|
||||
@ -156,25 +156,22 @@ public class OperationResultParcel implements Parcelable {
|
||||
|
||||
public SuperCardToast createNotify(final Activity activity) {
|
||||
|
||||
String str;
|
||||
int color;
|
||||
|
||||
// Take the last message as string
|
||||
String str = activity.getString(mLog.getLast().mType.getMsgId());
|
||||
|
||||
// Not an overall failure
|
||||
if (cancelled()) {
|
||||
color = Style.RED;
|
||||
str = "operation cancelled!";
|
||||
} else if (success()) {
|
||||
if (getLog().containsWarnings()) {
|
||||
color = Style.ORANGE;
|
||||
} else {
|
||||
color = Style.GREEN;
|
||||
}
|
||||
str = "operation succeeded!";
|
||||
// str = activity.getString(R.string.import_error);
|
||||
} else {
|
||||
color = Style.RED;
|
||||
str = "operation failed";
|
||||
// str = activity.getString(R.string.import_error);
|
||||
}
|
||||
|
||||
boolean button = getLog() != null && !getLog().isEmpty();
|
||||
@ -197,7 +194,7 @@ public class OperationResultParcel implements Parcelable {
|
||||
public void onClick(View view, Parcelable token) {
|
||||
Intent intent = new Intent(
|
||||
activity, LogDisplayActivity.class);
|
||||
intent.putExtra(LogDisplayFragment.EXTRA_RESULT, OperationResultParcel.this);
|
||||
intent.putExtra(LogDisplayFragment.EXTRA_RESULT, OperationResult.this);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
@ -498,6 +495,11 @@ public class OperationResultParcel implements Parcelable {
|
||||
MSG_SE_SIGCRYPTING (R.string.msg_se_sigcrypting),
|
||||
MSG_SE_SYMMETRIC (R.string.msg_se_symmetric),
|
||||
|
||||
MSG_CRT_UPLOAD_SUCCESS (R.string.msg_crt_upload_success),
|
||||
MSG_CRT_SUCCESS (R.string.msg_crt_success),
|
||||
|
||||
MSG_ACC_SAVED (R.string.api_settings_save)
|
||||
|
||||
;
|
||||
|
||||
private final int mMsgId;
|
||||
@ -533,27 +535,17 @@ public class OperationResultParcel implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
public static final Creator<OperationResultParcel> CREATOR = new Creator<OperationResultParcel>() {
|
||||
public OperationResultParcel createFromParcel(final Parcel source) {
|
||||
return new OperationResultParcel(source);
|
||||
}
|
||||
|
||||
public OperationResultParcel[] newArray(final int size) {
|
||||
return new OperationResultParcel[size];
|
||||
}
|
||||
};
|
||||
|
||||
public static class OperationLog implements Iterable<LogEntryParcel> {
|
||||
|
||||
private final List<LogEntryParcel> mParcels = new ArrayList<LogEntryParcel>();
|
||||
|
||||
/// Simple convenience method
|
||||
public void add(LogLevel level, LogType type, int indent, Object... parameters) {
|
||||
mParcels.add(new OperationResultParcel.LogEntryParcel(level, type, indent, parameters));
|
||||
mParcels.add(new OperationResult.LogEntryParcel(level, type, indent, parameters));
|
||||
}
|
||||
|
||||
public void add(LogLevel level, LogType type, int indent) {
|
||||
mParcels.add(new OperationResultParcel.LogEntryParcel(level, type, indent, (Object[]) null));
|
||||
mParcels.add(new OperationResult.LogEntryParcel(level, type, indent, (Object[]) null));
|
||||
}
|
||||
|
||||
public boolean containsType(LogType type) {
|
@ -23,7 +23,7 @@ import android.os.Parcel;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedKeyRing;
|
||||
|
||||
public class SaveKeyringResult extends OperationResultParcel {
|
||||
public class SaveKeyringResult extends OperationResult {
|
||||
|
||||
public final long mRingMasterKeyId;
|
||||
|
||||
|
@ -19,12 +19,9 @@ package org.sufficientlysecure.keychain.service.results;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import org.openintents.openpgp.OpenPgpMetadata;
|
||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class SignEncryptResult extends OperationResultParcel {
|
||||
public class SignEncryptResult extends OperationResult {
|
||||
|
||||
// the fourth bit indicates a "data pending" result! (it's also a form of non-success)
|
||||
public static final int RESULT_PENDING = RESULT_ERROR +8;
|
||||
|
@ -27,7 +27,7 @@ import com.github.johnpersano.supertoasts.util.Style;
|
||||
|
||||
/** This is a simple subclass meant to contain only a single log message. This log
|
||||
* message is also shown without a log button in the createNotify SuperToast. */
|
||||
public class SingletonResult extends OperationResultParcel {
|
||||
public class SingletonResult extends OperationResult {
|
||||
|
||||
/** Construct from a parcel - trivial because we have no extra data. */
|
||||
public SingletonResult(Parcel source) {
|
||||
|
@ -54,8 +54,11 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.SingletonResult;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment;
|
||||
import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner;
|
||||
@ -327,12 +330,10 @@ public class CertifyKeyFragment extends LoaderFragment
|
||||
|
||||
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
|
||||
|
||||
// Notify.showNotify(CertifyKeyActivity.this, R.string.key_certify_success,
|
||||
// Notify.Style.INFO);
|
||||
|
||||
OperationResultParcel result = new OperationResultParcel(OperationResultParcel.RESULT_OK, null);
|
||||
SingletonResult result = new SingletonResult(
|
||||
SingletonResult.RESULT_OK, LogLevel.OK, LogType.MSG_CRT_SUCCESS);
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(OperationResultParcel.EXTRA_RESULT, result);
|
||||
intent.putExtra(SingletonResult.EXTRA_RESULT, result);
|
||||
mActivity.setResult(CertifyKeyActivity.RESULT_OK, intent);
|
||||
|
||||
// check if we need to send the key to the server or not
|
||||
@ -383,12 +384,10 @@ public class CertifyKeyFragment extends LoaderFragment
|
||||
super.handleMessage(message);
|
||||
|
||||
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
|
||||
//Notify.showNotify(CertifyKeyActivity.this, R.string.key_send_success,
|
||||
//Notify.Style.INFO);
|
||||
|
||||
OperationResultParcel result = new OperationResultParcel(OperationResultParcel.RESULT_OK, null);
|
||||
SingletonResult result = new SingletonResult(SingletonResult.RESULT_OK,
|
||||
LogLevel.OK, LogType.MSG_CRT_UPLOAD_SUCCESS);
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(OperationResultParcel.EXTRA_RESULT, result);
|
||||
intent.putExtra(SingletonResult.EXTRA_RESULT, result);
|
||||
mActivity.setResult(CertifyKeyActivity.RESULT_OK, intent);
|
||||
mActivity.finish();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm;
|
||||
import org.sufficientlysecure.keychain.service.results.SaveKeyringResult;
|
||||
@ -141,7 +141,7 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
return;
|
||||
}
|
||||
final SaveKeyringResult result =
|
||||
returnData.getParcelable(OperationResultParcel.EXTRA_RESULT);
|
||||
returnData.getParcelable(OperationResult.EXTRA_RESULT);
|
||||
if (result == null) {
|
||||
Log.e(Constants.TAG, "result == null");
|
||||
return;
|
||||
@ -152,7 +152,7 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
uploadKey(result);
|
||||
} else {
|
||||
Intent data = new Intent();
|
||||
data.putExtra(OperationResultParcel.EXTRA_RESULT, result);
|
||||
data.putExtra(OperationResult.EXTRA_RESULT, result);
|
||||
getActivity().setResult(Activity.RESULT_OK, data);
|
||||
getActivity().finish();
|
||||
}
|
||||
@ -223,7 +223,7 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
//Notify.Style.INFO);
|
||||
|
||||
Intent data = new Intent();
|
||||
data.putExtra(OperationResultParcel.EXTRA_RESULT, saveKeyResult);
|
||||
data.putExtra(OperationResult.EXTRA_RESULT, saveKeyResult);
|
||||
getActivity().setResult(Activity.RESULT_OK, data);
|
||||
getActivity().finish();
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.SingletonResult;
|
||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
@ -541,8 +541,8 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
if (returnData == null) {
|
||||
return;
|
||||
}
|
||||
final OperationResultParcel result =
|
||||
returnData.getParcelable(OperationResultParcel.EXTRA_RESULT);
|
||||
final OperationResult result =
|
||||
returnData.getParcelable(OperationResult.EXTRA_RESULT);
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
@ -555,7 +555,7 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
|
||||
// if good -> finish, return result to showkey and display there!
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(OperationResultParcel.EXTRA_RESULT, result);
|
||||
intent.putExtra(OperationResult.EXTRA_RESULT, result);
|
||||
getActivity().setResult(EditKeyActivity.RESULT_OK, intent);
|
||||
getActivity().finish();
|
||||
|
||||
@ -590,7 +590,7 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
|
||||
// Prepare an intent with an EXTRA_RESULT
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(OperationResultParcel.EXTRA_RESULT,
|
||||
intent.putExtra(OperationResult.EXTRA_RESULT,
|
||||
new SingletonResult(SingletonResult.RESULT_ERROR, LogLevel.ERROR, reason));
|
||||
|
||||
// Finish with result
|
||||
|
@ -46,7 +46,7 @@ import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.results.ImportKeyResult;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.PagerTabStripAdapter;
|
||||
import org.sufficientlysecure.keychain.ui.widget.SlidingTabLayout;
|
||||
@ -459,7 +459,7 @@ public class ImportKeysActivity extends ActionBarActivity {
|
||||
return;
|
||||
}
|
||||
final ImportKeyResult result =
|
||||
returnData.getParcelable(OperationResultParcel.EXTRA_RESULT);
|
||||
returnData.getParcelable(OperationResult.EXTRA_RESULT);
|
||||
if (result == null) {
|
||||
Log.e(Constants.TAG, "result == null");
|
||||
return;
|
||||
|
@ -34,7 +34,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.results.ConsolidateResult;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Notify;
|
||||
@ -166,7 +166,7 @@ public class KeyListActivity extends DrawerActivity {
|
||||
return;
|
||||
}
|
||||
final ConsolidateResult result =
|
||||
returnData.getParcelable(OperationResultParcel.EXTRA_RESULT);
|
||||
returnData.getParcelable(OperationResult.EXTRA_RESULT);
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
@ -201,8 +201,8 @@ public class KeyListActivity extends DrawerActivity {
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
// if a result has been returned, display a notify
|
||||
if (data != null && data.hasExtra(OperationResultParcel.EXTRA_RESULT)) {
|
||||
OperationResultParcel result = data.getParcelableExtra(OperationResultParcel.EXTRA_RESULT);
|
||||
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
|
||||
OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
|
||||
result.createNotify(this).show();
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
@ -37,9 +37,9 @@ import android.widget.TextView;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogEntryParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel.LogLevel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogEntryParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.LogLevel;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -50,7 +50,7 @@ public class LogDisplayFragment extends ListFragment implements OnTouchListener
|
||||
LogAdapter mAdapter;
|
||||
LogLevel mLevel = LogLevel.DEBUG;
|
||||
|
||||
OperationResultParcel mResult;
|
||||
OperationResult mResult;
|
||||
|
||||
GestureDetector mDetector;
|
||||
|
||||
@ -66,7 +66,7 @@ public class LogDisplayFragment extends ListFragment implements OnTouchListener
|
||||
return;
|
||||
}
|
||||
|
||||
mResult = intent.<OperationResultParcel>getParcelableExtra(EXTRA_RESULT);
|
||||
mResult = intent.<OperationResult>getParcelableExtra(EXTRA_RESULT);
|
||||
if (mResult == null) {
|
||||
getActivity().finish();
|
||||
return;
|
||||
@ -135,7 +135,7 @@ public class LogDisplayFragment extends ListFragment implements OnTouchListener
|
||||
private LayoutInflater mInflater;
|
||||
private int dipFactor;
|
||||
|
||||
public LogAdapter(Context context, OperationResultParcel.OperationLog log, LogLevel level) {
|
||||
public LogAdapter(Context context, OperationResult.OperationLog log, LogLevel level) {
|
||||
super(context, R.layout.log_display_item);
|
||||
mInflater = LayoutInflater.from(getContext());
|
||||
dipFactor = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||
|
@ -56,7 +56,7 @@ import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResultParcel;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.PagerTabStripAdapter;
|
||||
import org.sufficientlysecure.keychain.ui.widget.SlidingTabLayout;
|
||||
import org.sufficientlysecure.keychain.ui.widget.SlidingTabLayout.TabColorizer;
|
||||
@ -322,8 +322,8 @@ public class ViewKeyActivity extends ActionBarActivity implements
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
// if a result has been returned, display a notify
|
||||
if (data != null && data.hasExtra(OperationResultParcel.EXTRA_RESULT)) {
|
||||
OperationResultParcel result = data.getParcelableExtra(OperationResultParcel.EXTRA_RESULT);
|
||||
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
|
||||
OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
|
||||
result.createNotify(this).show();
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
@ -214,8 +214,6 @@
|
||||
<item quantity="other">"%d bad secret keys ignored. Perhaps you exported with the option\n --export-secret-subkeys\nMake sure you export with\n --export-secret-keys\ninstead.""</item>
|
||||
</plurals>
|
||||
|
||||
<string name="key_send_success">"Successfully uploaded key to server"</string>
|
||||
<string name="key_certify_success">"Successfully certified identities"</string>
|
||||
<string name="list_empty">"This list is empty!"</string>
|
||||
<string name="nfc_successful">"Successfully sent key with NFC Beam!"</string>
|
||||
<string name="key_copied_to_clipboard">"Key has been copied to the clipboard!"</string>
|
||||
@ -827,6 +825,11 @@
|
||||
<string name="msg_se">"Starting sign and/or encrypt operation"</string>
|
||||
<string name="msg_se_symmetric">"Preparing symmetric encryption"</string>
|
||||
|
||||
<string name="msg_crt_upload_success">"Successfully uploaded key to server"</string>
|
||||
<string name="msg_crt_success">"Successfully certified identities"</string>
|
||||
|
||||
<string name="msg_acc_saved">"Account saved"</string>
|
||||
|
||||
<!-- PassphraseCache -->
|
||||
<string name="passp_cache_notif_click_to_clear">"Click to clear cached passphrases"</string>
|
||||
<string name="passp_cache_notif_n_keys">"OpenKeychain has cached %d passphrases"</string>
|
||||
|
Loading…
Reference in New Issue
Block a user