Ejemplo n.º 1
0
int AB_SelectBankInfoDialog_HandleValueChanged(GWEN_DIALOG *dlg, const char *sender)
{
  const char *s;

  DBG_NOTICE(0, "Changed %s", sender);
  if (strcasecmp(sender, "blzEdit")==0 ||
      strcasecmp(sender, "bicEdit")==0) {
    s=GWEN_Dialog_GetCharProperty(dlg, sender, GWEN_DialogProperty_Value, 0, NULL);
    if (s && strlen(s)>2) {
      AB_SelectBankInfoDialog_UpdateList(dlg);
      return GWEN_DialogEvent_ResultHandled;
    }
  }
  else if (strcasecmp(sender, "nameEdit")==0 ||
           strcasecmp(sender, "locationEdit")==0) {
    s=GWEN_Dialog_GetCharProperty(dlg, sender, GWEN_DialogProperty_Value, 0, NULL);
    if (s && strlen(s)>3) {
      AB_SelectBankInfoDialog_UpdateList(dlg);
      return GWEN_DialogEvent_ResultHandled;
    }
  }
  else if (strcasecmp(sender, "listBox")==0) {
    return GWEN_DialogEvent_ResultHandled;
  }

  return GWEN_DialogEvent_ResultNotHandled;
}
Ejemplo n.º 2
0
int AH_NewKeyFileDialog_GetBankPageData(GWEN_DIALOG *dlg) {
  AH_NEWKEYFILE_DIALOG *xdlg;
  const char *s;

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

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_bankcode_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AH_NewKeyFileDialog_SetBankCode(dlg, s);
  else {
    DBG_INFO(AQHBCI_LOGDOMAIN, "Missing bank code");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_bankname_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AH_NewKeyFileDialog_SetBankName(dlg, s);
  else
    AH_NewKeyFileDialog_SetBankName(dlg, NULL);

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_url_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AH_NewKeyFileDialog_SetUrl(dlg, s);
  else {
    DBG_INFO(AQHBCI_LOGDOMAIN, "Missing URL");
    return GWEN_ERROR_NO_DATA;
  }

  return 0;
}
Ejemplo n.º 3
0
int AH_NewKeyFileDialog_GetUserPageData(GWEN_DIALOG *dlg) {
  AH_NEWKEYFILE_DIALOG *xdlg;
  const char *s;

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

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_username_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AH_NewKeyFileDialog_SetUserName(dlg, s);
  else {
    DBG_INFO(AQHBCI_LOGDOMAIN, "Missing user name");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_userid_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AH_NewKeyFileDialog_SetUserId(dlg, s);
  else {
    DBG_INFO(AQHBCI_LOGDOMAIN, "Missing user id");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_customerid_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AH_NewKeyFileDialog_SetCustomerId(dlg, s);
  else
    AH_NewKeyFileDialog_SetCustomerId(dlg, NULL);

  return 0;
}
Ejemplo n.º 4
0
int APY_NewUserDialog_GetUserPageData(GWEN_DIALOG *dlg) {
  APY_NEWUSER_DIALOG *xdlg;
  const char *s;

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

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_username_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    APY_NewUserDialog_SetUserName(dlg, s);
  else {
    DBG_INFO(AQPAYPAL_LOGDOMAIN, "Missing user name");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_userid_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    APY_NewUserDialog_SetUserId(dlg, s);
  else {
    DBG_INFO(AQPAYPAL_LOGDOMAIN, "Missing user id");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_url_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    APY_NewUserDialog_SetUrl(dlg, s);
  else {
    DBG_INFO(AQPAYPAL_LOGDOMAIN, "Missing URL");
    return GWEN_ERROR_NO_DATA;
  }

  return 0;
}
Ejemplo n.º 5
0
int AO_NewUserDialog_GetAppPageData(GWEN_DIALOG *dlg)
{
  AO_NEWUSER_DIALOG *xdlg;
  const char *s;

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

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_appid_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AO_NewUserDialog_SetAppId(dlg, s);
  else {
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Missing application id");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_appver_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AO_NewUserDialog_SetAppVer(dlg, s);
  else {
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Missing application version");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_headerver_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AO_NewUserDialog_SetHeaderVer(dlg, s);
  else {
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Missing application version");
    return GWEN_ERROR_NO_DATA;
  }

  return 0;
}
Ejemplo n.º 6
0
int APY_NewUserDialog_GetSecretPageData(GWEN_DIALOG *dlg) {
  APY_NEWUSER_DIALOG *xdlg;
  const char *s;

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

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_apiuserid_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    APY_NewUserDialog_SetApiUserId(dlg, s);
  else {
    DBG_INFO(AQPAYPAL_LOGDOMAIN, "Missing API User ID");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_apipass_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    APY_NewUserDialog_SetApiPassword(dlg, s);
  else {
    DBG_INFO(AQPAYPAL_LOGDOMAIN, "Missing API Password");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_apisig_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    APY_NewUserDialog_SetApiSignature(dlg, s);
  else {
    DBG_INFO(AQPAYPAL_LOGDOMAIN, "Missing API Signature");
    return GWEN_ERROR_NO_DATA;
  }

  return 0;
}
Ejemplo n.º 7
0
int AO_NewUserDialog_GetUserPageData(GWEN_DIALOG *dlg)
{
  AO_NEWUSER_DIALOG *xdlg;
  const char *s;

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

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_username_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AO_NewUserDialog_SetUserName(dlg, s);
  else {
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Missing user name");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_userid_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AO_NewUserDialog_SetUserId(dlg, s);
  else {
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Missing user id");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_clientuid_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AO_NewUserDialog_SetClientUid(dlg, s);
  else
    AO_NewUserDialog_SetClientUid(dlg, NULL);

  return 0;
}
Ejemplo n.º 8
0
int AO_NewUserDialog_GetBankPageData(GWEN_DIALOG *dlg)
{
  AO_NEWUSER_DIALOG *xdlg;
  const char *s;

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

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_bankname_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AO_NewUserDialog_SetBankName(dlg, s);
  else {
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Missing bank name");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_brokerid_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AO_NewUserDialog_SetBrokerId(dlg, s);
  else
    AO_NewUserDialog_SetBrokerId(dlg, NULL);

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_fid_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AO_NewUserDialog_SetFid(dlg, s);
  else {
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Missing FID");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_org_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AO_NewUserDialog_SetOrg(dlg, s);
  else {
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Missing ORG");
    return GWEN_ERROR_NO_DATA;
  }

  s=GWEN_Dialog_GetCharProperty(dlg, "wiz_url_edit", GWEN_DialogProperty_Value, 0, NULL);
  if (s && *s)
    AO_NewUserDialog_SetUrl(dlg, s);
  else {
    DBG_INFO(AQOFXCONNECT_LOGDOMAIN, "Missing URL");
    return GWEN_ERROR_NO_DATA;
  }

  return 0;
}
Ejemplo n.º 9
0
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);
}
Ejemplo n.º 10
0
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;
}
Ejemplo n.º 11
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;
}
Ejemplo n.º 12
0
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;
}
Ejemplo n.º 13
0
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;
}
Ejemplo n.º 14
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);
}
Ejemplo n.º 15
0
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;
}
Ejemplo n.º 16
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;
}