summaryrefslogtreecommitdiffstats
path: root/src/assistant
diff options
context:
space:
mode:
authorAndreas Holzammer <andreas.holzammer.qnx@kdab.com>2012-04-20 10:06:45 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-20 10:40:10 +0200
commitfc081c31741e1011d659fd758bbd7ab3a90ee123 (patch)
treeed60e3238dd1c2352f47df617b0ee721fa3540da /src/assistant
parent0b526b2baed013c23cf856da8816e38e89f34dbf (diff)
Fix assistant build with QT_NO_CLIPBOARD
Change-Id: I2c31525cba5b613ad13368fe11869789e003cbd1 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/assistant')
-rw-r--r--src/assistant/assistant/centralwidget.cpp3
-rw-r--r--src/assistant/assistant/centralwidget.h2
-rw-r--r--src/assistant/assistant/helpviewer.h2
-rw-r--r--src/assistant/assistant/helpviewer_qtb.cpp8
-rw-r--r--src/assistant/assistant/helpviewer_qwv.cpp5
-rw-r--r--src/assistant/assistant/searchwidget.cpp12
6 files changed, 28 insertions, 4 deletions
diff --git a/src/assistant/assistant/centralwidget.cpp b/src/assistant/assistant/centralwidget.cpp
index 9d8a50be7..7ceab5d2f 100644
--- a/src/assistant/assistant/centralwidget.cpp
+++ b/src/assistant/assistant/centralwidget.cpp
@@ -339,12 +339,13 @@ void CentralWidget::connectTabBar()
}
// -- public slots
-
+#ifndef QT_NO_CLIPBOARD
void CentralWidget::copy()
{
TRACE_OBJ
currentHelpViewer()->copy();
}
+#endif
void CentralWidget::home()
{
diff --git a/src/assistant/assistant/centralwidget.h b/src/assistant/assistant/centralwidget.h
index d7d59e4f3..0fbd119ca 100644
--- a/src/assistant/assistant/centralwidget.h
+++ b/src/assistant/assistant/centralwidget.h
@@ -107,7 +107,9 @@ public:
void connectTabBar();
public slots:
+#ifndef QT_NO_CLIPBOARD
void copy();
+#endif
void home();
void zoomIn();
diff --git a/src/assistant/assistant/helpviewer.h b/src/assistant/assistant/helpviewer.h
index 8269adee9..505087754 100644
--- a/src/assistant/assistant/helpviewer.h
+++ b/src/assistant/assistant/helpviewer.h
@@ -111,7 +111,9 @@ public:
static bool launchWithExternalApp(const QUrl &url);
public slots:
+#ifndef QT_NO_CLIPBOARD
void copy();
+#endif
void home();
void forward();
diff --git a/src/assistant/assistant/helpviewer_qtb.cpp b/src/assistant/assistant/helpviewer_qtb.cpp
index a42f4781b..620debed1 100644
--- a/src/assistant/assistant/helpviewer_qtb.cpp
+++ b/src/assistant/assistant/helpviewer_qtb.cpp
@@ -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)
diff --git a/src/assistant/assistant/helpviewer_qwv.cpp b/src/assistant/assistant/helpviewer_qwv.cpp
index 866a08e16..6868ddbd2 100644
--- a/src/assistant/assistant/helpviewer_qwv.cpp
+++ b/src/assistant/assistant/helpviewer_qwv.cpp
@@ -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);
}
diff --git a/src/assistant/assistant/searchwidget.cpp b/src/assistant/assistant/searchwidget.cpp
index a15247370..36ed5dd0f 100644
--- a/src/assistant/assistant/searchwidget.cpp
+++ b/src/assistant/assistant/searchwidget.cpp
@@ -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) {