aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-09-29 12:17:35 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-09-29 12:40:10 +0200
commit91f9a68249d33dba25a2763ea89e73a219f8ad67 (patch)
tree768c1ba57dd38cd7ce0fc067b83e5b3847fd0a97 /plugins
parentTurn Session class into namespace (diff)
downloadsmolbote-91f9a68249d33dba25a2763ea89e73a219f8ad67.tar.xz
ProfileEditor plugin: fix delete button
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ProfileEditor/forms/profilemanagerdialog.cpp6
-rw-r--r--plugins/ProfileEditor/forms/profilemanagerdialog.h4
-rw-r--r--plugins/ProfileEditor/profileeditorplugin.cpp6
-rw-r--r--plugins/interfaces.h2
4 files changed, 10 insertions, 8 deletions
diff --git a/plugins/ProfileEditor/forms/profilemanagerdialog.cpp b/plugins/ProfileEditor/forms/profilemanagerdialog.cpp
index 72c56de..d660514 100644
--- a/plugins/ProfileEditor/forms/profilemanagerdialog.cpp
+++ b/plugins/ProfileEditor/forms/profilemanagerdialog.cpp
@@ -84,11 +84,7 @@ void ProfileManagerDialog::deleteProfile(QListWidgetItem *item)
auto profile = item->data(Qt::UserRole).value<QPointer<WebProfile>>();
Q_ASSERT(!profile.isNull());
- qDebug("deleting profile %s", qUtf8Printable(profile->name()));
- //qDebug("deleting %s: %s", qUtf8Printable(profile->configurationPath()), QFile(profile->configurationPath()).remove() ? "okay" : "failed");
- qDebug("deleting %s: %s", qUtf8Printable(profile->persistentStoragePath()), QDir(profile->persistentStoragePath()).removeRecursively() ? "okay" : "failed");
- qDebug("deleting %s: %s", qUtf8Printable(profile->cachePath()), QDir(profile->cachePath()).removeRecursively() ? "okay" : "failed");
+ emit removeProfile(profile);
delete item;
- delete profile.data();
}
diff --git a/plugins/ProfileEditor/forms/profilemanagerdialog.h b/plugins/ProfileEditor/forms/profilemanagerdialog.h
index ce38777..89e959a 100644
--- a/plugins/ProfileEditor/forms/profilemanagerdialog.h
+++ b/plugins/ProfileEditor/forms/profilemanagerdialog.h
@@ -18,11 +18,11 @@ class ProfileManagerDialog : public QDialog
public:
explicit ProfileManagerDialog(const ProfileManager *profiles, QWidget *parent = 0);
- ~ProfileManagerDialog();
+ ~ProfileManagerDialog() override;
signals:
void createProfile(const QString &id);
- void updateProfile(const QString &id);
+ void removeProfile(const WebProfile *profile);
public slots:
void addProfile(WebProfile *profile);
diff --git a/plugins/ProfileEditor/profileeditorplugin.cpp b/plugins/ProfileEditor/profileeditorplugin.cpp
index b158d6b..dcdd320 100644
--- a/plugins/ProfileEditor/profileeditorplugin.cpp
+++ b/plugins/ProfileEditor/profileeditorplugin.cpp
@@ -33,5 +33,11 @@ QDialog *ProfileEditorPlugin::createWidget(QWidget *parent)
auto newProfile = browser->loadProfile(id);
widget->addProfile(newProfile.second);
});
+
+ connect(widget, &ProfileManagerDialog::removeProfile, this, [this](const WebProfile *profile) {
+ const QString id = browser->getProfileManager()->id(profile);
+ browser->getProfileManager()->deleteProfile(id);
+ });
+
return widget;
}
diff --git a/plugins/interfaces.h b/plugins/interfaces.h
index 681a79e..b7c4091 100644
--- a/plugins/interfaces.h
+++ b/plugins/interfaces.h
@@ -27,7 +27,7 @@ public:
virtual Configuration *getConfiguration() const = 0;
virtual QPair<QString, WebProfile *> loadProfile(const QString &id) = 0;
- virtual const ProfileManager *getProfileManager() const = 0;
+ virtual ProfileManager *getProfileManager() = 0;
};
struct Plugin