Changeset View
Changeset View
Standalone View
Standalone View
kate/katequickopenmodel.cpp
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 78 | { | |||
---|---|---|---|---|---|
94 | for (auto *doc : qAsConst(openDocs)) { | 94 | for (auto *doc : qAsConst(openDocs)) { | ||
95 | const auto normalizedUrl = doc->url().toString(QUrl::NormalizePathSegments | QUrl::PreferLocalFile); | 95 | const auto normalizedUrl = doc->url().toString(QUrl::NormalizePathSegments | QUrl::PreferLocalFile); | ||
96 | allDocuments.push_back({ doc->url(), doc->documentName(), normalizedUrl, false }); | 96 | allDocuments.push_back({ doc->url(), doc->documentName(), normalizedUrl, false }); | ||
97 | openedUrls.push_back(normalizedUrl); | 97 | openedUrls.push_back(normalizedUrl); | ||
98 | } | 98 | } | ||
99 | 99 | | |||
100 | for (const auto& file : qAsConst(projectDocs)) { | 100 | for (const auto& file : qAsConst(projectDocs)) { | ||
101 | QFileInfo fi(file); | 101 | QFileInfo fi(file); | ||
102 | // example of file: "/home/user/projects/myfile.txt" which is consistent with QUrl::toDisplayString(QUrl::PreferLocalFile) | 102 | const auto localFile = QUrl::fromLocalFile(fi.absoluteFilePath()); | ||
103 | allDocuments.push_back({ QUrl::fromLocalFile(fi.absoluteFilePath()), fi.fileName(), file, false }); | 103 | allDocuments.push_back({ | ||
104 | localFile, | ||||
105 | fi.fileName(), | ||||
106 | localFile.toString(QUrl::NormalizePathSegments | QUrl::PreferLocalFile), false }); | ||||
104 | } | 107 | } | ||
105 | 108 | | |||
106 | /** Sort the arrays by filePath. */ | 109 | /** Sort the arrays by filePath. */ | ||
107 | std::sort(std::begin(allDocuments), std::end(allDocuments), | 110 | std::sort(std::begin(allDocuments), std::end(allDocuments), | ||
108 | [](const ModelEntry& a, const ModelEntry& b) { | 111 | [](const ModelEntry& a, const ModelEntry& b) { | ||
109 | return a.filePath < b.filePath; | 112 | return a.filePath < b.filePath; | ||
110 | }); | 113 | }); | ||
111 | 114 | | |||
Show All 24 Lines |