| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qplatformclipboard.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||
| 2 | ** | - | ||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||
| 5 | ** | - | ||||||
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||
| 7 | ** | - | ||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||
| 9 | ** Commercial License Usage | - | ||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||
| 16 | ** | - | ||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||
| 25 | ** | - | ||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||
| 29 | ** | - | ||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||
| 31 | ** | - | ||||||
| 32 | ****************************************************************************/ | - | ||||||
| 33 | #include "qplatformclipboard.h" | - | ||||||
| 34 | - | |||||||
| 35 | #ifndef QT_NO_CLIPBOARD | - | ||||||
| 36 | - | |||||||
| 37 | #include <QtGui/private/qguiapplication_p.h> | - | ||||||
| 38 | #include <QtCore/qmimedata.h> | - | ||||||
| 39 | - | |||||||
| 40 | QT_BEGIN_NAMESPACE | - | ||||||
| 41 | - | |||||||
| 42 | class QClipboardData | - | ||||||
| 43 | { | - | ||||||
| 44 | public: | - | ||||||
| 45 | QClipboardData(); | - | ||||||
| 46 | ~QClipboardData(); | - | ||||||
| 47 | - | |||||||
| 48 | void setSource(QMimeData* s) | - | ||||||
| 49 | { | - | ||||||
| 50 | if (s == src)
| 0 | ||||||
| 51 | return; never executed: return; | 0 | ||||||
| 52 | delete src; | - | ||||||
| 53 | src = s; | - | ||||||
| 54 | } never executed: end of block | 0 | ||||||
| 55 | QMimeData* source() | - | ||||||
| 56 | { return src; } never executed: return src; | 0 | ||||||
| 57 | - | |||||||
| 58 | private: | - | ||||||
| 59 | QMimeData* src; | - | ||||||
| 60 | }; | - | ||||||
| 61 | - | |||||||
| 62 | QClipboardData::QClipboardData() | - | ||||||
| 63 | { | - | ||||||
| 64 | src = 0; | - | ||||||
| 65 | } never executed: end of block | 0 | ||||||
| 66 | - | |||||||
| 67 | QClipboardData::~QClipboardData() | - | ||||||
| 68 | { | - | ||||||
| 69 | delete src; | - | ||||||
| 70 | } never executed: end of block | 0 | ||||||
| 71 | - | |||||||
| 72 | Q_GLOBAL_STATIC(QClipboardData,q_clipboardData); never executed: end of blocknever executed: guard.store(QtGlobalStatic::Destroyed);never executed: return &holder.value;
| 0 | ||||||
| 73 | - | |||||||
| 74 | /*! | - | ||||||
| 75 | \class QPlatformClipboard | - | ||||||
| 76 | \since 5.0 | - | ||||||
| 77 | \internal | - | ||||||
| 78 | \preliminary | - | ||||||
| 79 | \ingroup qpa | - | ||||||
| 80 | - | |||||||
| 81 | \brief The QPlatformClipboard class provides an abstraction for the system clipboard. | - | ||||||
| 82 | */ | - | ||||||
| 83 | - | |||||||
| 84 | QPlatformClipboard::~QPlatformClipboard() | - | ||||||
| 85 | { | - | ||||||
| 86 | - | |||||||
| 87 | } | - | ||||||
| 88 | - | |||||||
| 89 | QMimeData *QPlatformClipboard::mimeData(QClipboard::Mode mode) | - | ||||||
| 90 | { | - | ||||||
| 91 | //we know its clipboard | - | ||||||
| 92 | Q_UNUSED(mode); | - | ||||||
| 93 | return q_clipboardData()->source(); never executed: return q_clipboardData()->source(); | 0 | ||||||
| 94 | } | - | ||||||
| 95 | - | |||||||
| 96 | void QPlatformClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) | - | ||||||
| 97 | { | - | ||||||
| 98 | //we know its clipboard | - | ||||||
| 99 | Q_UNUSED(mode); | - | ||||||
| 100 | q_clipboardData()->setSource(data); | - | ||||||
| 101 | - | |||||||
| 102 | emitChanged(mode); | - | ||||||
| 103 | } never executed: end of block | 0 | ||||||
| 104 | - | |||||||
| 105 | bool QPlatformClipboard::supportsMode(QClipboard::Mode mode) const | - | ||||||
| 106 | { | - | ||||||
| 107 | return mode == QClipboard::Clipboard; never executed: return mode == QClipboard::Clipboard; | 0 | ||||||
| 108 | } | - | ||||||
| 109 | - | |||||||
| 110 | bool QPlatformClipboard::ownsMode(QClipboard::Mode mode) const | - | ||||||
| 111 | { | - | ||||||
| 112 | Q_UNUSED(mode); | - | ||||||
| 113 | return false; never executed: return false; | 0 | ||||||
| 114 | } | - | ||||||
| 115 | - | |||||||
| 116 | void QPlatformClipboard::emitChanged(QClipboard::Mode mode) | - | ||||||
| 117 | { | - | ||||||
| 118 | if (!QGuiApplicationPrivate::is_app_closing) // QTBUG-39317, prevent emission when closing down.
| 0 | ||||||
| 119 | QGuiApplication::clipboard()->emitChanged(mode); never executed: QGuiApplication::clipboard()->emitChanged(mode); | 0 | ||||||
| 120 | } never executed: end of block | 0 | ||||||
| 121 | - | |||||||
| 122 | QT_END_NAMESPACE | - | ||||||
| 123 | - | |||||||
| 124 | #endif //QT_NO_CLIPBOARD | - | ||||||
| Source code | Switch to Preprocessed file |