void GWEN_DlgShowBox_Fini(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); /* store dialog width */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, -1); if (i<DIALOG_MINWIDTH) i=DIALOG_MINWIDTH; GWEN_DB_SetIntValue(dbParams, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_width", i); /* store dialog height */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, -1); if (i<DIALOG_MINHEIGHT) i=DIALOG_MINHEIGHT; GWEN_DB_SetIntValue(dbParams, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_height", i); }
void AB_CSV_EditProfileDialog_Fini(GWEN_DIALOG *dlg) { AB_CSV_EDIT_PROFILE_DIALOG *xdlg; int i; GWEN_DB_NODE *dbPrefs; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_CSV_EDIT_PROFILE_DIALOG, dlg); assert(xdlg); dbPrefs=GWEN_Dialog_GetPreferences(dlg); /* store dialog width */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, -1); if (i<DIALOG_MINWIDTH) i=DIALOG_MINWIDTH; GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_width", i); /* store dialog height */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, -1); if (i<DIALOG_MINHEIGHT) i=DIALOG_MINHEIGHT; GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_height", i); }
int APY_NewUserDialog_HandleValueChanged(GWEN_DIALOG *dlg, const char *sender) { if (strcasecmp(sender, "wiz_username_edit")==0 || strcasecmp(sender, "wiz_userid_edit")==0 || strcasecmp(sender, "wiz_url_edit")==0 || strcasecmp(sender, "wiz_apiuserid_edit")==0 || strcasecmp(sender, "wiz_apipass_edit")==0 || strcasecmp(sender, "wiz_apisig_edit")==0) { int rv; if (GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1)==PAGE_USER) { 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); } else if (GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1)==PAGE_SECRET) { 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); } return GWEN_DialogEvent_ResultHandled; } return GWEN_DialogEvent_ResultNotHandled; }
void AH_NewKeyFileDialog_Fini(GWEN_DIALOG *dlg) { AH_NEWKEYFILE_DIALOG *xdlg; int i; GWEN_DB_NODE *dbPrefs; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg); assert(xdlg); dbPrefs=GWEN_Dialog_GetPreferences(dlg); /* store dialog width */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, -1); GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_width", i); /* store dialog height */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, -1); GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_height", i); }
int AH_NewKeyFileDialog_HandleValueChanged(GWEN_DIALOG *dlg, const char *sender) { if (strcasecmp(sender, "wiz_filename_edit")==0 || strcasecmp(sender, "wiz_bankcode_edit")==0 || strcasecmp(sender, "wiz_url_edit")==0 || strcasecmp(sender, "wiz_username_edit")==0 || strcasecmp(sender, "wiz_userid_edit")==0 || strcasecmp(sender, "wiz_customerid_edit")==0) { int rv; if (GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1)==PAGE_FILE) { 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 if (GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1)==PAGE_BANK) { rv=AH_NewKeyFileDialog_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); } else if (GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1)==PAGE_USER) { rv=AH_NewKeyFileDialog_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); } return GWEN_DialogEvent_ResultHandled; } return GWEN_DialogEvent_ResultNotHandled; }
void AB_SetupNewUserDialog_Fini(GWEN_DIALOG *dlg) { AB_SETUP_NEWUSER_DIALOG *xdlg; int i; GWEN_DB_NODE *dbPrefs; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_NEWUSER_DIALOG, dlg); assert(xdlg); xdlg->selectedType=0; free(xdlg->selectedBackend); xdlg->selectedBackend=NULL; i=AB_SetupNewUserDialog_DetermineBackendIndex(dlg); if (i>=0) { const char *s; GWEN_DIALOG_LIST2_ITERATOR *it; s=GWEN_StringList_StringAt(xdlg->backendNames, i); if (s && *s) xdlg->selectedBackend=strdup(s); it=GWEN_Dialog_List2_First(xdlg->backendDialogs); if (it) { int j=i; GWEN_DIALOG *cdlg; cdlg=GWEN_Dialog_List2Iterator_Data(it); while(cdlg && j>0) { j--; cdlg=GWEN_Dialog_List2Iterator_Next(it); } GWEN_Dialog_List2Iterator_free(it); if (cdlg) xdlg->selectedType=AB_UserTypePageDialog_GetSelectedType(cdlg); } } /* save dialog settings */ dbPrefs=GWEN_Dialog_GetPreferences(dlg); /* store dialog width */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, -1); GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_width", i); /* store dialog height */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, -1); GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_height", i); }
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_Next(GWEN_DIALOG *dlg) { AB_SETUP_NEWUSER_DIALOG *xdlg; int page; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_NEWUSER_DIALOG, dlg); assert(xdlg); page=GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1); DBG_NOTICE(0, "Value of wiz_stack: %d", page); if (page==PAGE_BEGIN) { DBG_NOTICE(0, "First page"); page++; return AB_SetupNewUserDialog_EnterPage(dlg, page, 1); } if (page==PAGE_BACKEND) { int idx; DBG_NOTICE(0, "Backend page"); idx=AB_SetupNewUserDialog_DetermineBackendIndex(dlg); if (idx!=-1) { page=idx+PAGE_BACKEND+1; return AB_SetupNewUserDialog_EnterPage(dlg, page, 1); } } else if (page>PAGE_BACKEND) return GWEN_DialogEvent_ResultAccept; return GWEN_DialogEvent_ResultHandled; }
int AB_SetupNewUserDialog_DetermineBackendIndex(GWEN_DIALOG *dlg) { AB_SETUP_NEWUSER_DIALOG *xdlg; GWEN_STRINGLISTENTRY *se; int i=0; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_NEWUSER_DIALOG, dlg); assert(xdlg); se=GWEN_StringList_FirstEntry(xdlg->backendRadioNames); while(se) { const char *s; s=GWEN_StringListEntry_Data(se); if (GWEN_Dialog_GetIntProperty(dlg, s, GWEN_DialogProperty_Value, 0, 0)) break; i++; se=GWEN_StringListEntry_Next(se); } if (se) return i; return -1; }
static int setColumnValueFromCombo(GWEN_DIALOG *dlg, GWEN_DB_NODE *db, const char *varName, const char *comboBoxName, const char **strings) { int i; int j; /* count number of string entries */ for (j=0; ; j+=2) { if (strings[j]==NULL) break; } j>>=1; i=GWEN_Dialog_GetIntProperty(dlg, comboBoxName, GWEN_DialogProperty_Value, 0, -1); if (i<0 || i>=j) { DBG_ERROR(AQBANKING_LOGDOMAIN, "Index %d of %s out of range (%d)", i, comboBoxName, j); return GWEN_ERROR_INVALID; } if (i!=0) GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, varName, strings[i*2]); return 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 AH_ChooseUserTypeDialog_Fini(GWEN_DIALOG *dlg) { int i; if (GWEN_Dialog_GetIntProperty(dlg, "hbciPinTanRadio", GWEN_DialogProperty_Value, 0, 0)!=0) i=AqHBCI_NewUserDialog_CodeExistingPinTan; else if (GWEN_Dialog_GetIntProperty(dlg, "hbciUseChipcardRadio", GWEN_DialogProperty_Value, 0, 0)!=0) i=AqHBCI_NewUserDialog_CodeExistingChipcard; else if (GWEN_Dialog_GetIntProperty(dlg, "hbciCreateKeyFileRadio", GWEN_DialogProperty_Value, 0, 0)!=0) i=AqHBCI_NewUserDialog_CodeCreateKeyFile; else if (GWEN_Dialog_GetIntProperty(dlg, "hbciImportKeyFileRadio", GWEN_DialogProperty_Value, 0, 0)!=0) i=AqHBCI_NewUserDialog_CodeExistingKeyFile; else if (GWEN_Dialog_GetIntProperty(dlg, "hbciInitChipcardRadio", GWEN_DialogProperty_Value, 0, 0)!=0) i=AqHBCI_NewUserDialog_CodeCreateChipcard; else i=AqHBCI_NewUserDialog_CodeGeneric; DBG_NOTICE(0, "Setting selected type to %d", i); AB_UserTypePageDialog_SetSelectedType(dlg, i); }
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 AO_NewUserDialog_HandleValueChanged(GWEN_DIALOG *dlg, const char *sender) { if (strcasecmp(sender, "wiz_username_edit")==0 || strcasecmp(sender, "wiz_userid_edit")==0 || strcasecmp(sender, "wiz_url_edit")==0 || strcasecmp(sender, "wiz_brokerid_edit")==0 || strcasecmp(sender, "wiz_fid_edit")==0 || strcasecmp(sender, "wiz_org_edit")==0 || strcasecmp(sender, "wiz_appid_edit")==0 || strcasecmp(sender, "wiz_appver_edit")==0 || strcasecmp(sender, "wiz_headerver_edit")==0) { int rv; if (GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1)==PAGE_BANK) { 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); } else if (GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1)==PAGE_USER) { rv=AO_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); } else if (GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1)==PAGE_APP) { rv=AO_NewUserDialog_GetAppPageData(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); } return GWEN_DialogEvent_ResultHandled; } return GWEN_DialogEvent_ResultNotHandled; }
int AH_NewKeyFileDialog_Previous(GWEN_DIALOG *dlg) { AH_NEWKEYFILE_DIALOG *xdlg; int page; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg); assert(xdlg); page=GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1); if (page>PAGE_BEGIN) { page--; return AH_NewKeyFileDialog_EnterPage(dlg, page, 0); } return GWEN_DialogEvent_ResultHandled; }
AB_BANKINFO *AB_SelectBankInfoDialog_DetermineSelectedBankInfo(GWEN_DIALOG *dlg) { AB_SELECTBANKINFO_DIALOG *xdlg; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SELECTBANKINFO_DIALOG, dlg); assert(xdlg); if (xdlg->matchingBankInfos) { AB_BANKINFO_LIST2_ITERATOR *it; int idx; idx=GWEN_Dialog_GetIntProperty(dlg, "listBox", GWEN_DialogProperty_Value, 0, -1); if (idx>=0) { const char *currentText; currentText=GWEN_Dialog_GetCharProperty(dlg, "listBox", GWEN_DialogProperty_Value, idx, NULL); if (currentText && *currentText) { it=AB_BankInfo_List2_First(xdlg->matchingBankInfos); 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); if (strcasecmp(currentText, GWEN_Buffer_GetStart(tbuf))==0) { GWEN_Buffer_free(tbuf); AB_BankInfo_List2Iterator_free(it); return bi; } GWEN_Buffer_Reset(tbuf); bi=AB_BankInfo_List2Iterator_Next(it); } GWEN_Buffer_free(tbuf); AB_BankInfo_List2Iterator_free(it); } } } } return NULL; }
int AB_SetupNewUserDialog_Previous(GWEN_DIALOG *dlg) { AB_SETUP_NEWUSER_DIALOG *xdlg; int page; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_NEWUSER_DIALOG, dlg); assert(xdlg); page=GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1); if (page>PAGE_BACKEND) { page=PAGE_BACKEND; return AB_SetupNewUserDialog_EnterPage(dlg, page, 0); } if (page==PAGE_BACKEND) { page=PAGE_BEGIN; return AB_SetupNewUserDialog_EnterPage(dlg, page, 0); } return GWEN_DialogEvent_ResultHandled; }
int AH_NewKeyFileDialog_Next(GWEN_DIALOG *dlg) { AH_NEWKEYFILE_DIALOG *xdlg; int page; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg); assert(xdlg); page=GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1); if (page==PAGE_CREATE) { return AH_NewKeyFileDialog_DoIt(dlg); } else if (page<PAGE_END) { page++; return AH_NewKeyFileDialog_EnterPage(dlg, page, 1); } else if (page==PAGE_END) return GWEN_DialogEvent_ResultAccept; return GWEN_DialogEvent_ResultHandled; }
static const char *getCharValueFromDoubleStringsCombo(GWEN_DIALOG *dlg, const char *comboBoxName, const char **strings) { int i; int j; /* count number of string entries */ for (j=0; ; j+=2) { if (strings[j]==NULL) break; } j>>=1; i=GWEN_Dialog_GetIntProperty(dlg, comboBoxName, GWEN_DialogProperty_Value, 0, -1); if (i<0 || i>=j) { DBG_ERROR(AQBANKING_LOGDOMAIN, "Index %d in %s out of range (%d)", i, comboBoxName, j); return NULL; } return strings[i*2]; }
OH_INSTITUTE_SPEC *OH_GetInstituteDialog_DetermineSelectedBankInfo(GWEN_DIALOG *dlg) { OH_GETINST_DIALOG *xdlg; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, OH_GETINST_DIALOG, dlg); assert(xdlg); if (xdlg->matchingSpecList) { int idx; idx=GWEN_Dialog_GetIntProperty(dlg, "listBox", GWEN_DialogProperty_Value, 0, -1); if (idx>=0) { const char *currentText; currentText=GWEN_Dialog_GetCharProperty(dlg, "listBox", GWEN_DialogProperty_Value, idx, NULL); if (currentText && *currentText) { OH_INSTITUTE_SPEC *os; GWEN_BUFFER *tbuf; tbuf=GWEN_Buffer_new(0, 256, 0, 1); os=OH_InstituteSpec_List_First(xdlg->matchingSpecList); while (os) { createListBoxString(os, tbuf); if (strcasecmp(currentText, GWEN_Buffer_GetStart(tbuf))==0) { GWEN_Buffer_free(tbuf); return os; } GWEN_Buffer_Reset(tbuf); os=OH_InstituteSpec_List_Next(os); } GWEN_Buffer_free(tbuf); } } } return NULL; }
uint32_t AB_SetupDialog_GetCurrentId(GWEN_DIALOG *dlg, const char *comboBoxName) { int idx; idx=GWEN_Dialog_GetIntProperty(dlg, comboBoxName, GWEN_DialogProperty_Value, 0, -1); if (idx>=0) { const char *currentText; currentText=GWEN_Dialog_GetCharProperty(dlg, comboBoxName, GWEN_DialogProperty_Value, idx, NULL); if (currentText && *currentText) { unsigned long int uid=0; if (1==sscanf(currentText, "%06lu", &uid)) { DBG_ERROR(AQBANKING_LOGDOMAIN, "Got id \"%lu id from \"%s\"", uid, currentText); return (uint32_t) uid; } else { DBG_ERROR(AQBANKING_LOGDOMAIN, "No id found in \"%s\"", currentText); } } } return 0; }
void OH_GetInstituteDialog_Fini(GWEN_DIALOG *dlg) { OH_GETINST_DIALOG *xdlg; int i; GWEN_DB_NODE *dbPrefs; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, OH_GETINST_DIALOG, dlg); assert(xdlg); dbPrefs=GWEN_Dialog_GetPreferences(dlg); /* store dialog width */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, -1); GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_width", i); /* store dialog height */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, -1); GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_height", i); /* store column widths of importer list */ GWEN_DB_DeleteVar(dbPrefs, "bank_list_columns"); for (i=0; i<1; i++) { int j; j=GWEN_Dialog_GetIntProperty(dlg, "listBox", GWEN_DialogProperty_ColumnWidth, i, -1); if (j<LIST_MINCOLWIDTH) j=LIST_MINCOLWIDTH; GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_DEFAULT, "bank_list_columns", j); } /* store column sorting */ GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "bank_list_sortbycolumn", -1); for (i=0; i<1; i++) { int j; j=GWEN_Dialog_GetIntProperty(dlg, "listBox", GWEN_DialogProperty_SortDirection, i, GWEN_DialogSortDirection_None); if (j!=GWEN_DialogSortDirection_None) { GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "bank_list_sortbycolumn", i); GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "bank_list_sortdir", (j==GWEN_DialogSortDirection_Up)?1:0); break; } } }
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); }
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; }
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 AB_SetupDialog_Fini(GWEN_DIALOG *dlg) { AB_SETUP_DIALOG *xdlg; int i; GWEN_DB_NODE *dbPrefs; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_DIALOG, dlg); assert(xdlg); /* deactivate providers */ AB_SetupDialog_DeactivateProviders(dlg); dbPrefs=GWEN_Dialog_GetPreferences(dlg); /* store dialog width */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, -1); GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_width", i); /* store dialog height */ i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, -1); GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "dialog_height", i); /* store column widths of user list */ GWEN_DB_DeleteVar(dbPrefs, "user_list_columns"); for (i=0; i<6; i++) { int j; j=GWEN_Dialog_GetIntProperty(dlg, "userListBox", GWEN_DialogProperty_ColumnWidth, i, -1); if (j<USER_LIST_MINCOLWIDTH) j=USER_LIST_MINCOLWIDTH; GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_DEFAULT, "user_list_columns", j); } /* store column sorting of user list */ GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "user_list_sortbycolumn", -1); for (i=0; i<6; i++) { int j; j=GWEN_Dialog_GetIntProperty(dlg, "userListBox", GWEN_DialogProperty_SortDirection, i, GWEN_DialogSortDirection_None); if (j!=GWEN_DialogSortDirection_None) { GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "user_list_sortbycolumn", i); GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "user_list_sortdir", (j==GWEN_DialogSortDirection_Up)?1:0); break; } } /* store column widths of account list */ GWEN_DB_DeleteVar(dbPrefs, "account_list_columns"); for (i=0; i<7; i++) { int j; j=GWEN_Dialog_GetIntProperty(dlg, "accountListBox", GWEN_DialogProperty_ColumnWidth, i, -1); if (j<ACCOUNT_LIST_MINCOLWIDTH) j=ACCOUNT_LIST_MINCOLWIDTH; GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_DEFAULT, "account_list_columns", j); } /* store column sorting */ GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "account_list_sortbycolumn", -1); for (i=0; i<7; i++) { int j; j=GWEN_Dialog_GetIntProperty(dlg, "accountListBox", GWEN_DialogProperty_SortDirection, i, GWEN_DialogSortDirection_None); if (j!=GWEN_DialogSortDirection_None) { GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "account_list_sortbycolumn", i); GWEN_DB_SetIntValue(dbPrefs, GWEN_DB_FLAGS_OVERWRITE_VARS, "account_list_sortdir", (j==GWEN_DialogSortDirection_Up)?1:0); break; } } }
int AB_CSV_EditProfileDialog_fromGui(GWEN_DIALOG *dlg, GWEN_DB_NODE *db) { const char *s; int i; s=GWEN_Dialog_GetCharProperty(dlg, "nameEdit", GWEN_DialogProperty_Value, 0, NULL); if (s && *s) GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "name", s); else { GWEN_Gui_MessageBox(GWEN_GUI_MSG_FLAGS_TYPE_ERROR | GWEN_GUI_MSG_FLAGS_CONFIRM_B1 | GWEN_GUI_MSG_FLAGS_SEVERITY_NORMAL, I18N("Input Error"), I18N("Please enter a name for the profile."), I18N("Continue"), 0, 0, 0); /* change focus */ GWEN_Dialog_SetIntProperty(dlg, "nameEdit", GWEN_DialogProperty_Focus, 0, 1, 0); return GWEN_ERROR_BAD_DATA; } s=GWEN_Dialog_GetCharProperty(dlg, "versionEdit", GWEN_DialogProperty_Value, 0, ""); if (s && *s) GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "version", s); s=GWEN_Dialog_GetCharProperty(dlg, "shortDescrEdit", GWEN_DialogProperty_Value, 0, ""); if (s && *s) GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "shortDescr", s); s=GWEN_Dialog_GetCharProperty(dlg, "longDescrEdit", GWEN_DialogProperty_Value, 0, ""); if (s && *s) GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "longDescr", s); i=GWEN_Dialog_GetIntProperty(dlg, "importCheck", GWEN_DialogProperty_Value, 0, 1); GWEN_DB_SetIntValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "import", i); i=GWEN_Dialog_GetIntProperty(dlg, "exportCheck", GWEN_DialogProperty_Value, 0, 1); GWEN_DB_SetIntValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "export", i); i=GWEN_Dialog_GetIntProperty(dlg, "ignoreLinesSpin", GWEN_DialogProperty_Value, 0, 0); GWEN_DB_SetIntValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "params/ignoreLines", i); i=setDbValueFromDoubleStringsCombo(dlg, db, "params/delimiter", "delimiterCombo", csv_delimiters); if (i<0) { GWEN_Gui_MessageBox(GWEN_GUI_MSG_FLAGS_TYPE_ERROR | GWEN_GUI_MSG_FLAGS_CONFIRM_B1 | GWEN_GUI_MSG_FLAGS_SEVERITY_NORMAL, I18N("Input Error"), I18N("Please select a field delimiter."), I18N("Continue"), 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "tabBook", GWEN_DialogProperty_Value, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "delimiterCombo", GWEN_DialogProperty_Focus, 0, 1, 0); return GWEN_ERROR_BAD_DATA; } i=setDbValueFromDoubleStringsCombo(dlg, db, "subject", "subjectCombo", csv_subjects); if (i<0) { GWEN_Dialog_SetIntProperty(dlg, "tabBook", GWEN_DialogProperty_Value, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "subjectCombo", GWEN_DialogProperty_Focus, 0, 1, 0); return GWEN_ERROR_BAD_DATA; } s=GWEN_Dialog_GetCharProperty(dlg, "dateFormatCombo", GWEN_DialogProperty_Value, 0, ""); if (!(s && *s)) { GWEN_Gui_MessageBox(GWEN_GUI_MSG_FLAGS_TYPE_ERROR | GWEN_GUI_MSG_FLAGS_CONFIRM_B1 | GWEN_GUI_MSG_FLAGS_SEVERITY_NORMAL, I18N("Input Error"), I18N("Please select a date format."), I18N("Continue"), 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "tabBook", GWEN_DialogProperty_Value, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "dateFormatCombo", GWEN_DialogProperty_Focus, 0, 1, 0); return GWEN_ERROR_BAD_DATA; } GWEN_DB_SetCharValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "dateFormat", s); i=setDbValueFromDoubleStringsCombo(dlg, db, "valueFormat", "amountFormatCombo", csv_amountFormats); if (i<0) { GWEN_Gui_MessageBox(GWEN_GUI_MSG_FLAGS_TYPE_ERROR | GWEN_GUI_MSG_FLAGS_CONFIRM_B1 | GWEN_GUI_MSG_FLAGS_SEVERITY_NORMAL, I18N("Input Error"), I18N("Please select a value format."), I18N("Continue"), 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "tabBook", GWEN_DialogProperty_Value, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "amountFormatCombo", GWEN_DialogProperty_Focus, 0, 1, 0); return GWEN_ERROR_BAD_DATA; } i=GWEN_Dialog_GetIntProperty(dlg, "headerCheck", GWEN_DialogProperty_Value, 0, 0); GWEN_DB_SetIntValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "params/title", i); i=GWEN_Dialog_GetIntProperty(dlg, "quoteCheck", GWEN_DialogProperty_Value, 0, 1); GWEN_DB_SetIntValue(db, GWEN_DB_FLAGS_OVERWRITE_VARS, "params/quote", i); /* get columns */ GWEN_DB_ClearGroup(db, "params/columns"); for (i=0; i<DIALOG_MAX_COLUMNS; i++) { char varName[32]; char comboName[32]; int rv; snprintf(varName, sizeof(varName)-1, "params/columns/%d", i+1); snprintf(comboName, sizeof(comboName)-1, "col%dCombo", i+1); rv=setColumnValueFromCombo(dlg, db, varName, comboName, csv_columns); if (rv<0) { GWEN_Gui_MessageBox(GWEN_GUI_MSG_FLAGS_TYPE_ERROR | GWEN_GUI_MSG_FLAGS_CONFIRM_B1 | GWEN_GUI_MSG_FLAGS_SEVERITY_NORMAL, I18N("Input Error"), I18N("Please select a valid column type."), I18N("Continue"), 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "tabBook", GWEN_DialogProperty_Value, 0, 1, 0); GWEN_Dialog_SetIntProperty(dlg, comboName, GWEN_DialogProperty_Focus, 0, 1, 0); return GWEN_ERROR_BAD_DATA; } } return 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; }