mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-05 16:55:05 -05:00
Create key: upload
This commit is contained in:
parent
e46d72ba27
commit
052cdfa392
@ -20,6 +20,7 @@ package org.sufficientlysecure.keychain.ui;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.Messenger;
|
import android.os.Messenger;
|
||||||
@ -34,6 +35,7 @@ import android.widget.TextView;
|
|||||||
import org.spongycastle.bcpg.sig.KeyFlags;
|
import org.spongycastle.bcpg.sig.KeyFlags;
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||||
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
||||||
import org.sufficientlysecure.keychain.service.OperationResultParcel;
|
import org.sufficientlysecure.keychain.service.OperationResultParcel;
|
||||||
@ -145,16 +147,16 @@ public class CreateKeyFinalFragment extends Fragment {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mUploadCheckbox.isChecked()) {
|
||||||
|
// result will be displayed after upload
|
||||||
|
uploadKey(result);
|
||||||
|
} else {
|
||||||
|
// TODO: return result
|
||||||
result.createNotify(getActivity());
|
result.createNotify(getActivity());
|
||||||
|
|
||||||
// TODO
|
|
||||||
// if (mUploadCheckbox.isChecked()) {
|
|
||||||
// uploadKey();
|
|
||||||
// } else {
|
|
||||||
getActivity().setResult(Activity.RESULT_OK);
|
getActivity().setResult(Activity.RESULT_OK);
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -184,16 +186,17 @@ public class CreateKeyFinalFragment extends Fragment {
|
|||||||
getActivity().startService(intent);
|
getActivity().startService(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uploadKey() {
|
private void uploadKey(final OperationResults.EditKeyResult editKeyResult) {
|
||||||
// Send all information needed to service to upload key in other thread
|
// Send all information needed to service to upload key in other thread
|
||||||
Intent intent = new Intent(getActivity(), KeychainIntentService.class);
|
Intent intent = new Intent(getActivity(), KeychainIntentService.class);
|
||||||
|
|
||||||
intent.setAction(KeychainIntentService.ACTION_UPLOAD_KEYRING);
|
intent.setAction(KeychainIntentService.ACTION_UPLOAD_KEYRING);
|
||||||
|
|
||||||
// set data uri as path to keyring
|
// set data uri as path to keyring
|
||||||
// TODO
|
Uri blobUri = KeychainContract.KeyRingData.buildPublicKeyRingUri(
|
||||||
// Uri blobUri = KeychainContract.KeyRingData.buildPublicKeyRingUri(mDataUri);
|
Long.toString(editKeyResult.getRing().getMasterKeyId())
|
||||||
// intent.setData(blobUri);
|
);
|
||||||
|
intent.setData(blobUri);
|
||||||
|
|
||||||
// fill values for this action
|
// fill values for this action
|
||||||
Bundle data = new Bundle();
|
Bundle data = new Bundle();
|
||||||
@ -212,6 +215,10 @@ public class CreateKeyFinalFragment extends Fragment {
|
|||||||
super.handleMessage(message);
|
super.handleMessage(message);
|
||||||
|
|
||||||
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
|
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
|
||||||
|
// TODO: return results
|
||||||
|
|
||||||
|
editKeyResult.createNotify(getActivity());
|
||||||
|
|
||||||
Notify.showNotify(getActivity(), R.string.key_send_success,
|
Notify.showNotify(getActivity(), R.string.key_send_success,
|
||||||
Notify.Style.INFO);
|
Notify.Style.INFO);
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<include layout="@layout/notify_area" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/create_key_fragment_container"
|
android:id="@+id/create_key_fragment_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user