atm copy paste primary selection (ie from outside lyx) doesn't work for me

the attached solves it

does this look ok?

thanks
Index: QWorkArea.C
===================================================================
--- QWorkArea.C (revision 13976)
+++ QWorkArea.C (working copy)
@@ -50,6 +50,11 @@
 using lyx::support::subst;
 #endif
 
+#ifdef Q_WS_WIN
+#include <support/lstrings.h>
+using lyx::support::subst;
+#endif
+
 // You can find other qt-immodule, X11 and MACX specific stuff
 // at the end of this file...
 ///////////////////////////////////////////////////////////////
@@ -247,15 +252,20 @@
 
 string const QWorkArea::getClipboard() const
 {
-       QString str = QApplication::clipboard()->text(QClipboard::Selection);
+       QString str = QApplication::clipboard()->text(QClipboard::Clipboard);
        lyxerr[Debug::ACTION] << "getClipboard: " << (const char*) str << endl;
        if (str.isNull())
                return string();
+
 #ifdef Q_WS_MACX
        // The MAC clipboard uses \r for lineendings, and we use \n
        return subst(fromqstr(str), '\r', '\n');
+#endif
+#ifdef Q_WS_WIN
+       // The WIN clipboard uses \r\n for lineendings, and we use \n
+       return subst(fromqstr(str), "\r\n", "\n");
 #else
-       return fromqstr(str);
+       return fromqstr(str); 
 #endif
 }
 
@@ -265,9 +275,14 @@
 #ifdef Q_WS_MACX
        // The MAC clipboard uses \r for lineendings, and we use \n
        QApplication::clipboard()->setText(toqstr(subst(str, '\n', '\r')),
-                                          QClipboard::Selection);
+                                          QClipboard::Clipboard);
+#endif
+#ifdef Q_WS_WIN
+       // The WIN clipboard uses \r\n for lineendings, and we use \n
+       QApplication::clipboard()->setText(toqstr(subst(str, "\n", "\r\n")),
+                                          QClipboard::Clipboard);
 #else
-       QApplication::clipboard()->setText(toqstr(str), QClipboard::Selection);
+       QApplication::clipboard()->setText(toqstr(str), QClipboard::Clipboard);
 #endif
        lyxerr[Debug::ACTION] << "putClipboard: " << str << endl;
 }

Reply via email to