Android: Return empty mime data instead of 0 from empty clipboard

This is consistent with other platforms such as iOS and
XCB, which return a QMimeData with an empty text when the clipboard
is empty.

[ChangeLog][Android] QClipboard::mimeData() now returns an empty
object instead of null pointer from QClipboard when clipboard is
empty for consistency with other platforms.

Change-Id: I17068f0afcb63690cf11048ffa60e19dc9b08691
Task-number: QTBUG-41817
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2014-10-09 12:37:56 +02:00
parent aa00020578
commit 9685c72e37

View File

@ -44,10 +44,10 @@ QAndroidPlatformClipboard::QAndroidPlatformClipboard()
QMimeData *QAndroidPlatformClipboard::mimeData(QClipboard::Mode mode)
{
if (QClipboard::Clipboard != mode || !QtAndroidClipboard::hasClipboardText())
return 0;
m_mimeData.setText(QtAndroidClipboard::clipboardText());
Q_ASSERT(supportsMode(mode));
m_mimeData.setText(QtAndroidClipboard::hasClipboardText()
? QtAndroidClipboard::clipboardText()
: QString());
return &m_mimeData;
}