summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/certimportwidget.c8
-rw-r--r--src/ui/documentwidget.c22
-rw-r--r--src/ui/sidebarwidget.c4
-rw-r--r--src/ui/util.c13
-rw-r--r--src/ui/util.h4
-rw-r--r--src/ui/window.c7
6 files changed, 39 insertions, 19 deletions
diff --git a/src/ui/certimportwidget.c b/src/ui/certimportwidget.c
index 3a037135..fdc189db 100644
--- a/src/ui/certimportwidget.c
+++ b/src/ui/certimportwidget.c
@@ -207,8 +207,8 @@ static iBool processEvent_CertImportWidget_(iCertImportWidget *d, const SDL_Even
207 const int mods = keyMods_Sym(ev->key.keysym.mod); 207 const int mods = keyMods_Sym(ev->key.keysym.mod);
208 if (key == SDLK_v && mods == KMOD_PRIMARY) { 208 if (key == SDLK_v && mods == KMOD_PRIMARY) {
209 if (!tryImportFromClipboard_CertImportWidget_(d)) { 209 if (!tryImportFromClipboard_CertImportWidget_(d)) {
210 makeMessage_Widget(uiTextCaution_ColorEscape "${heading.certimport.pasted}", 210 makeSimpleMessage_Widget(uiTextCaution_ColorEscape "${heading.certimport.pasted}",
211 "${dlg.certimport.notfound}"); 211 "${dlg.certimport.notfound}");
212 } 212 }
213 postRefresh_App(); 213 postRefresh_App();
214 return iTrue; 214 return iTrue;
@@ -241,8 +241,8 @@ static iBool processEvent_CertImportWidget_(iCertImportWidget *d, const SDL_Even
241 } 241 }
242 } 242 }
243 else { 243 else {
244 makeMessage_Widget(uiTextCaution_ColorEscape "${heading.certimport.dropped}", 244 makeSimpleMessage_Widget(uiTextCaution_ColorEscape "${heading.certimport.dropped}",
245 "${dlg.certimport.notfound}"); 245 "${dlg.certimport.notfound}");
246 } 246 }
247 } 247 }
248 iRelease(f); 248 iRelease(f);
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 1960d9b7..9b414b63 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1615,7 +1615,7 @@ static iBool handleMediaCommand_DocumentWidget_(iDocumentWidget *d, const char *
1615 } 1615 }
1616 else { 1616 else {
1617 const iGmError *err = get_GmError(code); 1617 const iGmError *err = get_GmError(code);
1618 makeMessage_Widget(format_CStr(uiTextCaution_ColorEscape "%s", err->title), err->info); 1618 makeSimpleMessage_Widget(format_CStr(uiTextCaution_ColorEscape "%s", err->title), err->info);
1619 removeMediaRequest_DocumentWidget_(d, req->linkId); 1619 removeMediaRequest_DocumentWidget_(d, req->linkId);
1620 } 1620 }
1621 return iTrue; 1621 return iTrue;
@@ -1665,15 +1665,21 @@ static void saveToDownloads_(const iString *url, const iString *mime, const iBlo
1665#if defined (iPlatformAppleMobile) 1665#if defined (iPlatformAppleMobile)
1666 exportDownloadedFile_iOS(savePath); 1666 exportDownloadedFile_iOS(savePath);
1667#else 1667#else
1668 const iMenuItem items[2] = {
1669 { "Open Downloaded File", 0, 0,
1670 format_CStr("!open url:%s", cstrCollect_String(makeFileUrl_String(savePath))) },
1671 { "${dlg.message.ok}", 0, 0, "message.ok" },
1672 };
1668 makeMessage_Widget(uiHeading_ColorEscape "${heading.save}", 1673 makeMessage_Widget(uiHeading_ColorEscape "${heading.save}",
1669 format_CStr("%s\n${dlg.save.size} %.3f %s", cstr_String(path_File(f)), 1674 format_CStr("%s\n${dlg.save.size} %.3f %s", cstr_String(path_File(f)),
1670 isMega ? size / 1.0e6f : (size / 1.0e3f), 1675 isMega ? size / 1.0e6f : (size / 1.0e3f),
1671 isMega ? "${mb}" : "${kb}")); 1676 isMega ? "${mb}" : "${kb}"),
1677 items, iElemCount(items));
1672#endif 1678#endif
1673 } 1679 }
1674 else { 1680 else {
1675 makeMessage_Widget(uiTextCaution_ColorEscape "${heading.save.error}", 1681 makeSimpleMessage_Widget(uiTextCaution_ColorEscape "${heading.save.error}",
1676 strerror(errno)); 1682 strerror(errno));
1677 } 1683 }
1678 iRelease(f); 1684 iRelease(f);
1679 } 1685 }
@@ -2141,8 +2147,8 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
2141 } 2147 }
2142 else if (equal_Command(cmd, "document.save") && document_App() == d) { 2148 else if (equal_Command(cmd, "document.save") && document_App() == d) {
2143 if (d->request) { 2149 if (d->request) {
2144 makeMessage_Widget(uiTextCaution_ColorEscape "${heading.save.incomplete}", 2150 makeSimpleMessage_Widget(uiTextCaution_ColorEscape "${heading.save.incomplete}",
2145 "${dlg.save.incomplete}"); 2151 "${dlg.save.incomplete}");
2146 } 2152 }
2147 else if (!isEmpty_Block(&d->sourceContent)) { 2153 else if (!isEmpty_Block(&d->sourceContent)) {
2148 saveToDownloads_(d->mod.url, &d->sourceMime, &d->sourceContent); 2154 saveToDownloads_(d->mod.url, &d->sourceMime, &d->sourceContent);
@@ -2375,8 +2381,8 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
2375 } 2381 }
2376 } 2382 }
2377 else { 2383 else {
2378 makeMessage_Widget(uiHeading_ColorEscape "${heading.import.bookmarks}", 2384 makeSimpleMessage_Widget(uiHeading_ColorEscape "${heading.import.bookmarks}",
2379 "${dlg.import.notnew}"); 2385 "${dlg.import.notnew}");
2380 } 2386 }
2381 return iTrue; 2387 return iTrue;
2382 } 2388 }
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index e7dcadde..5aa17140 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -1161,8 +1161,8 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
1161 else if (isCommand_Widget(w, ev, "ident.showuse")) { 1161 else if (isCommand_Widget(w, ev, "ident.showuse")) {
1162 const iGmIdentity *ident = menuIdentity_SidebarWidget_(d); 1162 const iGmIdentity *ident = menuIdentity_SidebarWidget_(d);
1163 if (ident) { 1163 if (ident) {
1164 makeMessage_Widget(uiHeading_ColorEscape "${heading.ident.use}", 1164 makeSimpleMessage_Widget(uiHeading_ColorEscape "${heading.ident.use}",
1165 cstrCollect_String(joinCStr_StringSet(ident->useUrls, "\n"))); 1165 cstrCollect_String(joinCStr_StringSet(ident->useUrls, "\n")));
1166 } 1166 }
1167 return iTrue; 1167 return iTrue;
1168 } 1168 }
diff --git a/src/ui/util.c b/src/ui/util.c
index 586a08be..e3a3689b 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1927,9 +1927,16 @@ static iBool messageHandler_(iWidget *msg, const char *cmd) {
1927 return iFalse; 1927 return iFalse;
1928} 1928}
1929 1929
1930iWidget *makeMessage_Widget(const char *title, const char *msg) { 1930iWidget *makeSimpleMessage_Widget(const char *title, const char *msg) {
1931 iWidget *dlg = 1931 return makeMessage_Widget(title,
1932 makeQuestion_Widget(title, msg, (iMenuItem[]){ { "${dlg.message.ok}", 0, 0, "message.ok" } }, 1); 1932 msg,
1933 (iMenuItem[]){ { "${dlg.message.ok}", 0, 0, "message.ok" } },
1934 1);
1935}
1936
1937iWidget *makeMessage_Widget(const char *title, const char *msg, const iMenuItem *items,
1938 size_t numItems) {
1939 iWidget *dlg = makeQuestion_Widget(title, msg, items, numItems);
1933 addAction_Widget(dlg, SDLK_ESCAPE, 0, "message.ok"); 1940 addAction_Widget(dlg, SDLK_ESCAPE, 0, "message.ok");
1934 addAction_Widget(dlg, SDLK_SPACE, 0, "message.ok"); 1941 addAction_Widget(dlg, SDLK_SPACE, 0, "message.ok");
1935 return dlg; 1942 return dlg;
diff --git a/src/ui/util.h b/src/ui/util.h
index 223982a8..aaffb1b8 100644
--- a/src/ui/util.h
+++ b/src/ui/util.h
@@ -259,7 +259,9 @@ void makeFilePath_Widget (iWidget *parent, const iString *initialPath
259iWidget * makeValueInput_Widget (iWidget *parent, const iString *initialValue, const char *title, 259iWidget * makeValueInput_Widget (iWidget *parent, const iString *initialValue, const char *title,
260 const char *prompt, const char *acceptLabel, const char *command); 260 const char *prompt, const char *acceptLabel, const char *command);
261void updateValueInput_Widget (iWidget *, const char *title, const char *prompt); 261void updateValueInput_Widget (iWidget *, const char *title, const char *prompt);
262iWidget * makeMessage_Widget (const char *title, const char *msg); 262iWidget * makeSimpleMessage_Widget(const char *title, const char *msg);
263iWidget * makeMessage_Widget (const char *title, const char *msg,
264 const iMenuItem *items, size_t numItems);
263iWidget * makeQuestion_Widget (const char *title, const char *msg, 265iWidget * makeQuestion_Widget (const char *title, const char *msg,
264 const iMenuItem *items, size_t numItems); 266 const iMenuItem *items, size_t numItems);
265 267
diff --git a/src/ui/window.c b/src/ui/window.c
index b400dced..086ab86e 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -195,6 +195,7 @@ static const iMenuItem navMenuItems_[] = {
195 { "${menu.openlocation}", SDLK_l, KMOD_PRIMARY, "navigate.focus" }, 195 { "${menu.openlocation}", SDLK_l, KMOD_PRIMARY, "navigate.focus" },
196 { "---", 0, 0, NULL }, 196 { "---", 0, 0, NULL },
197 { download_Icon " " saveToDownloads_Label, SDLK_s, KMOD_PRIMARY, "document.save" }, 197 { download_Icon " " saveToDownloads_Label, SDLK_s, KMOD_PRIMARY, "document.save" },
198 { "${menu.downloads}", 0, 0, "downloads.open" },
198 { "${menu.page.copysource}", SDLK_c, KMOD_PRIMARY, "copy" }, 199 { "${menu.page.copysource}", SDLK_c, KMOD_PRIMARY, "copy" },
199 { "---", 0, 0, NULL }, 200 { "---", 0, 0, NULL },
200 { leftHalf_Icon " ${menu.sidebar.left}", SDLK_l, KMOD_PRIMARY | KMOD_SHIFT, "sidebar.toggle" }, 201 { leftHalf_Icon " ${menu.sidebar.left}", SDLK_l, KMOD_PRIMARY | KMOD_SHIFT, "sidebar.toggle" },
@@ -227,7 +228,8 @@ static const iMenuItem tabletNavMenuItems_[] = {
227 { "---", 0, 0, NULL }, 228 { "---", 0, 0, NULL },
228 { book_Icon " ${menu.bookmarks.list}", 0, 0, "!open url:about:bookmarks" }, 229 { book_Icon " ${menu.bookmarks.list}", 0, 0, "!open url:about:bookmarks" },
229 { "${menu.bookmarks.bytag}", 0, 0, "!open url:about:bookmarks?tags" }, 230 { "${menu.bookmarks.bytag}", 0, 0, "!open url:about:bookmarks?tags" },
230 { "${menu.bookmarks.bytime}", 0, 0, "!open url:about:feeds" }, 231 { "${menu.feeds.entrylist}", 0, 0, "!open url:about:feeds" },
232 { "${menu.downloads}", 0, 0, "downloads.open" },
231 { "---", 0, 0, NULL }, 233 { "---", 0, 0, NULL },
232 { gear_Icon " ${menu.preferences}", SDLK_COMMA, KMOD_PRIMARY, "preferences" }, 234 { gear_Icon " ${menu.preferences}", SDLK_COMMA, KMOD_PRIMARY, "preferences" },
233 { "${menu.help}", SDLK_F1, 0, "!open url:about:help" }, 235 { "${menu.help}", SDLK_F1, 0, "!open url:about:help" },
@@ -244,6 +246,7 @@ static const iMenuItem phoneNavMenuItems_[] = {
244 { "---", 0, 0, NULL }, 246 { "---", 0, 0, NULL },
245 { book_Icon " ${menu.bookmarks.list}", 0, 0, "!open url:about:bookmarks" }, 247 { book_Icon " ${menu.bookmarks.list}", 0, 0, "!open url:about:bookmarks" },
246 { "${menu.feeds.entrylist}", 0, 0, "!open url:about:feeds" }, 248 { "${menu.feeds.entrylist}", 0, 0, "!open url:about:feeds" },
249 { "${menu.downloads}", 0, 0, "downloads.open" },
247 { "---", 0, 0, NULL }, 250 { "---", 0, 0, NULL },
248 { gear_Icon " Settings...", SDLK_COMMA, KMOD_PRIMARY, "preferences" }, 251 { gear_Icon " Settings...", SDLK_COMMA, KMOD_PRIMARY, "preferences" },
249}; 252};
@@ -257,6 +260,8 @@ static const iMenuItem fileMenuItems_[] = {
257 { "${menu.openlocation}", SDLK_l, KMOD_PRIMARY, "navigate.focus" }, 260 { "${menu.openlocation}", SDLK_l, KMOD_PRIMARY, "navigate.focus" },
258 { "---", 0, 0, NULL }, 261 { "---", 0, 0, NULL },
259 { saveToDownloads_Label, SDLK_s, KMOD_PRIMARY, "document.save" }, 262 { saveToDownloads_Label, SDLK_s, KMOD_PRIMARY, "document.save" },
263 { "---", 0, 0, NULL },
264 { "${menu.downloads}", 0, 0, "downloads.open" },
260}; 265};
261 266
262static const iMenuItem editMenuItems_[] = { 267static const iMenuItem editMenuItems_[] = {