Skip to content
Permalink
Browse files

add "open-in-browser-and-mark-read" key (fixes issue #170; patch by I…

…saac Good).
  • Loading branch information...
akrennmair committed Feb 24, 2010
1 parent 06e53a0 commit 6c87cf4233f0156210d66c259ca09d696bf65433
Showing with 29 additions and 28 deletions.
  1. +1 −0 CHANGES
  2. +1 −0 include/keymap.h
  3. +26 −28 src/itemlist_formaction.cpp
  4. +1 −0 src/keymap.cpp
@@ -9,6 +9,7 @@ Changes for newsbeuter:
Added "download status" format specifier for feedlist-format (fixes issue #181).
Added HTML table renderer (patch by Stefan Erben)
Fixed issues #183, #188 (patch by Stefan Erben)
Added "open-in-browser-and-mark-read" key (patch by Isaac Good)

2.1 (2009-12-08):
Added support for dc:creator tag for RSS 2.0 parser.
@@ -44,6 +44,7 @@ namespace newsbeuter {
OP_NEXTUNREAD,
OP_PREVUNREAD,
OP_OPENINBROWSER,
OP_OPENBROWSER_AND_MARK,
OP_HELP,
OP_TOGGLESOURCEVIEW,
OP_TOGGLEITEMREAD,
@@ -78,6 +78,7 @@ void itemlist_formaction::process_operation(operation op, bool automatic, std::v
do_redraw = true;
}
break;
case OP_OPENBROWSER_AND_MARK:
case OP_OPENINBROWSER: {
LOG(LOG_INFO, "itemlist_formaction: opening item at pos `%s'", itemposname.c_str());
if (itemposname.length() > 0 && visible_items.size() != 0) {
@@ -89,6 +90,31 @@ void itemlist_formaction::process_operation(operation op, bool automatic, std::v
v->show_error(_("No item selected!")); // should not happen
}
}
if (op == OP_OPENINBROWSER) break; //else fall through to OP_TOGGLEITEMREAD
case OP_TOGGLEITEMREAD: {
LOG(LOG_INFO, "itemlist_formaction: toggling item read at pos `%s'", itemposname.c_str());
if (itemposname.length() > 0) {
v->set_status(_("Toggling read flag for article..."));
try {
if (automatic && args->size() > 0) {
if ((*args)[0] == "read") {
visible_items[itempos].first->set_unread(false);
} else if ((*args)[0] == "unread") {
visible_items[itempos].first->set_unread(true);
}
v->set_status("");
} else {
visible_items[itempos].first->set_unread(!visible_items[itempos].first->unread());
v->set_status("");
}
} catch (const dbexception& e) {
v->set_status(utils::strprintf(_("Error while toggling read flag: %s"), e.what()));
}
if (itempos < visible_items.size()-1)
f->set("itempos", utils::strprintf("%u", itempos + 1));
do_redraw = true;
}
}
break;
case OP_SHOWURLS:
if (itemposname.length() > 0 && visible_items.size() != 0) {
@@ -290,34 +316,6 @@ void itemlist_formaction::process_operation(operation op, bool automatic, std::v
}
}
break;
case OP_TOGGLEITEMREAD: {
LOG(LOG_INFO, "itemlist_formaction: toggling item read at pos `%s'", itemposname.c_str());
if (itemposname.length() > 0 && visible_items.size() != 0) {
v->set_status(_("Toggling read flag for article..."));
try {
if (automatic && args->size() > 0) {
if ((*args)[0] == "read") {
visible_items[itempos].first->set_unread(false);
v->get_ctrl()->mark_article_read(visible_items[itempos].first->guid(), true);
} else if ((*args)[0] == "unread") {
visible_items[itempos].first->set_unread(true);
v->get_ctrl()->mark_article_read(visible_items[itempos].first->guid(), false);
}
v->set_status("");
} else {
v->get_ctrl()->mark_article_read(visible_items[itempos].first->guid(), visible_items[itempos].first->unread()); // sic!
visible_items[itempos].first->set_unread(!visible_items[itempos].first->unread());
v->set_status("");
}
} catch (const dbexception& e) {
v->set_status(utils::strprintf(_("Error while toggling read flag: %s"), e.what()));
}
if (itempos < visible_items.size()-1)
f->set("itempos", utils::strprintf("%u", itempos + 1));
do_redraw = true;
}
}
break;
case OP_SELECTFILTER:
if (v->get_ctrl()->get_filters().size() > 0) {
std::string newfilter;
@@ -31,6 +31,7 @@ static op_desc opdescs[] = {
{ OP_NEXTUNREAD, "next-unread", "n", _("Go to next unread article"), KM_FEEDLIST | KM_ARTICLELIST | KM_ARTICLE },
{ OP_PREVUNREAD, "prev-unread", "p", _("Go to previous unread article"), KM_FEEDLIST | KM_ARTICLELIST | KM_ARTICLE },
{ OP_RANDOMUNREAD, "random-unread", "^K", _("Go to a random unread article"), KM_FEEDLIST | KM_ARTICLELIST | KM_ARTICLE },
{ OP_OPENBROWSER_AND_MARK, "open-in-browser-and-mark-read", "O", _("Open article in browser and mark read"), KM_ARTICLELIST },
{ OP_OPENINBROWSER, "open-in-browser", "o", _("Open article in browser"), KM_FEEDLIST | KM_ARTICLELIST | KM_ARTICLE },
{ OP_HELP, "help", "?", _("Open help dialog"), KM_FEEDLIST | KM_ARTICLELIST | KM_ARTICLE | KM_PODBEUTER },
{ OP_TOGGLESOURCEVIEW, "toggle-source-view", "^U", _("Toggle source view"), KM_ARTICLE },

0 comments on commit 6c87cf4

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.