Fix assistant build with QT_NO_CLIPBOARD
authorAndreas Holzammer <andreas.holzammer.qnx@kdab.com>
Fri, 20 Apr 2012 08:06:45 +0000 (10:06 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 20 Apr 2012 08:40:10 +0000 (10:40 +0200)
Change-Id: I2c31525cba5b613ad13368fe11869789e003cbd1
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
src/assistant/assistant/centralwidget.cpp
src/assistant/assistant/centralwidget.h
src/assistant/assistant/helpviewer.h
src/assistant/assistant/helpviewer_qtb.cpp
src/assistant/assistant/helpviewer_qwv.cpp
src/assistant/assistant/searchwidget.cpp

index 9d8a50b..7ceab5d 100644 (file)
@@ -339,12 +339,13 @@ void CentralWidget::connectTabBar()
 }
 
 // -- public slots
-
+#ifndef QT_NO_CLIPBOARD
 void CentralWidget::copy()
 {
     TRACE_OBJ
     currentHelpViewer()->copy();
 }
+#endif
 
 void CentralWidget::home()
 {
index d7d59e4..0fbd119 100644 (file)
@@ -107,7 +107,9 @@ public:
     void connectTabBar();
 
 public slots:
+#ifndef QT_NO_CLIPBOARD
     void copy();
+#endif
     void home();
 
     void zoomIn();
index 8269ade..5050877 100644 (file)
@@ -111,7 +111,9 @@ public:
     static bool launchWithExternalApp(const QUrl &url);
 
 public slots:
+#ifndef QT_NO_CLIPBOARD
     void copy();
+#endif
     void home();
 
     void forward();
index a42f478..620debe 100644 (file)
@@ -51,7 +51,9 @@
 
 #include <QtGui/QContextMenuEvent>
 #include <QtWidgets/QMenu>
+#ifndef QT_NO_CLIPBOARD
 #include <QtGui/QClipboard>
+#endif
 #include <QtWidgets/QApplication>
 
 QT_BEGIN_NAMESPACE
@@ -248,11 +250,13 @@ bool HelpViewer::findText(const QString &text, FindFlags flags, bool incremental
 
 // -- public slots
 
+#ifndef QT_NO_CLIPBOARD
 void HelpViewer::copy()
 {
     TRACE_OBJ
     QTextBrowser::copy();
 }
+#endif
 
 void HelpViewer::forward()
 {
@@ -356,13 +360,17 @@ void HelpViewer::contextMenuEvent(QContextMenuEvent *event)
         if (!link.isEmpty() && link.isValid())
             copyAnchorAction = menu.addAction(tr("Copy &Link Location"));
     } else if (!selectedText().isEmpty()) {
+#ifndef QT_NO_CLIPBOARD
         menu.addAction(tr("Copy"), this, SLOT(copy()));
+#endif
     } else {
         menu.addAction(tr("Reload"), this, SLOT(reload()));
     }
 
+#ifndef QT_NO_CLIPBOARD
     if (copyAnchorAction == menu.exec(event->globalPos()))
         QApplication::clipboard()->setText(link.toString());
+#endif
 }
 
 QVariant HelpViewer::loadResource(int type, const QUrl &name)
index 866a08e..6868ddb 100644 (file)
@@ -394,12 +394,13 @@ bool HelpViewer::findText(const QString &text, FindFlags flags, bool incremental
 }
 
 // -- public slots
-
+#ifndef QT_NO_CLIPBOARD
 void HelpViewer::copy()
 {
     TRACE_OBJ
     triggerPageAction(QWebPage::Copy);
 }
+#endif
 
 void HelpViewer::forward()
 {
@@ -419,10 +420,12 @@ void HelpViewer::keyPressEvent(QKeyEvent *e)
 {
     TRACE_OBJ
     // TODO: remove this once we support multiple keysequences per command
+#ifndef QT_NO_CLIPBOARD
     if (e->key() == Qt::Key_Insert && e->modifiers() == Qt::CTRL) {
         if (!selectedText().isEmpty())
             copy();
     }
+#endif
     QWebView::keyPressEvent(e);
 }
 
index a152473..36ed5dd 100644 (file)
@@ -51,7 +51,9 @@
 #include <QtWidgets/QMenu>
 #include <QtWidgets/QLayout>
 #include <QtGui/QKeyEvent>
+#ifndef QT_NO_CLIPBOARD
 #include <QtGui/QClipboard>
+#endif
 #include <QtWidgets/QApplication>
 #include <QtWidgets/QTextBrowser>
 
@@ -194,10 +196,13 @@ void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
 
     QUrl link = browser->anchorAt(point);
 
-    QKeySequence keySeq(QKeySequence::Copy);
+    QKeySequence keySeq;
+#ifndef QT_NO_CLIPBOARD
+    keySeq = QKeySequence::Copy;
     QAction *copyAction = menu.addAction(tr("&Copy") + QLatin1String("\t") +
         keySeq.toString(QKeySequence::NativeText));
     copyAction->setEnabled(QTextCursor(browser->textCursor()).hasSelection());
+#endif
 
     QAction *copyAnchorAction = menu.addAction(tr("Copy &Link Location"));
     copyAnchorAction->setEnabled(!link.isEmpty() && link.isValid());
@@ -215,6 +220,7 @@ void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
         QLatin1String("\t") + keySeq.toString(QKeySequence::NativeText));
 
     QAction *usedAction = menu.exec(mapToGlobal(contextMenuEvent->pos()));
+#ifndef QT_NO_CLIPBOARD
     if (usedAction == copyAction) {
         QTextCursor cursor = browser->textCursor();
         if (!cursor.isNull() && cursor.hasSelection()) {
@@ -227,7 +233,9 @@ void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
     else if (usedAction == copyAnchorAction) {
         QApplication::clipboard()->setText(link.toString());
     }
-    else if (usedAction == newTabAction) {
+    else
+#endif
+        if (usedAction == newTabAction) {
         emit requestShowLinkInNewTab(link);
     }
     else if (usedAction == selectAllAction) {