コード例 #1
0
ファイル: dlg_getinst.c プロジェクト: Zauberstuhl/aqbanking
void GWENHYWFAR_CB OH_GetInstituteDialog_FreeData(void *bp, void *p) {
  OH_GETINST_DIALOG *xdlg;

  xdlg=(OH_GETINST_DIALOG*) p;
  OH_InstituteSpec_List_free(xdlg->matchingSpecList);
  OH_InstituteData_free(xdlg->selectedData);
  free(xdlg->name);
  OfxHome_free(xdlg->ofxHome);
  GWEN_FREE_OBJECT(xdlg);
}
コード例 #2
0
ファイル: dlg_getinst.c プロジェクト: cstim/aqbanking
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);
}
コード例 #3
0
ファイル: dlg_getinst.c プロジェクト: cstim/aqbanking
int OH_GetInstituteDialog_HandleActivated(GWEN_DIALOG *dlg, const char *sender)
{
  OH_GETINST_DIALOG *xdlg;

  assert(dlg);
  xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, OH_GETINST_DIALOG, dlg);
  assert(xdlg);

  DBG_ERROR(0, "Activated: %s", sender);
  if (strcasecmp(sender, "listBox")==0) {
    OH_INSTITUTE_SPEC *os;

    os=OH_GetInstituteDialog_DetermineSelectedBankInfo(dlg);
    GWEN_Dialog_SetIntProperty(dlg, "okButton", GWEN_DialogProperty_Enabled, 0, os?1:0, 0);

    return GWEN_DialogEvent_ResultHandled;
  }
  else if (strcasecmp(sender, "nameEdit")==0) {
    OH_GetInstituteDialog_UpdateList(dlg);
    return GWEN_DialogEvent_ResultHandled;
  }
  else if (strcasecmp(sender, "okButton")==0) {
    OH_INSTITUTE_SPEC *os;

    os=OH_GetInstituteDialog_DetermineSelectedBankInfo(dlg);
    if (os) {
      const OH_INSTITUTE_DATA *od;

      od=OfxHome_GetData(xdlg->ofxHome, OH_InstituteSpec_GetId(os));
      if (od) {
        OH_InstituteData_free(xdlg->selectedData);
        xdlg->selectedData=OH_InstituteData_dup(od);
        return GWEN_DialogEvent_ResultAccept;
      }
      else {
        DBG_ERROR(AQOFXCONNECT_LOGDOMAIN, "No institute data for id=%d",
                  OH_InstituteSpec_GetId(os));
      }
    }
    return GWEN_DialogEvent_ResultHandled;
  }
  else if (strcasecmp(sender, "abortButton")==0)
    return GWEN_DialogEvent_ResultReject;
  else if (strcasecmp(sender, "wiz_help_button")==0) {
    /* TODO: open a help dialog */
  }

  return GWEN_DialogEvent_ResultNotHandled;
}