Commit 7b722205 authored by David Brown's avatar David Brown
Browse files

Altered hotlist_add to create the new url after the first selected item or...

Altered hotlist_add to create the new url after the first selected item or inside the first selected directory when an item is selected.
parent 8c9a9091
......@@ -1961,12 +1961,33 @@ _kernel_oserror * hotlist_add(char * description, char * url, int at_bottom)
{
_kernel_oserror * e = NULL;
int position;
hotlist_item * target;
int type;
position = at_bottom ? HOTLIST_POSITION_END : HOTLIST_POSITION_BEGINNING;
target = hotlist_find_selected_item();
if (!target)
{
position = at_bottom ? HOTLIST_POSITION_END : HOTLIST_POSITION_BEGINNING;
target = hotlist_root;
type = 1;
}
else
{
if (target->type == hl_directory)
{
position = HOTLIST_POSITION_BEGINNING;
}
else
{
position = HOTLIST_POSITION_AFTER;
}
type = 2;
}
/* Add the item and ensure the window extent etc. is correct */
e = hotlist_new_url(hotlist_root,
e = hotlist_new_url(target,
position,
description,
url);
......@@ -1987,10 +2008,27 @@ _kernel_oserror * hotlist_add(char * description, char * url, int at_bottom)
case HOTLIST_POSITION_BEGINNING:
{
hotlist_redraw_items(0,
hotlist_count_displayed_items(hotlist_root->data.directory_content));
if (type == 1)
{
hotlist_redraw_items(0,
hotlist_count_displayed_items(hotlist_root->data.directory_content));
}
else
{
if (target->flags & HOTLIST_D_IS_OPEN)
{
hotlist_redraw_items(hotlist_find_no_from_item(target),
hotlist_count_displayed_items(hotlist_root->data.directory_content));
}
}
}
break;
case HOTLIST_POSITION_AFTER:
{
hotlist_redraw_items(hotlist_find_no_from_item(hotlist_newitem),
hotlist_count_displayed_items(hotlist_root->data.directory_content));
}
}
if (!e) return hotlist_modified(HL_MODIFIED_ADD);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment