Commit bac8b59f authored by Christoph Cullmann's avatar Christoph Cullmann 🍨
Browse files

allow to disable the welcome page

one can configure that every new window should
start with an untitled document

perhaps the UI element needs a better text, as
we naturally will only create an untitled document,
if we don't have something else to show
parent d650cd55
Pipeline #235674 passed with stage
in 12 minutes and 8 seconds
......@@ -346,6 +346,10 @@ void KateConfigDialog::addSessionPage()
connect(sessionConfigUi.loadLastUserSessionRadioButton, &QRadioButton::toggled, this, &KateConfigDialog::slotChanged);
connect(sessionConfigUi.manuallyChooseSessionRadioButton, &QRadioButton::toggled, this, &KateConfigDialog::slotChanged);
// New main windows open always a new document if none there
sessionConfigUi.openNewDocumentPerWindow->setChecked(cgGeneral.readEntry("Open untitled document for new window", false));
connect(sessionConfigUi.openNewDocumentPerWindow, &QCheckBox::toggled, this, &KateConfigDialog::slotChanged);
// Closing last file closes Kate
sessionConfigUi.modCloseAfterLast->setChecked(m_mainWindow->modCloseAfterLast());
connect(sessionConfigUi.modCloseAfterLast, &QCheckBox::toggled, this, &KateConfigDialog::slotChanged);
......@@ -500,6 +504,8 @@ void KateConfigDialog::slotApply()
cg.writeEntry("Days Meta Infos", sessionConfigUi.daysMetaInfos->value());
KateApp::self()->documentManager()->setDaysMetaInfos(sessionConfigUi.daysMetaInfos->value());
cg.writeEntry("Open untitled document for new window", sessionConfigUi.openNewDocumentPerWindow->isChecked());
cg.writeEntry("Close After Last", sessionConfigUi.modCloseAfterLast->isChecked());
m_mainWindow->setModCloseAfterLast(sessionConfigUi.modCloseAfterLast->isChecked());
......
......@@ -75,8 +75,23 @@ KateViewManager::KateViewManager(QWidget *parentW, KateMainWindow *parent)
connect(KateApp::self()->documentManager(), &KateDocManager::aboutToDeleteDocuments, this, &KateViewManager::aboutToDeleteDocuments);
connect(KateApp::self()->documentManager(), &KateDocManager::documentsDeleted, this, &KateViewManager::documentsDeleted);
// ensure we have the welcome view if no active view is there
showWelcomeViewIfNeeded();
// the user can decide: welcome page or a new untitled document for a new window?
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup cgGeneral = KConfigGroup(config, "General");
if (cgGeneral.readEntry("Open untitled document for new window", false)) {
// we only open one, if we have no other proper view around
QTimer::singleShot(0, this, [this]() {
// we really want to show up only if nothing is in the current view space
// this guard versus double invocation of this function, too
if (activeViewSpace() && (activeViewSpace()->currentView() || activeViewSpace()->currentWidget()))
return;
slotDocumentNew();
});
} else {
// ensure we have the welcome view if no active view is there
showWelcomeViewIfNeeded();
}
}
KateViewManager::~KateViewManager()
......
......@@ -44,7 +44,7 @@
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Application Shutdown Behavior</string>
<string>Application Startup/Shutdown Behavior</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
......@@ -82,6 +82,13 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="openNewDocumentPerWindow">
<property name="text">
<string>Open new window with fresh untitled document</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="modCloseAfterLast">
<property name="whatsThis">
......
......@@ -264,7 +264,7 @@ frequently.</para></listitem>
<varlistentry>
<term><anchor id="config-dialog-sessions-shutdown-behavior"/>
<guilabel>Application Shutdown Behavior</guilabel></term>
<guilabel>Application Startup/Shutdown Behavior</guilabel></term>
<listitem>
<para>Select how you want &kate; to behave at shutdown. It is possible to define what
&kate; should <guilabel>Automatically save and restore</guilabel>.</para>
......
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