summaryrefslogtreecommitdiff
path: root/src/gui/windows
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
parent05d41da56882a14b44648c8daed5f50979154c16 (diff)
downloadplus-4642291e19a5a98d07c067baddf1b5fafbab943a.tar.gz
plus-4642291e19a5a98d07c067baddf1b5fafbab943a.tar.bz2
plus-4642291e19a5a98d07c067baddf1b5fafbab943a.tar.xz
plus-4642291e19a5a98d07c067baddf1b5fafbab943a.zip
Fix popup menu for channel chat tab.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/chatwindow.cpp29
-rw-r--r--src/gui/windows/chatwindow.h3
2 files changed, 21 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,
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index 313a65803..acecdcaf2 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -294,6 +294,7 @@ class ChatWindow final : public Window,
#endif
protected:
+ friend class ChannelTab;
friend class ChatTab;
friend class WhisperTab;
friend class PopupMenu;
@@ -308,6 +309,8 @@ class ChatWindow final : public Window,
void removeWhisper(const std::string &nick);
+ void removeChannel(const std::string &nick);
+
void autoComplete();
std::string addColors(std::string &msg);