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
b08003ff
Commit
b08003ff
authored
Feb 14, 2022
by
Christoph Cullmann
🍨
Browse files
update url bar on url modifications
this properly tracks e.g. saveAs or the "we switch to new file in the current one"
parent
f2e0bdf5
Pipeline
#137370
passed with stage
in 5 minutes and 19 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
kate/kateurlbar.cpp
View file @
b08003ff
...
...
@@ -439,22 +439,40 @@ KateUrlBar::KateUrlBar(KateViewSpace *parent)
void
KateUrlBar
::
onViewChanged
(
KTextEditor
::
View
*
v
)
{
if
(
!
v
)
{
updateForDocument
(
nullptr
);
hide
();
return
;
}
updateForDocument
(
v
->
document
());
}
void
KateUrlBar
::
updateForDocument
(
KTextEditor
::
Document
*
doc
)
{
// always disconnect and perhaps set nullptr doc
if
(
m_currentDoc
)
{
disconnect
(
m_currentDoc
,
&
KTextEditor
::
Document
::
documentUrlChanged
,
this
,
&
KateUrlBar
::
updateForDocument
);
}
m_currentDoc
=
doc
;
if
(
!
doc
)
{
return
;
}
// we want to watch for url changed
connect
(
m_currentDoc
,
&
KTextEditor
::
Document
::
documentUrlChanged
,
this
,
&
KateUrlBar
::
updateForDocument
);
auto
*
vm
=
static_cast
<
KateViewSpace
*>
(
parentWidget
())
->
viewManger
();
if
(
vm
&&
!
vm
->
showUrlNavBar
())
{
return
;
}
const
auto
url
=
v
->
document
()
->
url
();
const
auto
url
=
doc
->
url
();
if
(
url
.
isEmpty
()
||
!
url
.
isLocalFile
())
{
hide
();
return
;
}
m_breadCrumbView
->
setUrl
(
v
->
document
()
->
url
()
);
m_breadCrumbView
->
setUrl
(
url
);
if
(
isHidden
())
show
();
...
...
kate/kateurlbar.h
View file @
b08003ff
...
...
@@ -6,7 +6,9 @@
#define KATE_URL_BAR_H
#include
"kateviewspace.h"
#include
<QFrame>
#include
<QPointer>
class
KateUrlBar
:
public
QWidget
{
...
...
@@ -19,7 +21,12 @@ Q_SIGNALS:
private:
void
onViewChanged
(
KTextEditor
::
View
*
v
);
void
updateForDocument
(
KTextEditor
::
Document
*
doc
);
class
BreadCrumbView
*
m_breadCrumbView
;
// document for which the url bar is currently active
// might be nullptr
QPointer
<
KTextEditor
::
Document
>
m_currentDoc
;
};
#endif
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