use long rather than String to build uris by key
This commit is contained in:
@@ -587,8 +587,7 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
||||
Intent data = new Intent();
|
||||
|
||||
// return uri pointing to new created key
|
||||
Uri uri = KeyRings.buildGenericKeyRingUri(
|
||||
String.valueOf(getMasterKeyId()));
|
||||
Uri uri = KeyRings.buildGenericKeyRingUri(getMasterKeyId());
|
||||
data.setData(uri);
|
||||
|
||||
setResult(RESULT_OK, data);
|
||||
|
||||
@@ -32,8 +32,9 @@ import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.WrappedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
@@ -147,12 +148,13 @@ public class EncryptAsymmetricFragment extends Fragment {
|
||||
// not sure if we need to distinguish between different subkeys here?
|
||||
if (preselectedSignatureKeyId != 0) {
|
||||
try {
|
||||
WrappedPublicKeyRing keyring =
|
||||
providerHelper.getWrappedPublicKeyRing(preselectedSignatureKeyId);
|
||||
CachedPublicKeyRing keyring =
|
||||
providerHelper.getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingUri(preselectedSignatureKeyId));
|
||||
if(keyring.hasAnySecret()) {
|
||||
setSignatureKeyId(keyring.getMasterKeyId());
|
||||
}
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
} catch (PgpGeneralException e) {
|
||||
Log.e(Constants.TAG, "key not found!", e);
|
||||
}
|
||||
}
|
||||
@@ -163,7 +165,7 @@ public class EncryptAsymmetricFragment extends Fragment {
|
||||
try {
|
||||
long id = providerHelper.getMasterKeyId(
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(
|
||||
Long.toString(preselectedEncryptionKeyIds[i]))
|
||||
preselectedEncryptionKeyIds[i])
|
||||
);
|
||||
goodIds.add(id);
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
|
||||
@@ -308,7 +308,7 @@ public class KeyListFragment extends LoaderFragment
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
Intent viewIntent = new Intent(getActivity(), ViewKeyActivity.class);
|
||||
viewIntent.setData(
|
||||
KeyRings.buildGenericKeyRingUri(Long.toString(mAdapter.getMasterKeyId(position))));
|
||||
KeyRings.buildGenericKeyRingUri(mAdapter.getMasterKeyId(position)));
|
||||
startActivity(viewIntent);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class SelectSecretKeyFragment extends ListFragment implements
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
long masterKeyId = mAdapter.getMasterKeyId(position);
|
||||
Uri result = KeyRings.buildGenericKeyRingUri(String.valueOf(masterKeyId));
|
||||
Uri result = KeyRings.buildGenericKeyRingUri(masterKeyId);
|
||||
|
||||
// return data to activity, which results in finishing it
|
||||
mActivity.afterListSelection(result);
|
||||
|
||||
@@ -132,7 +132,7 @@ public class SelectSecretKeyLayoutFragment extends Fragment implements LoaderMan
|
||||
|
||||
//For AppSettingsFragment
|
||||
public void selectKey(long masterKeyId) {
|
||||
Uri buildUri = KeychainContract.KeyRings.buildGenericKeyRingUri(String.valueOf(masterKeyId));
|
||||
Uri buildUri = KeychainContract.KeyRings.buildGenericKeyRingUri(masterKeyId);
|
||||
mReceivedUri = buildUri;
|
||||
getActivity().getSupportLoaderManager().restartLoader(LOADER_ID, null, this);
|
||||
}
|
||||
|
||||
@@ -212,11 +212,9 @@ public class ViewCertActivity extends ActionBarActivity
|
||||
try {
|
||||
ProviderHelper providerHelper = new ProviderHelper(ViewCertActivity.this);
|
||||
long signerMasterKeyId = providerHelper.getMasterKeyId(
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(Long.toString(mCertifierKeyId))
|
||||
);
|
||||
viewIntent.setData(KeyRings.buildGenericKeyRingUri(
|
||||
Long.toString(signerMasterKeyId))
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(mCertifierKeyId)
|
||||
);
|
||||
viewIntent.setData(KeyRings.buildGenericKeyRingUri(signerMasterKeyId));
|
||||
startActivity(viewIntent);
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
// TODO notify user of this, maybe offer download?
|
||||
|
||||
Reference in New Issue
Block a user