From 6f0494dde874a4d77371b82b1485c32acb4ad470 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 29 Jun 2018 20:07:33 +0200 Subject: Add browser.session --- lib/configuration/configuration.cpp | 1 + src/main.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/configuration/configuration.cpp b/lib/configuration/configuration.cpp index 769c003..b4a3d07 100644 --- a/lib/configuration/configuration.cpp +++ b/lib/configuration/configuration.cpp @@ -59,6 +59,7 @@ Configuration::Configuration(QObject *parent) configuration_desc.add_options() ("browser.stylesheet", po::value()) + ("browser.session", po::value()) // main window ui ("mainwindow.height", po::value()->default_value(720)) diff --git a/src/main.cpp b/src/main.cpp index c2cc0a1..a419775 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -126,6 +126,16 @@ int main(int argc, char **argv) if(sessionJson.open(QIODevice::ReadOnly | QIODevice::Text)) { app.sendMessage(sessionJson.readAll()); sessionJson.close(); + } else { + qWarning("Could not open session [%s].", qUtf8Printable(sessionJson.fileName())); + } + } else if(config->exists("browser.session")) { + QFile sessionJson(config->value("browser.session").value()); + if(sessionJson.open(QIODevice::ReadOnly | QIODevice::Text)) { + app.sendMessage(sessionJson.readAll()); + sessionJson.close(); + } else { + qWarning("Could not open browser.session [%s].", qUtf8Printable(sessionJson.fileName())); } } else app.sendMessage(Session::toJsonObject(config->value("profile.default").value(), urls)); @@ -133,5 +143,5 @@ int main(int argc, char **argv) if(isSingleInstance) return app.exec(); else - return 0; + return EXIT_SUCCESS; } -- cgit v1.2.1