diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-02-15 17:49:17 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-02-15 17:49:17 +0200 |
commit | 64eaaaac57fc909a9c9d47302f17f0801b7f2965 (patch) | |
tree | dab57405c80dcf6de974effc91737e89ebf23019 /src/ui | |
parent | d19691de189227ef1976cb8104cdc55830fdb347 (diff) |
Working on site-specific settings dialog
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 12 | ||||
-rw-r--r-- | src/ui/util.c | 43 | ||||
-rw-r--r-- | src/ui/util.h | 15 |
3 files changed, 50 insertions, 20 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 293e4507..7d9ac154 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -3936,12 +3936,12 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
3936 | const char *unchecked = red_ColorEscape "\u2610"; | 3936 | const char *unchecked = red_ColorEscape "\u2610"; |
3937 | const char *checked = green_ColorEscape "\u2611"; | 3937 | const char *checked = green_ColorEscape "\u2611"; |
3938 | const iBool haveFingerprint = (d->certFlags & haveFingerprint_GmCertFlag) != 0; | 3938 | const iBool haveFingerprint = (d->certFlags & haveFingerprint_GmCertFlag) != 0; |
3939 | const int requiredForTrust = (available_GmCertFlag | haveFingerprint_GmCertFlag | | 3939 | const int requiredForTrust = |
3940 | timeVerified_GmCertFlag); | 3940 | (available_GmCertFlag | haveFingerprint_GmCertFlag | timeVerified_GmCertFlag); |
3941 | const iBool canTrust = ~d->certFlags & trusted_GmCertFlag && | 3941 | const iBool canTrust = ~d->certFlags & trusted_GmCertFlag && |
3942 | ((d->certFlags & requiredForTrust) == requiredForTrust); | 3942 | ((d->certFlags & requiredForTrust) == requiredForTrust); |
3943 | const iRecentUrl *recent = constMostRecentUrl_History(d->mod.history); | 3943 | const iRecentUrl *recent = constMostRecentUrl_History(d->mod.history); |
3944 | const iString *meta = &d->sourceMime; | 3944 | const iString *meta = &d->sourceMime; |
3945 | if (recent && recent->cachedResponse) { | 3945 | if (recent && recent->cachedResponse) { |
3946 | meta = &recent->cachedResponse->meta; | 3946 | meta = &recent->cachedResponse->meta; |
3947 | } | 3947 | } |
@@ -4006,6 +4006,10 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
4006 | if (haveFingerprint) { | 4006 | if (haveFingerprint) { |
4007 | pushBack_Array(items, &(iMenuItem){ "${dlg.cert.fingerprint}", 0, 0, "server.copycert" }); | 4007 | pushBack_Array(items, &(iMenuItem){ "${dlg.cert.fingerprint}", 0, 0, "server.copycert" }); |
4008 | } | 4008 | } |
4009 | const iRangecc root = urlRoot_String(d->mod.url); | ||
4010 | if (!isEmpty_Range(&root)) { | ||
4011 | pushBack_Array(items, &(iMenuItem){ "${pageinfo.settings}", 0, 0, "document.sitespec" }); | ||
4012 | } | ||
4009 | if (!isEmpty_Array(items)) { | 4013 | if (!isEmpty_Array(items)) { |
4010 | pushBack_Array(items, &(iMenuItem){ "---", 0, 0, 0 }); | 4014 | pushBack_Array(items, &(iMenuItem){ "---", 0, 0, 0 }); |
4011 | } | 4015 | } |
@@ -4937,7 +4941,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
4937 | for (size_t i = 0; i < 64; ++i) { | 4941 | for (size_t i = 0; i < 64; ++i) { |
4938 | setByte_Block(seed, i, iRandom(0, 256)); | 4942 | setByte_Block(seed, i, iRandom(0, 256)); |
4939 | } | 4943 | } |
4940 | setThemeSeed_GmDocument(view->doc, seed); | 4944 | setThemeSeed_GmDocument(view->doc, seed, NULL); |
4941 | delete_Block(seed); | 4945 | delete_Block(seed); |
4942 | invalidate_DocumentWidget_(d); | 4946 | invalidate_DocumentWidget_(d); |
4943 | refresh_Widget(w); | 4947 | refresh_Widget(w); |
diff --git a/src/ui/util.c b/src/ui/util.c index befc2fd5..54715121 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -3169,15 +3169,14 @@ static iBool handleFeedSettingCommands_(iWidget *dlg, const char *cmd) { | |||
3169 | } | 3169 | } |
3170 | 3170 | ||
3171 | iWidget *makeFeedSettings_Widget(uint32_t bookmarkId) { | 3171 | iWidget *makeFeedSettings_Widget(uint32_t bookmarkId) { |
3172 | const char *headingText = bookmarkId ? uiHeading_ColorEscape "${heading.feedcfg}" | 3172 | iWidget *dlg; |
3173 | : uiHeading_ColorEscape "${heading.subscribe}"; | 3173 | const char *headingText = bookmarkId ? "${heading.feedcfg}" : "${heading.subscribe}"; |
3174 | const iMenuItem actions[] = { { "${cancel}" }, | 3174 | const iMenuItem actions[] = { { "${cancel}" }, |
3175 | { bookmarkId ? uiTextCaution_ColorEscape "${dlg.feed.save}" | 3175 | { bookmarkId ? uiTextCaution_ColorEscape "${dlg.feed.save}" |
3176 | : uiTextCaution_ColorEscape "${dlg.feed.sub}", | 3176 | : uiTextCaution_ColorEscape "${dlg.feed.sub}", |
3177 | SDLK_RETURN, | 3177 | SDLK_RETURN, |
3178 | KMOD_PRIMARY, | 3178 | KMOD_PRIMARY, |
3179 | format_CStr("feedcfg.accept bmid:%d", bookmarkId) } }; | 3179 | format_CStr("feedcfg.accept bmid:%d", bookmarkId) } }; |
3180 | iWidget *dlg; | ||
3181 | if (isUsingPanelLayout_Mobile()) { | 3180 | if (isUsingPanelLayout_Mobile()) { |
3182 | const iMenuItem typeItems[] = { | 3181 | const iMenuItem typeItems[] = { |
3183 | { "button id:feedcfg.type.gemini label:dlg.feed.type.gemini", 0, 0, "feedcfg.type arg:0" }, | 3182 | { "button id:feedcfg.type.gemini label:dlg.feed.type.gemini", 0, 0, "feedcfg.type arg:0" }, |
@@ -3234,6 +3233,32 @@ iWidget *makeFeedSettings_Widget(uint32_t bookmarkId) { | |||
3234 | return dlg; | 3233 | return dlg; |
3235 | } | 3234 | } |
3236 | 3235 | ||
3236 | iWidget *makeSiteSpecificSettings_Widget(const iString *url) { | ||
3237 | iWidget *dlg; | ||
3238 | const iMenuItem actions[] = { | ||
3239 | { "${cancel}" }, { "${sitespec.accept}", SDLK_RETURN, KMOD_PRIMARY, "sitespec.accept" } | ||
3240 | }; | ||
3241 | if (isUsingPanelLayout_Mobile()) { | ||
3242 | iAssert(iFalse); | ||
3243 | } | ||
3244 | else { | ||
3245 | iWidget *headings, *values; | ||
3246 | dlg = makeSheet_Widget("sitespec"); | ||
3247 | addDialogTitle_(dlg, "${heading.sitespec}", "heading.sitespec"); | ||
3248 | addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values))); | ||
3249 | addDialogToggle_(headings, values, "${sitespec.ansi}", "sitespec.ansi"); | ||
3250 | iInputWidget *palInput = new_InputWidget(0); | ||
3251 | addPrefsInputWithHeading_(headings, values, "sitespec.palette", iClob(palInput)); | ||
3252 | as_Widget(palInput)->rect.size.x = 80 * gap_UI; | ||
3253 | addChild_Widget(dlg, iClob(makeDialogButtons_Widget(actions, iElemCount(actions)))); | ||
3254 | } | ||
3255 | /* Initialize. */ { | ||
3256 | const iRangecc root = urlRoot_String(url); | ||
3257 | |||
3258 | } | ||
3259 | return dlg; | ||
3260 | } | ||
3261 | |||
3237 | iWidget *makeIdentityCreation_Widget(void) { | 3262 | iWidget *makeIdentityCreation_Widget(void) { |
3238 | const iMenuItem actions[] = { { "${dlg.newident.more}", 0, 0, "ident.showmore" }, | 3263 | const iMenuItem actions[] = { { "${dlg.newident.more}", 0, 0, "ident.showmore" }, |
3239 | { "---" }, | 3264 | { "---" }, |
diff --git a/src/ui/util.h b/src/ui/util.h index 0289d579..31c8cedc 100644 --- a/src/ui/util.h +++ b/src/ui/util.h | |||
@@ -336,13 +336,14 @@ iWidget * makeQuestion_Widget (const char *title, const char *msg, | |||
336 | iWidget * makePreferences_Widget (void); | 336 | iWidget * makePreferences_Widget (void); |
337 | void updatePreferencesLayout_Widget (iWidget *prefs); | 337 | void updatePreferencesLayout_Widget (iWidget *prefs); |
338 | 338 | ||
339 | iWidget * makeBookmarkEditor_Widget (void); | 339 | iWidget * makeBookmarkEditor_Widget (void); |
340 | void setBookmarkEditorFolder_Widget(iWidget *editor, uint32_t folderId); | 340 | void setBookmarkEditorFolder_Widget (iWidget *editor, uint32_t folderId); |
341 | iWidget * makeBookmarkCreation_Widget (const iString *url, const iString *title, iChar icon); | 341 | iWidget * makeBookmarkCreation_Widget (const iString *url, const iString *title, iChar icon); |
342 | iWidget * makeIdentityCreation_Widget (void); | 342 | iWidget * makeIdentityCreation_Widget (void); |
343 | iWidget * makeFeedSettings_Widget (uint32_t bookmarkId); | 343 | iWidget * makeFeedSettings_Widget (uint32_t bookmarkId); |
344 | iWidget * makeTranslation_Widget (iWidget *parent); | 344 | iWidget * makeSiteSpecificSettings_Widget (const iString *url); |
345 | iWidget * makeGlyphFinder_Widget (void); | 345 | iWidget * makeTranslation_Widget (iWidget *parent); |
346 | iWidget * makeGlyphFinder_Widget (void); | ||
346 | 347 | ||
347 | const char * languageId_String (const iString *menuItemLabel); | 348 | const char * languageId_String (const iString *menuItemLabel); |
348 | int languageIndex_CStr (const char *langId); | 349 | int languageIndex_CStr (const char *langId); |