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
bcb093aa
Commit
bcb093aa
authored
May 04, 2021
by
Mark Nauwelaerts
Browse files
quickopen: prefer fileName as filename of opened document
... and documentName only as a fallback.
parent
04969887
Changes
1
Hide whitespace changes
Inline
Side-by-side
kate/quickopen/katequickopenmodel.cpp
View file @
bcb093aa
...
...
@@ -111,20 +111,27 @@ void KateQuickOpenModel::refresh(KateMainWindow *mainWindow)
QSet
<
QString
>
openedDocUrls
;
openedDocUrls
.
reserve
(
sortedViews
.
size
());
for
(
auto
*
view
:
qAsConst
(
sortedViews
))
{
auto
doc
=
view
->
document
();
const
auto
collectDoc
=
[
&
openedDocUrls
,
&
allDocuments
](
KTextEditor
::
Document
*
doc
)
{
auto
path
=
doc
->
url
().
toString
(
QUrl
::
NormalizePathSegments
|
QUrl
::
PreferLocalFile
);
if
(
openedDocUrls
.
contains
(
path
))
{
return
;
}
openedDocUrls
.
insert
(
path
);
allDocuments
.
push_back
({
doc
->
url
(),
doc
->
documentName
(),
path
,
true
,
-
1
});
// prefer the real filename, since documentName might be `foo (2)`
// (which is not a suffix of the path)
auto
fileName
=
QFileInfo
(
path
).
fileName
();
if
(
fileName
.
isEmpty
())
{
fileName
=
doc
->
documentName
();
}
allDocuments
.
push_back
({
doc
->
url
(),
fileName
,
path
,
true
,
-
1
});
};
for
(
auto
*
view
:
qAsConst
(
sortedViews
))
{
collectDoc
(
view
->
document
());
}
for
(
auto
*
doc
:
qAsConst
(
openDocs
))
{
auto
path
=
doc
->
url
().
toString
(
QUrl
::
NormalizePathSegments
|
QUrl
::
PreferLocalFile
);
if
(
openedDocUrls
.
contains
(
path
))
{
continue
;
}
openedDocUrls
.
insert
(
path
);
allDocuments
.
push_back
({
doc
->
url
(),
doc
->
documentName
(),
path
,
true
,
-
1
});
collectDoc
(
doc
);
}
for
(
const
auto
&
file
:
qAsConst
(
projectDocs
))
{
...
...
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