diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-02-20 11:42:36 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-02-20 11:42:36 +0200 |
commit | 09c1f3d7c06b1852ab973e16e2c169a6e541082e (patch) | |
tree | 22d234e9150cabe749d2968e902fe47fac23a4e7 /src | |
parent | a8fd69b995058252c025f2ca5c11031373e5d63b (diff) |
Context menu items for opening items
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/documentwidget.c | 12 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 32 |
2 files changed, 31 insertions, 13 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 99039ff5..7492d9bd 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -5107,22 +5107,22 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
5107 | format_CStr("!open newtab:2 origin:%s url:%s", | 5107 | format_CStr("!open newtab:2 origin:%s url:%s", |
5108 | cstr_String(id_Widget(w)), | 5108 | cstr_String(id_Widget(w)), |
5109 | cstr_String(linkUrl)) }, | 5109 | cstr_String(linkUrl)) }, |
5110 | { "${link.side}", | 5110 | { openWindow_Icon " ${link.newwindow}", |
5111 | 0, | 5111 | 0, |
5112 | 0, | 5112 | 0, |
5113 | format_CStr("!open newtab:4 origin:%s url:%s", | 5113 | format_CStr("!open newwindow:1 origin:%s url:%s", |
5114 | cstr_String(id_Widget(w)), | 5114 | cstr_String(id_Widget(w)), |
5115 | cstr_String(linkUrl)) }, | 5115 | cstr_String(linkUrl)) }, |
5116 | { "${link.side.newtab}", | 5116 | { "${link.side}", |
5117 | 0, | 5117 | 0, |
5118 | 0, | 5118 | 0, |
5119 | format_CStr("!open newtab:5 origin:%s url:%s", | 5119 | format_CStr("!open newtab:4 origin:%s url:%s", |
5120 | cstr_String(id_Widget(w)), | 5120 | cstr_String(id_Widget(w)), |
5121 | cstr_String(linkUrl)) }, | 5121 | cstr_String(linkUrl)) }, |
5122 | { openWindow_Icon " ${link.newwindow}", | 5122 | { "${link.side.newtab}", |
5123 | 0, | 5123 | 0, |
5124 | 0, | 5124 | 0, |
5125 | format_CStr("!open newwindow:1 origin:%s url:%s", | 5125 | format_CStr("!open newtab:5 origin:%s url:%s", |
5126 | cstr_String(id_Widget(w)), | 5126 | cstr_String(id_Widget(w)), |
5127 | cstr_String(linkUrl)) }, | 5127 | cstr_String(linkUrl)) }, |
5128 | }, | 5128 | }, |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 0322b2a9..8f9e44c8 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -420,7 +420,7 @@ static void updateItemsWithFlags_SidebarWidget_(iSidebarWidget *d, iBool keepAct | |||
420 | { "---", 0, 0, NULL }, | 420 | { "---", 0, 0, NULL }, |
421 | { circle_Icon " ${feeds.entry.markread}", 0, 0, "feed.entry.toggleread" }, | 421 | { circle_Icon " ${feeds.entry.markread}", 0, 0, "feed.entry.toggleread" }, |
422 | { bookmark_Icon " ${feeds.entry.bookmark}", 0, 0, "feed.entry.bookmark" }, | 422 | { bookmark_Icon " ${feeds.entry.bookmark}", 0, 0, "feed.entry.bookmark" }, |
423 | { "${menu.copyurl}", 0, 0, "feed.entry.copyurl" }, | 423 | { "${menu.copyurl}", 0, 0, "feed.entry.copy" }, |
424 | { "---", 0, 0, NULL }, | 424 | { "---", 0, 0, NULL }, |
425 | { page_Icon " ${feeds.entry.openfeed}", 0, 0, "feed.entry.openfeed" }, | 425 | { page_Icon " ${feeds.entry.openfeed}", 0, 0, "feed.entry.openfeed" }, |
426 | { edit_Icon " ${feeds.edit}", 0, 0, "feed.entry.edit" }, | 426 | { edit_Icon " ${feeds.edit}", 0, 0, "feed.entry.edit" }, |
@@ -580,8 +580,8 @@ static void updateItemsWithFlags_SidebarWidget_(iSidebarWidget *d, iBool keepAct | |||
580 | { openTabBg_Icon " ${menu.opentab.background}", 0, 0, "history.open newtab:2" }, | 580 | { openTabBg_Icon " ${menu.opentab.background}", 0, 0, "history.open newtab:2" }, |
581 | { openWindow_Icon " ${menu.openwindow}", 0, 0, "history.open newwindow:1" }, | 581 | { openWindow_Icon " ${menu.openwindow}", 0, 0, "history.open newwindow:1" }, |
582 | { "---" }, | 582 | { "---" }, |
583 | { "${menu.copyurl}", 0, 0, "history.copy" }, | ||
584 | { bookmark_Icon " ${sidebar.entry.bookmark}", 0, 0, "history.addbookmark" }, | 583 | { bookmark_Icon " ${sidebar.entry.bookmark}", 0, 0, "history.addbookmark" }, |
584 | { "${menu.copyurl}", 0, 0, "history.copy" }, | ||
585 | { "---", 0, 0, NULL }, | 585 | { "---", 0, 0, NULL }, |
586 | { close_Icon " ${menu.forgeturl}", 0, 0, "history.delete" }, | 586 | { close_Icon " ${menu.forgeturl}", 0, 0, "history.delete" }, |
587 | { "---", 0, 0, NULL }, | 587 | { "---", 0, 0, NULL }, |
@@ -1652,12 +1652,18 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
1652 | if (item) { | 1652 | if (item) { |
1653 | if (isCommand_Widget(w, ev, "feed.entry.open")) { | 1653 | if (isCommand_Widget(w, ev, "feed.entry.open")) { |
1654 | const char *cmd = command_UserEvent(ev); | 1654 | const char *cmd = command_UserEvent(ev); |
1655 | postCommandString_Root(get_Root(), feedEntryOpenCommand_String(&item->url, | 1655 | postCommandString_Root( |
1656 | argLabel_Command(cmd, "newtab"), | 1656 | get_Root(), |
1657 | argLabel_Command(cmd, "newwindow"))); | 1657 | feedEntryOpenCommand_String(&item->url, |
1658 | argLabel_Command(cmd, "newtab"), | ||
1659 | argLabel_Command(cmd, "newwindow"))); | ||
1658 | return iTrue; | 1660 | return iTrue; |
1659 | } | 1661 | } |
1660 | if (isCommand_Widget(w, ev, "feed.entry.toggleread")) { | 1662 | else if (isCommand_Widget(w, ev, "feed.entry.copy")) { |
1663 | SDL_SetClipboardText(cstr_String(&item->url)); | ||
1664 | return iTrue; | ||
1665 | } | ||
1666 | else if (isCommand_Widget(w, ev, "feed.entry.toggleread")) { | ||
1661 | iVisited *vis = visited_App(); | 1667 | iVisited *vis = visited_App(); |
1662 | const iString *url = urlFragmentStripped_String(&item->url); | 1668 | const iString *url = urlFragmentStripped_String(&item->url); |
1663 | if (containsUrl_Visited(vis, url)) { | 1669 | if (containsUrl_Visited(vis, url)) { |
@@ -1669,7 +1675,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
1669 | postCommand_App("visited.changed"); | 1675 | postCommand_App("visited.changed"); |
1670 | return iTrue; | 1676 | return iTrue; |
1671 | } | 1677 | } |
1672 | if (isCommand_Widget(w, ev, "feed.entry.bookmark")) { | 1678 | else if (isCommand_Widget(w, ev, "feed.entry.bookmark")) { |
1673 | makeBookmarkCreation_Widget(&item->url, &item->label, item->icon); | 1679 | makeBookmarkCreation_Widget(&item->url, &item->label, item->icon); |
1674 | if (deviceType_App() == desktop_AppDeviceType) { | 1680 | if (deviceType_App() == desktop_AppDeviceType) { |
1675 | postCommand_App("focus.set id:bmed.title"); | 1681 | postCommand_App("focus.set id:bmed.title"); |
@@ -1718,6 +1724,18 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
1718 | } | 1724 | } |
1719 | return iTrue; | 1725 | return iTrue; |
1720 | } | 1726 | } |
1727 | else if (isCommand_Widget(w, ev, "history.open")) { | ||
1728 | const iSidebarItem *item = d->contextItem; | ||
1729 | if (item && !isEmpty_String(&item->url)) { | ||
1730 | const char *cmd = command_UserEvent(ev); | ||
1731 | postCommand_Widget(d, | ||
1732 | "!open newtab:%d newwindow:%d url:%s", | ||
1733 | argLabel_Command(cmd, "newtab"), | ||
1734 | argLabel_Command(cmd, "newwindow"), | ||
1735 | cstr_String(&item->url)); | ||
1736 | } | ||
1737 | return iTrue; | ||
1738 | } | ||
1721 | else if (isCommand_Widget(w, ev, "history.copy")) { | 1739 | else if (isCommand_Widget(w, ev, "history.copy")) { |
1722 | const iSidebarItem *item = d->contextItem; | 1740 | const iSidebarItem *item = d->contextItem; |
1723 | if (item && !isEmpty_String(&item->url)) { | 1741 | if (item && !isEmpty_String(&item->url)) { |