summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-19 08:51:17 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-19 08:51:17 +0200
commit6e54b0b5449e607417b2bd5b68ac4292277bad4b (patch)
treee4bd3d7fb26ce2f5770be404f94656fe4080b380 /src
parent8528a8c26c66735d0a977aaafaa32f6c0dc52c42 (diff)
Open links from sidebar in new tabs
Added context menu items for opening in new tabs, and the modifier keys work like in DocumentWidget. IssueID #77
Diffstat (limited to 'src')
-rw-r--r--src/ui/sidebarwidget.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index ff4be073..c2672646 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -222,14 +222,17 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
222 } 222 }
223 d->menu = makeMenu_Widget( 223 d->menu = makeMenu_Widget(
224 as_Widget(d), 224 as_Widget(d),
225 (iMenuItem[]){ { "Edit Bookmark...", 0, 0, "bookmark.edit" }, 225 (iMenuItem[]){ { "Open in New Tab", 0, 0, "bookmark.open newtab:1" },
226 { "Open in Background Tab", 0, 0, "bookmark.open newtab:2" },
227 { "---", 0, 0, NULL },
228 { "Edit Bookmark...", 0, 0, "bookmark.edit" },
226 { "Copy URL", 0, 0, "bookmark.copy" }, 229 { "Copy URL", 0, 0, "bookmark.copy" },
227 { "---", 0, 0, NULL }, 230 { "---", 0, 0, NULL },
228 { "Subscribe to Feed", 0, 0, "bookmark.tag tag:subscribed" }, 231 { "Subscribe to Feed", 0, 0, "bookmark.tag tag:subscribed" },
229 { "", 0, 0, "bookmark.tag tag:homepage" }, 232 { "", 0, 0, "bookmark.tag tag:homepage" },
230 { "---", 0, 0, NULL }, 233 { "---", 0, 0, NULL },
231 { uiTextCaution_ColorEscape "Delete Bookmark", 0, 0, "bookmark.delete" } }, 234 { uiTextCaution_ColorEscape "Delete Bookmark", 0, 0, "bookmark.delete" } },
232 7); 235 10);
233 break; 236 break;
234 } 237 }
235 case history_SidebarMode: { 238 case history_SidebarMode: {
@@ -518,7 +521,9 @@ static void itemClicked_SidebarWidget_(iSidebarWidget *d, const iSidebarItem *it
518 case bookmarks_SidebarMode: 521 case bookmarks_SidebarMode:
519 case history_SidebarMode: { 522 case history_SidebarMode: {
520 if (!isEmpty_String(&item->url)) { 523 if (!isEmpty_String(&item->url)) {
521 postCommandf_App("open url:%s", cstr_String(&item->url)); 524 postCommandf_App("open newtab:%d url:%s",
525 openTabMode_Sym(SDL_GetModState()),
526 cstr_String(&item->url));
522 } 527 }
523 break; 528 break;
524 } 529 }
@@ -707,6 +712,15 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
707 else if (isCommand_Widget(w, ev, "menu.closed")) { 712 else if (isCommand_Widget(w, ev, "menu.closed")) {
708 setFlags_Widget(as_Widget(d->list), disabled_WidgetFlag, iFalse); 713 setFlags_Widget(as_Widget(d->list), disabled_WidgetFlag, iFalse);
709 } 714 }
715 else if (isCommand_Widget(w, ev, "bookmark.open")) {
716 const iSidebarItem *item = d->contextItem;
717 if (d->mode == bookmarks_SidebarMode && item) {
718 postCommandf_App("open newtab:%d url:%s",
719 argLabel_Command(cmd, "newtab"),
720 cstr_String(&item->url));
721 }
722 return iTrue;
723 }
710 else if (isCommand_Widget(w, ev, "bookmark.copy")) { 724 else if (isCommand_Widget(w, ev, "bookmark.copy")) {
711 const iSidebarItem *item = d->contextItem; 725 const iSidebarItem *item = d->contextItem;
712 if (d->mode == bookmarks_SidebarMode && item) { 726 if (d->mode == bookmarks_SidebarMode && item) {