aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-06-01 16:25:09 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-06-01 16:25:09 +0200
commitc88b4129ffd06b9a230a2621cbcf3610905fc15c (patch)
treea26ba85d6788517feb33b5b15bd878650f9d6081 /src
parentProfile attributes (diff)
downloadsmolbote-c88b4129ffd06b9a230a2621cbcf3610905fc15c.tar.xz
Add ProfileManagerDialog
Diffstat (limited to 'src')
-rw-r--r--src/browser.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index b10ff6a..be9d6b5 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -35,7 +35,7 @@ inline QVector<Plugin> loadPlugins(const QString &location)
if(loader.load()) {
#ifdef QT_DEBUG
- qDebug("Loading plugin: %s [ok]", qUtf8Printable(name));
+ qDebug("Loading plugin: %s [ok]", qUtf8Printable(pluginsDir.absoluteFilePath(name)));
#endif
Plugin p;
p.instance = std::shared_ptr<QObject>(loader.instance());
@@ -125,8 +125,12 @@ void Browser::setup(const QString &defaultProfile)
if(p.instance->inherits("ProfileInterface")) {
auto *profileEditor = qobject_cast<ProfileInterface *>(p.instance.get());
Q_ASSERT_X(profileEditor != nullptr, "Browser::setup", "profile interface cast failed");
- m_commands.insert("profileEditor:editDefaultProfile", [profileEditor]() -> int {
- return profileEditor->createWidget(WebProfile::defaultProfile(), nullptr)->exec();
+ m_commands.insert("profileEditor:edit", [this, profileEditor]() -> int {
+ QHash<QString,QWebEngineProfile *> p;
+ for(const QString &key : m_profiles.keys()) {
+ p.insert(key, m_profiles.value(key));
+ }
+ return profileEditor->createWidget(p, nullptr)->exec();
});
}
}
@@ -229,9 +233,13 @@ MainWindow *Browser::createWindow()
auto *profileEditor = qobject_cast<ProfileInterface *>(p.instance.get());
if(profileEditor) {
auto *profileAction = new QAction(tr("Profile"), window);
- connect(profileAction, &QAction::triggered, window, [profileEditor]() {
- //window->currentSubWindow()
- profileEditor->createWidget(WebProfile::defaultProfile(), nullptr)->show();
+ connect(profileAction, &QAction::triggered, window, [this, profileEditor]() {
+ QHash<QString,QWebEngineProfile *> p;
+ for(const QString &key : m_profiles.keys()) {
+ p.insert(key, m_profiles.value(key));
+ }
+ profileEditor->createWidget(p, nullptr)->show();
+ //profileEditor->createWidget(WebProfile::defaultProfile(), nullptr)->show();
});
window->addAction(MainWindow::ToolsMenu, profileAction);
}