Commit a7ba6eb0 authored by Gregor Mi's avatar Gregor Mi

Quick Open: Remove "file:///" prefix from file paths

In the second column, remove all "file:///" prefixes from the file paths.

Screenshot BEFORE:


(Note, that the screenshot was taken at a time where the file paths in the upper section where not bold (before d6e38c0c). Now, the items in the first and second column are both bold)



Reviewers: #kate, cullmann

Reviewed By: #kate, cullmann

Subscribers: cullmann, kfunk, gregormi, broulik, dhaumann, tcanabrava, kwrite-devel

Tags: #kate

Differential Revision:
parent 44d14967
......@@ -84,23 +84,24 @@ void KateQuickOpenModel::refresh()
for (auto *view : qAsConst(sortedViews)) {
auto doc = view->document();
allDocuments.push_back({ doc->documentName(), doc->url().toString(QUrl::NormalizePathSegments), false });
allDocuments.push_back({ doc->documentName(), doc->url().toDisplayString(QUrl::NormalizePathSegments | QUrl::PreferLocalFile), false });
QStringList openedUrls;
for (auto *doc : qAsConst(openDocs)) {
const auto normalizedUrl = doc->url().toString(QUrl::NormalizePathSegments);
const auto normalizedUrl = doc->url().toString(QUrl::NormalizePathSegments | QUrl::PreferLocalFile);
allDocuments.push_back({ doc->documentName(), normalizedUrl, false });
for (const auto& file : qAsConst(projectDocs)) {
QFileInfo fi(file);
allDocuments.push_back({ fi.fileName(), QUrl::fromLocalFile(file).toString(QUrl::NormalizePathSegments), false });
// example of file: "/home/user/projects/myfile.txt" which is consistent with QUrl::toDisplayString(QUrl::PreferLocalFile)
allDocuments.push_back({ fi.fileName(), file, false });
/** Sort the arrays via Url. */
/** Sort the arrays by filePath. */
std::sort(std::begin(allDocuments), std::end(allDocuments),
[](const ModelEntry& a, const ModelEntry& b) {
return a.filePath < b.filePath;
......@@ -114,7 +115,7 @@ void KateQuickOpenModel::refresh()
for(auto& doc : allDocuments) {
for (auto& doc : allDocuments) {
if (Q_UNLIKELY(openedUrls.indexOf(doc.filePath) != -1)) {
doc.bold = true;
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