Commit 879c39b3 authored by Eric Armbruster's avatar Eric Armbruster 🍁
Browse files

welcomeview: add new document button

parent dbe7f50b
......@@ -1501,19 +1501,20 @@ void KateViewManager::showWelcomeView()
if (activeViewSpace() && (activeViewSpace()->currentView() || activeViewSpace()->currentWidget()))
return;
auto welcomeVeiw = new WelcomeView(this);
connect(welcomeVeiw, &WelcomeView::openClicked, this, &KateViewManager::slotDocumentOpen);
connect(welcomeVeiw, &WelcomeView::recentItemClicked, this, [this](const QUrl &url) {
auto welcomeView = new WelcomeView(this);
connect(welcomeView, &WelcomeView::openClicked, this, &KateViewManager::slotDocumentOpen);
connect(welcomeView, &WelcomeView::newClicked, this, &KateViewManager::slotDocumentNew);
connect(welcomeView, &WelcomeView::recentItemClicked, this, [this](const QUrl &url) {
openUrl(url);
});
connect(welcomeVeiw, &WelcomeView::forgetRecentItem, this, &KateViewManager::forgetRecentItem);
connect(welcomeView, &WelcomeView::forgetRecentItem, this, &KateViewManager::forgetRecentItem);
auto recentFilesAction = mainWindow()->recentFilesAction();
connect(recentFilesAction, &KRecentFilesAction::recentListCleared, this, &KateViewManager::refreshRecentsOnWelcomeView);
connect(welcomeVeiw, &WelcomeView::forgetAllRecents, recentFilesAction, &KRecentFilesAction::clear);
connect(this, &KateViewManager::loadRecentFiles, welcomeVeiw, &WelcomeView::loadRecents);
connect(welcomeView, &WelcomeView::forgetAllRecents, recentFilesAction, &KRecentFilesAction::clear);
connect(this, &KateViewManager::loadRecentFiles, welcomeView, &WelcomeView::loadRecents);
mainWindow()->addWidget(welcomeVeiw);
mainWindow()->addWidget(welcomeView);
refreshRecentsOnWelcomeView();
});
}
......
......@@ -131,6 +131,7 @@ WelcomeView::WelcomeView(QWidget *parent)
appIcon->setPixmap(qApp->windowIcon().pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous));
connect(openButton, &QPushButton::clicked, this, &WelcomeView::openClicked);
connect(newButton, &QPushButton::clicked, this, &WelcomeView::newClicked);
recentsListView->setContextMenuPolicy(Qt::DefaultContextMenu);
recentsListView->setModel(m_recentsModel);
......
......@@ -38,6 +38,7 @@ public Q_SLOTS:
Q_SIGNALS:
void openClicked();
void newClicked();
void recentItemClicked(QUrl const &url);
void forgetAllRecents();
void forgetRecentItem(QUrl const &url);
......
......@@ -110,7 +110,7 @@
</property>
<property name="maximumSize">
<size>
<width>192</width>
<width>272</width>
<height>16777215</height>
</size>
</property>
......@@ -212,22 +212,6 @@
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="openButton">
<property name="text">
......@@ -240,7 +224,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
......@@ -249,12 +233,23 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>48</width>
<height>0</height>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="newButton">
<property name="text">
<string comment="on welcome screen">New Document</string>
</property>
<property name="icon">
<iconset theme="document-new">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
......
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