From 7432e8857d5e58953326e49e24f79a1fcdbeaef2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 20 Apr 2012 02:51:09 +0300 Subject: Add additional keys handling to servers dialog. --- src/gui/serverdialog.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 56ff99228..d86d93f61 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -413,10 +413,35 @@ void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent) mConnectButton->getActionEventId())); return; + case Input::KEY_GUI_INSERT: + new EditServerDialog(this, ServerInfo(), -1); + return; + + case Input::KEY_GUI_DELETE: + { + int index = mServersList->getSelected(); + if (index >= 0) + { + mServersList->setSelected(0); + mServers.erase(mServers.begin() + index); + saveCustomServers(); + } + return; + } + + case Input::KEY_GUI_BACKSPACE: + { + int index = mServersList->getSelected(); + if (index >= 0) + new EditServerDialog(this, mServers.at(index), index); + return; + } + default: break; } - mServersList->keyPressed(keyEvent); + if (!keyEvent.isConsumed()) + mServersList->keyPressed(keyEvent); } void ServerDialog::valueChanged(const gcn::SelectionEvent &) -- cgit v1.2.3-70-g09d2