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