diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-20 14:31:09 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-20 14:31:09 +0300 |
commit | 202e2a95e8f93d520377a03d0bc2c0c44cce95ab (patch) | |
tree | b5ca001a9b36380f301a21191a70290ec69ba49b /src/ui | |
parent | 4b50a09a4c835c23ff0ff389e976f2539d41f61b (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.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/util.c | 54 |
1 files changed, 39 insertions, 15 deletions
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 | ||
1554 | static void addDialogInputWithHeading_(iWidget *headings, iWidget *values, const char *labelText, | 1554 | static 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 | |||
1571 | static 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 | ||
1569 | iInputWidget *addTwoColumnDialogInputField_Widget(iWidget *headings, iWidget *values, | 1576 | iInputWidget *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; |