aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-10-06 15:40:25 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-10-06 15:40:25 +0200
commit3e6bed362176dfa53dbaa082e2b0be45bd7cf087 (patch)
treedd1c5b742566d56e8d9190d4f60d82d0cffec7c4
parentbookmarks: save folder expanded state (diff)
downloadsmolbote-3e6bed362176dfa53dbaa082e2b0be45bd7cf087.tar.xz
Add "subwindow.shortcuts.menu" shortcut
-rw-r--r--lib/configuration/configuration.cpp3
-rw-r--r--src/mainwindow/mainwindow.cpp19
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/configuration/configuration.cpp b/lib/configuration/configuration.cpp
index 1edd9ed..0898c09 100644
--- a/lib/configuration/configuration.cpp
+++ b/lib/configuration/configuration.cpp
@@ -65,7 +65,7 @@ Configuration::Configuration(QObject *parent)
("mainwindow.shortcuts.newGroup", po::value<std::string>()->default_value("Ctrl+G"))
("mainwindow.shortcuts.newWindow", po::value<std::string>()->default_value("Ctrl+N"))
- ("mainwindow.shortcuts.about", po::value<std::string>()->default_value("F1"))
+ ("mainwindow.shortcuts.about", po::value<std::string>()->default_value("Ctrl+H"))
("mainwindow.shortcuts.quit", po::value<std::string>()->default_value("Ctrl+Q"))
("mainwindow.shortcuts.search", po::value<std::string>()->default_value("F3"))
@@ -87,6 +87,7 @@ Configuration::Configuration(QObject *parent)
("addressbar.shortcuts.menu", po::value<std::string>()->default_value("F2"))
// subwindow
+ ("subwindow.shortcuts.menu", po::value<std::string>()->default_value("F1"))
("subwindow.shortcuts.new", po::value<std::string>()->default_value("Ctrl+T"))
("subwindow.shortcuts.close", po::value<std::string>()->default_value("Ctrl+X"))
("subwindow.shortcuts.left", po::value<std::string>()->default_value("Ctrl+O"))
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp
index b3a7722..cabc94b 100644
--- a/src/mainwindow/mainwindow.cpp
+++ b/src/mainwindow/mainwindow.cpp
@@ -183,6 +183,19 @@ MainWindow::MainWindow(const std::unique_ptr<Configuration> &config, QWidget *pa
connect(pageLoadProfileMenu, &QMenu::aboutToShow, this, &MainWindow::updatePageLoadProfileMenu);
}
+ // current subwindow shortcut
+ {
+ QAction *subwindowMenuAction = new QAction(this);
+ QMainWindow::addAction(subwindowMenuAction);
+ config->setShortcut(subwindowMenuAction, "subwindow.shortcuts.menu");
+ connect(subwindowMenuAction, &QAction::triggered, this, [this]() {
+ QMdiSubWindow *window = mdiArea->currentSubWindow();
+ if(window) {
+ window->systemMenu()->exec();
+ }
+ });
+ }
+
navigationToolBar = new NavigationBar(config->section("navigation"), this);
navigationToolBar->setMovable(config->value<bool>("navigation.movable").value());
addToolBar(Qt::TopToolBarArea, navigationToolBar);
@@ -313,11 +326,7 @@ void MainWindow::removeDockWidget(QWidget *widget)
void MainWindow::createTab(const QUrl &url)
{
auto *w = qobject_cast<SubWindow *>(mdiArea->currentSubWindow());
- if(w == nullptr) {
- //w = createSubWindow(url.toString());
- // w = createSubWindow(WebProfile::defaultProfile());
- // w->addTab(url);
- } else {
+ if(w != nullptr) {
w->addTab(url);
}
}