Commit 4abbd6dc authored by Christoph Cullmann's avatar Christoph Cullmann 🍨 Committed by Eric Armbruster
Browse files

ensure to really register all new documents

there were more code paths to open something via
the view manager
parent 245243e7
......@@ -348,17 +348,11 @@ void KateViewManager::slotDocumentClose()
KTextEditor::Document *
KateViewManager::openUrl(const QUrl &url, const QString &encoding, bool activate, bool ignoreForRecentFiles, const KateDocumentInfo &docInfo)
{
auto doc = KateApp::self()->documentManager()->openUrl(url, encoding, docInfo);
auto doc = openUrls({url}, encoding, docInfo);
if (!doc) {
return nullptr;
}
// forward to currently active view space
activeViewSpace()->registerDocument(doc);
// to update open recent files on saving
connect(doc, &KTextEditor::Document::documentSavedOrUploaded, this, &KateViewManager::documentSavedOrUploaded);
if (!ignoreForRecentFiles) {
m_mainWindow->addRecentOpenedFile(doc->url());
}
......@@ -373,13 +367,17 @@ KateViewManager::openUrl(const QUrl &url, const QString &encoding, bool activate
KTextEditor::Document *KateViewManager::openUrls(const QList<QUrl> &urls, const QString &encoding, const KateDocumentInfo &docInfo)
{
const std::vector<KTextEditor::Document *> docs = KateApp::self()->documentManager()->openUrls(urls, encoding, docInfo);
for (auto doc : docs) {
// forward to currently active view space
activeViewSpace()->registerDocument(doc);
connect(doc, &KTextEditor::Document::documentSavedOrUploaded, this, &KateViewManager::documentSavedOrUploaded);
}
return docs.empty() ? nullptr : docs.back();
}
KTextEditor::View *KateViewManager::openUrlWithView(const QUrl &url, const QString &encoding)
{
KTextEditor::Document *doc = KateApp::self()->documentManager()->openUrl(url, encoding);
KTextEditor::Document *doc = openUrls({url}, encoding);
if (!doc) {
return nullptr;
}
......
Supports Markdown
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