GuiLog: Use GuiClipboard to put the log on the clipboard

All direct interaction with the Qt clipboard is now done in either GuiClipboard or GuiSelection.
This commit is contained in:
Vincent van Ravesteijn 2014-04-29 15:28:21 +02:00
parent 847d1fb2f5
commit 2552c737be
4 changed files with 13 additions and 1 deletions

View File

@ -75,6 +75,9 @@ public:
*/
virtual void put(std::string const & lyx, docstring const & html, docstring const & text) = 0;
/// Put a general string on the system clipboard (not LyX text)
virtual void put(std::string const & text) const = 0;
/// Does the clipboard contain text contents?
virtual bool hasTextContents(TextType type = AnyTextType) const = 0;
/// Does the clipboard contain graphics contents of a certain type?

View File

@ -413,6 +413,12 @@ docstring const GuiClipboard::getAsText(TextType type) const
}
void GuiClipboard::put(string const & text) const
{
qApp->clipboard()->setText(toqstr(text));
}
void GuiClipboard::put(string const & lyx, docstring const & html, docstring const & text)
{
LYXERR(Debug::ACTION, "GuiClipboard::put(`" << lyx << "' `"

View File

@ -70,6 +70,7 @@ public:
std::string const getAsLyX() const;
FileName getAsGraphics(Cursor const & cur, GraphicsType type) const;
docstring const getAsText(TextType type) const;
void put(std::string const & text) const;
void put(std::string const & lyx, docstring const & html, docstring const & text);
bool hasGraphicsContents(GraphicsType type = AnyGraphicsType) const;
bool hasTextContents(TextType typetype = AnyTextType) const;

View File

@ -18,6 +18,8 @@
#include "qt_helpers.h"
#include "Lexer.h"
#include "frontends/Clipboard.h"
#include "support/docstring.h"
#include "support/FileName.h"
#include "support/gettext.h"
@ -313,7 +315,7 @@ void GuiLog::getContents(ostream & ss) const
void GuiLog::on_copyPB_clicked()
{
qApp->clipboard()->setText(logTB->toPlainText());
theClipboard().put(fromqstr(logTB->toPlainText()));
}