summaryrefslogtreecommitdiff
path: root/src/ui/util.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-23 16:08:42 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-23 16:10:05 +0300
commit51dc5b1ef584a9aa214c518101b951f1745a6fc9 (patch)
treeb904890f57bbf7e4412fd51cef8682cf37657663 /src/ui/util.c
parent3b31ab31eb52578693acee07fdcf84fbeff72707 (diff)
Added an identity creation dialog
Diffstat (limited to 'src/ui/util.c')
-rw-r--r--src/ui/util.c68
1 files changed, 66 insertions, 2 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index 753fd140..52d5031e 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -708,8 +708,9 @@ static iBool toggleHandler_(iWidget *d, const char *cmd) {
708} 708}
709 709
710iWidget *makeToggle_Widget(const char *id) { 710iWidget *makeToggle_Widget(const char *id) {
711 iWidget *toggle = as_Widget(new_LabelWidget("YES", 0, 0, "toggle")); 711 iWidget *toggle = as_Widget(new_LabelWidget("YES", 0, 0, "toggle")); /* "YES" for sizing */
712 setId_Widget(toggle, id); 712 setId_Widget(toggle, id);
713 updateTextCStr_LabelWidget((iLabelWidget *) toggle, "NO"); /* actual initial value */
713 setCommandHandler_Widget(toggle, toggleHandler_); 714 setCommandHandler_Widget(toggle, toggleHandler_);
714 return toggle; 715 return toggle;
715} 716}
@@ -769,7 +770,7 @@ iWidget *makeBookmarkEditor_Widget(void) {
769 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); 770 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag);
770 iWidget *values = addChildFlags_Widget( 771 iWidget *values = addChildFlags_Widget(
771 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); 772 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag);
772 iInputWidget *inputs[4]; 773 iInputWidget *inputs[3];
773 addChild_Widget(headings, iClob(makeHeading_Widget("Title:"))); 774 addChild_Widget(headings, iClob(makeHeading_Widget("Title:")));
774 setId_Widget(addChild_Widget(values, iClob(inputs[0] = new_InputWidget(0))), "bmed.title"); 775 setId_Widget(addChild_Widget(values, iClob(inputs[0] = new_InputWidget(0))), "bmed.title");
775 addChild_Widget(headings, iClob(makeHeading_Widget("URL:"))); 776 addChild_Widget(headings, iClob(makeHeading_Widget("URL:")));
@@ -832,3 +833,66 @@ iWidget *makeBookmarkCreation_Widget(const iString *url, const iString *title, i
832 setCommandHandler_Widget(dlg, handleBookmarkCreationCommands_SidebarWidget_); 833 setCommandHandler_Widget(dlg, handleBookmarkCreationCommands_SidebarWidget_);
833 return dlg; 834 return dlg;
834} 835}
836
837iWidget *makeIdentityCreation_Widget(void) {
838 iWidget *dlg = makeSheet_Widget("ident");
839 setId_Widget(addChildFlags_Widget(
840 dlg,
841 iClob(new_LabelWidget(uiHeading_ColorEscape "NEW IDENTITY", 0, 0, NULL)),
842 frameless_WidgetFlag),
843 "ident.heading");
844 iWidget *page = new_Widget();
845 addChildFlags_Widget(
846 dlg,
847 iClob(
848 new_LabelWidget("Creating a 2048-bit self-signed RSA certificate.", 0, 0, NULL)),
849 frameless_WidgetFlag);
850 addChild_Widget(dlg, iClob(page));
851 setFlags_Widget(page, arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag, iTrue);
852 iWidget *headings = addChildFlags_Widget(
853 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag);
854 iWidget *values = addChildFlags_Widget(
855 page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag);
856 iInputWidget *inputs[4];
857 addChild_Widget(headings, iClob(makeHeading_Widget("Common name:")));
858 setId_Widget(addChild_Widget(values, iClob(inputs[0] = new_InputWidget(0))), "ident.common");
859 addChild_Widget(headings, iClob(makeHeading_Widget("User ID:")));
860 setId_Widget(addChild_Widget(values, iClob(inputs[1] = new_InputWidget(0))), "ident.userid");
861 addChild_Widget(headings, iClob(makeHeading_Widget("Organization:")));
862 setId_Widget(addChild_Widget(values, iClob(inputs[2] = new_InputWidget(0))), "ident.org");
863 addChild_Widget(headings, iClob(makeHeading_Widget("Country:")));
864 setId_Widget(addChild_Widget(values, iClob(inputs[3] = new_InputWidget(0))), "ident.country");
865 addChild_Widget(headings, iClob(makeHeading_Widget("Valid until:")));
866 iInputWidget *until;
867 addChild_Widget(values, iClob(until = new_InputWidget(19)));
868 setTextCStr_InputWidget(until, "YYYY-MM-DD HH:MM:SS");
869// addChild_Widget(headings, iClob(newEmpty_LabelWidget()));
870// addChild_Widget(values,
871// iClob(newColor_LabelWidget("Time defaults to end of day.",
872// uiAnnotation_ColorId)));
873 addChild_Widget(headings, iClob(makeHeading_Widget("Temporary:")));
874// iWidget *temp = new_Widget();
875// addChildFlags_Widget(
876// values, iClob(temp), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
877 addChild_Widget(values, iClob(makeToggle_Widget("ident.temp")));
878 // addChild_Widget(
879 // temp,
880 // iClob(newColor_LabelWidget("Temporary identities are not saved.",
881 // uiAnnotation_ColorId)));
882 arrange_Widget(dlg);
883 for (size_t i = 0; i < iElemCount(inputs); ++i) {
884 as_Widget(inputs[i])->rect.size.x = 100 * gap_UI - headings->rect.size.x;
885 }
886 iWidget *div = new_Widget(); {
887 setFlags_Widget(div, arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag, iTrue);
888 addChild_Widget(div, iClob(new_LabelWidget("Cancel", SDLK_ESCAPE, 0, "cancel")));
889 addChild_Widget(
890 div,
891 iClob(new_LabelWidget(
892 uiTextAction_ColorEscape "Create", SDLK_RETURN, KMOD_PRIMARY, "ident.accept")));
893 }
894 addChild_Widget(dlg, iClob(div));
895 addChild_Widget(get_Window()->root, iClob(dlg));
896 centerSheet_Widget(dlg);
897 return dlg;
898}