summaryrefslogtreecommitdiff
path: root/src/application.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/application.cpp')
-rw-r--r--src/application.cpp37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 54a7db88..9e34e5e2 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -10,8 +10,9 @@
* ============================================================ */
#include "application.h"
-#include "rview.h"
-#include "webengine/webview.h"
+#include "plugins/pluginloader.h"
+#include "plugins/rplugininterface.hpp"
+#include <QPluginLoader>
// ---------------------------------------------------------------------------------------------------------------
// Ctor and Dtor
@@ -42,9 +43,29 @@ Application::~Application()
// Destroy all web apps
for (auto *webApp : m_webApps) delete webApp;
+
+ // Unload all plugins
+ for (auto *plugin : m_plugins) {
+ plugin->unload();
+ delete plugin;
+ }
}
// ---------------------------------------------------------------------------------------------------------------
+// Plugin management
+
+bool Application::registerPlugin(const QString &path)
+{
+ auto *loader = new PluginLoader(path);
+ if (!loader->load()) {
+ delete loader;
+ return false;
+ }
+
+ m_plugins.append(loader);
+ return true;
+}
+// ---------------------------------------------------------------------------------------------------------------
/*
int Application::newInstance()
{
@@ -388,7 +409,17 @@ void Application::setWindowInfo(RekonqWindow *w)
rView *Application::newWebApp(const QUrl &url)
{
- auto *view = new WebView(url);
+ RekonqPluginInterface *interface = nullptr;
+ for (auto *plugin : m_plugins)
+ if (plugin->hasScheme(url.scheme())) {
+ interface = plugin->interface();
+ break;
+ }
+
+ if (interface == nullptr) return nullptr;
+
+ auto *view = interface->view(url);
+ Q_CHECK_PTR(view);
// tab->installEventFilter(this);
m_webApps.append(view);