aboutsummaryrefslogtreecommitdiff
path: root/plugins/ProfileEditor/profileeditorplugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ProfileEditor/profileeditorplugin.cpp')
-rw-r--r--plugins/ProfileEditor/profileeditorplugin.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/ProfileEditor/profileeditorplugin.cpp b/plugins/ProfileEditor/profileeditorplugin.cpp
index 041dbe7..d0341b9 100644
--- a/plugins/ProfileEditor/profileeditorplugin.cpp
+++ b/plugins/ProfileEditor/profileeditorplugin.cpp
@@ -7,26 +7,34 @@
*/
#include "profileeditorplugin.h"
-#include "forms/profileview.h"
#include "forms/profilemanagerdialog.h"
+#include "forms/profileview.h"
#include <QHash>
-QHash<QString, std::function<int ()> > ProfileEditorPlugin::commands()
+QHash<QString, std::function<int()>> ProfileEditorPlugin::commands()
{
QHash<QString, std::function<int()>> hash;
hash.insert("profileEditor:about", []() -> int {
qDebug("ProfileEditor for smolbote");
return 0;
});
+
+ hash.insert("profileEditor:edit", [this]() -> int {
+ auto *dialog = createWidget(nullptr);
+ return dialog->exec();
+ });
return hash;
}
-QDialog *ProfileEditorPlugin::createWidget(QHash<QString, QWebEngineProfile *> profiles, QWidget *parent)
+void ProfileEditorPlugin::addProfile(const QString &name, QWebEngineProfile *profile)
+{
+ Q_CHECK_PTR(profile);
+ profiles.insert(name, profile);
+}
+
+QDialog *ProfileEditorPlugin::createWidget(QWidget *parent)
{
- auto *widget = new ProfileManagerDialog(parent);
- for(const QString &name : profiles.keys()) {
- widget->addProfile(name, profiles.value(name));
- }
+ auto *widget = new ProfileManagerDialog(profiles, parent);
widget->setAttribute(Qt::WA_DeleteOnClose, true);
return widget;
}