Commit f6df3f8b authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Dont show absouloute path for files in quick-open

parent 6a2c9421
......@@ -73,6 +73,7 @@ void KateQuickOpenModel::refresh()
const QList<KTextEditor::View *> sortedViews = m_mainWindow->viewManager()->sortedViews();
const QList<KTextEditor::Document *> openDocs = KateApp::self()->documentManager()->documentList();
const QStringList projectDocs = projectView ? (m_listMode == CurrentProject ? projectView->property("projectFiles") : projectView->property("allProjectsFiles")).toStringList() : QStringList();
const QString projectBase = m_listMode == CurrentProject ? projectView->property("projectBaseDir").toString() : projectView->property("allProjectsCommonBaseDir").toString();
QVector<ModelEntry> allDocuments;
allDocuments.reserve(sortedViews.size() + openDocs.size() + projectDocs.size());
......@@ -80,18 +81,18 @@ void KateQuickOpenModel::refresh()
size_t sort_id = static_cast<size_t>(-1);
for (auto *view : qAsConst(sortedViews)) {
auto doc = view->document();
allDocuments.push_back({doc->url(), doc->documentName(), doc->url().toDisplayString(QUrl::NormalizePathSegments | QUrl::PreferLocalFile), true, sort_id--, -1});
allDocuments.push_back({doc->url(), doc->documentName(), doc->url().toDisplayString(QUrl::NormalizePathSegments | QUrl::PreferLocalFile).remove(projectBase), true, sort_id--, -1});
}
for (auto *doc : qAsConst(openDocs)) {
const auto normalizedUrl = doc->url().toString(QUrl::NormalizePathSegments | QUrl::PreferLocalFile);
const auto normalizedUrl = doc->url().toString(QUrl::NormalizePathSegments | QUrl::PreferLocalFile).remove(projectBase);
allDocuments.push_back({doc->url(), doc->documentName(), normalizedUrl, true, 0, -1});
}
for (const auto &file : qAsConst(projectDocs)) {
QFileInfo fi(file);
const auto localFile = QUrl::fromLocalFile(fi.absoluteFilePath());
allDocuments.push_back({localFile, fi.fileName(), localFile.toString(QUrl::NormalizePathSegments | QUrl::PreferLocalFile), false, 0, -1});
allDocuments.push_back({localFile, fi.fileName(), fi.filePath().remove(projectBase), false, 0, -1});
}
/** Sort the arrays by filePath. */
......
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