small improvements

This commit is contained in:
Dominik 2012-10-31 18:38:40 +01:00
parent 6fb9b8055d
commit 586358599e
6 changed files with 20 additions and 14 deletions

View File

@ -98,7 +98,7 @@
<string name="menu_search">Search</string>
<string name="menu_help">Help</string>
<string name="menu_keyServer">Key Server</string>
<string name="menu_updateKey">Update</string>
<string name="menu_updateKey">Update from Server</string>
<string name="menu_exportKeyToServer">Export To Server</string>
<string name="menu_share">Share public key with QR Code</string>
<string name="menu_scanQRCode">Scan QR Code</string>

View File

@ -582,7 +582,7 @@ public class ApgProvider extends ContentProvider {
case PUBLIC_KEY_RING_BY_MASTER_KEY_ID:
case SECRET_KEY_RING_BY_MASTER_KEY_ID:
defaultSelection = KeyRings.MASTER_KEY_ID + "=" + uri.getLastPathSegment();
// corresponding keys and userIds are deleted by ON DELETE CASCADE
count = db.delete(Tables.KEY_RINGS,
buildDefaultKeyRingsSelection(defaultSelection, getKeyType(match), selection),
selectionArgs);
@ -623,6 +623,16 @@ public class ApgProvider extends ContentProvider {
case SECRET_KEY_RING_BY_ROW_ID:
defaultSelection = BaseColumns._ID + "=" + uri.getLastPathSegment();
count = db.update(
Tables.KEY_RINGS,
values,
buildDefaultKeyRingsSelection(defaultSelection, getKeyType(match),
selection), selectionArgs);
break;
case PUBLIC_KEY_RING_BY_MASTER_KEY_ID:
case SECRET_KEY_RING_BY_MASTER_KEY_ID:
defaultSelection = KeyRings.MASTER_KEY_ID + "=" + uri.getLastPathSegment();
count = db.update(
Tables.KEY_RINGS,
values,

View File

@ -150,7 +150,7 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
// upload key
public static final String UPLOAD_KEY_SERVER = "uploadKeyServer";
public static final String UPLOAD_KEY_KEYRING_ID = "uploadKeyRingId";
public static final String UPLOAD_KEY_KEYRING_ROW_ID = "uploadKeyRingId";
// query key
public static final String QUERY_KEY_SERVER = "queryKeyServer";
@ -736,14 +736,13 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
try {
/* Input */
int keyRingId = data.getInt(UPLOAD_KEY_KEYRING_ID);
int keyRingRowId = data.getInt(UPLOAD_KEY_KEYRING_ROW_ID);
String keyServer = data.getString(UPLOAD_KEY_SERVER);
/* Operation */
HkpKeyServer server = new HkpKeyServer(keyServer);
PGPPublicKeyRing keyring = ProviderHelper.getPGPPublicKeyRingByMasterKeyId(this,
keyRingId);
PGPPublicKeyRing keyring = ProviderHelper.getPGPPublicKeyRing(this, keyRingRowId);
if (keyring != null) {
boolean uploaded = PGPMain.uploadKeyRingToServer(server,
(PGPPublicKeyRing) keyring);

View File

@ -110,12 +110,9 @@ public class KeyListPublicFragment extends KeyListFragment implements
return true;
case Id.menu.exportToServer:
// TODO: do it better directly with keyRingRowId?
long masterKeyId = ProviderHelper.getPublicMasterKeyId(mKeyListActivity, keyRingRowId);
Intent uploadIntent = new Intent(mKeyListActivity, KeyServerUploadActivity.class);
uploadIntent.setAction(KeyServerUploadActivity.ACTION_EXPORT_KEY_TO_SERVER);
uploadIntent.putExtra(KeyServerUploadActivity.EXTRA_KEY_ID, masterKeyId);
uploadIntent.putExtra(KeyServerUploadActivity.EXTRA_KEYRING_ROW_ID, keyRingRowId);
startActivityForResult(uploadIntent, Id.request.export_to_server);
return true;

View File

@ -49,7 +49,7 @@ public class KeyServerUploadActivity extends SherlockFragmentActivity {
public static final String ACTION_EXPORT_KEY_TO_SERVER = Constants.INTENT_PREFIX
+ "EXPORT_KEY_TO_SERVER";
public static final String EXTRA_KEY_ID = "keyId";
public static final String EXTRA_KEYRING_ROW_ID = "keyId";
private Button export;
private Spinner keyServer;
@ -109,8 +109,8 @@ public class KeyServerUploadActivity extends SherlockFragmentActivity {
// fill values for this action
Bundle data = new Bundle();
int keyRingId = getIntent().getIntExtra(EXTRA_KEY_ID, -1);
data.putInt(ApgService.UPLOAD_KEY_KEYRING_ID, keyRingId);
int keyRingId = getIntent().getIntExtra(EXTRA_KEYRING_ROW_ID, -1);
data.putInt(ApgService.UPLOAD_KEY_KEYRING_ROW_ID, keyRingId);
String server = (String) keyServer.getSelectedItem();
data.putString(ApgService.UPLOAD_KEY_SERVER, server);

View File

@ -254,7 +254,7 @@ public class SignKeyActivity extends SherlockFragmentActivity {
// fill values for this action
Bundle data = new Bundle();
data.putLong(ApgService.UPLOAD_KEY_KEYRING_ID, mPubKeyId);
data.putLong(ApgService.UPLOAD_KEY_KEYRING_ROW_ID, mPubKeyId);
Spinner keyServer = (Spinner) findViewById(R.id.keyServer);
String server = (String) keyServer.getSelectedItem();