GWEN_DIALOG *Dlg_Test1_new() { GWEN_DIALOG *dlg; int rv; const char *s; GWEN_BUFFER *tbuf; tbuf=GWEN_Buffer_new(0, 256, 0, 1); s=getenv("DIALOG_DIR"); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); else GWEN_Buffer_AppendString(tbuf, MEDIAPATH); dlg=GWEN_Dialog_new("dlg_test"); GWEN_Dialog_SetSignalHandler(dlg, _gwenGuiSignalHandler); GWEN_Dialog_AddMediaPath(dlg, GWEN_Buffer_GetStart(tbuf)); /* read dialog from dialog description file */ GWEN_Buffer_AppendString(tbuf, GWEN_DIR_SEPARATOR_S "dlg_test.dlg"); rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(tbuf)); GWEN_Buffer_free(tbuf); if (rv<0) { DBG_INFO(GWEN_LOGDOMAIN, "here (%d).", rv); GWEN_Dialog_free(dlg); return NULL; } /* done */ return dlg; }
GWEN_DIALOG *AB_SelectBankInfoDialog_new(AB_BANKING *ab, const char *country, const char *bankCode) { GWEN_DIALOG *dlg; AB_SELECTBANKINFO_DIALOG *xdlg; GWEN_BUFFER *fbuf; int rv; dlg=GWEN_Dialog_new("ab_selectbankinfo"); GWEN_NEW_OBJECT(AB_SELECTBANKINFO_DIALOG, xdlg); GWEN_INHERIT_SETDATA(GWEN_DIALOG, AB_SELECTBANKINFO_DIALOG, dlg, xdlg, AB_SelectBankInfoDialog_FreeData); GWEN_Dialog_SetSignalHandler(dlg, AB_SelectBankInfoDialog_SignalHandler); /* get path of dialog description file */ fbuf=GWEN_Buffer_new(0, 256, 0, 1); rv=GWEN_PathManager_FindFile(AB_PM_LIBNAME, AB_PM_DATADIR, "aqbanking/dialogs/dlg_selectbankinfo.dlg", fbuf); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "Dialog description file not found (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } /* read dialog from dialog description file */ rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(fbuf)); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } GWEN_Buffer_free(fbuf); xdlg->banking=ab; if (country) xdlg->country=strdup(country); else xdlg->country=strdup("de"); if (bankCode) xdlg->bankCode=strdup(bankCode); else xdlg->bankCode=NULL; /* done */ return dlg; }
GWEN_DIALOG *AB_CSV_EditProfileDialog_new(AB_IMEXPORTER *ie, GWEN_DB_NODE *dbProfile, const char *testFileName) { AB_BANKING *ab; GWEN_DIALOG *dlg; AB_CSV_EDIT_PROFILE_DIALOG *xdlg; GWEN_BUFFER *fbuf; int rv; assert(ie); assert(dbProfile); ab=AB_ImExporter_GetBanking(ie); dlg=GWEN_Dialog_new("ab_csv_edit_profile"); GWEN_NEW_OBJECT(AB_CSV_EDIT_PROFILE_DIALOG, xdlg); GWEN_INHERIT_SETDATA(GWEN_DIALOG, AB_CSV_EDIT_PROFILE_DIALOG, dlg, xdlg, AB_CSV_EditProfileDialog_FreeData); GWEN_Dialog_SetSignalHandler(dlg, AB_CSV_EditProfileDialog_SignalHandler); /* get path of dialog description file */ fbuf=GWEN_Buffer_new(0, 256, 0, 1); rv=GWEN_PathManager_FindFile(AB_PM_LIBNAME, AB_PM_DATADIR, "aqbanking/imexporters/csv/dialogs/csv_editprofile.dlg", fbuf); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "Dialog description file not found (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } /* read dialog from dialog description file */ rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(fbuf)); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } GWEN_Buffer_free(fbuf); xdlg->banking=ab; xdlg->imExporter=ie; xdlg->testFileName=testFileName; xdlg->dbProfile=dbProfile; xdlg->columns=GWEN_StringList_new(); /* done */ return dlg; }
GWEN_DIALOG *AB_NewUserDialog_new(AB_BANKING *ab, AB_PROVIDER *pro, const char *dname) { GWEN_DIALOG *dlg; AB_NEWUSER_DIALOG *xdlg; dlg=GWEN_Dialog_new(dname); GWEN_NEW_OBJECT(AB_NEWUSER_DIALOG, xdlg); GWEN_INHERIT_SETDATA(GWEN_DIALOG, AB_NEWUSER_DIALOG, dlg, xdlg, AB_NewUserDialog_FreeData); xdlg->banking=ab; xdlg->provider=pro; return dlg; }
GWEN_DIALOG *GWEN_DlgShowBox_new(uint32_t flags, const char *title, const char *text) { GWEN_DIALOG *dlg; GWEN_DLGSHOWBOX *xdlg; GWEN_BUFFER *fbuf; int rv; dlg=GWEN_Dialog_new("dlg_gwen_showbox"); GWEN_NEW_OBJECT(GWEN_DLGSHOWBOX, xdlg); GWEN_INHERIT_SETDATA(GWEN_DIALOG, GWEN_DLGSHOWBOX, dlg, xdlg, GWEN_DlgShowBox_FreeData); GWEN_Dialog_SetSignalHandler(dlg, GWEN_DlgShowBox_SignalHandler); /* get path of dialog description file */ fbuf=GWEN_Buffer_new(0, 256, 0, 1); rv=GWEN_PathManager_FindFile(GWEN_PM_LIBNAME, GWEN_PM_SYSDATADIR, "gwenhywfar/dialogs/dlg_showbox.dlg", fbuf); if (rv<0) { DBG_INFO(GWEN_LOGDOMAIN, "Dialog description file not found (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } /* read dialog from dialog description file */ rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(fbuf)); if (rv<0) { DBG_INFO(GWEN_LOGDOMAIN, "here (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } GWEN_Buffer_free(fbuf); xdlg->flags=flags; if (title) xdlg->title=strdup(title); if (text) xdlg->text=strdup(text); return dlg; }
GWEN_DIALOG *AH_NewKeyFileDialog_new(AB_BANKING *ab) { GWEN_DIALOG *dlg; AH_NEWKEYFILE_DIALOG *xdlg; GWEN_BUFFER *fbuf; int rv; dlg=GWEN_Dialog_new("ah_setup_newkeyfile"); GWEN_NEW_OBJECT(AH_NEWKEYFILE_DIALOG, xdlg); GWEN_INHERIT_SETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg, xdlg, AH_NewKeyFileDialog_FreeData); GWEN_Dialog_SetSignalHandler(dlg, AH_NewKeyFileDialog_SignalHandler); /* get path of dialog description file */ fbuf=GWEN_Buffer_new(0, 256, 0, 1); rv=GWEN_PathManager_FindFile(AB_PM_LIBNAME, AB_PM_DATADIR, "aqbanking/backends/aqhbci/dialogs/dlg_newkeyfile.dlg", fbuf); if (rv<0) { DBG_INFO(AQHBCI_LOGDOMAIN, "Dialog description file not found (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } /* read dialog from dialog description file */ rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(fbuf)); if (rv<0) { DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d).", rv); GWEN_Gui_ShowError(I18N("Error"), I18N("Could not read dialog description file [%s], maybe an installation error (%d)?"), GWEN_Buffer_GetStart(fbuf), rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } GWEN_Buffer_free(fbuf); xdlg->banking=ab; /* preset */ xdlg->hbciVersion=210; xdlg->rdhVersion=0; /* done */ return dlg; }
GWEN_DIALOG *APY_NewUserDialog_new(AB_BANKING *ab) { GWEN_DIALOG *dlg; APY_NEWUSER_DIALOG *xdlg; GWEN_BUFFER *fbuf; int rv; dlg=GWEN_Dialog_new("apy_newuser"); GWEN_NEW_OBJECT(APY_NEWUSER_DIALOG, xdlg); GWEN_INHERIT_SETDATA(GWEN_DIALOG, APY_NEWUSER_DIALOG, dlg, xdlg, APY_NewUserDialog_FreeData); GWEN_Dialog_SetSignalHandler(dlg, APY_NewUserDialog_SignalHandler); /* get path of dialog description file */ fbuf=GWEN_Buffer_new(0, 256, 0, 1); rv=GWEN_PathManager_FindFile(AB_PM_LIBNAME, AB_PM_DATADIR, "aqbanking/backends/aqpaypal/dialogs/dlg_newuser.dlg", fbuf); if (rv<0) { DBG_INFO(AQPAYPAL_LOGDOMAIN, "Dialog description file not found (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } /* read dialog from dialog description file */ rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(fbuf)); if (rv<0) { DBG_INFO(AQPAYPAL_LOGDOMAIN, "here (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } GWEN_Buffer_free(fbuf); xdlg->banking=ab; /* preset */ xdlg->httpVMajor=1; xdlg->httpVMinor=1; xdlg->url=strdup("https://api-3t.paypal.com/nvp"); /* done */ return dlg; }
GWEN_DIALOG *AO_NewUserDialog_new(AB_PROVIDER *pro) { GWEN_DIALOG *dlg; AO_NEWUSER_DIALOG *xdlg; GWEN_BUFFER *fbuf; int rv; dlg=GWEN_Dialog_new("ao_newuser"); GWEN_NEW_OBJECT(AO_NEWUSER_DIALOG, xdlg); GWEN_INHERIT_SETDATA(GWEN_DIALOG, AO_NEWUSER_DIALOG, dlg, xdlg, AO_NewUserDialog_FreeData); GWEN_Dialog_SetSignalHandler(dlg, AO_NewUserDialog_SignalHandler); /* get path of dialog description file */ fbuf=GWEN_Buffer_new(0, 256, 0, 1); rv=GWEN_PathManager_FindFile(AB_PM_LIBNAME, AB_PM_DATADIR, "aqbanking/backends/aqofxconnect/dialogs/dlg_newuser.dlg", fbuf); if (rv<0) { DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Dialog description file not found (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } /* read dialog from dialog description file */ rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(fbuf)); if (rv<0) { DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "here (%d)", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } GWEN_Buffer_free(fbuf); xdlg->provider=pro; xdlg->banking=AB_Provider_GetBanking(pro); /* preset */ xdlg->httpVMajor=1; xdlg->httpVMinor=1; /* done */ return dlg; }
GWEN_DIALOG *OH_GetInstituteDialog_new(const char *dataFolder, const char *name) { GWEN_DIALOG *dlg; OH_GETINST_DIALOG *xdlg; GWEN_BUFFER *fbuf; int rv; dlg=GWEN_Dialog_new("oh_getinst"); GWEN_NEW_OBJECT(OH_GETINST_DIALOG, xdlg); GWEN_INHERIT_SETDATA(GWEN_DIALOG, OH_GETINST_DIALOG, dlg, xdlg, OH_GetInstituteDialog_FreeData); GWEN_Dialog_SetSignalHandler(dlg, OH_GetInstituteDialog_SignalHandler); /* get path of dialog description file */ fbuf=GWEN_Buffer_new(0, 256, 0, 1); rv=GWEN_PathManager_FindFile(AB_PM_LIBNAME, AB_PM_DATADIR, "aqbanking/backends/aqofxconnect/dialogs/dlg_getinst.dlg", fbuf); if (rv<0) { DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Dialog description file not found (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } /* read dialog from dialog description file */ rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(fbuf)); if (rv<0) { DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "here (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } GWEN_Buffer_free(fbuf); xdlg->ofxHome=OfxHome_new(dataFolder); xdlg->matchingSpecList=OH_InstituteSpec_List_new(); if (name) xdlg->name=strdup(name); /* done */ return dlg; }
GWEN_DIALOG *TestDialog_new() { int rv; GWEN_DIALOG *dlg; /* create dialog */ dlg=GWEN_Dialog_new("testdialog"); /* set signal handler */ GWEN_Dialog_SetSignalHandler(dlg, TestDialog_SignalHandler); /* read dialog from dialog description file */ rv=GWEN_Dialog_ReadXmlFile(dlg, "testdialog.dlg"); if (rv<0) { fprintf(stderr, "Error reading dialog file (%d)\n", rv); GWEN_Dialog_free(dlg); return NULL; } return dlg; }
GWEN_DIALOG *AB_SetupDialog_new(AB_BANKING *ab) { GWEN_DIALOG *dlg; AB_SETUP_DIALOG *xdlg; GWEN_BUFFER *fbuf; int rv; dlg=GWEN_Dialog_new("ab_setup"); GWEN_NEW_OBJECT(AB_SETUP_DIALOG, xdlg); GWEN_INHERIT_SETDATA(GWEN_DIALOG, AB_SETUP_DIALOG, dlg, xdlg, AB_SetupDialog_FreeData); GWEN_Dialog_SetSignalHandler(dlg, AB_SetupDialog_SignalHandler); /* get path of dialog description file */ fbuf=GWEN_Buffer_new(0, 256, 0, 1); rv=GWEN_PathManager_FindFile(AB_PM_LIBNAME, AB_PM_DATADIR, "aqbanking/dialogs/dlg_setup.dlg", fbuf); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "Dialog description file not found (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } /* read dialog from dialog description file */ rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(fbuf)); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } GWEN_Buffer_free(fbuf); xdlg->banking=ab; /* done */ return dlg; }
GWEN_DIALOG *AB_SetupNewUserDialog_new(AB_BANKING *ab) { GWEN_DIALOG *dlg; AB_SETUP_NEWUSER_DIALOG *xdlg; GWEN_BUFFER *fbuf; int rv; GWEN_XMLNODE *n; GWEN_XMLNODE *nDialog; GWEN_PLUGIN_DESCRIPTION_LIST2 *providers; GWEN_DIALOG_LIST *subDialogs=NULL; dlg=GWEN_Dialog_new("ab_setup_newuser"); GWEN_NEW_OBJECT(AB_SETUP_NEWUSER_DIALOG, xdlg); GWEN_INHERIT_SETDATA(GWEN_DIALOG, AB_SETUP_NEWUSER_DIALOG, dlg, xdlg, AB_SetupNewUserDialog_FreeData); GWEN_Dialog_SetSignalHandler(dlg, AB_SetupNewUserDialog_SignalHandler); xdlg->backendDialogs=GWEN_Dialog_List2_new(); xdlg->backendRadioNames=GWEN_StringList_new(); xdlg->backendNames=GWEN_StringList_new(); /* get path of dialog description file */ fbuf=GWEN_Buffer_new(0, 256, 0, 1); rv=GWEN_PathManager_FindFile(AB_PM_LIBNAME, AB_PM_DATADIR, "aqbanking/dialogs/dlg_setup_newuser.dlg", fbuf); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "Dialog description file not found (%d).", rv); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } /* read XML file, extend it */ n=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "root"); rv=GWEN_XML_ReadFile(n, GWEN_Buffer_GetStart(fbuf), GWEN_XML_FLAGS_DEFAULT | GWEN_XML_FLAGS_HANDLE_HEADERS); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv); GWEN_XMLNode_free(n); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } nDialog=GWEN_XMLNode_FindFirstTag(n, "dialog", NULL, NULL); if (nDialog==NULL) { DBG_INFO(AQBANKING_LOGDOMAIN, "Dialog element not found in XML file [%s]", GWEN_Buffer_GetStart(fbuf)); GWEN_XMLNode_free(n); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } providers=AB_Banking_GetProviderDescrs(ab); if (providers) { GWEN_XMLNODE *nBackendRadioWidget; nBackendRadioWidget=GWEN_XMLNode_FindFirstTag(nDialog, "widget", "name", "dialogVLayout"); if (nBackendRadioWidget) nBackendRadioWidget=GWEN_XMLNode_FindFirstTag(nBackendRadioWidget, "widget", "name", "wiz_stack"); if (nBackendRadioWidget) nBackendRadioWidget=GWEN_XMLNode_FindFirstTag(nBackendRadioWidget, "widget", "name", "backendRadioWidget"); subDialogs=GWEN_Dialog_List_new(); if (nBackendRadioWidget) { GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR *pit; pit=GWEN_PluginDescription_List2_First(providers); if (pit) { GWEN_PLUGIN_DESCRIPTION *pd; pd=GWEN_PluginDescription_List2Iterator_Data(pit); while(pd) { const char *name; name=GWEN_PluginDescription_GetName(pd); if (name && *name) { AB_PROVIDER *pro; pro=AB_Banking_GetProvider(ab, name); if (pro) { GWEN_DIALOG *cdlg; GWEN_BUFFER *tbuf; GWEN_XMLNODE *wn; const char *s; if (AB_Provider_GetFlags(pro) & AB_PROVIDER_FLAGS_HAS_USERTYPE_DIALOG) { cdlg=AB_ProviderGetUserTypeDialog(pro); if (cdlg==NULL) { DBG_WARN(AQBANKING_LOGDOMAIN, "Backend [%s] does not return a userType dialog, using default", name); cdlg=AB_UserTypePageDefaultDialog_new(ab); } } else cdlg=AB_UserTypePageDefaultDialog_new(ab); tbuf=GWEN_Buffer_new(0, 256, 0, 1); GWEN_Buffer_AppendString(tbuf, "backend_"); GWEN_Buffer_AppendString(tbuf, name); GWEN_Buffer_AppendString(tbuf, "_radio"); wn=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "widget"); GWEN_XMLNode_SetProperty(wn, "type", "radioButton"); GWEN_XMLNode_SetProperty(wn, "name", GWEN_Buffer_GetStart(tbuf)); GWEN_StringList_AppendString(xdlg->backendRadioNames, GWEN_Buffer_GetStart(tbuf), 0, 0); GWEN_StringList_AppendString(xdlg->backendNames, name, 0, 0); s=GWEN_PluginDescription_GetShortDescr(pd); if (!(s && *s)) s=name; GWEN_XMLNode_SetProperty(wn, "text", I18N(s)); GWEN_XMLNode_SetProperty(wn, "groupId", "999999"); GWEN_XMLNode_SetProperty(wn, "flags", "fillX justifyLeft"); GWEN_XMLNode_AddChild(nBackendRadioWidget, wn); GWEN_Dialog_List_Add(cdlg, subDialogs); } else { DBG_ERROR(AQBANKING_LOGDOMAIN, "Could not activate backend [%s]", name); } } pd=GWEN_PluginDescription_List2Iterator_Next(pit); } GWEN_PluginDescription_List2Iterator_free(pit); } } else { DBG_ERROR(AQBANKING_LOGDOMAIN, "Dialog description does not contain path [dialogVLayout/wiz_stack/backendRadioWidget]"); GWEN_XMLNode_Dump(nDialog, 2); GWEN_XMLNode_free(n); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } } /* read dialog from dialog description file */ rv=GWEN_Dialog_ReadXml(dlg, nDialog); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d).", rv); GWEN_Dialog_List_free(subDialogs); GWEN_XMLNode_free(n); GWEN_Buffer_free(fbuf); GWEN_Dialog_free(dlg); return NULL; } GWEN_XMLNode_free(n); GWEN_Buffer_free(fbuf); /* insert pages for each backend */ if (GWEN_Dialog_List_GetCount(subDialogs)) { GWEN_DIALOG *cdlg; while ( (cdlg=GWEN_Dialog_List_First(subDialogs)) ) { GWEN_Dialog_List_Del(cdlg); DBG_NOTICE(AQBANKING_LOGDOMAIN, "Adding dialog %s", GWEN_Dialog_GetId(cdlg)); rv=GWEN_Dialog_AddSubDialog(dlg, "wiz_stack", cdlg); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv); GWEN_Dialog_List_free(subDialogs); GWEN_Dialog_free(cdlg); GWEN_Dialog_free(dlg); return NULL; } GWEN_Dialog_List2_PushBack(xdlg->backendDialogs, cdlg); } } GWEN_Dialog_List_free(subDialogs); xdlg->banking=ab; /* done */ return dlg; }