summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtWebView.cpp')
-rw-r--r--Swift/QtUI/QtWebView.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Swift/QtUI/QtWebView.cpp b/Swift/QtUI/QtWebView.cpp
index abdc17a..967be1a 100644
--- a/Swift/QtUI/QtWebView.cpp
+++ b/Swift/QtUI/QtWebView.cpp
@@ -1,68 +1,68 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swift/QtUI/QtWebView.h>
#include <boost/numeric/conversion/cast.hpp>
#include <QFocusEvent>
#include <QKeyEvent>
#include <QKeySequence>
#include <QMenu>
#include <Swiften/Base/Log.h>
namespace Swift {
QtWebView::QtWebView(QWidget* parent) : QWebView(parent), fontSizeIsMinimal(false) {
setRenderHint(QPainter::SmoothPixmapTransform);
filteredActions.push_back(QWebPage::CopyLinkToClipboard);
filteredActions.push_back(QWebPage::CopyImageToClipboard);
filteredActions.push_back(QWebPage::Copy);
if (Log::getLogLevel() == Log::debug) {
filteredActions.push_back(QWebPage::InspectElement);
}
}
void QtWebView::keyPressEvent(QKeyEvent* event) {
Qt::KeyboardModifiers modifiers = event->modifiers();
int key = event->key();
- if (event->matches(QKeySequence::ZoomIn)) {
+ if (event->matches(QKeySequence::ZoomIn) || (key == Qt::Key_Equal && (modifiers & Qt::ControlModifier))) {
event->accept();
emit fontGrowRequested();
return;
}
- if (event->matches(QKeySequence::ZoomOut)) {
+ if (event->matches(QKeySequence::ZoomOut) || (key == Qt::Key_Minus && (modifiers & Qt::ControlModifier))) {
event->accept();
emit fontShrinkRequested();
return;
}
if (modifiers == Qt::ShiftModifier && (key == Qt::Key_PageUp || key == Qt::Key_PageDown)) {
modifiers = Qt::NoModifier;
}
QKeyEvent* translatedEvent = new QKeyEvent(QEvent::KeyPress,
key,
modifiers,
event->text(),
event->isAutoRepeat(),
boost::numeric_cast<unsigned short>(event->count()));
QWebView::keyPressEvent(translatedEvent);
delete translatedEvent;
}
void QtWebView::dragEnterEvent(QDragEnterEvent*) {
}
void QtWebView::setFontSizeIsMinimal(bool minimum) {
fontSizeIsMinimal = minimum;
}
void QtWebView::contextMenuEvent(QContextMenuEvent* ev) {
// Filter out the relevant actions from the standard actions
QMenu* menu = page()->createStandardContextMenu();
QList<QAction*> actions(menu->actions());