Create key: upload

This commit is contained in:
Dominik Schürmann 2014-07-30 15:19:33 +02:00
parent e46d72ba27
commit 052cdfa392
2 changed files with 22 additions and 13 deletions

View File

@ -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;
} }
result.createNotify(getActivity()); if (mUploadCheckbox.isChecked()) {
// result will be displayed after upload
// TODO uploadKey(result);
// if (mUploadCheckbox.isChecked()) { } else {
// uploadKey(); // TODO: return result
// } else { result.createNotify(getActivity());
getActivity().setResult(Activity.RESULT_OK);
getActivity().finish();
// }
getActivity().setResult(Activity.RESULT_OK);
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);

View File

@ -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"