Commit 7be9efff authored by Christoph Cullmann's avatar Christoph Cullmann 🐮

simplify code

parent fe504795
......@@ -354,15 +354,6 @@ public Q_SLOTS:
*/
void remoteMessageReceived(const QString &message, QObject *socket);
public:
/**
* trigger emission of configurationChanged
*/
void emitConfigurationChanged()
{
emit configurationChanged();
}
Q_SIGNALS:
/**
* Emitted when the configuration got changed via the global config dialog.
......
......@@ -448,7 +448,7 @@ void KateConfigDialog::slotApply()
// emit config change
if (m_dataChanged) {
KateApp::self()->emitConfigurationChanged();
KateApp::self()->configurationChanged();
}
m_dataChanged = false;
......
......@@ -240,41 +240,43 @@ void KateTabBar::removeDocument(KTextEditor::Document *doc)
// remove document if needed, we might have no tab for it, if tab count is limited!
const int idx = documentIdx(doc);
if (idx != -1) {
// if we have some tab limit, replace the removed tab with the next best document that has none!
if (m_tabCountLimit > 0) {
quint64 maxCounter = 0;
KTextEditor::Document *docToReplace = nullptr;
for (const auto &lru : m_docToLruCounterAndHasTab) {
// ignore stuff with tabs
if (lru.second.second) {
continue;
}
// search most recently used one
if (lru.second.first >= maxCounter) {
maxCounter = lru.second.first;
docToReplace = lru.first;
}
}
if (idx == -1) {
return;
}
// any document found? replace the tab we want to close and be done
if (docToReplace) {
// mark the replace doc as "has a tab"
m_docToLruCounterAndHasTab[docToReplace].second = true;
// if we have some tab limit, replace the removed tab with the next best document that has none!
if (m_tabCountLimit > 0) {
quint64 maxCounter = 0;
KTextEditor::Document *docToReplace = nullptr;
for (const auto &lru : m_docToLruCounterAndHasTab) {
// ignore stuff with tabs
if (lru.second.second) {
continue;
}
// replace info for the tab
setTabDocument(idx, docToReplace);
setCurrentIndex(idx);
emit currentChanged(idx);
return;
// search most recently used one
if (lru.second.first >= maxCounter) {
maxCounter = lru.second.first;
docToReplace = lru.first;
}
}
// if we arrive here, we just need to purge the tab
// this happens if we have no limit or no document to replace the current one
removeTab(idx);
// any document found? replace the tab we want to close and be done
if (docToReplace) {
// mark the replace doc as "has a tab"
m_docToLruCounterAndHasTab[docToReplace].second = true;
// replace info for the tab
setTabDocument(idx, docToReplace);
setCurrentIndex(idx);
emit currentChanged(idx);
return;
}
}
// if we arrive here, we just need to purge the tab
// this happens if we have no limit or no document to replace the current one
removeTab(idx);
}
int KateTabBar::documentIdx(KTextEditor::Document *doc)
......
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