summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtWebView.cpp')
-rw-r--r--Swift/QtUI/QtWebView.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Swift/QtUI/QtWebView.cpp b/Swift/QtUI/QtWebView.cpp
index 5d25071..5f9539e 100644
--- a/Swift/QtUI/QtWebView.cpp
+++ b/Swift/QtUI/QtWebView.cpp
@@ -33,18 +33,22 @@ void QtWebView::keyPressEvent(QKeyEvent* event) {
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());
for (int i = 0; i < actions.size(); ++i) {
QAction* action = actions.at(i);
bool removeAction = true;
for(size_t j = 0; j < filteredActions.size(); ++j) {
if (action == pageAction(filteredActions[j])) {
@@ -54,19 +58,22 @@ void QtWebView::contextMenuEvent(QContextMenuEvent* ev) {
}
if (removeAction) {
menu->removeAction(action);
}
}
// Add our own custom actions
menu->addAction(tr("Clear"), this, SIGNAL(clearRequested()));
menu->addAction(tr("Increase font size"), this, SIGNAL(fontGrowRequested()));
- menu->addAction(tr("Decrease font size"), this, SIGNAL(fontShrinkRequested()));
+ QAction* shrink = new QAction(tr("Decrease font size"), this);
+ shrink->setEnabled(!fontSizeIsMinimal);
+ connect(shrink, SIGNAL(triggered()), this, SIGNAL(fontShrinkRequested()));
+ menu->addAction(shrink);
menu->exec(ev->globalPos());
delete menu;
}
void QtWebView::focusInEvent(QFocusEvent* event) {
QWebView::focusInEvent(event);
emit gotFocus();
}