~ubuntu-branches/ubuntu/natty/newsbeuter/natty

« back to all changes in this revision

Viewing changes to src/itemview_formaction.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Nico Golde
  • Date: 2010-03-23 19:09:18 UTC
  • mfrom: (4.1.10 sid)
  • Revision ID: james.westby@ubuntu.com-20100323190918-o3mwdwl3v4li449s
Tags: 2.2-2
Do not cleanup deleted items uppon quitting so they will be
reloaded and marked as new next time (Closes: #574665).

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
                if (show_source) {
125
125
                        render_source(lines, utils::quote_for_stfl(item->description()), render_width);
126
126
                } else {
127
 
                        lines = render_html(item->description(), links, item->feedurl(), render_width);
 
127
                        std::string baseurl = item->get_base() != "" ? item->get_base() : item->feedurl();
 
128
                        lines = render_html(item->description(), links, baseurl, render_width);
128
129
                }
129
130
 
130
131
                listfmt.add_lines(lines, view_width);
146
147
 
147
148
void itemview_formaction::process_operation(operation op, bool automatic, std::vector<std::string> * args) {
148
149
        std::tr1::shared_ptr<rss_item> item = feed->get_item_by_guid(guid);
 
150
        bool hardquit = false;
149
151
 
150
152
        /*
151
153
         * whenever we process an operation, we mark the item
155
157
         * recorded in the database.
156
158
         */
157
159
        try {
 
160
                bool old_unread = item->unread();
158
161
                item->set_unread(false);
 
162
                if (old_unread) {
 
163
                        v->get_ctrl()->mark_article_read(item->guid(), true);
 
164
                }
159
165
        } catch (const dbexception& e) {
160
166
                v->show_error(utils::strprintf(_("Error while marking article as read: %s"), e.what()));
161
167
        }
162
168
 
163
169
        switch (op) {
164
 
                case OP_OPEN:
165
 
                        // nothing
166
 
                        break;
167
170
                case OP_TOGGLESOURCEVIEW:
168
171
                        LOG(LOG_INFO, "view::run_itemview: toggling source view");
169
172
                        show_source = !show_source;
302
305
                        v->set_status(_("Toggling read flag for article..."));
303
306
                        try {
304
307
                                item->set_unread(true);
 
308
                                v->get_ctrl()->mark_article_read(item->guid(), false);
305
309
                        } catch (const dbexception& e) {
306
310
                                v->show_error(utils::strprintf(_("Error while marking article as unread: %s"), e.what()));
307
311
                        }
312
316
                        LOG(LOG_INFO, "view::run_itemview: quitting");
313
317
                        quit = true;
314
318
                        break;
 
319
                case OP_HARDQUIT:
 
320
                        LOG(LOG_INFO, "view::run_itemview: hard quitting");
 
321
                        hardquit = true;
 
322
                        break;
315
323
                case OP_HELP:
316
324
                        v->push_help();
317
325
                        break;
352
360
                        break;
353
361
        }
354
362
 
355
 
        if (quit) {
 
363
        if (hardquit) {
 
364
                while (v->formaction_stack_size() > 0) {
 
365
                        v->pop_current_formaction();
 
366
                }
 
367
        } else if (quit) {
356
368
                v->pop_current_formaction();
357
369
        }
358
370
 
361
373
keymap_hint_entry * itemview_formaction::get_keymap_hint() {
362
374
        static keymap_hint_entry hints[] = {
363
375
                { OP_QUIT, _("Quit") },
364
 
                { OP_OPEN, _("Open") },
365
376
                { OP_SAVE, _("Save") },
366
377
                { OP_NEXTUNREAD, _("Next Unread") },
367
378
                { OP_OPENINBROWSER, _("Open in Browser") },
451
462
        switch (op) {
452
463
                case OP_INT_EDITFLAGS_END:
453
464
                        item->set_flags(qna_responses[0]);
454
 
                        item->update_flags();
 
465
                        v->get_ctrl()->update_flags(item);
455
466
                        v->set_status(_("Flags updated."));
456
467
                        do_redraw = true;
457
468
                        break;