Create key: work on upload
This commit is contained in:
@@ -168,11 +168,13 @@ public abstract class OperationResults {
|
||||
public static class EditKeyResult extends OperationResultParcel {
|
||||
|
||||
private transient UncachedKeyRing mRing;
|
||||
public final long mRingMasterKeyId;
|
||||
|
||||
public EditKeyResult(int result, OperationLog log,
|
||||
UncachedKeyRing ring) {
|
||||
super(result, log);
|
||||
mRing = ring;
|
||||
mRingMasterKeyId = ring.getMasterKeyId();
|
||||
}
|
||||
|
||||
public UncachedKeyRing getRing() {
|
||||
@@ -181,6 +183,13 @@ public abstract class OperationResults {
|
||||
|
||||
public EditKeyResult(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<EditKeyResult> CREATOR = new Creator<EditKeyResult>() {
|
||||
|
||||
@@ -136,6 +136,8 @@ public class CertifyKeyActivity extends ActionBarActivity implements
|
||||
if (mPubKeyId != 0) {
|
||||
if (mMasterKeyId == 0) {
|
||||
mSelectKeyFragment.setError(getString(R.string.select_key_to_certify));
|
||||
Notify.showNotify(CertifyKeyActivity.this, getString(R.string.select_key_to_certify),
|
||||
Notify.Style.ERROR);
|
||||
} else {
|
||||
initiateSigning();
|
||||
}
|
||||
@@ -256,7 +258,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements
|
||||
// Bail out if there is not at least one user id selected
|
||||
ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds();
|
||||
if (userIds.isEmpty()) {
|
||||
Notify.showNotify(CertifyKeyActivity.this, "No Notify.Style IDs to sign selected!",
|
||||
Notify.showNotify(CertifyKeyActivity.this, "No identities selected!",
|
||||
Notify.Style.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,11 @@ package org.sufficientlysecure.keychain.ui;
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.database.ContentObserver;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.support.v4.app.Fragment;
|
||||
@@ -35,6 +38,7 @@ import android.widget.TextView;
|
||||
import org.spongycastle.bcpg.sig.KeyFlags;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.Preferences;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
||||
@@ -188,22 +192,22 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
|
||||
private void uploadKey(final OperationResults.EditKeyResult editKeyResult) {
|
||||
// Send all information needed to service to upload key in other thread
|
||||
Intent intent = new Intent(getActivity(), KeychainIntentService.class);
|
||||
final Intent intent = new Intent(getActivity(), KeychainIntentService.class);
|
||||
|
||||
intent.setAction(KeychainIntentService.ACTION_UPLOAD_KEYRING);
|
||||
|
||||
// set data uri as path to keyring
|
||||
Uri blobUri = KeychainContract.KeyRingData.buildPublicKeyRingUri(
|
||||
Long.toString(editKeyResult.getRing().getMasterKeyId())
|
||||
Long.toString(editKeyResult.mRingMasterKeyId)
|
||||
);
|
||||
intent.setData(blobUri);
|
||||
|
||||
// fill values for this action
|
||||
Bundle data = new Bundle();
|
||||
|
||||
Spinner keyServer = (Spinner) getActivity().findViewById(R.id.upload_key_keyserver);
|
||||
String server = (String) keyServer.getSelectedItem();
|
||||
data.putString(KeychainIntentService.UPLOAD_KEY_SERVER, server);
|
||||
// upload to favorite keyserver
|
||||
String keyserver = Preferences.getPreferences(getActivity()).getKeyServers()[0];
|
||||
data.putString(KeychainIntentService.UPLOAD_KEY_SERVER, keyserver);
|
||||
|
||||
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
||||
|
||||
|
||||
@@ -147,7 +147,6 @@ public class CreateKeyInputFragment extends Fragment {
|
||||
mCreateKeyActivity = (CreateKeyActivity) getActivity();
|
||||
}
|
||||
|
||||
|
||||
private void createKeyCheck() {
|
||||
if (isEditTextNotEmpty(getActivity(), mNameEdit)
|
||||
&& isEditTextNotEmpty(getActivity(), mEmailEdit)
|
||||
|
||||
@@ -354,9 +354,8 @@ public class ImportKeysActivity extends ActionBarActivity {
|
||||
ImportKeysServerFragment f = (ImportKeysServerFragment)
|
||||
getActiveFragment(mViewPager, TAB_KEYSERVER);
|
||||
|
||||
// TODO: Currently it simply uses keyserver nr 0
|
||||
String keyserver = Preferences.getPreferences(ImportKeysActivity.this)
|
||||
.getKeyServers()[0];
|
||||
// ask favorite keyserver
|
||||
String keyserver = Preferences.getPreferences(ImportKeysActivity.this).getKeyServers()[0];
|
||||
|
||||
// set fields of ImportKeysServerFragment
|
||||
f.setQueryAndKeyserver(query, keyserver);
|
||||
|
||||
Reference in New Issue
Block a user