Skip to content
GitLab
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
c776efad
Commit
c776efad
authored
Oct 22, 2022
by
Christoph Cullmann
🍨
Browse files
add api to check if document is visible in other windows
use new api for the viewspace checking
parent
7014499f
Pipeline
#253549
passed with stage
in 13 minutes and 51 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/lib/kateapp.cpp
View file @
c776efad
...
...
@@ -657,3 +657,13 @@ void KateApp::remoteMessageReceived(quint32, QByteArray message)
activeMainWindow
()
->
activateView
(
doc
);
}
}
bool
KateApp
::
documentVisibleInOtherWindows
(
KTextEditor
::
Document
*
doc
,
KateMainWindow
*
window
)
const
{
for
(
auto
win
:
m_mainWindows
)
{
if
(
win
!=
window
&&
win
->
viewManager
()
->
viewspaceCountForDoc
(
doc
)
>
0
)
{
return
true
;
}
}
return
false
;
}
apps/lib/kateapp.h
View file @
c776efad
...
...
@@ -226,6 +226,16 @@ public:
int
mainWindowID
(
KateMainWindow
*
window
);
/**
* Has the given document tabs/views inside main windows
* other then the given one?
*
* @param doc document to check
* @param window window to check
* @return is this document visible as tab/view/... in any other window?
*/
bool
documentVisibleInOtherWindows
(
KTextEditor
::
Document
*
doc
,
KateMainWindow
*
window
)
const
;
/**
* some stuff for the dcop API
*/
...
...
apps/lib/kateviewmanager.cpp
View file @
c776efad
...
...
@@ -1172,20 +1172,7 @@ int KateViewManager::viewspaceCountForDoc(KTextEditor::Document *doc) const
bool
KateViewManager
::
docOnlyInOneViewspace
(
KTextEditor
::
Document
*
doc
)
const
{
auto
count
=
viewspaceCountForDoc
(
doc
);
if
(
count
>
1
)
{
return
false
;
}
std
::
vector
<
KateMainWindow
*>
mainWindows
;
const
auto
mws
=
KateApp
::
self
()
->
mainWindows
();
for
(
auto
*
mw
:
mws
)
{
auto
w
=
qobject_cast
<
KateMainWindow
*>
(
mw
->
window
());
if
(
w
&&
w
!=
m_mainWindow
)
{
count
+=
w
->
viewManager
()
->
viewspaceCountForDoc
(
doc
);
}
}
return
count
==
1
;
return
(
viewspaceCountForDoc
(
doc
)
==
1
)
&&
!
KateApp
::
self
()
->
documentVisibleInOtherWindows
(
doc
,
m_mainWindow
);
}
void
KateViewManager
::
setShowUrlNavBar
(
bool
show
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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