Commit 245243e7 authored by Christoph Cullmann's avatar Christoph Cullmann 🍨 Committed by Eric Armbruster
Browse files

ensure we create tabs for all documents we open

if we open a document via the view manager function,
we want to at least have some tab, even if we don't activate
the view

this fixes e.g.

kate *.*

to just show the tab of the last opened doc
parent 1eeaf3db
......@@ -348,7 +348,16 @@ void KateViewManager::slotDocumentClose()
KTextEditor::Document *
KateViewManager::openUrl(const QUrl &url, const QString &encoding, bool activate, bool ignoreForRecentFiles, const KateDocumentInfo &docInfo)
{
KTextEditor::Document *doc = KateApp::self()->documentManager()->openUrl(url, encoding, docInfo);
auto doc = KateApp::self()->documentManager()->openUrl(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());
......@@ -397,36 +406,6 @@ KateMainWindow *KateViewManager::mainWindow()
return m_mainWindow;
}
void KateViewManager::documentCreated(KTextEditor::Document *doc)
{
// 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 (m_blockViewCreationAndActivation) {
return;
}
auto view = activeView();
if (!view) {
view = activateView(doc);
}
/**
* check if we have any empty viewspaces and give them a view
*/
for (KateViewSpace *vs : m_viewSpaceList) {
if (!vs->currentView() && !vs->currentWidget()) {
createView(view->document(), vs);
}
}
// trigger action update
updateViewSpaceActions();
}
void KateViewManager::aboutToDeleteDocuments(const QList<KTextEditor::Document *> &)
{
/**
......
......@@ -158,7 +158,6 @@ public:
private Q_SLOTS:
void slotViewChanged();
void documentCreated(KTextEditor::Document *doc);
void documentWillBeDeleted(KTextEditor::Document *doc);
void documentSavedOrUploaded(KTextEditor::Document *document, bool saveAs);
......
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