]> git.lyx.org Git - features.git/commitdiff
GuiLog: Use GuiClipboard to put the log on the clipboard
authorVincent van Ravesteijn <vfr@lyx.org>
Tue, 29 Apr 2014 13:28:21 +0000 (15:28 +0200)
committerVincent van Ravesteijn <vfr@lyx.org>
Tue, 29 Apr 2014 13:38:35 +0000 (15:38 +0200)
All direct interaction with the Qt clipboard is now done in either GuiClipboard or GuiSelection.

src/frontends/Clipboard.h
src/frontends/qt4/GuiClipboard.cpp
src/frontends/qt4/GuiClipboard.h
src/frontends/qt4/GuiLog.cpp

index 980c6bcbf7f0791bc60f6a031c7322cd63ea9892..faf4e0a8fe37d423cdcad09ce9575ab6c9783e00 100644 (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?
index 2df20a0cba2d700c9b5062ce03d8133cdbaa6d88..d96dd26f0be90fdaa5fe793208fbd7fa8a0a3981 100644 (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 << "' `"
index 3ffdafcef631a79cd377f4062a84f547a0b53742..392f0594c600102f0cafd0f718e8b9b82a7cfa3d 100644 (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;
index 8c74139e039c02ae45b7a1f566a2586beeb5e971..d81849a5ec659adaf8c4b96a1b3b3906f773f297 100644 (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()));
 }