Commit c9548b0e authored by Fushan Wen's avatar Fushan Wen
Browse files

Add confirmation dialog when marking feed(s) as read

Users sometimes will accidentally mark all articles as read, so showing
a confirmation dialog when doing so could be a solution.

BUG: 443122
parent 8c7e2663
Pipeline #83893 passed with stage
in 10 minutes and 28 seconds
......@@ -766,8 +766,37 @@ void MainWidget::slotPrevUnreadArticle()
}
}
bool MainWidget::confirmMarkFeedAsRead(bool isSingleFeed, bool isGroup)
{
QString msg, caption;
if (isSingleFeed && !isGroup) {
msg = i18n("<qt>Are you sure you want to mark <b>all articles in the feed</b> as read?</qt>");
caption = i18n("Mark Feed as Read");
} else {
if (!isGroup) {
msg = i18n("<qt>Are you sure you want to mark <b>all feeds</b> as read?</qt>");
} else {
msg = i18n("<qt>Are you sure you want to mark <b>all feeds in the folder</b> as read?</qt>");
}
caption = i18n("Mark Feeds as Read");
}
if (KMessageBox::warningContinueCancel(this,
msg,
caption,
KStandardGuiItem::cont(),
KStandardGuiItem::cancel(),
QStringLiteral("Disable Mark Feed As Read Confirmation"))
!= KMessageBox::Continue) {
return false;
}
return true;
}
void MainWidget::slotMarkAllFeedsRead()
{
if (!confirmMarkFeedAsRead(false, false)) {
return;
}
KJob *job = m_feedList->createMarkAsReadJob();
connect(job, &KJob::finished, m_selectionController, &AbstractSelectionController::forceFilterUpdate);
job->start();
......@@ -775,10 +804,11 @@ void MainWidget::slotMarkAllFeedsRead()
void MainWidget::slotMarkAllRead()
{
if (!m_selectionController->selectedSubscription()) {
TreeNode *current = m_selectionController->selectedSubscription();
if (!current || !confirmMarkFeedAsRead(true, current->isGroup())) {
return;
}
KJob *job = m_selectionController->selectedSubscription()->createMarkAsReadJob();
KJob *job = current->createMarkAsReadJob();
connect(job, &KJob::finished, m_selectionController, &AbstractSelectionController::forceFilterUpdate);
job->start();
}
......
......@@ -237,6 +237,8 @@ private:
void deleteExpiredArticles(const QSharedPointer<FeedList> &feedList);
void connectFrame(Akregator::WebEngineFrame *frame);
void cleanUpDownloadFile();
/** ask for confirmation when marking feed(s) as read */
Q_REQUIRED_RESULT bool confirmMarkFeedAsRead(bool isSingleFeed, bool isGroup);
/** opens current article in new tab, background/foreground depends on settings TODO: use selected instead of current? */
void openSelectedArticles(bool openInBackground);
......
Markdown is supported
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