1 /*
2  * Copyright 2004 Martin Fuchs
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18 
19 
20  //
21  // Explorer and Desktop clone
22  //
23  // favorites.h
24  //
25  // Martin Fuchs, 04.04.2004
26  //
27 
28 
29 extern String DecodeURLString(const char* s);
30 
31 
32 struct Bookmark
33 {
34 	Bookmark() : _icon_idx(0) {}
35 
36 	String	_name;
37 	String	_description;
38 	String	_url;
39 	String	_icon_path;
40 	int		_icon_idx;
41 
42 	bool	read_url(LPCTSTR path);
43 	bool	read(const_XMLPos& pos);
44 	void	write(XMLPos& pos) const;
45 };
46 
47 struct BookmarkFolder;
48 
49 struct BookmarkNode
50 {
51 	BookmarkNode();
52 	BookmarkNode(const Bookmark& bm);
53 	BookmarkNode(const BookmarkFolder& bmf);
54 	BookmarkNode(const BookmarkNode& other);
55 
56 	~BookmarkNode();
57 
58 	BookmarkNode& operator=(const Bookmark& bm);
59 	BookmarkNode& operator=(const BookmarkFolder& bmf);
60 	BookmarkNode& operator=(const BookmarkNode& other);
61 
62 	void	clear();
63 
64 	enum BOOKMARKNODE_TYPE {
65 		BMNT_NONE, BMNT_BOOKMARK, BMNT_FOLDER
66 	};
67 
68 	BOOKMARKNODE_TYPE	_type;
69 
70 	union {
71 		Bookmark*		_pbookmark;
72 		BookmarkFolder* _pfolder;
73 	};
74 };
75 
76 struct BookmarkList : public list<BookmarkNode>
77 {
78 	void	import_IE_favorites(struct ShellDirectory& dir, HWND hwnd);
79 
80 	void	read(const_XMLPos& pos);
81 	void	write(XMLPos& pos) const;
82 
83 	void	fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST, HDC hdc_wnd) const;
84 };
85 
86 struct BookmarkFolder
87 {
88 	String	_name;
89 	String	_description;
90 	BookmarkList _bookmarks;
91 
92 	void	read(const_XMLPos& pos);
93 	void	write(XMLPos& pos) const;
94 };
95 
96 struct Favorites : public BookmarkList
97 {
98 	typedef BookmarkList super;
99 
100 	bool	read(LPCTSTR path);
101 	void	write(LPCTSTR path) const;
102 
103 	bool	import_IE_favorites(HWND hwnd);
104 };
105