diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 29 | ||||
-rw-r--r-- | src/ui/certimportwidget.c | 8 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 22 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 4 | ||||
-rw-r--r-- | src/ui/util.c | 13 | ||||
-rw-r--r-- | src/ui/util.h | 4 | ||||
-rw-r--r-- | src/ui/window.c | 7 |
7 files changed, 56 insertions, 31 deletions
@@ -1491,8 +1491,8 @@ static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) { | |||
1491 | const iString *country = text_InputWidget (findChild_Widget(dlg, "ident.country")); | 1491 | const iString *country = text_InputWidget (findChild_Widget(dlg, "ident.country")); |
1492 | const iBool isTemp = isSelected_Widget(findChild_Widget(dlg, "ident.temp")); | 1492 | const iBool isTemp = isSelected_Widget(findChild_Widget(dlg, "ident.temp")); |
1493 | if (isEmpty_String(commonName)) { | 1493 | if (isEmpty_String(commonName)) { |
1494 | makeMessage_Widget(orange_ColorEscape "MISSING INFO", | 1494 | makeSimpleMessage_Widget(orange_ColorEscape "MISSING INFO", |
1495 | "A \"Common name\" must be specified."); | 1495 | "A \"Common name\" must be specified."); |
1496 | return iTrue; | 1496 | return iTrue; |
1497 | } | 1497 | } |
1498 | iDate until; | 1498 | iDate until; |
@@ -1506,11 +1506,11 @@ static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) { | |||
1506 | "%04u-%u-%u %u:%u:%u", | 1506 | "%04u-%u-%u %u:%u:%u", |
1507 | &val[0], &val[1], &val[2], &val[3], &val[4], &val[5]); | 1507 | &val[0], &val[1], &val[2], &val[3], &val[4], &val[5]); |
1508 | if (n <= 0) { | 1508 | if (n <= 0) { |
1509 | makeMessage_Widget(orange_ColorEscape "INVALID DATE", | 1509 | makeSimpleMessage_Widget(orange_ColorEscape "INVALID DATE", |
1510 | "Please check the \"Valid until\" date. Examples:\n" | 1510 | "Please check the \"Valid until\" date. Examples:\n" |
1511 | "\u2022 2030\n" | 1511 | "\u2022 2030\n" |
1512 | "\u2022 2025-06-30\n" | 1512 | "\u2022 2025-06-30\n" |
1513 | "\u2022 2021-12-31 23:59:59"); | 1513 | "\u2022 2021-12-31 23:59:59"); |
1514 | return iTrue; | 1514 | return iTrue; |
1515 | } | 1515 | } |
1516 | until.year = val[0]; | 1516 | until.year = val[0]; |
@@ -1525,8 +1525,8 @@ static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) { | |||
1525 | initCurrent_Time(&now); | 1525 | initCurrent_Time(&now); |
1526 | init_Time(&t, &until); | 1526 | init_Time(&t, &until); |
1527 | if (cmp_Time(&t, &now) <= 0) { | 1527 | if (cmp_Time(&t, &now) <= 0) { |
1528 | makeMessage_Widget(orange_ColorEscape "INVALID DATE", | 1528 | makeSimpleMessage_Widget(orange_ColorEscape "INVALID DATE", |
1529 | "Expiration date must be in the future."); | 1529 | "Expiration date must be in the future."); |
1530 | return iTrue; | 1530 | return iTrue; |
1531 | } | 1531 | } |
1532 | } | 1532 | } |
@@ -1559,9 +1559,10 @@ const iString *searchQueryUrl_App(const iString *queryStringUnescaped) { | |||
1559 | iBool handleCommand_App(const char *cmd) { | 1559 | iBool handleCommand_App(const char *cmd) { |
1560 | iApp *d = &app_; | 1560 | iApp *d = &app_; |
1561 | if (equal_Command(cmd, "config.error")) { | 1561 | if (equal_Command(cmd, "config.error")) { |
1562 | makeMessage_Widget(uiTextCaution_ColorEscape "CONFIG ERROR", | 1562 | makeSimpleMessage_Widget(uiTextCaution_ColorEscape "CONFIG ERROR", |
1563 | format_CStr("Error in config file: %s\nSee \"about:debug\" for details.", | 1563 | format_CStr("Error in config file: %s\n" |
1564 | suffixPtr_Command(cmd, "where"))); | 1564 | "See \"about:debug\" for details.", |
1565 | suffixPtr_Command(cmd, "where"))); | ||
1565 | return iTrue; | 1566 | return iTrue; |
1566 | } | 1567 | } |
1567 | else if (equal_Command(cmd, "prefs.changed")) { | 1568 | else if (equal_Command(cmd, "prefs.changed")) { |
@@ -1810,6 +1811,10 @@ iBool handleCommand_App(const char *cmd) { | |||
1810 | setCStr_String(&d->prefs.downloadDir, suffixPtr_Command(cmd, "path")); | 1811 | setCStr_String(&d->prefs.downloadDir, suffixPtr_Command(cmd, "path")); |
1811 | return iTrue; | 1812 | return iTrue; |
1812 | } | 1813 | } |
1814 | else if (equal_Command(cmd, "downloads.open")) { | ||
1815 | postCommandf_App("open url:%s", cstrCollect_String(makeFileUrl_String(downloadDir_App()))); | ||
1816 | return iTrue; | ||
1817 | } | ||
1813 | else if (equal_Command(cmd, "ca.file")) { | 1818 | else if (equal_Command(cmd, "ca.file")) { |
1814 | setCStr_String(&d->prefs.caFile, suffixPtr_Command(cmd, "path")); | 1819 | setCStr_String(&d->prefs.caFile, suffixPtr_Command(cmd, "path")); |
1815 | if (!argLabel_Command(cmd, "noset")) { | 1820 | if (!argLabel_Command(cmd, "noset")) { |
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 | ||
1930 | iWidget *makeMessage_Widget(const char *title, const char *msg) { | 1930 | iWidget *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 | |||
1937 | iWidget *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 | |||
259 | iWidget * makeValueInput_Widget (iWidget *parent, const iString *initialValue, const char *title, | 259 | iWidget * 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); |
261 | void updateValueInput_Widget (iWidget *, const char *title, const char *prompt); | 261 | void updateValueInput_Widget (iWidget *, const char *title, const char *prompt); |
262 | iWidget * makeMessage_Widget (const char *title, const char *msg); | 262 | iWidget * makeSimpleMessage_Widget(const char *title, const char *msg); |
263 | iWidget * makeMessage_Widget (const char *title, const char *msg, | ||
264 | const iMenuItem *items, size_t numItems); | ||
263 | iWidget * makeQuestion_Widget (const char *title, const char *msg, | 265 | iWidget * 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 | ||
262 | static const iMenuItem editMenuItems_[] = { | 267 | static const iMenuItem editMenuItems_[] = { |