diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/certimportwidget.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/ui/certimportwidget.c b/src/ui/certimportwidget.c index d47851f5..43e8ff97 100644 --- a/src/ui/certimportwidget.c +++ b/src/ui/certimportwidget.c | |||
@@ -47,8 +47,7 @@ struct Impl_CertImportWidget { | |||
47 | iTlsCertificate *cert; | 47 | iTlsCertificate *cert; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static const char *infoText_ = "Paste a PEM-encoded certificate and/or private key,\n" | 50 | static const char *infoText_ = "${dlg.certimport.help}"; |
51 | "or drop a .crt/.key file on the window."; | ||
52 | 51 | ||
53 | static iBool tryImport_CertImportWidget_(iCertImportWidget *d, const iBlock *data) { | 52 | static iBool tryImport_CertImportWidget_(iCertImportWidget *d, const iBlock *data) { |
54 | iBool ok = iFalse; | 53 | iBool ok = iFalse; |
@@ -84,7 +83,7 @@ static iBool tryImport_CertImportWidget_(iCertImportWidget *d, const iBlock *dat | |||
84 | setFrameColor_Widget(as_Widget(d->crtLabel), uiTextAction_ColorId); | 83 | setFrameColor_Widget(as_Widget(d->crtLabel), uiTextAction_ColorId); |
85 | } | 84 | } |
86 | else { | 85 | else { |
87 | setTextCStr_LabelWidget(d->crtLabel, uiTextCaution_ColorEscape "No Certificate"); | 86 | setTextCStr_LabelWidget(d->crtLabel, uiTextCaution_ColorEscape "${dlg.certimport.nocert}"); |
88 | setFrameColor_Widget(as_Widget(d->crtLabel), uiTextCaution_ColorId); | 87 | setFrameColor_Widget(as_Widget(d->crtLabel), uiTextCaution_ColorId); |
89 | } | 88 | } |
90 | if (d->cert && hasPrivateKey_TlsCertificate(d->cert)) { | 89 | if (d->cert && hasPrivateKey_TlsCertificate(d->cert)) { |
@@ -96,7 +95,7 @@ static iBool tryImport_CertImportWidget_(iCertImportWidget *d, const iBlock *dat | |||
96 | setFrameColor_Widget(as_Widget(d->keyLabel), uiTextAction_ColorId); | 95 | setFrameColor_Widget(as_Widget(d->keyLabel), uiTextAction_ColorId); |
97 | } | 96 | } |
98 | else { | 97 | else { |
99 | setTextCStr_LabelWidget(d->keyLabel, uiTextCaution_ColorEscape "No Private Key"); | 98 | setTextCStr_LabelWidget(d->keyLabel, uiTextCaution_ColorEscape "${dlg.certimport.nokey}"); |
100 | setFrameColor_Widget(as_Widget(d->keyLabel), uiTextCaution_ColorId); | 99 | setFrameColor_Widget(as_Widget(d->keyLabel), uiTextCaution_ColorId); |
101 | } | 100 | } |
102 | } | 101 | } |
@@ -118,9 +117,10 @@ void init_CertImportWidget(iCertImportWidget *d) { | |||
118 | overflowScrollable_WidgetFlag, | 117 | overflowScrollable_WidgetFlag, |
119 | iTrue); | 118 | iTrue); |
120 | } | 119 | } |
121 | addChildFlags_Widget(w, | 120 | addChildFlags_Widget( |
122 | iClob(new_LabelWidget(uiHeading_ColorEscape "IMPORT IDENTITY", NULL)), | 121 | w, |
123 | frameless_WidgetFlag); | 122 | iClob(new_LabelWidget(uiHeading_ColorEscape "${heading.certimport}", NULL)), |
123 | frameless_WidgetFlag); | ||
124 | d->info = addChildFlags_Widget(w, iClob(new_LabelWidget(infoText_, NULL)), frameless_WidgetFlag); | 124 | d->info = addChildFlags_Widget(w, iClob(new_LabelWidget(infoText_, NULL)), frameless_WidgetFlag); |
125 | addChild_Widget(w, iClob(makePadding_Widget(gap_UI))); | 125 | addChild_Widget(w, iClob(makePadding_Widget(gap_UI))); |
126 | d->crtLabel = new_LabelWidget("", NULL); { | 126 | d->crtLabel = new_LabelWidget("", NULL); { |
@@ -141,9 +141,9 @@ void init_CertImportWidget(iCertImportWidget *d) { | |||
141 | page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); | 141 | page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); |
142 | iWidget *values = addChildFlags_Widget( | 142 | iWidget *values = addChildFlags_Widget( |
143 | page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); | 143 | page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); |
144 | addChild_Widget(headings, iClob(makeHeading_Widget("Notes:"))); | 144 | addChild_Widget(headings, iClob(makeHeading_Widget("${dlg.certimport.notes}"))); |
145 | addChild_Widget(values, iClob(d->notes = new_InputWidget(0))); | 145 | addChild_Widget(values, iClob(d->notes = new_InputWidget(0))); |
146 | setHint_InputWidget(d->notes, "description"); | 146 | setHint_InputWidget(d->notes, "${hint.certimport.description}"); |
147 | as_Widget(d->notes)->rect.size.x = gap_UI * 70; | 147 | as_Widget(d->notes)->rect.size.x = gap_UI * 70; |
148 | } | 148 | } |
149 | addChild_Widget(w, iClob(page)); | 149 | addChild_Widget(w, iClob(page)); |
@@ -153,9 +153,11 @@ void init_CertImportWidget(iCertImportWidget *d) { | |||
153 | /* Buttons. */ | 153 | /* Buttons. */ |
154 | addChild_Widget(w, iClob(makePadding_Widget(gap_UI))); | 154 | addChild_Widget(w, iClob(makePadding_Widget(gap_UI))); |
155 | iWidget *buttons = makeDialogButtons_Widget( | 155 | iWidget *buttons = makeDialogButtons_Widget( |
156 | (iMenuItem[]){ | 156 | (iMenuItem[]){ { "${cancel}", 0, 0, NULL }, |
157 | { "${cancel}", 0, 0, NULL }, | 157 | { uiTextAction_ColorEscape "${dlg.certimport.import}", |
158 | { uiTextAction_ColorEscape "Import", SDLK_RETURN, KMOD_PRIMARY, "certimport.accept" } }, | 158 | SDLK_RETURN, |
159 | KMOD_PRIMARY, | ||
160 | "certimport.accept" } }, | ||
159 | 2); | 161 | 2); |
160 | addChild_Widget(w, iClob(buttons)); | 162 | addChild_Widget(w, iClob(buttons)); |
161 | arrange_Widget(w); | 163 | arrange_Widget(w); |
@@ -182,7 +184,7 @@ void setPageContent_CertImportWidget(iCertImportWidget *d, const iBlock *content | |||
182 | } | 184 | } |
183 | else { | 185 | else { |
184 | setTextCStr_LabelWidget( | 186 | setTextCStr_LabelWidget( |
185 | d->info, format_CStr("No certificate/key found on the current page.\n%s", infoText_)); | 187 | d->info, format_CStr("${dlg.certimport.notfound.page}\n%s", infoText_)); |
186 | } | 188 | } |
187 | arrange_Widget(as_Widget(d)); | 189 | arrange_Widget(as_Widget(d)); |
188 | } | 190 | } |
@@ -198,8 +200,8 @@ static iBool processEvent_CertImportWidget_(iCertImportWidget *d, const SDL_Even | |||
198 | const int mods = keyMods_Sym(ev->key.keysym.mod); | 200 | const int mods = keyMods_Sym(ev->key.keysym.mod); |
199 | if (key == SDLK_v && mods == KMOD_PRIMARY) { | 201 | if (key == SDLK_v && mods == KMOD_PRIMARY) { |
200 | if (!tryImportFromClipboard_CertImportWidget_(d)) { | 202 | if (!tryImportFromClipboard_CertImportWidget_(d)) { |
201 | makeMessage_Widget(uiTextCaution_ColorEscape "PASTED FROM CLIPBOARD", | 203 | makeMessage_Widget(uiTextCaution_ColorEscape "${heading.certimport.pasted}", |
202 | "No certificate or private key was found."); | 204 | "${dlg.certimport.notfound}"); |
203 | } | 205 | } |
204 | postRefresh_App(); | 206 | postRefresh_App(); |
205 | return iTrue; | 207 | return iTrue; |
@@ -232,8 +234,8 @@ static iBool processEvent_CertImportWidget_(iCertImportWidget *d, const SDL_Even | |||
232 | } | 234 | } |
233 | } | 235 | } |
234 | else { | 236 | else { |
235 | makeMessage_Widget(uiTextCaution_ColorEscape "DROPPED FILE", | 237 | makeMessage_Widget(uiTextCaution_ColorEscape "${heading.certimport.dropped}", |
236 | "No certificate or private key was found."); | 238 | "${dlg.certimport.notfound}"); |
237 | } | 239 | } |
238 | } | 240 | } |
239 | iRelease(f); | 241 | iRelease(f); |