summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tabs
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/widgets/tabs
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/widgets/tabs')
-rw-r--r--src/gui/widgets/tabs/chat/channeltab.cpp24
-rw-r--r--src/gui/widgets/tabs/chat/channeltab.h3
-rw-r--r--src/gui/widgets/tabs/chat/chattab.h2
3 files changed, 28 insertions, 1 deletions
diff --git a/src/gui/widgets/tabs/chat/channeltab.cpp b/src/gui/widgets/tabs/chat/channeltab.cpp
index f4b26f4bc..43ba86acf 100644
--- a/src/gui/widgets/tabs/chat/channeltab.cpp
+++ b/src/gui/widgets/tabs/chat/channeltab.cpp
@@ -25,6 +25,8 @@
#include "chatlogger.h"
#include "configuration.h"
+#include "gui/widgets/windowcontainer.h"
+
#include "gui/windows/chatwindow.h"
#include "net/chathandler.h"
@@ -40,6 +42,8 @@ ChannelTab::ChannelTab(const Widget2 *const widget,
ChannelTab::~ChannelTab()
{
+ if (chatWindow)
+ chatWindow->removeChannel(mChannelName);
}
void ChannelTab::handleInput(const std::string &msg)
@@ -48,3 +52,23 @@ void ChannelTab::handleInput(const std::string &msg)
newMsg = ChatWindow::doReplace(msg);
chatHandler->privateMessage(mChannelName, newMsg);
}
+
+bool ChannelTab::handleCommand(const std::string &restrict type,
+ const std::string &restrict args A_UNUSED)
+{
+ if (type == "close")
+ {
+ if (windowContainer)
+ windowContainer->scheduleDelete(this);
+ else
+ delete this;
+ if (chatWindow)
+ chatWindow->defaultTab();
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
diff --git a/src/gui/widgets/tabs/chat/channeltab.h b/src/gui/widgets/tabs/chat/channeltab.h
index 4ca3d9379..33ed49987 100644
--- a/src/gui/widgets/tabs/chat/channeltab.h
+++ b/src/gui/widgets/tabs/chat/channeltab.h
@@ -41,6 +41,9 @@ class ChannelTab final : public ChatTab
protected:
void handleInput(const std::string &msg) override final;
+
+ bool handleCommand(const std::string &restrict type,
+ const std::string &restrict args) override final;
};
#endif // GUI_WIDGETS_TABS_CHAT_CHANNELTAB_H
diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h
index 41a02030e..f60a5bc85 100644
--- a/src/gui/widgets/tabs/chat/chattab.h
+++ b/src/gui/widgets/tabs/chat/chattab.h
@@ -134,7 +134,7 @@ class ChatTab notfinal : public Tab
/**
* Returns type of the being.
*/
- int getType() const A_WARN_UNUSED
+ ChatTabType::Type getType() const A_WARN_UNUSED
{ return mType; }
void saveToLogFile(std::string msg) const;