summaryrefslogtreecommitdiff
path: root/src/gui/windows/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-12 22:14:50 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-12 23:17:23 +0300
commit4642291e19a5a98d07c067baddf1b5fafbab943a (patch)
tree33dfc87c07e39fecdcaff5542f744e5828cfaac1 /src/gui/windows/chatwindow.cpp
parent05d41da56882a14b44648c8daed5f50979154c16 (diff)
downloadmv-4642291e19a5a98d07c067baddf1b5fafbab943a.tar.gz
mv-4642291e19a5a98d07c067baddf1b5fafbab943a.tar.bz2
mv-4642291e19a5a98d07c067baddf1b5fafbab943a.tar.xz
mv-4642291e19a5a98d07c067baddf1b5fafbab943a.zip
Fix popup menu for channel chat tab.
Diffstat (limited to 'src/gui/windows/chatwindow.cpp')
-rw-r--r--src/gui/windows/chatwindow.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 3a59279cc..357c76911 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -64,6 +64,8 @@
#include "gui/widgets/tabs/chat/tradetab.h"
#include "gui/widgets/tabs/chat/whispertab.h"
+#include "input/inputmanager.h"
+
#include "render/opengldebug.h"
#include "net/chathandler.h"
@@ -378,15 +380,13 @@ void ChatWindow::closeTab() const
if (!mChatTabs)
return;
- Tab *const tab = mChatTabs->getTabByIndex(
- mChatTabs->getSelectedTabIndex());
+ ChatTab *const tab = dynamic_cast<ChatTab*>(mChatTabs->getTabByIndex(
+ mChatTabs->getSelectedTabIndex()));
if (!tab)
return;
- WhisperTab *const whisper = dynamic_cast<WhisperTab* const>(tab);
- if (!whisper)
- return;
-
- whisper->handleCommand("close", "");
+ const ChatTabType::Type &type = tab->getType();
+ if (type == ChatTabType::WHISPER || type == ChatTabType::CHANNEL)
+ tab->handleCommand("close", "");
}
void ChatWindow::defaultTab()
@@ -546,6 +546,13 @@ void ChatWindow::removeWhisper(const std::string &nick)
mWhispers.erase(tempNick);
}
+void ChatWindow::removeChannel(const std::string &name)
+{
+ std::string tempName = name;
+ toLower(tempName);
+ mChannels.erase(tempName);
+}
+
void ChatWindow::removeAllWhispers()
{
std::list<ChatTab*> tabs;
@@ -681,16 +688,16 @@ void ChatWindow::mousePressed(MouseEvent &event)
if (tab)
{
event.consume();
+ ChatTab *const cTab = dynamic_cast<ChatTab*>(tab);
if (inputManager.isActionActive(static_cast<int>(
InputAction::CHAT_MOD)))
{
- ChatTab *const wTab = dynamic_cast<WhisperTab*>(tab);
- if (wTab)
- wTab->handleCommand("close", "");
+ inputManager.executeChatCommand(
+ InputAction::CLOSE_CHAT_TAB,
+ std::string(), cTab);
}
else
{
- ChatTab *const cTab = dynamic_cast<ChatTab*>(tab);
if (cTab)
{
popupMenu->showChatPopup(viewport->mMouseX,