Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
7be9efff
Commit
7be9efff
authored
Sep 15, 2020
by
Christoph Cullmann
🐮
Browse files
simplify code
parent
fe504795
Changes
3
Hide whitespace changes
Inline
Side-by-side
kate/kateapp.h
View file @
7be9efff
...
...
@@ -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.
...
...
kate/kateconfigdialog.cpp
View file @
7be9efff
...
...
@@ -448,7 +448,7 @@ void KateConfigDialog::slotApply()
// emit config change
if
(
m_dataChanged
)
{
KateApp
::
self
()
->
emitC
onfigurationChanged
();
KateApp
::
self
()
->
c
onfigurationChanged
();
}
m_dataChanged
=
false
;
...
...
kate/katetabbar.cpp
View file @
7be9efff
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment