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

@ -63,9 +63,35 @@ public class KeyListActivity extends DrawerActivity {
mExportHelper.showExportKeysDialog(null, Id.type.public_key, Constants.path.APP_DIR_FILE_PUB);
return true;
case R.id.menu_key_list_create:
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"
android:icon="@drawable/ic_action_add_person"
android:title="@string/menu_import" />
<item
android:id="@+id/menu_key_list_export"
app:showAsAction="never"
android:title="@string/menu_export_keys" />
<item
android:id="@+id/menu_key_list_search"
android:title="@string/menu_search"
android:icon="@drawable/ic_action_search"
app:actionViewClass="android.support.v7.widget.SearchView"
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>

View File

@ -78,6 +78,7 @@
<string name="menu_import">Import</string>
<string name="menu_import_from_nfc">Import from NFC</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_delete_key">Delete key</string>
<string name="menu_create_key">Create key</string>