summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--po/en.po3
-rw-r--r--res/about/version.gmi3
-rw-r--r--res/lang/cs.binbin30703 -> 30731 bytes
-rw-r--r--res/lang/de.binbin28698 -> 29732 bytes
-rw-r--r--res/lang/en.binbin26142 -> 25846 bytes
-rw-r--r--res/lang/eo.binbin24935 -> 24795 bytes
-rw-r--r--res/lang/es.binbin29535 -> 29563 bytes
-rw-r--r--res/lang/es_MX.binbin27023 -> 26902 bytes
-rw-r--r--res/lang/fi.binbin29370 -> 29398 bytes
-rw-r--r--res/lang/fr.binbin29904 -> 29783 bytes
-rw-r--r--res/lang/gl.binbin28724 -> 28752 bytes
-rw-r--r--res/lang/hu.binbin30547 -> 30575 bytes
-rw-r--r--res/lang/ia.binbin28023 -> 27902 bytes
-rw-r--r--res/lang/ie.binbin28462 -> 28490 bytes
-rw-r--r--res/lang/isv.binbin24862 -> 24566 bytes
-rw-r--r--res/lang/pl.binbin29299 -> 29178 bytes
-rw-r--r--res/lang/ru.binbin43848 -> 43876 bytes
-rw-r--r--res/lang/sk.binbin25195 -> 24899 bytes
-rw-r--r--res/lang/sr.binbin43298 -> 43326 bytes
-rw-r--r--res/lang/tok.binbin26584 -> 26612 bytes
-rw-r--r--res/lang/uk.binbin43179 -> 43207 bytes
-rw-r--r--res/lang/zh_Hans.binbin24975 -> 24800 bytes
-rw-r--r--res/lang/zh_Hant.binbin25116 -> 24995 bytes
-rw-r--r--src/app.c1
-rw-r--r--src/bookmarks.c29
-rw-r--r--src/bookmarks.h2
-rw-r--r--src/ui/sidebarwidget.c12
-rw-r--r--src/ui/util.c65
-rw-r--r--src/ui/util.h1
29 files changed, 111 insertions, 5 deletions
diff --git a/po/en.po b/po/en.po
index 80fee8ae..8204afec 100644
--- a/po/en.po
+++ b/po/en.po
@@ -1208,6 +1208,9 @@ msgstr "Title:"
1208msgid "dlg.bookmark.url" 1208msgid "dlg.bookmark.url"
1209msgstr "URL:" 1209msgstr "URL:"
1210 1210
1211msgid "dlg.bookmark.folder"
1212msgstr "Folder:"
1213
1211msgid "dlg.bookmark.tags" 1214msgid "dlg.bookmark.tags"
1212msgstr "Tags:" 1215msgstr "Tags:"
1213 1216
diff --git a/res/about/version.gmi b/res/about/version.gmi
index 6b2e9a45..1dce0fec 100644
--- a/res/about/version.gmi
+++ b/res/about/version.gmi
@@ -9,6 +9,7 @@
9# 1.9 9# 1.9
10 10
11New features: 11New features:
12* Choose parent folder when creating or editing a bookmark.
12* macOS: Automatic updates using the Sparkle framework. 13* macOS: Automatic updates using the Sparkle framework.
13* Windows: Automatic updates using the WinSparkle library. 14* Windows: Automatic updates using the WinSparkle library.
14 15
@@ -17,7 +18,7 @@ Changes and enhancements:
17* The resource bundle (resources.lgr) is now a regular ZIP archive. This allows it to do double duty as a fontpack containing the built-in fonts. The archive contains a version number to avoid use of obsolete resources. 18* The resource bundle (resources.lgr) is now a regular ZIP archive. This allows it to do double duty as a fontpack containing the built-in fonts. The archive contains a version number to avoid use of obsolete resources.
18 19
19Fixes: 20Fixes:
20* Handling duplicate feed entries: if multiple entries in a feed have the same URL, only handle the first one. 21* Handling duplicate feed entries: if multiple entries in a feed have the same URL, only use the first one.
21 22
22## 1.8.3 23## 1.8.3
23* Fixed clicking on UI elements that are over the page top banner. The banner would always get clicked instead. 24* Fixed clicking on UI elements that are over the page top banner. The banner would always get clicked instead.
diff --git a/res/lang/cs.bin b/res/lang/cs.bin
index d0dcabcd..ae978667 100644
--- a/res/lang/cs.bin
+++ b/res/lang/cs.bin
Binary files differ
diff --git a/res/lang/de.bin b/res/lang/de.bin
index e3ea2835..b1722d2b 100644
--- a/res/lang/de.bin
+++ b/res/lang/de.bin
Binary files differ
diff --git a/res/lang/en.bin b/res/lang/en.bin
index 63a9d6c7..344dfa6a 100644
--- a/res/lang/en.bin
+++ b/res/lang/en.bin
Binary files differ
diff --git a/res/lang/eo.bin b/res/lang/eo.bin
index a69a9f3f..2e902f76 100644
--- a/res/lang/eo.bin
+++ b/res/lang/eo.bin
Binary files differ
diff --git a/res/lang/es.bin b/res/lang/es.bin
index edd37672..cd5c0811 100644
--- a/res/lang/es.bin
+++ b/res/lang/es.bin
Binary files differ
diff --git a/res/lang/es_MX.bin b/res/lang/es_MX.bin
index ffb53cba..5cea30c9 100644
--- a/res/lang/es_MX.bin
+++ b/res/lang/es_MX.bin
Binary files differ
diff --git a/res/lang/fi.bin b/res/lang/fi.bin
index fc83470b..3066e970 100644
--- a/res/lang/fi.bin
+++ b/res/lang/fi.bin
Binary files differ
diff --git a/res/lang/fr.bin b/res/lang/fr.bin
index bda6f4f6..733db93c 100644
--- a/res/lang/fr.bin
+++ b/res/lang/fr.bin
Binary files differ
diff --git a/res/lang/gl.bin b/res/lang/gl.bin
index 23d9e952..3f7fca1d 100644
--- a/res/lang/gl.bin
+++ b/res/lang/gl.bin
Binary files differ
diff --git a/res/lang/hu.bin b/res/lang/hu.bin
index 1470aea2..95cb23a9 100644
--- a/res/lang/hu.bin
+++ b/res/lang/hu.bin
Binary files differ
diff --git a/res/lang/ia.bin b/res/lang/ia.bin
index 9c4ba6b5..5307f916 100644
--- a/res/lang/ia.bin
+++ b/res/lang/ia.bin
Binary files differ
diff --git a/res/lang/ie.bin b/res/lang/ie.bin
index 19687852..b89c350f 100644
--- a/res/lang/ie.bin
+++ b/res/lang/ie.bin
Binary files differ
diff --git a/res/lang/isv.bin b/res/lang/isv.bin
index b501166c..3bd7acc2 100644
--- a/res/lang/isv.bin
+++ b/res/lang/isv.bin
Binary files differ
diff --git a/res/lang/pl.bin b/res/lang/pl.bin
index f44d90fc..b51ae42b 100644
--- a/res/lang/pl.bin
+++ b/res/lang/pl.bin
Binary files differ
diff --git a/res/lang/ru.bin b/res/lang/ru.bin
index 4febb613..a6df8daf 100644
--- a/res/lang/ru.bin
+++ b/res/lang/ru.bin
Binary files differ
diff --git a/res/lang/sk.bin b/res/lang/sk.bin
index 402ab526..a7ea4b57 100644
--- a/res/lang/sk.bin
+++ b/res/lang/sk.bin
Binary files differ
diff --git a/res/lang/sr.bin b/res/lang/sr.bin
index 12cc399f..644dc759 100644
--- a/res/lang/sr.bin
+++ b/res/lang/sr.bin
Binary files differ
diff --git a/res/lang/tok.bin b/res/lang/tok.bin
index 9e36f8b0..1fa86a8d 100644
--- a/res/lang/tok.bin
+++ b/res/lang/tok.bin
Binary files differ
diff --git a/res/lang/uk.bin b/res/lang/uk.bin
index 9e19b644..4eb7acf6 100644
--- a/res/lang/uk.bin
+++ b/res/lang/uk.bin
Binary files differ
diff --git a/res/lang/zh_Hans.bin b/res/lang/zh_Hans.bin
index 7a59c620..10a91560 100644
--- a/res/lang/zh_Hans.bin
+++ b/res/lang/zh_Hans.bin
Binary files differ
diff --git a/res/lang/zh_Hant.bin b/res/lang/zh_Hant.bin
index 76ac592a..1f4bc3de 100644
--- a/res/lang/zh_Hant.bin
+++ b/res/lang/zh_Hant.bin
Binary files differ
diff --git a/src/app.c b/src/app.c
index abcf95da..374bab71 100644
--- a/src/app.c
+++ b/src/app.c
@@ -3004,6 +3004,7 @@ iBool handleCommand_App(const char *cmd) {
3004 get_Bookmarks(d->bookmarks, id)->parentId = parentId; 3004 get_Bookmarks(d->bookmarks, id)->parentId = parentId;
3005 } 3005 }
3006 postCommandf_App("bookmarks.changed added:%zu", id); 3006 postCommandf_App("bookmarks.changed added:%zu", id);
3007 setRecentFolder_Bookmarks(d->bookmarks, id);
3007 } 3008 }
3008 else { 3009 else {
3009 iWidget *dlg = makeValueInput_Widget( 3010 iWidget *dlg = makeValueInput_Widget(
diff --git a/src/bookmarks.c b/src/bookmarks.c
index 1a260f3a..d4b20162 100644
--- a/src/bookmarks.c
+++ b/src/bookmarks.c
@@ -96,7 +96,8 @@ struct Impl_Bookmarks {
96 iMutex * mtx; 96 iMutex * mtx;
97 int idEnum; 97 int idEnum;
98 iHash bookmarks; /* bookmark ID is the hash key */ 98 iHash bookmarks; /* bookmark ID is the hash key */
99 iPtrArray remoteRequests; 99 uint32_t recentFolderId; /* recently interacted with */
100 iPtrArray remoteRequests;
100}; 101};
101 102
102iDefineTypeConstruction(Bookmarks) 103iDefineTypeConstruction(Bookmarks)
@@ -105,6 +106,7 @@ void init_Bookmarks(iBookmarks *d) {
105 d->mtx = new_Mutex(); 106 d->mtx = new_Mutex();
106 d->idEnum = 0; 107 d->idEnum = 0;
107 init_Hash(&d->bookmarks); 108 init_Hash(&d->bookmarks);
109 d->recentFolderId = 0;
108 init_PtrArray(&d->remoteRequests); 110 init_PtrArray(&d->remoteRequests);
109} 111}
110 112
@@ -232,6 +234,9 @@ static void handleKeyValue_BookmarkLoader_(void *context, const iString *table,
232 bm->order = tv->value.int64; 234 bm->order = tv->value.int64;
233 } 235 }
234 } 236 }
237 else if (!cmp_String(key, "recentfolder") && tv->type == int64_TomlType) {
238 d->bookmarks->recentFolderId = tv->value.int64;
239 }
235} 240}
236 241
237static void init_BookmarkLoader(iBookmarkLoader *d, iBookmarks *bookmarks) { 242static void init_BookmarkLoader(iBookmarkLoader *d, iBookmarks *bookmarks) {
@@ -289,8 +294,10 @@ void save_Bookmarks(const iBookmarks *d, const char *dirPath) {
289 lock_Mutex(d->mtx); 294 lock_Mutex(d->mtx);
290 iRegExp *remotePattern = iClob(new_RegExp("\\bremote\\b", caseSensitive_RegExpOption)); 295 iRegExp *remotePattern = iClob(new_RegExp("\\bremote\\b", caseSensitive_RegExpOption));
291 iFile *f = newCStr_File(concatPath_CStr(dirPath, fileName_Bookmarks_)); 296 iFile *f = newCStr_File(concatPath_CStr(dirPath, fileName_Bookmarks_));
292 if (open_File(f, writeOnly_FileMode | text_FileMode)) { 297 if (open_File(f, writeOnly_FileMode | text_FileMode)) {
293 iString *str = collectNew_String(); 298 iString *str = collectNew_String();
299 format_String(str, "recentfolder = %u\n\n", d->recentFolderId);
300 writeData_File(f, cstr_String(str), size_String(str));
294 iConstForEach(Hash, i, &d->bookmarks) { 301 iConstForEach(Hash, i, &d->bookmarks) {
295 const iBookmark *bm = (const iBookmark *) i.value; 302 const iBookmark *bm = (const iBookmark *) i.value;
296 iRegExpMatch m; 303 iRegExpMatch m;
@@ -299,6 +306,7 @@ void save_Bookmarks(const iBookmarks *d, const char *dirPath) {
299 /* Remote bookmarks are not saved. */ 306 /* Remote bookmarks are not saved. */
300 continue; 307 continue;
301 } 308 }
309 iBeginCollect();
302 format_String(str, 310 format_String(str,
303 "[%d]\n" 311 "[%d]\n"
304 "url = \"%s\"\n" 312 "url = \"%s\"\n"
@@ -321,7 +329,8 @@ void save_Bookmarks(const iBookmarks *d, const char *dirPath) {
321 } 329 }
322 appendCStr_String(str, "\n"); 330 appendCStr_String(str, "\n");
323 writeData_File(f, cstr_String(str), size_String(str)); 331 writeData_File(f, cstr_String(str), size_String(str));
324 } 332 iEndCollect();
333 }
325 } 334 }
326 iRelease(f); 335 iRelease(f);
327 unlock_Mutex(d->mtx); 336 unlock_Mutex(d->mtx);
@@ -399,6 +408,16 @@ iBool updateBookmarkIcon_Bookmarks(iBookmarks *d, const iString *url, iChar icon
399 return changed; 408 return changed;
400} 409}
401 410
411void setRecentFolder_Bookmarks(iBookmarks *d, uint32_t folderId) {
412 iBookmark *bm = get_Bookmarks(d, folderId);
413 if (isFolder_Bookmark(bm)) {
414 d->recentFolderId = folderId;
415 }
416 else {
417 d->recentFolderId = 0;
418 }
419}
420
402iChar siteIcon_Bookmarks(const iBookmarks *d, const iString *url) { 421iChar siteIcon_Bookmarks(const iBookmarks *d, const iString *url) {
403 if (isEmpty_String(url)) { 422 if (isEmpty_String(url)) {
404 return 0; 423 return 0;
@@ -466,6 +485,10 @@ uint32_t findUrl_Bookmarks(const iBookmarks *d, const iString *url) {
466 return id_Bookmark(constFront_PtrArray(found)); 485 return id_Bookmark(constFront_PtrArray(found));
467} 486}
468 487
488uint32_t recentFolder_Bookmarks(const iBookmarks *d) {
489 return d->recentFolderId;
490}
491
469const iPtrArray *list_Bookmarks(const iBookmarks *d, iBookmarksCompareFunc cmp, 492const iPtrArray *list_Bookmarks(const iBookmarks *d, iBookmarksCompareFunc cmp,
470 iBookmarksFilterFunc filter, void *context) { 493 iBookmarksFilterFunc filter, void *context) {
471 lock_Mutex(d->mtx); 494 lock_Mutex(d->mtx);
diff --git a/src/bookmarks.h b/src/bookmarks.h
index 87d7694d..6cb5c8a9 100644
--- a/src/bookmarks.h
+++ b/src/bookmarks.h
@@ -100,12 +100,14 @@ iBool remove_Bookmarks (iBookmarks *, uint32_t id);
100iBookmark * get_Bookmarks (iBookmarks *, uint32_t id); 100iBookmark * get_Bookmarks (iBookmarks *, uint32_t id);
101void reorder_Bookmarks (iBookmarks *, uint32_t id, int newOrder); 101void reorder_Bookmarks (iBookmarks *, uint32_t id, int newOrder);
102iBool updateBookmarkIcon_Bookmarks(iBookmarks *, const iString *url, iChar icon); 102iBool updateBookmarkIcon_Bookmarks(iBookmarks *, const iString *url, iChar icon);
103void setRecentFolder_Bookmarks (iBookmarks *, uint32_t folderId);
103void sort_Bookmarks (iBookmarks *, uint32_t parentId, iBookmarksCompareFunc cmp); 104void sort_Bookmarks (iBookmarks *, uint32_t parentId, iBookmarksCompareFunc cmp);
104void fetchRemote_Bookmarks (iBookmarks *); 105void fetchRemote_Bookmarks (iBookmarks *);
105void requestFinished_Bookmarks (iBookmarks *, iGmRequest *req); 106void requestFinished_Bookmarks (iBookmarks *, iGmRequest *req);
106 107
107iChar siteIcon_Bookmarks (const iBookmarks *, const iString *url); 108iChar siteIcon_Bookmarks (const iBookmarks *, const iString *url);
108uint32_t findUrl_Bookmarks (const iBookmarks *, const iString *url); /* O(n) */ 109uint32_t findUrl_Bookmarks (const iBookmarks *, const iString *url); /* O(n) */
110uint32_t recentFolder_Bookmarks (const iBookmarks *);
109 111
110iBool filterTagsRegExp_Bookmarks (void *regExp, const iBookmark *); 112iBool filterTagsRegExp_Bookmarks (void *regExp, const iBookmark *);
111 113
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 3abfd498..5d627dda 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -893,6 +893,7 @@ static void itemClicked_SidebarWidget_(iSidebarWidget *d, iSidebarItem *item, si
893 if (isEmpty_String(&item->url)) /* a folder */ { 893 if (isEmpty_String(&item->url)) /* a folder */ {
894 if (contains_IntSet(d->closedFolders, item->id)) { 894 if (contains_IntSet(d->closedFolders, item->id)) {
895 remove_IntSet(d->closedFolders, item->id); 895 remove_IntSet(d->closedFolders, item->id);
896 setRecentFolder_Bookmarks(bookmarks_App(), item->id);
896 } 897 }
897 else { 898 else {
898 insert_IntSet(d->closedFolders, item->id); 899 insert_IntSet(d->closedFolders, item->id);
@@ -990,6 +991,10 @@ void setWidth_SidebarWidget(iSidebarWidget *d, float widthAsGaps) {
990} 991}
991 992
992iBool handleBookmarkEditorCommands_SidebarWidget_(iWidget *editor, const char *cmd) { 993iBool handleBookmarkEditorCommands_SidebarWidget_(iWidget *editor, const char *cmd) {
994 if (equal_Command(cmd, "dlg.bookmark.setfolder")) {
995 setBookmarkEditorFolder_Widget(editor, arg_Command(cmd));
996 return iTrue;
997 }
993 if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) { 998 if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) {
994 iAssert(startsWith_String(id_Widget(editor), "bmed.")); 999 iAssert(startsWith_String(id_Widget(editor), "bmed."));
995 iSidebarWidget *d = findWidget_App(cstr_String(id_Widget(editor)) + 5); /* bmed.sidebar */ 1000 iSidebarWidget *d = findWidget_App(cstr_String(id_Widget(editor)) + 5); /* bmed.sidebar */
@@ -1020,7 +1025,11 @@ iBool handleBookmarkEditorCommands_SidebarWidget_(iWidget *editor, const char *c
1020 isSelected_Widget(findChild_Widget(editor, "bmed.tag.remote"))); 1025 isSelected_Widget(findChild_Widget(editor, "bmed.tag.remote")));
1021 addOrRemoveTag_Bookmark(bm, linkSplit_BookmarkTag, 1026 addOrRemoveTag_Bookmark(bm, linkSplit_BookmarkTag,
1022 isSelected_Widget(findChild_Widget(editor, "bmed.tag.linksplit"))); 1027 isSelected_Widget(findChild_Widget(editor, "bmed.tag.linksplit")));
1023 } 1028 }
1029 const iBookmark *folder = userData_Object(findChild_Widget(editor, "bmed.folder"));
1030 if (!folder || !hasParent_Bookmark(folder, id_Bookmark(bm))) {
1031 bm->parentId = folder ? id_Bookmark(folder) : 0;
1032 }
1024 postCommand_App("bookmarks.changed"); 1033 postCommand_App("bookmarks.changed");
1025 } 1034 }
1026 setupSheetTransition_Mobile(editor, iFalse); 1035 setupSheetTransition_Mobile(editor, iFalse);
@@ -1327,6 +1336,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
1327 setFlags_Widget(notNeeded[i], disabled_WidgetFlag, iTrue); 1336 setFlags_Widget(notNeeded[i], disabled_WidgetFlag, iTrue);
1328 } 1337 }
1329 } 1338 }
1339 setBookmarkEditorFolder_Widget(dlg, bm ? bm->parentId : 0);
1330 setCommandHandler_Widget(dlg, handleBookmarkEditorCommands_SidebarWidget_); 1340 setCommandHandler_Widget(dlg, handleBookmarkEditorCommands_SidebarWidget_);
1331 setFocus_Widget(findChild_Widget(dlg, "bmed.title")); 1341 setFocus_Widget(findChild_Widget(dlg, "bmed.title"));
1332 } 1342 }
diff --git a/src/ui/util.c b/src/ui/util.c
index 0a9dde0c..ba6a2538 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -2181,6 +2181,14 @@ size_t findWidestLabel_MenuItem(const iMenuItem *items, size_t num) {
2181 return widestPos; 2181 return widestPos;
2182} 2182}
2183 2183
2184const char *widestLabel_MenuItemArray(const iArray *items) {
2185 size_t index = findWidestLabel_MenuItem(constData_Array(items), size_Array(items));
2186 if (index == iInvalidPos) {
2187 return "";
2188 }
2189 return constValue_Array(items, index, iMenuItem).label;
2190}
2191
2184iChar removeIconPrefix_String(iString *d) { 2192iChar removeIconPrefix_String(iString *d) {
2185 if (isEmpty_String(d)) { 2193 if (isEmpty_String(d)) {
2186 return 0; 2194 return 0;
@@ -2772,6 +2780,35 @@ iWidget *makePreferences_Widget(void) {
2772 return dlg; 2780 return dlg;
2773} 2781}
2774 2782
2783static iBool isBookmarkFolder_(void *context, const iBookmark *bm) {
2784 iUnused(context);
2785 return isFolder_Bookmark(bm);
2786}
2787
2788static const iArray *makeBookmarkFolderItems_(void) {
2789 iArray *folders = new_Array(sizeof(iMenuItem));
2790 pushBack_Array(folders, &(iMenuItem){ "\u2014", 0, 0, "dlg.bookmark.setfolder arg:0" });
2791 iConstForEach(
2792 PtrArray,
2793 i,
2794 list_Bookmarks(bookmarks_App(), cmpTree_Bookmark, isBookmarkFolder_, NULL)) {
2795 const iBookmark *bm = i.ptr;
2796 iString *title = collect_String(copy_String(&bm->title));
2797 for (const iBookmark *j = bm; j && j->parentId; ) {
2798 j = get_Bookmarks(bookmarks_App(), j->parentId);
2799 prependCStr_String(title, " > ");
2800 prepend_String(title, &j->title);
2801 }
2802 pushBack_Array(
2803 folders,
2804 &(iMenuItem){ cstr_String(title),
2805 0,
2806 0,
2807 format_CStr("dlg.bookmark.setfolder arg:%u", id_Bookmark(bm)) });
2808 }
2809 return collect_Array(folders);
2810}
2811
2775iWidget *makeBookmarkEditor_Widget(void) { 2812iWidget *makeBookmarkEditor_Widget(void) {
2776 const iMenuItem actions[] = { 2813 const iMenuItem actions[] = {
2777 { "${cancel}" }, 2814 { "${cancel}" },
@@ -2808,6 +2845,19 @@ iWidget *makeBookmarkEditor_Widget(void) {
2808 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.title}", "bmed.title", iClob(inputs[0] = new_InputWidget(0))); 2845 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.title}", "bmed.title", iClob(inputs[0] = new_InputWidget(0)));
2809 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.url}", "bmed.url", iClob(inputs[1] = new_InputWidget(0))); 2846 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.url}", "bmed.url", iClob(inputs[1] = new_InputWidget(0)));
2810 setUrlContent_InputWidget(inputs[1], iTrue); 2847 setUrlContent_InputWidget(inputs[1], iTrue);
2848 /* Folder to add to. */ {
2849 addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.bookmark.folder}")));
2850 const iArray *folderItems = makeBookmarkFolderItems_();
2851 iLabelWidget *folderButton;
2852 setId_Widget(addChildFlags_Widget(values,
2853 iClob(folderButton = makeMenuButton_LabelWidget(
2854 widestLabel_MenuItemArray(folderItems),
2855 constData_Array(folderItems),
2856 size_Array(folderItems))), alignLeft_WidgetFlag),
2857 "bmed.folder");
2858 updateDropdownSelection_LabelWidget(
2859 folderButton, format_CStr(" arg:%u", recentFolder_Bookmarks(bookmarks_App())));
2860 }
2811 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.tags}", "bmed.tags", iClob(inputs[2] = new_InputWidget(0))); 2861 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.tags}", "bmed.tags", iClob(inputs[2] = new_InputWidget(0)));
2812 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.icon}", "bmed.icon", iClob(inputs[3] = new_InputWidget(1))); 2862 addDialogInputWithHeading_(headings, values, "${dlg.bookmark.icon}", "bmed.icon", iClob(inputs[3] = new_InputWidget(1)));
2813 /* Buttons for special tags. */ 2863 /* Buttons for special tags. */
@@ -2830,12 +2880,23 @@ iWidget *makeBookmarkEditor_Widget(void) {
2830 return dlg; 2880 return dlg;
2831} 2881}
2832 2882
2883void setBookmarkEditorFolder_Widget(iWidget *editor, uint32_t folderId) {
2884 iLabelWidget *button = findChild_Widget(editor, "bmed.folder");
2885 updateDropdownSelection_LabelWidget(button, format_CStr(" arg:%u", folderId));
2886 setUserData_Object(button, get_Bookmarks(bookmarks_App(), folderId));
2887}
2888
2833static iBool handleBookmarkCreationCommands_SidebarWidget_(iWidget *editor, const char *cmd) { 2889static iBool handleBookmarkCreationCommands_SidebarWidget_(iWidget *editor, const char *cmd) {
2890 if (equal_Command(cmd, "dlg.bookmark.setfolder")) {
2891 setBookmarkEditorFolder_Widget(editor, arg_Command(cmd));
2892 return iTrue;
2893 }
2834 if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) { 2894 if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) {
2835 if (equal_Command(cmd, "bmed.accept")) { 2895 if (equal_Command(cmd, "bmed.accept")) {
2836 const iString *title = text_InputWidget(findChild_Widget(editor, "bmed.title")); 2896 const iString *title = text_InputWidget(findChild_Widget(editor, "bmed.title"));
2837 const iString *url = text_InputWidget(findChild_Widget(editor, "bmed.url")); 2897 const iString *url = text_InputWidget(findChild_Widget(editor, "bmed.url"));
2838 const iString *tags = text_InputWidget(findChild_Widget(editor, "bmed.tags")); 2898 const iString *tags = text_InputWidget(findChild_Widget(editor, "bmed.tags"));
2899 const iBookmark *folder = userData_Object(findChild_Widget(editor, "bmed.folder"));
2839 const iString *icon = collect_String(trimmed_String(text_InputWidget(findChild_Widget(editor, "bmed.icon")))); 2900 const iString *icon = collect_String(trimmed_String(text_InputWidget(findChild_Widget(editor, "bmed.icon"))));
2840 const uint32_t id = add_Bookmarks(bookmarks_App(), url, title, tags, first_String(icon)); 2901 const uint32_t id = add_Bookmarks(bookmarks_App(), url, title, tags, first_String(icon));
2841 iBookmark * bm = get_Bookmarks(bookmarks_App(), id); 2902 iBookmark * bm = get_Bookmarks(bookmarks_App(), id);
@@ -2851,6 +2912,10 @@ static iBool handleBookmarkCreationCommands_SidebarWidget_(iWidget *editor, cons
2851 if (isSelected_Widget(findChild_Widget(editor, "bmed.tag.linksplit"))) { 2912 if (isSelected_Widget(findChild_Widget(editor, "bmed.tag.linksplit"))) {
2852 addTag_Bookmark(bm, linkSplit_BookmarkTag); 2913 addTag_Bookmark(bm, linkSplit_BookmarkTag);
2853 } 2914 }
2915 bm->parentId = folder ? id_Bookmark(folder) : 0;
2916 if (bm->parentId) {
2917 setRecentFolder_Bookmarks(bookmarks_App(), bm->parentId);
2918 }
2854 postCommandf_App("bookmarks.changed added:%zu", id); 2919 postCommandf_App("bookmarks.changed added:%zu", id);
2855 } 2920 }
2856 setupSheetTransition_Mobile(editor, iFalse); 2921 setupSheetTransition_Mobile(editor, iFalse);
diff --git a/src/ui/util.h b/src/ui/util.h
index 52b3a692..81fb1cbd 100644
--- a/src/ui/util.h
+++ b/src/ui/util.h
@@ -311,6 +311,7 @@ iWidget * makePreferences_Widget (void);
311void updatePreferencesLayout_Widget (iWidget *prefs); 311void updatePreferencesLayout_Widget (iWidget *prefs);
312 312
313iWidget * makeBookmarkEditor_Widget (void); 313iWidget * makeBookmarkEditor_Widget (void);
314void setBookmarkEditorFolder_Widget(iWidget *editor, uint32_t folderId);
314iWidget * makeBookmarkCreation_Widget (const iString *url, const iString *title, iChar icon); 315iWidget * makeBookmarkCreation_Widget (const iString *url, const iString *title, iChar icon);
315iWidget * makeIdentityCreation_Widget (void); 316iWidget * makeIdentityCreation_Widget (void);
316iWidget * makeFeedSettings_Widget (uint32_t bookmarkId); 317iWidget * makeFeedSettings_Widget (uint32_t bookmarkId);