summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-05-20 14:31:09 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-05-20 14:31:09 +0300
commit202e2a95e8f93d520377a03d0bc2c0c44cce95ab (patch)
treeb5ca001a9b36380f301a21191a70290ec69ba49b
parent4b50a09a4c835c23ff0ff389e976f2539d41f61b (diff)
Identity creation user experience
Revised the New Identity dialog to hide the additional fields by default. Added a new option to select where the new identity will be active (current domain/page/nowhere). When the new identity is automatically activated, reload the URL used for activation.
-rw-r--r--po/en.po8
-rw-r--r--res/lang/de.binbin20305 -> 20358 bytes
-rw-r--r--res/lang/en.binbin19054 -> 19106 bytes
-rw-r--r--res/lang/es.binbin21021 -> 21074 bytes
-rw-r--r--res/lang/fi.binbin20995 -> 21048 bytes
-rw-r--r--res/lang/fr.binbin21511 -> 21564 bytes
-rw-r--r--res/lang/ia.binbin21212 -> 21265 bytes
-rw-r--r--res/lang/ie.binbin20383 -> 20436 bytes
-rw-r--r--res/lang/pl.binbin22016 -> 22069 bytes
-rw-r--r--res/lang/ru.binbin32094 -> 32147 bytes
-rw-r--r--res/lang/sr.binbin30673 -> 30726 bytes
-rw-r--r--res/lang/tok.binbin19417 -> 19470 bytes
-rw-r--r--res/lang/zh_Hans.binbin18176 -> 18229 bytes
-rw-r--r--res/lang/zh_Hant.binbin18250 -> 18303 bytes
-rw-r--r--src/app.c74
-rw-r--r--src/ui/util.c54
16 files changed, 117 insertions, 19 deletions
diff --git a/po/en.po b/po/en.po
index 60beade4..a89221d0 100644
--- a/po/en.po
+++ b/po/en.po
@@ -916,7 +916,7 @@ msgid "dlg.newident.until"
916msgstr "Valid until:" 916msgstr "Valid until:"
917 917
918msgid "hint.newident.date" 918msgid "hint.newident.date"
919msgstr "YYYY-MM-DD HH:MM:SS" 919msgstr "YYYY or YYYY-MM-DD"
920 920
921msgid "hint.newident.optional" 921msgid "hint.newident.optional"
922msgstr "optional" 922msgstr "optional"
@@ -930,6 +930,9 @@ msgstr "Temporary:"
930msgid "dlg.newident.notsaved" 930msgid "dlg.newident.notsaved"
931msgstr "not saved to disk" 931msgstr "not saved to disk"
932 932
933msgid "dlg.newident.scope"
934msgstr "Use on:"
935
933msgid "dlg.newident.email" 936msgid "dlg.newident.email"
934msgstr "Email:" 937msgstr "Email:"
935 938
@@ -945,6 +948,9 @@ msgstr "Organization:"
945msgid "dlg.newident.country" 948msgid "dlg.newident.country"
946msgstr "Country:" 949msgstr "Country:"
947 950
951msgid "dlg.newident.more"
952msgstr "More…"
953
948msgid "dlg.newident.create" 954msgid "dlg.newident.create"
949msgstr "Create Identity" 955msgstr "Create Identity"
950 956
diff --git a/res/lang/de.bin b/res/lang/de.bin
index 45c01abd..4c2c53ea 100644
--- a/res/lang/de.bin
+++ b/res/lang/de.bin
Binary files differ
diff --git a/res/lang/en.bin b/res/lang/en.bin
index 0a9a3c0f..d6dfc691 100644
--- a/res/lang/en.bin
+++ b/res/lang/en.bin
Binary files differ
diff --git a/res/lang/es.bin b/res/lang/es.bin
index 0d3e80c7..4a9b3cb5 100644
--- a/res/lang/es.bin
+++ b/res/lang/es.bin
Binary files differ
diff --git a/res/lang/fi.bin b/res/lang/fi.bin
index 00039ebd..da1eeeb7 100644
--- a/res/lang/fi.bin
+++ b/res/lang/fi.bin
Binary files differ
diff --git a/res/lang/fr.bin b/res/lang/fr.bin
index 139f8e51..80ca94cf 100644
--- a/res/lang/fr.bin
+++ b/res/lang/fr.bin
Binary files differ
diff --git a/res/lang/ia.bin b/res/lang/ia.bin
index e7607899..51be909b 100644
--- a/res/lang/ia.bin
+++ b/res/lang/ia.bin
Binary files differ
diff --git a/res/lang/ie.bin b/res/lang/ie.bin
index 79b517df..1a2223c8 100644
--- a/res/lang/ie.bin
+++ b/res/lang/ie.bin
Binary files differ
diff --git a/res/lang/pl.bin b/res/lang/pl.bin
index e208f3ba..52ff43ae 100644
--- a/res/lang/pl.bin
+++ b/res/lang/pl.bin
Binary files differ
diff --git a/res/lang/ru.bin b/res/lang/ru.bin
index 4e775c94..4c015ac3 100644
--- a/res/lang/ru.bin
+++ b/res/lang/ru.bin
Binary files differ
diff --git a/res/lang/sr.bin b/res/lang/sr.bin
index 19408d1a..4f06505d 100644
--- a/res/lang/sr.bin
+++ b/res/lang/sr.bin
Binary files differ
diff --git a/res/lang/tok.bin b/res/lang/tok.bin
index 2d8017cb..f15c88fa 100644
--- a/res/lang/tok.bin
+++ b/res/lang/tok.bin
Binary files differ
diff --git a/res/lang/zh_Hans.bin b/res/lang/zh_Hans.bin
index 171bd2a8..f4b7ef15 100644
--- a/res/lang/zh_Hans.bin
+++ b/res/lang/zh_Hans.bin
Binary files differ
diff --git a/res/lang/zh_Hant.bin b/res/lang/zh_Hant.bin
index 6518c7bf..154d991d 100644
--- a/res/lang/zh_Hant.bin
+++ b/res/lang/zh_Hant.bin
Binary files differ
diff --git a/src/app.c b/src/app.c
index 3f0ec2c4..4c4d08e9 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1653,12 +1653,36 @@ iDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf, iBool switchToNe
1653 1653
1654static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) { 1654static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) {
1655 iApp *d = &app_; 1655 iApp *d = &app_;
1656 if (equal_Command(cmd, "ident.showmore")) {
1657 iForEach(ObjectList, i, children_Widget(findChild_Widget(dlg, "headings"))) {
1658 if (flags_Widget(i.object) & collapse_WidgetFlag) {
1659 setFlags_Widget(i.object, hidden_WidgetFlag, iFalse);
1660 }
1661 }
1662 iForEach(ObjectList, j, children_Widget(findChild_Widget(dlg, "values"))) {
1663 if (flags_Widget(j.object) & collapse_WidgetFlag) {
1664 setFlags_Widget(j.object, hidden_WidgetFlag, iFalse);
1665 }
1666 }
1667 setFlags_Widget(child_Widget(findChild_Widget(dlg, "dialogbuttons"), 0), disabled_WidgetFlag,
1668 iTrue);
1669 arrange_Widget(dlg);
1670 refresh_Widget(dlg);
1671 return iTrue;
1672 }
1673 if (equal_Command(cmd, "ident.scope")) {
1674 iLabelWidget *scope = findChild_Widget(dlg, "ident.scope");
1675 setText_LabelWidget(scope,
1676 text_LabelWidget(child_Widget(
1677 findChild_Widget(as_Widget(scope), "menu"), arg_Command(cmd))));
1678 return iTrue;
1679 }
1656 if (equal_Command(cmd, "ident.temp.changed")) { 1680 if (equal_Command(cmd, "ident.temp.changed")) {
1657 setFlags_Widget( 1681 setFlags_Widget(
1658 findChild_Widget(dlg, "ident.temp.note"), hidden_WidgetFlag, !arg_Command(cmd)); 1682 findChild_Widget(dlg, "ident.temp.note"), hidden_WidgetFlag, !arg_Command(cmd));
1659 return iFalse; 1683 return iFalse;
1660 } 1684 }
1661 if (equal_Command(cmd, "ident.accept") || equal_Command(cmd, "cancel")) { 1685 if (equal_Command(cmd, "ident.accept") || equal_Command(cmd, "ident.cancel")) {
1662 if (equal_Command(cmd, "ident.accept")) { 1686 if (equal_Command(cmd, "ident.accept")) {
1663 const iString *commonName = text_InputWidget (findChild_Widget(dlg, "ident.common")); 1687 const iString *commonName = text_InputWidget (findChild_Widget(dlg, "ident.common"));
1664 const iString *email = text_InputWidget (findChild_Widget(dlg, "ident.email")); 1688 const iString *email = text_InputWidget (findChild_Widget(dlg, "ident.email"));
@@ -1706,11 +1730,55 @@ static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) {
1706 } 1730 }
1707 } 1731 }
1708 /* The input seems fine. */ 1732 /* The input seems fine. */
1709 newIdentity_GmCerts(d->certs, isTemp ? temporary_GmIdentityFlag : 0, 1733 iGmIdentity *ident = newIdentity_GmCerts(d->certs,
1710 until, commonName, email, userId, domain, organization, country); 1734 isTemp ? temporary_GmIdentityFlag : 0,
1735 until,
1736 commonName,
1737 email,
1738 userId,
1739 domain,
1740 organization,
1741 country);
1742 /* Use in the chosen scope. */ {
1743 const iLabelWidget *scope = findChild_Widget(dlg, "ident.scope");
1744 const iString * selLabel = text_LabelWidget(scope);
1745 int selScope = 0;
1746// printf("SelLabel: %s\n", cstr_String(selLabel));
1747 iConstForEach(ObjectList,
1748 i,
1749 children_Widget(findChild_Widget(constAs_Widget(scope), "menu"))) {
1750 if (isInstance_Object(i.object, &Class_LabelWidget)) {
1751 const iLabelWidget *item = i.object;
1752// printf("itemLabel: %s\n", cstr_String(text_LabelWidget(item)));
1753 if (equal_String(text_LabelWidget(item), selLabel)) {
1754 break;
1755 }
1756 selScope++;
1757 }
1758 }
1759// printf("selScope:%d\n", selScope);
1760 const iString *docUrl = url_DocumentWidget(document_Root(dlg->root));
1761 switch (selScope) {
1762 case 0: /* current domain */
1763 signIn_GmCerts(d->certs,
1764 ident,
1765 collectNewFormat_String(
1766 "gemini://%s", cstr_Rangecc(urlHost_String(docUrl))));
1767 break;
1768 case 1: /* current page */
1769 signIn_GmCerts(d->certs, ident, docUrl);
1770 break;
1771 default: /* not used */
1772 break;
1773 }
1774 if (selScope == 0 || selScope == 1) {
1775 postCommand_App("navigate.reload");
1776 }
1777 }
1711 postCommandf_App("sidebar.mode arg:%d show:1", identities_SidebarMode); 1778 postCommandf_App("sidebar.mode arg:%d show:1", identities_SidebarMode);
1712 postCommand_App("idents.changed"); 1779 postCommand_App("idents.changed");
1713 } 1780 }
1781 setupSheetTransition_Mobile(dlg, iFalse);
1714 destroy_Widget(dlg); 1782 destroy_Widget(dlg);
1715 return iTrue; 1783 return iTrue;
1716 } 1784 }
diff --git a/src/ui/util.c b/src/ui/util.c
index 86478300..0c71cb1f 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1551,8 +1551,8 @@ void updatePreferencesLayout_Widget(iWidget *prefs) {
1551 } 1551 }
1552} 1552}
1553 1553
1554static void addDialogInputWithHeading_(iWidget *headings, iWidget *values, const char *labelText, 1554static void addDialogInputWithHeadingAndFlags_(iWidget *headings, iWidget *values, const char *labelText,
1555 const char *inputId, iInputWidget *input) { 1555 const char *inputId, iInputWidget *input, int64_t flags) {
1556 iLabelWidget *head = addChild_Widget(headings, iClob(makeHeading_Widget(labelText))); 1556 iLabelWidget *head = addChild_Widget(headings, iClob(makeHeading_Widget(labelText)));
1557#if defined (iPlatformMobile) 1557#if defined (iPlatformMobile)
1558 /* On mobile, inputs have 2 gaps of extra padding. */ 1558 /* On mobile, inputs have 2 gaps of extra padding. */
@@ -1564,6 +1564,13 @@ static void addDialogInputWithHeading_(iWidget *headings, iWidget *values, const
1564 /* Ensure that the label has the same height as the input widget. */ 1564 /* Ensure that the label has the same height as the input widget. */
1565 as_Widget(head)->sizeRef = as_Widget(input); 1565 as_Widget(head)->sizeRef = as_Widget(input);
1566 } 1566 }
1567 setFlags_Widget(as_Widget(head), flags, iTrue);
1568 setFlags_Widget(as_Widget(input), flags, iTrue);
1569}
1570
1571static void addDialogInputWithHeading_(iWidget *headings, iWidget *values, const char *labelText,
1572 const char *inputId, iInputWidget *input) {
1573 addDialogInputWithHeadingAndFlags_(headings, values, labelText, inputId, input, 0);
1567} 1574}
1568 1575
1569iInputWidget *addTwoColumnDialogInputField_Widget(iWidget *headings, iWidget *values, 1576iInputWidget *addTwoColumnDialogInputField_Widget(iWidget *headings, iWidget *values,
@@ -2049,7 +2056,21 @@ iWidget *makeIdentityCreation_Widget(void) {
2049 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); 2056 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag);
2050 iWidget *values = addChildFlags_Widget( 2057 iWidget *values = addChildFlags_Widget(
2051 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); 2058 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag);
2059 setId_Widget(headings, "headings");
2060 setId_Widget(values, "values");
2052 iInputWidget *inputs[6]; 2061 iInputWidget *inputs[6];
2062 /* Where will the new identity be active on? */ {
2063 addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.newident.scope}")));
2064 const iMenuItem items[] = {
2065 { "Current Domain", 0, 0, "ident.scope arg:0" },
2066 { "Current Page", 0, 0, "ident.scope arg:1" },
2067 { "Not Used", 0, 0, "ident.scope arg:2" },
2068 };
2069 setId_Widget(addChild_Widget(values,
2070 iClob(makeMenuButton_LabelWidget(
2071 items[0].label, items, iElemCount(items)))),
2072 "ident.scope");
2073 }
2053 addDialogInputWithHeading_(headings, 2074 addDialogInputWithHeading_(headings,
2054 values, 2075 values,
2055 "${dlg.newident.until}", 2076 "${dlg.newident.until}",
@@ -2066,32 +2087,35 @@ iWidget *makeIdentityCreation_Widget(void) {
2066 setFlags_Widget(tmpGroup, arrangeSize_WidgetFlag | arrangeHorizontal_WidgetFlag, iTrue); 2087 setFlags_Widget(tmpGroup, arrangeSize_WidgetFlag | arrangeHorizontal_WidgetFlag, iTrue);
2067 addChild_Widget(tmpGroup, iClob(makeToggle_Widget("ident.temp"))); 2088 addChild_Widget(tmpGroup, iClob(makeToggle_Widget("ident.temp")));
2068 setId_Widget( 2089 setId_Widget(
2069 addChildFlags_Widget( 2090 addChildFlags_Widget(tmpGroup,
2070 tmpGroup, 2091 iClob(new_LabelWidget(uiTextCaution_ColorEscape warning_Icon
2071 iClob(new_LabelWidget(uiTextCaution_ColorEscape "\u26a0 ${dlg.newident.notsaved}", NULL)), 2092 " ${dlg.newident.notsaved}",
2072 hidden_WidgetFlag | frameless_WidgetFlag), 2093 NULL)),
2094 hidden_WidgetFlag | frameless_WidgetFlag),
2073 "ident.temp.note"); 2095 "ident.temp.note");
2074 addChild_Widget(values, iClob(tmpGroup)); 2096 addChild_Widget(values, iClob(tmpGroup));
2075 } 2097 }
2076 addChild_Widget(headings, iClob(makePadding_Widget(gap_UI))); 2098 addChildFlags_Widget(headings, iClob(makePadding_Widget(gap_UI)), collapse_WidgetFlag | hidden_WidgetFlag);
2077 addChild_Widget(values, iClob(makePadding_Widget(gap_UI))); 2099 addChildFlags_Widget(values, iClob(makePadding_Widget(gap_UI)), collapse_WidgetFlag | hidden_WidgetFlag);
2078 addDialogInputWithHeading_(headings, values, "${dlg.newident.email}", "ident.email", iClob(inputs[1] = newHint_InputWidget(0, "${hint.newident.optional}"))); 2100 addDialogInputWithHeadingAndFlags_(headings, values, "${dlg.newident.email}", "ident.email", iClob(inputs[1] = newHint_InputWidget(0, "${hint.newident.optional}")), collapse_WidgetFlag | hidden_WidgetFlag);
2079 addDialogInputWithHeading_(headings, values, "${dlg.newident.userid}", "ident.userid", iClob(inputs[2] = newHint_InputWidget(0, "${hint.newident.optional}"))); 2101 addDialogInputWithHeadingAndFlags_(headings, values, "${dlg.newident.userid}", "ident.userid", iClob(inputs[2] = newHint_InputWidget(0, "${hint.newident.optional}")), collapse_WidgetFlag | hidden_WidgetFlag);
2080 addDialogInputWithHeading_(headings, values, "${dlg.newident.domain}", "ident.domain", iClob(inputs[3] = newHint_InputWidget(0, "${hint.newident.optional}"))); 2102 addDialogInputWithHeadingAndFlags_(headings, values, "${dlg.newident.domain}", "ident.domain", iClob(inputs[3] = newHint_InputWidget(0, "${hint.newident.optional}")), collapse_WidgetFlag | hidden_WidgetFlag);
2081 addDialogInputWithHeading_(headings, values, "${dlg.newident.org}", "ident.org", iClob(inputs[4] = newHint_InputWidget(0, "${hint.newident.optional}"))); 2103 addDialogInputWithHeadingAndFlags_(headings, values, "${dlg.newident.org}", "ident.org", iClob(inputs[4] = newHint_InputWidget(0, "${hint.newident.optional}")), collapse_WidgetFlag | hidden_WidgetFlag);
2082 addDialogInputWithHeading_(headings, values, "${dlg.newident.country}", "ident.country", iClob(inputs[5] = newHint_InputWidget(0, "${hint.newident.optional}"))); 2104 addDialogInputWithHeadingAndFlags_(headings, values, "${dlg.newident.country}", "ident.country", iClob(inputs[5] = newHint_InputWidget(0, "${hint.newident.optional}")), collapse_WidgetFlag | hidden_WidgetFlag);
2083 arrange_Widget(dlg); 2105 arrange_Widget(dlg);
2084 for (size_t i = 0; i < iElemCount(inputs); ++i) { 2106 for (size_t i = 0; i < iElemCount(inputs); ++i) {
2085 as_Widget(inputs[i])->rect.size.x = 100 * gap_UI - headings->rect.size.x; 2107 as_Widget(inputs[i])->rect.size.x = 100 * gap_UI - headings->rect.size.x;
2086 } 2108 }
2087 addChild_Widget(dlg, 2109 addChild_Widget(dlg,
2088 iClob(makeDialogButtons_Widget( 2110 iClob(makeDialogButtons_Widget(
2089 (iMenuItem[]){ { "${cancel}", 0, 0, NULL }, 2111 (iMenuItem[]){ { "${dlg.newident.more}", 0, 0, "ident.showmore" },
2112 { "---", 0, 0, NULL },
2113 { "${cancel}", SDLK_ESCAPE, 0, "ident.cancel" },
2090 { uiTextAction_ColorEscape "${dlg.newident.create}", 2114 { uiTextAction_ColorEscape "${dlg.newident.create}",
2091 SDLK_RETURN, 2115 SDLK_RETURN,
2092 KMOD_PRIMARY, 2116 KMOD_PRIMARY,
2093 "ident.accept" } }, 2117 "ident.accept" } },
2094 2))); 2118 4)));
2095 addChild_Widget(get_Root()->widget, iClob(dlg)); 2119 addChild_Widget(get_Root()->widget, iClob(dlg));
2096 finalizeSheet_Mobile(dlg); 2120 finalizeSheet_Mobile(dlg);
2097 return dlg; 2121 return dlg;