summaryrefslogtreecommitdiff
path: root/src/gui/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-12-03 21:05:17 +0300
committerAndrei Karas <akaras@inbox.ru>2011-12-03 21:05:17 +0300
commit284458d6c7644159eb14479e9f41127fd400ffdb (patch)
tree802e190c77a337a7645e1b6d01f66dcbbf8ef2e5 /src/gui/chatwindow.cpp
parent5acadea119fc2a89e944dc9431e298e5e9544770 (diff)
downloadplus-284458d6c7644159eb14479e9f41127fd400ffdb.tar.gz
plus-284458d6c7644159eb14479e9f41127fd400ffdb.tar.bz2
plus-284458d6c7644159eb14479e9f41127fd400ffdb.tar.xz
plus-284458d6c7644159eb14479e9f41127fd400ffdb.zip
Allow copy any line from chat log to clipboard by
context menu item "Copy to clipboard".
Diffstat (limited to 'src/gui/chatwindow.cpp')
-rw-r--r--src/gui/chatwindow.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 35b89b839..9ba54016e 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -55,6 +55,7 @@
#include "net/playerhandler.h"
#include "net/net.h"
+#include "utils/copynpaste.h"
#include "utils/dtor.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -1540,4 +1541,18 @@ void ChatWindow::parseHighlights()
bool ChatWindow::findHighlight(std::string &str)
{
return findI(str, mHighlights) != std::string::npos;
-} \ No newline at end of file
+}
+
+void ChatWindow::copyToClipboard(int x, int y)
+{
+ ChatTab *tab = getFocused();
+ if (!tab)
+ return;
+
+ BrowserBox *text = tab->mTextOutput;
+ if (!text)
+ return;
+
+ std::string str = text->getTextAtPos(x, y);
+ sendBuffer(str);
+}