Commit 8487506e authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

always set an icon

this avoids any relayout
parent bbfa7ee9
......@@ -287,9 +287,7 @@ void KateTabBar::setTabDocument(int idx, KTextEditor::Document *doc)
// BUG: 441340 We need to escape the & because it is used for accelerators/shortcut mnemonic by default
QString tabName = doc->documentName();
tabName.replace(QLatin1Char('&'), QLatin1String("&&"));
if (doc->isModified()) {
tabName.append(QStringLiteral(" *"));
}
setTabIcon(idx, QIcon::fromTheme(doc->isModified() ? QStringLiteral("document-save") : QStringLiteral("document-open")));
setTabText(idx, tabName);
setTabToolTip(idx, doc->url().toDisplayString());
}
......
......@@ -516,7 +516,12 @@ void KateViewSpace::registerDocument(KTextEditor::Document *doc)
*/
connect(doc, &KTextEditor::Document::documentNameChanged, this, &KateViewSpace::updateDocumentName);
connect(doc, &KTextEditor::Document::documentUrlChanged, this, &KateViewSpace::updateDocumentUrl);
connect(doc, &KTextEditor::Document::modifiedChanged, this, &KateViewSpace::updateDocumentName);
connect(doc, &KTextEditor::Document::modifiedChanged, this, [this](KTextEditor::Document *doc) {
int tab = m_tabBar->documentIdx(doc);
if (tab >= 0) {
m_tabBar->setTabIcon(tab, QIcon::fromTheme(doc->isModified() ? QStringLiteral("document-save") : QStringLiteral("document-open")));
}
});
/**
* allow signals again, now that the tab is there
......@@ -682,9 +687,6 @@ void KateViewSpace::updateDocumentName(KTextEditor::Document *doc)
// BUG: 441278 We need to escape the & because it is used for accelerators/shortcut mnemonic by default
QString tabName = doc->documentName();
tabName.replace(QLatin1Char('&'), QLatin1String("&&"));
if (doc->isModified()) {
tabName.append(QStringLiteral(" *"));
}
m_tabBar->setTabText(buttonId, tabName);
}
}
......
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