commit 2552c737be8a761ab6f6993215f98baa95c09829
Author: Vincent van Ravesteijn <[email protected]>
Date: Tue Apr 29 15:28:21 2014 +0200
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.
diff --git a/src/frontends/Clipboard.h b/src/frontends/Clipboard.h
index 980c6bc..faf4e0a 100644
--- a/src/frontends/Clipboard.h
+++ b/src/frontends/Clipboard.h
@@ -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?
diff --git a/src/frontends/qt4/GuiClipboard.cpp
b/src/frontends/qt4/GuiClipboard.cpp
index 2df20a0..d96dd26 100644
--- a/src/frontends/qt4/GuiClipboard.cpp
+++ b/src/frontends/qt4/GuiClipboard.cpp
@@ -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 << "' `"
diff --git a/src/frontends/qt4/GuiClipboard.h b/src/frontends/qt4/GuiClipboard.h
index 3ffdafc..392f059 100644
--- a/src/frontends/qt4/GuiClipboard.h
+++ b/src/frontends/qt4/GuiClipboard.h
@@ -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;
diff --git a/src/frontends/qt4/GuiLog.cpp b/src/frontends/qt4/GuiLog.cpp
index 8c74139..d81849a 100644
--- a/src/frontends/qt4/GuiLog.cpp
+++ b/src/frontends/qt4/GuiLog.cpp
@@ -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()));
}