From 284458d6c7644159eb14479e9f41127fd400ffdb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 3 Dec 2011 21:05:17 +0300 Subject: Allow copy any line from chat log to clipboard by context menu item "Copy to clipboard". --- src/gui/chatwindow.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/gui/chatwindow.cpp') 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); +} -- cgit v1.2.3-70-g09d2