aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow/widgets')
-rw-r--r--src/mainwindow/widgets/navigationbar.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/mainwindow/widgets/navigationbar.cpp b/src/mainwindow/widgets/navigationbar.cpp
index 98fe0fa..177c4ad 100644
--- a/src/mainwindow/widgets/navigationbar.cpp
+++ b/src/mainwindow/widgets/navigationbar.cpp
@@ -25,7 +25,10 @@ NavigationBar::NavigationBar(const QHash<QString, QString> &conf, QWidget *paren
// Back button
backAction = addAction(qStyle->standardIcon(QStyle::SP_ArrowBack), tr("Back"));
- backAction->setShortcut(QKeySequence(conf.value("navigation.shortcuts.back")));
+ if(conf.count("navigation.shortcuts.back") > 0) {
+ backAction->setShortcut(QKeySequence(conf.value("navigation.shortcuts.back")));
+ backAction->setToolTip(tr("Back (%1)").arg(conf.value("navigation.shortcuts.back")));
+ }
connect(backAction, &QAction::triggered, this, [this]() {
m_view->history()->back();
});
@@ -42,9 +45,20 @@ NavigationBar::NavigationBar(const QHash<QString, QString> &conf, QWidget *paren
});
backAction->setMenu(backMenu);
+ auto *backMenuShortcut = new QShortcut(QKeySequence(conf.value("navigation.shortcuts.backMenu")), this);
+ connect(backMenuShortcut, &QShortcut::activated, backMenu, [this, backMenu]() {
+ if(backAction->isEnabled()) {
+ auto *widget = this->widgetForAction(backAction);
+ backMenu->exec(this->mapToGlobal(widget->pos() + QPoint(0, widget->height())));
+ }
+ });
+
// Forward button
forwardAction = addAction(qStyle->standardIcon(QStyle::SP_ArrowForward), tr("Forward"));
- forwardAction->setShortcut(QKeySequence(conf.value("navigation.shortcuts.forward")));
+ if(conf.count("navigation.shortcuts.forward") > 0) {
+ forwardAction->setShortcut(QKeySequence(conf.value("navigation.shortcuts.forward")));
+ forwardAction->setToolTip(tr("Forward (%1)").arg(conf.value("navigation.shortcuts.forward")));
+ }
connect(forwardAction, &QAction::triggered, this, [this]() {
m_view->history()->forward();
});
@@ -61,8 +75,16 @@ NavigationBar::NavigationBar(const QHash<QString, QString> &conf, QWidget *paren
});
forwardAction->setMenu(forwardMenu);
+ auto *forwardMenuShortcut = new QShortcut(QKeySequence(conf.value("navigation.shortcuts.forwardMenu")), this);
+ connect(forwardMenuShortcut, &QShortcut::activated, forwardMenu, [this, forwardMenu]() {
+ if(forwardAction->isEnabled()) {
+ auto *widget = this->widgetForAction(forwardAction);
+ forwardMenu->exec(this->mapToGlobal(widget->pos() + QPoint(0, widget->height())));
+ }
+ });
+
// Stop/Refresh button
- stopReloadAction = addAction(qStyle->standardIcon(QStyle::SP_BrowserReload), tr("Reload"));
+ stopReloadAction = addAction(qStyle->standardIcon(QStyle::SP_BrowserReload), tr("Refresh"));
stopReloadAction->setShortcut(QKeySequence(conf.value("navigation.shortcuts.refresh")));
connect(stopReloadAction, &QAction::triggered, this, [this]() {
if(m_view->isLoaded())
@@ -71,6 +93,11 @@ NavigationBar::NavigationBar(const QHash<QString, QString> &conf, QWidget *paren
m_view->stop();
});
+ auto *reloadShortcut = new QShortcut(QKeySequence(conf.value("navigation.shortcuts.reload")), this);
+ connect(reloadShortcut, &QShortcut::activated, this, [this]() {
+ m_view->triggerPageAction(QWebEnginePage::ReloadAndBypassCache);
+ });
+
// Home button
homeAction = addAction(qStyle->standardIcon(QStyle::SP_DirHomeIcon), tr("Home"));
homeAction->setShortcut(QKeySequence(conf.value("navigation.shortcuts.home")));