OSDN Git Service

remove mac and win QClipboard support leftovers
authorIvailo Monev <xakepa10@laimg.moc>
Wed, 1 Apr 2020 12:52:25 +0000 (12:52 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Wed, 1 Apr 2020 12:52:25 +0000 (12:52 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/gui/kernel/qclipboard.cpp
src/gui/kernel/qclipboard.h
src/gui/kernel/qclipboard_x11.cpp
src/gui/text/qtextcontrol.cpp
src/gui/widgets/qlinecontrol.cpp
src/gui/widgets/qlineedit.cpp

index c19edde..198d345 100644 (file)
@@ -107,27 +107,6 @@ QT_BEGIN_NAMESPACE
 
     \endlist
 
-    \section1 Notes for Mac OS X Users
-
-    Mac OS X supports a separate find buffer that holds the current
-    search string in Find operations. This find clipboard can be accessed
-    by specifying the FindBuffer mode.
-
-    \section1 Notes for Windows and Mac OS X Users
-
-    \list
-
-    \i Windows and Mac OS X do not support the global mouse
-    selection; they only supports the global clipboard, i.e. they
-    only add text to the clipboard when an explicit copy or cut is
-    made.
-
-    \i Windows and Mac OS X does not have the concept of ownership;
-    the clipboard is a fully global resource so all applications are
-    notified of changes.
-
-    \endlist
-
     \sa QApplication
 */
 
@@ -225,9 +204,6 @@ QClipboard::~QClipboard()
     the global mouse selection. Support for \c Selection is provided only on 
     systems with a global mouse selection (e.g. X11).
 
-    \value FindBuffer indicates that data should be stored and retrieved from
-    the Find buffer. This mode is used for holding search strings on Mac OS X.
-
     \omitvalue LastMode
 
     \sa QClipboard::supportsSelection()
@@ -312,8 +288,7 @@ QString QClipboard::text(QString &subtype, Mode mode) const
     clipboard is used.  If \a mode is QClipboard::Clipboard, the
     text is retrieved from the global clipboard.  If \a mode is
     QClipboard::Selection, the text is retrieved from the global
-    mouse selection. If \a mode is QClipboard::FindBuffer, the
-    text is retrieved from the search string buffer.
+    mouse selection.
 
     \sa setText(), mimeData()
 */
@@ -330,8 +305,7 @@ QString QClipboard::text(Mode mode) const
     clipboard is used.  If \a mode is QClipboard::Clipboard, the
     text is stored in the global clipboard.  If \a mode is
     QClipboard::Selection, the text is stored in the global
-    mouse selection. If \a mode is QClipboard::FindBuffer, the
-    text is stored in the search string buffer.
+    mouse selection.
 
     \sa text(), setMimeData()
 */
@@ -437,8 +411,7 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)
     clipboard is used.  If \a mode is QClipboard::Clipboard, the
     data is retrieved from the global clipboard.  If \a mode is
     QClipboard::Selection, the data is retrieved from the global
-    mouse selection. If \a mode is QClipboard::FindBuffer, the
-    data is retrieved from the search string buffer.
+    mouse selection.
 
     The text(), image(), and pixmap() functions are simpler
     wrappers for retrieving text, image, and pixmap data.
@@ -457,8 +430,7 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)
     clipboard is used.  If \a mode is QClipboard::Clipboard, the
     data is stored in the global clipboard.  If \a mode is
     QClipboard::Selection, the data is stored in the global
-    mouse selection. If \a mode is QClipboard::FindBuffer, the
-    data is stored in the search string buffer.
+    mouse selection.
 
     The setText(), setImage() and setPixmap() functions are simpler
     wrappers for setting text, image and pixmap data respectively.
@@ -474,8 +446,7 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)
     clipboard is used.  If \a mode is QClipboard::Clipboard, this
     function clears the global clipboard contents.  If \a mode is
     QClipboard::Selection, this function clears the global mouse
-    selection contents. If \a mode is QClipboard::FindBuffer, this 
-    function clears the search string buffer.
+    selection contents.
 
     \sa QClipboard::Mode, supportsSelection()
 */
