lyx_mirror/src/frontends/qt4/GuiClipboard.C
Georg Baum e33bac93cd Fix clipboard/selection encoding
* src/frontends/qt[34]/qt_helpers.[Ch]
	(toqstr): add variant for docstring
	(qstring_to_ucs4): Use docstring and port from qt4 to qt3

	* Many other files: Many std::string -> lyx::docstring conversions

	* src/support/lstrings.[Ch]
	(subst): Add variant for docstring and char_type
	(externalLineEnding): std::string -> lyx::docstring
	(internalLineEnding): std::string -> lyx::docstring


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14871 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-03 07:02:38 +00:00

55 lines
1.2 KiB
C

// -*- C++ -*-
/**
* \file qt4/GuiClipboard.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "GuiClipboard.h"
#include "qt_helpers.h"
#include "debug.h"
#include <QApplication>
#include <QClipboard>
#include <QString>
#include "support/lstrings.h"
using lyx::support::internalLineEnding;
using lyx::support::externalLineEnding;
using std::endl;
namespace lyx {
namespace frontend {
docstring const GuiClipboard::get() const
{
QString const str = qApp->clipboard()->text(QClipboard::Clipboard);
lyxerr[Debug::ACTION] << "GuiClipboard::get: " << fromqstr(str)
<< endl;
if (str.isNull())
return docstring();
return internalLineEnding(qstring_to_ucs4(str));
}
void GuiClipboard::put(docstring const & str)
{
lyxerr[Debug::ACTION] << "GuiClipboard::put: " << lyx::to_utf8(str) << endl;
qApp->clipboard()->setText(toqstr(externalLineEnding(str)),
QClipboard::Clipboard);
}
} // namespace frontend
} // namespace lyx