diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/socialwindow.cpp | 36 | ||||
-rw-r--r-- | src/gui/textdialog.cpp | 15 | ||||
-rw-r--r-- | src/gui/textdialog.h | 5 |
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: |