diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-05-01 18:38:54 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-05-01 18:38:54 +0200 |
commit | 19ff096cd450780f16bfe8f699e76f6dc68fe193 (patch) | |
tree | 859a86ab8f3612a4bdef2e9fcf797622ae3d225d /src/mainwindow/mainwindow.cpp | |
parent | Split off addressbar into lib/ (diff) | |
download | smolbote-19ff096cd450780f16bfe8f699e76f6dc68fe193.tar.xz |
Don't open additional tabs when creating subwindows
Diffstat (limited to 'src/mainwindow/mainwindow.cpp')
-rw-r--r-- | src/mainwindow/mainwindow.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 35cc598..f83c2a7 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -102,7 +102,7 @@ void MainWindow::createMenuBar() auto *smolboteMenu = menuBar()->addMenu(qApp->applicationDisplayName()); smolboteMenu->addAction(tr("New tab group"), this, [this]() { - createSubWindow(QUrl::fromUserInput("about:blank")); + createSubWindow(); }, QKeySequence(m_config->value<std::string>("mainwindow.shortcuts.newGroup").value().c_str())); smolboteMenu->addAction(tr("New window"))->setEnabled(false); @@ -160,13 +160,18 @@ void MainWindow::createTab(const QUrl &url) { auto *w = qobject_cast<Window *>(mdiArea->currentSubWindow()); if(w == nullptr) { - w = createSubWindow(url); + w = createSubWindow(url.toString()); } else { w->addTab(url); } } -Window *MainWindow::createSubWindow(const QUrl &url) +Window *MainWindow::currentSubWindow() const +{ + return qobject_cast<Window *>(mdiArea->currentSubWindow()); +} + +Window *MainWindow::createSubWindow(const QString &url) { auto *w = new Window(m_config->section("window"), this); mdiArea->addSubWindow(w); @@ -176,11 +181,11 @@ Window *MainWindow::createSubWindow(const QUrl &url) QJsonObject session; session.insert("profile", ""); QJsonArray urls; - urls.append(url.toString()); + if(!url.isEmpty()) + urls.append(url); session.insert("tabs", urls); - //w->addTab(url); - //w->restoreSession(session); + w->restoreSession(session); return w; } |