#include <favorites.h>


Public Member Functions | |
| void | import_IE_favorites (struct ShellDirectory &dir, HWND hwnd) |
| import Internet Explorer bookmarks from Favorites folder into bookmark list | |
| void | read (const_XMLPos &pos) |
| void | write (XMLPos &pos) const |
| void | fill_tree (HWND hwnd, HTREEITEM parent, HIMAGELIST, HDC hdc_wnd) const |
| fill treeview control with bookmark tree content | |
Definition at line 76 of file favorites.h.
| void BookmarkList::fill_tree | ( | HWND | hwnd, |
| HTREEITEM | parent, | ||
| HIMAGELIST | himagelist, | ||
| HDC | hdc_wnd | ||
| ) | const |
fill treeview control with bookmark tree content
Definition at line 327 of file favorites.cpp.
References BookmarkFolder::_bookmarks, ExplorerGlobals::_icon_cache, Bookmark::_icon_idx, Bookmark::_icon_path, Bookmark::_name, BookmarkFolder::_name, BookmarkNode::_pbookmark, BookmarkNode::_pfolder, BookmarkNode::_type, Icon::add_to_imagelist(), BookmarkNode::BMNT_BOOKMARK, BookmarkNode::BMNT_FOLDER, IconCache::extract(), fill_tree(), g_Globals, and ICID_NONE.
Referenced by fill_tree(), and MainFrameBase::FillBookmarks().
{
TV_INSERTSTRUCT tvi;
tvi.hParent = parent;
tvi.hInsertAfter = TVI_LAST;
TV_ITEM& tv = tvi.item;
tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
for(const_iterator it=begin(); it!=end(); ++it) {
const BookmarkNode& node = *it;
tv.lParam = (LPARAM)&node;
if (node._type == BookmarkNode::BMNT_FOLDER) {
const BookmarkFolder& folder = *node._pfolder;
tv.pszText = (LPTSTR)folder._name.c_str();
tv.iImage = 3; // folder
tv.iSelectedImage = 4; // open folder
HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi);
folder._bookmarks.fill_tree(hwnd, hitem, himagelist, hdc_wnd);
} else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
const Bookmark& bookmark = *node._pbookmark;
tv.pszText = (LPTSTR)bookmark._name.c_str();
tv.iImage = 1; // bookmark
tv.iSelectedImage = 2; // selected bookmark
if (!bookmark._icon_path.empty()) {
const Icon& icon = g_Globals._icon_cache.extract(bookmark._icon_path, bookmark._icon_idx);
if ((ICON_ID)icon != ICID_NONE)
tv.iImage = tv.iSelectedImage = icon.add_to_imagelist(himagelist, hdc_wnd);
}
(void)TreeView_InsertItem(hwnd, &tvi);
}
}
}


| void BookmarkList::import_IE_favorites | ( | struct ShellDirectory & | dir, |
| HWND | hwnd | ||
| ) |
import Internet Explorer bookmarks from Favorites folder into bookmark list
Definition at line 372 of file favorites.cpp.
References BookmarkFolder::_bookmarks, Entry::_down, ShellDirectory::_folder, _MAX_EXT, Bookmark::_name, BookmarkFolder::_name, Entry::_next, _tcsicmp, _tsplitpath_s, COUNTOF, XMLStorage::DecodeXMLString(), ET_SHELL, ShellFolder::get_name(), GetDesktopFolder(), import_IE_favorites(), Bookmark::read_url(), SCAN_DONT_EXTRACT_ICONS, Entry::smart_scan(), SORT_NAME, and TEXT.
Referenced by Favorites::import_IE_favorites(), and import_IE_favorites().
{
TCHAR path[MAX_PATH], ext[_MAX_EXT];
dir.smart_scan(SORT_NAME, SCAN_DONT_EXTRACT_ICONS);
for(Entry*entry=dir._down; entry; entry=entry->_next) {
if (entry->_shell_attribs & SFGAO_HIDDEN) // ignore files like "desktop.ini"
continue;
String name;
if (entry->_etype == ET_SHELL)
name = dir._folder.get_name(static_cast<ShellEntry*>(entry)->_pidl);
else
name = entry->_display_name;
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
BookmarkFolder new_folder;
new_folder._name = DecodeXMLString(name);
if (entry->_etype == ET_SHELL) {
ShellDirectory new_dir(dir._folder, static_cast<ShellEntry*>(entry)->_pidl, hwnd);
new_folder._bookmarks.import_IE_favorites(new_dir, hwnd);
} else {
entry->get_path(path, COUNTOF(path));
ShellDirectory new_dir(GetDesktopFolder(), path, hwnd);
new_folder._bookmarks.import_IE_favorites(new_dir, hwnd);
}
push_back(new_folder);
} else {
Bookmark bookmark;
bookmark._name = DecodeXMLString(name);
entry->get_path(path, COUNTOF(path));
_tsplitpath_s(path, NULL, 0, NULL, 0, NULL, 0, ext, COUNTOF(ext));
if (!_tcsicmp(ext, TEXT(".url"))) {
bookmark.read_url(path);
push_back(bookmark);
} else {
///@todo read shell links
//assert(0);
}
}
}
}


| void BookmarkList::read | ( | const_XMLPos & | pos ) |
| void BookmarkList::write | ( | XMLPos & | pos ) | const |
|
ROS Explorer Source Code Documentation
generated on 02.01.2013 by
|