diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-11-12 21:49:57 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-11-12 21:49:57 +0100 |
| commit | a4acfc1f992eb5135c9ae6542ae5ffa8b09a2c2d (patch) | |
| tree | d7b77189da352e15fd35b12940b64c8896cbd796 /src/organizerproxy.cpp | |
| parent | 56dcdd33a2110a8c5ad13cc9401ce87fb3d7bf80 (diff) | |
Add callbacks for plugin enabled/disabled.
Diffstat (limited to 'src/organizerproxy.cpp')
| -rw-r--r-- | src/organizerproxy.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index 77b7c2d6..c2283acc 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -293,8 +293,36 @@ bool OrganizerProxy::onProfileChanged(std::function<void(MOBase::IProfile*, MOBa return m_Proxied->onProfileChanged(MOShared::callIfPluginActive(this, func));
}
+// Always call these one, otherwise plugin cannot detect they are being enabled / disabled:
bool OrganizerProxy::onPluginSettingChanged(std::function<void(QString const&, const QString& key, const QVariant&, const QVariant&)> const& func)
{
- // Always call this one, otherwise plugin cannot detect they are being enabled / disabled:
return m_Proxied->onPluginSettingChanged(func);
}
+
+bool OrganizerProxy::onPluginEnabled(std::function<void(const IPlugin*)> const& func)
+{
+ return m_Proxied->onPluginEnabled(func);
+}
+
+bool OrganizerProxy::onPluginEnabled(const QString& pluginName, std::function<void()> const& func)
+{
+ return m_Proxied->onPluginEnabled([=](const IPlugin* plugin) {
+ if (plugin->name().compare(pluginName, Qt::CaseInsensitive) == 0) {
+ func();
+ }
+ });
+}
+
+bool OrganizerProxy::onPluginDisabled(std::function<void(const IPlugin*)> const& func)
+{
+ return m_Proxied->onPluginDisabled(func);
+}
+
+bool OrganizerProxy::onPluginDisabled(const QString& pluginName, std::function<void()> const& func)
+{
+ return m_Proxied->onPluginDisabled([=](const IPlugin* plugin) {
+ if (plugin->name().compare(pluginName, Qt::CaseInsensitive) == 0) {
+ func();
+ }
+ });
+}
|
