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

Show the default help information in the help panel only after the backend was...

Show the default help information in the help panel only after the backend was already completely initialized.
This avoids the crash when openning project files without having any worksheet tab created yet.

BUG: 459631
FIXED-IN: 22.08.2
parent d16037fb
Pipeline #240209 passed with stage
in 8 minutes and 25 seconds
......@@ -360,8 +360,12 @@ void CantorShell::addWorksheet(const QString& backendName)
connect(part, SIGNAL(requestDocumentation(QString)), this, SIGNAL(requestDocumentation(QString)));
m_parts.append(part);
if (backend) // If backend empty (loading worksheet from file), then we connect to signal and wait
if (backend) {// If backend empty (loading worksheet from file), then we connect to signal and wait
m_parts2Backends[part] = backend->id();
//show the default help string in the help panel
emit showHelp(backend->defaultHelp());
}
else
{
m_parts2Backends[part] = QString();
......@@ -375,9 +379,6 @@ void CantorShell::addWorksheet(const QString& backendName)
// Force run updateCaption for getting proper backend icon
QMetaObject::invokeMethod(part, "updateCaption");
//show the default help string in the help panel
emit showHelp(backend->defaultHelp());
}
else
{
......@@ -881,21 +882,28 @@ void CantorShell::saveDockPanelsState(KParts::ReadWritePart* part)
}
}
void CantorShell::updateBackendForPart(const QString& backend)
void CantorShell::updateBackendForPart(const QString& backendName)
{
auto* part = dynamic_cast<KParts::ReadWritePart*>(sender());
if (part && m_parts2Backends.contains(part) && m_parts2Backends[part].isEmpty())
{
m_parts2Backends[part] = backend;
m_parts2Backends[part] = backendName;
KConfigGroup panelStatusGroup(KSharedConfig::openConfig(), QLatin1String("PanelsStatus"));
if (m_part == part && panelStatusGroup.hasKey(backend))
if (m_part == part && panelStatusGroup.hasKey(backendName))
{
const QStringList& plugins = panelStatusGroup.readEntry(m_parts2Backends[m_part]).split(QLatin1Char('\n'));
m_pluginsVisibility[m_part] = plugins;
updatePanel();
}
auto* backend = Cantor::Backend::getBackend(backendName);
if (backend)
{
//show the default help string in the help panel
emit showHelp(backend->defaultHelp());
}
}
}
......
Supports Markdown
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