diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-12-23 02:55:16 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-12-23 02:55:16 +0100 |
commit | e908d973553011d478e4f81bb6d4c616e0cb6a38 (patch) | |
tree | af7a14a62a6a5b614a7c01e163d33dbd4a0168c2 /src/browser.cpp | |
parent | smolbote can now compile on Qt 5.7.1 (diff) | |
download | smolbote-e908d973553011d478e4f81bb6d4c616e0cb6a38.tar.xz |
Removed SingleApplication::SessionParam
Diffstat (limited to 'src/browser.cpp')
-rw-r--r-- | src/browser.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/browser.cpp b/src/browser.cpp index 25ff5fb..4221eb9 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -98,16 +98,18 @@ MainWindow *Browser::createWindow() return window; } -MainWindow *Browser::createSession(const SessionParam ¶ms) +MainWindow *Browser::createSession(const QString &profileName, bool newWindow, const QStringList &urls) { MainWindow *window = nullptr; - if(params.newWindow || m_windows.isEmpty()) { + + // if we need to open in a new window, or there are no windows, make one + if(newWindow || m_windows.isEmpty()) { window = createWindow(); - window->setProfile(profile(params.profile)); + window->setProfile(profile(profileName)); } else { // reverse-iterate through windows to check for window with the same profile for(auto it = m_windows.rbegin(); it != m_windows.rend(); ++it) { - if((*it)->profile()->storageName() == params.profile) { + if((*it)->profile()->storageName() == profileName) { window = *it; break; } @@ -115,18 +117,18 @@ MainWindow *Browser::createSession(const SessionParam ¶ms) // if none is found, create one if(window == nullptr) { window = createWindow(); - window->setProfile(profile(params.profile)); + window->setProfile(profile(profileName)); } } Q_CHECK_PTR(window); - if(params.urls.isEmpty()) { + if(urls.isEmpty()) { // no URLs were given window->newTab(QUrl::fromUserInput(m_config->value<std::string>("profile.homepage").value().c_str())); } else { - for(const QUrl &url : params.urls) { - window->newTab(url); + for(const QString &url : urls) { + window->newTab(QUrl::fromUserInput(url)); } } |