diff options
-rw-r--r-- | src/gui/serverdialog.cpp | 18 | ||||
-rw-r--r-- | src/gui/serverdialog.h | 3 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index da95b6a1..44998bcc 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -169,6 +169,8 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir): mServersListModel = new ServersListModel(&mServers, this); mServersList = new ListBox(mServersListModel); + mServersList->addMouseListener(this); + ScrollArea *usedScroll = new ScrollArea(mServersList); usedScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); @@ -371,20 +373,30 @@ void ServerDialog::valueChanged(const gcn::SelectionEvent &) mPortField->setText(toString(myServer.port)); switch (myServer.type) { - case ServerInfo::UNKNOWN: - mTypeField->setSelected(2); - break; case ServerInfo::EATHENA: mTypeField->setSelected(0); break; case ServerInfo::MANASERV: mTypeField->setSelected(1); + default: + mTypeField->setSelected(2); + break; } setFieldsReadOnly(true); mDeleteButton->setEnabled(myServer.save); } +void ServerDialog::mouseClicked(gcn::MouseEvent &mouseEvent) +{ + if (mouseEvent.getClickCount() == 2 && + mouseEvent.getSource() == mServersList) + { + action(gcn::ActionEvent(mConnectButton, + mConnectButton->getActionEventId())); + } +} + void ServerDialog::logic() { { diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h index 6a7091c2..3d7dca9d 100644 --- a/src/gui/serverdialog.h +++ b/src/gui/serverdialog.h @@ -32,6 +32,7 @@ #include <guichan/actionlistener.hpp> #include <guichan/keylistener.hpp> #include <guichan/listmodel.hpp> +#include <guichan/mouselistener.hpp> #include <guichan/selectionlistener.hpp> #include <string> @@ -134,6 +135,8 @@ class ServerDialog : public Window, */ void valueChanged(const gcn::SelectionEvent &event); + void mouseClicked(gcn::MouseEvent &mouseEvent); + void logic(); protected: |