summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/sidebarwidget.c32
-rw-r--r--src/ui/util.c13
-rw-r--r--src/ui/window.c2
3 files changed, 38 insertions, 9 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 4c7435c5..ad23da3e 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -230,7 +230,8 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
230 (iMenuItem[]){ { "Open in New Tab", 0, 0, "bookmark.open newtab:1" }, 230 (iMenuItem[]){ { "Open in New Tab", 0, 0, "bookmark.open newtab:1" },
231 { "Open in Background Tab", 0, 0, "bookmark.open newtab:2" }, 231 { "Open in Background Tab", 0, 0, "bookmark.open newtab:2" },
232 { "---", 0, 0, NULL }, 232 { "---", 0, 0, NULL },
233 { "Edit Bookmark...", 0, 0, "bookmark.edit" }, 233 { "Edit...", 0, 0, "bookmark.edit" },
234 { "Duplicate...", 0, 0, "bookmark.dup" },
234 { "Copy URL", 0, 0, "bookmark.copy" }, 235 { "Copy URL", 0, 0, "bookmark.copy" },
235 { "---", 0, 0, NULL }, 236 { "---", 0, 0, NULL },
236 { "?", 0, 0, "bookmark.tag tag:subscribed" }, 237 { "?", 0, 0, "bookmark.tag tag:subscribed" },
@@ -239,8 +240,8 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
239 { "---", 0, 0, NULL }, 240 { "---", 0, 0, NULL },
240 { uiTextCaution_ColorEscape "Delete Bookmark", 0, 0, "bookmark.delete" }, 241 { uiTextCaution_ColorEscape "Delete Bookmark", 0, 0, "bookmark.delete" },
241 { "---", 0, 0, NULL }, 242 { "---", 0, 0, NULL },
242 { "Refresh Remote Bookmarks", 0, 0, "bookmarks.reload.remote" } }, 243 { "Refresh Remote Sources", 0, 0, "bookmarks.reload.remote" } },
243 13); 244 14);
244 break; 245 break;
245 } 246 }
246 case history_SidebarMode: { 247 case history_SidebarMode: {
@@ -751,6 +752,22 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
751 } 752 }
752 return iTrue; 753 return iTrue;
753 } 754 }
755 else if (isCommand_Widget(w, ev, "bookmark.dup")) {
756 const iSidebarItem *item = d->contextItem;
757 if (d->mode == bookmarks_SidebarMode && item) {
758 setFlags_Widget(w, disabled_WidgetFlag, iTrue);
759 iBookmark *bm = get_Bookmarks(bookmarks_App(), item->id);
760 const iBool isRemote = hasTag_Bookmark(bm, "remote");
761 iChar icon = isRemote ? 0x1f588 : bm->icon;
762 iWidget *dlg = makeBookmarkCreation_Widget(&bm->url, &bm->title, icon);
763 setId_Widget(dlg, format_CStr("bmed.%s", cstr_String(id_Widget(w))));
764 if (!isRemote) {
765 setText_InputWidget(findChild_Widget(dlg, "bmed.tags"), &bm->tags);
766 }
767 setFocus_Widget(findChild_Widget(dlg, "bmed.title"));
768 }
769 return iTrue;
770 }
754 else if (isCommand_Widget(w, ev, "bookmark.tag")) { 771 else if (isCommand_Widget(w, ev, "bookmark.tag")) {
755 const iSidebarItem *item = d->contextItem; 772 const iSidebarItem *item = d->contextItem;
756 if (d->mode == bookmarks_SidebarMode && item) { 773 if (d->mode == bookmarks_SidebarMode && item) {
@@ -1220,7 +1237,14 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect,
1220 init_String(&str); 1237 init_String(&str);
1221 appendChar_String(&str, d->icon ? d->icon : 0x1f588); 1238 appendChar_String(&str, d->icon ? d->icon : 0x1f588);
1222 const iRect iconArea = { addX_I2(pos, gap_UI), init_I2(7 * gap_UI, itemHeight) }; 1239 const iRect iconArea = { addX_I2(pos, gap_UI), init_I2(7 * gap_UI, itemHeight) };
1223 drawCentered_Text(font, iconArea, iTrue, iconColor, "%s", cstr_String(&str)); 1240 drawCentered_Text(font,
1241 iconArea,
1242 iTrue,
1243 isPressing ? iconColor
1244 : d->icon == 0x2601 /* remote */ ? uiTextCaution_ColorId
1245 : iconColor,
1246 "%s",
1247 cstr_String(&str));
1224 deinit_String(&str); 1248 deinit_String(&str);
1225 const iInt2 textPos = addY_I2(topRight_Rect(iconArea), (itemHeight - lineHeight_Text(font)) / 2); 1249 const iInt2 textPos = addY_I2(topRight_Rect(iconArea), (itemHeight - lineHeight_Text(font)) / 2);
1226 drawRange_Text(font, textPos, fg, range_String(&d->label)); 1250 drawRange_Text(font, textPos, fg, range_String(&d->label));
diff --git a/src/ui/util.c b/src/ui/util.c
index 1118758b..ddff096a 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1216,6 +1216,11 @@ iWidget *makeBookmarkEditor_Widget(void) {
1216 return dlg; 1216 return dlg;
1217} 1217}
1218 1218
1219static void enableSidebars_(void) {
1220 setFlags_Widget(findWidget_App("sidebar"), disabled_WidgetFlag, iFalse);
1221 setFlags_Widget(findWidget_App("sidebar2"), disabled_WidgetFlag, iFalse);
1222}
1223
1219static iBool handleBookmarkCreationCommands_SidebarWidget_(iWidget *editor, const char *cmd) { 1224static iBool handleBookmarkCreationCommands_SidebarWidget_(iWidget *editor, const char *cmd) {
1220 if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) { 1225 if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) {
1221 if (equal_Command(cmd, "bmed.accept")) { 1226 if (equal_Command(cmd, "bmed.accept")) {
@@ -1230,6 +1235,8 @@ static iBool handleBookmarkCreationCommands_SidebarWidget_(iWidget *editor, cons
1230 postCommand_App("bookmarks.changed"); 1235 postCommand_App("bookmarks.changed");
1231 } 1236 }
1232 destroy_Widget(editor); 1237 destroy_Widget(editor);
1238 /* Sidebars are disabled when a dialog is opened. */
1239 enableSidebars_();
1233 return iTrue; 1240 return iTrue;
1234 } 1241 }
1235 return iFalse; 1242 return iFalse;
@@ -1260,8 +1267,7 @@ static iBool handleFeedSettingCommands_(iWidget *dlg, const char *cmd) {
1260 if (equal_Command(cmd, "cancel")) { 1267 if (equal_Command(cmd, "cancel")) {
1261 destroy_Widget(dlg); 1268 destroy_Widget(dlg);
1262 /* Sidebars are disabled when a dialog is opened. */ 1269 /* Sidebars are disabled when a dialog is opened. */
1263 setFlags_Widget(findWidget_App("sidebar"), disabled_WidgetFlag, iFalse); 1270 enableSidebars_();
1264 setFlags_Widget(findWidget_App("sidebar2"), disabled_WidgetFlag, iFalse);
1265 return iTrue; 1271 return iTrue;
1266 } 1272 }
1267 if (equal_Command(cmd, "feedcfg.accept")) { 1273 if (equal_Command(cmd, "feedcfg.accept")) {
@@ -1297,8 +1303,7 @@ static iBool handleFeedSettingCommands_(iWidget *dlg, const char *cmd) {
1297 postCommand_App("bookmarks.changed"); 1303 postCommand_App("bookmarks.changed");
1298 destroy_Widget(dlg); 1304 destroy_Widget(dlg);
1299 /* Sidebars are disabled when a dialog is opened. */ 1305 /* Sidebars are disabled when a dialog is opened. */
1300 setFlags_Widget(findWidget_App("sidebar"), disabled_WidgetFlag, iFalse); 1306 enableSidebars_();
1301 setFlags_Widget(findWidget_App("sidebar2"), disabled_WidgetFlag, iFalse);
1302 return iTrue; 1307 return iTrue;
1303 } 1308 }
1304 return iFalse; 1309 return iFalse;
diff --git a/src/ui/window.c b/src/ui/window.c
index bc0a622e..5e346108 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -167,7 +167,7 @@ static iMenuItem bookmarksMenuItems_[] = {
167 { "List All", 0, 0, "open url:about:bookmarks" }, 167 { "List All", 0, 0, "open url:about:bookmarks" },
168 { "List by Tag", 0, 0, "open url:about:bookmarks?tags" }, 168 { "List by Tag", 0, 0, "open url:about:bookmarks?tags" },
169 { "List by Creation Time", 0, 0, "open url:about:bookmarks?created" }, 169 { "List by Creation Time", 0, 0, "open url:about:bookmarks?created" },
170 { "Refresh Remote Bookmarks", 0, 0, "bookmarks.reload.remote" }, 170 { "Refresh Remote Sources", 0, 0, "bookmarks.reload.remote" },
171 { "---", 0, 0, NULL }, 171 { "---", 0, 0, NULL },
172 { "Subscribe to This Page...", subscribeToPage_KeyModifier, "feeds.subscribe" }, 172 { "Subscribe to This Page...", subscribeToPage_KeyModifier, "feeds.subscribe" },
173 { "---", 0, 0, NULL }, 173 { "---", 0, 0, NULL },