Commit 7ef4699b authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

show empty icon or circle

parent 8487506e
......@@ -287,9 +287,24 @@ 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("&&"));
setTabIcon(idx, QIcon::fromTheme(doc->isModified() ? QStringLiteral("document-save") : QStringLiteral("document-open")));
setTabText(idx, tabName);
setTabToolTip(idx, doc->url().toDisplayString());
setModifiedStateIcon(idx, doc->isModified());
}
void KateTabBar::setModifiedStateIcon(int idx, bool modified)
{
// empty icon as place holder
if (!modified) {
QImage x(100, 100, QImage::Format_ARGB32_Premultiplied);
x.fill(0);
QIcon i(QPixmap::fromImage(x));
setTabIcon(idx, i);
return;
}
// modified indicator
setTabIcon(idx, QIcon::fromTheme(QStringLiteral("choice-round")));
}
void KateTabBar::setCurrentDocument(KTextEditor::Document *doc)
......
......@@ -64,6 +64,7 @@ public:
void setTabDocument(int idx, KTextEditor::Document *doc);
KTextEditor::Document *tabDocument(int idx);
void removeDocument(KTextEditor::Document *doc);
void setModifiedStateIcon(int idx, bool modified);
/**
* Marks this tabbar as active. That is, current-tab indicators are
......
......@@ -519,7 +519,7 @@ void KateViewSpace::registerDocument(KTextEditor::Document *doc)
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")));
m_tabBar->setModifiedStateIcon(tab, doc->isModified());
}
});
......
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