summaryrefslogtreecommitdiff
path: root/include/itemview_formaction.h
blob: b845d152acf980d6f55dfd91c88390eed43e4072 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef NEWSBEUTER_ITEMVIEW_FORMACTION__H
#define NEWSBEUTER_ITEMVIEW_FORMACTION__H

#include <formaction.h>
#include <htmlrenderer.h>
#include <regexmanager.h>
#include <rss.h>

namespace newsbeuter {

class itemlist_formaction;

class itemview_formaction : public formaction {
	public:
		itemview_formaction(view *, std::tr1::shared_ptr<itemlist_formaction> il, std::string formstr);
		virtual ~itemview_formaction();
		virtual void prepare();
		virtual void init();
		inline void set_guid(const std::string& guid_) { 
			LOG(LOG_DEBUG, "itemview_formaction::set_guid: new guid = %s", guid_.c_str()); 
			guid = guid_; 
		}
		inline void set_feed(std::tr1::shared_ptr<rss_feed> fd) { feed = fd; }
		void set_highlightphrase(const std::string& text);
		keymap_hint_entry * get_keymap_hint();
		virtual void handle_cmdline(const std::string& cmd);

		virtual std::string id() const { return "article"; }
		virtual std::string title();

		virtual void finished_qna(operation op);

		std::vector<std::string> render_html(const std::string& source, std::vector<linkpair>& links, const std::string& feedurl, unsigned int render_width);

		void set_regexmanager(regexmanager * r);

		void update_percent();

	private:
		virtual void process_operation(operation op, bool automatic = false, std::vector<std::string> * args = NULL);
		void set_head(const std::string& s, unsigned int unread, unsigned int total);
		void highlight_text(const std::string& searchphrase);

		void render_source(std::vector<std::string>& lines, std::string desc, unsigned int width);

		void do_search();
		
		std::string guid;
		std::tr1::shared_ptr<rss_feed> feed;
		bool show_source;
		std::vector<linkpair> links;
		bool quit;
		regexmanager * rxman;
		unsigned int num_lines;
		std::tr1::shared_ptr<itemlist_formaction> itemlist;
		bool in_search;
};

}

#endif