aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/browser.cpp12
-rw-r--r--src/browser.h9
2 files changed, 18 insertions, 3 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index e248a3f..46e55d2 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -52,6 +52,18 @@ void Browser::about()
dlg->exec();
}
+QPair<QString, WebProfile *> Browser::loadProfile(const QString &id)
+{
+ Q_ASSERT(m_config);
+ const QDir profilesDir(m_config->value<QString>("profile.path").value());
+
+ auto *profile = ProfileManager::loadProfile(profilesDir.absoluteFilePath(id + ".profile"), m_config->section("profile"));
+ connect(profile, &WebProfile::downloadRequested, m_downloads.get(), &DownloadsWidget::addDownload);
+ profile->setRequestInterceptor(m_urlFilter.get());
+
+ return QPair<QString, WebProfile *>(id, profile);
+}
+
void Browser::setConfiguration(std::unique_ptr<Configuration> &config)
{
Q_ASSERT(config);
diff --git a/src/browser.h b/src/browser.h
index 340a16d..ff84c32 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -36,8 +36,13 @@ public slots:
void about();
public:
- void setConfiguration(std::unique_ptr<Configuration> &config);
+ // interface
Configuration *getConfiguration() const override;
+ const QVector<WebProfile *> profiles() const override;
+ QPair<QString, WebProfile *> loadProfile(const QString &id) override;
+
+ void setConfiguration(std::unique_ptr<Configuration> &config);
+
void registerPlugin(const Plugin &plugin);
void setup(const QString &defaultProfile);
@@ -47,8 +52,6 @@ public:
return m_bookmarks;
}
- const QVector<WebProfile *> profiles() const override;
-
public slots:
void createSession(const QJsonObject &object);
MainWindow *createWindow();