summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.c16
-rw-r--r--src/ui/sidebarwidget.c13
2 files changed, 23 insertions, 6 deletions
diff --git a/src/app.c b/src/app.c
index c6918eb5..2f4b4fb8 100644
--- a/src/app.c
+++ b/src/app.c
@@ -2766,15 +2766,21 @@ iBool handleCommand_App(const char *cmd) {
2766 return iTrue; 2766 return iTrue;
2767 } 2767 }
2768 else if (equal_Command(cmd, "bookmarks.addfolder")) { 2768 else if (equal_Command(cmd, "bookmarks.addfolder")) {
2769 const int parentId = argLabel_Command(cmd, "parent");
2769 if (suffixPtr_Command(cmd, "value")) { 2770 if (suffixPtr_Command(cmd, "value")) {
2770 add_Bookmarks(d->bookmarks, NULL, collect_String(suffix_Command(cmd, "value")), NULL, 0); 2771 uint32_t id = add_Bookmarks(d->bookmarks, NULL,
2772 collect_String(suffix_Command(cmd, "value")), NULL, 0);
2773 if (parentId) {
2774 get_Bookmarks(d->bookmarks, id)->parentId = parentId;
2775 }
2771 postCommand_App("bookmarks.changed"); 2776 postCommand_App("bookmarks.changed");
2772 } 2777 }
2773 else { 2778 else {
2774 iWidget *dlg = makeValueInput_Widget(get_Root()->widget, 2779 iWidget *dlg = makeValueInput_Widget(
2775 collectNewCStr_String(cstr_Lang("dlg.addfolder.defaulttitle")), 2780 get_Root()->widget, collectNewCStr_String(cstr_Lang("dlg.addfolder.defaulttitle")),
2776 uiHeading_ColorEscape "${heading.addfolder}", "${dlg.addfolder.prompt}", 2781 uiHeading_ColorEscape "${heading.addfolder}", "${dlg.addfolder.prompt}",
2777 uiTextAction_ColorEscape "${dlg.addfolder}", "bookmarks.addfolder"); 2782 uiTextAction_ColorEscape "${dlg.addfolder}",
2783 format_CStr("bookmarks.addfolder parent:%d", parentId));
2778 setSelectAllOnFocus_InputWidget(findChild_Widget(dlg, "input"), iTrue); 2784 setSelectAllOnFocus_InputWidget(findChild_Widget(dlg, "input"), iTrue);
2779 } 2785 }
2780 return iTrue; 2786 return iTrue;
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 6c2934ec..e8aa69c1 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -446,7 +446,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
446 { "---", 0, 0, NULL }, 446 { "---", 0, 0, NULL },
447 { delete_Icon " " uiTextCaution_ColorEscape "${bookmark.delete}", 0, 0, "bookmark.delete" }, 447 { delete_Icon " " uiTextCaution_ColorEscape "${bookmark.delete}", 0, 0, "bookmark.delete" },
448 { "---", 0, 0, NULL }, 448 { "---", 0, 0, NULL },
449 { add_Icon " ${menu.newfolder}", 0, 0, "bookmarks.addfolder" }, 449 { add_Icon " ${menu.newfolder}", 0, 0, "bookmark.addfolder" },
450 { reload_Icon " ${bookmarks.reload}", 0, 0, "bookmarks.reload.remote" }, 450 { reload_Icon " ${bookmarks.reload}", 0, 0, "bookmarks.reload.remote" },
451 { "---", 0, 0, NULL }, 451 { "---", 0, 0, NULL },
452 { upDownArrow_Icon " ${menu.sort.alpha}", 0, 0, "bookmark.sortfolder" } }, 452 { upDownArrow_Icon " ${menu.sort.alpha}", 0, 0, "bookmark.sortfolder" } },
@@ -1319,6 +1319,17 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
1319 } 1319 }
1320 return iTrue; 1320 return iTrue;
1321 } 1321 }
1322 else if (isCommand_Widget(w, ev, "bookmark.addfolder")) {
1323 const iSidebarItem *item = d->contextItem;
1324 if (d->mode == bookmarks_SidebarMode) {
1325 postCommandf_App("bookmarks.addfolder parent:%zu",
1326 !item ? 0
1327 : item->listItem.isDropTarget
1328 ? item->id
1329 : get_Bookmarks(bookmarks_App(), item->id)->parentId);
1330 }
1331 return iTrue;
1332 }
1322 else if (isCommand_Widget(w, ev, "bookmark.sortfolder")) { 1333 else if (isCommand_Widget(w, ev, "bookmark.sortfolder")) {
1323 const iSidebarItem *item = d->contextItem; 1334 const iSidebarItem *item = d->contextItem;
1324 if (d->mode == bookmarks_SidebarMode && item) { 1335 if (d->mode == bookmarks_SidebarMode && item) {