mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-30 12:32:17 -05:00
return some more results
This commit is contained in:
parent
0e152d1db0
commit
47bcc6149e
@ -317,7 +317,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements LoaderManag
|
|||||||
|
|
||||||
OperationResultParcel result = new OperationResultParcel(OperationResultParcel.RESULT_OK, null);
|
OperationResultParcel result = new OperationResultParcel(OperationResultParcel.RESULT_OK, null);
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(OperationResults.ImportKeyResult.EXTRA_RESULT, result);
|
intent.putExtra(OperationResultParcel.EXTRA_RESULT, result);
|
||||||
CertifyKeyActivity.this.setResult(RESULT_OK, intent);
|
CertifyKeyActivity.this.setResult(RESULT_OK, intent);
|
||||||
CertifyKeyActivity.this.finish();
|
CertifyKeyActivity.this.finish();
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements LoaderManag
|
|||||||
|
|
||||||
OperationResultParcel result = new OperationResultParcel(OperationResultParcel.RESULT_OK, null);
|
OperationResultParcel result = new OperationResultParcel(OperationResultParcel.RESULT_OK, null);
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(OperationResults.ImportKeyResult.EXTRA_RESULT, result);
|
intent.putExtra(OperationResultParcel.EXTRA_RESULT, result);
|
||||||
CertifyKeyActivity.this.setResult(RESULT_OK, intent);
|
CertifyKeyActivity.this.setResult(RESULT_OK, intent);
|
||||||
CertifyKeyActivity.this.finish();
|
CertifyKeyActivity.this.finish();
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import org.spongycastle.bcpg.PublicKeyAlgorithmTags;
|
import org.spongycastle.bcpg.PublicKeyAlgorithmTags;
|
||||||
import org.spongycastle.bcpg.sig.KeyFlags;
|
import org.spongycastle.bcpg.sig.KeyFlags;
|
||||||
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.helper.Preferences;
|
import org.sufficientlysecure.keychain.helper.Preferences;
|
||||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||||
@ -42,6 +43,7 @@ import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
|||||||
import org.sufficientlysecure.keychain.service.OperationResultParcel;
|
import org.sufficientlysecure.keychain.service.OperationResultParcel;
|
||||||
import org.sufficientlysecure.keychain.service.OperationResults;
|
import org.sufficientlysecure.keychain.service.OperationResults;
|
||||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||||
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
import org.sufficientlysecure.keychain.util.Notify;
|
import org.sufficientlysecure.keychain.util.Notify;
|
||||||
|
|
||||||
public class CreateKeyFinalFragment extends Fragment {
|
public class CreateKeyFinalFragment extends Fragment {
|
||||||
@ -142,23 +144,18 @@ public class CreateKeyFinalFragment extends Fragment {
|
|||||||
final OperationResults.SaveKeyringResult result =
|
final OperationResults.SaveKeyringResult result =
|
||||||
returnData.getParcelable(OperationResultParcel.EXTRA_RESULT);
|
returnData.getParcelable(OperationResultParcel.EXTRA_RESULT);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
|
Log.e(Constants.TAG, "result == null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.getResult() == OperationResultParcel.RESULT_OK) {
|
if (mUploadCheckbox.isChecked()) {
|
||||||
if (mUploadCheckbox.isChecked()) {
|
// result will be displayed after upload
|
||||||
// result will be displayed after upload
|
uploadKey(result);
|
||||||
uploadKey(result);
|
|
||||||
} else {
|
|
||||||
// TODO: return result
|
|
||||||
result.createNotify(getActivity());
|
|
||||||
|
|
||||||
getActivity().setResult(Activity.RESULT_OK);
|
|
||||||
getActivity().finish();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// display result on error without finishing activity
|
Intent data = new Intent();
|
||||||
result.createNotify(getActivity());
|
data.putExtra(OperationResultParcel.EXTRA_RESULT, result);
|
||||||
|
getActivity().setResult(Activity.RESULT_OK, data);
|
||||||
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,20 +214,16 @@ public class CreateKeyFinalFragment extends Fragment {
|
|||||||
super.handleMessage(message);
|
super.handleMessage(message);
|
||||||
|
|
||||||
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
|
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
|
||||||
// TODO: not supported by upload?
|
// TODO: upload operation needs a result!
|
||||||
// if (result.getResult() == OperationResultParcel.RESULT_OK) {
|
// TODO: then combine these results
|
||||||
// TODO: return result
|
//if (result.getResult() == OperationResultParcel.RESULT_OK) {
|
||||||
editKeyResult.createNotify(getActivity());
|
//Notify.showNotify(getActivity(), R.string.key_send_success,
|
||||||
|
//Notify.Style.INFO);
|
||||||
|
|
||||||
Notify.showNotify(getActivity(), R.string.key_send_success,
|
Intent data = new Intent();
|
||||||
Notify.Style.INFO);
|
data.putExtra(OperationResultParcel.EXTRA_RESULT, editKeyResult);
|
||||||
|
getActivity().setResult(Activity.RESULT_OK, data);
|
||||||
getActivity().setResult(Activity.RESULT_OK);
|
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
// } else {
|
|
||||||
// // display result on error without finishing activity
|
|
||||||
// editKeyResult.createNotify(getActivity());
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,7 @@ public class FirstTimeActivity extends ActionBarActivity {
|
|||||||
mSkipSetup.setOnClickListener(new View.OnClickListener() {
|
mSkipSetup.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
finishSetup();
|
finishSetup(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -80,18 +80,20 @@ public class FirstTimeActivity extends ActionBarActivity {
|
|||||||
|
|
||||||
if (requestCode == REQUEST_CODE_CREATE_OR_IMPORT_KEY) {
|
if (requestCode == REQUEST_CODE_CREATE_OR_IMPORT_KEY) {
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
finishSetup();
|
finishSetup(data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(Constants.TAG, "No valid request code!");
|
Log.e(Constants.TAG, "No valid request code!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finishSetup() {
|
private void finishSetup(Intent srcData) {
|
||||||
Preferences prefs = Preferences.getPreferences(this);
|
Preferences prefs = Preferences.getPreferences(this);
|
||||||
prefs.setFirstTime(false);
|
prefs.setFirstTime(false);
|
||||||
Intent intent = new Intent(FirstTimeActivity.this, KeyListActivity.class);
|
Intent intent = new Intent(this, KeyListActivity.class);
|
||||||
startActivity(intent);
|
// give intent through to display notify
|
||||||
|
intent.putExtras(srcData);
|
||||||
|
startActivityForResult(intent, 0);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ public class KeyListActivity extends DrawerActivity {
|
|||||||
|
|
||||||
private void createKey() {
|
private void createKey() {
|
||||||
Intent intent = new Intent(this, CreateKeyActivity.class);
|
Intent intent = new Intent(this, CreateKeyActivity.class);
|
||||||
startActivity(intent);
|
startActivityForResult(intent, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void consolidate() {
|
private void consolidate() {
|
||||||
@ -197,4 +197,15 @@ 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);
|
||||||
|
result.createNotify(this).show();
|
||||||
|
} else {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,6 @@ public class LogDisplayFragment extends ListFragment implements OnTouchListener
|
|||||||
(Integer) entry.mParameters[0],
|
(Integer) entry.mParameters[0],
|
||||||
entry.mParameters));
|
entry.mParameters));
|
||||||
} else {
|
} else {
|
||||||
Log.d(Constants.TAG, "entry.mType.getMsgId() "+entry.mType.name());
|
|
||||||
ih.mText.setText(getResources().getString(entry.mType.getMsgId(),
|
ih.mText.setText(getResources().getString(entry.mType.getMsgId(),
|
||||||
entry.mParameters));
|
entry.mParameters));
|
||||||
}
|
}
|
||||||
|
@ -313,6 +313,7 @@ public class ViewKeyActivity extends ActionBarActivity implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
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)) {
|
if (data != null && data.hasExtra(OperationResultParcel.EXTRA_RESULT)) {
|
||||||
OperationResultParcel result = data.getParcelableExtra(OperationResultParcel.EXTRA_RESULT);
|
OperationResultParcel result = data.getParcelableExtra(OperationResultParcel.EXTRA_RESULT);
|
||||||
result.createNotify(this).show();
|
result.createNotify(this).show();
|
||||||
|
Loading…
Reference in New Issue
Block a user