summaryrefslogtreecommitdiff
path: root/src/ui/uploadwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/uploadwidget.c')
-rw-r--r--src/ui/uploadwidget.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/ui/uploadwidget.c b/src/ui/uploadwidget.c
index 1b26922c..ab1afae9 100644
--- a/src/ui/uploadwidget.c
+++ b/src/ui/uploadwidget.c
@@ -107,9 +107,11 @@ static void updateInputMaxHeight_UploadWidget_(iUploadWidget *d) {
107static const iArray *makeIdentityItems_UploadWidget_(const iUploadWidget *d) { 107static const iArray *makeIdentityItems_UploadWidget_(const iUploadWidget *d) {
108 iArray *items = collectNew_Array(sizeof(iMenuItem)); 108 iArray *items = collectNew_Array(sizeof(iMenuItem));
109 const iGmIdentity *urlId = identityForUrl_GmCerts(certs_App(), &d->url); 109 const iGmIdentity *urlId = identityForUrl_GmCerts(certs_App(), &d->url);
110 pushBack_Array(items, &(iMenuItem){ format_CStr("${dlg.upload.id.default} (%s)", 110 pushBack_Array(items,
111 urlId ? cstr_String(name_GmIdentity(urlId)) : "${dlg.upload.id.none}"), 111 &(iMenuItem){ format_CStr("${dlg.upload.id.default} (%s)",
112 0, 0, "upload.setid arg:1" }); 112 urlId ? cstr_String(name_GmIdentity(urlId))
113 : "${dlg.upload.id.none}"),
114 0, 0, "upload.setid arg:1" });
113 pushBack_Array(items, &(iMenuItem){ "${dlg.upload.id.none}", 0, 0, "upload.setid arg:0" }); 115 pushBack_Array(items, &(iMenuItem){ "${dlg.upload.id.none}", 0, 0, "upload.setid arg:0" });
114 pushBack_Array(items, &(iMenuItem){ "---" }); 116 pushBack_Array(items, &(iMenuItem){ "---" });
115 iConstForEach(PtrArray, i, listIdentities_GmCerts(certs_App(), NULL, NULL)) { 117 iConstForEach(PtrArray, i, listIdentities_GmCerts(certs_App(), NULL, NULL)) {
@@ -219,21 +221,31 @@ void init_UploadWidget(iUploadWidget *d) {
219 setFixedSize_Widget(as_Widget(d->mime), init_I2(70 * gap_UI, -1)); 221 setFixedSize_Widget(as_Widget(d->mime), init_I2(70 * gap_UI, -1));
220 addTwoColumnDialogInputField_Widget(headings, values, "${upload.mime}", "upload.mime", iClob(d->mime)); 222 addTwoColumnDialogInputField_Widget(headings, values, "${upload.mime}", "upload.mime", iClob(d->mime));
221 } 223 }
222 /* Token. */ { 224 /* Identity and Token. */ {
223 addChild_Widget(w, iClob(makePadding_Widget(gap_UI))); 225 addChild_Widget(w, iClob(makePadding_Widget(gap_UI)));
224 iWidget *page = makeTwoColumns_Widget(&headings, &values); 226 iWidget *page = makeTwoColumns_Widget(&headings, &values);
227 /* Token. */
225 d->token = addTwoColumnDialogInputField_Widget( 228 d->token = addTwoColumnDialogInputField_Widget(
226 headings, values, "${upload.token}", "upload.token", iClob(new_InputWidget(0))); 229 headings, values, "${upload.token}", "upload.token", iClob(new_InputWidget(0)));
227 setHint_InputWidget(d->token, "${hint.upload.token}"); 230 setHint_InputWidget(d->token, "${hint.upload.token}");
228 setFixedSize_Widget(as_Widget(d->token), init_I2(50 * gap_UI, -1)); 231 setFixedSize_Widget(as_Widget(d->token), init_I2(50 * gap_UI, -1));
232 /* Identity. */
233 const iArray * identItems = makeIdentityItems_UploadWidget_(d);
234 const iMenuItem *items = constData_Array(identItems);
235 const size_t numItems = size_Array(identItems);
236 iLabelWidget * ident = makeMenuButton_LabelWidget("${upload.id}", items, numItems);
237 setTextCStr_LabelWidget(ident, items[findWidestLabel_MenuItem(items, numItems)].label);
238 addChild_Widget(headings, iClob(makeHeading_Widget("${upload.id}")));
239 setId_Widget(addChildFlags_Widget(values, iClob(ident), alignLeft_WidgetFlag), "upload.id");
229 addChild_Widget(w, iClob(page)); 240 addChild_Widget(w, iClob(page));
230 } 241 }
231 /* Buttons. */ { 242 /* Buttons. */ {
232 addChild_Widget(w, iClob(makePadding_Widget(gap_UI))); 243 addChild_Widget(w, iClob(makePadding_Widget(gap_UI)));
233 iWidget *buttons = makeDialogButtons_Widget(actions, iElemCount(actions)); 244 iWidget *buttons = makeDialogButtons_Widget(actions, iElemCount(actions));
234 setId_Widget(insertChildAfterFlags_Widget(buttons, 245 setId_Widget(insertChildAfterFlags_Widget(buttons,
235 iClob(d->counter = new_LabelWidget("", NULL)), 246 iClob(d->counter = new_LabelWidget("", NULL)),
236 0, frameless_WidgetFlag), 247 0,
248 frameless_WidgetFlag),
237 "upload.counter"); 249 "upload.counter");
238 addChild_Widget(w, iClob(buttons)); 250 addChild_Widget(w, iClob(buttons));
239 } 251 }