Commit 182c6dfa authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

add a go to overview action

previously there was no real way to get back to the mainpage. it's all a
bit awkward because of how state management works, but I don't
realistically see that improving a lot with qwidgets. in kirigami we can
do it smarter while porting, if we ever port

in the meantime this adds an overview button to the toolbar which shows
the summary widget

BUG: 450512
parent 52a2232a
Pipeline #157865 passed with stage
in 42 seconds
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
<gui name="filelight" version="5">
<gui name="filelight" version="6">
<MenuBar>
<Menu name="file" noMerge="1"><text>&amp;Scan</text>
<Action name="scan_folder"/>
......@@ -22,6 +22,7 @@
</MenuBar>
<ToolBar name="mainToolBar"><text>Main Toolbar</text>
<Action name="go_overview"/>
<Action name="go_back"/>
<Action name="go_forward"/>
<Action name="go_up"/>
......
......@@ -161,6 +161,13 @@ void MainWindow::setupActions() //singleton function
action->setText(i18n("Go"));
action->setIcon(QIcon::fromTheme(QStringLiteral("go-jump-locationbar")));
action = ac->addAction(QStringLiteral("go_overview"), m_combo, [this]() {
slotAbortScan();
showSummary();
});
action->setText(i18nc("@action go to overview page, listing browsable mount points", "Overview"));
action->setIcon(QIcon::fromTheme(QStringLiteral("go-jump-locationbar")));
action = ac->addAction(QStringLiteral("scan_folder"), this, &MainWindow::slotScanFolder);
action->setText(i18n("Scan Folder"));
action->setIcon(QIcon::fromTheme(QStringLiteral("folder")));
......@@ -395,8 +402,7 @@ bool MainWindow::openUrl(const QUrl &u)
else
{
//we don't want to be using the summary screen anymore
if (m_summary != nullptr)
m_summary->hide();
hideSummary();
m_stateWidget->show();
m_layout->addWidget(m_stateWidget);
......@@ -570,8 +576,16 @@ void MainWindow::showSummary()
connect(m_summary, &SummaryWidget::activated, this, &MainWindow::openUrl);
m_summary->show();
m_layout->addWidget(m_summary);
} else {
m_summary->show();
}
}
void MainWindow::hideSummary()
{
if (m_summary != nullptr) {
m_summary->hide();
}
else m_summary->show();
}
} //namespace Filelight
......@@ -87,6 +87,7 @@ private:
bool closeUrl();
QString prettyUrl(const QUrl &url) const;
void showSummary();
void hideSummary();
bool start(const QUrl&);
KSqueezedTextLabel *m_status[2];
......
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