summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/kernel.pri6
-rw-r--r--src/gui/kernel/qclipboard_qpa.cpp82
-rw-r--r--src/gui/kernel/qdnd_p.h2
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.cpp101
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.h70
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.cpp18
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.h4
7 files changed, 209 insertions, 74 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 4261e93438..0ff3d883d2 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -222,7 +222,8 @@ qpa {
kernel/qplatformglcontext_qpa.h \
kernel/qdesktopwidget_qpa_p.h \
kernel/qplatformeventloopintegration_qpa.h \
- kernel/qplatformcursor_qpa.h
+ kernel/qplatformcursor_qpa.h \
+ kernel/qplatformclipboard_qpa.h
SOURCES += \
kernel/qapplication_qpa.cpp \
@@ -244,7 +245,8 @@ qpa {
kernel/qplatformwindowformat_qpa.cpp \
kernel/qplatformeventloopintegration_qpa.cpp \
kernel/qplatformglcontext_qpa.cpp \
- kernel/qplatformcursor_qpa.cpp
+ kernel/qplatformcursor_qpa.cpp \
+ kernel/qplatformclipboard_qpa.cpp
contains(QT_CONFIG, glib) {
SOURCES += \
diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp
index 92b9e83255..b8ce60e00d 100644
--- a/src/gui/kernel/qclipboard_qpa.cpp
+++ b/src/gui/kernel/qclipboard_qpa.cpp
@@ -44,73 +44,16 @@
#ifndef QT_NO_CLIPBOARD
#include "qmimedata.h"
-#include "qapplication.h"
+#include "private/qapplication_p.h"
+#include "qplatformclipboard_qpa.h"
QT_BEGIN_NAMESPACE
QT_USE_NAMESPACE
-
-class QClipboardData
-{
-public:
- QClipboardData();
- ~QClipboardData();
-
- void setSource(QMimeData* s)
- {
- if (s == src)
- return;
- delete src;
- src = s;
- }
- QMimeData* source()
- { return src; }
-
- void clear();
-
-private:
- QMimeData* src;
-};
-
-QClipboardData::QClipboardData()
-{
- src = 0;
-}
-
-QClipboardData::~QClipboardData()
-{
- delete src;
-}
-
-void QClipboardData::clear()
-{
- delete src;
- src = 0;
-}
-
-
-static QClipboardData *internalCbData = 0;
-
-static void cleanupClipboardData()
-{
- delete internalCbData;
- internalCbData = 0;
-}
-
-static QClipboardData *clipboardData()
-{
- if (internalCbData == 0) {
- internalCbData = new QClipboardData;
- qAddPostRoutine(cleanupClipboardData);
- }
- return internalCbData;
-}
-
-
void QClipboard::clear(Mode mode)
{
- setText(QString(), mode);
+ setMimeData(0,mode);
}
@@ -121,26 +64,25 @@ bool QClipboard::event(QEvent *e)
const QMimeData* QClipboard::mimeData(Mode mode) const
{
- if (mode != Clipboard) return 0;
-
- QClipboardData *d = clipboardData();
- return d->source();
+ QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
+ if (!clipboard->supportsMode(mode)) return 0;
+ return clipboard->mimeData(mode);
}
void QClipboard::setMimeData(QMimeData* src, Mode mode)
{
- if (mode != Clipboard) return;
-
- QClipboardData *d = clipboardData();
+ QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
+ if (!clipboard->supportsMode(mode)) return;
- d->setSource(src);
+ clipboard->setMimeData(src,mode);
- emitChanged(QClipboard::Clipboard);
+ emitChanged(mode);
}
bool QClipboard::supportsMode(Mode mode) const
{
- return (mode == Clipboard);
+ QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
+ return clipboard->supportsMode(mode);
}
bool QClipboard::ownsMode(Mode mode) const
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index 598a9de8a6..7b23630624 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -76,7 +76,7 @@ class QEventLoop;
#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
-class QInternalMimeData : public QMimeData
+class Q_GUI_EXPORT QInternalMimeData : public QMimeData
{
Q_OBJECT
public:
diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp
new file mode 100644
index 0000000000..fff4e19d9d
--- /dev/null
+++ b/src/gui/kernel/qplatformclipboard_qpa.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qplatformclipboard_qpa.h"
+
+QT_BEGIN_NAMESPACE
+
+class QClipboardData
+{
+public:
+ QClipboardData();
+ ~QClipboardData();
+
+ void setSource(QMimeData* s)
+ {
+ if (s == src)
+ return;
+ delete src;
+ src = s;
+ }
+ QMimeData* source()
+ { return src; }
+
+private:
+ QMimeData* src;
+};
+
+QClipboardData::QClipboardData()
+{
+ src = 0;
+}
+
+QClipboardData::~QClipboardData()
+{
+ delete src;
+}
+
+Q_GLOBAL_STATIC(QClipboardData,q_clipboardData);
+
+QPlatformClipboard::~QPlatformClipboard()
+{
+
+}
+
+const QMimeData *QPlatformClipboard::mimeData(QClipboard::Mode mode) const
+{
+ //we know its clipboard
+ Q_UNUSED(mode);
+ return q_clipboardData()->source();
+}
+
+void QPlatformClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
+{
+ //we know its clipboard
+ Q_UNUSED(mode);
+ q_clipboardData()->setSource(data);
+}
+
+bool QPlatformClipboard::supportsMode(QClipboard::Mode mode) const
+{
+ return mode == QClipboard::Clipboard;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h
new file mode 100644
index 0000000000..3f7bfbbcfe
--- /dev/null
+++ b/src/gui/kernel/qplatformclipboard_qpa.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMCLIPBOARD_QPA_H
+#define QPLATFORMCLIPBOARD_QPA_H
+
+#include <qplatformdefs.h>
+
+#include <QtGui/QClipboard>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class Q_GUI_EXPORT QPlatformClipboard
+{
+public:
+ virtual ~QPlatformClipboard();
+
+ virtual const QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard ) const;
+ virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard);
+ virtual bool supportsMode(QClipboard::Mode mode) const;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+
+#endif //QPLATFORMCLIPBOARD_QPA_H
diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp
index 9b6e59085d..0cac57d3a6 100644
--- a/src/gui/kernel/qplatformintegration_qpa.cpp
+++ b/src/gui/kernel/qplatformintegration_qpa.cpp
@@ -42,6 +42,7 @@
#include "qplatformintegration_qpa.h"
#include <QtGui/QPlatformFontDatabase>
+#include <QtGui/QPlatformClipboard>
QT_BEGIN_NAMESPACE
@@ -94,6 +95,23 @@ QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const
}
/*!
+ Accessor for the platform integrations clipboard.
+
+ Default implementation returns a default QPlatformClipboard.
+
+ \sa QPlatformClipboard
+
+*/
+QPlatformClipboard *QPlatformIntegration::clipboard() const
+{
+ static QPlatformClipboard *clipboard = 0;
+ if (!clipboard) {
+ clipboard = new QPlatformClipboard;
+ }
+ return clipboard;
+}
+
+/*!
\class QPlatformIntegration
\since 4.8
\internal
diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h
index f01b4f4c79..70502455c4 100644
--- a/src/gui/kernel/qplatformintegration_qpa.h
+++ b/src/gui/kernel/qplatformintegration_qpa.h
@@ -59,6 +59,7 @@ class QBlittable;
class QWidget;
class QPlatformEventLoopIntegration;
class QPlatformFontDatabase;
+class QPlatformClipboard;
class Q_GUI_EXPORT QPlatformIntegration
{
@@ -76,8 +77,9 @@ public:
virtual bool isVirtualDesktop() { return false; }
virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const;
-//Fontdatabase integration.
+//Deeper window system integrations
virtual QPlatformFontDatabase *fontDatabase() const;
+ virtual QPlatformClipboard *clipboard() const;
// Experimental in mainthread eventloop integration
// This should only be used if it is only possible to do window system event processing in