Commit 9a720737 authored by Alexander Semke's avatar Alexander Semke

[cas] adopted to the recent changes in Cantor where the panel plugin

handler is not part of the KPart-component and needs to be created
separately.
parent e0ad3ee3
......@@ -40,9 +40,16 @@
#include <QAction>
#include <QModelIndex>
#include "cantor/cantorlibs_version.h"
#if CANTOR_VERSION > QT_VERSION_CHECK(20,8,0)
#include "cantor/20.12/cantor_part.h"
#include "cantor/20.12/panelpluginhandler.h"
#include "cantor/20.12/panelplugin.h"
#else
#include "cantor/cantor_part.h"
#include <cantor/panelpluginhandler.h>
#include <cantor/panelplugin.h>
#include "cantor/panelpluginhandler.h"
#include "cantor/panelplugin.h"
#endif
#include <cantor/worksheetaccess.h>
CantorWorksheet::CantorWorksheet(const QString &name, bool loading)
......@@ -96,12 +103,20 @@ bool CantorWorksheet::init(QByteArray* content) {
connect(m_variableModel, &QAbstractItemModel::modelReset, this, &CantorWorksheet::modelReset);
//available plugins
#if CANTOR_VERSION > QT_VERSION_CHECK(20,8,0)
auto* handler = new Cantor::PanelPluginHandler(this);
handler->loadPlugins();
m_plugins = handler->activePluginsForSession(m_session, Cantor::PanelPluginHandler::PanelStates());
for (auto* plugin : m_plugins)
plugin->connectToShell(m_part);
#else
auto* handler = m_part->findChild<Cantor::PanelPluginHandler*>(QLatin1String("PanelPluginHandler"));
if (!handler) {
KMessageBox::error(nullptr, i18n("No PanelPluginHandle found for the Cantor Part."));
return false;
}
m_plugins = handler->plugins();
#endif
}
return true;
......
......@@ -58,7 +58,6 @@ void CantorWorksheetDock::setCantorWorksheets(QList<CantorWorksheet*> list) {
ui.leName->setToolTip("");
ui.leComment->setText(m_worksheet->comment());
//show all available plugins
int k = 0;
int prev_index = ui.tabWidget->currentIndex();
......@@ -71,6 +70,8 @@ void CantorWorksheetDock::setCantorWorksheets(QList<CantorWorksheet*> list) {
QList<Cantor::PanelPlugin*> plugins = m_cantorworksheetlist.first()->getPlugins();
index.clear();
for (auto* plugin : plugins) {
if (plugin->name() == QLatin1String("File Browser"))
continue;
plugin->setParentWidget(this);
int i = ui.tabWidget->addTab(plugin->widget(), plugin->name());
index.append(i);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment