diff options
Diffstat (limited to 'src/browser.cpp')
-rw-r--r-- | src/browser.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/browser.cpp b/src/browser.cpp index e93123c..1542370 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -10,6 +10,7 @@ #include "addressbar/addressbar.h" #include "mainwindow/mainwindow.h" #include "subwindow/subwindow.h" +#include "util.h" #include "webengine/urlinterceptor.h" #include <QAction> #include <QDir> @@ -111,14 +112,20 @@ void Browser::setup(const QString &defaultProfile) // load profiles m_profileManager = new ProfileManager(m_config->section("profile"), defaultProfile, this); - // connect profiles - for(const QString &id : m_profileManager->idList()) { - auto *profile = m_profileManager->profile(id); - connect(profile, &WebProfile::downloadRequested, m_downloads.get(), &DownloadsWidget::addDownload); - profile->setRequestInterceptor(m_urlFilter.get()); + for(const QString &profilePath : Util::files(m_config->value<QString>("profile.path").value(), { "*.profile" })) { + this->loadProfile(profilePath); } + // set default profile - WebProfile::setDefaultProfile(m_profileManager->profile(defaultProfile)); + { + const QString id = m_config->value<QString>("profile.default").value(); + auto *profile = m_profileManager->profile(id); + if(profile == nullptr) { + profile = this->loadProfile(id).second; + } + + WebProfile::setDefaultProfile(profile); + } // bookmarks m_bookmarks = std::make_shared<BookmarksWidget>(QString::fromStdString(m_config->value<std::string>("bookmarks.path").value())); |