Commit 3d87ee0c authored by Christoph Cullmann's avatar Christoph Cullmann 🍨 Committed by Eric Armbruster
Browse files

allow new/open file on welcome

parent 185fe315
......@@ -5,10 +5,39 @@
*/
#include "katewelcomeview.h"
#include "katemainwindow.h"
#include "kateviewmanager.h"
#include "kateviewspace.h"
#include <QPushButton>
#include <QTimer>
KateWelcomeView::KateWelcomeView(KateViewSpace *viewSpace, QWidget *parent)
: QWidget(parent)
, m_viewSpace(viewSpace)
{
m_ui.setupUi(this);
// ensure proper title for tab & co.
setWindowTitle(i18n("Welcome"));
// new file action, closes welcome after creating a new document
m_ui.fileNew->setText(i18n("New File"));
m_ui.fileNew->setIcon(QIcon::fromTheme(QStringLiteral("file-new")));
connect(m_ui.fileNew, &QPushButton::clicked, this, [this]() {
m_viewSpace->viewManager()->slotDocumentNew();
QTimer::singleShot(0, this, [this]() {
m_viewSpace->viewManager()->mainWindow()->removeWidget(this);
});
});
// open file action, closes welcome after creating a new document
m_ui.fileOpen->setText(i18n("Open File..."));
m_ui.fileOpen->setIcon(QIcon::fromTheme(QStringLiteral("file-open")));
connect(m_ui.fileOpen, &QPushButton::clicked, this, [this]() {
m_viewSpace->viewManager()->slotDocumentOpen();
QTimer::singleShot(0, this, [this]() {
m_viewSpace->viewManager()->mainWindow()->removeWidget(this);
});
});
}
......@@ -32,21 +32,14 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="fileNew">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<widget class="QPushButton" name="fileOpen">
<property name="text">
<string>PushButton</string>
</property>
......
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