- actions.add(new KeyAction(Mode.CONTACT_DETAILS, 'e',
- Trans.StringId.KEY_ACTION_EDIT_CONTACT) {
+ actions.add(new KeyAction(Mode.ASK_USER_KEY, 'd',
+ Trans.StringId.KEY_ACTION_DELETE_CONTACT) {
+ @Override
+ public Object getObject() {
+ return getSelectedContact();
+ }
+
+ @Override
+ public String getQuestion() {
+ // TODO i18n
+ return "Delete contact? [Y/N]";
+ }
+
+ @Override
+ public String callback(String answer) {
+ if (answer.equalsIgnoreCase("y")) {
+ Contact contact = getSelectedContact();
+ if (contact != null && contact.delete()) {
+ return null;
+ }
+
+ // TODO i18n
+ return "Cannot delete contact";
+ }
+
+ return null;
+ }
+ });
+ actions.add(new KeyAction(Mode.ASK_USER_KEY, 's',
+ Trans.StringId.KEY_ACTION_SAVE_CARD) {