aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-12-14 14:25:04 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-12-14 14:45:13 +0100
commitf15af11e4b6ad5dfa1be5107c2db0ddad6480f5b (patch)
treefb32290b6a8b2f1b86dca1b483b994a30de9206b /src/mainwindow
parentProfile picker menu: use QActionGroup instead of QRadioButton (diff)
downloadsmolbote-f15af11e4b6ad5dfa1be5107c2db0ddad6480f5b.tar.xz
Add SaveSessionDialog
Diffstat (limited to 'src/mainwindow')
-rw-r--r--src/mainwindow/menubar.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/mainwindow/menubar.cpp b/src/mainwindow/menubar.cpp
index 0429ffd..84ce24f 100644
--- a/src/mainwindow/menubar.cpp
+++ b/src/mainwindow/menubar.cpp
@@ -13,6 +13,7 @@
#include "downloadswidget.h"
#include "mainwindow.h"
#include "profilemanager.h"
+#include "session/savesessiondialog.h"
#include "session/sessiondialog.h"
#include "subwindow/subwindow.h"
#include "webengine/webview.h"
@@ -69,21 +70,18 @@ MenuBar::MenuBar(const Configuration *config, MainWindow *parent)
smolbote->addSeparator();
const QString sessionPath = config->value<QString>("browser.session.path").value();
- smolbote->addAction(tr("Save Session"), parent, [parent, sessionPath]() {
- const QString filename = QFileDialog::getSaveFileName(parent, tr("Save Session"), sessionPath, tr("JSON (*.json)"));
- QFile output(filename);
- if(output.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
- auto *browser = qobject_cast<Browser *>(qApp);
- auto data = Session::_session(browser->windows());
- output.write(QJsonDocument(data).toJson());
- output.close();
- }
+ auto *actionSaveSession = smolbote->addAction(tr("Save Session"), parent, [sessionPath]() {
+ auto *sessionDialog = new SaveSessionDialog(nullptr);
+ if(sessionDialog->exec())
+ sessionDialog->save(sessionPath);
});
+ config->setShortcut(actionSaveSession, "mainwindow.shortcuts.saveSession");
- smolbote->addAction(tr("Open Session"), parent, [parent]() {
+ auto *actionOpenSession = smolbote->addAction(tr("Open Session"), parent, [parent]() {
auto *sessionDialog = new SessionDialog(parent);
sessionDialog->exec();
});
+ config->setShortcut(actionOpenSession, "mainwindow.shortcuts.openSession");
smolbote->addSeparator();
auto *actionBookmarks = smolbote->addAction(tr("Bookmarks"), browser, [browser, parent]() {