Commit 39d545c6 authored by Eric Armbruster's avatar Eric Armbruster 🍁
Browse files

welcomeview: add open folder button

parent 8271a040
Pipeline #234403 passed with stage
in 9 minutes and 5 seconds
......@@ -172,6 +172,7 @@ KateProjectPluginView::KateProjectPluginView(KateProjectPlugin *plugin, KTextEdi
*/
auto a = actionCollection()->addAction(QStringLiteral("projects_open_project"), this, SLOT(openDirectoryOrProject()));
a->setText(i18n("Open Folder..."));
a->setIcon(QIcon::fromTheme(QStringLiteral("document-open-folder")));
m_projectTodosAction = a = actionCollection()->addAction(QStringLiteral("projects_todos"), this, SLOT(showProjectTodos()));
a->setText(i18n("Project TODOs"));
......
......@@ -1502,13 +1502,20 @@ void KateViewManager::showWelcomeView()
return;
auto welcomeView = new WelcomeView(this);
connect(welcomeView, &WelcomeView::openClicked, this, &KateViewManager::slotDocumentOpen);
connect(welcomeView, &WelcomeView::newClicked, this, &KateViewManager::slotDocumentNew);
connect(welcomeView, &WelcomeView::openDocumentClicked, this, &KateViewManager::slotDocumentOpen);
connect(welcomeView, &WelcomeView::newDocumentClicked, this, &KateViewManager::slotDocumentNew);
connect(welcomeView, &WelcomeView::recentItemClicked, this, [this](const QUrl &url) {
openUrl(url);
});
connect(welcomeView, &WelcomeView::forgetRecentItem, this, &KateViewManager::forgetRecentItem);
QObject *project = mainWindow()->pluginView(QStringLiteral("kateprojectplugin"));
if (project) {
connect(welcomeView, &WelcomeView::openFolderClicked, this, [this, project]() {
QMetaObject::invokeMethod(project, "openDirectoryOrProject");
});
}
auto recentFilesAction = mainWindow()->recentFilesAction();
connect(recentFilesAction, &KRecentFilesAction::recentListCleared, this, &KateViewManager::refreshRecentsOnWelcomeView);
connect(welcomeView, &WelcomeView::forgetAllRecents, recentFilesAction, &KRecentFilesAction::clear);
......
......@@ -130,8 +130,9 @@ WelcomeView::WelcomeView(QWidget *parent)
welcomeLabel->setText(KateApp::isKate() ? i18n("Welcome to Kate") : i18n("Welcome to KWrite"));
appIcon->setPixmap(qApp->windowIcon().pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous));
connect(openButton, &QPushButton::clicked, this, &WelcomeView::openClicked);
connect(newButton, &QPushButton::clicked, this, &WelcomeView::newClicked);
connect(openDocumentButton, &QPushButton::clicked, this, &WelcomeView::openDocumentClicked);
connect(openFolderButton, &QPushButton::clicked, this, &WelcomeView::openFolderClicked);
connect(newDocumentButton, &QPushButton::clicked, this, &WelcomeView::newDocumentClicked);
recentsListView->setContextMenuPolicy(Qt::DefaultContextMenu);
recentsListView->setModel(m_recentsModel);
......
......@@ -37,8 +37,9 @@ public Q_SLOTS:
}
Q_SIGNALS:
void openClicked();
void newClicked();
void openDocumentClicked();
void openFolderClicked();
void newDocumentClicked();
void recentItemClicked(QUrl const &url);
void forgetAllRecents();
void forgetRecentItem(QUrl const &url);
......
......@@ -213,7 +213,7 @@
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QPushButton" name="newButton">
<widget class="QPushButton" name="newDocumentButton">
<property name="text">
<string comment="on welcome screen">New Document</string>
</property>
......@@ -224,7 +224,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="openButton">
<widget class="QPushButton" name="openDocumentButton">
<property name="text">
<string comment="on welcome screen">Open Document...</string>
</property>
......@@ -234,6 +234,17 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="openFolderButton">
<property name="text">
<string comment="on welcome screen">Open Folder...</string>
</property>
<property name="icon">
<iconset theme="document-open-folder">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
......@@ -442,7 +453,7 @@
</layout>
</widget>
<tabstops>
<tabstop>openButton</tabstop>
<tabstop>openDocumentButton</tabstop>
</tabstops>
<resources/>
<connections/>
......
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