fix issue that filebox incorrectly loads folder tree on Linux
This commit is contained in:
parent
c348ec4009
commit
8cb29a1617
@ -435,20 +435,20 @@ namespace nana
|
||||
nodes_.filesystem = tree_.insert("FS.ROOT", "Filesystem");
|
||||
nodes_.filesystem.value(kind::filesystem);
|
||||
|
||||
std::vector<std::string> paths;
|
||||
paths.emplace_back(fs_ext::path_user().native());
|
||||
paths.emplace_back("/");
|
||||
std::vector<std::pair<std::string, treebox::item_proxy>> paths;
|
||||
paths.emplace_back(fs_ext::path_user().native(), nodes_.home);
|
||||
paths.emplace_back("/", nodes_.filesystem);
|
||||
|
||||
fs::directory_iterator end;
|
||||
for (auto & p : paths)
|
||||
{
|
||||
for (fs::directory_iterator i(p); i != end; ++i)
|
||||
for (fs::directory_iterator i{p.first}; i != end; ++i)
|
||||
{
|
||||
auto name = i->path().filename().native();
|
||||
if (!is_directory(i->status()) || (name.size() && name[0] == '.'))
|
||||
continue;
|
||||
|
||||
item_proxy node = tree_.insert(nodes_.filesystem, name, name);
|
||||
item_proxy node = tree_.insert(p.second, name, name);
|
||||
if (false == node.empty())
|
||||
{
|
||||
node.value(kind::filesystem);
|
||||
@ -831,8 +831,8 @@ namespace nana
|
||||
{
|
||||
for(fs::directory_iterator u(i->path()); u != end; ++u)
|
||||
{
|
||||
auto uname = i->path().filename().native();
|
||||
if ((!is_directory(*i)) || (uname.size() && uname[0] == '.'))
|
||||
auto uname = u->path().filename().native();
|
||||
if ((!is_directory(*u)) || (uname.size() && uname[0] == '.'))
|
||||
continue;
|
||||
|
||||
child.append(uname, uname, kind::filesystem);
|
||||
|
||||
@ -1825,7 +1825,6 @@ namespace nana
|
||||
item_locator nl(impl_, xpos, arg.pos.x, arg.pos.y);
|
||||
impl_->attr.tree_cont.for_each<item_locator&>(shape.first, nl);
|
||||
|
||||
bool has_redraw = false;
|
||||
|
||||
auto & node_state = impl_->node_state;
|
||||
node_state.pressed_node = nl.node();
|
||||
@ -1834,21 +1833,17 @@ namespace nana
|
||||
{
|
||||
if(impl_->set_expanded(node_state.pressed_node, !node_state.pressed_node->value.second.expanded))
|
||||
impl_->make_adjust(node_state.pressed_node, 0);
|
||||
|
||||
has_redraw = true; //btw, don't select the node
|
||||
}
|
||||
|
||||
if ((!has_redraw) && (node_state.selected != node_state.pressed_node))
|
||||
else if (node_state.selected != node_state.pressed_node)
|
||||
{
|
||||
impl_->set_selected(node_state.pressed_node);
|
||||
has_redraw = true;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if(has_redraw)
|
||||
{
|
||||
impl_->draw(true);
|
||||
API::dev::lazy_refresh();
|
||||
}
|
||||
|
||||
impl_->draw(true);
|
||||
API::dev::lazy_refresh();
|
||||
}
|
||||
|
||||
void trigger::mouse_up(graph_reference, const arg_mouse& arg)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user