diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-05-06 14:02:18 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-05-06 14:02:18 +0200 |
commit | 1765cacc60d101bb8dddbe990bd729f8cdb5087f (patch) | |
tree | b83dcde4e2a827a30bd6690a42109a238bd5e802 /src | |
parent | Tabifying dock widgets (diff) | |
download | smolbote-1765cacc60d101bb8dddbe990bd729f8cdb5087f.tar.xz |
New window action
Diffstat (limited to 'src')
-rw-r--r-- | src/browser.cpp | 1 | ||||
-rw-r--r-- | src/mainwindow/mainwindow.cpp | 11 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/browser.cpp b/src/browser.cpp index 65a67d5..222174c 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -106,7 +106,6 @@ MainWindow *Browser::createWindow() // the window will delete itself when it closes, so we don't need to delete it MainWindow *window = new MainWindow(m_config); connect(window->addressBar, &AddressBar::complete, m_bookmarks.get(), &BookmarksWidget::search); - //window->createSubWindow(WebProfile::defaultProfile()->newtab()); auto *bookmarksAction = new QAction(tr("Bookmarks"), window); bookmarksAction->setShortcut(QKeySequence(QString::fromStdString(m_config->value<std::string>("bookmarks.shortcut").value()))); diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 5129abc..88a0b42 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -28,6 +28,7 @@ #include <configuration/configuration.h> #include <QJsonObject> #include <QJsonArray> +#include "browser.h" MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent) : QMainWindow(parent) @@ -113,9 +114,13 @@ void MainWindow::createMenuBar() auto *smolboteMenu = menuBar()->addMenu(qApp->applicationDisplayName()); smolboteMenu->addAction(tr("New tab group"), this, [this]() { createSubWindow(); - }, - QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.newGroup").value().c_str())); - smolboteMenu->addAction(tr("New window"))->setEnabled(false); + }, QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.newGroup").value().c_str())); + + smolboteMenu->addAction(tr("New window"), this, [this]() { + auto *browser = qobject_cast<Browser *>(qApp); + if(browser) + browser->createWindow(); + }, QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.newWindow").value().c_str())); smolboteMenu->addSeparator(); |