static void setUpComboFromSingleStrings(GWEN_DIALOG *dlg, const char *comboBoxName, const char **strings, const char *s) { int i; int j; const char *t; GWEN_Dialog_SetIntProperty(dlg, comboBoxName, GWEN_DialogProperty_ClearValues, 0, 0, 0); j=-1; for (i=0; ; i++) { t=strings[i]; if (t==NULL) break; GWEN_Dialog_SetCharProperty(dlg, comboBoxName, GWEN_DialogProperty_AddValue, 0, t, 0); if (s && *s && strcmp(s, t)==0) j=i; } if (j==-1) { if (s && *s) { GWEN_Dialog_SetCharProperty(dlg, comboBoxName, GWEN_DialogProperty_AddValue, 0, s, 0); j=i; } else j=0; } GWEN_Dialog_SetIntProperty(dlg, comboBoxName, GWEN_DialogProperty_Value, 0, j, 0); }
static void setUpComboFromDoubleStrings(GWEN_DIALOG *dlg, const char *comboBoxName, const char **strings, const char *s) { int i; int j; const char *t1; const char *t2; GWEN_Dialog_SetIntProperty(dlg, comboBoxName, GWEN_DialogProperty_ClearValues, 0, 0, 0); j=-1; for (i=0; ; i+=2) { t1=strings[i]; if (t1==NULL) break; t2=strings[i+1]; GWEN_Dialog_SetCharProperty(dlg, comboBoxName, GWEN_DialogProperty_AddValue, 0, I18N(t2), 0); if (s && *s && strcasecmp(s, t1)==0) j=i/2; } if (j==-1) { if (s && *s) { GWEN_Dialog_SetCharProperty(dlg, comboBoxName, GWEN_DialogProperty_AddValue, 0, s, 0); j=i/2; } else j=0; } GWEN_Dialog_SetIntProperty(dlg, comboBoxName, GWEN_DialogProperty_Value, 0, j, 0); }
void GWEN_DlgShowBox_Init(GWEN_DIALOG *dlg) { GWEN_DLGSHOWBOX *xdlg; int i; GWEN_DB_NODE *dbParams; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGSHOWBOX, dlg); assert(xdlg); dbParams=GWEN_Dialog_GetPreferences(dlg); assert(dbParams); /* read width */ i=GWEN_DB_GetIntValue(dbParams, "dialog_width", 0, -1); if (i>=DIALOG_MINWIDTH) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0); /* read height */ i=GWEN_DB_GetIntValue(dbParams, "dialog_height", 0, -1); if (i>=DIALOG_MINHEIGHT) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0); /* special stuff */ if (xdlg->title) GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, xdlg->title, 0); if (xdlg->text) GWEN_Dialog_SetCharProperty(dlg, "descrLabel", GWEN_DialogProperty_Title, 0, xdlg->text, 0); xdlg->wasInit=1; }
int AO_NewUserDialog_HandleActivatedApp(GWEN_DIALOG *dlg) { AO_NEWUSER_DIALOG *xdlg; int idx; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AO_NEWUSER_DIALOG, dlg); assert(xdlg); idx=GWEN_Dialog_GetIntProperty(dlg, "wiz_app_combo", GWEN_DialogProperty_Value, 0, -1); if (idx>0) { const AO_APPINFO *ai; ai=AO_Provider_GetAppInfos(xdlg->provider); if (ai) { while (ai->appName && --idx) { ai++; } if (ai->appName) { if (ai->appId) GWEN_Dialog_SetCharProperty(dlg, "wiz_appid_edit", GWEN_DialogProperty_Value, 0, ai->appId, 0); if (ai->appVer) GWEN_Dialog_SetCharProperty(dlg, "wiz_appver_edit", GWEN_DialogProperty_Value, 0, ai->appVer, 0); } } } return GWEN_DialogEvent_ResultHandled; }
int AB_SetupNewUserDialog_EnterPage(GWEN_DIALOG *dlg, int page, int forwards) { AB_SETUP_NEWUSER_DIALOG *xdlg; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_NEWUSER_DIALOG, dlg); assert(xdlg); switch(page) { case PAGE_BEGIN: GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, page, 0); return GWEN_DialogEvent_ResultHandled; case PAGE_BACKEND: GWEN_Dialog_SetCharProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Title, 0, I18N("Next"), 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 1, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, page, 0); return GWEN_DialogEvent_ResultHandled; default: if (forwards){ DBG_NOTICE(0, "About to enter page %d", page); GWEN_Dialog_SetCharProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Title, 0, I18N("Run"), 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, page, 0); return GWEN_DialogEvent_ResultHandled; } return GWEN_DialogEvent_ResultHandled; } return GWEN_DialogEvent_ResultHandled; }
int APY_NewUserDialog_EnterPage(GWEN_DIALOG *dlg, int page, int forwards) { APY_NEWUSER_DIALOG *xdlg; int rv; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, APY_NEWUSER_DIALOG, dlg); assert(xdlg); switch(page) { case PAGE_BEGIN: GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, page, 0); return GWEN_DialogEvent_ResultHandled; case PAGE_USER: GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 1, 0); rv=APY_NewUserDialog_GetUserPageData(dlg); if (rv<0) GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 0, 0); else GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, page, 0); return GWEN_DialogEvent_ResultHandled; case PAGE_SECRET: GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 1, 0); rv=APY_NewUserDialog_GetSecretPageData(dlg); if (rv<0) GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 0, 0); else GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, page, 0); return GWEN_DialogEvent_ResultHandled; case PAGE_CREATE: if (!forwards) GWEN_Dialog_SetCharProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Title, 0, I18N("Next"), 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, page, 0); return GWEN_DialogEvent_ResultHandled; case PAGE_END: GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, page, 0); GWEN_Dialog_SetCharProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Title, 0, I18N("Finish"), 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_abort_button", GWEN_DialogProperty_Enabled, 0, 0, 0); return GWEN_DialogEvent_ResultHandled; default: return GWEN_DialogEvent_ResultHandled; } return GWEN_DialogEvent_ResultHandled; }
void AB_SetupNewUserDialog_Init(GWEN_DIALOG *dlg) { AB_SETUP_NEWUSER_DIALOG *xdlg; GWEN_DB_NODE *dbPrefs; int i; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_NEWUSER_DIALOG, dlg); assert(xdlg); dbPrefs=GWEN_Dialog_GetPreferences(dlg); GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, I18N("New User Wizard"), 0); /* select first page */ GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, 0, 0); /* setup intro page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_begin_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>This dialog assists you in creating an online banking user." "The following steps are:</p>" "<ul>" "<li>select the banking protocol</li>" "<li>select the type of user to create</li>" "</ul>" "</html>" "This dialog assists you in creating an online banking user.\n" "The following steps are:\n" " - select the banking protocol\n" " - select the type of user to create\n"), 0); /* read width */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_width", 0, -1); if (i>=DIALOG_MINWIDTH) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0); /* read height */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_height", 0, -1); if (i>=DIALOG_MINHEIGHT) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0); /* disable next and previous buttons */ GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); }
static int GWENHYWFAR_CB _gwenGuiSignalHandler(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender) { fprintf(stderr, "Received event %d from widget [%s]\n", t, sender); switch(t) { case GWEN_DialogEvent_TypeInit: fprintf(stderr, "Init\n"); GWEN_Dialog_SetCharProperty(dlg, "button1", GWEN_DialogProperty_Title, 0, "Click this button to close", 0); GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, 640, 0); GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, 480, 0); break; case GWEN_DialogEvent_TypeFini: fprintf(stderr, "Fini\n"); break; case GWEN_DialogEvent_TypeValueChanged: fprintf(stderr, "ValueChanged\n"); if (strcasecmp(sender, "listbox1")==0) { fprintf(stderr, "Selected list entry %d\n", GWEN_Dialog_GetIntProperty(dlg, "listbox1", GWEN_DialogProperty_Value, 0, -1)); } break; case GWEN_DialogEvent_TypeActivated: fprintf(stderr, "Activated\n"); if (strcasecmp(sender, "button1")==0) return GWEN_DialogEvent_ResultAccept; break; case GWEN_DialogEvent_TypeEnabled: fprintf(stderr, "Enabled\n"); break; case GWEN_DialogEvent_TypeDisabled: fprintf(stderr, "Disabled\n"); break; case GWEN_DialogEvent_TypeClose: fprintf(stderr, "Close\n"); return GWEN_DialogEvent_ResultNotHandled; case GWEN_DialogEvent_TypeLast: fprintf(stderr, "Last, ignored\n"); return GWEN_DialogEvent_ResultNotHandled; } return GWEN_DialogEvent_ResultHandled; }
void OH_GetInstituteDialog_UpdateList(GWEN_DIALOG *dlg) { OH_GETINST_DIALOG *xdlg; const OH_INSTITUTE_SPEC_LIST *sl; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, OH_GETINST_DIALOG, dlg); assert(xdlg); /* clear bank info list */ GWEN_Dialog_SetIntProperty(dlg, "listBox", GWEN_DialogProperty_ClearValues, 0, 0, 0); OH_InstituteSpec_List_Clear(xdlg->matchingSpecList); OH_InstituteData_free(xdlg->selectedData); xdlg->selectedData=NULL; sl=OfxHome_GetSpecs(xdlg->ofxHome); if (sl) { GWEN_BUFFER *tbuf; const OH_INSTITUTE_SPEC *os; const char *s; s=GWEN_Dialog_GetCharProperty(dlg, "nameEdit", GWEN_DialogProperty_Value, 0, NULL); tbuf=GWEN_Buffer_new(0, 256, 0, 1); os=OH_InstituteSpec_List_First(sl); while (os) { const char *bname; bname=OH_InstituteSpec_GetName(os); /* only add matching entries */ if ((s && bname && GWEN_Text_StrCaseStr(bname, s)!=NULL) || !(s && *s)) { OH_InstituteSpec_List_Add(OH_InstituteSpec_dup(os), xdlg->matchingSpecList); createListBoxString(os, tbuf); GWEN_Dialog_SetCharProperty(dlg, "listBox", GWEN_DialogProperty_AddValue, 0, GWEN_Buffer_GetStart(tbuf), 0); GWEN_Buffer_Reset(tbuf); } os=OH_InstituteSpec_List_Next(os); } GWEN_Buffer_free(tbuf); } if (GWEN_Dialog_GetIntProperty(dlg, "listBox", GWEN_DialogProperty_Value, 0, -1)>=0) GWEN_Dialog_SetIntProperty(dlg, "okButton", GWEN_DialogProperty_Enabled, 0, 1, 0); else GWEN_Dialog_SetIntProperty(dlg, "okButton", GWEN_DialogProperty_Enabled, 0, 0, 0); }
int AH_NewKeyFileDialog_HandleActivatedFileButton(GWEN_DIALOG *dlg) { AH_NEWKEYFILE_DIALOG *xdlg; int rv; const char *s; GWEN_BUFFER *pathBuffer; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg); assert(xdlg); pathBuffer=GWEN_Buffer_new(0, 256, 0, 1); s=GWEN_Dialog_GetCharProperty(dlg, "wiz_filename_edit", GWEN_DialogProperty_Value, 0, NULL); if (s && *s) GWEN_Buffer_AppendString(pathBuffer, s); rv=GWEN_Gui_GetFileName(I18N("Create Keyfile"), GWEN_Gui_FileNameType_SaveFileName, 0, I18N("All Files (*)\tOHBCI Files (*ohbci;*.medium)"), pathBuffer, GWEN_Dialog_GetGuiId(dlg)); if (rv==0) { GWEN_Dialog_SetCharProperty(dlg, "wiz_filename_edit", GWEN_DialogProperty_Value, 0, GWEN_Buffer_GetStart(pathBuffer), 0); rv=AH_NewKeyFileDialog_GetFilePageData(dlg); if (rv<0) GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 0, 0); else GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); } else { DBG_NOTICE(AQHBCI_LOGDOMAIN, "here (%d)", rv); } GWEN_Buffer_free(pathBuffer); return GWEN_DialogEvent_ResultHandled; }
void AH_ChooseUserTypeDialog_Init(GWEN_DIALOG *dlg) { GWEN_Dialog_SetCharProperty(dlg, "hbciIntroLabel", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>The HBCI module supports a broad range of security " "media. Please choose the user setup mode from the following " "list.</p>" "<p>Click on the <i>run</i> button below to create the user.</p>" "</html>" "The HBCI module supports a broad range of security\n" "media. Please choose the user setup mode from the following\n" "list.\n" "Click on the RUN button below to create the user." ), 0); switch(AB_UserTypePageDialog_GetSelectedType(dlg)) { case AqHBCI_NewUserDialog_CodeGeneric: case AqHBCI_NewUserDialog_CodeExistingPinTan: GWEN_Dialog_SetIntProperty(dlg, "hbciPinTanRadio", GWEN_DialogProperty_Value, 0, 1, 0); break; case AqHBCI_NewUserDialog_CodeCreateKeyFile: GWEN_Dialog_SetIntProperty(dlg, "hbciCreateKeyFileRadio", GWEN_DialogProperty_Value, 0, 1, 0); break; case AqHBCI_NewUserDialog_CodeExistingKeyFile: GWEN_Dialog_SetIntProperty(dlg, "hbciImportKeyFileRadio", GWEN_DialogProperty_Value, 0, 1, 0); break; case AqHBCI_NewUserDialog_CodeCreateChipcard: GWEN_Dialog_SetIntProperty(dlg, "hbciInitChipcardRadio", GWEN_DialogProperty_Value, 0, 1, 0); break; case AqHBCI_NewUserDialog_CodeExistingChipcard: GWEN_Dialog_SetIntProperty(dlg, "hbciUseChipcardRadio", GWEN_DialogProperty_Value, 0, 1, 0); break; } /* temporarily disable not-implemented buttons */ GWEN_Dialog_SetIntProperty(dlg, "hbciInitChipcardRadio", GWEN_DialogProperty_Enabled, 0, 0, 0); }
static void AB_SetupDialog_Reload(GWEN_DIALOG *dlg) { AB_SETUP_DIALOG *xdlg; AB_USER *u; AB_ACCOUNT *a; int i; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_DIALOG, dlg); assert(xdlg); /* user list */ i=0; GWEN_Dialog_SetIntProperty(dlg, "userListBox", GWEN_DialogProperty_ClearValues, 0, 0, 0); if (xdlg->currentUserList) AB_User_List_free(xdlg->currentUserList); xdlg->currentUserList=AB_User_List_new(); AB_SetupDialog_LoadUsers(dlg, xdlg->currentUserList); if (AB_User_List_GetCount(xdlg->currentUserList)) { GWEN_BUFFER *tbuf; tbuf=GWEN_Buffer_new(0, 256, 0, 1); u=AB_User_List_First(xdlg->currentUserList); while (u) { createUserListBoxString(u, tbuf); GWEN_Dialog_SetCharProperty(dlg, "userListBox", GWEN_DialogProperty_AddValue, 0, GWEN_Buffer_GetStart(tbuf), 0); i++; GWEN_Buffer_Reset(tbuf); u=AB_User_List_Next(u); } GWEN_Buffer_free(tbuf); } /* if user list not empty */ GWEN_Dialog_SetIntProperty(dlg, "userListBox", GWEN_DialogProperty_Sort, 0, 0, 0); if (i) GWEN_Dialog_SetIntProperty(dlg, "userListBox", GWEN_DialogProperty_Value, 0, 0, 0); /* account list */ i=0; GWEN_Dialog_SetIntProperty(dlg, "accountListBox", GWEN_DialogProperty_ClearValues, 0, 0, 0); if (xdlg->currentAccountList) AB_Account_List_free(xdlg->currentAccountList); xdlg->currentAccountList=AB_Account_List_new(); AB_SetupDialog_LoadAccounts(dlg, xdlg->currentAccountList); if (AB_Account_List_GetCount(xdlg->currentAccountList)) { GWEN_BUFFER *tbuf; tbuf=GWEN_Buffer_new(0, 256, 0, 1); a=AB_Account_List_First(xdlg->currentAccountList); while (a) { createAccountListBoxString(a, tbuf); GWEN_Dialog_SetCharProperty(dlg, "accountListBox", GWEN_DialogProperty_AddValue, 0, GWEN_Buffer_GetStart(tbuf), 0); i++; GWEN_Buffer_Reset(tbuf); a=AB_Account_List_Next(a); } GWEN_Buffer_free(tbuf); } /* if account list not empty */ GWEN_Dialog_SetIntProperty(dlg, "accountListBox", GWEN_DialogProperty_Sort, 0, 0, 0); if (i) GWEN_Dialog_SetIntProperty(dlg, "accountListBox", GWEN_DialogProperty_Value, 0, 0, 0); AB_SetupDialog_UserChanged(dlg); AB_SetupDialog_AccountChanged(dlg); }
int AH_NewKeyFileDialog_HandleActivatedBankCode(GWEN_DIALOG *dlg) { AH_NEWKEYFILE_DIALOG *xdlg; GWEN_DIALOG *dlg2; int rv; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg); assert(xdlg); dlg2=AB_SelectBankInfoDialog_new(xdlg->banking, "de", NULL); if (dlg2==NULL) { DBG_ERROR(AQHBCI_LOGDOMAIN, "Could not create dialog"); GWEN_Gui_ShowError(I18N("Error"), "%s", I18N("Could not create dialog, maybe an installation error?")); return GWEN_DialogEvent_ResultHandled; } rv=GWEN_Gui_ExecDialog(dlg2, 0); if (rv==0) { /* rejected */ GWEN_Dialog_free(dlg2); return GWEN_DialogEvent_ResultHandled; } else { const AB_BANKINFO *bi; bi=AB_SelectBankInfoDialog_GetSelectedBankInfo(dlg2); if (bi) { const char *s; AB_BANKINFO_SERVICE *sv; s=AB_BankInfo_GetBankId(bi); GWEN_Dialog_SetCharProperty(dlg, "wiz_bankcode_edit", GWEN_DialogProperty_Value, 0, (s && *s)?s:"", 0); s=AB_BankInfo_GetBankName(bi); GWEN_Dialog_SetCharProperty(dlg, "wiz_bankname_edit", GWEN_DialogProperty_Value, 0, (s && *s)?s:"", 0); sv=AB_BankInfoService_List_First(AB_BankInfo_GetServices(bi)); while(sv) { const char *s; s=AB_BankInfoService_GetType(sv); if (s && *s && strcasecmp(s, "HBCI")==0) { s=AB_BankInfoService_GetMode(sv); if (s && *s && strncasecmp(s, "RDH", 3)==0) break; } sv=AB_BankInfoService_List_Next(sv); } if (sv) { /* RDH service found */ s=AB_BankInfoService_GetMode(sv); if (s && *s) { if (strcasecmp(s, "RDH1")==0) xdlg->rdhVersion=1; else if (strcasecmp(s, "RDH2")==0) xdlg->rdhVersion=2; else if (strcasecmp(s, "RDH3")==0) xdlg->rdhVersion=3; else if (strcasecmp(s, "RDH4")==0) xdlg->rdhVersion=4; else if (strcasecmp(s, "RDH5")==0) xdlg->rdhVersion=5; else if (strcasecmp(s, "RDH6")==0) xdlg->rdhVersion=6; else if (strcasecmp(s, "RDH7")==0) xdlg->rdhVersion=7; else if (strcasecmp(s, "RDH8")==0) xdlg->rdhVersion=8; else if (strcasecmp(s, "RDH9")==0) xdlg->rdhVersion=9; else if (strcasecmp(s, "RDH10")==0) xdlg->rdhVersion=10; else if (strcasecmp(s, "RDH")==0) xdlg->rdhVersion=1; } s=AB_BankInfoService_GetAddress(sv); GWEN_Dialog_SetCharProperty(dlg, "wiz_url_edit", GWEN_DialogProperty_Value, 0, (s && *s)?s:"", 0); s=AB_BankInfoService_GetPversion(sv); if (s && *s) { if (strcasecmp(s, "2.01")==0 || strcasecmp(s, "2")==0) xdlg->hbciVersion=201; else if (strcasecmp(s, "2.10")==0 || strcasecmp(s, "2.1")==0) xdlg->hbciVersion=210; else if (strcasecmp(s, "2.20")==0 || strcasecmp(s, "2.2")==0) xdlg->hbciVersion=220; else if (strcasecmp(s, "3.00")==0 || strcasecmp(s, "3.0")==0 || strcasecmp(s, "3")==0) xdlg->hbciVersion=300; else if (strcasecmp(s, "4.00")==0 || strcasecmp(s, "4.0")==0 || strcasecmp(s, "4")==0) xdlg->hbciVersion=400; } } } } GWEN_Dialog_free(dlg2); if (AH_NewKeyFileDialog_GetBankPageData(dlg)<0) GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 0, 0); else GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); return GWEN_DialogEvent_ResultHandled; }
int APY_NewUserDialog_DoIt(GWEN_DIALOG *dlg) { APY_NEWUSER_DIALOG *xdlg; AB_USER *u; int rv; uint32_t pid; AB_PROVIDER *pro; DBG_INFO(0, "Doit"); assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, APY_NEWUSER_DIALOG, dlg); assert(xdlg); pro=AB_Banking_GetProvider(xdlg->banking, "aqpaypal"); if (pro==NULL) { DBG_ERROR(AQPAYPAL_LOGDOMAIN, "Could not find backend, maybe some plugins are not installed?"); // TODO: show error message return GWEN_DialogEvent_ResultHandled; } DBG_INFO(0, "Creating user"); u=AB_Banking_CreateUser(xdlg->banking, "aqpaypal"); if (u==NULL) { DBG_ERROR(AQPAYPAL_LOGDOMAIN, "Could not create user, maybe backend missing?"); // TODO: show error message return GWEN_DialogEvent_ResultHandled; } /* generic setup */ AB_User_SetUserName(u, xdlg->userName); AB_User_SetUserId(u, xdlg->userId); AB_User_SetCustomerId(u, xdlg->userId); AB_User_SetCountry(u, "de"); AB_User_SetBankCode(u, "PAYPAL"); APY_User_SetServerUrl(u, xdlg->url); APY_User_SetHttpVMajor(u, xdlg->httpVMajor); APY_User_SetHttpVMinor(u, xdlg->httpVMinor); DBG_INFO(0, "Adding user"); rv=AB_Banking_AddUser(xdlg->banking, u); if (rv<0) { DBG_ERROR(AQPAYPAL_LOGDOMAIN, "Could not add user (%d)", rv); AB_User_free(u); return GWEN_DialogEvent_ResultHandled; } pid=GWEN_Gui_ProgressStart(GWEN_GUI_PROGRESS_DELAY | GWEN_GUI_PROGRESS_ALLOW_EMBED | GWEN_GUI_PROGRESS_SHOW_PROGRESS | GWEN_GUI_PROGRESS_SHOW_ABORT, I18N("Setting Up Paypal User"), I18N("The user will be created."), 3, 0); /* lock new user */ DBG_INFO(0, "Locking user"); rv=AB_Banking_BeginExclUseUser(xdlg->banking, u); if (rv<0) { DBG_ERROR(AQPAYPAL_LOGDOMAIN, "Could not lock user (%d)", rv); GWEN_Gui_ProgressLog(pid, GWEN_LoggerLevel_Error, I18N("Unable to lock users")); AB_Banking_DeleteUser(xdlg->banking, u); GWEN_Gui_ProgressEnd(pid); return GWEN_DialogEvent_ResultHandled; } #if 0 DBG_INFO(0, "Getting certs (%08x)", AH_User_GetFlags(u)); GWEN_Gui_ProgressLog(pid, GWEN_LoggerLevel_Notice, I18N("Retrieving SSL certificate")); rv=APY_Provider_GetCert(pro, u, 0, 1, 0); if (rv<0) { // TODO: retry with SSLv3 if necessary AB_Banking_EndExclUseUser(xdlg->banking, u, 1); DBG_ERROR(AQPAYPAL_LOGDOMAIN, "here (%d)", rv); AB_Banking_DeleteUser(xdlg->banking, u); GWEN_Gui_ProgressEnd(pid); return GWEN_DialogEvent_ResultHandled; } rv=GWEN_Gui_ProgressAdvance(pid, GWEN_GUI_PROGRESS_ONE); if (rv==GWEN_ERROR_USER_ABORTED) { AB_Banking_EndExclUseUser(xdlg->banking, u, 1); DBG_INFO(AQPAYPAL_LOGDOMAIN, "here (%d)", rv); AB_Banking_DeleteUser(xdlg->banking, u); GWEN_Gui_ProgressLog(pid, GWEN_LoggerLevel_Error, I18N("Aborted by user.")); GWEN_Gui_ProgressEnd(pid); return GWEN_DialogEvent_ResultHandled; } #endif GWEN_Gui_ProgressLog(pid, GWEN_LoggerLevel_Notice, I18N("Creating API credentials file")); rv=APY_User_SetApiSecrets(u, xdlg->apiPassword, xdlg->apiSignature, xdlg->apiUserId); if (rv<0) { AB_Banking_EndExclUseUser(xdlg->banking, u, 1); DBG_INFO(AQPAYPAL_LOGDOMAIN, "here (%d)", rv); AB_Banking_DeleteUser(xdlg->banking, u); GWEN_Gui_ProgressLog(pid, GWEN_LoggerLevel_Error, I18N("Aborted by user.")); GWEN_Gui_ProgressEnd(pid); return GWEN_DialogEvent_ResultHandled; } /* unlock user */ DBG_INFO(0, "Unlocking user"); rv=AB_Banking_EndExclUseUser(xdlg->banking, u, 0); if (rv<0) { DBG_INFO(AQPAYPAL_LOGDOMAIN, "Could not unlock user [%s] (%d)", AB_User_GetUserId(u), rv); GWEN_Gui_ProgressLog2(pid, GWEN_LoggerLevel_Error, I18N("Could not unlock user %s (%d)"), AB_User_GetUserId(u), rv); AB_Banking_EndExclUseUser(xdlg->banking, u, 1); AB_Banking_DeleteUser(xdlg->banking, u); GWEN_Gui_ProgressEnd(pid); return GWEN_DialogEvent_ResultHandled; } if (1) { AB_ACCOUNT *account; int rv; static char accountname[256]; account=AB_Banking_CreateAccount(xdlg->banking, APY_PROVIDER_NAME); assert(account); #if 0 AB_User_SetUserName(u, xdlg->userName); AB_User_SetUserId(u, xdlg->userId); #endif AB_Account_SetOwnerName(account, AB_User_GetUserName(u)); AB_Account_SetAccountNumber(account, AB_User_GetUserId(u)); AB_Account_SetBankCode(account, "PAYPAL"); AB_Account_SetBankName(account, "PAYPAL"); strcpy(accountname, "PP "); strcat(accountname, AB_User_GetUserName(u)); AB_Account_SetAccountName(account, accountname); AB_Account_SetUser(account, u); AB_Account_SetSelectedUser(account, u); rv=AB_Banking_AddAccount(xdlg->banking, account); if (rv<0) { DBG_INFO(AQPAYPAL_LOGDOMAIN, "Error adding account (%d)", rv); AB_Account_free(account); AB_Banking_DeleteUser(xdlg->banking, u); GWEN_Gui_ProgressEnd(pid); return GWEN_DialogEvent_ResultHandled; } } GWEN_Dialog_SetCharProperty(dlg, "wiz_end_label", GWEN_DialogProperty_Title, 0, I18N("The user has been successfully setup."), 0); GWEN_Gui_ProgressEnd(pid); APY_NewUserDialog_EnterPage(dlg, PAGE_END, 1); xdlg->user=u; return GWEN_DialogEvent_ResultHandled; }
static int GWENHYWFAR_CB _gwenGuiSignalHandler(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender) { fprintf(stderr, "Received event %d from widget [%s]\n", t, sender); switch(t) { case GWEN_DialogEvent_TypeInit: fprintf(stderr, "Init\n"); GWEN_Dialog_SetCharProperty(dlg, "combo1", GWEN_DialogProperty_AddValue, 0, "Erster Text in Combo1", 0); GWEN_Dialog_SetCharProperty(dlg, "combo1", GWEN_DialogProperty_AddValue, 0, "Zweiter Text in Combo1", 0); GWEN_Dialog_SetIntProperty(dlg, "combo1", GWEN_DialogProperty_Value, 0, 0, 0); GWEN_Dialog_SetCharProperty(dlg, "combo2", GWEN_DialogProperty_AddValue, 0, "Erster Text in Combo2", 0); GWEN_Dialog_SetCharProperty(dlg, "combo2", GWEN_DialogProperty_AddValue, 0, "Zweiter Text in Combo2", 0); GWEN_Dialog_SetIntProperty(dlg, "combo2", GWEN_DialogProperty_Value, 0, 0, 0); GWEN_Dialog_SetCharProperty(dlg, "listbox1", GWEN_DialogProperty_Title, 0, "Column1\tColumn2\tColumn3", 0); GWEN_Dialog_SetCharProperty(dlg, "listbox1", GWEN_DialogProperty_AddValue, 0, "Zeile 1 Spalte 1\tZeile 1 Spalte 2\tZeile 1 Spalte 3", 0); GWEN_Dialog_SetCharProperty(dlg, "listbox1", GWEN_DialogProperty_AddValue, 0, "Zeile 2 Spalte 1\tZeile 2 Spalte 2\tZeile 2 Spalte 3", 0); GWEN_Dialog_SetIntProperty(dlg, "listbox1", GWEN_DialogProperty_ColumnWidth, 0, 100, 0); GWEN_Dialog_SetIntProperty(dlg, "listbox1", GWEN_DialogProperty_ColumnWidth, 1, 200, 0); GWEN_Dialog_SetCharProperty(dlg, "labelWithHtmlImage", GWEN_DialogProperty_Title, 0, "<html>This label contains text which should also contain an image:" "<img src=\"chipcard.png\">" "<p>And here the text should continue, followed by another image:" "<img src=\"disk.png\"></p>" "And again, this should be on the following line.</html>" "This label would contain an image if it were able to use " "HTML.", 0); GWEN_Dialog_SetCharProperty(dlg, "textBrowser1", GWEN_DialogProperty_Value, 0, "<html>" "<p>This is <b>bold</b> text, while this one is <i>italic</i>.</p>" "This is a list:" "<ul>" "<li>first item</li>" "<li>second item</li>" "<li>third item</li>" "<li>fourth item</li>" "</ul>" "<p>This paragraph should follow the list.</p>" "</html>" "This is BOLD text, while this one is would be i t a l i c.\n" "This is a list:\n" "- first item\n" "- second item\n" "- third item\n" "- fourth item\n" "This paragraph should follow the list.", 0); GWEN_Dialog_SetIntProperty(dlg, "progressBar1", GWEN_DialogProperty_MinValue, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "progressBar1", GWEN_DialogProperty_MaxValue, 0, 10, 0); GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, 640, 0); GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, 480, 0); break; case GWEN_DialogEvent_TypeFini: fprintf(stderr, "Fini\n"); break; case GWEN_DialogEvent_TypeValueChanged: fprintf(stderr, "ValueChanged\n"); if (strcasecmp(sender, "listbox1")==0) { fprintf(stderr, "Selected list entry %d\n", GWEN_Dialog_GetIntProperty(dlg, "listbox1", GWEN_DialogProperty_Value, 0, -1)); } else if (strcasecmp(sender, "editPass1")==0) { const char *s; s=GWEN_Dialog_GetCharProperty(dlg, "editPass1", GWEN_DialogProperty_Value, 0, NULL); if (!(s && *s)) s="<empty>"; GWEN_Dialog_SetCharProperty(dlg, "editPass2", GWEN_DialogProperty_Value, 0, s, 0); } break; case GWEN_DialogEvent_TypeActivated: fprintf(stderr, "Activated\n"); if (strcasecmp(sender, "listbox1")==0) { int idx; idx=GWEN_Dialog_GetIntProperty(dlg, "listbox1", GWEN_DialogProperty_Value, 0, -1); fprintf(stderr, "Selected list entry %d\n", idx); if (idx>=0) { const char *s; s=GWEN_Dialog_GetCharProperty(dlg, "listbox1", GWEN_DialogProperty_Value, idx, NULL); if (s && *s) { fprintf(stderr, "Text of selected list entry %d: [%s]\n", idx, s); } } } else if (strcasecmp(sender, "combo1")==0) { int idx; idx=GWEN_Dialog_GetIntProperty(dlg, "combo1", GWEN_DialogProperty_Value, 0, -1); fprintf(stderr, "Selected list entry %d\n", idx); if (idx>=0) { const char *s; s=GWEN_Dialog_GetCharProperty(dlg, "combo1", GWEN_DialogProperty_Value, idx, NULL); if (s && *s) { fprintf(stderr, "Text of selected list entry %d: [%s]\n", idx, s); } } } else if (strcasecmp(sender, "okButton")==0) return GWEN_DialogEvent_ResultAccept; else if (strcasecmp(sender, "abortButton")==0) return GWEN_DialogEvent_ResultReject; else if (strcasecmp(sender, "progressMinus")==0) { int v; v=GWEN_Dialog_GetIntProperty(dlg, "progressBar1", GWEN_DialogProperty_Value, 0, -1); if (v>0) GWEN_Dialog_SetIntProperty(dlg, "progressBar1", GWEN_DialogProperty_Value, 0, v-1, 0); return GWEN_DialogEvent_ResultHandled; } else if (strcasecmp(sender, "progressPlus")==0) { int v; v=GWEN_Dialog_GetIntProperty(dlg, "progressBar1", GWEN_DialogProperty_Value, 0, -1); if (v<10) GWEN_Dialog_SetIntProperty(dlg, "progressBar1", GWEN_DialogProperty_Value, 0, v+1, 0); return GWEN_DialogEvent_ResultHandled; } else if (strcasecmp(sender, "prevPageButton")==0) { int v; v=GWEN_Dialog_GetIntProperty(dlg, "stack1", GWEN_DialogProperty_Value, 0, -1); if (v>0) GWEN_Dialog_SetIntProperty(dlg, "stack1", GWEN_DialogProperty_Value, 0, v-1, 0); return GWEN_DialogEvent_ResultHandled; } else if (strcasecmp(sender, "nextPageButton")==0) { int v; v=GWEN_Dialog_GetIntProperty(dlg, "stack1", GWEN_DialogProperty_Value, 0, -1); if (v<3) GWEN_Dialog_SetIntProperty(dlg, "stack1", GWEN_DialogProperty_Value, 0, v+1, 0); return GWEN_DialogEvent_ResultHandled; } break; case GWEN_DialogEvent_TypeEnabled: fprintf(stderr, "Enabled\n"); break; case GWEN_DialogEvent_TypeDisabled: fprintf(stderr, "Disabled\n"); break; case GWEN_DialogEvent_TypeClose: fprintf(stderr, "Close\n"); return GWEN_DialogEvent_ResultNotHandled; case GWEN_DialogEvent_TypeLast: fprintf(stderr, "Last, ignored\n"); return GWEN_DialogEvent_ResultNotHandled; } return GWEN_DialogEvent_ResultHandled; }
void APY_NewUserDialog_Init(GWEN_DIALOG *dlg) { APY_NEWUSER_DIALOG *xdlg; GWEN_DB_NODE *dbPrefs; int i; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, APY_NEWUSER_DIALOG, dlg); assert(xdlg); dbPrefs=GWEN_Dialog_GetPreferences(dlg); GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, I18N("Paypal Setup Wizard"), 0); /* select first page */ GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, 0, 0); /* setup intro page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_begin_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>This dialog assists you in setting up a Paypal User.</p>" "<p>Please note that you have to apply for API access with Paypal. " "The following procedure helps you getting there:</p>" "<p>Login into your Paypal account via web browser, enter the <i>My Profile</i> " "page, click <i>API access</i> under <i>Account information</i>.</p>" "<p>Choose <b>Option 2</b>.</p>" "</html>" "This dialog assists you in setting up a Paypal User.\n" "Please note that you have to apply for API access with Paypal.\n" "The following procedure helps you getting there:\n" "Login into your Paypal account via web browser, enter the \"My Profile\"\n" "page, click \"API access\" under \"Account information\".\n" "Choose OPTION 2." ), 0); /* setup user page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_user_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>You can find the information needed here after logging into your " "Paypal account via web browser. The information can then be found " "under <i>My Profile</i>, <i>Account Information</i>, <i>API Access</i>.</p>" "</html>" "You can find the information needed here after logging into your\n" "Paypal account via web browser. The information can then be found\n" "under <\"My Profile\", \"Account Information\", \"API Access\"." ), 0); GWEN_Dialog_SetCharProperty(dlg, "wiz_url_edit", GWEN_DialogProperty_Value, 0, "https://api-3t.paypal.com/nvp", 0); /* setup secret page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_secret_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>Enter the API password and signature as it is found on the " "Paypal page described in the previous steps.</p>" "<p><font color=\"red\"><b>" "The API password and API signature are extremely sensitive " "information which you must under no circumstances reveal to " "anybody!</b></font></p>" "<p>That being said, these credentials are also quite hard to " "remember, so AqBanking stores them in a file which is very well " "encrypted.</p>" "<p>When the user is created in the next step you will be asked for " "the password to be set for that credential file.</p>" "</html>" "Enter the API password and signature as it is found on the\n" "Paypal page described in the previous steps.\n" "The API password and API signature are extremely sensitive\n" "information which you must under no circumstances reveal to\n" "anybody!\n" "That being said, these credentials are also quite hard to\n" "remember, so AqBanking stores them in a file which is very well\n" "encrypted.\n" "When the user is created in the next step you will be asked for\n" "the password to be set for that credential file." ), 0); /* setup creation page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_create_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>We are now ready to create the user.</p>" "<p>Click the <i>next</i> button to proceed or <i>abort</i> to abort.</p>" "<p>If you proceed you will be asked to enter a new password. This is the password " "for the credentials file described in previous steps.</p>" "<p>Please be carefull to enter a sufficiently secure password</p>" "</html>" "We are now ready to create the user.\n" "Click the \"next\" button to proceed or \"abort\" to abort.\n" "If you proceed you will be asked to enter a new password. This is the password\n" "for the credentials file described in previous steps.\n" "Please be carefull to enter a sufficiently secure password." ), 0); /* setup extro page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_end_label", GWEN_DialogProperty_Title, 0, I18N("The user has been successfully setup."), 0); /* read width */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_width", 0, -1); if (i>=DIALOG_MINWIDTH) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0); /* read height */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_height", 0, -1); if (i>=DIALOG_MINHEIGHT) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0); /* disable next and previous buttons */ GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); }
static int GWENHYWFAR_CB TestDialog_SignalHandler(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender) { fprintf(stderr, "Received event %d from widget [%s]\n", t, sender); switch(t) { case GWEN_DialogEvent_TypeInit: /* This is the init event. It is issued immediately before showing the * dialog on screen. Only after this signal has been received the properties * of a dialog are accessible. */ fprintf(stderr, "Init\n"); /* add some entries to the ComboBox "combo1" */ GWEN_Dialog_SetCharProperty(dlg, "combo1", GWEN_DialogProperty_AddValue, 0, "Erster Text in Combo1", 0); GWEN_Dialog_SetCharProperty(dlg, "combo1", GWEN_DialogProperty_AddValue, 0, "Zweiter Text in Combo1", 0); /* select first entry (entry 0) of the ComboBo "combo1" */ GWEN_Dialog_SetIntProperty(dlg, "combo1", GWEN_DialogProperty_Value, 0, 0, 0); /* same for ComboBox "combo2" */ GWEN_Dialog_SetCharProperty(dlg, "combo2", GWEN_DialogProperty_AddValue, 0, "Erster Text in Combo2", 0); GWEN_Dialog_SetCharProperty(dlg, "combo2", GWEN_DialogProperty_AddValue, 0, "Zweiter Text in Combo2", 0); GWEN_Dialog_SetIntProperty(dlg, "combo2", GWEN_DialogProperty_Value, 0, 0, 0); /* set the title of the ListBox "listbox1". Please note that multiple * columns can be specified here (separated by TAB, i.e. '\t') */ GWEN_Dialog_SetCharProperty(dlg, "listbox1", GWEN_DialogProperty_Title, 0, "Column1\tColumn2", 0); /* add some entries to the ListBox "listbox1". As with the title * multiple columns can be specified (separated by TAB). */ GWEN_Dialog_SetCharProperty(dlg, "listbox1", GWEN_DialogProperty_AddValue, 0, "Zeile 1 Spalte 1\tZeile 1 Spalte 2", 0); GWEN_Dialog_SetCharProperty(dlg, "listbox1", GWEN_DialogProperty_AddValue, 0, "Zeile 2 Spalte 1\tZeile 2 Spalte 2", 0); /* for every column of a ListBox the width can be specified. This is done * by modification of the property "ColumnWidth". In this example we set * the width of column 0 to 100 pixel and that of column 1 to 200 pixel. */ GWEN_Dialog_SetIntProperty(dlg, "listbox1", GWEN_DialogProperty_ColumnWidth, 0, 100, 0); GWEN_Dialog_SetIntProperty(dlg, "listbox1", GWEN_DialogProperty_ColumnWidth, 1, 200, 0); /* Set the width and height of the dialog itself to 640x480 pixel. * As you can see specifying the dialog itself is done by providing * an empty widget name. */ GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, 640, 0); GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, 480, 0); break; case GWEN_DialogEvent_TypeFini: /* this is the fini signal. It is emitted immediately after hiding * the dialog from screen. After this signal handler returns the * properties of this dialog are no longer accessible. */ fprintf(stderr, "Fini\n"); break; case GWEN_DialogEvent_TypeValueChanged: /* this signal is emitted by some of the widgets when its value * has changed. For LineEdit widgets this event occurrs when something * is entered into the text field, for a ListBox this is emitted when * another entry from the ListBox is selected. */ fprintf(stderr, "ValueChanged\n"); if (strcasecmp(sender, "listbox1")==0) { fprintf(stderr, "Selected list entry %d\n", GWEN_Dialog_GetIntProperty(dlg, "listbox1", GWEN_DialogProperty_Value, 0, -1)); } break; /* this signal is emitted by some widgets upon activation, e.g. a Button * widget sends this signal when it is clicked. */ case GWEN_DialogEvent_TypeActivated: fprintf(stderr, "Activated\n"); if (strcasecmp(sender, "okButton")==0) return GWEN_DialogEvent_ResultAccept; else if (strcasecmp(sender, "abortButton")==0) return GWEN_DialogEvent_ResultReject; break; case GWEN_DialogEvent_TypeClose: /* this signal is emitted by the dialog when closing of the dialog is * requested (e.g. by clicking the little X in the title bar). * If the dialog doesn't want to be closed you can return * GWEN_DialogEvent_ResultReject here. */ fprintf(stderr, "Close\n"); return GWEN_DialogEvent_ResultNotHandled; default: fprintf(stderr, "Unhandled signal, ignored\n"); return GWEN_DialogEvent_ResultNotHandled; } return GWEN_DialogEvent_ResultHandled; }
void AO_NewUserDialog_Init(GWEN_DIALOG *dlg) { AO_NEWUSER_DIALOG *xdlg; GWEN_DB_NODE *dbPrefs; int i; const AO_APPINFO *ai; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AO_NEWUSER_DIALOG, dlg); assert(xdlg); dbPrefs=GWEN_Dialog_GetPreferences(dlg); GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, I18N("OFX DirectConnect Setup Wizard"), 0); /* select first page */ GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, 0, 0); /* setup intro page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_begin_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>This dialog assists you in setting up an OFX DirectConnect User.</p>" "</html>" "This dialog assists you in setting up an OFX DirectConnect User."), 0); /* setup bank page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_bank_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>Please enter your bank settings below.</p>" "<p>Click the <b>Select</b> button to choose from a list of " "known banks. That will connect to <i>www.ofxhome.com</i> and " "try to retrieve information about your bank.</p>" "<p>If you had to manually enter this information because your " "bank was unknown to <i>www.ofxhome.com</i> you are kindly " "asked to submit your bank server information there to help " "the next user.</p>" "</html>" "Click the SELECT button to choose from a list of\n" "known banks. That will connect to \"www.ofxhome.com\" and\n" "try to retrieve information about your bank.\n" "If you had to manually enter this information because your\n" "bank was unknown to \"www.ofxhome.com\" you are kindly\n" "asked to submit your bank server information there to help\n" "the next user."), 0); /* setup user page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_user_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>Please enter your user settings below.</p>" "<p><i>User Name</i> is your real name, <i>User Id</i> is " "assigned to you by the bank after applying for OFX DirectConnect " "and <i>Client UID</i> is used by some banks only. If you do not have such " "a value in your documents from the bank just leave it blank.</p>" "</html>" "Please enter your user settings below.\n" "\"User Name\" is your real name, \"User Id\" is\n" "assigned to you by the bank after applying for OFX DirectConnect\n" "and \"Client UID\" is used by some banks. If you do not have such\n" "a value in your documents from the bank just leave it blank."), 0); /* setup application page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_app_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>Please choose the application you want AqBanking to emulate. " "Not all banks support all applications and versions, you might have " "to try multiple settings.</p>" "</html>" "Please choose the application you want AqBanking to emulate.\n" "Not all banks support all applications and versions, you might have\n" "to try multiple settings."), 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_app_combo", GWEN_DialogProperty_ClearValues, 0, 0, 0); GWEN_Dialog_SetCharProperty(dlg, "wiz_app_combo", GWEN_DialogProperty_AddValue, 0, I18N("-- select --"), 0); ai=AO_Provider_GetAppInfos(xdlg->provider); if (ai) { const AO_APPINFO *first; first=ai; while (ai->appName) { GWEN_Dialog_SetCharProperty(dlg, "wiz_app_combo", GWEN_DialogProperty_AddValue, 0, I18N(ai->appName), 0); ai++; } if (first->appName) { GWEN_Dialog_SetIntProperty(dlg, "wiz_app_combo", GWEN_DialogProperty_Value, 0, 1, 0); if (first->appId) GWEN_Dialog_SetCharProperty(dlg, "wiz_appid_edit", GWEN_DialogProperty_Value, 0, first->appId, 0); if (first->appVer) GWEN_Dialog_SetCharProperty(dlg, "wiz_appver_edit", GWEN_DialogProperty_Value, 0, first->appVer, 0); } } GWEN_Dialog_SetCharProperty(dlg, "wiz_headerver_edit", GWEN_DialogProperty_Value, 0, "102", 0); /* setup creation page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_create_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>We are now ready to create the user.</p>" "<p>Click the <i>next</i> button to proceed or <i>abort</i> to abort.</p>" "</html>" "We are now ready to create the user.\n" "Click the NEXT button to proceed or ABORT to abort."), 0); /* setup extro page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_end_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>The user has been successfully setup.</p>" "<p>You can now try to retrieve the list of accounts the " "bank allows you to manage via OFX DirectConnect.</p>" "<p>Please note that not every banks supports this. If your " "bank does not support account list download you will have to " "add the account manually.</p>" "</html>" "The user has been successfully setup.\n" "You can now try to retrieve the list of accounts the\n" "bank allows you to manage via OFX DirectConnect.\n" "Please note that not every banks supports this. If your\n" "bank does not support account list download you will have to\n" "add the account manually." ), 0); /* read width */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_width", 0, -1); if (i>=DIALOG_MINWIDTH) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0); /* read height */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_height", 0, -1); if (i>=DIALOG_MINHEIGHT) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0); /* disable next and previous buttons */ GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); }
static int readTestData(GWEN_DIALOG *dlg) { AB_CSV_EDIT_PROFILE_DIALOG *xdlg; GWEN_SYNCIO *sio; GWEN_SYNCIO *baseIo; GWEN_BUFFER *dbuf; int i; int ignoreLines=0; int rv; const char *delimiter; GWEN_BUFFER *wbuffer; const char *s; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_CSV_EDIT_PROFILE_DIALOG, dlg); assert(xdlg); GWEN_StringList_Clear(xdlg->columns); /* create file IO */ sio=GWEN_SyncIo_File_new(xdlg->testFileName, GWEN_SyncIo_File_CreationMode_OpenExisting); GWEN_SyncIo_AddFlags(sio, GWEN_SYNCIO_FILE_FLAGS_READ); baseIo=sio; /* create buffered IO on top of file io to allow for reading of lines below */ sio=GWEN_SyncIo_Buffered_new(baseIo); dbuf=GWEN_Buffer_new(0, 1024, 0, 1); /* skip lines */ ignoreLines=GWEN_Dialog_GetIntProperty(dlg, "ignoreLinesSpin", GWEN_DialogProperty_Value, 0, 0); i=GWEN_Dialog_GetIntProperty(dlg, "headerCheck", GWEN_DialogProperty_Value, 0, 0); if (i) ignoreLines++; delimiter=getCharValueFromDoubleStringsCombo(dlg, "delimiterCombo", csv_delimiters); if (!(delimiter && *delimiter)) delimiter="TAB"; if (strcasecmp(delimiter, "TAB")==0) delimiter="\t"; else if (strcasecmp(delimiter, "SPACE")==0) delimiter=" "; /* open file */ rv=GWEN_SyncIo_Connect(sio); if (rv<0) { DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv); GWEN_Buffer_free(dbuf); GWEN_SyncIo_free(sio); return rv; } for (i=0; i<ignoreLines; i++) { rv=GWEN_SyncIo_Buffered_ReadLineToBuffer(sio, dbuf); if (rv<0) { DBG_ERROR(AQBANKING_LOGDOMAIN, "Error reading: %d", rv); GWEN_Buffer_free(dbuf); GWEN_SyncIo_Disconnect(sio); GWEN_SyncIo_free(sio); return rv; } GWEN_Buffer_Reset(dbuf); } /* read single data line */ rv=GWEN_SyncIo_Buffered_ReadLineToBuffer(sio, dbuf); if (rv<0) { DBG_ERROR(AQBANKING_LOGDOMAIN, "Error reading: %d", rv); GWEN_Buffer_free(dbuf); GWEN_SyncIo_Disconnect(sio); GWEN_SyncIo_free(sio); return rv; } GWEN_Dialog_SetCharProperty(dlg, "dataEdit", GWEN_DialogProperty_Value, 0, GWEN_Buffer_GetStart(dbuf), 0); /* we don't need the io layer any longer */ GWEN_SyncIo_Disconnect(sio); GWEN_SyncIo_free(sio); wbuffer=GWEN_Buffer_new(0, 256, 0, 1); s=GWEN_Buffer_GetStart(dbuf); while (*s) { rv=GWEN_Text_GetWordToBuffer(s, delimiter, wbuffer, GWEN_TEXT_FLAGS_DEL_LEADING_BLANKS | GWEN_TEXT_FLAGS_DEL_TRAILING_BLANKS | GWEN_TEXT_FLAGS_NULL_IS_DELIMITER | GWEN_TEXT_FLAGS_DEL_QUOTES, &s); if (rv) { DBG_DEBUG(AQBANKING_LOGDOMAIN, "here (%d)", rv); GWEN_Buffer_free(wbuffer); GWEN_Buffer_free(dbuf); return rv; } GWEN_StringList_AppendString(xdlg->columns, GWEN_Buffer_GetStart(wbuffer), 0, 0); GWEN_Buffer_Reset(wbuffer); if (*s) { if (strchr(delimiter, *s)) s++; } } /* while */ GWEN_Buffer_free(wbuffer); for (i=0; i<DIALOG_MAX_COLUMNS; i++) { char editName[32]; snprintf(editName, sizeof(editName)-1, "col%dDataEdit", i+1); s=GWEN_StringList_StringAt(xdlg->columns, i); if (s==NULL) break; GWEN_Dialog_SetCharProperty(dlg, editName, GWEN_DialogProperty_Value, 0, s, 0); } return 0; }
void AB_CSV_EditProfileDialog_Init(GWEN_DIALOG *dlg) { AB_CSV_EDIT_PROFILE_DIALOG *xdlg; int i; const char *s; GWEN_DB_NODE *dbPrefs; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_CSV_EDIT_PROFILE_DIALOG, dlg); assert(xdlg); /* setup dialog size */ dbPrefs=GWEN_Dialog_GetPreferences(dlg); /* read width */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_width", 0, -1); if (i>=DIALOG_MINWIDTH) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0); /* read height */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_height", 0, -1); if (i>=DIALOG_MINHEIGHT) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0); GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, I18N("Edit CSV Profile"), 0); /* setup dialog widgets */ s=GWEN_DB_GetCharValue(xdlg->dbProfile, "name", 0, NULL); if (s && *s) GWEN_Dialog_SetCharProperty(dlg, "nameEdit", GWEN_DialogProperty_Value, 0, s, 0); s=GWEN_DB_GetCharValue(xdlg->dbProfile, "version", 0, NULL); if (s && *s) GWEN_Dialog_SetCharProperty(dlg, "versionEdit", GWEN_DialogProperty_Value, 0, s, 0); s=GWEN_DB_GetCharValue(xdlg->dbProfile, "shortDescr", 0, NULL); if (s && *s) GWEN_Dialog_SetCharProperty(dlg, "shortDescrEdit", GWEN_DialogProperty_Value, 0, s, 0); s=GWEN_DB_GetCharValue(xdlg->dbProfile, "longDescr", 0, NULL); if (s && *s) GWEN_Dialog_SetCharProperty(dlg, "longDescrEdit", GWEN_DialogProperty_Value, 0, s, 0); i=GWEN_DB_GetIntValue(xdlg->dbProfile, "import", 0, 1); GWEN_Dialog_SetIntProperty(dlg, "importCheck", GWEN_DialogProperty_Value, 0, i?1:0, 0); i=GWEN_DB_GetIntValue(xdlg->dbProfile, "export", 0, 1); GWEN_Dialog_SetIntProperty(dlg, "exportCheck", GWEN_DialogProperty_Value, 0, i?1:0, 0); GWEN_Dialog_SetIntProperty(dlg, "ignoreLinesSpin", GWEN_DialogProperty_MinValue, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "ignoreLinesSpin", GWEN_DialogProperty_MaxValue, 0, 1000, 0); i=GWEN_DB_GetIntValue(xdlg->dbProfile, "params/ignoreLines", 0, 0); GWEN_Dialog_SetIntProperty(dlg, "ignoreLinesSpin", GWEN_DialogProperty_Value, 0, i, 0); i=GWEN_DB_GetIntValue(xdlg->dbProfile, "params/title", 0, 0); GWEN_Dialog_SetIntProperty(dlg, "headerCheck", GWEN_DialogProperty_Value, 0, i?1:0, 0); i=GWEN_DB_GetIntValue(xdlg->dbProfile, "params/quote", 0, 1); GWEN_Dialog_SetIntProperty(dlg, "quoteCheck", GWEN_DialogProperty_Value, 0, i?1:0, 0); /* setup delimiter combo box */ s=GWEN_DB_GetCharValue(xdlg->dbProfile, "params/delimiter", 0, NULL); setUpComboFromDoubleStrings(dlg, "delimiterCombo", csv_delimiters, s); /* setup subject combo box */ s=GWEN_DB_GetCharValue(xdlg->dbProfile, "subject", 0, NULL); setUpComboFromDoubleStrings(dlg, "subjectCombo", csv_subjects, s); /* setup date format combo box */ s=GWEN_DB_GetCharValue(xdlg->dbProfile, "dateFormat", 0, NULL); setUpComboFromSingleStrings(dlg, "dateFormatCombo", csv_dateFormats, s); /* setup amount format combo box */ s=GWEN_DB_GetCharValue(xdlg->dbProfile, "valueFormat", 0, NULL); setUpComboFromDoubleStrings(dlg, "amountFormatCombo", csv_amountFormats, s); /* setup columns page */ for (i=0; i<DIALOG_MAX_COLUMNS; i++) { char varName[32]; char comboName[32]; char editName[32]; snprintf(varName, sizeof(varName)-1, "params/columns/%d", i+1); snprintf(comboName, sizeof(comboName)-1, "col%dCombo", i+1); snprintf(editName, sizeof(editName)-1, "col%dDataEdit", i+1); s=GWEN_DB_GetCharValue(xdlg->dbProfile, varName, 0, NULL); setUpComboFromDoubleStrings(dlg, comboName, csv_columns, s); } if (xdlg->testFileName) readTestData(dlg); }
void AB_SelectBankInfoDialog_Init(GWEN_DIALOG *dlg) { AB_SELECTBANKINFO_DIALOG *xdlg; GWEN_DB_NODE *dbPrefs; int i; int j; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SELECTBANKINFO_DIALOG, dlg); assert(xdlg); dbPrefs=GWEN_Dialog_GetPreferences(dlg); GWEN_Dialog_SetCharProperty(dlg, "blzEdit", GWEN_DialogProperty_Value, 0, xdlg->bankCode, 0); GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, I18N("Select a Bank"), 0); GWEN_Dialog_SetCharProperty(dlg, "listBox", GWEN_DialogProperty_Title, 0, I18N("Bank Code\tBIC\tName\tLocation\tProtocols"), 0); GWEN_Dialog_SetIntProperty(dlg, "listBox", GWEN_DialogProperty_SelectionMode, 0, GWEN_Dialog_SelectionMode_Single, 0); /* read width */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_width", 0, -1); if (i>=DIALOG_MINWIDTH) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0); /* read height */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_height", 0, -1); if (i>=DIALOG_MINHEIGHT) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0); /* read bank column widths */ for (i=0; i<5; i++) { j=GWEN_DB_GetIntValue(dbPrefs, "bank_list_columns", i, -1); if (j<LIST_MINCOLWIDTH) j=LIST_MINCOLWIDTH; GWEN_Dialog_SetIntProperty(dlg, "listBox", GWEN_DialogProperty_ColumnWidth, i, j, 0); } /* get sort column */ i=GWEN_DB_GetIntValue(dbPrefs, "bank_list_sortbycolumn", 0, -1); j=GWEN_DB_GetIntValue(dbPrefs, "bank_list_sortdir", 0, -1); if (i>=0 && j>=0) GWEN_Dialog_SetIntProperty(dlg, "listBox", GWEN_DialogProperty_SortDirection, i, j, 0); /* disable ok button */ GWEN_Dialog_SetIntProperty(dlg, "okButton", GWEN_DialogProperty_Enabled, 0, 0, 0); }
void AH_NewKeyFileDialog_Init(GWEN_DIALOG *dlg) { AH_NEWKEYFILE_DIALOG *xdlg; GWEN_DB_NODE *dbPrefs; int i; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg); assert(xdlg); dbPrefs=GWEN_Dialog_GetPreferences(dlg); GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, I18N("HBCI Keyfile Setup Wizard"), 0); /* select first page */ GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, 0, 0); /* setup intro page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_begin_label", GWEN_DialogProperty_Title, 0, I18N("This dialog assists you in setting up a Keyfile User.\n"), 0); /* setup bank page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_bank_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>Please select the bank.</p>" "<p>AqBanking has an internal database which " "contains HBCI/FinTS information about many banks.<p>" "<p>If there is an entry for your bank this dialog will use the " "information from the database.</p>" "</html>" "Please select the bank.\n" "AqBanking has an internal database which contains\n" "HBCI/FinTS information about many banks.\n" "If there is an entry for your bank this dialog will use the\n" "information from the database."), 0); /* setup user page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_user_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>For most banks the customer id must be the same as the user id.</p>" "<p>However, some banks actually use the customer id, so please look into " "the documentation provided by your bank to discover whether this is the " "case with your bank.</p>" "</html>" "For most banks the customer id must be the same as the user id.\n" "However, some banks actually use the customer id, so please look into\n" "the documentation provided by your bank to discover whether this is the\n" "case with your bank."), 0); /* setup creation page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_create_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>We are now ready to create the user and exchange keys with the server.</p>" "<p>Click the <i>next</i> button to proceed or <i>abort</i> to abort.</p>" "</html>" "We are now ready to create the user and exchange keys with the server.\n" "Click the NEXT button to proceed or ABORT to abort."), 0); /* setup extro page */ GWEN_Dialog_SetCharProperty(dlg, "wiz_end_label", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>The user has been successfully created.</p>" "<p>You must now <b>print</b> the INI letter (click the button below) " "and <b>send</b> it to the bank.</p> " "<p>The activation of your account by the bank can take a few days.</p>" "</html>" "The user has been successfully created.\n" "You must now PRINT the INI letter (click the button below)\n" "and SEND it to the bank.\n" "The activation of your account by the bank can take a few days."), 0); /* read width */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_width", 0, -1); if (i>=DIALOG_MINWIDTH) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0); /* read height */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_height", 0, -1); if (i>=DIALOG_MINHEIGHT) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0); /* disable next and previous buttons */ GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); }
void AB_SelectBankInfoDialog_UpdateList(GWEN_DIALOG *dlg) { AB_SELECTBANKINFO_DIALOG *xdlg; AB_BANKINFO *tbi; const char *s; AB_BANKINFO_LIST2 *bl; int rv; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SELECTBANKINFO_DIALOG, dlg); assert(xdlg); /* clear bank info list */ GWEN_Dialog_SetIntProperty(dlg, "listBox", GWEN_DialogProperty_ClearValues, 0, 0, 0); if (xdlg->matchingBankInfos) AB_BankInfo_List2_freeAll(xdlg->matchingBankInfos); xdlg->matchingBankInfos=NULL; /* setup template */ tbi=AB_BankInfo_new(); /* set country */ AB_BankInfo_SetCountry(tbi, xdlg->country); /* set bank code */ s=GWEN_Dialog_GetCharProperty(dlg, "blzEdit", GWEN_DialogProperty_Value, 0, NULL); if (s && *s) { int len; char *cpy; len=strlen(s); cpy=(char *) malloc(len+2); assert(cpy); memmove(cpy, s, len+1); /* copy including terminating zero char */ removeAllSpaces((uint8_t *)cpy); len=strlen(cpy); if (len) { /* append joker */ cpy[len]='*'; cpy[len+1]=0; } AB_BankInfo_SetBankId(tbi, cpy); free(cpy); } /* set bank code */ s=GWEN_Dialog_GetCharProperty(dlg, "bicEdit", GWEN_DialogProperty_Value, 0, NULL); if (s && *s) { int len; char *cpy; len=strlen(s); cpy=(char *) malloc(len+2); assert(cpy); memmove(cpy, s, len+1); /* copy including terminating zero char */ removeAllSpaces((uint8_t *)cpy); len=strlen(cpy); if (len) { /* append joker */ cpy[len]='*'; cpy[len+1]=0; } AB_BankInfo_SetBic(tbi, cpy); free(cpy); } /* set bank name */ s=GWEN_Dialog_GetCharProperty(dlg, "nameEdit", GWEN_DialogProperty_Value, 0, NULL); if (s && *s) { GWEN_BUFFER *tbuf; tbuf=GWEN_Buffer_new(0, 256, 0, 1); GWEN_Buffer_AppendString(tbuf, s); GWEN_Text_CondenseBuffer(tbuf); GWEN_Buffer_AppendString(tbuf, "*"); AB_BankInfo_SetBankName(tbi, GWEN_Buffer_GetStart(tbuf)); GWEN_Buffer_free(tbuf); } /* set bank name */ s=GWEN_Dialog_GetCharProperty(dlg, "locationEdit", GWEN_DialogProperty_Value, 0, NULL); if (s && *s) { GWEN_BUFFER *tbuf; tbuf=GWEN_Buffer_new(0, 256, 0, 1); GWEN_Buffer_AppendString(tbuf, s); GWEN_Text_CondenseBuffer(tbuf); GWEN_Buffer_AppendString(tbuf, "*"); AB_BankInfo_SetLocation(tbi, GWEN_Buffer_GetStart(tbuf)); GWEN_Buffer_free(tbuf); } bl=AB_BankInfo_List2_new(); rv=AB_Banking_GetBankInfoByTemplate(xdlg->banking, xdlg->country, tbi, bl); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv); AB_BankInfo_List2_freeAll(bl); } else { AB_BANKINFO_LIST2_ITERATOR *it; it=AB_BankInfo_List2_First(bl); if (it) { AB_BANKINFO *bi; GWEN_BUFFER *tbuf; tbuf=GWEN_Buffer_new(0, 256, 0, 1); bi=AB_BankInfo_List2Iterator_Data(it); while (bi) { createListBoxString(bi, tbuf); GWEN_Dialog_SetCharProperty(dlg, "listBox", GWEN_DialogProperty_AddValue, 0, GWEN_Buffer_GetStart(tbuf), 0); GWEN_Buffer_Reset(tbuf); bi=AB_BankInfo_List2Iterator_Next(it); } GWEN_Buffer_free(tbuf); AB_BankInfo_List2Iterator_free(it); } xdlg->matchingBankInfos=bl; } AB_BankInfo_free(tbi); if (GWEN_Dialog_GetIntProperty(dlg, "listBox", GWEN_DialogProperty_Value, 0, -1)>=0) GWEN_Dialog_SetIntProperty(dlg, "okButton", GWEN_DialogProperty_Enabled, 0, 1, 0); else GWEN_Dialog_SetIntProperty(dlg, "okButton", GWEN_DialogProperty_Enabled, 0, 0, 0); }
void AB_SetupDialog_Init(GWEN_DIALOG *dlg) { AB_SETUP_DIALOG *xdlg; GWEN_DB_NODE *dbPrefs; int i; int j; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_DIALOG, dlg); assert(xdlg); dbPrefs=GWEN_Dialog_GetPreferences(dlg); GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, I18N("AqBanking Setup"), 0); /* user list */ GWEN_Dialog_SetCharProperty(dlg, "userListBox", GWEN_DialogProperty_Title, 0, I18N("Id\tBank Code\tUser Id\tCustomer Id\tUser Name\tModule"), 0); GWEN_Dialog_SetIntProperty(dlg, "userListBox", GWEN_DialogProperty_SelectionMode, 0, GWEN_Dialog_SelectionMode_Single, 0); /* account list */ GWEN_Dialog_SetCharProperty(dlg, "accountListBox", GWEN_DialogProperty_Title, 0, I18N("Id\tBank Code\tBank Name\tAccount Number\tAccount Name\tOwner Name\tModule"), 0); GWEN_Dialog_SetIntProperty(dlg, "accountListBox", GWEN_DialogProperty_SelectionMode, 0, GWEN_Dialog_SelectionMode_Single, 0); /* read width */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_width", 0, -1); if (i>=DIALOG_MINWIDTH) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0); /* read height */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_height", 0, -1); if (i>=DIALOG_MINHEIGHT) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0); /* read user column widths */ for (i=0; i<6; i++) { j=GWEN_DB_GetIntValue(dbPrefs, "user_list_columns", i, -1); if (j<USER_LIST_MINCOLWIDTH) j=USER_LIST_MINCOLWIDTH; GWEN_Dialog_SetIntProperty(dlg, "userListBox", GWEN_DialogProperty_ColumnWidth, i, j, 0); } /* get sort column */ i=GWEN_DB_GetIntValue(dbPrefs, "user_list_sortbycolumn", 0, -1); j=GWEN_DB_GetIntValue(dbPrefs, "user_list_sortdir", 0, -1); if (i>=0 && j>=0) GWEN_Dialog_SetIntProperty(dlg, "userListBox", GWEN_DialogProperty_SortDirection, i, j, 0); /* read account column widths */ for (i=0; i<7; i++) { j=GWEN_DB_GetIntValue(dbPrefs, "account_list_columns", i, -1); if (j<ACCOUNT_LIST_MINCOLWIDTH) j=ACCOUNT_LIST_MINCOLWIDTH; GWEN_Dialog_SetIntProperty(dlg, "accountListBox", GWEN_DialogProperty_ColumnWidth, i, j, 0); } /* get sort column */ i=GWEN_DB_GetIntValue(dbPrefs, "account_list_sortbycolumn", 0, -1); j=GWEN_DB_GetIntValue(dbPrefs, "account_list_sortdir", 0, -1); if (i>=0 && j>=0) GWEN_Dialog_SetIntProperty(dlg, "accountListBox", GWEN_DialogProperty_SortDirection, i, j, 0); /* activate providers */ AB_SetupDialog_ActivateProviders(dlg); /* reload accounts and users */ AB_SetupDialog_Reload(dlg); }
void OH_GetInstituteDialog_Init(GWEN_DIALOG *dlg) { OH_GETINST_DIALOG *xdlg; GWEN_DB_NODE *dbPrefs; int i; int j; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, OH_GETINST_DIALOG, dlg); assert(xdlg); dbPrefs=GWEN_Dialog_GetPreferences(dlg); GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, I18N("Select a Bank"), 0); GWEN_Dialog_SetCharProperty(dlg, "listBox", GWEN_DialogProperty_Title, 0, I18N("Bank Name"), 0); GWEN_Dialog_SetIntProperty(dlg, "listBox", GWEN_DialogProperty_SelectionMode, 0, GWEN_Dialog_SelectionMode_Single, 0); GWEN_Dialog_SetCharProperty(dlg, "infoLabel", GWEN_DialogProperty_Title, 0, I18N("<html>" "<p>Please start typing in the name of your bank. The list " "below will be updated to show matching banks.</p>" "<p>Choose the bank from list below and click <b>ok</b>.</p>" "</html>" "Please start typing in the name of your bank. The list\n" "below will be updated to show matching banks.\n" "Choose the bank from list below and click OK."), 0); /* read width */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_width", 0, -1); if (i>=DIALOG_MINWIDTH) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0); /* read height */ i=GWEN_DB_GetIntValue(dbPrefs, "dialog_height", 0, -1); if (i>=DIALOG_MINHEIGHT) GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0); /* read bank column widths */ for (i=0; i<1; i++) { j=GWEN_DB_GetIntValue(dbPrefs, "bank_list_columns", i, -1); if (j<LIST_MINCOLWIDTH) j=LIST_MINCOLWIDTH; GWEN_Dialog_SetIntProperty(dlg, "listBox", GWEN_DialogProperty_ColumnWidth, i, j, 0); } /* get sort column */ i=GWEN_DB_GetIntValue(dbPrefs, "bank_list_sortbycolumn", 0, -1); j=GWEN_DB_GetIntValue(dbPrefs, "bank_list_sortdir", 0, -1); if (i>=0 && j>=0) GWEN_Dialog_SetIntProperty(dlg, "listBox", GWEN_DialogProperty_SortDirection, i, j, 0); /* disable ok button */ GWEN_Dialog_SetIntProperty(dlg, "okButton", GWEN_DialogProperty_Enabled, 0, 0, 0); }
int AO_NewUserDialog_HandleActivatedBankSelect(GWEN_DIALOG *dlg) { AO_NEWUSER_DIALOG *xdlg; int rv; GWEN_DIALOG *dlg2; GWEN_BUFFER *tbuf; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AO_NEWUSER_DIALOG, dlg); assert(xdlg); /* get data dir */ tbuf=GWEN_Buffer_new(0, 256, 0, 1); rv=AB_Banking_GetProviderUserDataDir(xdlg->banking, "aqofxconnect", tbuf); if (rv<0) { DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "here (%d)", rv); GWEN_Buffer_free(tbuf); return GWEN_DialogEvent_ResultHandled; } GWEN_Buffer_AppendString(tbuf, GWEN_DIR_SEPARATOR_S "ofxhome"); /* possibly create data folder */ rv=GWEN_Directory_GetPath(GWEN_Buffer_GetStart(tbuf), GWEN_PATH_FLAGS_CHECKROOT); if (rv<0) { DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "here (%d)", rv); GWEN_Buffer_free(tbuf); return GWEN_DialogEvent_ResultHandled; } dlg2=OH_GetInstituteDialog_new(GWEN_Buffer_GetStart(tbuf), NULL); GWEN_Buffer_free(tbuf); if (dlg2==NULL) { DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Could not create dialog"); return GWEN_DialogEvent_ResultHandled; } rv=GWEN_Gui_ExecDialog(dlg2, 0); if (rv<=0) { DBG_DEBUG(AQOFXCONNECT_LOGDOMAIN, "Dialog: rejected (%d)", rv); return GWEN_DialogEvent_ResultHandled; } else { const OH_INSTITUTE_DATA *od; DBG_DEBUG(AQOFXCONNECT_LOGDOMAIN, "Dialog: rejected (%d)", rv); od=OH_GetInstituteDialog_GetSelectedInstitute(dlg2); if (od) { const char *s; s=OH_InstituteData_GetName(od); if (s && *s) GWEN_Dialog_SetCharProperty(dlg, "wiz_bankname_edit", GWEN_DialogProperty_Value, 0, s, 0); s=OH_InstituteData_GetFid(od); if (s && *s) GWEN_Dialog_SetCharProperty(dlg, "wiz_fid_edit", GWEN_DialogProperty_Value, 0, s, 0); s=OH_InstituteData_GetOrg(od); if (s && *s) GWEN_Dialog_SetCharProperty(dlg, "wiz_org_edit", GWEN_DialogProperty_Value, 0, s, 0); s=OH_InstituteData_GetUrl(od); if (s && *s) GWEN_Dialog_SetCharProperty(dlg, "wiz_url_edit", GWEN_DialogProperty_Value, 0, s, 0); rv=AO_NewUserDialog_GetBankPageData(dlg); if (rv<0) GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 0, 0); else GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); } } GWEN_Dialog_free(dlg2); return GWEN_DialogEvent_ResultHandled; }