fix editactivity crash, default key creation, import from keyserver menu button

This commit is contained in:
Dominik Schürmann 2013-09-09 17:43:10 +02:00
parent 38e8733fd6
commit b6d63f95cb
5 changed files with 48 additions and 26 deletions

View File

@ -92,22 +92,23 @@
<string name="menu_importFromFile">Import from file</string>
<string name="menu_importFromQrCode">Import from QR Code</string>
<string name="menu_importFromNfc">Import from NFC</string>
<string name="menu_exportKeys">Export All Keys</string>
<string name="menu_exportKey">Export To File</string>
<string name="menu_deleteKey">Delete Key</string>
<string name="menu_createKey">Create Key</string>
<string name="menu_editKey">Edit Key</string>
<string name="menu_exportKeys">Export all keys</string>
<string name="menu_exportKey">Export to file</string>
<string name="menu_deleteKey">Delete key</string>
<string name="menu_createKey">Create key</string>
<string name="menu_createKeyExpert">Create key (expert)</string>
<string name="menu_editKey">Edit key</string>
<string name="menu_search">Search</string>
<string name="menu_help">Help</string>
<string name="menu_keyServer">Query Key Server</string>
<string name="menu_updateKey">Update from Server</string>
<string name="menu_exportKeyToServer">Export To Server</string>
<string name="menu_keyServer">Import from key server</string>
<string name="menu_updateKey">Update from server</string>
<string name="menu_exportKeyToServer">Export to server</string>
<string name="menu_share">Share with…</string>
<string name="menu_shareQrCode">Share with QR Code</string>
<string name="menu_shareNfc">Share with NFC</string>
<string name="menu_scanQRCode">Scan QR Code</string>
<string name="menu_signKey">Sign Key</string>
<string name="menu_BeamPreferences">Beam Settings</string>
<string name="menu_signKey">Sign key</string>
<string name="menu_BeamPreferences">Beam settings</string>
<!-- label_lowerCase: capitalized words, no punctuation -->
<string name="label_sign">Sign</string>

View File

@ -63,6 +63,7 @@ public final class Id {
public static final int import_from_qr_code = 0x21070021;
public static final int import_from_nfc = 0x21070022;
public static final int crypto_consumers = 0x21070023;
public static final int createExpert = 0x21070024;
}
}

View File

@ -89,13 +89,15 @@ public class ImportKeysActivity extends SherlockFragmentActivity {
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(1, Id.menu.option.import_from_file, 0, R.string.menu_importFromFile)
menu.add(1, Id.menu.option.key_server, 0, R.string.menu_keyServer).setShowAsAction(
MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add(1, Id.menu.option.import_from_file, 1, R.string.menu_importFromFile)
.setShowAsAction(
MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add(1, Id.menu.option.import_from_qr_code, 1, R.string.menu_importFromQrCode)
menu.add(1, Id.menu.option.import_from_qr_code, 2, R.string.menu_importFromQrCode)
.setShowAsAction(
MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add(1, Id.menu.option.import_from_nfc, 2, R.string.menu_importFromNfc)
menu.add(1, Id.menu.option.import_from_nfc, 3, R.string.menu_importFromNfc)
.setShowAsAction(
MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
@ -113,6 +115,11 @@ public class ImportKeysActivity extends SherlockFragmentActivity {
startActivity(intent);
return true;
case Id.menu.option.key_server:
startActivityForResult(new Intent(this, KeyServerQueryActivity.class), 0);
return true;
case Id.menu.option.import_from_file:
showImportFromFileDialog();
return true;

View File

@ -52,6 +52,8 @@ public class KeyListSecretActivity extends KeyListActivity {
super.onCreateOptionsMenu(menu);
menu.add(1, Id.menu.option.create, 1, R.string.menu_createKey).setShowAsAction(
MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add(1, Id.menu.option.createExpert, 2, R.string.menu_createKeyExpert).setShowAsAction(
MenuItem.SHOW_AS_ACTION_NEVER);
return true;
}
@ -64,6 +66,11 @@ public class KeyListSecretActivity extends KeyListActivity {
return true;
}
case Id.menu.option.createExpert: {
createKeyExpert();
return true;
}
default: {
return super.onOptionsItemSelected(item);
}
@ -112,12 +119,23 @@ public class KeyListSecretActivity extends KeyListActivity {
private void createKey() {
PgpMain.setEditPassPhrase("");
Intent intent = new Intent(EditKeyActivity.ACTION_CREATE_KEY);
Intent intent = new Intent(this, EditKeyActivity.class);
intent.setAction(EditKeyActivity.ACTION_CREATE_KEY);
intent.putExtra(EditKeyActivity.EXTRA_GENERATE_DEFAULT_KEYS, true);
intent.putExtra(EditKeyActivity.EXTRA_USER_IDS, ""); // show user id view
startActivityForResult(intent, 0);
}
private void createKeyExpert() {
PgpMain.setEditPassPhrase("");
Intent intent = new Intent(this, EditKeyActivity.class);
intent.setAction(EditKeyActivity.ACTION_CREATE_KEY);
startActivityForResult(intent, 0);
}
private void editKey(long masterKeyId, boolean masterCanSign) {
Intent intent = new Intent(EditKeyActivity.ACTION_EDIT_KEY);
Intent intent = new Intent(this, EditKeyActivity.class);
intent.setAction(EditKeyActivity.ACTION_EDIT_KEY);
intent.putExtra(EditKeyActivity.EXTRA_MASTER_KEY_ID, masterKeyId);
intent.putExtra(EditKeyActivity.EXTRA_MASTER_CAN_SIGN, masterCanSign);
startActivityForResult(intent, 0);

View File

@ -17,28 +17,23 @@
package org.sufficientlysecure.keychain.ui;
import java.util.ArrayList;
import org.sufficientlysecure.keychain.Id;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.ui.widget.KeyListAdapter;
import org.sufficientlysecure.keychain.R;
import com.google.zxing.integration.android.IntentIntegrator;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v4.app.LoaderManager;
import android.view.ContextMenu;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.Toast;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
public class KeyListSecretFragment extends KeyListFragment implements
@ -91,7 +86,8 @@ public class KeyListSecretFragment extends KeyListFragment implements
long masterKeyId = ProviderHelper
.getSecretMasterKeyId(mKeyListSecretActivity, keyRingRowId);
boolean masterCanSign = ProviderHelper.getSecretMasterKeyCanSign(mKeyListSecretActivity, keyRingRowId);
boolean masterCanSign = ProviderHelper.getSecretMasterKeyCanSign(mKeyListSecretActivity,
keyRingRowId);
switch (item.getItemId()) {
case Id.menu.edit:
@ -105,7 +101,6 @@ public class KeyListSecretFragment extends KeyListFragment implements
}
}
// These are the rows that we will retrieve.
static final String[] PROJECTION = new String[] { KeyRings._ID, KeyRings.MASTER_KEY_ID,
UserIds.USER_ID };