diff options
author | 2018-03-17 18:26:40 +0200 | |
---|---|---|
committer | 2018-03-17 19:26:40 +0300 | |
commit | ba03e35b0b0f7da8aa3fe236492c5e9c3f1f2ad3 (patch) | |
tree | fe7152e845f246fbda9ed8b2327263da8ce0ad68 | |
parent | c17a8fd8831e3b5c1ab242b8d9261b59ff685510 (diff) | |
download | newsboat-ba03e35b0b0f7da8aa3fe236492c5e9c3f1f2ad3.tar.gz newsboat-ba03e35b0b0f7da8aa3fe236492c5e9c3f1f2ad3.tar.zst newsboat-ba03e35b0b0f7da8aa3fe236492c5e9c3f1f2ad3.zip |
Implemented new command: Mark feed read until current article (#144)
New command: Mark all above as read
Diffstat (limited to '')
-rw-r--r-- | doc/keycmds.dsv | 1 | ||||
-rw-r--r-- | include/keymap.h | 1 | ||||
-rw-r--r-- | src/itemlist_formaction.cpp | 17 | ||||
-rw-r--r-- | src/keymap.cpp | 5 |
4 files changed, 24 insertions, 0 deletions
diff --git a/doc/keycmds.dsv b/doc/keycmds.dsv index 474ad333..1139a8f5 100644 --- a/doc/keycmds.dsv +++ b/doc/keycmds.dsv @@ -5,6 +5,7 @@ reload||r||Reload the currently selected feed. reload-all||R||Reload all feeds. mark-feed-read||A||Mark all articles in the currently selected feed read. mark-all-feeds-read||C||Mark articles in all feeds read. +mark-all-above-as-read||n/a||Mark all above as read. save||s||Save the currently selected article to a file. next-unread||n||Jump to the next unread article. prev-unread||p||Jump to the previous unread article. diff --git a/include/keymap.h b/include/keymap.h index efb5819f..99c62163 100644 --- a/include/keymap.h +++ b/include/keymap.h @@ -38,6 +38,7 @@ enum operation { OP_NIL = 0, OP_RELOADALL, OP_MARKFEEDREAD, OP_MARKALLFEEDSREAD, + OP_MARKALLABOVEASREAD, OP_OPEN, OP_SAVE, OP_NEXTUNREAD, diff --git a/src/itemlist_formaction.cpp b/src/itemlist_formaction.cpp index edada713..f0557dc4 100644 --- a/src/itemlist_formaction.cpp +++ b/src/itemlist_formaction.cpp @@ -361,6 +361,23 @@ void itemlist_formaction::process_operation(operation op, bool automatic, std::v v->show_error(strprintf::fmt(_("Error: couldn't mark feed read: %s"), e.what())); } break; + case OP_MARKALLABOVEASREAD: + LOG(level::INFO, "itemlist_formaction: marking all above as read"); + v->set_status(_("Marking all above as read...")); + if (itemposname.length() > 0 && itempos < visible_items.size()) { + for (unsigned int i=0; i<itempos; ++i) { + if (visible_items[i].first->unread()) { + visible_items[i].first->set_unread(false); + v->get_ctrl()->mark_article_read(visible_items[i].first->guid(), true); + } + } + if (!v->get_cfg()->get_configvalue_as_bool("show-read-articles")) { + f->set("itempos","0"); + } + invalidate(InvalidationMode::COMPLETE); + } + v->set_status(""); + break; case OP_TOGGLESHOWREAD: m.parse(FILTER_UNREAD_ITEMS); LOG(level::DEBUG, "itemlist_formaction: toggling show-read-articles"); diff --git a/src/keymap.cpp b/src/keymap.cpp index efd0a11a..b73fd807 100644 --- a/src/keymap.cpp +++ b/src/keymap.cpp @@ -58,6 +58,11 @@ static op_desc opdescs[] = { KM_FEEDLIST }, { + OP_MARKALLABOVEASREAD, "mark-all-above-as-read", "", + _("Mark all above as read"), + KM_ARTICLELIST + }, + { OP_SAVE, "save", "s", _("Save article"), KM_ARTICLELIST | KM_ARTICLE |