]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiClipboard.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / GuiClipboard.C
index 6e951a4f45d14d73f25ae18554d8f15686b8c3da..ea7d891ad32026c1bd27621c3e756a258b2ccf62 100644 (file)
@@ -26,50 +26,28 @@ using lyx::support::internalLineEnding;
 using lyx::support::externalLineEnding;
 
 using std::endl;
-using std::string;
 
 namespace lyx {
 namespace frontend {
 
-#ifdef Q_WS_X11
-QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Selection;
-#else
-// FIXME external clipboard support is mostly broken for windows
-// because the following fixe would involves too much side effects WRT mouse selection.
-//QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Clipboard;
-QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Selection;
-#endif
-
-void GuiClipboard::haveSelection(bool own)
-{
-       if (!qApp->clipboard()->supportsSelection())
-               return;
-
-       if (own) {
-               qApp->clipboard()->setText(QString(), CLIPBOARD_MODE);
-       }
-       // We don't need to do anything if own = false, as this case is
-       // handled by QT.
-}
-
-
-string const GuiClipboard::get() const
+docstring const GuiClipboard::get() const
 {
-       QString str = qApp->clipboard()->text(CLIPBOARD_MODE);
-       lyxerr[Debug::ACTION] << "GuiClipboard::get: " << (const char*) str
+       QString const str = qApp->clipboard()->text(QClipboard::Clipboard);
+       lyxerr[Debug::ACTION] << "GuiClipboard::get: " << fromqstr(str)
                              << endl;
        if (str.isNull())
-               return string();
+               return docstring();
 
-       return internalLineEnding(fromqstr(str));
+       return internalLineEnding(qstring_to_ucs4(str));
 }
 
 
-void GuiClipboard::put(string const & str)
+void GuiClipboard::put(docstring const & str)
 {
-       lyxerr[Debug::ACTION] << "GuiClipboard::put: " << str << endl;
+       lyxerr[Debug::ACTION] << "GuiClipboard::put: " << lyx::to_utf8(str) << endl;
 
-       qApp->clipboard()->setText(toqstr(externalLineEnding(str)), CLIPBOARD_MODE);
+       qApp->clipboard()->setText(toqstr(externalLineEnding(str)),
+                                  QClipboard::Clipboard);
 }
 
 } // namespace frontend