Commit 4f40d69c authored by Nikita Sirgienko's avatar Nikita Sirgienko

Fix problem with missing backend icon for created sessions

parent 83575703
......@@ -351,6 +351,9 @@ void CantorShell::addWorksheet(const QString& backendName)
// Setting focus on worksheet view, because Qt clear focus of added widget inside addTab
// This fix https://bugs.kde.org/show_bug.cgi?id=395976
part->widget()->findChild<QGraphicsView*>()->setFocus();
// Force run updateCaption for getting proper backend icon
QMetaObject::invokeMethod(part, "updateCaption");
}
else
{
......@@ -405,12 +408,11 @@ void CantorShell::activateWorksheet(int index)
void CantorShell::setTabCaption(const QString& caption, const QIcon& icon)
{
if (caption.isEmpty()) return;
KParts::ReadWritePart* part=dynamic_cast<KParts::ReadWritePart*>(sender());
if (part)
{
m_tabWidget->setTabText(m_tabWidget->indexOf(part->widget()), caption);
if (!caption.isEmpty())
m_tabWidget->setTabText(m_tabWidget->indexOf(part->widget()), caption);
m_tabWidget->setTabIcon(m_tabWidget->indexOf(part->widget()), icon);
}
}
......
......@@ -724,11 +724,11 @@ void CantorPart::updateCaption()
//strip away the extension
filename=filename.left(filename.lastIndexOf(QLatin1Char('.')));
if (filename.isEmpty())
filename = i18n("Unnamed");
if (!m_worksheet->isReadOnly())
emit setCaption(filename, QIcon::fromTheme(m_worksheet->session()->backend()->icon()));
{
if (m_worksheet->session())
emit setCaption(filename, QIcon::fromTheme(m_worksheet->session()->backend()->icon()));
}
else
emit setCaption(filename+QLatin1Char(' ') + i18n("[read-only]"), QIcon());
}
......
......@@ -84,6 +84,9 @@ Q_SIGNALS:
void showHelp(const QString& help);
void worksheetSave(const QUrl& url);
public Q_SLOTS:
void updateCaption();
protected:
/**
* This must be implemented by each part
......@@ -123,7 +126,6 @@ protected Q_SLOTS:
void worksheetSessionLoginStarted();
void worksheetSessionLoginDone();
void initialized();
void updateCaption();
void pluginsChanged();
void runCommand(const QString& value);
......
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