File: dirbrowserformaction.h

package info (click to toggle)
newsboat 2.38-0.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,540 kB
  • sloc: cpp: 90,216; xml: 606; sh: 429; makefile: 369; ruby: 258; python: 239; ansic: 211; php: 63; awk: 59; perl: 38
file content (58 lines) | stat: -rw-r--r-- 1,362 bytes parent folder | download
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
#ifndef NEWSBOAT_DIRBROWSERFORMACTION_H
#define NEWSBOAT_DIRBROWSERFORMACTION_H

#include <sys/stat.h>
#include <grp.h>

#include "configcontainer.h"
#include "file_system.h"
#include "formaction.h"
#include "listwidget.h"
#include "stflrichtext.h"

namespace newsboat {

class DirBrowserFormAction : public FormAction {
public:
	DirBrowserFormAction(View&, std::string formstr, ConfigContainer* cfg);
	~DirBrowserFormAction() override = default;
	void prepare() override;
	void init() override;
	std::vector<KeyMapHintEntry> get_keymap_hint() const override;

	std::string id() const override
	{
		return "dirbrowser";
	}
	std::string title() override;

protected:
	std::string main_widget() const override
	{
		return "files";
	}

private:
	bool process_operation(Operation op,
		const std::vector<std::string>& args,
		BindingType bindingType = BindingType::BindKey) override;
	void update_title(const std::string& working_directory);

	void add_directory(std::vector<file_system::FileSystemEntry>& id_at_position,
		std::string dirname);
	std::vector<file_system::FileSystemEntry> id_at_position;
	std::vector<StflRichText> lines;

	std::string get_formatted_dirname(std::string dirname, mode_t mode);

	LineView file_prompt_line;
	std::string cwd;

	ListWidget files_list;

	View& view;
};

} // namespace newsboat

#endif //NEWSBOAT_DIRBROWSERFORMACTION_H