mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-01-12 14:08:24 -05:00
fix bug in UploadKeyActivity, minor work on uri handling
This commit is contained in:
parent
c5ce794ef7
commit
caad5d1fc1
@ -233,6 +233,12 @@ public class ProviderHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private KeyRing getCanonicalizedKeyRing(Uri queryUri, boolean secret) throws NotFoundException {
|
private KeyRing getCanonicalizedKeyRing(Uri queryUri, boolean secret) throws NotFoundException {
|
||||||
|
|
||||||
|
// if this is not a unified query, we /will/ get hard to trace errors below!
|
||||||
|
if ( ! queryUri.getPath().contains("unified")) {
|
||||||
|
throw new RuntimeException("only unified uris can be passed to getCanonicalizedKeyRing!");
|
||||||
|
}
|
||||||
|
|
||||||
Cursor cursor = mContentResolver.query(queryUri,
|
Cursor cursor = mContentResolver.query(queryUri,
|
||||||
new String[]{
|
new String[]{
|
||||||
// we pick from cache only information that is not easily available from keyrings
|
// we pick from cache only information that is not easily available from keyrings
|
||||||
|
@ -36,6 +36,7 @@ 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.provider.KeychainContract;
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
|
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||||
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.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
@ -92,7 +93,7 @@ public class UploadKeyActivity extends ActionBarActivity {
|
|||||||
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
|
||||||
Uri blobUri = KeychainContract.KeyRingData.buildPublicKeyRingUri(mDataUri);
|
Uri blobUri = KeyRings.buildUnifiedKeyRingUri(mDataUri);
|
||||||
intent.setData(blobUri);
|
intent.setData(blobUri);
|
||||||
|
|
||||||
// fill values for this action
|
// fill values for this action
|
||||||
|
@ -145,20 +145,27 @@ public class ViewKeyActivity extends ActionBarActivity implements
|
|||||||
switchToTab = intent.getExtras().getInt(EXTRA_SELECTED_TAB);
|
switchToTab = intent.getExtras().getInt(EXTRA_SELECTED_TAB);
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri dataUri = getDataUri();
|
mDataUri = getIntent().getData();
|
||||||
if (dataUri == null) {
|
if (mDataUri == null) {
|
||||||
Log.e(Constants.TAG, "Data missing. Should be Uri of key!");
|
Log.e(Constants.TAG, "Data missing. Should be uri of key!");
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (mDataUri.getHost().equals(ContactsContract.AUTHORITY)) {
|
||||||
|
mDataUri = ContactHelper.dataUriFromContactUri(this, mDataUri);
|
||||||
|
}
|
||||||
|
|
||||||
loadData(dataUri);
|
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
|
||||||
|
|
||||||
initNfc(dataUri);
|
// Prepare the loaders. Either re-connect with an existing ones,
|
||||||
|
// or start new ones.
|
||||||
|
getSupportLoaderManager().initLoader(LOADER_ID_UNIFIED, null, this);
|
||||||
|
|
||||||
|
initNfc(mDataUri);
|
||||||
|
|
||||||
mShowAdvancedTabs = false;
|
mShowAdvancedTabs = false;
|
||||||
|
|
||||||
initTabs(dataUri);
|
initTabs(mDataUri);
|
||||||
|
|
||||||
// switch to tab selected by extra
|
// switch to tab selected by extra
|
||||||
mViewPager.setCurrentItem(switchToTab);
|
mViewPager.setCurrentItem(switchToTab);
|
||||||
@ -235,24 +242,6 @@ public class ViewKeyActivity extends ActionBarActivity implements
|
|||||||
mSlidingTabLayout.setViewPager(mViewPager);
|
mSlidingTabLayout.setViewPager(mViewPager);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Uri getDataUri() {
|
|
||||||
Uri dataUri = getIntent().getData();
|
|
||||||
if (dataUri != null && dataUri.getHost().equals(ContactsContract.AUTHORITY)) {
|
|
||||||
dataUri = ContactHelper.dataUriFromContactUri(this, dataUri);
|
|
||||||
}
|
|
||||||
return dataUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadData(Uri dataUri) {
|
|
||||||
mDataUri = dataUri;
|
|
||||||
|
|
||||||
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
|
|
||||||
|
|
||||||
// Prepare the loaders. Either re-connect with an existing ones,
|
|
||||||
// or start new ones.
|
|
||||||
getSupportLoaderManager().initLoader(LOADER_ID_UNIFIED, null, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
|
Loading…
Reference in New Issue
Block a user