summaryrefslogtreecommitdiff
path: root/src/gui/serverdialog.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-03-03 07:48:55 -0700
committerJared Adams <jaxad0127@gmail.com>2010-03-03 08:16:36 -0700
commitb1aef06ac85b1ed7db7725e50b2dbfcdfd1a0925 (patch)
tree1ef54acdb35f0ca8f63620773d4ee431ac2122bb /src/gui/serverdialog.cpp
parent4f422bd50c51d812fb9e50f2610c2cd37ead8ef2 (diff)
downloadmana-b1aef06ac85b1ed7db7725e50b2dbfcdfd1a0925.tar.gz
mana-b1aef06ac85b1ed7db7725e50b2dbfcdfd1a0925.tar.bz2
mana-b1aef06ac85b1ed7db7725e50b2dbfcdfd1a0925.tar.xz
mana-b1aef06ac85b1ed7db7725e50b2dbfcdfd1a0925.zip
Connect to a server when it's double clicked
Reviewed-by: Bernd Wachter
Diffstat (limited to 'src/gui/serverdialog.cpp')
-rw-r--r--src/gui/serverdialog.cpp18
1 files changed, 15 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()
{
{