@@ -487,16 +458,13 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)
 */
 bool QClipboard::supportsSelection() const
 {
-    return supportsMode(Selection);
-}
-
-/*!
-    Returns true if the clipboard supports a separate search buffer; otherwise
-    returns false.
-*/
-bool QClipboard::supportsFindBuffer() const
-{
-    return supportsMode(FindBuffer);
+    // ### remove this method
+#ifdef Q_WS_X11
+    // X11 implementation supports both Clipboard and Selection modes
+    return true;
+#else
+    return false;
+#endif
 }
 
 /*!
@@ -517,17 +485,6 @@ bool QClipboard::ownsSelection() const
     return ownsMode(Selection);
 }
 
-/*!
-    \since 4.2
-
-    Returns true if this clipboard object owns the find buffer data;
-    otherwise returns false.
-*/
-bool QClipboard::ownsFindBuffer() const
-{
-    return ownsMode(FindBuffer);
-}
-
 /*! 
     \internal
     \fn bool QClipboard::supportsMode(Mode mode) const;
@@ -551,15 +508,10 @@ void QClipboard::emitChanged(Mode mode)
     switch (mode) {
         case Clipboard:
             emit dataChanged();
-        break;
+            break;
         case Selection:
             emit selectionChanged();
-        break;
-        case FindBuffer:
-            emit findBufferChanged();
-        break;
-        default:
-        break;
+            break;
     }
     emit changed(mode);
 }
index 3a0bdea..f040a94 100644 (file)
@@ -55,16 +55,14 @@ private:
     ~QClipboard();
 
 public:
-    enum Mode { Clipboard, Selection, FindBuffer, LastMode = FindBuffer };
+    enum Mode { Clipboard, Selection, LastMode = Selection };
 
     void clear(Mode mode = Clipboard);
 
     bool supportsSelection() const;
-    bool supportsFindBuffer() const;
 
     bool ownsSelection() const;
     bool ownsClipboard() const;
-    bool ownsFindBuffer() const;
 
     QString text(Mode mode = Clipboard) const;
     QString text(QString& subtype, Mode mode = Clipboard) const;
@@ -81,11 +79,9 @@ public:
 Q_SIGNALS:
     void changed(QClipboard::Mode mode);
     void selectionChanged();
-    void findBufferChanged();
     void dataChanged();
 
 protected:
-    void connectNotify(const char *);
     bool event(QEvent *);
 
     friend class QApplication;
@@ -95,7 +91,6 @@ protected:
 private:
     Q_DISABLE_COPY(QClipboard)
 
-    bool supportsMode(Mode mode) const;
     bool ownsMode(Mode mode) const;
     void emitChanged(Mode mode);
 };
index 3dceaba..7ff038a 100644 (file)
@@ -438,12 +438,6 @@ void QClipboard::clear(Mode mode)
     setMimeData(0, mode);
 }
 
-
-bool QClipboard::supportsMode(Mode mode) const
-{
-    return (mode == Clipboard || mode == Selection);
-}
-
 bool QClipboard::ownsMode(Mode mode) const
 {
     if (mode == Clipboard)
@@ -751,13 +745,6 @@ static Atom send_selection(QClipboardData *d, Atom target, Window window, Atom p
     return property;
 }
 
-/*! \internal
-    Internal optimization for Windows.
-*/
-void QClipboard::connectNotify(const char *)
-{ }
-
-
 bool QClipboard::event(QEvent *e)
 {
     if (e->type() == QEvent::Timer) {
index a1c6027..be7809f 100644 (file)
@@ -583,12 +583,11 @@ void QTextControlPrivate::_q_updateCurrentCharFormatAndSelection()
 #ifndef QT_NO_CLIPBOARD
 void QTextControlPrivate::setClipboardSelection()
 {
-    QClipboard *clipboard = QApplication::clipboard();
-    if (!cursor.hasSelection() || !clipboard->supportsSelection())
+    if (!cursor.hasSelection())
         return;
     Q_Q(QTextControl);
     QMimeData *data = q->createMimeDataFromSelection();
-    clipboard->setMimeData(data, QClipboard::Selection);
+    QApplication::clipboard()->setMimeData(data, QClipboard::Selection);
 }
 #endif
 
@@ -1644,9 +1643,7 @@ void QTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton button, c
 #ifndef QT_NO_CLIPBOARD
         setClipboardSelection();
         selectionChanged(true);
-    } else if (button == Qt::MiddleButton
-               && (interactionFlags & Qt::TextEditable)
-               && QApplication::clipboard()->supportsSelection()) {
+    } else if (button == Qt::MiddleButton && (interactionFlags & Qt::TextEditable)) {
         setCursorPosition(pos);
         const QMimeData *md = QApplication::clipboard()->mimeData(QClipboard::Selection);
         if (md)
index 926a509..ec595d5 100644 (file)
@@ -1409,13 +1409,11 @@ void QLineControl::processMouseEvent(QMouseEvent* ev)
         case QEvent::GraphicsSceneMouseRelease:
         case QEvent::MouseButtonRelease:
 #ifndef QT_NO_CLIPBOARD
-            if (QApplication::clipboard()->supportsSelection()) {
-                if (ev->button() == Qt::LeftButton) {
-                    copy(QClipboard::Selection);
-                } else if (!isReadOnly() && ev->button() == Qt::MiddleButton) {
-                    deselect();
-                    insert(QApplication::clipboard()->text(QClipboard::Selection));
-                }
+            if (ev->button() == Qt::LeftButton) {
+                copy(QClipboard::Selection);
+            } else if (!isReadOnly() && ev->button() == Qt::MiddleButton) {
+                deselect();
+                insert(QApplication::clipboard()->text(QClipboard::Selection));
             }
 #endif
             break;
index 9252e63..d968399 100644 (file)
@@ -1384,13 +1384,11 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e)
     }
 #endif
 #ifndef QT_NO_CLIPBOARD
-    if (QApplication::clipboard()->supportsSelection()) {
-        if (e->button() == Qt::LeftButton) {
-            d->control->copy(QClipboard::Selection);
-        } else if (!d->control->isReadOnly() && e->button() == Qt::MiddleButton) {
-            deselect();
-            insert(QApplication::clipboard()->text(QClipboard::Selection));
-        }
+    if (e->button() == Qt::LeftButton) {
+        d->control->copy(QClipboard::Selection);
+    } else if (!d->control->isReadOnly() && e->button() == Qt::MiddleButton) {
+        deselect();
+        insert(QApplication::clipboard()->text(QClipboard::Selection));
     }
 #endif