diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-12-03 10:41:15 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-12-03 10:41:15 +0200 |
commit | ad86fbe2cffa2bea07d004782e711932c5c91a79 (patch) | |
tree | 5df37073ad27b9893c4f42673e02e39ceb0a1176 | |
parent | 6e917280380316eba77b1dfa983daf488510e70f (diff) |
Improving identity use
The URL checks for determining which identity was in use were a bit too page-specific. Now the URL prefix usage is applied more consistently.
The identity toolbar menu is now more useful in that it allows both switching identities and stopping the use of the current identity.
-rw-r--r-- | po/en.po | 2 | ||||
-rw-r--r-- | res/lang/cs.bin | bin | 31087 -> 31081 bytes | |||
-rw-r--r-- | res/lang/de.bin | bin | 30094 -> 30088 bytes | |||
-rw-r--r-- | res/lang/en.bin | bin | 26191 -> 26185 bytes | |||
-rw-r--r-- | res/lang/eo.bin | bin | 25145 -> 25139 bytes | |||
-rw-r--r-- | res/lang/es.bin | bin | 29918 -> 29912 bytes | |||
-rw-r--r-- | res/lang/es_MX.bin | bin | 27250 -> 27244 bytes | |||
-rw-r--r-- | res/lang/fi.bin | bin | 29751 -> 29745 bytes | |||
-rw-r--r-- | res/lang/fr.bin | bin | 30898 -> 30892 bytes | |||
-rw-r--r-- | res/lang/gl.bin | bin | 29103 -> 29097 bytes | |||
-rw-r--r-- | res/lang/hu.bin | bin | 30923 -> 30917 bytes | |||
-rw-r--r-- | res/lang/ia.bin | bin | 28250 -> 28244 bytes | |||
-rw-r--r-- | res/lang/ie.bin | bin | 28838 -> 28832 bytes | |||
-rw-r--r-- | res/lang/isv.bin | bin | 24911 -> 24905 bytes | |||
-rw-r--r-- | res/lang/pl.bin | bin | 29526 -> 29520 bytes | |||
-rw-r--r-- | res/lang/ru.bin | bin | 44286 -> 44280 bytes | |||
-rw-r--r-- | res/lang/sk.bin | bin | 25247 -> 25241 bytes | |||
-rw-r--r-- | res/lang/sr.bin | bin | 43712 -> 43706 bytes | |||
-rw-r--r-- | res/lang/tok.bin | bin | 26960 -> 26954 bytes | |||
-rw-r--r-- | res/lang/tr.bin | bin | 29144 -> 29138 bytes | |||
-rw-r--r-- | res/lang/uk.bin | bin | 43631 -> 43625 bytes | |||
-rw-r--r-- | res/lang/zh_Hans.bin | bin | 25145 -> 25139 bytes | |||
-rw-r--r-- | res/lang/zh_Hant.bin | bin | 25343 -> 25337 bytes | |||
-rw-r--r-- | src/app.c | 4 | ||||
-rw-r--r-- | src/gmcerts.c | 16 | ||||
-rw-r--r-- | src/ui/certlistwidget.c | 13 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 9 | ||||
-rw-r--r-- | src/ui/root.c | 78 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 59 |
29 files changed, 108 insertions, 73 deletions
@@ -639,7 +639,7 @@ msgstr "Export" | |||
639 | # The %s represents the name of an identity. | 639 | # The %s represents the name of an identity. |
640 | #, c-format | 640 | #, c-format |
641 | msgid "ident.switch" | 641 | msgid "ident.switch" |
642 | msgstr "Switch to %s" | 642 | msgstr "Use %s" |
643 | 643 | ||
644 | msgid "heading.ident.use" | 644 | msgid "heading.ident.use" |
645 | msgstr "IDENTITY USAGE" | 645 | msgstr "IDENTITY USAGE" |
diff --git a/res/lang/cs.bin b/res/lang/cs.bin index 7c08bcfe..cf37c7de 100644 --- a/res/lang/cs.bin +++ b/res/lang/cs.bin | |||
Binary files differ | |||
diff --git a/res/lang/de.bin b/res/lang/de.bin index e3f45a34..a9d497d7 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 0c65ffd3..5e24ab94 100644 --- a/res/lang/en.bin +++ b/res/lang/en.bin | |||
Binary files differ | |||
diff --git a/res/lang/eo.bin b/res/lang/eo.bin index 9edecafe..789c01c2 100644 --- a/res/lang/eo.bin +++ b/res/lang/eo.bin | |||
Binary files differ | |||
diff --git a/res/lang/es.bin b/res/lang/es.bin index 9e7d0585..7ca8e297 100644 --- a/res/lang/es.bin +++ b/res/lang/es.bin | |||
Binary files differ | |||
diff --git a/res/lang/es_MX.bin b/res/lang/es_MX.bin index 1dd95a4e..43a5bb77 100644 --- a/res/lang/es_MX.bin +++ b/res/lang/es_MX.bin | |||
Binary files differ | |||
diff --git a/res/lang/fi.bin b/res/lang/fi.bin index 1d5e4624..5a0ec586 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 c0202489..329cae2b 100644 --- a/res/lang/fr.bin +++ b/res/lang/fr.bin | |||
Binary files differ | |||
diff --git a/res/lang/gl.bin b/res/lang/gl.bin index 34d16341..527de83b 100644 --- a/res/lang/gl.bin +++ b/res/lang/gl.bin | |||
Binary files differ | |||
diff --git a/res/lang/hu.bin b/res/lang/hu.bin index 2ab5484b..82257541 100644 --- a/res/lang/hu.bin +++ b/res/lang/hu.bin | |||
Binary files differ | |||
diff --git a/res/lang/ia.bin b/res/lang/ia.bin index c43aec10..5f1d7ab2 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 8a1d71e4..0d866d47 100644 --- a/res/lang/ie.bin +++ b/res/lang/ie.bin | |||
Binary files differ | |||
diff --git a/res/lang/isv.bin b/res/lang/isv.bin index e9978815..d30dcf4f 100644 --- a/res/lang/isv.bin +++ b/res/lang/isv.bin | |||
Binary files differ | |||
diff --git a/res/lang/pl.bin b/res/lang/pl.bin index b6de49f1..e9fd8460 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 7f153025..f8a69f51 100644 --- a/res/lang/ru.bin +++ b/res/lang/ru.bin | |||
Binary files differ | |||
diff --git a/res/lang/sk.bin b/res/lang/sk.bin index 35fdb2b1..9d0e9f04 100644 --- a/res/lang/sk.bin +++ b/res/lang/sk.bin | |||
Binary files differ | |||
diff --git a/res/lang/sr.bin b/res/lang/sr.bin index bd9ca450..bbaba1e9 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 cb34ada6..517194d1 100644 --- a/res/lang/tok.bin +++ b/res/lang/tok.bin | |||
Binary files differ | |||
diff --git a/res/lang/tr.bin b/res/lang/tr.bin index 99dc6431..e0aef190 100644 --- a/res/lang/tr.bin +++ b/res/lang/tr.bin | |||
Binary files differ | |||
diff --git a/res/lang/uk.bin b/res/lang/uk.bin index edcafb7e..0c261c00 100644 --- a/res/lang/uk.bin +++ b/res/lang/uk.bin | |||
Binary files differ | |||
diff --git a/res/lang/zh_Hans.bin b/res/lang/zh_Hans.bin index 488cc64f..d31b280b 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 edab200b..e06f4339 100644 --- a/res/lang/zh_Hant.bin +++ b/res/lang/zh_Hant.bin | |||
Binary files differ | |||
@@ -3142,6 +3142,7 @@ iBool handleCommand_App(const char *cmd) { | |||
3142 | d->certs, | 3142 | d->certs, |
3143 | findIdentity_GmCerts(d->certs, collect_Block(hexDecode_Rangecc(range_Command(cmd, "ident")))), | 3143 | findIdentity_GmCerts(d->certs, collect_Block(hexDecode_Rangecc(range_Command(cmd, "ident")))), |
3144 | url); | 3144 | url); |
3145 | postCommand_App("navigate.reload"); | ||
3145 | postCommand_App("idents.changed"); | 3146 | postCommand_App("idents.changed"); |
3146 | return iTrue; | 3147 | return iTrue; |
3147 | } | 3148 | } |
@@ -3154,6 +3155,7 @@ iBool handleCommand_App(const char *cmd) { | |||
3154 | else { | 3155 | else { |
3155 | setUse_GmIdentity(ident, collect_String(suffix_Command(cmd, "url")), iFalse); | 3156 | setUse_GmIdentity(ident, collect_String(suffix_Command(cmd, "url")), iFalse); |
3156 | } | 3157 | } |
3158 | postCommand_App("navigate.reload"); | ||
3157 | postCommand_App("idents.changed"); | 3159 | postCommand_App("idents.changed"); |
3158 | return iTrue; | 3160 | return iTrue; |
3159 | } | 3161 | } |
@@ -3164,7 +3166,7 @@ iBool handleCommand_App(const char *cmd) { | |||
3164 | const iGmIdentity *cur = identityForUrl_GmCerts(d->certs, docUrl); | 3166 | const iGmIdentity *cur = identityForUrl_GmCerts(d->certs, docUrl); |
3165 | iGmIdentity *dst = findIdentity_GmCerts( | 3167 | iGmIdentity *dst = findIdentity_GmCerts( |
3166 | d->certs, collect_Block(hexDecode_Rangecc(range_Command(cmd, "fp")))); | 3168 | d->certs, collect_Block(hexDecode_Rangecc(range_Command(cmd, "fp")))); |
3167 | if (cur && dst && cur != dst) { | 3169 | if (dst && cur != dst) { |
3168 | iString *useUrl = copy_String(findUse_GmIdentity(cur, docUrl)); | 3170 | iString *useUrl = copy_String(findUse_GmIdentity(cur, docUrl)); |
3169 | if (isEmpty_String(useUrl)) { | 3171 | if (isEmpty_String(useUrl)) { |
3170 | useUrl = copy_String(docUrl); | 3172 | useUrl = copy_String(docUrl); |
diff --git a/src/gmcerts.c b/src/gmcerts.c index 345c36e0..ed4759be 100644 --- a/src/gmcerts.c +++ b/src/gmcerts.c | |||
@@ -146,6 +146,7 @@ iBool isUsed_GmIdentity(const iGmIdentity *d) { | |||
146 | } | 146 | } |
147 | 147 | ||
148 | iBool isUsedOn_GmIdentity(const iGmIdentity *d, const iString *url) { | 148 | iBool isUsedOn_GmIdentity(const iGmIdentity *d, const iString *url) { |
149 | #if 0 | ||
149 | size_t pos = iInvalidPos; | 150 | size_t pos = iInvalidPos; |
150 | locate_StringSet(d->useUrls, url, &pos); | 151 | locate_StringSet(d->useUrls, url, &pos); |
151 | if (pos < size_StringSet(d->useUrls)) { | 152 | if (pos < size_StringSet(d->useUrls)) { |
@@ -159,6 +160,12 @@ iBool isUsedOn_GmIdentity(const iGmIdentity *d, const iString *url) { | |||
159 | return iTrue; | 160 | return iTrue; |
160 | } | 161 | } |
161 | } | 162 | } |
163 | #endif | ||
164 | iConstForEach(StringSet, i, d->useUrls) { | ||
165 | if (startsWithCase_String(url, cstr_String(i.value))) { | ||
166 | return iTrue; | ||
167 | } | ||
168 | } | ||
162 | return iFalse; | 169 | return iFalse; |
163 | } | 170 | } |
164 | 171 | ||
@@ -193,7 +200,13 @@ void setUse_GmIdentity(iGmIdentity *d, const iString *url, iBool use) { | |||
193 | iAssert(wasInserted); | 200 | iAssert(wasInserted); |
194 | } | 201 | } |
195 | else { | 202 | else { |
196 | remove_StringSet(d->useUrls, url); | 203 | iForEach(Array, i, &d->useUrls->strings.values) { |
204 | iString *used = i.value; | ||
205 | if (startsWithCase_String(url, cstr_String(used))) { | ||
206 | deinit_String(used); | ||
207 | remove_ArrayIterator(&i); | ||
208 | } | ||
209 | } | ||
197 | } | 210 | } |
198 | } | 211 | } |
199 | 212 | ||
@@ -202,6 +215,7 @@ void clearUse_GmIdentity(iGmIdentity *d) { | |||
202 | } | 215 | } |
203 | 216 | ||
204 | const iString *findUse_GmIdentity(const iGmIdentity *d, const iString *url) { | 217 | const iString *findUse_GmIdentity(const iGmIdentity *d, const iString *url) { |
218 | if (!d) return NULL; | ||
205 | iConstForEach(StringSet, using, d->useUrls) { | 219 | iConstForEach(StringSet, using, d->useUrls) { |
206 | if (startsWith_String(url, cstr_String(using.value))) { | 220 | if (startsWith_String(url, cstr_String(using.value))) { |
207 | return using.value; | 221 | return using.value; |
diff --git a/src/ui/certlistwidget.c b/src/ui/certlistwidget.c index c67203e3..7c140c19 100644 --- a/src/ui/certlistwidget.c +++ b/src/ui/certlistwidget.c | |||
@@ -113,7 +113,7 @@ static void updateContextMenu_CertListWidget_(iCertListWidget *d) { | |||
113 | iBool usedOnCurrentPage = iFalse; | 113 | iBool usedOnCurrentPage = iFalse; |
114 | iConstForEach(StringSet, i, ident->useUrls) { | 114 | iConstForEach(StringSet, i, ident->useUrls) { |
115 | const iString *url = i.value; | 115 | const iString *url = i.value; |
116 | usedOnCurrentPage |= equalCase_String(docUrl, url); | 116 | usedOnCurrentPage |= startsWithCase_String(docUrl, cstr_String(url)); |
117 | iRangecc urlStr = range_String(url); | 117 | iRangecc urlStr = range_String(url); |
118 | if (startsWith_Rangecc(urlStr, "gemini://")) { | 118 | if (startsWith_Rangecc(urlStr, "gemini://")) { |
119 | urlStr.start += 9; /* omit the default scheme */ | 119 | urlStr.start += 9; /* omit the default scheme */ |
@@ -128,6 +128,9 @@ static void updateContextMenu_CertListWidget_(iCertListWidget *d) { | |||
128 | if (!usedOnCurrentPage) { | 128 | if (!usedOnCurrentPage) { |
129 | remove_Array(items, 1); | 129 | remove_Array(items, 1); |
130 | } | 130 | } |
131 | else { | ||
132 | remove_Array(items, 0); | ||
133 | } | ||
131 | } | 134 | } |
132 | destroy_Widget(d->menu); | 135 | destroy_Widget(d->menu); |
133 | d->menu = makeMenu_Widget(as_Widget(d), data_Array(items), size_Array(items)); | 136 | d->menu = makeMenu_Widget(as_Widget(d), data_Array(items), size_Array(items)); |
@@ -166,8 +169,8 @@ static iBool processEvent_CertListWidget_(iCertListWidget *d, const SDL_Event *e | |||
166 | return iTrue; | 169 | return iTrue; |
167 | } | 170 | } |
168 | else if (isCommand_Widget(w, ev, "ident.use")) { | 171 | else if (isCommand_Widget(w, ev, "ident.use")) { |
169 | iGmIdentity * ident = menuIdentity_CertListWidget_(d); | 172 | iGmIdentity *ident = menuIdentity_CertListWidget_(d); |
170 | const iString *tabUrl = url_DocumentWidget(document_App()); | 173 | const iString *tabUrl = urlQueryStripped_String(url_DocumentWidget(document_App())); |
171 | if (ident) { | 174 | if (ident) { |
172 | if (argLabel_Command(cmd, "clear")) { | 175 | if (argLabel_Command(cmd, "clear")) { |
173 | clearUse_GmIdentity(ident); | 176 | clearUse_GmIdentity(ident); |
@@ -388,7 +391,6 @@ void init_CertListWidget(iCertListWidget *d) { | |||
388 | init_ListWidget(&d->list); | 391 | init_ListWidget(&d->list); |
389 | setId_Widget(w, "certlist"); | 392 | setId_Widget(w, "certlist"); |
390 | setBackgroundColor_Widget(w, none_ColorId); | 393 | setBackgroundColor_Widget(w, none_ColorId); |
391 | setItemHeight_ListWidget(&d->list, 3.5f * lineHeight_Text(default_FontId)); | ||
392 | d->itemFonts[0] = uiContent_FontId; | 394 | d->itemFonts[0] = uiContent_FontId; |
393 | d->itemFonts[1] = uiContentBold_FontId; | 395 | d->itemFonts[1] = uiContentBold_FontId; |
394 | #if defined (iPlatformMobile) | 396 | #if defined (iPlatformMobile) |
@@ -397,6 +399,7 @@ void init_CertListWidget(iCertListWidget *d) { | |||
397 | d->itemFonts[1] = uiLabelBigBold_FontId; | 399 | d->itemFonts[1] = uiLabelBigBold_FontId; |
398 | } | 400 | } |
399 | #endif | 401 | #endif |
402 | updateItemHeight_CertListWidget(d); | ||
400 | d->menu = NULL; | 403 | d->menu = NULL; |
401 | d->contextItem = NULL; | 404 | d->contextItem = NULL; |
402 | d->contextIndex = iInvalidPos; | 405 | d->contextIndex = iInvalidPos; |
@@ -443,7 +446,7 @@ iBool updateItems_CertListWidget(iCertListWidget *d) { | |||
443 | cstr_String(&ident->notes)); | 446 | cstr_String(&ident->notes)); |
444 | } | 447 | } |
445 | item->listItem.isSelected = isActive; | 448 | item->listItem.isSelected = isActive; |
446 | if (isUsedOnDomain_GmIdentity(ident, tabHost)) { | 449 | if (!isActive && isUsedOnDomain_GmIdentity(ident, tabHost)) { |
447 | item->indent = 1; /* will be highlighted */ | 450 | item->indent = 1; /* will be highlighted */ |
448 | } | 451 | } |
449 | addItem_ListWidget(&d->list, item); | 452 | addItem_ListWidget(&d->list, item); |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 3fb8498b..95286566 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1289,8 +1289,13 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode | |||
1289 | if (category_GmStatusCode(code) == categoryClientCertificate_GmStatus) { | 1289 | if (category_GmStatusCode(code) == categoryClientCertificate_GmStatus) { |
1290 | makeFooterButtons_DocumentWidget_( | 1290 | makeFooterButtons_DocumentWidget_( |
1291 | d, | 1291 | d, |
1292 | (iMenuItem[]){ { leftHalf_Icon " ${menu.show.identities}", '4', KMOD_PRIMARY, "sidebar.mode arg:3 show:1" }, | 1292 | (iMenuItem[]){ |
1293 | { person_Icon " ${menu.identity.new}", newIdentity_KeyShortcut, "ident.new" } }, | 1293 | { leftHalf_Icon " ${menu.show.identities}", |
1294 | '4', | ||
1295 | KMOD_PRIMARY, | ||
1296 | deviceType_App() == desktop_AppDeviceType ? "sidebar.mode arg:3 show:1" | ||
1297 | : "preferences idents:1" }, | ||
1298 | { person_Icon " ${menu.identity.new}", newIdentity_KeyShortcut, "ident.new" } }, | ||
1294 | 2); | 1299 | 2); |
1295 | } | 1300 | } |
1296 | /* Make a new document for the error page.*/ | 1301 | /* Make a new document for the error page.*/ |
diff --git a/src/ui/root.c b/src/ui/root.c index 5df4b36f..f722df94 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -344,41 +344,47 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { | |||
344 | if (ident) { | 344 | if (ident) { |
345 | str = copy_String(name_GmIdentity(ident)); | 345 | str = copy_String(name_GmIdentity(ident)); |
346 | if (!isEmpty_String(&ident->notes)) { | 346 | if (!isEmpty_String(&ident->notes)) { |
347 | appendFormat_String(str, "\n%s%s", escape_Color(uiAnnotation_ColorId), | 347 | appendFormat_String(str, "\n\x1b[0m" uiHeading_ColorEscape "%s", cstr_String(&ident->notes)); |
348 | cstr_String(&ident->notes)); | ||
349 | } | 348 | } |
350 | } | 349 | } |
351 | pushBackN_Array( | 350 | pushBack_Array( |
352 | &items, | 351 | &items, |
353 | (iMenuItem[]){ { format_CStr("///" uiHeading_ColorEscape "%s", | 352 | &(iMenuItem){ format_CStr("```" uiHeading_ColorEscape "\x1b[1m%s", |
354 | str ? cstr_String(str) : "${menu.identity.notactive}") }, | 353 | str ? cstr_String(str) : "${menu.identity.notactive}") }); |
355 | { "---" } }, | 354 | if (ident && isUsedOn_GmIdentity(ident, docUrl)) { |
356 | 2); | 355 | pushBack_Array(&items, |
356 | &(iMenuItem){ close_Icon " ${ident.stopuse}", | ||
357 | 0, | ||
358 | 0, | ||
359 | format_CStr("ident.signout ident:%s url:%s", | ||
360 | cstr_String(fp), | ||
361 | cstr_String(docUrl)) }); | ||
362 | } | ||
363 | pushBack_Array(&items, &(iMenuItem){ "---" }); | ||
357 | delete_String(str); | 364 | delete_String(str); |
358 | /* Alternate identities. */ | 365 | /* Alternate identities. */ |
359 | if (ident) { | 366 | const iString *site = collectNewRange_String(urlRoot_String(docUrl)); |
360 | const iString *site = collectNewRange_String(urlRoot_String(docUrl)); | 367 | iBool haveAlts = iFalse; |
361 | iBool haveAlts = iFalse; | 368 | iConstForEach(StringArray, i, strings_SiteSpec(site, usedIdentities_SiteSpecKey)) { |
362 | iConstForEach(StringArray, i, strings_SiteSpec(site, usedIdentities_SiteSpecKey)) { | 369 | if (!fp || !equal_String(i.value, fp)) { |
363 | if (!equal_String(i.value, fp)) { | 370 | const iBlock *otherFp = collect_Block(hexDecode_Rangecc(range_String(i.value))); |
364 | const iBlock *otherFp = collect_Block(hexDecode_Rangecc(range_String(i.value))); | 371 | const iGmIdentity *other = findIdentity_GmCerts(certs_App(), otherFp); |
365 | const iGmIdentity *other = findIdentity_GmCerts(certs_App(), otherFp); | 372 | if (other && other != ident) { |
366 | if (other) { | 373 | pushBack_Array( |
367 | pushBack_Array( | 374 | &items, |
368 | &items, | 375 | &(iMenuItem){ |
369 | &(iMenuItem){ | 376 | format_CStr(translateCStr_Lang("\U0001f816 ${ident.switch}"), |
370 | format_CStr(translateCStr_Lang("\U0001f816 ${ident.switch}"), | 377 | format_CStr("\x1b[1m%s", |
371 | cstr_String(name_GmIdentity(other))), | 378 | cstr_String(name_GmIdentity(other)))), |
372 | 0, | 379 | 0, |
373 | 0, | 380 | 0, |
374 | format_CStr("ident.switch fp:%s", cstr_String(i.value)) }); | 381 | format_CStr("ident.switch fp:%s", cstr_String(i.value)) }); |
375 | haveAlts = iTrue; | 382 | haveAlts = iTrue; |
376 | } | ||
377 | } | 383 | } |
378 | } | 384 | } |
379 | if (haveAlts) { | 385 | } |
380 | pushBack_Array(&items, &(iMenuItem){ "---" }); | 386 | if (haveAlts) { |
381 | } | 387 | pushBack_Array(&items, &(iMenuItem){ "---" }); |
382 | } | 388 | } |
383 | iSidebarWidget *sidebar = findWidget_App("sidebar"); | 389 | iSidebarWidget *sidebar = findWidget_App("sidebar"); |
384 | pushBackN_Array( | 390 | pushBackN_Array( |
@@ -388,14 +394,14 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { | |||
388 | { "${menu.identity.import}", SDLK_i, KMOD_PRIMARY | KMOD_SHIFT, "ident.import" }, | 394 | { "${menu.identity.import}", SDLK_i, KMOD_PRIMARY | KMOD_SHIFT, "ident.import" }, |
389 | { "---" } }, 3); | 395 | { "---" } }, 3); |
390 | if (deviceType_App() == desktop_AppDeviceType) { | 396 | if (deviceType_App() == desktop_AppDeviceType) { |
391 | pushBack_Array(&items, &(iMenuItem) | 397 | pushBack_Array(&items, |
392 | { isVisible_Widget(sidebar) && mode_SidebarWidget(sidebar) == identities_SidebarMode | 398 | &(iMenuItem){ isVisible_Widget(sidebar) && mode_SidebarWidget(sidebar) == |
393 | ? leftHalf_Icon " ${menu.hide.identities}" | 399 | identities_SidebarMode |
394 | : leftHalf_Icon " ${menu.show.identities}", | 400 | ? leftHalf_Icon " ${menu.hide.identities}" |
395 | 0, | 401 | : leftHalf_Icon " ${menu.show.identities}", |
396 | 0, | 402 | 0, |
397 | //deviceType_App() == phone_AppDeviceType ? "toolbar.showident" | 403 | 0, |
398 | "sidebar.mode arg:3 toggle:1" }); | 404 | "sidebar.mode arg:3 toggle:1" }); |
399 | } | 405 | } |
400 | else { | 406 | else { |
401 | pushBack_Array(&items, &(iMenuItem){ gear_Icon " ${menu.identities}", 0, 0, | 407 | pushBack_Array(&items, &(iMenuItem){ gear_Icon " ${menu.identities}", 0, 0, |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 9b94f4d9..13fc33b1 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -591,6 +591,9 @@ iBool setMode_SidebarWidget(iSidebarWidget *d, enum iSidebarMode mode) { | |||
591 | if (d->mode == mode) { | 591 | if (d->mode == mode) { |
592 | return iFalse; | 592 | return iFalse; |
593 | } | 593 | } |
594 | if (mode == identities_SidebarMode && deviceType_App() != desktop_AppDeviceType) { | ||
595 | return iFalse; /* Identities are in Settings. */ | ||
596 | } | ||
594 | if (d->mode >= 0 && d->mode < max_SidebarMode) { | 597 | if (d->mode >= 0 && d->mode < max_SidebarMode) { |
595 | d->modeScroll[d->mode] = scrollPos_ListWidget(list_SidebarWidget_(d)); /* saved for later */ | 598 | d->modeScroll[d->mode] = scrollPos_ListWidget(list_SidebarWidget_(d)); /* saved for later */ |
596 | } | 599 | } |
@@ -705,33 +708,34 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) { | |||
705 | d->certList = NULL; | 708 | d->certList = NULL; |
706 | d->actions = NULL; | 709 | d->actions = NULL; |
707 | d->closedFolders = new_IntSet(); | 710 | d->closedFolders = new_IntSet(); |
708 | /* On a phone, the right sidebar is used exclusively for Identities. */ | 711 | /* On a phone, the right sidebar is not used. */ |
709 | const iBool isPhone = deviceType_App() == phone_AppDeviceType; | 712 | const iBool isPhone = deviceType_App() == phone_AppDeviceType; |
710 | if (!isPhone || d->side == left_SidebarSide) { | 713 | //if (!isPhone || d->side == left_SidebarSide) { |
711 | iWidget *buttons = new_Widget(); | 714 | iWidget *buttons = new_Widget(); |
712 | setId_Widget(buttons, "buttons"); | 715 | setId_Widget(buttons, "buttons"); |
713 | setDrawBufferEnabled_Widget(buttons, iTrue); | 716 | setDrawBufferEnabled_Widget(buttons, iTrue); |
714 | for (int i = 0; i < max_SidebarMode; i++) { | 717 | for (int i = 0; i < max_SidebarMode; i++) { |
715 | if (i == identities_SidebarMode && deviceType_App() != desktop_AppDeviceType) { | 718 | if (i == identities_SidebarMode && deviceType_App() != desktop_AppDeviceType) { |
716 | /* On mobile, identities are managed via Settings. */ | 719 | /* On mobile, identities are managed via Settings. */ |
717 | continue; | 720 | continue; |
718 | } | 721 | } |
719 | d->modeButtons[i] = addChildFlags_Widget( | 722 | d->modeButtons[i] = addChildFlags_Widget( |
720 | buttons, | 723 | buttons, |
721 | iClob(new_LabelWidget( | 724 | iClob(new_LabelWidget( |
722 | tightModeLabels_[i], | 725 | tightModeLabels_[i], |
723 | format_CStr("%s.mode arg:%d", cstr_String(id_Widget(w)), i))), | 726 | format_CStr("%s.mode arg:%d", cstr_String(id_Widget(w)), i))), |
724 | frameless_WidgetFlag | noBackground_WidgetFlag); | 727 | frameless_WidgetFlag | noBackground_WidgetFlag); |
725 | } | ||
726 | setButtonFont_SidebarWidget(d, isPhone ? uiLabelBig_FontId : uiLabel_FontId); | ||
727 | addChildFlags_Widget(vdiv, | ||
728 | iClob(buttons), | ||
729 | arrangeHorizontal_WidgetFlag | | ||
730 | resizeWidthOfChildren_WidgetFlag | | ||
731 | arrangeHeight_WidgetFlag | resizeToParentWidth_WidgetFlag); // | | ||
732 | // drawBackgroundToHorizontalSafeArea_WidgetFlag); | ||
733 | setBackgroundColor_Widget(buttons, uiBackgroundSidebar_ColorId); | ||
734 | } | 728 | } |
729 | setButtonFont_SidebarWidget(d, isPhone ? uiLabelBig_FontId : uiLabel_FontId); | ||
730 | addChildFlags_Widget(vdiv, | ||
731 | iClob(buttons), | ||
732 | arrangeHorizontal_WidgetFlag | | ||
733 | resizeWidthOfChildren_WidgetFlag | | ||
734 | arrangeHeight_WidgetFlag | resizeToParentWidth_WidgetFlag); // | | ||
735 | // drawBackgroundToHorizontalSafeArea_WidgetFlag); | ||
736 | setBackgroundColor_Widget(buttons, uiBackgroundSidebar_ColorId); | ||
737 | // } | ||
738 | #if 0 | ||
735 | else { | 739 | else { |
736 | iLabelWidget *heading = new_LabelWidget(person_Icon " ${sidebar.identities}", NULL); | 740 | iLabelWidget *heading = new_LabelWidget(person_Icon " ${sidebar.identities}", NULL); |
737 | checkIcon_LabelWidget(heading); | 741 | checkIcon_LabelWidget(heading); |
@@ -742,6 +746,7 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) { | |||
742 | drawBackgroundToHorizontalSafeArea_WidgetFlag), | 746 | drawBackgroundToHorizontalSafeArea_WidgetFlag), |
743 | uiLabelLargeBold_FontId); | 747 | uiLabelLargeBold_FontId); |
744 | } | 748 | } |
749 | #endif | ||
745 | iWidget *content = new_Widget(); | 750 | iWidget *content = new_Widget(); |
746 | setFlags_Widget(content, resizeChildren_WidgetFlag, iTrue); | 751 | setFlags_Widget(content, resizeChildren_WidgetFlag, iTrue); |
747 | iWidget *listAndActions = makeVDiv_Widget(); | 752 | iWidget *listAndActions = makeVDiv_Widget(); |
@@ -771,8 +776,8 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) { | |||
771 | addChildFlags_Widget(content, iClob(d->blank), resizeChildren_WidgetFlag); | 776 | addChildFlags_Widget(content, iClob(d->blank), resizeChildren_WidgetFlag); |
772 | addChildFlags_Widget(vdiv, iClob(content), expand_WidgetFlag); | 777 | addChildFlags_Widget(vdiv, iClob(content), expand_WidgetFlag); |
773 | setMode_SidebarWidget(d, | 778 | setMode_SidebarWidget(d, |
774 | deviceType_App() == phone_AppDeviceType && d->side == right_SidebarSide ? | 779 | /*deviceType_App() == phone_AppDeviceType && d->side == right_SidebarSide ? |
775 | identities_SidebarMode : bookmarks_SidebarMode); | 780 | identities_SidebarMode :*/ bookmarks_SidebarMode); |
776 | d->resizer = | 781 | d->resizer = |
777 | addChildFlags_Widget(w, | 782 | addChildFlags_Widget(w, |
778 | iClob(new_Widget()), | 783 | iClob(new_Widget()), |