int AH_NewKeyFileDialog_CheckBankIniLetter(GWEN_DIALOG *dlg, AB_USER *u) { AH_NEWKEYFILE_DIALOG *xdlg; int rv; GWEN_BUFFER *tbuf; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg); assert(xdlg); tbuf=GWEN_Buffer_new(0, 1024, 0, 1); /* add HTML version of the INI letter */ GWEN_Buffer_AppendString(tbuf, "<html>"); GWEN_Buffer_AppendString(tbuf, I18N("<p>The following is the INI letter describing the keys of your bank. " "Please look at it carefully and compare the information against that " "in the letter from your bank.</p>" "<p><font color=red><b>Important Warning:</b></font> Only proceed if the hash matches! " "Contact your bank immediately if the hash does not match!</p>")); rv=AH_Provider_GetIniLetterHtml(AB_User_GetProvider(u), u, 1, 0, tbuf, 1); if (rv<0) { DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d)", rv); // TODO: show error message GWEN_Buffer_free(tbuf); return GWEN_DialogEvent_ResultHandled; } GWEN_Buffer_AppendString(tbuf, "</html>"); /* add ASCII version of the INI letter for frontends which don't support HTML */ GWEN_Buffer_AppendString(tbuf, I18N("The following is the INI letter describing the keys of your bank.\n" "Please look at it carefully and compare the information against that\n" "in the letter from your bank.\n" "\n" "IMPORTANT WARNING: Only proceed if the hash matches!\n" "Contact your bank immediately if the hash does not match!\n\n")); rv=AH_Provider_GetIniLetterTxt(AB_User_GetProvider(u), u, 1, 0, tbuf, 0); if (rv<0) { DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d)", rv); // TODO: show error message GWEN_Buffer_free(tbuf); return GWEN_DialogEvent_ResultHandled; } if (1!=GWEN_Gui_MessageBox(GWEN_GUI_MSG_FLAGS_TYPE_INFO | GWEN_GUI_MSG_FLAGS_CONFIRM_B1 | GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS, I18N("Check Bank Keys"), GWEN_Buffer_GetStart(tbuf), I18N("Keys are ok"), I18N("Keys do not match!"), NULL, 0)) { GWEN_Buffer_free(tbuf); return GWEN_ERROR_VERIFY; } GWEN_Buffer_free(tbuf); return 0; }
int AB_SetupDialog_DelAccount(GWEN_DIALOG *dlg) { AB_SETUP_DIALOG *xdlg; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_DIALOG, dlg); assert(xdlg); if (xdlg->currentAccountList) { uint32_t aid; aid=AB_SetupDialog_GetCurrentAccountId(dlg); if (aid) { AB_ACCOUNT *a; a=AB_Account_List_GetByUniqueId(xdlg->currentAccountList, aid); if (a) { int rv; char nbuf[512]; char ibuf[32]; const char *an; an=AB_Account_GetAccountName(a); if (!(an && *an)) an=AB_Account_GetAccountNumber(a); if (!(an && *an)) { snprintf(ibuf, sizeof(ibuf)-1, "%d", (int) AB_Account_GetUniqueId(a)); ibuf[sizeof(ibuf)-1]=0; an=ibuf; } snprintf(nbuf, sizeof(nbuf)-1, I18N("<html>" "<p>Do you really want to delete the account <i>%s</i>?" "</html>" "Do you really want to delete the account \"%s\"?"), an, an); nbuf[sizeof(nbuf)-1]=0; rv=GWEN_Gui_MessageBox(GWEN_GUI_MSG_FLAGS_TYPE_WARN | GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS, I18N("Delete Account"), nbuf, I18N("Yes"), I18N("No"), NULL, 0); if (rv!=1) { DBG_INFO(AQBANKING_LOGDOMAIN, "Aborted by user"); return GWEN_DialogEvent_ResultHandled; } rv=AB_Provider_DeleteAccount(AB_Account_GetProvider(a), aid); if (rv<0) { GWEN_Gui_ShowError(I18N("Error"), I18N("Error deleting account: %d"), rv); AB_SetupDialog_Reload(dlg); return GWEN_DialogEvent_ResultHandled; } AB_SetupDialog_Reload(dlg); } /* if a */ } /* if aid */ } /* if xdlg->currentAccountList */ return GWEN_DialogEvent_ResultHandled; }
int AB_SetupDialog_DelUser(GWEN_DIALOG *dlg) { AB_SETUP_DIALOG *xdlg; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_DIALOG, dlg); assert(xdlg); if (xdlg->currentUserList) { uint32_t uid; uid=AB_SetupDialog_GetCurrentUserId(dlg); if (uid) { AB_USER *u; u=AB_User_List_GetByUniqueId(xdlg->currentUserList, uid); if (u) { AB_ACCOUNT *a; uint32_t aid; int rv; char nbuf[512]; snprintf(nbuf, sizeof(nbuf)-1, I18N("<html>" "<p>Do you really want to delete the user <i>%s</i>?" "</html>" "Do you really want to delete the user \"%s\"?"), AB_User_GetUserId(u), AB_User_GetUserId(u)); nbuf[sizeof(nbuf)-1]=0; rv=GWEN_Gui_MessageBox(GWEN_GUI_MSG_FLAGS_TYPE_WARN | GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS, I18N("Delete User"), nbuf, I18N("Yes"), I18N("No"), NULL, 0); if (rv!=1) { DBG_INFO(AQBANKING_LOGDOMAIN, "Aborted by user"); return GWEN_DialogEvent_ResultHandled; } xdlg->currentAccountList=AB_Account_List_new(); AB_SetupDialog_LoadAccounts(dlg, xdlg->currentAccountList); if (AB_Account_List_GetCount(xdlg->currentAccountList)) { a=AB_Account_List_First(xdlg->currentAccountList); while (a) { if (AB_Account_GetUserId(a) == uid) { aid=AB_Account_GetUniqueId(a); rv=GWEN_Gui_MessageBox(GWEN_GUI_MSG_FLAGS_TYPE_ERROR | GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS, I18N("Error"), I18N("<html>" "<p>There is at least one account assigned to the selected user.</p>" "<p>Do you want to remove the account(s) and continue removing the user?</p>" "</html>" "There is at least one account assigned to the selected user.\n" "Do you want to remove the account(s) and continue removing the user?"), I18N("Yes"), I18N("No"), NULL, 0); if (rv!=1) { DBG_INFO(AQBANKING_LOGDOMAIN, "Aborted by user"); return GWEN_DialogEvent_ResultHandled; } rv=AB_Provider_DeleteAccount(AB_Account_GetProvider(a), aid); if (rv<0) { GWEN_Gui_ShowError(I18N("Error"), I18N("Error deleting account: %d (%d deleted)"), rv, aid); AB_SetupDialog_Reload(dlg); return GWEN_DialogEvent_ResultHandled; } } a=AB_Account_List_Next(a); } } /* now delete the user */ rv=AB_Provider_DeleteUser(AB_User_GetProvider(u), uid); if (rv<0) { GWEN_Gui_ShowError(I18N("Error"), I18N("Error deleting user: %d"), rv); AB_SetupDialog_Reload(dlg); return GWEN_DialogEvent_ResultHandled; } } /* if u */ } /* if uid */ AB_SetupDialog_Reload(dlg); } /* if currentUserList */ return GWEN_DialogEvent_ResultHandled; }
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; }