Readd create key menu items

This commit is contained in:
Dominik Schürmann 2014-03-13 19:01:24 +01:00
parent cf51e5ff56
commit 4c5ae3cdaa
3 changed files with 59 additions and 14 deletions

View File

@ -53,19 +53,45 @@ public class KeyListActivity extends DrawerActivity {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.menu_key_list_import: case R.id.menu_key_list_import:
Intent intentImport = new Intent(this, ImportKeysActivity.class); Intent intentImport = new Intent(this, ImportKeysActivity.class);
startActivityForResult(intentImport, 0); startActivityForResult(intentImport, 0);
return true; return true;
case R.id.menu_key_list_export: case R.id.menu_key_list_export:
// TODO fix this for unified keylist // TODO fix this for unified keylist
mExportHelper.showExportKeysDialog(null, Id.type.public_key, Constants.path.APP_DIR_FILE_PUB); mExportHelper.showExportKeysDialog(null, Id.type.public_key, Constants.path.APP_DIR_FILE_PUB);
return true; return true;
default: case R.id.menu_key_list_create:
return super.onOptionsItemSelected(item); createKey();
return true;
case R.id.menu_key_list_create_expert:
createKeyExpert();
return true;
case R.id.menu_key_list_secret_export:
mExportHelper.showExportKeysDialog(null, Id.type.secret_key, Constants.path.APP_DIR_FILE_SEC);
default:
return super.onOptionsItemSelected(item);
} }
} }
private void createKey() {
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() {
Intent intent = new Intent(this, EditKeyActivity.class);
intent.setAction(EditKeyActivity.ACTION_CREATE_KEY);
startActivityForResult(intent, 0);
}
} }

View File

@ -7,14 +7,32 @@
app:showAsAction="ifRoom|withText" app:showAsAction="ifRoom|withText"
android:icon="@drawable/ic_action_add_person" android:icon="@drawable/ic_action_add_person"
android:title="@string/menu_import" /> android:title="@string/menu_import" />
<item
android:id="@+id/menu_key_list_export"
app:showAsAction="never"
android:title="@string/menu_export_keys" />
<item <item
android:id="@+id/menu_key_list_search" android:id="@+id/menu_key_list_search"
android:title="@string/menu_search" android:title="@string/menu_search"
android:icon="@drawable/ic_action_search" android:icon="@drawable/ic_action_search"
app:actionViewClass="android.support.v7.widget.SearchView" app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="collapseActionView|ifRoom" /> app:showAsAction="collapseActionView|ifRoom" />
<item
android:id="@+id/menu_key_list_create"
app:showAsAction="never"
android:title="@string/menu_create_key" />
<item
android:id="@+id/menu_key_list_create_expert"
app:showAsAction="never"
android:title="@string/menu_create_key_expert" />
<item
android:id="@+id/menu_key_list_export"
app:showAsAction="never"
android:title="@string/menu_export_keys" />
<item
android:id="@+id/menu_key_list_secret_export"
app:showAsAction="never"
android:title="@string/menu_export_secret_keys" />
</menu> </menu>

View File

@ -78,6 +78,7 @@
<string name="menu_import">Import</string> <string name="menu_import">Import</string>
<string name="menu_import_from_nfc">Import from NFC</string> <string name="menu_import_from_nfc">Import from NFC</string>
<string name="menu_export_keys">Export all keys</string> <string name="menu_export_keys">Export all keys</string>
<string name="menu_export_secret_keys">Export all secret keys</string>
<string name="menu_export_key">Export to file</string> <string name="menu_export_key">Export to file</string>
<string name="menu_delete_key">Delete key</string> <string name="menu_delete_key">Delete key</string>
<string name="menu_create_key">Create key</string> <string name="menu_create_key">Create key</string>