mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
Fix notify after certify
This commit is contained in:
parent
4aed570ee3
commit
fa73362a9f
@ -70,8 +70,6 @@ public class MultiCertifyKeyFragment extends LoaderFragment
|
|||||||
|
|
||||||
public static final int REQUEST_CODE_PASSPHRASE = 0x00008001;
|
public static final int REQUEST_CODE_PASSPHRASE = 0x00008001;
|
||||||
|
|
||||||
private FragmentActivity mActivity;
|
|
||||||
|
|
||||||
private CheckBox mUploadKeyCheckbox;
|
private CheckBox mUploadKeyCheckbox;
|
||||||
ListView mUserIds;
|
ListView mUserIds;
|
||||||
|
|
||||||
@ -102,15 +100,15 @@ public class MultiCertifyKeyFragment extends LoaderFragment
|
|||||||
// Start out with a progress indicator.
|
// Start out with a progress indicator.
|
||||||
setContentShown(false);
|
setContentShown(false);
|
||||||
|
|
||||||
mPubMasterKeyIds = mActivity.getIntent().getLongArrayExtra(MultiCertifyKeyActivity.EXTRA_KEY_IDS);
|
mPubMasterKeyIds = getActivity().getIntent().getLongArrayExtra(MultiCertifyKeyActivity.EXTRA_KEY_IDS);
|
||||||
if (mPubMasterKeyIds == null) {
|
if (mPubMasterKeyIds == null) {
|
||||||
Log.e(Constants.TAG, "List of key ids to certify missing!");
|
Log.e(Constants.TAG, "List of key ids to certify missing!");
|
||||||
mActivity.finish();
|
getActivity().finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// preselect certify key id if given
|
// preselect certify key id if given
|
||||||
long certifyKeyId = mActivity.getIntent().getLongExtra(MultiCertifyKeyActivity.EXTRA_CERTIFY_KEY_ID, Constants.key.none);
|
long certifyKeyId = getActivity().getIntent().getLongExtra(MultiCertifyKeyActivity.EXTRA_CERTIFY_KEY_ID, Constants.key.none);
|
||||||
if (certifyKeyId != Constants.key.none) {
|
if (certifyKeyId != Constants.key.none) {
|
||||||
try {
|
try {
|
||||||
CachedPublicKeyRing key = (new ProviderHelper(getActivity())).getCachedPublicKeyRing(certifyKeyId);
|
CachedPublicKeyRing key = (new ProviderHelper(getActivity())).getCachedPublicKeyRing(certifyKeyId);
|
||||||
@ -122,16 +120,16 @@ public class MultiCertifyKeyFragment extends LoaderFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mUserIdsAdapter = new MultiUserIdsAdapter(mActivity, null, 0);
|
mUserIdsAdapter = new MultiUserIdsAdapter(getActivity(), null, 0);
|
||||||
mUserIds.setAdapter(mUserIdsAdapter);
|
mUserIds.setAdapter(mUserIdsAdapter);
|
||||||
mUserIds.setDividerHeight(0);
|
mUserIds.setDividerHeight(0);
|
||||||
|
|
||||||
getLoaderManager().initLoader(0, null, this);
|
getLoaderManager().initLoader(0, null, this);
|
||||||
|
|
||||||
OperationResult result = mActivity.getIntent().getParcelableExtra(MultiCertifyKeyActivity.EXTRA_RESULT);
|
OperationResult result = getActivity().getIntent().getParcelableExtra(MultiCertifyKeyActivity.EXTRA_RESULT);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
// display result from import
|
// display result from import
|
||||||
result.createNotify(mActivity).show();
|
result.createNotify(getActivity()).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,9 +137,6 @@ public class MultiCertifyKeyFragment extends LoaderFragment
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) {
|
||||||
View root = super.onCreateView(inflater, superContainer, savedInstanceState);
|
View root = super.onCreateView(inflater, superContainer, savedInstanceState);
|
||||||
|
|
||||||
// is this "the android way"?
|
|
||||||
mActivity = getActivity();
|
|
||||||
|
|
||||||
View view = inflater.inflate(R.layout.multi_certify_key_fragment, getContainer());
|
View view = inflater.inflate(R.layout.multi_certify_key_fragment, getContainer());
|
||||||
|
|
||||||
mCertifyKeySpinner = (CertifyKeySpinner) view.findViewById(R.id.certify_key_spinner);
|
mCertifyKeySpinner = (CertifyKeySpinner) view.findViewById(R.id.certify_key_spinner);
|
||||||
@ -167,7 +162,7 @@ public class MultiCertifyKeyFragment extends LoaderFragment
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (mSignMasterKeyId == Constants.key.none) {
|
if (mSignMasterKeyId == Constants.key.none) {
|
||||||
Notify.showNotify(mActivity, getString(R.string.select_key_to_certify),
|
Notify.showNotify(getActivity(), getString(R.string.select_key_to_certify),
|
||||||
Notify.Style.ERROR);
|
Notify.Style.ERROR);
|
||||||
} else {
|
} else {
|
||||||
initiateCertifying();
|
initiateCertifying();
|
||||||
@ -204,7 +199,7 @@ public class MultiCertifyKeyFragment extends LoaderFragment
|
|||||||
+ " IN (" + placeholders + ")";
|
+ " IN (" + placeholders + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CursorLoader(mActivity, uri,
|
return new CursorLoader(getActivity(), uri,
|
||||||
USER_IDS_PROJECTION, selection, ids,
|
USER_IDS_PROJECTION, selection, ids,
|
||||||
Tables.USER_IDS + "." + UserIds.MASTER_KEY_ID + " ASC"
|
Tables.USER_IDS + "." + UserIds.MASTER_KEY_ID + " ASC"
|
||||||
+ ", " + Tables.USER_IDS + "." + UserIds.USER_ID + " ASC"
|
+ ", " + Tables.USER_IDS + "." + UserIds.USER_ID + " ASC"
|
||||||
@ -303,10 +298,10 @@ public class MultiCertifyKeyFragment extends LoaderFragment
|
|||||||
// get the user's passphrase for this key (if required)
|
// get the user's passphrase for this key (if required)
|
||||||
String passphrase;
|
String passphrase;
|
||||||
try {
|
try {
|
||||||
passphrase = PassphraseCacheService.getCachedPassphrase(mActivity, mSignMasterKeyId, mSignMasterKeyId);
|
passphrase = PassphraseCacheService.getCachedPassphrase(getActivity(), mSignMasterKeyId, mSignMasterKeyId);
|
||||||
} catch (PassphraseCacheService.KeyNotFoundException e) {
|
} catch (PassphraseCacheService.KeyNotFoundException e) {
|
||||||
Log.e(Constants.TAG, "Key not found!", e);
|
Log.e(Constants.TAG, "Key not found!", e);
|
||||||
mActivity.finish();
|
getActivity().finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (passphrase == null) {
|
if (passphrase == null) {
|
||||||
@ -344,13 +339,13 @@ public class MultiCertifyKeyFragment extends LoaderFragment
|
|||||||
// Bail out if there is not at least one user id selected
|
// Bail out if there is not at least one user id selected
|
||||||
ArrayList<CertifyAction> certifyActions = mUserIdsAdapter.getSelectedCertifyActions();
|
ArrayList<CertifyAction> certifyActions = mUserIdsAdapter.getSelectedCertifyActions();
|
||||||
if (certifyActions.isEmpty()) {
|
if (certifyActions.isEmpty()) {
|
||||||
Notify.showNotify(mActivity, "No identities selected!",
|
Notify.showNotify(getActivity(), "No identities selected!",
|
||||||
Notify.Style.ERROR);
|
Notify.Style.ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send all information needed to service to sign key in other thread
|
// Send all information needed to service to sign key in other thread
|
||||||
Intent intent = new Intent(mActivity, KeychainIntentService.class);
|
Intent intent = new Intent(getActivity(), KeychainIntentService.class);
|
||||||
|
|
||||||
intent.setAction(KeychainIntentService.ACTION_CERTIFY_KEYRING);
|
intent.setAction(KeychainIntentService.ACTION_CERTIFY_KEYRING);
|
||||||
|
|
||||||
@ -367,7 +362,7 @@ public class MultiCertifyKeyFragment extends LoaderFragment
|
|||||||
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
||||||
|
|
||||||
// Message is received after signing is done in KeychainIntentService
|
// Message is received after signing is done in KeychainIntentService
|
||||||
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(mActivity,
|
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(getActivity(),
|
||||||
getString(R.string.progress_certifying), ProgressDialog.STYLE_SPINNER, true) {
|
getString(R.string.progress_certifying), ProgressDialog.STYLE_SPINNER, true) {
|
||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
// handle messages by standard KeychainIntentServiceHandler first
|
// handle messages by standard KeychainIntentServiceHandler first
|
||||||
@ -380,9 +375,8 @@ public class MultiCertifyKeyFragment extends LoaderFragment
|
|||||||
|
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(CertifyResult.EXTRA_RESULT, result);
|
intent.putExtra(CertifyResult.EXTRA_RESULT, result);
|
||||||
mActivity.setResult(Activity.RESULT_OK, intent);
|
getActivity().setResult(Activity.RESULT_OK, intent);
|
||||||
mActivity.finish();
|
getActivity().finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -392,10 +386,10 @@ public class MultiCertifyKeyFragment extends LoaderFragment
|
|||||||
intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);
|
intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);
|
||||||
|
|
||||||
// show progress dialog
|
// show progress dialog
|
||||||
saveHandler.showProgressDialog(mActivity);
|
saveHandler.showProgressDialog(getActivity());
|
||||||
|
|
||||||
// start service with intent
|
// start service with intent
|
||||||
mActivity.startService(intent);
|
getActivity().startService(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ public class QrCodeScanActivity extends FragmentActivity {
|
|||||||
|
|
||||||
public void importKeys(String fingerprint) {
|
public void importKeys(String fingerprint) {
|
||||||
// Message is received after importing is done in KeychainIntentService
|
// Message is received after importing is done in KeychainIntentService
|
||||||
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
|
KeychainIntentServiceHandler serviceHandler = new KeychainIntentServiceHandler(
|
||||||
this,
|
this,
|
||||||
getString(R.string.progress_importing),
|
getString(R.string.progress_importing),
|
||||||
ProgressDialog.STYLE_HORIZONTAL,
|
ProgressDialog.STYLE_HORIZONTAL,
|
||||||
@ -208,11 +208,11 @@ public class QrCodeScanActivity extends FragmentActivity {
|
|||||||
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
||||||
|
|
||||||
// Create a new Messenger for the communication back
|
// Create a new Messenger for the communication back
|
||||||
Messenger messenger = new Messenger(saveHandler);
|
Messenger messenger = new Messenger(serviceHandler);
|
||||||
intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);
|
intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);
|
||||||
|
|
||||||
// show progress dialog
|
// show progress dialog
|
||||||
saveHandler.showProgressDialog(this);
|
serviceHandler.showProgressDialog(this);
|
||||||
|
|
||||||
// start service with intent
|
// start service with intent
|
||||||
startService(intent);
|
startService(intent);
|
||||||
|
Loading…
Reference in New Issue
Block a user