Permalink
Browse files

Andreas Krennmair:

	fixed issue #112 (patch by Isaac Good)
  • Loading branch information...
akrennmair committed Dec 8, 2008
1 parent 356bb4d commit d026700ac32e8be295bc5ea1de5f154363a837e5
Showing with 17 additions and 1 deletion.
  1. +1 −0 CHANGES
  2. +1 −0 include/itemlist_formaction.h
  3. +15 −1 src/itemlist_formaction.cpp
View
@@ -2,6 +2,7 @@ Changes for newsbeuter:
1.4:
Added more flexible dialog handling
Improved position handling in article list (fixes #112; thanks to Isaac Good)
1.3 (2008-12-06):
Changed some internal data structures to smart pointers (stability improvement).
@@ -87,6 +87,7 @@ class itemlist_formaction : public formaction {
regexmanager * rxman;
unsigned int old_width;
int old_itempos;
};
}
@@ -20,7 +20,7 @@ namespace newsbeuter {
itemlist_formaction::itemlist_formaction(view * vv, std::string formstr)
: formaction(vv,formstr), apply_filter(false), update_visible_items(true), show_searchresult(false),
search_dummy_feed(new rss_feed(v->get_ctrl()->get_cache())),
set_filterpos(false), filterpos(0), rxman(0), old_width(0) {
set_filterpos(false), filterpos(0), rxman(0), old_width(0), old_itempos(-1) {
assert(true==m.parse(FILTER_UNREAD_ITEMS));
}
@@ -43,6 +43,7 @@ void itemlist_formaction::process_operation(operation op, bool automatic, std::v
GetLogger().log(LOG_INFO, "itemlist_formaction: opening item at pos `%s'", itemposname.c_str());
if (itemposname.length() > 0) {
visible_items[itempos].first->set_unread(false); // set article as read
old_itempos = itempos;
v->push_itemview(feed, visible_items[itempos].first->guid());
do_redraw = true;
} else {
@@ -647,6 +648,19 @@ int itemlist_formaction::get_pos(unsigned int realidx) {
void itemlist_formaction::recalculate_form() {
formaction::recalculate_form();
set_update_visible_items(true);
std::string itemposname = f->get("itempos");
unsigned int itempos = utils::to_u(itemposname);
// If the old position was set and it is less than the itempos, use it for the feed's itempos
// Correct the problem when you open itemview and jump to next then exit to itemlist and the itempos is wrong
// This only applies when "show-read-articles" is set to false
if ( (old_itempos != -1) && itempos > (unsigned int)old_itempos
&& ! v->get_cfg()->get_configvalue_as_bool("show-read-articles") )
{
f->set("itempos", utils::strprintf("%u", old_itempos));
old_itempos = -1; // Reset
}
}
void itemlist_formaction::save_article(const std::string& filename, std::tr1::shared_ptr<rss_item> item) {

0 comments on commit d026700

Please sign in to comment.