Commit 312f3966 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

add * to modified document tabs

same way we mark them in the title bar
parent babf0b70
Pipeline #196086 passed with stage
in 24 minutes and 37 seconds
......@@ -287,6 +287,9 @@ 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(" *"));
}
setTabText(idx, tabName);
setTabToolTip(idx, doc->url().toDisplayString());
}
......
......@@ -516,7 +516,7 @@ 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::updateDocumentState);
connect(doc, &KTextEditor::Document::modifiedChanged, this, &KateViewSpace::updateDocumentName);
/**
* allow signals again, now that the tab is there
......@@ -676,12 +676,15 @@ void KateViewSpace::documentDestroyed(QObject *doc)
void KateViewSpace::updateDocumentName(KTextEditor::Document *doc)
{
// update tab button if available, might not be the case for tab limit set!
// update tab button if available, might not be the case for tab limit set!wee
const int buttonId = m_tabBar->documentIdx(doc);
if (buttonId >= 0) {
// 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);
}
}
......@@ -695,15 +698,6 @@ void KateViewSpace::updateDocumentUrl(KTextEditor::Document *doc)
}
}
void KateViewSpace::updateDocumentState(KTextEditor::Document *doc)
{
// update tab button if available, might not be the case for tab limit set!
const int buttonId = m_tabBar->documentIdx(doc);
if (buttonId >= 0) {
m_tabBar->update(m_tabBar->tabRect(buttonId));
}
}
void KateViewSpace::closeTabRequest(int idx)
{
auto *doc = m_tabBar->tabDocument(idx);
......
......@@ -199,7 +199,6 @@ public Q_SLOTS:
void documentDestroyed(QObject *doc);
void updateDocumentName(KTextEditor::Document *doc);
void updateDocumentUrl(KTextEditor::Document *doc);
void updateDocumentState(KTextEditor::Document *doc);
private Q_SLOTS:
void tabBarToggled();
......
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