1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

. Fixe bug # 122: Some keyboard shortcuts only work when a message is selected

This commit is contained in:
Bao-Long Nguyen-Trong 2008-12-14 06:37:58 +00:00
parent 3217d4b772
commit ec29561d8b

View File

@ -453,26 +453,30 @@ public class FolderMessageList extends ExpandableListActivity {
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
//Shortcuts that work no matter what is selected
switch (keyCode) {
case KeyEvent.KEYCODE_C: { onCompose(); return true;}
case KeyEvent.KEYCODE_Q: { onAccounts(); return true; }
}//switch
//Shortcuts that only work when a message is selected
int group = mListView.getPackedPositionGroup(mListView.getSelectedId()); int group = mListView.getPackedPositionGroup(mListView.getSelectedId());
int item =(mListView.getSelectedItemPosition() -1 ); int item =(mListView.getSelectedItemPosition() -1 );
// Guard against hitting delete on group names // Guard against hitting delete on group names
//
try { try {
MessageInfoHolder message = (MessageInfoHolder) mAdapter.getChild(group, item); MessageInfoHolder message = (MessageInfoHolder) mAdapter.getChild(group, item);
switch (keyCode) { switch (keyCode) {
case KeyEvent.KEYCODE_DEL: { onDelete(message); return true;} case KeyEvent.KEYCODE_DEL: { onDelete(message); return true;}
case KeyEvent.KEYCODE_D: { onDelete(message); return true;} case KeyEvent.KEYCODE_D: { onDelete(message); return true;}
case KeyEvent.KEYCODE_C: { onCompose(); return true;} case KeyEvent.KEYCODE_F: { onForward(message); return true;}
case KeyEvent.KEYCODE_Q: { onAccounts(); return true; } case KeyEvent.KEYCODE_A: { onReplyAll(message); return true; }
case KeyEvent.KEYCODE_F: { onForward(message); return true;} case KeyEvent.KEYCODE_R: { onReply(message); return true; }
case KeyEvent.KEYCODE_A: { onReplyAll(message); return true; }
case KeyEvent.KEYCODE_R: { onReply(message); return true; }
} }
} }
finally { finally {
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
} }
} }//onKeyDown
@Override @Override