Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
3d87ee0c
Commit
3d87ee0c
authored
Sep 17, 2022
by
Christoph Cullmann
🍨
Committed by
Eric Armbruster
Sep 19, 2022
Browse files
allow new/open file on welcome
parent
185fe315
Changes
2
Hide whitespace changes
Inline
Side-by-side
apps/lib/katewelcomeview.cpp
View file @
3d87ee0c
...
...
@@ -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
);
});
});
}
apps/lib/ui/welcome.ui
View file @
3d87ee0c
...
...
@@ -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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment