summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-03-21 18:50:22 -0600
committerJared Adams <jaxad0127@gmail.com>2010-03-21 18:55:18 -0600
commit7365f367e74a1353a6254d8e3adedf52f1b5bdb2 (patch)
treee795537e6178ca678c8b05419eb987b1643deb3d /src/gui
parenteb2a133b9534868b6e0ba86babb5d98b498e07b4 (diff)
downloadmana-client-7365f367e74a1353a6254d8e3adedf52f1b5bdb2.tar.gz
mana-client-7365f367e74a1353a6254d8e3adedf52f1b5bdb2.tar.bz2
mana-client-7365f367e74a1353a6254d8e3adedf52f1b5bdb2.tar.xz
mana-client-7365f367e74a1353a6254d8e3adedf52f1b5bdb2.zip
Make TextDialog send an appropriate event for cancel
Reviewed-by: Chuck Miller
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/socialwindow.cpp36
-rw-r--r--src/gui/textdialog.cpp15
-rw-r--r--src/gui/textdialog.h5
3 files changed, 36 insertions, 20 deletions
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 4fdd5e9e..1396ab98 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -121,6 +121,10 @@ public:
BY_SERVER);
mInviteDialog = NULL;
}
+ else if (event.getId() == "~do invite")
+ {
+ mInviteDialog = NULL;
+ }
else if (event.getId() == "yes")
{
Net::getGuildHandler()->leave(mGuild->getId());
@@ -128,6 +132,10 @@ public:
mGuild->getName().c_str()), BY_SERVER);
mConfirmDialog = NULL;
}
+ else if (event.getId() == "~yes")
+ {
+ mConfirmDialog = NULL;
+ }
}
protected:
@@ -138,7 +146,7 @@ protected:
strprintf(_("Who would you like to invite to guild %s?"),
mGuild->getName().c_str()),
socialWindow);
- mInviteDialog->setOKButtonActionId("do invite");
+ mInviteDialog->setActionEventId("do invite");
mInviteDialog->addActionListener(this);
}
@@ -184,6 +192,10 @@ public:
name.c_str()), BY_SERVER);
mInviteDialog = NULL;
}
+ else if (event.getId() == "~do invite")
+ {
+ mInviteDialog = NULL;
+ }
else if (event.getId() == "yes")
{
Net::getPartyHandler()->leave();
@@ -191,6 +203,10 @@ public:
mParty->getName().c_str()), BY_SERVER);
mConfirmDialog = NULL;
}
+ else if (event.getId() == "~yes")
+ {
+ mConfirmDialog = NULL;
+ }
}
protected:
@@ -201,7 +217,7 @@ protected:
strprintf(_("Who would you like to invite to party %s?"),
mParty->getName().c_str()),
socialWindow);
- mInviteDialog->setOKButtonActionId("do invite");
+ mInviteDialog->setActionEventId("do invite");
mInviteDialog->addActionListener(this);
}
@@ -468,6 +484,12 @@ void SocialWindow::action(const gcn::ActionEvent &event)
Net::getGuildHandler()->create(name);
localChatTab->chatLog(strprintf(_("Creating guild called %s."),
name.c_str()), BY_SERVER);
+
+ mGuildCreateDialog = NULL;
+ }
+ else if (event.getId() == "~create guild")
+ {
+ mGuildCreateDialog = NULL;
}
else if (event.getId() == "create party")
{
@@ -482,6 +504,12 @@ void SocialWindow::action(const gcn::ActionEvent &event)
Net::getPartyHandler()->create(name);
localChatTab->chatLog(strprintf(_("Creating party called %s."),
name.c_str()), BY_SERVER);
+
+ mPartyCreateDialog = NULL;
+ }
+ else if (event.getId() == "~create party")
+ {
+ mPartyCreateDialog = NULL;
}
}
@@ -489,7 +517,7 @@ void SocialWindow::showGuildCreate()
{
mGuildCreateDialog = new TextDialog(_("Guild Name"),
_("Choose your guild's name."), this);
- mGuildCreateDialog->setOKButtonActionId("create guild");
+ mGuildCreateDialog->setActionEventId("create guild");
mGuildCreateDialog->addActionListener(this);
}
@@ -575,6 +603,6 @@ void SocialWindow::showPartyCreate()
mPartyCreateDialog = new TextDialog(_("Party Name"),
_("Choose your party's name."), this);
- mPartyCreateDialog->setOKButtonActionId("create party");
+ mPartyCreateDialog->setActionEventId("create party");
mPartyCreateDialog->addActionListener(this);
}
diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp
index b33b664b..120780fe 100644
--- a/src/gui/textdialog.cpp
+++ b/src/gui/textdialog.cpp
@@ -78,21 +78,14 @@ TextDialog::~TextDialog()
void TextDialog::action(const gcn::ActionEvent &event)
{
- setActionEventId(event.getId());
- distributeActionEvent();
+ if (event.getId() == "CANCEL")
+ setActionEventId("~" + getActionEventId());
- if (event.getId() == "CANCEL" || event.getSource() == mOkButton)
- {
- scheduleDelete();
- }
+ distributeActionEvent();
+ scheduleDelete();
}
const std::string &TextDialog::getText() const
{
return mTextField->getText();
}
-
-void TextDialog::setOKButtonActionId(const std::string &name)
-{
- mOkButton->setActionEventId(name);
-}
diff --git a/src/gui/textdialog.h b/src/gui/textdialog.h
index 825d9ddc..d4c611cc 100644
--- a/src/gui/textdialog.h
+++ b/src/gui/textdialog.h
@@ -56,11 +56,6 @@ public:
*/
const std::string &getText() const;
- /**
- * Set the OK button action id
- */
- void setOKButtonActionId(const std::string &name);
-
static bool isActive() { return instances > 0; }
private: