Commit f947d36e authored by Alexander Semke's avatar Alexander Semke
Browse files

Small fixes required for the integration in LabPlot:

* ensure the documentation panel widget is available when the state in the documentation panel is restored
* do all the connects in DocumentationPanelPlugin::connectToShell() as it is already done in other panels
* explicitely specify "cantorrc" when reading the config group in CantorPart::documentationRequested since the application name is labplot when running inside of labplot
parent bfa8fac3
Pipeline #128431 passed with stage
in 23 minutes and 31 seconds
......@@ -727,7 +727,7 @@ void CantorPart::enableTypesetting(bool enable)
*/
void CantorPart::documentationRequested(const QString& keyword) {
auto* backend = m_worksheet->session()->backend();
const KConfigGroup& group = KSharedConfig::openConfig()->group(backend->name().toLower());
const auto& group = KSharedConfig::openConfig(QStringLiteral("cantorrc"))->group(backend->name().toLower());
const auto& docNames = group.readEntry(QLatin1String("Names"), QStringList());
if (!docNames.isEmpty())
emit requestDocumentation(keyword);
......
......@@ -75,7 +75,7 @@ QList<PanelPlugin*> PanelPluginHandler::plugins(Session* session)
if (session == nullptr)
return pluginsForSession;
const Cantor::Backend::Capabilities capabilities = session->backend()->capabilities();
const auto capabilities = session->backend()->capabilities();
const QStringList& extensions = session->backend()->extensions();
qDebug()<<"loading panel plugins for session of type "<<session->backend()->name();
......@@ -104,7 +104,7 @@ QList<PanelPlugin*> PanelPluginHandler::plugins(Session* session)
QList<PanelPlugin*> PanelPluginHandler::activePluginsForSession(Session* session, const PanelStates& previousPluginStates)
{
QList<Cantor::PanelPlugin*> plugins = this->plugins(session);
const auto& plugins = this->plugins(session);
for (auto* plugin : plugins)
{
if(!plugin)
......
......@@ -20,10 +20,7 @@ DocumentationPanelPlugin::~DocumentationPanelPlugin()
QWidget* DocumentationPanelPlugin::widget()
{
if(!m_widget)
{
m_widget = new DocumentationPanelWidget(parentWidget());
connect(m_cantorShell, SIGNAL(requestDocumentation(QString)), m_widget, SLOT(contextSensitiveHelp(QString)));
}
return m_widget;
}
......@@ -37,6 +34,7 @@ void DocumentationPanelPlugin::connectToShell(QObject* cantorShell)
{
m_cantorShell = cantorShell;
connect(cantorShell, SIGNAL(requestDocumentation(QString)), this, SIGNAL(visibilityRequested()));
connect(cantorShell, SIGNAL(requestDocumentation(QString)), m_widget, SLOT(contextSensitiveHelp(QString)));
}
Cantor::PanelPlugin::State DocumentationPanelPlugin::saveState()
......@@ -49,6 +47,12 @@ Cantor::PanelPlugin::State DocumentationPanelPlugin::saveState()
void DocumentationPanelPlugin::restoreState(const Cantor::PanelPlugin::State& state)
{
PanelPlugin::restoreState(state);
//TODO: when using this panel in LabPlot this function is being called before widget().
//the reason is not completely clear. call widget() here to make sure it's available.
if (!m_widget)
this->widget();
if(session() && m_widget)
{
m_widget->updateBackend(session()->backend()->name());
......
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