diff --git a/abtransfers.pro b/abtransfers.pro --- a/abtransfers.pro +++ b/abtransfers.pro @@ -7,10 +7,21 @@ DESTDIR = build TEMPLATE = app +QT += gui +#check for Qt5 or greater +greaterThan(QT_MAJOR_VERSION, 4) { + QT += widgets #needed for Qt5 +} + USEWEBKIT=$$system(pkg-config QtWebKit && echo "available") contains(USEWEBKIT, "available") { message("QtWebKit available") - QT += webkit + greaterThan(QT_MAJOR_VERSION, 4) { + QT += webkitwidgets #needed for Qt5 + } else { + QT += webkit #needed for Qt4 + } + DEFINES += USE_QT_WEBKIT } else { message("QtWebKit not available, using QLabel") @@ -121,6 +132,10 @@ unix|macx { CONFIG += link_pkgconfig PKGCONFIG += gwenhywfar gwengui-qt4 aqbanking +# Only for tests with the lastest aqbanking version at development! +# LIBS += -L/opt/latest_svn/lib -laqbanking -lgwenhywfar -lgwengui-qt4 -lgwengui-cpp +# INCLUDEPATH += /opt/latest_svn/include/aqbanking5 \ +# /opt/latest_svn/include/gwenhywfar4 } else { warning(configuring project for a not tested platform. The LIBS are probably wrong.) #The above (CONFIG/PKGCONFIG) could be used if pkg-config is available. @@ -159,7 +174,8 @@ # MVW_VERSION=\\\"$${VERSION}\\\" \ # MVW_VERSION_EXTRA=\"\\\"'development-version-test test-test'\\\"\" #damit auch space möglich ist # MVW_VERSION_EXTRA=\\\"development-version\\\" # keine space möglich! DEFINES += ABTRANSFER_SVN_REVISION=\\\"$${SVN_REVISION}$${HG_REVISION}\\\" \ - ABTRANSFER_VERSION=\\\"$${VERSION}\\\" + ABTRANSFER_VERSION=\\\"$${VERSION}\\\" \ + ABTRANSFER_VERSION_EXTRA=\\\"development-version\\\" # no space possible! # NO_DEBUG diff --git a/src/abt_conv.cpp b/src/abt_conv.cpp --- a/src/abt_conv.cpp +++ b/src/abt_conv.cpp @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (C) 2011-2013 Patrick Wacker + * Copyright (C) 2011-2015 Patrick Wacker * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) @@ -30,6 +30,7 @@ #include "abt_conv.h" #include +#include #include #include @@ -107,13 +108,31 @@ case AB_Job_TypeTransfer : return (QObject::tr("Überweisung durchführen")); break; + +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 5 + case AB_Job_TypeSepaCreateStandingOrder : + return (QObject::tr("SEPA Dauerauftrag anlegen")); + break; + case AB_Job_TypeSepaModifyStandingOrder : + return (QObject::tr("SEPA Dauerauftrag ändern")); + break; + case AB_Job_TypeSepaDeleteStandingOrder : + return (QObject::tr("SEPA Dauerauftrag löschen")); + break; + case AB_Job_TypeSepaGetStandingOrders : + return (QObject::tr("SEPA Daueraufträge abfragen")); + break; + case AB_Job_TypeSepaFlashDebitNote : + return (QObject::tr("SEPA Lastschrift anlegen (flash)")); + break; +#endif case AB_Job_TypeUnknown : return (QObject::tr("AqBanking Typ unbekannt")); break; + default: //if no type matches + return QObject::tr("ab_transfers Typ unbekannt"); + break; } - - //default if no type match - return QObject::tr("ab_transfers Typ unbekannt"); } //static @@ -184,7 +203,7 @@ GWEN_Time_toUtcString(gwentime, "YYYYMMDD", gbuf); std::string stdDatetime(GWEN_Buffer_GetStart(gbuf)); QString strDate = QString::fromStdString(stdDatetime); - date = QDate::fromString(strDate, "yyyyMMdd"); + date = QDate::fromString(strDate, QString::fromUtf8("yyyyMMdd")); GWEN_Buffer_free(gbuf); } else { @@ -214,12 +233,12 @@ return NULL; } - datestr = QString("%1%2%3") + datestr = QString::fromUtf8("%1%2%3") .arg(date.year(), 4, 10, QLatin1Char('0')) .arg(date.month(), 2, 10, QLatin1Char('0')) .arg(date.day(), 2, 10, QLatin1Char('0')); - datestr.append("-12:00"); + datestr.append(QString::fromUtf8("-12:00")); gwt = GWEN_Time_fromUtcString(datestr.toStdString().c_str(), "YYYYMMDD-hh:mm"); //gwt = GWEN_Time_new(date.year(), date.month()-1, date.day(), 12, 0, 0, 1); @@ -231,13 +250,18 @@ } //static -const QStringList abt_conv::GwenStringListToQStringList(const GWEN_STRINGLIST *gwenList) +const QStringList abt_conv::GwenStringListToQStringList(const GWEN_STRINGLIST *gwenList, + bool fromImport /* = false */) { Q_ASSERT(gwenList); QStringList ret; for (unsigned int i=0; iappend(gwl); return gwl; + +// GWEN_STRINGLIST *gwl = GWEN_StringList_new(); +// for (int i=0; iappend(gwl); +// return gwl; } //static @@ -283,13 +325,13 @@ } if (asDecimal) { - return QString("%L1").arg(AB_Value_GetValueAsDouble(value),0,'f',2); + return QString::fromUtf8("%L1").arg(AB_Value_GetValueAsDouble(value),0,'f',2); } else { GWEN_BUFFER *buf = GWEN_Buffer_new(NULL, 100, 0, 0); AB_Value_toString(value, buf); - std::string result(GWEN_Buffer_GetStart(buf)); + QString ret = encodeFromAb(GWEN_Buffer_GetStart(buf)); GWEN_Buffer_free(buf); - return QString::fromStdString(result); + return ret; } } @@ -310,17 +352,52 @@ return NULL; } - std::string s = str.toStdString(); AB_VALUE *val; - val = AB_Value_fromString(s.c_str()); - QString cur = currency.toUtf8(); - std::string c = cur.toStdString(); - AB_Value_SetCurrency(val, c.c_str()); + val = AB_Value_fromString(str.toStdString().c_str()); + AB_Value_SetCurrency(val, currency.toStdString().c_str()); //remember the AB_VALUE, so that freeAllGwenLists() can delete it abt_conv::gwen_abvlist->append(val); return val; } +//static +/** \brief converts a QString (Unicode) to a value that the Im-/Exporter of + * AqBanking can handle. + * + */ +const char* abt_conv::encodeToAb(const QString &str) +{ + return str.toStdString().c_str(); + QTextCodec *codec = QTextCodec::codecForName("UTF-8"); + QByteArray encodedStr = codec->fromUnicode(str); + return encodedStr; +} + +//static +/** \brief converts a const char* from the Im-/Exporter of AqBanking to a + * QString. + * + */ +const QString abt_conv::encodeFromAb(const char* str) +{ + if (QTextCodec::codecForCStrings() != NULL) { + qWarning() << Q_FUNC_INFO + << "WARNING QTextCodec::codecForCString() is set!" + << "This results to a doulbe conversion from UTF-8!"; + return QString::fromUtf8(str); + } + + QTextCodec *codec = QTextCodec::codecForName("UTF-8"); + QString ret; + + ret = codec->toUnicode(str); +// qDebug() << Q_FUNC_INFO << "1:" << ret; + ret = QString::fromUtf8(ret.toStdString().c_str()); + qDebug() << Q_FUNC_INFO << "returning:" << ret; + return ret; +} + + /** @brief must be called at the termination of the program so that ALL created * list are deleted. * diff --git a/src/abt_conv.h b/src/abt_conv.h --- a/src/abt_conv.h +++ b/src/abt_conv.h @@ -71,11 +71,15 @@ static const QDate GwenTimeToQDate(const GWEN_TIME *gwen_time); static const GWEN_TIME* QDateToGwenTime(const QDate &date); - static const QStringList GwenStringListToQStringList(const GWEN_STRINGLIST *gwenList); + static const QStringList GwenStringListToQStringList(const GWEN_STRINGLIST *gwenList, bool fromImport = false); static const GWEN_STRINGLIST* QStringListToGwenStringList(const QStringList &l); static const QString ABValueToString(const AB_VALUE *value, bool asDecimal=false); - static AB_VALUE* ABValueFromString(const QString &str, const QString ¤cy = "EUR"); + static AB_VALUE* ABValueFromString(const QString &str, + const QString ¤cy = QString::fromUtf8("EUR")); + + static const char* encodeToAb(const QString &str); + static const QString encodeFromAb(const char* str); static void freeAllGwenLists(); diff --git a/src/abt_empfaengerinfo.h b/src/abt_empfaengerinfo.h --- a/src/abt_empfaengerinfo.h +++ b/src/abt_empfaengerinfo.h @@ -51,10 +51,10 @@ QString m_Verw; public: abt_EmpfaengerInfo(); - abt_EmpfaengerInfo(const QString &Name, const QString &Kontonummer = "", - const QString &BLZ = "", const QString &IBAN = "", - const QString &BIC = "", const QString &Institut = "", - const QString &Verw = ""); + abt_EmpfaengerInfo(const QString &Name, const QString &Kontonummer = QString(), + const QString &BLZ = QString(), const QString &IBAN = QString(), + const QString &BIC = QString(), const QString &Institut = QString(), + const QString &Verw = QString()); ~abt_EmpfaengerInfo(); const QString &getName() const { return this->m_Name; } diff --git a/src/abt_history.cpp b/src/abt_history.cpp --- a/src/abt_history.cpp +++ b/src/abt_history.cpp @@ -182,8 +182,8 @@ case AB_Job_TypeDeleteDatedTransfer: //append a dated transfer to the history t = AB_Transaction_dup(job->getTransaction()->getAB_Transaction()); - AB_Transaction_AddCategory(t, QString("JobStatus: %1").arg(job->getAbJobStatus()).toUtf8(), 1); - AB_Transaction_AddCategory(t, QString("JobType: %1").arg(job->getAbJobType()).toUtf8(), 1); + AB_Transaction_AddCategory(t, QString::fromUtf8("JobStatus: %1").arg(job->getAbJobStatus()).toUtf8(), 1); + AB_Transaction_AddCategory(t, QString::fromUtf8("JobType: %1").arg(job->getAbJobType()).toUtf8(), 1); AB_ImExporterAccountInfo_AddDatedTransfer(iea, t); break; case AB_Job_TypeCreateStandingOrder: @@ -191,8 +191,8 @@ case AB_Job_TypeDeleteStandingOrder: //append a standing order to the history t = AB_Transaction_dup(job->getTransaction()->getAB_Transaction()); - AB_Transaction_AddCategory(t, QString("JobStatus: %1").arg(job->getAbJobStatus()).toUtf8(), 1); - AB_Transaction_AddCategory(t, QString("JobType: %1").arg(job->getAbJobType()).toUtf8(), 1); + AB_Transaction_AddCategory(t, QString::fromUtf8("JobStatus: %1").arg(job->getAbJobStatus()).toUtf8(), 1); + AB_Transaction_AddCategory(t, QString::fromUtf8("JobType: %1").arg(job->getAbJobType()).toUtf8(), 1); AB_ImExporterAccountInfo_AddStandingOrder(iea, t); break; case AB_Job_TypeTransfer: @@ -204,8 +204,8 @@ case AB_Job_TypeSepaTransfer: //append a transfer to the history t = AB_Transaction_dup(job->getTransaction()->getAB_Transaction()); - AB_Transaction_AddCategory(t, QString("JobStatus: %1").arg(job->getAbJobStatus()).toUtf8(), 1); - AB_Transaction_AddCategory(t, QString("JobType: %1").arg(job->getAbJobType()).toUtf8(), 1); + AB_Transaction_AddCategory(t, QString::fromUtf8("JobStatus: %1").arg(job->getAbJobStatus()).toUtf8(), 1); + AB_Transaction_AddCategory(t, QString::fromUtf8("JobType: %1").arg(job->getAbJobType()).toUtf8(), 1); AB_ImExporterAccountInfo_AddTransfer(iea, t); break; diff --git a/src/abt_job_ctrl.cpp b/src/abt_job_ctrl.cpp --- a/src/abt_job_ctrl.cpp +++ b/src/abt_job_ctrl.cpp @@ -33,6 +33,7 @@ #include #include +#include // for version depended compiling #include #include @@ -55,6 +56,20 @@ #include #include #include +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 5 +#include +#include +#endif + +/***** INFO + * as with aqbanking git 33ea5e5910cb2cbe2afc4f69a56fab38747d58ad from + * 2013-12-30 the ...Get- and ...SetTransaction() functions for each single job + * are marked obsolete, and be replaced with a single AB_Job[Set|Get]Transaction() + * function. + * Therefore this code was reworked to work with both versions. + * If AqBanking >= 5.3.0, the new functions are used, otherwise the old + * functions. + *****/ #include "abt_parser.h" @@ -114,7 +129,6 @@ { Q_ASSERT(hash != NULL); AB_JOB *j = NULL; - j = AB_JobCreateDatedTransfer_new(a); hash->insert(AB_Job_TypeCreateDatedTransfer, AB_Job_CheckAvailability(j) == 0); AB_Job_free(j); @@ -183,6 +197,18 @@ hash->insert(AB_Job_TypeTransfer, AB_Job_CheckAvailability(j) == 0); AB_Job_free(j); +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 5 + //check for newly added SEPA transfers + + j = AB_JobSepaGetStandingOrders_new(a); + hash->insert(AB_Job_TypeSepaGetStandingOrders, AB_Job_CheckAvailability(j) == 0); + AB_Job_free(j); + + j = AB_JobSepaFlashDebitNote_new(a); + hash->insert(AB_Job_TypeSepaFlashDebitNote, AB_Job_CheckAvailability(j) == 0); + AB_Job_free(j); + +#endif } //static public @@ -213,8 +239,13 @@ if (AB_Job_CheckAvailability(j)) { qDebug("Job SingleTransfer not available"); } else { +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + AB_Job_SetTransaction(j, t); + tl = AB_Job_GetFieldLimits(j); +#else AB_JobSingleTransfer_SetTransaction(j, t); tl = AB_JobSingleTransfer_GetFieldLimits(j); +#endif if (tl) { abt_transactionLimits *limits = new abt_transactionLimits(tl); ah->insert(AB_Job_TypeTransfer, limits); @@ -229,8 +260,13 @@ if (AB_Job_CheckAvailability(j)) { qDebug("Job SingleDebitNote not available"); } else { +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + AB_Job_SetTransaction(j, t); + tl = AB_Job_GetFieldLimits(j); +#else AB_JobSingleDebitNote_SetTransaction(j, t); tl = AB_JobSingleDebitNote_GetFieldLimits(j); +#endif if (tl) { abt_transactionLimits *limits = new abt_transactionLimits(tl); ah->insert(AB_Job_TypeDebitNote, limits); @@ -247,8 +283,13 @@ if (AB_Job_CheckAvailability(j)) { qDebug("Job InternalTransfer not available"); } else { +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + AB_Job_SetTransaction(j, t); + tl = AB_Job_GetFieldLimits(j); +#else AB_JobInternalTransfer_SetTransaction(j, t); tl = AB_JobInternalTransfer_GetFieldLimits(j); +#endif if (tl) { abt_transactionLimits *limits = new abt_transactionLimits(tl); ah->insert(AB_Job_TypeInternalTransfer, limits); @@ -263,8 +304,13 @@ if (AB_Job_CheckAvailability(j)) { qDebug("Job SepaTransfer not available"); } else { +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + AB_Job_SetTransaction(j, t); + tl = AB_Job_GetFieldLimits(j); +#else AB_JobSepaTransfer_SetTransaction(j, t); tl = AB_JobSepaTransfer_GetFieldLimits(j); +#endif if (tl) { abt_transactionLimits *limits = new abt_transactionLimits(tl); ah->insert(AB_Job_TypeSepaTransfer, limits); @@ -279,8 +325,13 @@ if (AB_Job_CheckAvailability(j)) { qDebug("Job CreateDatedTransfer not available"); } else { +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + AB_Job_SetTransaction(j, t); + tl = AB_Job_GetFieldLimits(j); +#else AB_JobCreateDatedTransfer_SetTransaction(j, t); tl = AB_JobCreateDatedTransfer_GetFieldLimits(j); +#endif if (tl) { abt_transactionLimits *limits = new abt_transactionLimits(tl); ah->insert(AB_Job_TypeCreateDatedTransfer, limits); @@ -295,8 +346,13 @@ if (AB_Job_CheckAvailability(j)) { qDebug("Job ModifyDatedTransfer not available"); } else { +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + AB_Job_SetTransaction(j, t); + tl = AB_Job_GetFieldLimits(j); +#else AB_JobModifyDatedTransfer_SetTransaction(j, t); tl = AB_JobModifyDatedTransfer_GetFieldLimits(j); +#endif if (tl) { abt_transactionLimits *limits = new abt_transactionLimits(tl); ah->insert(AB_Job_TypeModifyDatedTransfer, limits); @@ -311,8 +367,13 @@ if (AB_Job_CheckAvailability(j)) { qDebug("Job CreateStandingOrder not available"); } else { +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + AB_Job_SetTransaction(j, t); + tl = AB_Job_GetFieldLimits(j); +#else AB_JobCreateStandingOrder_SetTransaction(j, t); tl = AB_JobCreateStandingOrder_GetFieldLimits(j); +#endif if (tl) { abt_transactionLimits *limits = new abt_transactionLimits(tl); ah->insert(AB_Job_TypeCreateStandingOrder, limits); @@ -327,8 +388,13 @@ if (AB_Job_CheckAvailability(j)) { qDebug("Job ModifyStandingOrder not available"); } else { +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + AB_Job_SetTransaction(j, t); + tl = AB_Job_GetFieldLimits(j); +#else AB_JobModifyStandingOrder_SetTransaction(j, t); tl = AB_JobModifyStandingOrder_GetFieldLimits(j); +#endif if (tl) { abt_transactionLimits *limits = new abt_transactionLimits(tl); ah->insert(AB_Job_TypeModifyStandingOrder, limits); @@ -361,8 +427,13 @@ if (AB_Job_CheckAvailability(j)) { qDebug("Job SepaDebitNote not available"); } else { +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + AB_Job_SetTransaction(j, t); + tl = AB_Job_GetFieldLimits(j); +#else AB_JobSepaDebitNote_SetTransaction(j, t); tl = AB_JobSepaDebitNote_GetFieldLimits(j); +#endif if (tl) { abt_transactionLimits *limits = new abt_transactionLimits(tl); ah->insert(AB_Job_TypeSepaDebitNote, limits); @@ -389,8 +460,8 @@ void abt_job_ctrl::addlog(const QString &str) { static QString time; - time = QTime::currentTime().toString("HH:mm:ss.zzz"); - time.append(": "); + time = QTime::currentTime().toString(QString::fromUtf8("HH:mm:ss.zzz")); + time.append(QString::fromUtf8(": ")); time.append(str); emit this->log(time); @@ -421,29 +492,33 @@ GWEN_StringList_free(gwenStrList); } + /* + * FIXME: check the encoding and use the apropriate functions! + */ + //preprocess the logs from AqBanking (UTF8 to ASCII) //replace %22 by " - strList.replaceInStrings("%22", "\"", Qt::CaseSensitive); + strList.replaceInStrings(QString::fromUtf8("%22"), QString::fromUtf8("\""), Qt::CaseSensitive); //replace %28 by ( - strList.replaceInStrings("%28", "(", Qt::CaseSensitive); + strList.replaceInStrings(QString::fromUtf8("%28"), QString::fromUtf8("("), Qt::CaseSensitive); //replace %29 by ) - strList.replaceInStrings("%29", ")", Qt::CaseSensitive); + strList.replaceInStrings(QString::fromUtf8("%29"), QString::fromUtf8(")"), Qt::CaseSensitive); //replace %3A by : - strList.replaceInStrings("%3A", ":", Qt::CaseSensitive); + strList.replaceInStrings(QString::fromUtf8("%3A"), QString::fromUtf8(":"), Qt::CaseSensitive); //replace %C3%A4 by ä - strList.replaceInStrings("%C3%A4", "ä", Qt::CaseSensitive); + strList.replaceInStrings(QString::fromUtf8("%C3%A4"), QString::fromUtf8("ä"), Qt::CaseSensitive); //replace %C3%84 by Ä - strList.replaceInStrings("%C3%84", "Ä", Qt::CaseSensitive); + strList.replaceInStrings(QString::fromUtf8("%C3%84"), QString::fromUtf8("Ä"), Qt::CaseSensitive); //replace %C3%BC by ü - strList.replaceInStrings("%C3%BC", "ü", Qt::CaseSensitive); + strList.replaceInStrings(QString::fromUtf8("%C3%BC"), QString::fromUtf8("ü"), Qt::CaseSensitive); //replace %C3%9C by Ü - strList.replaceInStrings("%C3%9C", "Ü", Qt::CaseSensitive); + strList.replaceInStrings(QString::fromUtf8("%C3%9C"), QString::fromUtf8("Ü"), Qt::CaseSensitive); //replace %C3%B6 by ö - strList.replaceInStrings("%C3%B6", "ö", Qt::CaseSensitive); + strList.replaceInStrings(QString::fromUtf8("%C3%B6"), QString::fromUtf8("ö"), Qt::CaseSensitive); //replace %C3%96 by Ö - strList.replaceInStrings("%C3%96", "Ö", Qt::CaseSensitive); + strList.replaceInStrings(QString::fromUtf8("%C3%96"), QString::fromUtf8("Ö"), Qt::CaseSensitive); //replace %3D by = - strList.replaceInStrings("%3D", "=", Qt::CaseSensitive); + strList.replaceInStrings(QString::fromUtf8("%3D"), QString::fromUtf8("="), Qt::CaseSensitive); return strList; } @@ -695,7 +770,11 @@ wantedPos = this->getSupposedJobqueue_NextStandingPos(firstStandingPos, lastPos); break; } - case AB_Job_TypeGetStandingOrders: { + case AB_Job_TypeGetStandingOrders: +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 5 + case AB_Job_TypeSepaGetStandingOrders: +#endif + { //the update of standingOrders should be after the standingOrder changes int firstStandingPos = this->getSupposedJobqueue_NextTransferPos(firstPos, lastPos); //the update of standingOrders should be direct after the last @@ -928,7 +1007,11 @@ } //add transaction to the job +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + rv = AB_Job_SetTransaction(job, t->getAB_Transaction()); +#else rv = AB_JobSingleTransfer_SetTransaction(job, t->getAB_Transaction()); +#endif abt_jobInfo *ji = new abt_jobInfo(job); @@ -974,7 +1057,11 @@ } //add transaction to the job +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + rv = AB_Job_SetTransaction(job, t->getAB_Transaction()); +#else rv = AB_JobSingleDebitNote_SetTransaction(job, t->getAB_Transaction()); +#endif abt_jobInfo *ji = new abt_jobInfo(job); @@ -1066,7 +1153,11 @@ } //add transaction to the job +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + rv = AB_Job_SetTransaction(job, t->getAB_Transaction()); +#else rv = AB_JobInternalTransfer_SetTransaction(job, t->getAB_Transaction()); +#endif abt_jobInfo *ji = new abt_jobInfo(job); @@ -1112,7 +1203,11 @@ } //add transaction to the job +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + rv = AB_Job_SetTransaction(job, t->getAB_Transaction()); +#else rv = AB_JobSepaTransfer_SetTransaction(job, t->getAB_Transaction()); +#endif abt_jobInfo *ji = new abt_jobInfo(job); @@ -1162,8 +1257,12 @@ } //add transaction to the job +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + rv = AB_Job_SetTransaction(job, t->getAB_Transaction()); +#else rv = AB_JobCreateDatedTransfer_SetTransaction(job, t->getAB_Transaction()); +#endif abt_jobInfo *ji = new abt_jobInfo(job); @@ -1224,8 +1323,12 @@ } //add transaction to the job +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + rv = AB_Job_SetTransaction(job, t->getAB_Transaction()); +#else rv = AB_JobModifyDatedTransfer_SetTransaction(job, t->getAB_Transaction()); +#endif abt_jobInfo *ji = new abt_jobInfo(job); @@ -1278,8 +1381,12 @@ } //add transaction to the job +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + rv = AB_Job_SetTransaction(job, t->getAB_Transaction()); +#else rv = AB_JobDeleteDatedTransfer_SetTransaction(job, t->getAB_Transaction()); +#endif abt_jobInfo *ji = new abt_jobInfo(job); @@ -1389,8 +1496,12 @@ } //add transaction to the job +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + rv = AB_Job_SetTransaction(job, t->getAB_Transaction()); +#else rv = AB_JobCreateStandingOrder_SetTransaction(job, t->getAB_Transaction()); +#endif abt_jobInfo *ji = new abt_jobInfo(job); @@ -1450,8 +1561,12 @@ } //add transaction to the job +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + rv = AB_Job_SetTransaction(job, t->getAB_Transaction()); +#else rv = AB_JobModifyStandingOrder_SetTransaction(job, t->getAB_Transaction()); +#endif abt_jobInfo *ji = new abt_jobInfo(job); @@ -1504,8 +1619,12 @@ } //add transaction to the job +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + rv = AB_Job_SetTransaction(job, t->getAB_Transaction()); +#else rv = AB_JobDeleteStandingOrder_SetTransaction(job, t->getAB_Transaction()); +#endif abt_jobInfo *ji = new abt_jobInfo(job); @@ -1586,7 +1705,68 @@ } +//public slot +/** @brief adds a get sepa standing orders to the jobqueue + * + * AqBanking >= 5.5.0 is needed for this type of job! + */ +void abt_job_ctrl::addGetSepaStandingOrders(const aqb_AccountInfo *acc, + bool withoutInfo /*=false*/) +{ +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 5 + int rv; + if (acc == NULL) { //Job is not available! + qWarning() << Q_FUNC_INFO + << "Job AB_Job_TypeGetSepaStandingOrders is not" + << "available (no valid account [NULL])"; + emit jobNotAvailable(AB_Job_TypeSepaGetStandingOrders); + return; //abort + } + + //this jobtype should only be send once + if (this->isJobTypeInQueue(AB_Job_TypeSepaGetStandingOrders, + acc->get_AB_ACCOUNT())) { + return; //already in queue, nothing to do + } + + + AB_JOB *job = AB_JobSepaGetStandingOrders_new(acc->get_AB_ACCOUNT()); + + rv = AB_Job_CheckAvailability(job); + + if (rv) { //Job is not available! + qWarning() << Q_FUNC_INFO + << "Job is not available -" + << "AB_Job_CheckAvailability returned:" << rv; + emit jobNotAvailable(AB_Job_TypeSepaGetStandingOrders); + return; //cancel adding + } + + abt_jobInfo *ji = new abt_jobInfo(job); + + //get the right position and insert the job in the jobqueue (at + //execution time the AB_JOB_LIST is created from the jobs in the queue) + int pos = this->getSupposedJobqueuePos(ji); + this->jobqueue->insert(pos, ji); + + if (!withoutInfo) { //only emit a jobAdded() signal if wanted + emit this->jobAdded(ji); + } + + emit this->jobQueueListChanged(); + + //Das zuständige AccountInfo Object darüber informieren wenn wir + //mit dem parsen fertig sind (damit dies die SOs neu laden kann) + //--> wird jetzt direkt beim parsen erledigt! +// connect(this, SIGNAL(standingOrdersParsed()), +// acc, SLOT(loadKnownStandingOrders())); +#else + //getSepaStandingOrders not supported by AqBanking version! + emit jobNotAvailable(AB_Job_TypeUnknown); + return; //cancel further processing +#endif +} //public slot /** @@ -1810,7 +1990,7 @@ } while (j) { jobType = AB_Job_GetType(j); - strType = AB_Job_Type2Char(jobType); + strType = QString::fromUtf8(AB_Job_Type2Char(jobType)); jobState = AB_Job_GetStatus(j); if (jobState == AB_Job_StatusFinished || @@ -1884,14 +2064,22 @@ break; case AB_Job_TypeDeleteDatedTransfer: +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + t = AB_Job_GetTransaction(j); +#else t = AB_JobDeleteDatedTransfer_GetTransaction(j); +#endif dt = new abt_datedTransferInfo(t); acc->removeDatedTransfer(dt); delete dt; break; case AB_Job_TypeModifyDatedTransfer: +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + t = AB_Job_GetTransaction(j); +#else t = AB_JobModifyDatedTransfer_GetTransaction(j); +#endif dt = new abt_datedTransferInfo(t); acc->removeDatedTransfer(dt); delete dt; @@ -1903,14 +2091,22 @@ break; case AB_Job_TypeDeleteStandingOrder: +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + t = AB_Job_GetTransaction(j); +#else t = AB_JobDeleteStandingOrder_GetTransaction(j); +#endif so = new abt_standingOrderInfo(t); acc->removeStandingOrder(so); delete so; break; case AB_Job_TypeModifyStandingOrder: +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + t = AB_Job_GetTransaction(j); +#else t = AB_JobModifyStandingOrder_GetTransaction(j); +#endif so = new abt_standingOrderInfo(t); acc->removeStandingOrder(so); delete so; diff --git a/src/abt_job_ctrl.h b/src/abt_job_ctrl.h --- a/src/abt_job_ctrl.h +++ b/src/abt_job_ctrl.h @@ -158,6 +158,7 @@ void addModifyStandingOrder(const aqb_AccountInfo *acc, const abt_transaction *t); void addDeleteStandingOrder(const aqb_AccountInfo *acc, const abt_transaction *t); void addGetStandingOrders(const aqb_AccountInfo *acc, bool withoutInfo = false); + void addGetSepaStandingOrders(const aqb_AccountInfo *acc, bool withoutInfo = false); void addGetBalance(const aqb_AccountInfo *acc, bool withoutInfo = false); diff --git a/src/abt_jobinfo.cpp b/src/abt_jobinfo.cpp --- a/src/abt_jobinfo.cpp +++ b/src/abt_jobinfo.cpp @@ -30,6 +30,8 @@ #include "abt_jobinfo.h" +#include + #include #include #include @@ -54,6 +56,17 @@ #include "aqb_accountinfo.h" #include "abt_transaction_base.h" +#include // for version depended compiling +/***** INFO + * as with aqbanking git 33ea5e5910cb2cbe2afc4f69a56fab38747d58ad from + * 2013-12-30 the ...Get- and ...SetTransaction() functions for each single job + * are marked obsolete, and be replaced with a single AB_Job[Set|Get]Transaction() + * function. + * Therefore this code was reworked to work with both versions. + * If AqBanking >= 5.3.0, the new functions are used, otherwise the old + * functions. + *****/ + abt_jobInfo::abt_jobInfo(AB_JOB *j) @@ -106,6 +119,11 @@ { const AB_TRANSACTION *AB_Trans = NULL; +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 3 + //much more simplified with the new API + AB_Trans = AB_Job_GetTransaction(this->m_job); +#else + //with the old API we need to call a seperate function for each job type switch (this->getAbJobType()) { case AB_Job_TypeCreateDatedTransfer: AB_Trans = AB_JobCreateDatedTransfer_GetTransaction(this->m_job); @@ -157,6 +175,7 @@ AB_Trans = NULL; break; } +#endif if (AB_Trans == NULL) { //the job does not have a transaction, so do i @@ -288,7 +307,8 @@ case AB_Job_TypeTransfer: this->createJobInfoStringList_Transfer(strList); break; - case AB_Job_TypeUnknown: + case AB_Job_TypeUnknown: // fall through + default: this->createJobInfoStringList_Unknown(strList); break; } @@ -324,7 +344,7 @@ { if (!this->m_trans) return; //only if transaction available QString info; - + qDebug() << Q_FUNC_INFO << this->m_trans->getRemoteName().at(0); info = QObject::tr("Zu: %1 (%2 - %3)").arg(this->m_trans->getRemoteName().at(0), this->m_trans->getRemoteAccountNumber(), this->m_trans->getRemoteBankCode()); @@ -350,7 +370,7 @@ strList->append(QObject::tr("Verwendungszweck:")); for (int i=0; im_trans->getPurpose().size(); ++i) { - strList->append(" " + this->m_trans->getPurpose().at(i)); + strList->append(QString::fromUtf8(" ") + this->m_trans->getPurpose().at(i)); } } @@ -363,7 +383,7 @@ if (v) { //Betrag und Währung enthalten info = QObject::tr("Betrag: %1 %2").arg(abt_conv::ABValueToString(v, true), - AB_Value_GetCurrency(v)); + QString::fromUtf8(AB_Value_GetCurrency(v))); } else { //Kein AB_VALUE vorhanden info = QObject::tr("Betrag: NICHT VORHANDEN (sollte nicht vorkommen)"); } @@ -400,7 +420,7 @@ const abt_transaction *t = this->m_trans; this->createJobInfoStringList_Standard_Text(strList); - strList->append(""); //leere Zeile + strList->append(QString::fromUtf8("")); //leere Zeile int cycle = t->getCycle(); AB_TRANSACTION_PERIOD period = t->getPeriod(); @@ -494,24 +514,24 @@ { strList->append(QObject::tr("Aktualisiert den aktuellen Saldo für das")); strList->append(QObject::tr("Konto %1 (%2)").arg( - AB_Account_GetAccountNumber(this->m_ABAccount), - AB_Account_GetAccountName(this->m_ABAccount))); + QString::fromUtf8(AB_Account_GetAccountNumber(this->m_ABAccount)), + QString::fromUtf8(AB_Account_GetAccountName(this->m_ABAccount)))); } void abt_jobInfo::createJobInfoStringList_GetDatedTransfers(QStringList *strList) const { strList->append(QObject::tr("Holt alle noch nicht ausgeführten terminierten Überweisungen")); strList->append(QObject::tr("für das Konto %1 (%2)").arg( - AB_Account_GetAccountNumber(this->m_ABAccount), - AB_Account_GetAccountName(this->m_ABAccount))); + QString::fromUtf8(AB_Account_GetAccountNumber(this->m_ABAccount)), + QString::fromUtf8(AB_Account_GetAccountName(this->m_ABAccount)))); } void abt_jobInfo::createJobInfoStringList_GetStandingOrders(QStringList *strList) const { strList->append(QObject::tr("Holt alle bei der Bank hinterlegten Daueraufträge")); strList->append(QObject::tr("für das Konto %1 (%2)").arg( - AB_Account_GetAccountNumber(this->m_ABAccount), - AB_Account_GetAccountName(this->m_ABAccount))); + QString::fromUtf8(AB_Account_GetAccountNumber(this->m_ABAccount)), + QString::fromUtf8(AB_Account_GetAccountName(this->m_ABAccount)))); } diff --git a/src/abt_jobinfo.h b/src/abt_jobinfo.h --- a/src/abt_jobinfo.h +++ b/src/abt_jobinfo.h @@ -126,7 +126,7 @@ /** \brief gibt den enthaltenen AB_Job zurück (could be NULL!) */ AB_JOB *getJob() const; - const abt_transaction* getTransaction() const { return this->m_trans; }; + const abt_transaction* getTransaction() const { return this->m_trans; } const AB_ACCOUNT* getAbAccount() const; @@ -135,7 +135,7 @@ int getAccountID() const; }; -Q_DECLARE_METATYPE(abt_jobInfo*); -Q_DECLARE_METATYPE(const abt_jobInfo*); +Q_DECLARE_METATYPE(abt_jobInfo*) +Q_DECLARE_METATYPE(const abt_jobInfo*) #endif // ABT_JOBINFO_H diff --git a/src/abt_parser.cpp b/src/abt_parser.cpp --- a/src/abt_parser.cpp +++ b/src/abt_parser.cpp @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (C) 2012 Patrick Wacker + * Copyright (C) 2012-2014 Patrick Wacker * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) @@ -32,7 +32,7 @@ #include "abt_parser.h" -#include +#include #include "globalvars.h" @@ -46,6 +46,7 @@ #include +//private static /** * When a AB_TRANSACTION is exported from the history by the AB_IMEXPORTER_CONTEXT, * that is created at abt_history::getContext(), the AB_JOB_TYPE and AB_JOB_STATUS @@ -59,8 +60,8 @@ * The values will also be removed from the category field of the AB_TRANSACTION! * */ -//private static -void abt_parser::getJobStatesFromTransaction(AB_TRANSACTION *t, AB_JOB_TYPE &jobType, AB_JOB_STATUS &jobStatus) +void abt_parser::getJobStatesFromTransaction(AB_TRANSACTION *t, AB_JOB_TYPE *jobType, + AB_JOB_STATUS *jobStatus) { const GWEN_STRINGLIST *gsl = AB_Transaction_GetCategory(t); if (!gsl) return; //abort, no category exist @@ -70,14 +71,16 @@ GWEN_STRINGLIST *sl = GWEN_StringList_dup(gsl); if (!sl) return; //abort - for(unsigned int i=0; igetAccount(t_kto, t_blz); + if (!acc) { + //no matching account + qWarning() << "No matching account found!" + << "( KTO:" << t_kto + << " - BLZ:" << t_blz << ")"; + return; //cancel further processing + } + + AB_ACCOUNT *a = acc->get_AB_ACCOUNT(); + + //default values for a dated transfer + AB_JOB_TYPE jtype = defType; + AB_JOB_STATUS jstatus = defStatus; + + //get the jobType and jobStatus from the category field of the transaction. + abt_parser::getJobStatesFromTransaction(t, &jtype, &jstatus); + + abt_jobInfo *ji = new abt_jobInfo(jtype, jstatus, t, a); + + history->add(ji); +} + +//private static +/** \brief parses the messages of the supplied context. + * + * Parses all messages that are in the supplied context. + * + * At the moment these values were not stored nor handled by abtransfers at + * all! They are only printed through the qDebug function of Qt. + * + * \returns the count of messages that could be parsed. + */ +int abt_parser::parse_ctx_messages(AB_IMEXPORTER_CONTEXT *iec) +{ + int cnt = 0; + const char *logmsg = "PARSER - Messages: "; + const AB_MESSAGE *msg; + QString tmp; + + msg = AB_ImExporterContext_GetFirstMessage(iec); + while (msg) { + + /** \todo Messages should be stored and handled! + * + * At the moment they are only printed as debug values. + */ + +#if DEBUG_ABTPARSER + QDate date = abt_conv::GwenTimeToQDate(AB_Message_GetDateReceived(msg)); + tmp = QString("Date:\t%1").arg(date.toString(Qt::DefaultLocaleLongDate)); + qDebug() << logmsg << tmp; + + tmp = QString("Subject:\t%1").arg(AB_Message_GetSubject(msg)); + qDebug() << logmsg << tmp; + + tmp = QString("Text:\t%1").arg(AB_Message_GetText(msg)); + qDebug() << logmsg << tmp; + + int aid = AB_Message_GetAccountId(msg); + int uid = AB_Message_GetUserId(msg); + tmp = QString("account id: %1 - user id: %2").arg(aid, uid); + qDebug() << logmsg << tmp; +#endif + + msg = AB_ImExporterContext_GetNextMessage(iec); + cnt++; + } + + tmp = QString::fromUtf8("Count: %1").arg(cnt); + qDebug() << logmsg << tmp; + + return cnt; +} + +//private static +/** \brief parses the securities of the supplied context. + * + * Parses all securities that are in the supplied context. + * + * At the moment these values were not stored nor handled by abtransfers at + * all! They are only printed as debug messages (if enabled). + * + * \returns the count of securities that could be parsed. + */ +int abt_parser::parse_ctx_securities(AB_IMEXPORTER_CONTEXT *iec) +{ + const char *logmsg = "PARSER - Security: "; + const AB_SECURITY *sec; + QString tmp; + int cnt = 0; + + sec = AB_ImExporterContext_GetFirstSecurity(iec); + while (sec) { + + /** \todo Securities should be stored and handled! + * + * At the moment they are only printed as debug values. + */ + +#if DEBUG_ABTPARSER + const AB_VALUE *v; + + tmp = QString("Name:\t%1").arg(AB_Security_GetName(sec)); + qDebug() << logmsg << tmp; + + v = AB_Security_GetUnitPriceValue(sec); + tmp = QString("UnitPriceValue:\t%1").arg(AB_Value_GetValueAsDouble(v)); + qDebug() << logmsg << tmp; +#endif + + sec = AB_ImExporterContext_GetNextSecurity(iec); + cnt++; + } + + tmp = QString::fromUtf8("Count: %1").arg(cnt); + qDebug() << logmsg << tmp; + + return cnt; +} + +//private static +/** \brief parses all account infos of the supplied context \a iec. */ +int abt_parser::parse_ctx_accountInfos(AB_IMEXPORTER_CONTEXT *iec, + const aqb_Accounts *allAccounts, + abt_history *history /* = NULL */) +{ + AB_IMEXPORTER_ACCOUNTINFO *ai; + const char *logmsg = "PARSER - Acc-Info: "; + int cnt = 0; + aqb_AccountInfo *acc; + abt_history *parseHistory = NULL; + + ai = AB_ImExporterContext_GetFirstAccountInfo(iec); + while (ai) { + QString accnr = QString::fromUtf8(AB_ImExporterAccountInfo_GetAccountNumber(ai)); + QString blz = QString::fromUtf8(AB_ImExporterAccountInfo_GetBankCode(ai)); + QString iban = QString::fromUtf8(AB_ImExporterAccountInfo_GetIban(ai)); + QString bic = QString::fromUtf8(AB_ImExporterAccountInfo_GetBic(ai)); + QString owner = QString::fromUtf8(AB_ImExporterAccountInfo_GetOwner(ai)); + QString name = QString::fromUtf8(AB_ImExporterAccountInfo_GetAccountName(ai)); + QString id = QString::fromUtf8("%1").arg(AB_ImExporterAccountInfo_GetAccountId(ai)); + + //check if we parse data for the "history account" + if (history && (accnr == QString::fromUtf8("0000000000")) && + (blz == QString::fromUtf8("00000000")) && + (owner == QString::fromUtf8("AB-Transfers"))) { + //we should parse data for the history! + acc = NULL; + parseHistory = history; + } else { + parseHistory = NULL; + //get the internaly used account object (null if not found) + acc = allAccounts->getAccount(accnr, blz, owner, name); + + if (!acc) { + qWarning() << logmsg << "No account found! Import for: " + << "AccNr:" << accnr + << "BLZ:" << blz + << "( IBAN: " << iban + << "/ BIC: " << bic << ")" + << "Name:" << name + << "Owner:" << owner; + //next account + ai = AB_ImExporterContext_GetNextAccountInfo(iec); + continue; + } + } + + QString tmp = QString::fromUtf8( + "%1 (%3) [%2] Owner: %4 ID: %5 (IBAN: %6 BIC: %7)") + .arg(accnr, blz, name, owner, id, iban, bic); + qDebug() << logmsg << tmp; + + if (parseHistory) { + //only parse supported account infos + abt_parser::parse_ctx_ai_datedTransfers(ai, acc, parseHistory, allAccounts); + abt_parser::parse_ctx_ai_standingOrders(ai, acc, parseHistory, allAccounts); + abt_parser::parse_ctx_ai_transfers(ai, acc, parseHistory, allAccounts); + } else { + //parse all account infos + abt_parser::parse_ctx_ai_status(ai, acc); + abt_parser::parse_ctx_ai_datedTransfers(ai, acc); + abt_parser::parse_ctx_ai_notedTransactions(ai, acc); + abt_parser::parse_ctx_ai_standingOrders(ai, acc); + abt_parser::parse_ctx_ai_transactions(ai, acc); + abt_parser::parse_ctx_ai_transfers(ai, acc); + } + + //next account + ai = AB_ImExporterContext_GetNextAccountInfo(iec); + cnt++; + } + + return cnt; +} + +//private static +/** \brief parses all account status of the supplied account info \a ai. + * + * Includes the bank line, noted balance, booked balance, disposable and + * disposed values. + * + * These values are set at the supplied account \a acc. + * + * (The account status is not saved at the history, so there is no need to + * to add it to the definition) + * + * \returns the status counts at the account info. + */ +int abt_parser::parse_ctx_ai_status(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo *acc) +{ + AB_ACCOUNT_STATUS *as; + const char *logmsg = "PARSER - AccStats: "; + int cnt = 0; + QString tmp; + + as = AB_ImExporterAccountInfo_GetFirstAccountStatus(ai); + while (as) { + acc->setAccountStatus(as); //save the account state + +#if DEBUG_ABTPARSER + const AB_BALANCE *b; + const AB_VALUE *v; + + QDate date = abt_conv::GwenTimeToQDate(AB_AccountStatus_GetTime(as)); + tmp = QString("Time:\t\t%1").arg(date.toString(Qt::DefaultLocaleLongDate)); + qDebug() << logmsg << tmp; + + v = AB_AccountStatus_GetBankLine(as); + if (v) { + tmp = QString("BankLine:\t%1").arg( + AB_Value_GetValueAsDouble(v), 0, 'f', 2); + qDebug() << logmsg << tmp; + } + + b = AB_AccountStatus_GetNotedBalance(as); + if (b) { + v = AB_Balance_GetValue(b); + if (v) { + tmp = QString("NotedBalance:\t%1").arg( + AB_Value_GetValueAsDouble(v), 0, 'f', 2); + qDebug() << logmsg << tmp; + } + } + + b = AB_AccountStatus_GetBookedBalance(as); + if (b) { + v = AB_Balance_GetValue(b); + if (v) { + tmp = QString("BookedBalance:\t%1").arg( + AB_Value_GetValueAsDouble(v), 0, 'f', 2); + qDebug() << logmsg << tmp; + } + } + + v = AB_AccountStatus_GetDisposable(as); + if (v) { + tmp = QString("Disposable:\t%1").arg( + AB_Value_GetValueAsDouble(v), 0, 'f', 2); + qDebug() << logmsg << tmp; + } + + v = AB_AccountStatus_GetDisposed(as); + if (v) { + tmp = QString("Disposed:\t%1").arg( + AB_Value_GetValueAsDouble(v), 0, 'f', 2); + qDebug() << logmsg << tmp; + } +#endif + + as = AB_ImExporterAccountInfo_GetNextAccountStatus(ai); + cnt++; + } + + tmp = QString::fromUtf8("Count: %1").arg(cnt); + qDebug() << logmsg << tmp; + + return cnt; +} + +//private static +/** \brief parses all dated transfers of the supplied account info \a ai. + * + * Depending of the dated transfer state, the found dated transfers are added + * or removed form the supplied account \a acc. + * + * If \a history is supplied != NULL, it is assumed that the parsed data should + * be added to the history (no further checks are done!) + * + * \returns the count of dated transfers found at the account info. + */ +int abt_parser::parse_ctx_ai_datedTransfers(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo *acc, + abt_history *history /* = NULL */, + const aqb_Accounts *allAccounts /* = NULL */) +{ + AB_TRANSACTION *t; + const char *logmsg = "PARSER - DatedTra: "; + QString tmp; + + int cnt = AB_ImExporterAccountInfo_GetDatedTransferCount(ai); + + tmp = QString::fromUtf8("Count: %1").arg(cnt); + qDebug() << logmsg << tmp; + + t = AB_ImExporterAccountInfo_GetFirstDatedTransfer(ai); + while (t) { + if (history) { //parse history data + Q_ASSERT(allAccounts); + abt_parser::addJobInfoToHistory(history, allAccounts, t, + AB_Job_TypeCreateDatedTransfer, + AB_Job_StatusFinished); + } else { //parse received data + //add or remove the dated transfers to the accuont, + //depending on its supplied state. + abt_datedTransferInfo *dt = new abt_datedTransferInfo(t); + if (dt->getTransaction()->getStatus() == AB_Transaction_StatusRevoked) { + //accounts only have existing dated transfers + //(the history possible show other values too) + acc->removeDatedTransfer(dt); + delete dt; //no longer used + } else { + //the account gets the owner of the dt! + acc->addDatedTransfer(dt); + } + } + +#if DEBUG_ABTPARSER + const GWEN_STRINGLIST *sl; + QStringList strList; + + sl = AB_Transaction_GetPurpose(t); + strList = abt_conv::GwenStringListToQStringList(sl); + tmp = QString("Purpose:\t\t%1").arg(strList.join(" - ")); + qDebug() << logmsg << tmp; + + const AB_VALUE *v = AB_Transaction_GetValue(t); + if (v) { + tmp = QString("Value:\t\t%1").arg(AB_Value_GetValueAsDouble(v)); + } else { + tmp = QString("Value:\t\tNOT SET!"); + } + qDebug() << logmsg << tmp; + + sl = AB_Transaction_GetRemoteName(t); + strList = abt_conv::GwenStringListToQStringList(sl); + tmp = QString("RemoteName:\t%1").arg(strList.join(" - ")); + qDebug() << logmsg << tmp; + + AB_TRANSACTION_STATUS state = AB_Transaction_GetStatus(t); + tmp = QString("Status:\t\t%1 (%2)").arg(state).arg( + AB_Transaction_Status_toString(state)); + qDebug() << logmsg << tmp; +#endif + + t = AB_ImExporterAccountInfo_GetNextDatedTransfer(ai); + } + + return cnt; +} + +//private static +/** \brief parses all noted transactions of the supplied account info \a ai. + * + * Only prints the values at the debug output (if enabled). If the transactions + * should be shown and handled by abtransfers then this must be implemented. + * + * (The noted transactions are not saved at the history, so there is no need to + * to add it to the definition) + * + * \returns the count of noted transactions found at the account info. + */ +int abt_parser::parse_ctx_ai_notedTransactions(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo* /* acc */) +{ + AB_TRANSACTION *t; + const char *logmsg = "PARSER - NotedTra: "; + QString tmp; + + int cnt = AB_ImExporterAccountInfo_GetNotedTransactionCount(ai); + + tmp = QString::fromUtf8("Count: %1").arg(cnt); + qDebug() << logmsg << tmp; + + t = AB_ImExporterAccountInfo_GetFirstNotedTransaction(ai); + while (t) { + + /** \todo implement the setting at the account if it should + * be supported. + */ + +#if DEBUG_ABTPARSER + const GWEN_STRINGLIST *sl; + QStringList strList; + + sl = AB_Transaction_GetPurpose(t); + strList = abt_conv::GwenStringListToQStringList(sl); + tmp = QString("Purpose:\t\t%1").arg(strList.join(" - ")); + qDebug() << logmsg << tmp; + + const AB_VALUE *v = AB_Transaction_GetValue(t); + tmp = QString("Value:\t\t%1").arg(AB_Value_GetValueAsDouble(v)); + qDebug() << logmsg << tmp; + + sl = AB_Transaction_GetRemoteName(t); + strList = abt_conv::GwenStringListToQStringList(sl); + tmp = QString("RemoteName:\t%1").arg(strList.join(" - ")); + qDebug() << logmsg << tmp; + + AB_TRANSACTION_STATUS state = AB_Transaction_GetStatus(t); + tmp = QString("Status:\t\t%1 (%2)").arg(state).arg( + AB_Transaction_Status_toString(state)); + qDebug() << logmsg << tmp; +#endif + + t = AB_ImExporterAccountInfo_GetNextNotedTransaction(ai); + } + + return cnt; +} + +//private static +/** \brief parses all standing orders of the supplied account info \a ai. + * + * Depending of the standing order state, the found standing orders are added + * or removed form the supplied account \a acc. + * + * If \a history is supplied != NULL, it is assumed that the parsed data should + * be added to the history (no further checks are done!) + * + * \returns the count of standing orders found at the account info. + */ +int abt_parser::parse_ctx_ai_standingOrders(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo *acc, + abt_history *history /* = NULL */, + const aqb_Accounts *allAccounts /* = NULL */) +{ + AB_TRANSACTION *t; + const char *logmsg = "PARSER - Standing: "; + QString tmp; + + int cnt = AB_ImExporterAccountInfo_GetStandingOrderCount(ai); + + tmp = QString::fromUtf8("Count: %1").arg(cnt); + qDebug() << logmsg << tmp; + + t = AB_ImExporterAccountInfo_GetFirstStandingOrder(ai); + while (t) { + if (history) { //parse for the history + Q_ASSERT(allAccounts); + abt_parser::addJobInfoToHistory(history, allAccounts, t, + AB_Job_TypeCreateStandingOrder, + AB_Job_StatusFinished); + } else { + //add or remove the standing order to the accuont, depending + //on its supplied state. + abt_standingOrderInfo *so = new abt_standingOrderInfo(t); + if (so->getTransaction()->getStatus() == AB_Transaction_StatusRevoked) { + //accounts only have existing standing orders + //(the history possible show other values too) + acc->removeStandingOrder(so); + delete so; //no longer used + } else { + //the account gets the owner of the so and deletes it! + acc->addStandingOrder(so); + } + } + +#if DEBUG_ABTPARSER + const GWEN_STRINGLIST *sl; + QStringList strList; + + sl = AB_Transaction_GetPurpose(t); + strList = abt_conv::GwenStringListToQStringList(sl); + tmp = QString("Purpose:\t\t%1").arg(strList.join(" - ")); + qDebug() << logmsg << tmp; + + const AB_VALUE *v = AB_Transaction_GetValue(t); + tmp = QString("Value:\t\t%1").arg(AB_Value_GetValueAsDouble(v)); + qDebug() << logmsg << tmp; + + sl = AB_Transaction_GetRemoteName(t); + strList = abt_conv::GwenStringListToQStringList(sl); + tmp = QString("RemoteName:\t%1").arg(strList.join(" - ")); + qDebug() << logmsg << tmp; + + AB_TRANSACTION_STATUS state = AB_Transaction_GetStatus(t); + tmp = QString("Status:\t\t%1 (%2)").arg(state).arg( + AB_Transaction_Status_toString(state)); + qDebug() << logmsg << tmp; +#endif + + t = AB_ImExporterAccountInfo_GetNextStandingOrder(ai); + } + + return cnt; +} + +//private static +/** \brief parses all transactions of the supplied account info \a ai. + * + * Only prints the values at the debug output (if enabled). If the transactions + * should be shown and handled by abtransfers then this must be implemented. + * + * (The transactions are not saved at the history, so there is no need to + * to add it to the definition) + * + * \returns the count of transactions found at the account info. + */ +int abt_parser::parse_ctx_ai_transactions(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo* /* acc */) +{ + AB_TRANSACTION *t; + const char *logmsg = "PARSER - Transact: "; + QString tmp; + + int cnt = AB_ImExporterAccountInfo_GetTransactionCount(ai); + tmp = QString::fromUtf8("Count: %1").arg(cnt); + qDebug() << logmsg << tmp; + + t = AB_ImExporterAccountInfo_GetFirstTransaction(ai); + while (t) { + + /** \todo implement the setting at the account if it should + * be supported. + */ + +#if DEBUG_ABTPARSER + const GWEN_STRINGLIST *sl; + QStringList strList; + + sl = AB_Transaction_GetPurpose(t); + strList = abt_conv::GwenStringListToQStringList(sl); + tmp = QString("Purpose:\t\t%1").arg(strList.join(" - ")); + qDebug() << logmsg << tmp; + + const AB_VALUE *v = AB_Transaction_GetValue(t); + tmp = QString("Value:\t\t%1").arg(AB_Value_GetValueAsDouble(v)); + qDebug() << logmsg << tmp; + + sl = AB_Transaction_GetRemoteName(t); + strList = abt_conv::GwenStringListToQStringList(sl); + tmp = QString("RemoteName:\t%1").arg(strList.join(" - ")); + qDebug() << logmsg << tmp; + + AB_TRANSACTION_STATUS state = AB_Transaction_GetStatus(t); + tmp = QString("Status:\t\t%1 (%2)").arg(state).arg( + AB_Transaction_Status_toString(state)); + qDebug() << logmsg << tmp; +#endif + + t = AB_ImExporterAccountInfo_GetNextTransaction(ai); + } + + return cnt; +} + +//private static +/** \brief parses all transfers of the supplied account info \a ai. + * + * Transfers are only shown at the history! + * + * If \a history is supplied != NULL, it is assumed that the parsed data should + * be added to the history (no further checks are done!) + * + * With no \a history supplied the values are only printed as debug output + * (if enabled). If the transfers should be shown and handled by abtransfers + * then this must be implemented. + * + * \returns the count of transfers found at the account info. + */ +int abt_parser::parse_ctx_ai_transfers(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo* /* acc */, + abt_history *history /* = NULL */, + const aqb_Accounts *allAccounts /* = NULL */) +{ + AB_TRANSACTION *t; + const char *logmsg = "PARSER - Transfer: "; + QString tmp; + + int cnt = AB_ImExporterAccountInfo_GetTransferCount(ai); + + tmp = QString::fromUtf8("Count: %1").arg(cnt); + qDebug() << logmsg << tmp; + + t = AB_ImExporterAccountInfo_GetFirstTransfer(ai); + while (t) { + if (history) { //parse for history + Q_ASSERT(allAccounts); + abt_parser::addJobInfoToHistory(history, allAccounts, t, + AB_Job_TypeTransfer, + AB_Job_StatusFinished); + } else { + /** \todo implement the setting at the account if + * it should be supported. + */ + } + +#if DEBUG_ABTPARSER + const GWEN_STRINGLIST *sl; + QStringList strList; + + sl = AB_Transaction_GetPurpose(t); + strList = abt_conv::GwenStringListToQStringList(sl); + tmp = QString("Purpose:\t\t%1").arg(strList.join(" - ")); + qDebug() << logmsg << tmp; + + const AB_VALUE *v = AB_Transaction_GetValue(t); + tmp = QString("Value:\t\t%1").arg(AB_Value_GetValueAsDouble(v)); + qDebug() << logmsg << tmp; + + sl = AB_Transaction_GetRemoteName(t); + strList = abt_conv::GwenStringListToQStringList(sl); + tmp = QString("RemoteName:\t%1").arg(strList.join(" - ")); + qDebug() << logmsg << tmp; + + AB_TRANSACTION_STATUS state = AB_Transaction_GetStatus(t); + tmp = QString("Status:\t\t%1 (%2)").arg(state).arg( + AB_Transaction_Status_toString(state)); + qDebug() << logmsg << tmp; +#endif + + t = AB_ImExporterAccountInfo_GetNextTransfer(ai); + } + + return cnt; +} + +//constructor +/** \brief default constructor, does nothing + * + * all needed functions are static and an instantiation of the class is not + * needed yet. + */ abt_parser::abt_parser() { } -/** - * Der zurückgegebene Context muss über AB_ImExporterContext_free() wieder - * freigegeben werden! - */ //static +/** The caller is responsible for freeing the returned context (e.g. with + * AB_ImExporterContext_free()). + */ AB_IMEXPORTER_CONTEXT *abt_parser::load_local_ctx(const QString &filename, const QString &importerName, const QString &profileName) @@ -108,7 +764,7 @@ NULL, filename.toUtf8()); - //eventuelle "Lücken" versuchen zu füllen (z.B. Account ID) + //try to fill gaps (e.g. the account id) int ret; ret = AB_Banking_FillGapsInImExporterContext(banking->getAqBanking(), ctx); @@ -118,8 +774,6 @@ << "(this is not an serious error)"; } - - return ctx; } @@ -149,28 +803,28 @@ filename.toUtf8()); if (ret) { - //Fehler aufgetreten! + //error occurred! qWarning() << Q_FUNC_INFO << "ERROR:" << ret << " -- something went wrong on storing the ctx to file"; } } - +//static /** - * Wenn keine Accounts übergeben wurden wird NULL zurück gegeben! + * The caller is responsible to free the returned context (e.g. trough + * AB_ImExporterContext_free() ) * - * Der zurückgegebene Context muss über AB_ImExporterContext_free() wieder - * freigegeben werden! + * \returns an AB_IMEXPORTER_CONTEXT with all values from \a allAccounts + * \returns NULL if \a allAccounts is not valid! */ -//static AB_IMEXPORTER_CONTEXT *abt_parser::create_ctx_from(const aqb_Accounts *allAccounts) { - if (!allAccounts) return NULL; //Abbruch, keine Accounts vorhanden + if (!allAccounts) return NULL; //no accounts, cant work AB_IMEXPORTER_CONTEXT *ctx = AB_ImExporterContext_new(); - //wir gehen alle Objecte durch und holen uns den jeweiligen IE-Context + //go trough all known accounts and add the IEC to the returned one QHashIterator it(allAccounts->getAccountHash()); while (it.hasNext()) { it.next(); @@ -181,34 +835,32 @@ return ctx; } +//static /** - * parses the supplied AB_IMEXPORTER_CONTEXT \a iec and adds the found - * transactions to the corresponding aqb_Accounts \a allAccounts. + * This is the main function that should be used to parse any data of the + * supplied context \a iec. * - * This function should be used to parse the account data and the context which - * is returned from the bank. + * This context could be returned from the bank or the saved values of the + * history of abtransfers. * - * (the parse_ctx() function wich also has an abt_history parameter should be - * used so load the saved history transactions). - * + * If data for the history should be paresed the abt_history object must be + * supplied as \a history (default is NULL). */ -//static -void abt_parser::parse_ctx(AB_IMEXPORTER_CONTEXT *iec, aqb_Accounts *allAccounts) +void abt_parser::parse_ctx(AB_IMEXPORTER_CONTEXT *iec, const aqb_Accounts *allAccounts, + abt_history *history /* = NULL */) { - AB_IMEXPORTER_ACCOUNTINFO *ai; - const AB_SECURITY *security; - const AB_MESSAGE *msg; - const AB_VALUE *v; - const AB_BALANCE *b; - QString logmsg; - QString logmsg2; - int cnt = 0; - aqb_AccountInfo *acc; + if (!iec) { + //if no valid context is supplied we have nothing to do + return; + } - //wenn kein gültiger context vorhanden ist brauchen wir auch nichts machen - if (!iec) return; + if (!allAccounts) { + //we need the accounts to store the vales (even for the history + //import) + return; + } - //eventuelle Lücken im Context füllen (ID, Bankname etc) + //fill possible gaps (e.g. bankname, account number etc) int ret = AB_Banking_FillGapsInImExporterContext(banking->getAqBanking(), iec); if (ret) { @@ -217,679 +869,11 @@ << "(this is not an serious error)"; } + //messages and securities are not supported at the history, so there + //is no need to supply it to them (at the moment) + abt_parser::parse_ctx_messages(iec); + abt_parser::parse_ctx_securities(iec); - /**********************************************************************/ - // Nachrichten - /**********************************************************************/ - cnt = 0; - logmsg = "PARSER - Messages: "; - - msg = AB_ImExporterContext_GetFirstMessage(iec); - while (msg) { - - /** \todo Messages sollten noch gespeichert und angezeigt werden. - Momentan werden die Daten nur als Debug-Meldung - ausgegeben. - */ - - logmsg2 = QString("Empfangsdatum:\t%1").arg( - abt_conv::GwenTimeToQDate(AB_Message_GetDateReceived(msg)) - .toString(Qt::DefaultLocaleLongDate)); - qDebug() << logmsg << logmsg2; - logmsg2 = QString("Betreff:\t%1").arg(AB_Message_GetSubject(msg)); - qDebug() << logmsg << logmsg2; - logmsg2 = QString("Text:\t%1").arg(AB_Message_GetText(msg)); - qDebug() << logmsg << logmsg2; - logmsg2 = QString("AccountID: %1 - UserID: %2").arg( - AB_Message_GetAccountId(msg), - AB_Message_GetUserId(msg)); - qDebug() << logmsg << logmsg2; - - msg = AB_ImExporterContext_GetNextMessage(iec); - cnt++; - } - - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - - /**********************************************************************/ - // Securitys - /**********************************************************************/ - logmsg = "PARSER - Security: "; - cnt = 0; - - security = AB_ImExporterContext_GetFirstSecurity(iec); - while (security) { - - /** \todo Securitys sollten noch gespeichert und angezeigt werden. - Momentan werden die Daten nur als Debug-Meldung - ausgegeben. - */ - - logmsg2 = QString("Name:\t%1").arg(AB_Security_GetName(security)); - qDebug() << logmsg << logmsg2; - - v = AB_Security_GetUnitPriceValue(security); - logmsg2 = QString("UnitPriceValue:\t%1").arg(AB_Value_GetValueAsDouble(v)); - qDebug() << logmsg << logmsg2; - - security = AB_ImExporterContext_GetNextSecurity(iec); - cnt++; - } - - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - - ai=AB_ImExporterContext_GetFirstAccountInfo(iec); - while(ai) { - logmsg = "PARSER - Acc-Info: "; - - //Jetzt folgen Daten für verschiedene Accounts - QString KtoNr = QString::fromUtf8(AB_ImExporterAccountInfo_GetAccountNumber(ai)); - QString BLZ = QString::fromUtf8(AB_ImExporterAccountInfo_GetBankCode(ai)); - QString Owner = QString::fromUtf8(AB_ImExporterAccountInfo_GetOwner(ai)); - QString Name = QString::fromUtf8(AB_ImExporterAccountInfo_GetAccountName(ai)); - QString ID = QString("%1").arg(AB_ImExporterAccountInfo_GetAccountId(ai)); - - //das interne accountInfo-Object besorgen (gibt NULL zurück wenn - //keins gefunden wurde) - acc = allAccounts->getAccount(KtoNr, BLZ, Owner, Name); - - //wenn kein lokaler account gefunden wurde können diesem auch - //keine Daten zugewiesen werden - if (!acc) { - qWarning() << logmsg << "Keinen Account gefunden! Import für: " - << "KtoNr:" << KtoNr - << "BLZ:" << BLZ - << "Name:" << Name - << "Besitzer:" << Owner; - //next account - ai=AB_ImExporterContext_GetNextAccountInfo(iec); - continue; - } - - logmsg2 = QString("%1 (%3) [%2] Owner: %4 ID: %5").arg( - KtoNr, BLZ, Name, Owner, ID); - qDebug() << logmsg << logmsg2; - - - /**********************************************************************/ - // Kontostände - /**********************************************************************/ - AB_ACCOUNT_STATUS *as; - logmsg = "PARSER - AccStats: "; - cnt = 0; - - as = AB_ImExporterAccountInfo_GetFirstAccountStatus(ai); - while (as) { - QDate date = abt_conv::GwenTimeToQDate(AB_AccountStatus_GetTime(as)); - logmsg2 = QString("Time:\t\t%1").arg(date.toString(Qt::DefaultLocaleLongDate)); - - //Den neuen Account_Status im entsprechenden Object setzen - acc->setAccountStatus(as); - - qDebug() << logmsg << logmsg2; - - v = AB_AccountStatus_GetBankLine(as); - if (v) { - logmsg2 = QString("BankLine:\t%1").arg( - AB_Value_GetValueAsDouble(v), 0, 'f', 2); - qDebug() << logmsg << logmsg2; - } - - b = AB_AccountStatus_GetNotedBalance(as); - if (b) { - v = AB_Balance_GetValue(b); - if (v) { - logmsg2 = QString("NotedBalance:\t%1").arg( - AB_Value_GetValueAsDouble(v), 0, 'f', 2); - qDebug() << logmsg << logmsg2; - } - } - - b = AB_AccountStatus_GetBookedBalance(as); - if (b) { - v = AB_Balance_GetValue(b); - if (v) { - logmsg2 = QString("BookedBalance:\t%1").arg( - AB_Value_GetValueAsDouble(v), 0, 'f', 2); - qDebug() << logmsg << logmsg2; - } - } - - v = AB_AccountStatus_GetDisposable(as); - if (v) { - logmsg2 = QString("Disposable:\t%1").arg( - AB_Value_GetValueAsDouble(v), 0, 'f', 2); - qDebug() << logmsg << logmsg2; - } - - v = AB_AccountStatus_GetDisposed(as); - if (v) { - logmsg2 = QString("Disposed:\t%1").arg( - AB_Value_GetValueAsDouble(v), 0, 'f', 2); - qDebug() << logmsg << logmsg2; - } - - as = AB_ImExporterAccountInfo_GetNextAccountStatus(ai); - cnt++; - } - - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - - - /**********************************************************************/ - // Terminüberweisungen - /**********************************************************************/ - AB_TRANSACTION *t; - logmsg = "PARSER - DatedTra: "; - QStringList strList; - const GWEN_STRINGLIST *l; - - cnt = AB_ImExporterAccountInfo_GetDatedTransferCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetFirstDatedTransfer(ai); - while (t) { - //die terminierte Überweisung dem Account zufügen - //oder evt. auch löschen. Abhängig vom Status. - abt_datedTransferInfo *dt = new abt_datedTransferInfo(t); - if (dt->getTransaction()->getStatus() == AB_Transaction_StatusRevoked) { - //Dem account werden nur gültige Terminüberweisungen - //zugeordnet, gelöschte erscheinen nur in der History - acc->removeDatedTransfer(dt); - delete dt; //dt wird nicht länger benötigt - } else { - acc->addDatedTransfer(dt); - //dt wird durch den Account wieder gelöscht - } - - l = AB_Transaction_GetPurpose(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2 = QString("Purpose:\t\t%1").arg(strList.join(" - ")); - qDebug() << logmsg << logmsg2; - - v = AB_Transaction_GetValue(t); - if (v) { - logmsg2 = QString("Value:\t\t%1").arg(AB_Value_GetValueAsDouble(v)); - - } else { - logmsg2 = QString("Value:\t\tNOT SET!"); - } - qDebug() << logmsg << logmsg2; - - l = AB_Transaction_GetRemoteName(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2 = QString("RemoteName:\t%1").arg(strList.join(" - ")); - qDebug() << logmsg << logmsg2; - - AB_TRANSACTION_STATUS state = AB_Transaction_GetStatus(t); - logmsg2 = QString("Status:\t\t%1 (%2)").arg(state).arg( - AB_Transaction_Status_toString(state)); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetNextDatedTransfer(ai); - } - - - - /**********************************************************************/ - // geplante Buchungen - /**********************************************************************/ - logmsg = "PARSER - NotedTra: "; - strList.clear(); - const AB_VALUE *v; - - cnt = AB_ImExporterAccountInfo_GetNotedTransactionCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetFirstNotedTransaction(ai); - while (t) { - - /** \todo Wenn auch Transactionen angezeigt werden sollen - muss dies noch implementiert werden. - */ - - l = AB_Transaction_GetPurpose(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2 = QString("Purpose:\t\t%1").arg(strList.join(" - ")); - qDebug() << logmsg << logmsg2; - - v = AB_Transaction_GetValue(t); - logmsg2 = QString("Value:\t\t%1").arg(AB_Value_GetValueAsDouble(v)); - qDebug() << logmsg << logmsg2; - - l = AB_Transaction_GetRemoteName(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2 = QString("RemoteName:\t%1").arg(strList.join(" - ")); - qDebug() << logmsg << logmsg2; - - AB_TRANSACTION_STATUS state = AB_Transaction_GetStatus(t); - logmsg2 = QString("Status:\t\t%1 (%2)").arg(state).arg( - AB_Transaction_Status_toString(state)); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetNextNotedTransaction(ai); - } - - - /**********************************************************************/ - // Daueraufträge - /**********************************************************************/ - logmsg = "PARSER - Standing: "; - strList.clear(); - - cnt = AB_ImExporterAccountInfo_GetStandingOrderCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetFirstStandingOrder(ai); - while (t) { - //den Dauerauftrag dem Account zufügen - //oder evt. auch löschen. Abhängig vom Status. - abt_standingOrderInfo *so = new abt_standingOrderInfo(t); - if (so->getTransaction()->getStatus() == AB_Transaction_StatusRevoked) { - //Dem account werden nur gültige Daueraufträge - //zugeordnet, gelöschte erscheinen nur in der History - acc->removeStandingOrder(so); - delete so; //so wird nicht länger benötigt - } else { - acc->addStandingOrder(so); - //so wird durch den Account wieder gelöscht - } - - l = AB_Transaction_GetPurpose(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2 = QString("Purpose:\t\t%1").arg(strList.join(" - ")); - qDebug() << logmsg << logmsg2; - - v = AB_Transaction_GetValue(t); - logmsg2 = QString("Value:\t\t%1").arg(AB_Value_GetValueAsDouble(v)); - qDebug() << logmsg << logmsg2; - - l = AB_Transaction_GetRemoteName(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2 = QString("RemoteName:\t%1").arg(strList.join(" - ")); - qDebug() << logmsg << logmsg2; - - AB_TRANSACTION_STATUS state = AB_Transaction_GetStatus(t); - logmsg2 = QString("Status:\t\t%1 (%2)").arg(state).arg( - AB_Transaction_Status_toString(state)); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetNextStandingOrder(ai); - } - - - /**********************************************************************/ - // Buchungen - /**********************************************************************/ - logmsg = "PARSER - Transact: "; - strList.clear();; - - cnt = AB_ImExporterAccountInfo_GetTransactionCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetFirstTransaction(ai); - while (t) { - - /** \todo Wenn auch Transactionen angezeigt werden sollen - muss dies noch implementiert werden. - */ - - l = AB_Transaction_GetPurpose(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2 = QString("Purpose:\t\t%1").arg(strList.join(" - ")); - qDebug() << logmsg << logmsg2; - - v = AB_Transaction_GetValue(t); - logmsg2 = QString("Value:\t\t%1").arg(AB_Value_GetValueAsDouble(v)); - qDebug() << logmsg << logmsg2; - - l = AB_Transaction_GetRemoteName(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2 = QString("RemoteName:\t%1").arg(strList.join(" - ")); - qDebug() << logmsg << logmsg2; - - AB_TRANSACTION_STATUS state = AB_Transaction_GetStatus(t); - logmsg2 = QString("Status:\t\t%1 (%2)").arg(state).arg( - AB_Transaction_Status_toString(state)); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetNextTransaction(ai); - } - - - /**********************************************************************/ - // Überweisungen - /**********************************************************************/ - logmsg = "PARSER - Transfer: "; - strList.clear(); - - cnt = AB_ImExporterAccountInfo_GetTransferCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetFirstTransfer(ai); - while (t) { - - /** \todo Wenn auch Transactionen angezeigt werden sollen - muss dies noch implementiert werden. - */ - - l = AB_Transaction_GetPurpose(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2 = QString("Purpose:\t\t%1").arg(strList.join(" - ")); - qDebug() << logmsg << logmsg2; - - v = AB_Transaction_GetValue(t); - logmsg2 = QString("Value:\t\t%1").arg(AB_Value_GetValueAsDouble(v)); - qDebug() << logmsg << logmsg2; - - l = AB_Transaction_GetRemoteName(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2 = QString("RemoteName:\t%1").arg(strList.join(" - ")); - qDebug() << logmsg << logmsg2; - - AB_TRANSACTION_STATUS state = AB_Transaction_GetStatus(t); - logmsg2 = QString("Status:\t\t%1 (%2)").arg(state).arg( - AB_Transaction_Status_toString(state)); - qDebug() << logmsg << logmsg2; - - - t = AB_ImExporterAccountInfo_GetNextTransfer(ai); - } - - //next account - ai=AB_ImExporterContext_GetNextAccountInfo(iec); - } /* while ai */ - + //parse all types of transfers for the accounts (or the history) + abt_parser::parse_ctx_accountInfos(iec, allAccounts, history); } - - -/** - * parses the supplied AB_IMEXPORTER_CONTEXT \a iec and adds the found - * transactions as abt_jobinfo types in the supplied abt_history \a history. - * - */ -//static -void abt_parser::parse_ctx(AB_IMEXPORTER_CONTEXT *iec, - const aqb_Accounts *allAccounts, - abt_history *history) -{ - AB_IMEXPORTER_ACCOUNTINFO *ai; - const AB_SECURITY *security; - const AB_MESSAGE *msg; - QString logmsg; - QString logmsg2; - int cnt = 0; - - //wenn kein gültiger context vorhanden ist brauchen wir auch nichts machen - if (!iec) return; - - //die history sollte natürlich auch existieren - if (!history) return; - if (!allAccounts) return; - - /**********************************************************************/ - // Nachrichten - /**********************************************************************/ - cnt = 0; - logmsg = "PARSER HISTORY - Messages: "; - - msg = AB_ImExporterContext_GetFirstMessage(iec); - while (msg) { - /** \todo Sollte implementiert werden wenn Nachrichten in der - History gepeichert werden oder angezeigt werden sollen - */ - msg = AB_ImExporterContext_GetNextMessage(iec); - cnt++; - } - - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - - /**********************************************************************/ - // Securitys - /**********************************************************************/ - logmsg = "PARSER HISTORY - Security: "; - cnt = 0; - - security = AB_ImExporterContext_GetFirstSecurity(iec); - while (security) { - /** \todo Sollte implementiert werden wenn Securitys in der - History gepeichert werden oder angezeigt werden sollen - */ - //Must be implemented - security = AB_ImExporterContext_GetNextSecurity(iec); - cnt++; - } - - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - - ai=AB_ImExporterContext_GetFirstAccountInfo(iec); - while(ai) { - logmsg = "PARSER HISTORY - Acc-Info: "; - - //Jetzt folgen Daten für verschiedene Accounts - QString KtoNr = QString::fromUtf8(AB_ImExporterAccountInfo_GetAccountNumber(ai)); - QString BLZ = QString::fromUtf8(AB_ImExporterAccountInfo_GetBankCode(ai)); - QString Owner = QString::fromUtf8(AB_ImExporterAccountInfo_GetOwner(ai)); - //der AccountName wird nicht importiert! Und über fillGaps kann - //er auch nicht nachträglich gesetzt werden, da der Account nur - //"virtuell" existiert. - - //beim History account sollte nur einer mit vorgegebenen Daten - //existieren! - if (KtoNr != "0000000000" || BLZ != "00000000" || - Owner != "AB-Transfers" ) { - //Account ist fehlerhaft! - qWarning() << logmsg << "History Account not correct! " - << "KtoNr:" << KtoNr - << "BLZ:" << BLZ - << "Owner:" << Owner; - qWarning() << logmsg << "ABORTING HISTORY IMPORT"; - //perhaps the next account is correct, try it - ai=AB_ImExporterContext_GetNextAccountInfo(iec); - continue; - } - - logmsg2 = QString("%1 [%2] Owner: %3").arg(KtoNr, BLZ, Owner); - qDebug() << logmsg << logmsg2; - - - /**********************************************************************/ - // Salden - /**********************************************************************/ - AB_ACCOUNT_STATUS *as; - logmsg = "PARSER HISTORY - AccStats: "; - cnt = 0; - - as = AB_ImExporterAccountInfo_GetFirstAccountStatus(ai); - while (as) { - // The account states are not stored in the history! - as = AB_ImExporterAccountInfo_GetNextAccountStatus(ai); - cnt++; - } - - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - - /**********************************************************************/ - // Terminüberweisungen - /**********************************************************************/ - AB_TRANSACTION *t; - logmsg = "PARSER HISTORY - DatedTra: "; - QStringList strList; - - cnt = AB_ImExporterAccountInfo_GetDatedTransferCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetFirstDatedTransfer(ai); - while (t) { - QString t_kto = AB_Transaction_GetLocalAccountNumber(t); - QString t_blz = AB_Transaction_GetLocalBankCode(t); - aqb_AccountInfo *acc = allAccounts->getAccount(t_kto, t_blz); - if (!acc) { - //keinen passenden Account gefunden, nächster - qWarning() << logmsg << "No matching account found!" - << "( KTO:" << t_kto - << " - BLZ:" << t_blz << ")"; - t = AB_ImExporterAccountInfo_GetNextDatedTransfer(ai); - continue; - } - AB_ACCOUNT *a = acc->get_AB_ACCOUNT(); - - //default values for a dated transfer - AB_JOB_TYPE jtype = AB_Job_TypeCreateDatedTransfer; - AB_JOB_STATUS jstatus = AB_Job_StatusFinished; - - //get the jobType and jobStatus from the category field - //of the saved transaction. - getJobStatesFromTransaction(t, jtype, jstatus); - - abt_jobInfo *ji = new abt_jobInfo(jtype, jstatus, t, a); - - history->add(ji); - - t = AB_ImExporterAccountInfo_GetNextDatedTransfer(ai); - } - - - /**********************************************************************/ - // geplante Buchungen - /**********************************************************************/ - logmsg = "PARSER HISTORY - NotedTra: "; - strList.clear(); - - cnt = AB_ImExporterAccountInfo_GetNotedTransactionCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetFirstNotedTransaction(ai); - while (t) { - /** \todo Sollte implementiert werden wenn geplante Buchungen in der - History gepeichert werden oder angezeigt werden sollen - */ - t = AB_ImExporterAccountInfo_GetNextNotedTransaction(ai); - } - - - /**********************************************************************/ - // Daueraufträge - /**********************************************************************/ - logmsg = "PARSER HISTORY - Standing: "; - strList.clear(); - - cnt = AB_ImExporterAccountInfo_GetStandingOrderCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetFirstStandingOrder(ai); - while (t) { - QString t_kto = AB_Transaction_GetLocalAccountNumber(t); - QString t_blz = AB_Transaction_GetLocalBankCode(t); - aqb_AccountInfo *acc = allAccounts->getAccount(t_kto, t_blz); - if (!acc) { - // keinen passenden Account gefunden, Nächste - qWarning() << logmsg << "No matching account found!" - << "( KTO:" << t_kto - << " - BLZ:" << t_blz << ")"; - t = AB_ImExporterAccountInfo_GetNextStandingOrder(ai); - continue; - } - AB_ACCOUNT *a = acc->get_AB_ACCOUNT(); - - //default values for a standing order - AB_JOB_TYPE jtype = AB_Job_TypeCreateStandingOrder; - AB_JOB_STATUS jstatus = AB_Job_StatusFinished; - - //get the jobType and jobStatus from the category field - //of the saved transaction. - getJobStatesFromTransaction(t, jtype, jstatus); - - abt_jobInfo *ji = new abt_jobInfo(jtype, jstatus, t, a); - - history->add(ji); - - t = AB_ImExporterAccountInfo_GetNextStandingOrder(ai); - } - - - /**********************************************************************/ - // Buchungen - /**********************************************************************/ - logmsg = "PARSER HISTORY - Transact: "; - strList.clear();; - - cnt = AB_ImExporterAccountInfo_GetTransactionCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetFirstTransaction(ai); - while (t) { - /** \todo Sollte implementiert werden wenn Buchungen in der - History gepeichert werden oder angezeigt werden sollen - */ - t = AB_ImExporterAccountInfo_GetNextTransaction(ai); - } - - - /**********************************************************************/ - // Überweisungen - /**********************************************************************/ - logmsg = "PARSER HISTORY - Transfer: "; - strList.clear(); - - cnt = AB_ImExporterAccountInfo_GetTransferCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - qDebug() << logmsg << logmsg2; - - t = AB_ImExporterAccountInfo_GetFirstTransfer(ai); - while (t) { - QString lclKto = AB_Transaction_GetLocalAccountNumber(t); - QString lclBLZ = AB_Transaction_GetLocalBankCode(t); - - aqb_AccountInfo *lclAcc = allAccounts->getAccount(lclKto, lclBLZ); - if (!lclAcc) { - // keinen passenden Account gefunden, Nächste - qWarning() << logmsg << "No matching account found!" - << "( KTO:" << lclKto - << " - BLZ:" << lclBLZ << ")"; - t = AB_ImExporterAccountInfo_GetNextTransfer(ai); - continue; - } - - //default values for a transfer - AB_JOB_TYPE jtype = AB_Job_TypeTransfer; - AB_JOB_STATUS jstatus = AB_Job_StatusFinished; - - //get the jobType and jobStatus from the category field - //of the saved transaction. - getJobStatesFromTransaction(t, jtype, jstatus); - - abt_jobInfo *ji = new abt_jobInfo(jtype, jstatus, t, - lclAcc->get_AB_ACCOUNT()); - - history->add(ji); - - t = AB_ImExporterAccountInfo_GetNextTransfer(ai); - } - - //next account - ai=AB_ImExporterContext_GetNextAccountInfo(iec); - } /* while ai */ - -} diff --git a/src/abt_parser.h b/src/abt_parser.h --- a/src/abt_parser.h +++ b/src/abt_parser.h @@ -61,65 +61,98 @@ #include "abt_history.h" -/** \brief parser zum laden der lokal gespeicherten Daten sowie zum Auswerten - * der vom Institut gelieferten Daten. - * - * Über \ref load_local_ctx() können die Daten einer lokal gespeicherten Datei - * in den Context (Rückgabewert) geladen werden. - * - * Dieser Context [ctx] kann dann über \ref parse_ctx() ausgewertet werden. - * \ref parse_ctx() setzt dabei alle Werte die im Context gefunden wurden in - * den entsprechenden Objekten. - * - * Außerdem kann \ref parse_ctx() dazu verwendet werden die gelieferten Daten - * des Instituts aus zu werten und die entsprechenden Objekte zu aktualisieren. - * - */ +#ifndef DEBUG_ABTPARSER +/** \brief DEBUG_ABTPARSER should be 1 to enable debug output of the parser! + * + * It could also be set with -DDEBUG_ABTPARSER=1 as a compiler parameter to + * enable it for a test compilation only! +*/ +//disable debug messages if not supplied as compiler define +#define DEBUG_ABTPARSER 0 +#endif + + +/** \brief parser for the local saved data and for the data retrieved from + * the bank. + * + * With \ref load_local_ctx() local saved data can be loaded (returned as + * AB_IMEXPORTER_CONTEXT). + * + * Every AB_IMEXPORTER_CONTEXT [ctx] can be parsed with \ref parse_ctx(). + * \ref parse_ctx() sets all read values from the supplied ctx at the + * corresponding objects. + * + * \ref parse_ctx() could also be used to parse the information retrieved from + * the bank and update the corresponding objects. + * + */ class abt_parser { private: - //static AB_IMEXPORTER_CONTEXT *ctx; /** \brief reads the type and status from the category field */ static void getJobStatesFromTransaction(AB_TRANSACTION *t, - AB_JOB_TYPE &jobType, - AB_JOB_STATUS &jobStatus); + AB_JOB_TYPE *jobType, + AB_JOB_STATUS *jobStatus); + static void addJobInfoToHistory(abt_history *history, + const aqb_Accounts *allAccounts, + AB_TRANSACTION *t, AB_JOB_TYPE defType, + AB_JOB_STATUS defStatus); + + //private functions to parse the different possible contents of a + //AB_IMEXPORTER_CONTEXT object + static int parse_ctx_messages(AB_IMEXPORTER_CONTEXT *iec); + static int parse_ctx_securities(AB_IMEXPORTER_CONTEXT *iec); + static int parse_ctx_accountInfos(AB_IMEXPORTER_CONTEXT *iec, + const aqb_Accounts *allAccounts, + abt_history *history = NULL); + + static int parse_ctx_ai_status(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo *acc); + static int parse_ctx_ai_datedTransfers(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo *acc, + abt_history *history = NULL, + const aqb_Accounts *allAccounts = NULL); + static int parse_ctx_ai_notedTransactions(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo *acc); + static int parse_ctx_ai_standingOrders(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo *acc, + abt_history *history = NULL, + const aqb_Accounts *allAccounts = NULL); + static int parse_ctx_ai_transactions(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo *acc); + static int parse_ctx_ai_transfers(AB_IMEXPORTER_ACCOUNTINFO *ai, + aqb_AccountInfo *acc, + abt_history *history = NULL, + const aqb_Accounts *allAccounts = NULL); public: abt_parser(); - /** \brief erstellt einen AB_IMEXPORTER_CONTEXT für alle in aqb_Accounts - * enhaltenen aqb_AccountInfo Objekte - */ + /** \brief creates an AB_IMEXPORTER_CONTEXT for all aqb_AccountInfo + * objects of the aqb_Accounts object. + */ static AB_IMEXPORTER_CONTEXT *create_ctx_from(const aqb_Accounts *allAccounts); - - /** \brief lädt alle Daten der Datei \a filename mit dem Importer - * \a importerName und dem Profile \a profileName in den \return ctx - */ + /** \brief loads all data from the \a filename with the \a importerName + * and \a profileName to the returned context. + */ static AB_IMEXPORTER_CONTEXT *load_local_ctx(const QString &filename, const QString &importerName, const QString &profileName); - /** \brief speichert alle Daten des IE-Context \a ctx in der Datei - * \a filename mit dem Importer \a importerName und dem Profile - * \a profileName - */ + /** \brief saves all data of the \a ctx to the given \a filename. + */ static void save_local_ctx(AB_IMEXPORTER_CONTEXT *ctx, const QString &filename, const QString &exporterName, const QString &profileName); - - /** \brief parst den Context \a iec und setzt die entsprechenden Werte - * des entsprechenden Accounts - */ - static void parse_ctx(AB_IMEXPORTER_CONTEXT *iec, aqb_Accounts *allAccounts); - - /** \overload zur Verwendung wenn die History geladen werden soll - */ + /** \brief parses the supplied context \a iec and stores the relevant + * data to the matching accounts at \a allAccounts + */ static void parse_ctx(AB_IMEXPORTER_CONTEXT *iec, const aqb_Accounts *allAccounts, - abt_history *history); + abt_history *history = NULL); }; diff --git a/src/abt_settings.cpp b/src/abt_settings.cpp --- a/src/abt_settings.cpp +++ b/src/abt_settings.cpp @@ -45,11 +45,11 @@ //there is always the settings.ini QString homePath = QDir::homePath(); - QString iniFilename = homePath + "/.abtransfers/settings.ini"; + QString iniFilename = homePath + QString::fromUtf8("/.abtransfers/settings.ini"); //the path must be useable on all systems iniFilename = QDir::toNativeSeparators(iniFilename); //if the folder does not exist, we create it - QDir dataStorage(QDir::toNativeSeparators(homePath + "/.abtransfers")); + QDir dataStorage(QDir::toNativeSeparators(homePath + QString::fromUtf8("/.abtransfers"))); if (!dataStorage.exists()) { bool ret = dataStorage.mkpath(dataStorage.absolutePath()); if (!ret) { @@ -70,33 +70,38 @@ QString defValue; //Standard folder to store data - defValue = homePath + "/.abtransfers/"; + defValue = homePath + QString::fromUtf8("/.abtransfers/"); defValue = QDir::toNativeSeparators(defValue); - this->m_dataDir = this->settings->value("Main/DataDir", defValue).toString(); + this->m_dataDir = this->settings->value(QString::fromUtf8("Main/DataDir"), + defValue).toString(); //file for known recipients - defValue = homePath + "/.abtransfers/recipients.txt"; + defValue = homePath + QString::fromUtf8("/.abtransfers/recipients.txt"); defValue = QDir::toNativeSeparators(defValue); this->m_recipientsFilename = - this->settings->value("Main/RecipientsFilename", defValue).toString(); + this->settings->value(QString::fromUtf8("Main/RecipientsFilename"), + defValue).toString(); //file for account data (balance, standing-/dated-transfers) - defValue = homePath + "/.abtransfers/accountdata.ctx"; + defValue = homePath + QString::fromUtf8("/.abtransfers/accountdata.ctx"); defValue = QDir::toNativeSeparators(defValue); this->m_accountdataFilename = - this->settings->value("Main/AccountDataFilename", defValue).toString(); + this->settings->value(QString::fromUtf8("Main/AccountDataFilename"), + defValue).toString(); //file for the history - defValue = homePath + "/.abtransfers/history.ctx"; + defValue = homePath + QString::fromUtf8("/.abtransfers/history.ctx"); defValue = QDir::toNativeSeparators(defValue); this->m_historyFilename = - this->settings->value("Main/HistoryFilename", defValue).toString(); + this->settings->value(QString::fromUtf8("Main/HistoryFilename"), + defValue).toString(); //filename for the automatic export - defValue = homePath + "/.abtransfers/automatic_export.csv"; + defValue = homePath + QString::fromUtf8("/.abtransfers/automatic_export.csv"); defValue = QDir::toNativeSeparators(defValue); this->m_autoExportFilename = - this->settings->value("Main/AutoExportFilename", defValue).toString(); + this->settings->value(QString::fromUtf8("Main/AutoExportFilename"), + defValue).toString(); this->m_textKeyDescr = NULL; this->loadTextKeyDescriptions(); @@ -136,22 +141,22 @@ this->m_textKeyDescr->clear(); - if (!this->settings->childGroups().contains("TextKeyDescriptions")) { + if (!this->settings->childGroups().contains(QString::fromUtf8("TextKeyDescriptions"))) { //TextKexDescriptions doesnt exists, use default values - this->settings->beginGroup("TextKeyDescriptions"); - this->settings->setValue("04", "Lastschrift (Abbuchungsauftragsverfahren)"); - this->settings->setValue("05", "Lastschrift (Einzugsermächtigungsverfahren)"); - this->settings->setValue("51", "Überweisung"); - this->settings->setValue("52", "Dauerauftrags-Überweisung"); - this->settings->setValue("53", "Lohn-, Gehalts-, Renten-Überweisung"); - this->settings->setValue("54", "Vermögenswirksame Leistung (VL)"); - this->settings->setValue("56", "Überweisung öffentlicher Kassen"); - this->settings->setValue("67", "Überweisung mit prüfziffergesicherten Zuordnungsdaten (BZÜ)"); - this->settings->setValue("69", "Spendenüberweisung"); + this->settings->beginGroup(QString::fromUtf8("TextKeyDescriptions")); + this->settings->setValue(QString::fromUtf8("04"), QString::fromUtf8("Lastschrift (Abbuchungsauftragsverfahren)")); + this->settings->setValue(QString::fromUtf8("05"), QString::fromUtf8("Lastschrift (Einzugsermächtigungsverfahren)")); + this->settings->setValue(QString::fromUtf8("51"), QString::fromUtf8("Überweisung")); + this->settings->setValue(QString::fromUtf8("52"), QString::fromUtf8("Dauerauftrags-Überweisung")); + this->settings->setValue(QString::fromUtf8("53"), QString::fromUtf8("Lohn-, Gehalts-, Renten-Überweisung")); + this->settings->setValue(QString::fromUtf8("54"), QString::fromUtf8("Vermögenswirksame Leistung (VL)")); + this->settings->setValue(QString::fromUtf8("56"), QString::fromUtf8("Überweisung öffentlicher Kassen")); + this->settings->setValue(QString::fromUtf8("67"), QString::fromUtf8("Überweisung mit prüfziffergesicherten Zuordnungsdaten (BZÜ)")); + this->settings->setValue(QString::fromUtf8("69"), QString::fromUtf8("Spendenüberweisung")); this->settings->endGroup(); } - this->settings->beginGroup("TextKeyDescriptions"); + this->settings->beginGroup(QString::fromUtf8("TextKeyDescriptions")); //go through all keys and store the values in a QHash foreach (QString key, this->settings->allKeys()) { QString text = this->settings->value(key, tr("Unbekannt")).toString(); @@ -165,7 +170,7 @@ void abt_settings::setFilePermissions() { QString homePath = QDir::homePath(); - QString iniFilename = homePath + "/.abtransfers/settings.ini"; + QString iniFilename = homePath + QString::fromUtf8("/.abtransfers/settings.ini"); //the path must be useable on all systems iniFilename = QDir::toNativeSeparators(iniFilename); @@ -195,11 +200,11 @@ << this->getRecipientsFilename() << "failed"; //also the permissions fpr the folder should be correct - ret = QFile::setPermissions(QDir::toNativeSeparators(homePath + "/.abtransfers"), + ret = QFile::setPermissions(QDir::toNativeSeparators(homePath + QString::fromUtf8("/.abtransfers")), QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner | QFile::ReadUser | QFile::WriteUser | QFile::ExeUser); if (!ret) qWarning() << Q_FUNC_INFO << " setting permissions on folder" - << QDir::toNativeSeparators(homePath + "/.abtransfers") << "failed"; + << QDir::toNativeSeparators(homePath + QString::fromUtf8("/.abtransfers")) << "failed"; ret = QFile::setPermissions(this->getDataDir(), QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner | @@ -227,7 +232,8 @@ abt_EmpfaengerInfo *recipientInfo; while (!in.atEnd()) { QString line = in.readLine(); - InfoStringList = line.split("\t", QString::KeepEmptyParts); + InfoStringList = line.split(QString::fromUtf8("\t"), + QString::KeepEmptyParts); recipientInfo = new abt_EmpfaengerInfo(); recipientInfo->setName(InfoStringList.at(0)); @@ -319,7 +325,8 @@ */ void abt_settings::setLanguage(const QString &language) { - this->settings->setValue("Options/Language", language); + this->settings->setValue(QString::fromUtf8("Options/Language"), + language); } @@ -328,33 +335,37 @@ void abt_settings::saveWindowStateGeometry(QByteArray state, QByteArray geometry) { - this->settings->setValue("Main/WindowState", state); - this->settings->setValue("Main/WindowGeometry", geometry); + this->settings->setValue(QString::fromUtf8("Main/WindowState"), state); + this->settings->setValue(QString::fromUtf8("Main/WindowGeometry"), + geometry); } QByteArray abt_settings::loadWindowState() const { - return this->settings->value("Main/WindowState", QVariant()).toByteArray(); + return this->settings->value(QString::fromUtf8("Main/WindowState"), + QVariant()).toByteArray(); } QByteArray abt_settings::loadWindowGeometry() const { - return this->settings->value("Main/WindowGeometry", QVariant()).toByteArray(); + return this->settings->value(QString::fromUtf8("Main/WindowGeometry"), + QVariant()).toByteArray(); } -void abt_settings::saveSelAccountInWidget(const QString &widgetName, const aqb_AccountInfo *acc) +void abt_settings::saveSelAccountInWidget(const QString &widgetName, + const aqb_AccountInfo *acc) { - QString groupname("Main/Widget"); + QString groupname(QString::fromUtf8("Main/Widget")); groupname.append(widgetName); this->settings->setValue(groupname, acc->get_ID()); } int abt_settings::loadSelAccountInWidget(const QString &widgetName) const { - QString groupname("Main/Widget"); + QString groupname(QString::fromUtf8("Main/Widget")); groupname.append(widgetName); return this->settings->value(groupname, -1).toInt(); } @@ -363,13 +374,14 @@ bool abt_settings::showDialog(const QString &dialogType) const { - return this->settings->value(QString("Dialogs/Show").append(dialogType), + return this->settings->value(QString::fromUtf8("Dialogs/Show").append(dialogType), true).toBool(); } void abt_settings::setShowDialog(const QString &dialogType, bool show) { - this->settings->setValue(QString("Dialogs/Show").append(dialogType), show); + this->settings->setValue(QString::fromUtf8("Dialogs/Show").append(dialogType), + show); } @@ -377,74 +389,85 @@ bool abt_settings::appendJobToOutbox(const QString &jobname) const { - return this->settings->value(QString("LoadAtStart/").append(jobname), + return this->settings->value(QString::fromUtf8("LoadAtStart/").append(jobname), false).toBool(); } void abt_settings::setAppendJobToOutbox(const QString &jobname, bool get) { - this->settings->setValue(QString("LoadAtStart/").append(jobname), get); + this->settings->setValue(QString::fromUtf8("LoadAtStart/").append(jobname), + get); } //public bool abt_settings::autoAddNewRecipients() const { - return this->settings->value("Options/autoAddNewRecipients", true).toBool(); + return this->settings->value(QString::fromUtf8("Options/autoAddNewRecipients"), + true).toBool(); } //public void abt_settings::setAutoAddNewRecipients(bool value) { - this->settings->setValue("Options/autoAddNewRecipients", value); + this->settings->setValue(QString::fromUtf8("Options/autoAddNewRecipients"), + value); } //public bool abt_settings::autoExportEnabled() const { - return this->settings->value("Options/autoExportEnabled", false).toBool(); + return this->settings->value(QString::fromUtf8("Options/autoExportEnabled"), + false).toBool(); } //public void abt_settings::setAutoExportEnabled(bool value) { - this->settings->setValue("Options/autoExportEnabled", value); + this->settings->setValue(QString::fromUtf8("Options/autoExportEnabled"), + value); } //public const QString abt_settings::autoExportProfileName() const { - return this->settings->value("Options/autoExportProfileName", "csv").toString(); + return this->settings->value(QString::fromUtf8("Options/autoExportProfileName"), + QString::fromUtf8("csv")).toString(); } //public void abt_settings::setAutoExportProfileName(const QString name) const { - this->settings->setValue("Options/autoExportProfileName", name); + this->settings->setValue(QString::fromUtf8("Options/autoExportProfileName"), + name); } //public const QString abt_settings::autoExportPluginName() const { - return this->settings->value("Options/autoExportPluginName", "default").toString(); + return this->settings->value(QString::fromUtf8("Options/autoExportPluginName"), + QString::fromUtf8("default")).toString(); } //public void abt_settings::setAutoExportPluginName(const QString name) const { - this->settings->setValue("Options/autoExportPluginName", name); + this->settings->setValue(QString::fromUtf8("Options/autoExportPluginName"), + name); } //public bool abt_settings::autoExportAsTransaction() const { - return this->settings->value("Main/AutoExportAsTransaction", true).toBool(); + return this->settings->value(QString::fromUtf8("Main/AutoExportAsTransaction"), + true).toBool(); } //public void abt_settings::setAutoExportAsTransaction(bool value) { - this->settings->setValue("Main/AutoExportAsTransaction", value); + this->settings->setValue(QString::fromUtf8("Main/AutoExportAsTransaction"), + value); } /** @@ -458,14 +481,16 @@ */ QStringList abt_settings::getAllProfileFavorites() const { - this->settings->beginGroup("ImExportFavorites"); + this->settings->beginGroup(QString::fromUtf8("ImExportFavorites")); QStringList retList; foreach(const QString group, this->settings->childGroups()) { this->settings->beginGroup(group); foreach(const QString key, this->settings->childKeys()) { - retList.append(QString(group).append("/").append(key)); + retList.append(QString(group) + .append(QString::fromUtf8("/")) + .append(key)); } this->settings->endGroup(); @@ -477,13 +502,13 @@ bool abt_settings::isProfileFavorit(const QString &name) const { - QString key = QString("ImExportFavorites/").append(name); + QString key = QString::fromUtf8("ImExportFavorites/").append(name); return this->settings->value(key, false).toBool(); } void abt_settings::setProfileFavorit(const QString &name, bool favorit) { - QString key = QString("ImExportFavorites/").append(name); + QString key = QString::fromUtf8("ImExportFavorites/").append(name); this->settings->setValue(key, favorit); } @@ -493,52 +518,167 @@ */ void abt_settings::deleteProfileFavorit(const QString &name) { - this->settings->beginGroup("ImExportFavorites"); + this->settings->beginGroup(QString::fromUtf8("ImExportFavorites")); this->settings->remove(name); this->settings->endGroup(); } +//public +/** \brief sets the advanced options enabled flag. + * + * This function must be used to alter the enable flag for the advanced options! + * + * The setAdvancedOption() function would not save anything when the + * advanced options are disabled! + */ +void abt_settings::setAdvancedOptionEnabled(bool enable) +{ + this->settings->setValue(QString::fromUtf8("Options/Advanced/enabled"), + enable); +} -bool abt_settings::isAdvancedOptionSet(const QString &option) const +//public +/** \brief checks if the advanced options are enabled or not + * + * \returns true if enabled + * \returns false if disabled + */ +bool abt_settings::isAdvancedEnabled() const { - QString key = QString("Options/Advanced/").append(option); + QString key = QString::fromUtf8("Options/Advanced/enabled"); return this->settings->value(key, false).toBool(); } +//public +/** \brief checks if the advanced options are enabled and returns the value + * of the wanted \a option. + * + * If the advanced options are not enabled, false is returned always! + * Otherwise the value of the supplied \a option. + */ +bool abt_settings::isAdvancedOptionSet(const QString &option) const +{ + bool ret = false; + + if (this->isAdvancedEnabled()) { + QString key = QString::fromUtf8("Options/Advanced/").append(option); + ret = this->settings->value(key, false).toBool(); + } + return ret; +} + +//public +/** \brief stores the \a value for the \a \option + * + * The value is only stored when the advanced options are enabled! + */ void abt_settings::setAdvancedOption(const QString &option, bool value) { - QString key = QString("Options/Advanced/").append(option); - this->settings->setValue(key, value); + if (this->isAdvancedEnabled()) { + QString key = QString::fromUtf8("Options/Advanced/").append(option); + this->settings->setValue(key, value); + } } +//public +/** \overload */ +void abt_settings::setAdvancedOption(const QString &option, QString value) +{ + if (this->isAdvancedEnabled()) { + QString key = QString::fromUtf8("Options/Advanced/").append(option); + this->settings->setValue(key, value); + } +} + +//public +/** \brief gets the value for the \a option from the advanced options + * + * If the advanced options are not enabled or if the \a option is not stored + * at the settings file, the \a defValue is returned. + * + * Otherwise the read string from the settings file is returned. + */ +QString abt_settings::getAdvancedOption(const QString &option, + const QString defValue) const +{ + if (this->isAdvancedEnabled()) { + QString key = QString::fromUtf8("Options/Advanced/").append(option); + return this->settings->value(key, defValue).toString(); + } + return defValue; +} + +//public +/** \brief deletes an advanced option from the settings file */ void abt_settings::deleteAdvancedOption(const QString &option) { - this->settings->beginGroup("Options/Advanced/"); + this->settings->beginGroup(QString::fromUtf8("Options/Advanced/")); this->settings->remove(option); this->settings->endGroup(); } //public +/** \brief returns the regular expression for the purpose field. + * + * Additional checks are performed to be sure the returned value could be + * used as a regular expression. + * + * If the stored regex is empty or an invalid regex, the default value is + * returned. + */ +QString abt_settings::allowedCharsPurposeRegex() const +{ + QString regex = this->getAdvancedOption(QString::fromUtf8("RegexPurpose"), + DEFAULT_REGEX_PURPOSE); + + if (regex.isEmpty() || !QRegExp(regex).isValid()) + regex = DEFAULT_REGEX_PURPOSE; + + return regex; +} + +//public +/** \brief returns the regular expression for the recipient name / bankname field. + * + * Additional checks are performed to be sure the returned value could be + * used as a regular expression. + * + * If the stored regex is empty or an invalid regex, the default value is + * returned. + */ +QString abt_settings::allowedCharsRecipientRegex() const +{ + QString regex = this->getAdvancedOption(QString::fromUtf8("RegexRecipient"), + DEFAULT_REGEX_RECIPIENT); + + if (regex.isEmpty() || !QRegExp(regex).isValid()) + regex = DEFAULT_REGEX_RECIPIENT; + + return regex; +} + +//public /** \brief returns the language set by the user (or an empty string if nothing set) */ QString abt_settings::language() const { - return this->settings->value("Options/Language", QString("")).toString(); + return this->settings->value(QString::fromUtf8("Options/Language"), + QString()).toString(); } void abt_settings::saveColWidth(const QString &name, int col, int width) { - QString key = QString("Main/").append(name); - QString key2 = QString("/col%1").arg(col); + QString key = QString::fromUtf8("Main/").append(name); + QString key2 = QString::fromUtf8("/col%1").arg(col); key.append(key2); this->settings->setValue(key, width); } int abt_settings::getColWidth(const QString &name, int col, int def) { - QString key = QString("Main/").append(name); - QString key2 = QString("/col%1").arg(col); + QString key = QString::fromUtf8("Main/").append(name); + QString key2 = QString::fromUtf8("/col%1").arg(col); key.append(key2); bool convOK; int ret = this->settings->value(key, def).toInt(&convOK); @@ -558,7 +698,6 @@ } } - /** * @returns -1: error (not handled \a type passed) * @returns 0: not supported @@ -569,6 +708,8 @@ //static public int abt_settings::supportedByAbtransfers(const AB_JOB_TYPE type) { + int ret = -1; //default error + switch (type) { //supported and implemented types case AB_Job_TypeGetBalance : @@ -586,7 +727,7 @@ case AB_Job_TypeModifyStandingOrder : case AB_Job_TypeDeleteStandingOrder : case AB_Job_TypeGetStandingOrders : - return 1; + ret = 1; //supported break; //not supported but should be implemented @@ -594,17 +735,26 @@ case AB_Job_TypeDebitNote : case AB_Job_TypeSepaDebitNote : case AB_Job_TypeLoadCellPhone : - return 2; +#if AQBANKING_VERSION_MAJOR >= 5 && AQBANKING_VERSION_MINOR >= 5 + case AB_Job_TypeSepaFlashDebitNote : + case AB_Job_TypeSepaCreateStandingOrder : + case AB_Job_TypeSepaDeleteStandingOrder : + case AB_Job_TypeSepaModifyStandingOrder : + case AB_Job_TypeSepaGetStandingOrders : +#endif + ret = 2; //not supported yet break; //not supported (and not planed to be implemented) case AB_Job_TypeGetTransactions : case AB_Job_TypeUnknown : - return 0; + ret = 0; //not supported yet break; + default: + ret = -1; //error (not handled type) } - return -1; //error + return ret; } //public @@ -615,7 +765,8 @@ return; //Abbruch } - this->settings->setValue("Main/RecipientsFilename", filename); + this->settings->setValue(QString::fromUtf8("Main/RecipientsFilename"), + filename); this->m_recipientsFilename = filename; } @@ -628,7 +779,8 @@ return; //Abbruch } - this->settings->setValue("Main/AccountDataFilename", filename); + this->settings->setValue(QString::fromUtf8("Main/AccountDataFilename"), + filename); this->m_accountdataFilename = filename; } @@ -641,7 +793,8 @@ return; //Abbruch } - this->settings->setValue("Main/HistoryFilename", filename); + this->settings->setValue(QString::fromUtf8("Main/HistoryFilename"), + filename); this->m_historyFilename = filename; } @@ -654,7 +807,7 @@ return; //Abbruch } - this->settings->setValue("Main/DataDir", dirname); + this->settings->setValue(QString::fromUtf8("Main/DataDir"), dirname); this->m_dataDir = dirname; } @@ -667,7 +820,8 @@ return; // cancel } - this->settings->setValue("Main/AutoExportFilename", filename); + this->settings->setValue(QString::fromUtf8("Main/AutoExportFilename"), + filename); this->m_autoExportFilename = filename; } diff --git a/src/abt_settings.h b/src/abt_settings.h --- a/src/abt_settings.h +++ b/src/abt_settings.h @@ -42,8 +42,15 @@ #include "abt_standingorderinfo.h" #include "abt_datedtransferinfo.h" + +/** default regular expression for valid characters at the purpose field. */ +static const QString DEFAULT_REGEX_PURPOSE = QString::fromUtf8("[-+ .,/*&%0-9A-Za-z]"); + +/** default regular expression for valid characters at the recipient and bankname field. */ +static const QString DEFAULT_REGEX_RECIPIENT = QString::fromUtf8("[-+ .,/*&%0-9A-Za-z]"); + + /** \brief saves and restores settings which can be modified by the user */ - class abt_settings : public QObject { Q_OBJECT @@ -114,10 +121,18 @@ void setProfileFavorit(const QString &name, bool favorit); void deleteProfileFavorit(const QString &name); + void setAdvancedOptionEnabled(bool enable); + bool isAdvancedEnabled() const; bool isAdvancedOptionSet(const QString &option) const; void setAdvancedOption(const QString &option, bool value); + void setAdvancedOption(const QString &option, QString value); + QString getAdvancedOption(const QString &option, + const QString defValue = QString()) const; void deleteAdvancedOption(const QString &option); + QString allowedCharsPurposeRegex() const; + QString allowedCharsRecipientRegex() const; + QString language() const; void saveColWidth(const QString &name, int col, int width); @@ -128,6 +143,7 @@ static void resizeColToContentsFor(QTreeWidget *w); + signals: void recipientsListChanged(); diff --git a/src/abt_transaction_base.cpp b/src/abt_transaction_base.cpp --- a/src/abt_transaction_base.cpp +++ b/src/abt_transaction_base.cpp @@ -133,6 +133,9 @@ const QString abt_transaction::getLocalCountry() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetLocalCountry(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetLocalCountry(this->aqb_transaction_C)); @@ -142,12 +145,15 @@ void abt_transaction::setLocalCountry(const QString &Country) { AB_Transaction_SetLocalCountry(this->aqb_transaction, - Country.toUtf8()); + Country.toStdString().c_str()); } const QString abt_transaction::getLocalBankCode() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetLocalBankCode(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetLocalBankCode(this->aqb_transaction_C)); @@ -157,12 +163,15 @@ void abt_transaction::setLocalBankCode(const QString &BankCode) { AB_Transaction_SetLocalBankCode(this->aqb_transaction, - BankCode.toUtf8()); + BankCode.toStdString().c_str()); } const QString abt_transaction::getLocalBranchId() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetLocalBranchId(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetLocalBranchId(this->aqb_transaction_C)); @@ -172,12 +181,15 @@ void abt_transaction::setLocalBranchId(const QString &BranchId) { AB_Transaction_SetLocalBranchId(this->aqb_transaction, - BranchId.toUtf8()); + BranchId.toStdString().c_str()); } const QString abt_transaction::getLocalAccountNumber() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetLocalAccountNumber(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetLocalAccountNumber(this->aqb_transaction_C)); @@ -187,12 +199,15 @@ void abt_transaction::setLocalAccountNumber(const QString &AccountNumber) { AB_Transaction_SetLocalAccountNumber(this->aqb_transaction, - AccountNumber.toUtf8()); + AccountNumber.toStdString().c_str()); } const QString abt_transaction::getLocalSuffix() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetLocalSuffix(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetLocalSuffix(this->aqb_transaction_C)); @@ -202,12 +217,15 @@ void abt_transaction::setLocalSuffix(const QString &Suffix) { AB_Transaction_SetLocalSuffix(this->aqb_transaction, - Suffix.toUtf8()); + Suffix.toStdString().c_str()); } const QString abt_transaction::getLocalIban() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetLocalIban(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetLocalIban(this->aqb_transaction_C)); @@ -217,12 +235,15 @@ void abt_transaction::setLocalIban(const QString &Iban) { AB_Transaction_SetLocalIban(this->aqb_transaction, - Iban.toUtf8()); + Iban.toStdString().c_str()); } const QString abt_transaction::getLocalName() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetLocalName(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetLocalName(this->aqb_transaction_C)); @@ -232,12 +253,15 @@ void abt_transaction::setLocalName(const QString &Name) { AB_Transaction_SetLocalName(this->aqb_transaction, - Name.toUtf8()); + Name.toStdString().c_str()); } const QString abt_transaction::getLocalBic() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetLocalBic(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetLocalBic(this->aqb_transaction_C)); @@ -247,7 +271,7 @@ void abt_transaction::setLocalBic(const QString &Bic) { AB_Transaction_SetLocalBic(this->aqb_transaction, - Bic.toUtf8()); + Bic.toStdString().c_str()); } @@ -257,6 +281,9 @@ const QString abt_transaction::getRemoteCountry() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteCountry(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteCountry(this->aqb_transaction_C)); @@ -266,12 +293,15 @@ void abt_transaction::setRemoteCountry(const QString &Country) { AB_Transaction_SetRemoteCountry(this->aqb_transaction, - Country.toUtf8()); + Country.toStdString().c_str()); } const QString abt_transaction::getRemoteBankName() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteBankName(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteBankName(this->aqb_transaction_C)); @@ -281,12 +311,15 @@ void abt_transaction::setRemoteBankName(const QString &BankName) { AB_Transaction_SetRemoteBankName(this->aqb_transaction, - BankName.toUtf8()); + BankName.toStdString().c_str()); } const QString abt_transaction::getRemoteBankLocation() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteBankLocation(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteBankLocation(this->aqb_transaction_C)); @@ -296,12 +329,15 @@ void abt_transaction::setRemoteBankLocation(const QString &BankLocation) { AB_Transaction_SetRemoteBankLocation(this->aqb_transaction, - BankLocation.toUtf8()); + BankLocation.toStdString().c_str()); } const QString abt_transaction::getRemoteBankCode() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteBankCode(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteBankCode(this->aqb_transaction_C)); @@ -311,12 +347,15 @@ void abt_transaction::setRemoteBankCode(const QString &BankCode) { AB_Transaction_SetRemoteBankCode(this->aqb_transaction, - BankCode.toUtf8()); + BankCode.toStdString().c_str()); } const QString abt_transaction::getRemoteBranchId() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteBranchId(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteBranchId(this->aqb_transaction_C)); @@ -326,12 +365,15 @@ void abt_transaction::setRemoteBranchId(const QString &BranchId) { AB_Transaction_SetRemoteBranchId(this->aqb_transaction, - BranchId.toUtf8()); + BranchId.toStdString().c_str()); } const QString abt_transaction::getRemoteAccountNumber() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteAccountNumber(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteAccountNumber(this->aqb_transaction_C)); @@ -341,12 +383,15 @@ void abt_transaction::setRemoteAccountNumber(const QString &AccountNumber) { AB_Transaction_SetRemoteAccountNumber(this->aqb_transaction, - AccountNumber.toUtf8()); + AccountNumber.toStdString().c_str()); } const QString abt_transaction::getRemoteSuffix() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteSuffix(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteSuffix(this->aqb_transaction_C)); @@ -356,12 +401,15 @@ void abt_transaction::setRemoteSuffix(const QString &Suffix) { AB_Transaction_SetRemoteSuffix(this->aqb_transaction, - Suffix.toUtf8()); + Suffix.toStdString().c_str()); } const QString abt_transaction::getRemoteIban() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteIban(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteIban(this->aqb_transaction_C)); @@ -371,7 +419,7 @@ void abt_transaction::setRemoteIban(const QString &Iban) { AB_Transaction_SetRemoteIban(this->aqb_transaction, - Iban.toUtf8()); + Iban.toStdString().c_str()); } const QStringList abt_transaction::getRemoteName() const @@ -389,6 +437,9 @@ const QString abt_transaction::getRemoteBic() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteBic(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteBic(this->aqb_transaction_C)); @@ -398,7 +449,7 @@ void abt_transaction::setRemoteBic(const QString &Bic) { AB_Transaction_SetRemoteBic(this->aqb_transaction, - Bic.toUtf8()); + Bic.toStdString().c_str()); } @@ -485,6 +536,9 @@ const QString abt_transaction::getTransactionKey() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetTransactionKey(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetTransactionKey(this->aqb_transaction_C)); @@ -494,12 +548,15 @@ void abt_transaction::setTransactionKey(const QString &TransactionKey) { AB_Transaction_SetTransactionKey(this->aqb_transaction, - TransactionKey.toUtf8()); + TransactionKey.toStdString().c_str()); } const QString abt_transaction::getCustomerReference() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetCustomerReference(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetCustomerReference(this->aqb_transaction_C)); @@ -509,12 +566,15 @@ void abt_transaction::setCustomerReference(const QString &CustomerReference) { AB_Transaction_SetCustomerReference(this->aqb_transaction, - CustomerReference.toUtf8()); + CustomerReference.toStdString().c_str()); } const QString abt_transaction::getBankReference() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetBankReference(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetBankReference(this->aqb_transaction_C)); @@ -524,12 +584,15 @@ void abt_transaction::setBankReference(const QString &BankReference) { AB_Transaction_SetBankReference(this->aqb_transaction, - BankReference.toUtf8()); + BankReference.toStdString().c_str()); } const QString abt_transaction::getEndToEndReference() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetEndToEndReference(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetEndToEndReference(this->aqb_transaction_C)); @@ -539,42 +602,64 @@ void abt_transaction::setEndToEndReference(const QString &EndToEndReference) { AB_Transaction_SetEndToEndReference(this->aqb_transaction, - EndToEndReference.toUtf8()); + EndToEndReference.toStdString().c_str()); } const QString abt_transaction::getMandateReference() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetMandateId(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( - AB_Transaction_GetMandateReference(this->aqb_transaction_C)); + //removed in aqBanking > 5.5.0 because it is not used yet in + //abtransfers, we simple replace this with an equal function! + //AB_Transaction_GetMandateReference(this->aqb_transaction_C)); + AB_Transaction_GetMandateId(this->aqb_transaction_C)); return ret; } void abt_transaction::setMandateReference(const QString &MandateReference) { - AB_Transaction_SetMandateReference(this->aqb_transaction, - MandateReference.toUtf8()); + //removed in aqBanking > 5.5.0 because it is not used yet in + //abtransfers, we simple replace this with an equal function! + //AB_Transaction_SetMandateReference(this->aqb_transaction, + // MandateReference.toUtf8()); + AB_Transaction_SetMandateId(this->aqb_transaction, + MandateReference.toStdString().c_str()); } -const QString abt_transaction::getCreditorIdentifier() const +//was getCreditorIdentifier() +//removed in aqBanking > 5.5.0, because it is not used yet in abtransfers, we +//simple replace this with an equal function! +const QString abt_transaction::getCreditorSchemeId() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetCreditorSchemeId(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( - AB_Transaction_GetCreditorIdentifier(this->aqb_transaction_C)); + AB_Transaction_GetCreditorSchemeId(this->aqb_transaction_C)); return ret; } -void abt_transaction::setCreditorIdentifier(const QString &CreditorIdentifier) +//was setCreditorIdentifier() +//removed in aqBanking > 5.5.0, because it is not used yet in abtransfers, we +//simple replace this with an equal function! +void abt_transaction::setCreditorSchemeId(const QString &CreditorIdentifier) { - AB_Transaction_SetCreditorIdentifier(this->aqb_transaction, - CreditorIdentifier.toUtf8()); + AB_Transaction_SetCreditorSchemeId(this->aqb_transaction, + CreditorIdentifier.toStdString().c_str()); } const QString abt_transaction::getOriginatorIdentifier() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetOriginatorIdentifier(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetOriginatorIdentifier(this->aqb_transaction_C)); @@ -584,7 +669,7 @@ void abt_transaction::setOriginatorIdentifier(const QString &OriginatorIdentifier) { AB_Transaction_SetOriginatorIdentifier(this->aqb_transaction, - OriginatorIdentifier.toUtf8()); + OriginatorIdentifier.toStdString().c_str()); } @@ -602,6 +687,9 @@ const QString abt_transaction::getTransactionText() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetTransactionText(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetTransactionText(this->aqb_transaction_C)); @@ -611,12 +699,15 @@ void abt_transaction::setTransactionText(const QString &TransactionText) { AB_Transaction_SetTransactionText(this->aqb_transaction, - TransactionText.toUtf8()); + TransactionText.toStdString().c_str()); } const QString abt_transaction::getPrimanota() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetPrimanota(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetPrimanota(this->aqb_transaction_C)); @@ -626,12 +717,15 @@ void abt_transaction::setPrimanota(const QString &Primanota) { AB_Transaction_SetPrimanota(this->aqb_transaction, - Primanota.toUtf8()); + Primanota.toStdString().c_str()); } const QString abt_transaction::getFiId() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetFiId(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetFiId(this->aqb_transaction_C)); @@ -641,7 +735,7 @@ void abt_transaction::setFiId(const QString &FiId) { AB_Transaction_SetFiId(this->aqb_transaction, - FiId.toUtf8()); + FiId.toStdString().c_str()); } const QStringList abt_transaction::getPurpose() const @@ -816,6 +910,9 @@ const QString abt_transaction::getRemoteAddrStreet() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteAddrStreet(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteAddrStreet(this->aqb_transaction_C)); @@ -825,12 +922,15 @@ void abt_transaction::setRemoteAddrStreet(const QString &RemoteAddrStreet) { AB_Transaction_SetRemoteAddrStreet(this->aqb_transaction, - RemoteAddrStreet.toUtf8()); + RemoteAddrStreet.toStdString().c_str()); } const QString abt_transaction::getRemoteAddrZipcode() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteAddrZipcode(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteAddrZipcode(this->aqb_transaction_C)); @@ -840,12 +940,15 @@ void abt_transaction::setRemoteAddrZipcode(const QString &RemoteAddrZipcode) { AB_Transaction_SetRemoteAddrZipcode(this->aqb_transaction, - RemoteAddrZipcode.toUtf8()); + RemoteAddrZipcode.toStdString().c_str()); } const QString abt_transaction::getRemoteAddrCity() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemoteAddrCity(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemoteAddrCity(this->aqb_transaction_C)); @@ -855,12 +958,15 @@ void abt_transaction::setRemoteAddrCity(const QString &RemoteAddrCity) { AB_Transaction_SetRemoteAddrCity(this->aqb_transaction, - RemoteAddrCity.toUtf8()); + RemoteAddrCity.toStdString().c_str()); } const QString abt_transaction::getRemotePhone() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetRemotePhone(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetRemotePhone(this->aqb_transaction_C)); @@ -870,7 +976,7 @@ void abt_transaction::setRemotePhone(const QString &RemotePhone) { AB_Transaction_SetRemotePhone(this->aqb_transaction, - RemotePhone.toUtf8()); + RemotePhone.toStdString().c_str()); } @@ -884,6 +990,9 @@ const QString abt_transaction::getUnitId() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetUnitId(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetUnitId(this->aqb_transaction_C)); @@ -892,12 +1001,16 @@ void abt_transaction::setUnitId(const QString &UnitId) { - AB_Transaction_SetUnitId(this->aqb_transaction, UnitId.toUtf8()); + AB_Transaction_SetUnitId(this->aqb_transaction, + UnitId.toStdString().c_str()); } const QString abt_transaction::getUnitIdNameSpace() const { +// return abt_conv::encodeFromAb( +// AB_Transaction_GetUnitIdNameSpace(this->aqb_transaction_C)); + QString ret; ret = QString::fromUtf8( AB_Transaction_GetUnitIdNameSpace(this->aqb_transaction_C)); @@ -907,7 +1020,7 @@ void abt_transaction::setUnitIdNameSpace(const QString &UnitIdNameSpace) { AB_Transaction_SetUnitIdNameSpace(this->aqb_transaction, - UnitIdNameSpace.toUtf8()); + UnitIdNameSpace.toStdString().c_str()); } diff --git a/src/abt_transaction_base.h b/src/abt_transaction_base.h --- a/src/abt_transaction_base.h +++ b/src/abt_transaction_base.h @@ -176,8 +176,8 @@ const QString getMandateReference() const; void setMandateReference(const QString &MandateReference); - const QString getCreditorIdentifier() const; - void setCreditorIdentifier(const QString &CreditorIdentifier); + const QString getCreditorSchemeId() const; + void setCreditorSchemeId(const QString &CreditorIdentifier); const QString getOriginatorIdentifier() const; void setOriginatorIdentifier(const QString &OriginatorIdentifier); @@ -323,8 +323,8 @@ }; -Q_DECLARE_METATYPE(abt_transaction); -Q_DECLARE_METATYPE(abt_transaction*); -Q_DECLARE_METATYPE(const abt_transaction*); +Q_DECLARE_METATYPE(abt_transaction) +Q_DECLARE_METATYPE(abt_transaction*) +Q_DECLARE_METATYPE(const abt_transaction*) #endif // TRANS_JOB_H diff --git a/src/abt_transactionlimits.cpp b/src/abt_transactionlimits.cpp --- a/src/abt_transactionlimits.cpp +++ b/src/abt_transactionlimits.cpp @@ -100,7 +100,7 @@ // } else { // this->TextKeys = "Not available"; // } - this->TextKeys = "not used by AB-Transfers, yet."; + this->TextKeys = QString::fromUtf8("not used by AB-Transfers, yet."); this->MaxLenCustomerReference = AB_TransactionLimits_GetMaxLenCustomerReference(el); this->MinLenCustomerReference = AB_TransactionLimits_GetMinLenCustomerReference(el); diff --git a/src/abt_validators.cpp b/src/abt_validators.cpp --- a/src/abt_validators.cpp +++ b/src/abt_validators.cpp @@ -43,16 +43,16 @@ void BetragValidator::fixup(QString &input) const { - int commapos = input.lastIndexOf(','); + int commapos = input.lastIndexOf(QLatin1Char(',')); if (commapos == -1) { - input.append(",00"); + input.append(QString::fromUtf8(",00")); return; } else { if (input.length()-1 - commapos == 1) { - input.append("0"); + input.append(QString::fromUtf8("0")); return; } else if (input.length()-1 - commapos == 0) { - input.append("00"); + input.append(QString::fromUtf8("00")); return; } } diff --git a/src/aqb_accountinfo.cpp b/src/aqb_accountinfo.cpp --- a/src/aqb_accountinfo.cpp +++ b/src/aqb_accountinfo.cpp @@ -101,18 +101,18 @@ this->m_availableJobs = NULL; this->m_ID = 0; - this->m_BankCode = ""; - this->m_BankName = ""; - this->m_Number = ""; - this->m_Name = ""; - this->m_BackendName = ""; - this->m_SubAccountId = ""; - this->m_IBAN = ""; - this->m_BIC = ""; - this->m_OwnerName = ""; - this->m_Currency = ""; - this->m_Country = ""; - this->m_AccountType = ""; + this->m_BankCode = QString(); + this->m_BankName = QString(); + this->m_Number = QString(); + this->m_Name = QString(); + this->m_BackendName = QString(); + this->m_SubAccountId = QString(); + this->m_IBAN = QString(); + this->m_BIC = QString(); + this->m_OwnerName = QString(); + this->m_Currency = QString(); + this->m_Country = QString(); + this->m_AccountType = QString(); //geblockte Signale wieder auf den vorherigen Zustand setzen @@ -250,7 +250,7 @@ //protected AB_IMEXPORTER_CONTEXT *aqb_AccountInfo::getContext() const { - //Dadurch das die aufrugende Funktion über AB_ImExporterContext_free() + //Dadurch das die aufrufende Funktion über AB_ImExporterContext_free() //den Context wieder freigibt dürfen wir nur kopien unserer Daten in den //Context einfügen, ansonsten würden die Daten in unserem Objekt //gelöscht werden. @@ -388,11 +388,11 @@ if (!this->account_status) return QString(); const AB_VALUE *v; - QString value = ""; //empty string als default + QString value = QString(); //empty string als default v = AB_AccountStatus_GetBankLine(this->account_status); if (v) { - value = QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2); + value = QString::fromUtf8("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2); } return value; @@ -405,13 +405,13 @@ const AB_VALUE *v; const AB_BALANCE *b; - QString value = ""; //empty string als default + QString value = QString(); //empty string als default b = AB_AccountStatus_GetNotedBalance(this->account_status); if (b) { v = AB_Balance_GetValue(b); if (v) { - value = QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2); + value = QString::fromUtf8("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2); } } @@ -425,13 +425,13 @@ const AB_VALUE *v; const AB_BALANCE *b; - QString value = ""; //empty string als default + QString value = QString(); //empty string als default b = AB_AccountStatus_GetBookedBalance(this->account_status); if (b) { v = AB_Balance_GetValue(b); if (v) { - value = QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2); + value = QString::fromUtf8("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2); } } @@ -444,11 +444,11 @@ if (!this->account_status) return QString(); const AB_VALUE *v; - QString value = ""; //empty string als default + QString value = QString(); //empty string als default v = AB_AccountStatus_GetDisposable(this->account_status); if (v) { - value = QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2); + value = QString::fromUtf8("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2); } return value; @@ -460,11 +460,11 @@ if (!this->account_status) return QString(); const AB_VALUE *v; - QString value = ""; //empty string als default + QString value = QString(); //empty string als default v = AB_AccountStatus_GetDisposed(this->account_status); if (v) { - value = QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2); + value = QString::fromUtf8("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2); } return value; diff --git a/src/aqb_accounts.cpp b/src/aqb_accounts.cpp --- a/src/aqb_accounts.cpp +++ b/src/aqb_accounts.cpp @@ -144,6 +144,8 @@ const QString &owner, const QString &name) const { + /** \todo should also support iban and bic! */ + aqb_AccountInfo *acc = NULL; //Alle Accounts durchgehen @@ -171,10 +173,10 @@ aqb_AccountInfo* aqb_Accounts::getAccount(const AB_ACCOUNT *a) const { Q_ASSERT(a); - QString kto = AB_Account_GetAccountNumber(a); - QString blz = AB_Account_GetBankCode(a); - QString name = AB_Account_GetAccountName(a); - QString owner = AB_Account_GetOwnerName(a); + QString kto = QString::fromUtf8(AB_Account_GetAccountNumber(a)); + QString blz = QString::fromUtf8(AB_Account_GetBankCode(a)); + QString name = QString::fromUtf8(AB_Account_GetAccountName(a)); + QString owner = QString::fromUtf8(AB_Account_GetOwnerName(a)); return this->getAccount(kto, blz, owner, name); } diff --git a/src/aqb_accounts.h b/src/aqb_accounts.h --- a/src/aqb_accounts.h +++ b/src/aqb_accounts.h @@ -65,9 +65,9 @@ /** \brief returns the account that matches or NULL */ aqb_AccountInfo* getAccount(const QString &kontonummer, - const QString &blz = "", - const QString &owner = "", - const QString &name = "") const; + const QString &blz = QString(), + const QString &owner = QString(), + const QString &name = QString()) const; /** \overload */ aqb_AccountInfo* getAccount(const AB_ACCOUNT *a) const; diff --git a/src/aqb_banking.cpp b/src/aqb_banking.cpp --- a/src/aqb_banking.cpp +++ b/src/aqb_banking.cpp @@ -60,7 +60,7 @@ } AB_Banking_GetVersion(&this->major, &this->minor, &this->patch, &this->build); - this->aqbanking_version = QString("%1.%2.%3.%4") + this->aqbanking_version = QString::fromUtf8("%1.%2.%3.%4") .arg(this->major) .arg(this->minor) .arg(this->patch) @@ -185,7 +185,7 @@ /** \todo: Adjust the version label when AqBanking supports setting * the last date. */ - return !(this->aqbanking_version < "9.9.9"); + return !(this->aqbanking_version < QString::fromUtf8("9.9.9")); } @@ -194,8 +194,8 @@ QString aqb_banking::getInstituteFromBLZ(const QString &BLZ) const { AB_BANKINFO *bankinfo; - QString Institute = "NO INFORMATION"; - bankinfo = AB_Banking_GetBankInfo(this->ab, "de", "", BLZ.toUtf8()); + QString Institute = QString::fromUtf8("NO INFORMATION"); + bankinfo = AB_Banking_GetBankInfo(this->ab, "de", "", BLZ.toStdString().c_str()); if (bankinfo) { Institute = QString::fromUtf8(AB_BankInfo_GetBankName(bankinfo)); @@ -244,8 +244,10 @@ { AB_BANKINFO_CHECKRESULT res; res = AB_Banking_CheckAccount(this->ab, - country.toUtf8(), branchId.toUtf8(), - bankId.toUtf8(), accountId.toUtf8()); + country.toStdString().c_str(), + branchId.toStdString().c_str(), + bankId.toStdString().c_str(), + accountId.toStdString().c_str()); switch (res) { case AB_BankInfoCheckResult_Ok: result = QObject::tr("OK"); @@ -289,16 +291,16 @@ } } - QString resStr = ""; + QString resStr = QString(); QString countryCode = iban.left(2); QString pruefziffer = iban.mid(2,2); QString blz = iban.mid(4,8); QString ktonr = iban.mid(12); - if (countryCode.toUpper() == "DE") { + if (countryCode.toUpper() == QString::fromUtf8("DE")) { //the IBAN is for a german bank account, so we can also check //the account-number and bankcode - if (!this->checkAccount("de", "", blz, ktonr, resStr)) { + if (!this->checkAccount(QString::fromUtf8("de"), QString(), blz, ktonr, resStr)) { result = QObject::tr("Überprüfung von Kontonummer und " "Bankleitzahl für Deutsches Konto " "fehlerhaft: %1").arg(resStr); @@ -312,7 +314,7 @@ for(int i=0; i<4; i++) { if (iban.at(i).isLetter()) { //A=10, B=11, C=12 etc. - int value = iban.at(i).toUpper().toAscii()-55; + int value = iban.at(i).toUpper().toLatin1()-55; pp_substitution.append(QString::number(value)); } else { pp_substitution.append(iban.at(i)); @@ -324,7 +326,7 @@ QString sIban; for(int i=4; inames = new QStringList(); GWEN_DB_NODE *nvars = GWEN_DB_GetFirstVar(this->dbnode); while (nvars) { - const char *varname = GWEN_DB_VariableName(nvars); + QString varname = QString::fromUtf8(GWEN_DB_VariableName(nvars)); this->names->append(varname); nvars = GWEN_DB_GetNextVar(nvars); @@ -302,7 +302,7 @@ QVariant aqb_ieProfile::getValue(const char *varname, int idx /* = 0 */) const { QVariant value = QVariant::Invalid; - if (!this->names->contains(varname)) { + if (!this->names->contains(QString::fromUtf8(varname))) { qWarning() << Q_FUNC_INFO << this << "does not contain a var" << varname; return value; } @@ -311,7 +311,8 @@ switch(vartype) { case GWEN_DB_NodeType_ValueChar: - value = GWEN_DB_GetCharValue(this->dbnode, varname, idx, ""); + value = QString::fromUtf8(GWEN_DB_GetCharValue( + this->dbnode, varname, idx, "")); break; case GWEN_DB_NodeType_ValueInt: value = GWEN_DB_GetIntValue(this->dbnode, varname, idx, 0); diff --git a/src/aqb_imexporters.h b/src/aqb_imexporters.h --- a/src/aqb_imexporters.h +++ b/src/aqb_imexporters.h @@ -138,14 +138,14 @@ int loadProfiles(AB_BANKING *ab); public: - const char *getName() const { return this->name; } - const char *getType() const { return this->type; } - const char *getDescShort() const { return this->desc_short; } - const char *getDescLong() const { return this->desc_long; } - const char *getFilename() const { return this->filename; } - const char *getPath() const { return this->path; } - const char *getAuthor() const { return this->author; } - const char *getVersion() const { return this->version; } + const QString getName() const { return QString::fromUtf8(this->name); } + const QString getType() const { return QString::fromUtf8(this->type); } + const QString getDescShort() const { return QString::fromUtf8(this->desc_short); } + const QString getDescLong() const { return QString::fromUtf8(this->desc_long); } + const QString getFilename() const { return QString::fromUtf8(this->filename); } + const QString getPath() const { return QString::fromUtf8(this->path); } + const QString getAuthor() const { return QString::fromUtf8(this->author); } + const QString getVersion() const { return QString::fromUtf8(this->version); } const GWEN_PLUGIN_DESCRIPTION *getPD() const { return this->pd; } diff --git a/src/dialogs/abt_dialog.cpp b/src/dialogs/abt_dialog.cpp --- a/src/dialogs/abt_dialog.cpp +++ b/src/dialogs/abt_dialog.cpp @@ -69,7 +69,7 @@ } //Icon entsprechend der vorgabe einstellen - this->ui->label_Icon->setText(""); //keine Beschriftung + this->ui->label_Icon->setText(QString()); //keine Beschriftung QIcon tmpIcon; QStyle *style = parent ? parent->style() : QApplication::style(); int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, parent); diff --git a/src/dialogs/abt_dialog.h b/src/dialogs/abt_dialog.h --- a/src/dialogs/abt_dialog.h +++ b/src/dialogs/abt_dialog.h @@ -72,9 +72,9 @@ QDialogButtonBox::StandardButtons buttons, QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::NoButton, QMessageBox::Icon Icon = QMessageBox::NoIcon, - QString dialogName = "", + QString dialogName = QString(), bool showCheckBox = true, - QString checkBoxText = ""); + QString checkBoxText = QString()); ~abt_dialog(); diff --git a/src/dialogs/dialogsettings.cpp b/src/dialogs/dialogsettings.cpp --- a/src/dialogs/dialogsettings.cpp +++ b/src/dialogs/dialogsettings.cpp @@ -32,10 +32,10 @@ #include "dialogsettings.h" #include "ui_dialogsettings.h" -#include -#include -#include -#include +#include +#include +#include +#include #include "../abt_settings.h" #include "../dialogs/abt_dialog.h" @@ -68,11 +68,16 @@ this->onCheckBoxRefereshAtStartStateChanged(0); QIcon ico; - ico = QIcon::fromTheme("document-new", QIcon(":/icons/document-new")); + ico = QIcon::fromTheme(QString::fromUtf8("document-new"), + QIcon(QString::fromUtf8(":/icons/document-new"))); this->ui->actionNewProfile->setIcon(ico); - ico = QIcon::fromTheme("document-edit", QIcon(":/icons/document-edit")); + + ico = QIcon::fromTheme(QString::fromUtf8("document-edit"), + QIcon(QString::fromUtf8(":/icons/document-edit"))); this->ui->actionEditProfile->setIcon(ico); - ico = QIcon::fromTheme("edit-delete", QIcon(":/icons/delete")); + + ico = QIcon::fromTheme(QString::fromUtf8("edit-delete"), + QIcon(QString::fromUtf8(":/icons/delete"))); this->ui->actionDeleteProfile->setIcon(ico); connect(this->ui->checkBox_getBalance, SIGNAL(stateChanged(int)), @@ -135,19 +140,27 @@ this->ui->lineEdit_history->setText(this->settings->getHistoryFilename()); this->ui->lineEdit_recipients->setText(this->settings->getRecipientsFilename()); - this->ui->checkBox_warnCosts->setChecked(this->settings->showDialog("WarnCosts")); - this->ui->checkBox_jobAddedToOutput->setChecked(this->settings->showDialog("JobAddOutput")); - this->ui->checkBox_warnDeleteProfile->setChecked(this->settings->showDialog("ProfileConfirmDelete")); - this->ui->checkBox_warnDeleteHistory->setChecked(this->settings->showDialog("HistoryConfirmDelete")); - this->ui->checkBox_runtimeLanguageChange->setChecked(this->settings->showDialog("RuntimeLanguageChange")); + QString name = QString::fromUtf8("WarnCosts"); + this->ui->checkBox_warnCosts->setChecked(this->settings->showDialog(name)); + name = QString::fromUtf8("JobAddOutput"); + this->ui->checkBox_jobAddedToOutput->setChecked(this->settings->showDialog(name)); + name = QString::fromUtf8("ProfileConfirmDelete"); + this->ui->checkBox_warnDeleteProfile->setChecked(this->settings->showDialog(name)); + name = QString::fromUtf8("HistoryConfirmDelete"); + this->ui->checkBox_warnDeleteHistory->setChecked(this->settings->showDialog(name)); + name = QString::fromUtf8("RuntimeLanguageChange"); + this->ui->checkBox_runtimeLanguageChange->setChecked(this->settings->showDialog(name)); - this->ui->checkBox_getBalance->setChecked(this->settings->appendJobToOutbox("getBalance")); - this->ui->checkBox_getStandingOrders->setChecked(this->settings->appendJobToOutbox("getStandingOrders")); - this->ui->checkBox_getDatedTransfers->setChecked(this->settings->appendJobToOutbox("getDatedTransfers")); - this->ui->checkBox_executeAtStart->setChecked(this->settings->appendJobToOutbox("executeAtStart")); + name = QString::fromUtf8("getBalance"); + this->ui->checkBox_getBalance->setChecked(this->settings->appendJobToOutbox(name)); + name = QString::fromUtf8("getStandingOrders"); + this->ui->checkBox_getStandingOrders->setChecked(this->settings->appendJobToOutbox(name)); + name = QString::fromUtf8("getDatedTransfers"); + this->ui->checkBox_getDatedTransfers->setChecked(this->settings->appendJobToOutbox(name)); + name = QString::fromUtf8("executeAtStart"); + this->ui->checkBox_executeAtStart->setChecked(this->settings->appendJobToOutbox(name)); - this->ui->checkBox_adv_manualOutboxRearrange->setChecked( - this->settings->isAdvancedOptionSet("ManualOutboxRearrange")); + this->loadAdvancedSettings(); this->loadFavoriteImExpFromSettings(); @@ -178,7 +191,6 @@ break; } } - } //private @@ -189,20 +201,46 @@ this->settings->setHistoryFilename(this->ui->lineEdit_history->text()); this->settings->setRecipientsFilename(this->ui->lineEdit_recipients->text()); - this->settings->setShowDialog("WarnCosts", this->ui->checkBox_warnCosts->isChecked()); - this->settings->setShowDialog("JobAddOutput", this->ui->checkBox_jobAddedToOutput->isChecked()); - this->settings->setShowDialog("ProfileConfirmDelete", this->ui->checkBox_warnDeleteProfile->isChecked()); - this->settings->setShowDialog("HistoryConfirmDelete", this->ui->checkBox_warnDeleteHistory->isChecked()); - this->settings->setShowDialog("RuntimeLanguageChange", this->ui->checkBox_runtimeLanguageChange->isChecked()); + this->settings->setShowDialog(QString::fromUtf8("WarnCosts"), + this->ui->checkBox_warnCosts->isChecked()); + this->settings->setShowDialog(QString::fromUtf8("JobAddOutput"), + this->ui->checkBox_jobAddedToOutput->isChecked()); + this->settings->setShowDialog(QString::fromUtf8("ProfileConfirmDelete"), + this->ui->checkBox_warnDeleteProfile->isChecked()); + this->settings->setShowDialog(QString::fromUtf8("HistoryConfirmDelete"), + this->ui->checkBox_warnDeleteHistory->isChecked()); + this->settings->setShowDialog(QString::fromUtf8("RuntimeLanguageChange"), + this->ui->checkBox_runtimeLanguageChange->isChecked()); - this->settings->setAppendJobToOutbox("getBalance", this->ui->checkBox_getBalance->isChecked()); - this->settings->setAppendJobToOutbox("getStandingOrders", this->ui->checkBox_getStandingOrders->isChecked()); - this->settings->setAppendJobToOutbox("getDatedTransfers", this->ui->checkBox_getDatedTransfers->isChecked()); - this->settings->setAppendJobToOutbox("executeAtStart", this->ui->checkBox_executeAtStart->isChecked()); + this->settings->setAppendJobToOutbox(QString::fromUtf8("getBalance"), + this->ui->checkBox_getBalance->isChecked()); + this->settings->setAppendJobToOutbox(QString::fromUtf8("getStandingOrders"), + this->ui->checkBox_getStandingOrders->isChecked()); + this->settings->setAppendJobToOutbox(QString::fromUtf8("getDatedTransfers"), + this->ui->checkBox_getDatedTransfers->isChecked()); + this->settings->setAppendJobToOutbox(QString::fromUtf8("executeAtStart"), + this->ui->checkBox_executeAtStart->isChecked()); - this->settings->setAdvancedOption("ManualOutboxRearrange", + //Hint: the advanced options are only saved by this->settings if the + // advanced options are enabled! + this->settings->setAdvancedOption(QString::fromUtf8("ManualOutboxRearrange"), this->ui->checkBox_adv_manualOutboxRearrange->isChecked()); + //save regex values only if they can be used with QRegExp, otherwise + //store the default regex value! + QString regex; + regex = this->ui->lineEdit_regexPurpose->text(); + if (!QRegExp(regex).isValid()) + regex = DEFAULT_REGEX_PURPOSE; + this->settings->setAdvancedOption(QString::fromUtf8("RegexPurpose"), regex); + + regex = this->ui->lineEdit_regexRecipient->text(); + if (!QRegExp(regex).isValid()) + regex = DEFAULT_REGEX_PURPOSE; + this->settings->setAdvancedOption(QString::fromUtf8("RegexRecipient"), + this->ui->lineEdit_regexRecipient->text()); + + this->settings->setAutoAddNewRecipients(this->ui->checkBox_autoAddNewRecipients->isChecked()); this->settings->setAutoExportEnabled(this->ui->checkBox_autoExport->isChecked()); @@ -215,6 +253,25 @@ } +//private +/** \brief only loads and updates the advanced settings options! */ +void DialogSettings::loadAdvancedSettings(bool updateState /* = true */) +{ + bool checked; + + checked = this->settings->isAdvancedEnabled(); + this->ui->checkBox_adv_iKnowWhatIDo->setChecked(checked); + + if (updateState) + this->setAdvancedOptionState(checked); + + checked = this->settings->isAdvancedOptionSet(QString::fromUtf8("ManualOutboxRearrange")); + this->ui->checkBox_adv_manualOutboxRearrange->setChecked(checked); + + this->ui->lineEdit_regexPurpose->setText(this->settings->allowedCharsPurposeRegex()); + this->ui->lineEdit_regexRecipient->setText(this->settings->allowedCharsRecipientRegex()); +} + void DialogSettings::loadFavoriteImExpFromSettings() { //load all as favorite marked im-/exort profiles @@ -261,7 +318,7 @@ Q_ASSERT(this->imexp); //remember the selected item - QString pluginName = ""; + QString pluginName = QString(); int row = this->ui->listWidget_plugins->currentRow(); if (row != -1) { pluginName = this->ui->listWidget_plugins->item(row)->text(); @@ -289,7 +346,7 @@ { const aqb_iePlugin *plugin = NULL; int row = this->ui->listWidget_plugins->currentRow(); - QString pluginName = ""; + QString pluginName = QString(); if (row >= 0) pluginName = this->ui->listWidget_plugins->item(row)->text(); @@ -317,7 +374,7 @@ item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); this->ui->tableWidget_profiles->setItem(rowc, 0, item); - bool selected = this->selection.value(pluginName, "") == item->text(); + bool selected = this->selection.value(pluginName, QString()) == item->text(); //qDebug() << "ROW:" << rowc << "profile" << item->text() << selected; item = new QTableWidgetItem(); @@ -363,7 +420,7 @@ //if the profile is a favorite this is stored in the private QHash QString key = pluginName; - key.append("/"); + key.append(QString::fromUtf8("/")); key.append(profile->getValue("name").toString()); if (this->imex_favorites->value(key, false)) { checkState = Qt::Checked; @@ -422,7 +479,7 @@ exportsAvailable = false; foreach(aqb_ieProfile *profile, *plugin->getProfiles()) { //the plugin must contain a profile useable for export - if (profile->getNames()->contains("export") && + if (profile->getNames()->contains(QString::fromUtf8("export")) && profile->getValue("export").toInt() == 1) { exportsAvailable = true; break; @@ -447,6 +504,25 @@ } //private +/** \brief sets the advanced options state + * + * Enables or disables the input to the the advanced option fields depending + * on the supplied \a enabled value. + */ +void DialogSettings::setAdvancedOptionState(bool enabled) +{ + this->ui->checkBox_adv_manualOutboxRearrange->setEnabled(enabled); + this->ui->lineEdit_regexPurpose->setEnabled(enabled); + this->ui->label_12->setEnabled(enabled); + this->ui->lineEdit_regexRecipient->setEnabled(enabled); + this->ui->label_13->setEnabled(enabled); + + //the state is set already, do not update it. Otherwise we get a + //circular calling! + this->loadAdvancedSettings(false); +} + +//private bool DialogSettings::getSelectedPluginAndProfile(const aqb_iePlugin **plugin, const aqb_ieProfile **profile) const { @@ -679,7 +755,7 @@ QString key; // in the form of "pluginname/profilename" int listWidgetRow = this->ui->listWidget_plugins->currentRow(); key = this->ui->listWidget_plugins->item(listWidgetRow)->text(); //pluginname - key.append("/"); + key.append(QString::fromUtf8("/")); key.append(this->ui->tableWidget_profiles->item(item->row(), 0)->text()); //profilename this->imex_favorites->insert(key, checked); @@ -762,9 +838,9 @@ QString path = banking->getUserDataDir(); - path.append("/imexporters"); - path.append("/").append(plugin->getName()); - path.append("/profiles/"); + path.append(QString::fromUtf8("/imexporters")); + path.append(QString::fromUtf8("/")).append(plugin->getName()); + path.append(QString::fromUtf8("/profiles/")); lclImexpDir.setPath(path); if (!lclImexpDir.exists()) { @@ -787,15 +863,17 @@ } - GWEN_DB_NODE *dbProfile = AB_Banking_GetImExporterProfile(banking->getAqBanking(), - plugin->getName(), - profileName.toUtf8()); + GWEN_DB_NODE *dbProfile = AB_Banking_GetImExporterProfile( + banking->getAqBanking(), + plugin->getName().toStdString().c_str(), + profileName.toStdString().c_str()); QString filename = profile->getValue("fileName").toString(); - int ret = this->imexp->editProfileWithAqbDialog(dbProfile, - plugin->getName(), - filename.toUtf8()); + int ret = this->imexp->editProfileWithAqbDialog( + dbProfile, + plugin->getName().toStdString().c_str(), + filename.toStdString().c_str()); if (ret < 0) { //something went wrong @@ -822,7 +900,7 @@ newname = QInputDialog::getText(this, tr("Profil Name"), tr("Bitte geben sie einen Namen für " "das neue Profil ein"), - QLineEdit::Normal, "", &inputOk); + QLineEdit::Normal, QString(), &inputOk); if (!inputOk || newname.isEmpty()) { //no name was given or cancel clicked @@ -871,7 +949,7 @@ newname.toUtf8()); QString filename = newname; - filename.append(".conf"); + filename.append(QString::fromUtf8(".conf")); //the folder for the new local profile must exists, otherwise the //profile could not be saved by aqbanking @@ -881,9 +959,9 @@ QString path = banking->getUserDataDir(); - path.append("/imexporters"); - path.append("/").append(selPlugin->getName()); - path.append("/profiles/"); + path.append(QString::fromUtf8("/imexporters")); + path.append(QString::fromUtf8("/")).append(selPlugin->getName()); + path.append(QString::fromUtf8("/profiles/")); lclImexpDir.setPath(path); if (!lclImexpDir.exists()) { @@ -904,9 +982,10 @@ } } - int ret = this->imexp->editProfileWithAqbDialog(dbProfile, - selPlugin->getName(), - filename.toUtf8()); + int ret = this->imexp->editProfileWithAqbDialog( + dbProfile, + selPlugin->getName().toStdString().c_str(), + filename.toStdString().c_str()); if (ret < 0) { //something went wrong @@ -961,9 +1040,10 @@ QString path = banking->getUserDataDir(); - path.append("/imexporters"); - path.append("/").append(selPlugin->getName()); - path.append("/profiles/"); + //TODO: used 3 or more times, make a function! + path.append(QString::fromUtf8("/imexporters")); + path.append(QString::fromUtf8("/")).append(selPlugin->getName()); + path.append(QString::fromUtf8("/profiles/")); lclImexpDir.setPath(path); if (!lclImexpDir.exists()) { @@ -982,15 +1062,15 @@ "werden?").arg(selProfile->getValue("name").toString()), QDialogButtonBox::Yes | QDialogButtonBox::No, QDialogButtonBox::Yes, QMessageBox::Question, - "ProfileConfirmDelete"); + QString::fromUtf8("ProfileConfirmDelete")); if (delDia.exec() == QDialogButtonBox::Yes) { //remember the key for settings before deletion QString key = selPlugin->getName(); - key.append("/"); + key.append(QString::fromUtf8("/")); key.append(selProfile->getValue("name").toString()); QString file = lclImexpDir.absolutePath(); - file.append("/").append(profileFilename); + file.append(QString::fromUtf8("/")).append(profileFilename); QFile::remove(file); qDebug() << Q_FUNC_INFO << "file" << file << "deleted!"; @@ -1052,7 +1132,8 @@ return; } else { for (int i=0; iui->comboBox_profile->count(); ++i) { - if (this->ui->comboBox_profile->itemText(i) == "default") { + if (this->ui->comboBox_profile->itemText(i) == + QString::fromUtf8("default")) { idx = i; //default idx found, use it goto CURRENT_INDEX_CHANGED_SET_INDEX; @@ -1081,3 +1162,17 @@ this->ui->label_10->setEnabled(checked); this->ui->label_11->setEnabled(checked); } + +//private slot +/** \brief gets called when the checked value is changed. + * + * Saves the value immediately so that others functions can use this to + * evaluate if edits are allowed or not. + * + * Also update the enabled options for the advanced edits. +*/ +void DialogSettings::on_checkBox_adv_iKnowWhatIDo_toggled(bool checked) +{ + this->settings->setAdvancedOptionEnabled(checked); + this->setAdvancedOptionState(checked); +} diff --git a/src/dialogs/dialogsettings.h b/src/dialogs/dialogsettings.h --- a/src/dialogs/dialogsettings.h +++ b/src/dialogs/dialogsettings.h @@ -32,9 +32,9 @@ #ifndef DIALOGSETTINGS_H #define DIALOGSETTINGS_H -#include -#include -#include +#include +#include +#include #include "../aqb_imexporters.h" @@ -66,6 +66,7 @@ void loadFromSettings(); void saveToSettings(); + void loadAdvancedSettings(bool updateState = true); void loadFavoriteImExpFromSettings(); void saveFavoriteImExpToSettings(); @@ -75,6 +76,8 @@ void refreshImExProfileTableWidget(); void refreshAutoExportComboBoxPlugin(); + void setAdvancedOptionState(bool enabled); + /** @brief set @a plugin and @a profile to the selected values (or NULL) */ bool getSelectedPluginAndProfile(const aqb_iePlugin **plugin = NULL, const aqb_ieProfile **profile = NULL) const; @@ -103,6 +106,7 @@ void on_actionDeleteProfile_triggered(); void on_comboBox_plugin_currentIndexChanged(const QString &arg1); void on_checkBox_autoExport_toggled(bool checked); + void on_checkBox_adv_iKnowWhatIDo_toggled(bool checked); }; #endif // DIALOGSETTINGS_H diff --git a/src/dialogs/dialogsettings.ui b/src/dialogs/dialogsettings.ui --- a/src/dialogs/dialogsettings.ui +++ b/src/dialogs/dialogsettings.ui @@ -49,7 +49,7 @@ - 0 + 2 @@ -925,7 +925,7 @@ Erweitert - + @@ -937,42 +937,90 @@ - - - 12 + + + Ich weiß was ich mache. Änderungen zulassen! - - 16 + + + + + + Qt::Horizontal - - - - Wenn diese Option aktiviert ist können die Aufträge im Ausgang in der vorgegebenen Reihenfolge verändert werden. + + + + + + Wenn diese Option aktiviert ist können die Aufträge im Ausgang in der vorgegebenen Reihenfolge verändert werden. Je nachdem an welcher Position ein Auftrag zur Bank gesendet wird kann dies Auswirkungen auf die Antwort der Bank haben. Außerdem hat eine Verschiebung unter Umständen Einfluss darauf an welche Stelle ein neuer Aufträge in den Ausgang eingereiht wird! - - - Änderung der Reihenfolge im Ausgang ermöglichen (Hilfetext beachten) + + + Änderung der Reihenfolge im Ausgang ermöglichen (Hilfetext beachten) + + + + + + + + + + 140 + 22 + - - - - Qt::Vertical + + + + <html><head/><body><p>Der hier angegebene reguläre Ausdruck wird verwendet um zu Prüfen das nur gültige Zeichen als Verwendungszweck eingegeben werden können.</p><p>Er wird auf jedes Zeichen das Eingegeben wird angewendet und wenn der reguläre Ausdruck nicht passt wird die Eingabe unterdrückt.</p><p>Zusätzlich wird beim Absenden der Nachricht jede Zeile des Verwendungszwecks gegen den angegebenen regulären Ausdruck, mit einem vorgestellten &quot;^&quot; und angehangenem &quot;+$&quot;, auf Gültigkeit geprüft.</p><p>Beachten Sie Bitte beim Ändern des Ausdrucks das nicht alle Zeichen durch die Banken unterstützt werden!</p><p>Standard: &quot;[-+ .,/*&amp;%0-9A-Za-z]&quot;</p></body></html> - + + Regulärer Ausdruck der definiert welche Zeichen als Eingabe im Verwendungszweck zugelassen sind. + + + + + + - 20 - 40 + 140 + 22 - + + + + + + <html><head/><body><p>Der hier angegebene reguläre Ausdruck wird verwendet um zu Prüfen das nur gültige Zeichen als Empfängernamen eingegeben werden können.</p><p>Er wird auf jedes Zeichen das Eingegeben wird angewendet und wenn der reguläre Ausdruck nicht passt wird die Eingabe unterdrückt.</p><p>Zusätzlich wird beim Absenden der Nachricht jede Zeile des Empfängernamens gegen den angegebenen regulären Ausdruck, mit einem vorgestellten &quot;^&quot; und angehangenem &quot;+$&quot;, auf Gültigkeit geprüft.</p><p>Beachten Sie Bitte beim Ändern des Ausdrucks das nicht alle Zeichen durch die Banken unterstützt werden!</p><p>Standard: &quot;[-+ .,/*&amp;%0-9A-Za-z]&quot;</p></body></html> + + + Regulärer Ausdruck der definiert welche Zeichen als Eingabe für Empfängernamen zugelassen sind. + + + + + + Qt::Vertical + + + + 20 + 220 + + + + @@ -1048,7 +1096,6 @@ checkBox_getDatedTransfers checkBox_executeAtStart buttonBox - tabWidget listWidget_plugins tableWidget_profiles checkBox_adv_manualOutboxRearrange diff --git a/src/main.cpp b/src/main.cpp --- a/src/main.cpp +++ b/src/main.cpp @@ -28,7 +28,7 @@ * ******************************************************************************/ -#include +#include #include #include #include @@ -47,7 +47,11 @@ /** a message handler to display qDebug(), qWarning() etc. in the debug-Dialog */ +#if QT_VERSION >= 0x050000 +void myMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg); +#else void myMessageHandler(QtMsgType type, const char *msg); +#endif int main(int argc, char *argv[]) { @@ -60,25 +64,28 @@ //setCodecForTr() and setCodedForCString() are removed in Qt 5.0.0 //see http://qt-project.org/doc/qt-5.0/qtdoc/sourcebreaks.html QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); - QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + //QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); #endif - QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); QLocale::setDefault(QLocale(QLocale::German, QLocale::Germany)); + //QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); //create the DebugDialogWidget, that displays all qDebug(), qWarning() //etc. messages and install the MsgHandler that redirect the messages. debugDialog = new DebugDialogWidget(); +#if QT_VERSION >= 0x050000 + qInstallMessageHandler(myMessageHandler); +#else qInstallMsgHandler(myMessageHandler); - +#endif #ifdef ABTRANSFER_VERSION - app.setApplicationVersion(ABTRANSFER_VERSION); + app.setApplicationVersion(QString::fromUtf8(ABTRANSFER_VERSION)); #else #warning "ABTRANSFER_VERSION not set! Compiling without version information!" #endif - app.setOrganizationName("Patrick Wacker"); - app.setOrganizationDomain("schmufu.dyndns.org"); - app.setApplicationName("AB-Transfers"); + app.setOrganizationName(QString::fromUtf8("Patrick Wacker")); + app.setOrganizationDomain(QString::fromUtf8("schmufu.dyndns.org")); + app.setApplicationName(QString::fromUtf8("AB-Transfers")); //On MacOS the QSharedMemory seems not to work as assumed. //Therefore, as a fast workaround, we do not use the protection on MacOS. @@ -88,7 +95,7 @@ //As key for the sharedMemory the program name and the "Key-ID" from //my the PGP-Key is used (Patrick Wacker ) QString smKey = app.applicationName(); - smKey.append("-49E8D03B0700F6C4"); //PGP-Key-ID from Patrick Wacker + smKey.append(QString::fromUtf8("-49E8D03B0700F6C4")); //PGP-Key-ID from Patrick Wacker QSharedMemory myMem(smKey); if ( !myMem.create(sizeof(int)) ) { qDebug() << Q_FUNC_INFO << "SharedMemoryError:" << myMem.errorString(); @@ -121,7 +128,11 @@ if (msgRet != QMessageBox::Yes) { //cleanup and cancel execution +#if QT_VERSION >= 0x050000 + qInstallMessageHandler(NULL); +#else qInstallMsgHandler(NULL); +#endif delete debugDialog; return 9; } @@ -159,17 +170,21 @@ //free all created GWEN_STRINGLIST and GWEN_TIME objects abt_conv::freeAllGwenLists(); - +#if QT_VERSION >= 0x050000 + qInstallMessageHandler(NULL); +#else qInstallMsgHandler(NULL); //uninstall the MsgHandler +#endif delete debugDialog; //and the corresponding dialog return apprv; } - -void myMessageHandler(QtMsgType type, const char *msg) +#if QT_VERSION >= 0x050000 +void myMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { - fprintf(stderr, "%s\n", msg); //always show the messages at stderr + //always show the messages at stderr + fprintf(stderr, "[%s] %s\n", context.function, msg.toStdString().c_str()); //only show the messages if wanted //! @todo implement the option to deactivate debug messges @@ -177,16 +192,45 @@ switch(type) { case QtDebugMsg: - debugDialog->appendMsg(QString("DEBUG: ").append(msg)); + debugDialog->appendMsg(QString::fromUtf8("DEBUG: ").append(msg); break; case QtWarningMsg: - debugDialog->appendMsg(QString("WARNING: ").append(msg)); + debugDialog->appendMsg(QString::fromUtf8("WARNING: ").append(msg); break; case QtCriticalMsg: - debugDialog->appendMsg(QString("CRITICAL: ").append(msg)); + debugDialog->appendMsg(QString::fromUtf8("CRITICAL: ").append(msg); + break; + case QtFatalMsg: + fprintf(stderr, "Fatal: %s\n", msg.toStdString().c_str()); + abort(); + } +} +#else +void myMessageHandler(QtMsgType type, const char *msg) +{ + //always show the messages at stderr + fprintf(stderr, "%s\n", QString::fromUtf8(msg).toStdString().c_str()); + + //only show the messages if wanted + //! @todo implement the option to deactivate debug messges + //if (!settings->displayDebugMessages()) return; + + switch(type) { + case QtDebugMsg: + debugDialog->appendMsg(QString::fromUtf8("DEBUG: "). + append(QString::fromUtf8(msg))); + break; + case QtWarningMsg: + debugDialog->appendMsg(QString::fromUtf8("WARNING: "). + append(QString::fromUtf8(msg))); + break; + case QtCriticalMsg: + debugDialog->appendMsg(QString::fromUtf8("CRITICAL: "). + append(QString::fromUtf8(msg))); break; case QtFatalMsg: fprintf(stderr, "Fatal: %s\n", msg); abort(); } } +#endif diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -196,11 +196,6 @@ this->timer->setSingleShot(true); connect(this->timer, SIGNAL(timeout()), this, SLOT(TimerTimeOut())); this->timer->start(10); - -#ifdef TESTWIDGETACCESS - this->ui->menuBar->addAction(this->actTestWidgetAccess); -#endif - } MainWindow::~MainWindow() @@ -324,7 +319,7 @@ QDialogButtonBox::Ok, QDialogButtonBox::Ok, QMessageBox::Information, - "RuntimeLanguageChange"); + QString::fromUtf8("RuntimeLanguageChange")); dia.exec(); } } @@ -357,24 +352,24 @@ QDialogButtonBox::Ok, QDialogButtonBox::Ok, QMessageBox::Information, - "WarnCosts"); + QString::fromUtf8("WarnCosts")); dia.exec(); //check if jobs should be put in the outbox and if the should be //executed at start. - if (settings->appendJobToOutbox("getBalance")) { + if (settings->appendJobToOutbox(QString::fromUtf8("getBalance"))) { this->appendGetBalanceToOutbox(); } - if (settings->appendJobToOutbox("getDatedTransfers")) { + if (settings->appendJobToOutbox(QString::fromUtf8("getDatedTransfers"))) { this->appendGetDatedTransfersToOutbox(); } - if (settings->appendJobToOutbox("getStandingOrders")) { + if (settings->appendJobToOutbox(QString::fromUtf8("getStandingOrders"))) { this->appendGetStandingOrdersToOutbox(); } - if (settings->appendJobToOutbox("executeAtStart")) { + if (settings->appendJobToOutbox(QString::fromUtf8("executeAtStart"))) { this->jobctrl->execQueuedTransactions(); } @@ -391,89 +386,106 @@ { actTransferNational = new QAction(this); actTransferNational->setText(tr("National")); - actTransferNational->setIcon(QIcon(":/icons/bank-icon")); - connect(actTransferNational, SIGNAL(triggered()), this, SLOT(onActionTransferNationalTriggered())); + actTransferNational->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actTransferNational, SIGNAL(triggered()), + this, SLOT(onActionTransferNationalTriggered())); connect(this->ui->pushButton_transferNational, SIGNAL(clicked()), this->actTransferNational, SLOT(trigger())); actTransferInternational = new QAction(this); actTransferInternational->setText(tr("International")); - actTransferInternational->setIcon(QIcon(":/icons/bank-icon")); - connect(actTransferInternational, SIGNAL(triggered()), this, SLOT(onActionTransferInternationalTriggered())); + actTransferInternational->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actTransferInternational, SIGNAL(triggered()), + this, SLOT(onActionTransferInternationalTriggered())); connect(this->ui->pushButton_transferInternational, SIGNAL(clicked()), this->actTransferInternational, SLOT(trigger())); actTransferSepa = new QAction(this); actTransferSepa->setText(tr("SEPA (EU weit)")); - actTransferSepa->setIcon(QIcon(":/icons/bank-icon")); - connect(actTransferSepa, SIGNAL(triggered()), this, SLOT(onActionTransferSepaTriggered())); + actTransferSepa->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actTransferSepa, SIGNAL(triggered()), + this, SLOT(onActionTransferSepaTriggered())); connect(this->ui->pushButton_transferSepa, SIGNAL(clicked()), this->actTransferSepa, SLOT(trigger())); actTransferInternal = new QAction(this); actTransferInternal->setText(tr("Umbuchung")); - actTransferInternal->setIcon(QIcon(":/icons/bank-icon")); - connect(actTransferInternal, SIGNAL(triggered()), this, SLOT(onActionTransferInternalTriggered())); + actTransferInternal->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actTransferInternal, SIGNAL(triggered()), + this, SLOT(onActionTransferInternalTriggered())); connect(this->ui->pushButton_transferInternal, SIGNAL(clicked()), this->actTransferInternal, SLOT(trigger())); actDatedNew = new QAction(this); actDatedNew->setText(tr("Anlegen")); - actDatedNew->setIcon(QIcon(":/icons/bank-icon")); - connect(actDatedNew, SIGNAL(triggered()), this, SLOT(onActionDatedNewTriggered())); + actDatedNew->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actDatedNew, SIGNAL(triggered()), + this, SLOT(onActionDatedNewTriggered())); connect(this->ui->pushButton_datedNew, SIGNAL(clicked()), this->actDatedNew, SLOT(trigger())); actDatedUpdate = new QAction(this); actDatedUpdate->setText(tr("Aktualisieren")); - actDatedUpdate->setIcon(QIcon(":/icons/bank-icon")); - connect(actDatedUpdate, SIGNAL(triggered()), this, SLOT(onActionDatedUpdateTriggered())); + actDatedUpdate->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actDatedUpdate, SIGNAL(triggered()), + this, SLOT(onActionDatedUpdateTriggered())); connect(this->ui->pushButton_datedUpdate, SIGNAL(clicked()), this->actDatedUpdate, SLOT(trigger())); actStandingNew = new QAction(this); actStandingNew->setText(tr("Anlegen")); - actStandingNew->setIcon(QIcon(":/icons/bank-icon")); - connect(actStandingNew, SIGNAL(triggered()), this, SLOT(onActionStandingNewTriggered())); + actStandingNew->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actStandingNew, SIGNAL(triggered()), + this, SLOT(onActionStandingNewTriggered())); connect(this->ui->pushButton_standingNew, SIGNAL(clicked()), this->actStandingNew, SLOT(trigger())); actStandingUpdate = new QAction(this); actStandingUpdate->setText(tr("Aktualisieren")); - actStandingUpdate->setIcon(QIcon(":/icons/bank-icon")); - connect(actStandingUpdate, SIGNAL(triggered()), this, SLOT(onActionStandingUpdateTriggered())); + actStandingUpdate->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actStandingUpdate, SIGNAL(triggered()), + this, SLOT(onActionStandingUpdateTriggered())); connect(this->ui->pushButton_standingUpdate, SIGNAL(clicked()), this->actStandingUpdate, SLOT(trigger())); actDebitNote = new QAction(this); actDebitNote->setText(tr("Lastschrift")); - actDebitNote->setIcon(QIcon(":/icons/bank-icon")); - connect(actDebitNote, SIGNAL(triggered()), this, SLOT(onActionDebitNoteTriggered())); + actDebitNote->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actDebitNote, SIGNAL(triggered()), + this, SLOT(onActionDebitNoteTriggered())); actDebitNoteSepa = new QAction(this); actDebitNoteSepa->setText(tr("SEPA-Lastschrift (EU weit)")); - actDebitNoteSepa->setIcon(QIcon(":/icons/bank-icon")); - connect(actDebitNoteSepa, SIGNAL(triggered()), this, SLOT(onActionDebitNoteSepaTriggered())); + actDebitNoteSepa->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actDebitNoteSepa, SIGNAL(triggered()), + this, SLOT(onActionDebitNoteSepaTriggered())); actUpdateBalance = new QAction(this); actUpdateBalance->setText(tr("Kontostand aktualisieren")); - actUpdateBalance->setIcon(QIcon(":/icons/bank-icon")); - connect(actUpdateBalance, SIGNAL(triggered()), this, SLOT(onActionUpdateBalanceTriggered())); + actUpdateBalance->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actUpdateBalance, SIGNAL(triggered()), + this, SLOT(onActionUpdateBalanceTriggered())); actShowAvailableJobs = new QAction(this); actShowAvailableJobs->setText(tr("Unterstütze Aufträge")); - actShowAvailableJobs->setIcon(QIcon(":/icons/bank-icon")); - connect(actShowAvailableJobs, SIGNAL(triggered()), this, SLOT(onActionShowAvailableJobsTriggered())); + actShowAvailableJobs->setIcon(QIcon(QString::fromUtf8(":/icons/bank-icon"))); + connect(actShowAvailableJobs, SIGNAL(triggered()), + this, SLOT(onActionShowAvailableJobsTriggered())); actSaveAllData = new QAction(this); actSaveAllData->setText(tr("Speichern")); - actSaveAllData->setIcon(QIcon::fromTheme("document-save", QIcon(":/icons/document-save"))); - connect(actSaveAllData, SIGNAL(triggered()), this, SLOT(onActionSaveAllDataTriggered())); + actSaveAllData->setIcon(QIcon::fromTheme(QString::fromUtf8("document-save"), + QIcon(QString::fromUtf8(":/icons/document-save")))); + connect(actSaveAllData, SIGNAL(triggered()), + this, SLOT(onActionSaveAllDataTriggered())); #ifdef TESTWIDGETACCESS - actTestWidgetAccess = new QAction(tr("TestWidget"), this); - connect(actTestWidgetAccess, SIGNAL(triggered()), this, SLOT(onActionTestWidgetAccessTriggered())); + actTestWidgetAccess = new QAction(this); + actTestWidgetAccess->setText(tr("TestWidget")); + connect(actTestWidgetAccess, SIGNAL(triggered()), + this, SLOT(onActionTestWidgetAccessTriggered())); + this->ui->menuBar->addAction(this->actTestWidgetAccess); #endif @@ -538,7 +550,7 @@ void MainWindow::createDockToolbar() { this->dockToolbar = new QToolBar(tr("Dock Toolbar"),this); - this->dockToolbar->setObjectName("dockToolbar"); + this->dockToolbar->setObjectName(QString::fromUtf8("dockToolbar")); this->dockToolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); this->dockToolbar->addAction(this->dock_Accounts->toggleViewAction()); this->dockToolbar->addAction(this->dock_KnownRecipient->toggleViewAction()); @@ -610,7 +622,7 @@ { /** create a new QDockWidget ("Online Konten"). */ this->dock_Accounts = new QDockWidget(tr("Online Konten"),this); - this->dock_Accounts->setObjectName("OnlineAccounts"); + this->dock_Accounts->setObjectName(QString::fromUtf8("OnlineAccounts")); qDebug() << "creating bankAccountsWidget"; /** A new BankAccountsWidget is set as the new widget in der QDockWidget. */ BankAccountsWidget *baw = new BankAccountsWidget(this->accounts, this->dock_Accounts); @@ -619,7 +631,8 @@ this->dock_Accounts->setAllowedAreas(Qt::AllDockWidgetAreas); this->dock_Accounts->setFloating(false); this->dock_Accounts->hide(); - this->dock_Accounts->toggleViewAction()->setIcon(QIcon(":/icons/bank-icon")); + QIcon ico = QIcon(QString::fromUtf8(":/icons/bank-icon")); + this->dock_Accounts->toggleViewAction()->setIcon(ico); /** Add the DockWidget topDockWidgetArea of the MainWindow. */ this->addDockWidget(Qt::TopDockWidgetArea, this->dock_Accounts); /** Connection for the ContextMenu is established. */ @@ -642,7 +655,7 @@ void MainWindow::createDockKnownRecipients() { this->dock_KnownRecipient = new QDockWidget(tr("Bekannte Empfänger"),this); - this->dock_KnownRecipient->setObjectName("KnownRecipients"); + this->dock_KnownRecipient->setObjectName(QString::fromUtf8("KnownRecipients")); qDebug() << "creating knownEmpfaengerWidget"; KnownEmpfaengerWidget *kew = new KnownEmpfaengerWidget(settings->loadKnownEmpfaenger(), this->dock_KnownRecipient); //Changes of the known recipients must be send to the widget @@ -659,7 +672,8 @@ this->dock_KnownRecipient->setAllowedAreas(Qt::AllDockWidgetAreas); this->dock_KnownRecipient->setFloating(false); this->dock_KnownRecipient->hide(); - this->dock_KnownRecipient->toggleViewAction()->setIcon(QIcon(":/icons/knownEmpfaenger")); + QIcon ico = QIcon(QString::fromUtf8(":/icons/knownEmpfaenger")); + this->dock_KnownRecipient->toggleViewAction()->setIcon(ico); this->addDockWidget(Qt::RightDockWidgetArea, this->dock_KnownRecipient); //restore widget state to the previous settings @@ -671,7 +685,7 @@ void MainWindow::createDockStandingOrders() { QDockWidget *dock = new QDockWidget(tr("Daueraufträge"), this); - dock->setObjectName("dockStandingOrders"); + dock->setObjectName(QString::fromUtf8("dockStandingOrders")); QVBoxLayout *layoutDock = new QVBoxLayout(); QHBoxLayout *layoutAcc = new QHBoxLayout(); @@ -710,7 +724,7 @@ dock->setAllowedAreas(Qt::AllDockWidgetAreas); dock->setFloating(false); dock->hide(); - dock->toggleViewAction()->setIcon(QIcon(":/icons/dauerauftrag")); + dock->toggleViewAction()->setIcon(QIcon(QString::fromUtf8(":/icons/dauerauftrag"))); this->addDockWidget(Qt::RightDockWidgetArea, dock); this->dock_KnownStandingOrders = dock; @@ -733,7 +747,7 @@ } //get the last selected account (from settings) - int selAccID = settings->loadSelAccountInWidget("StandingOrders"); + int selAccID = settings->loadSelAccountInWidget(QString::fromUtf8("StandingOrders")); const aqb_AccountInfo *lastAcc = this->accounts->getAccount(selAccID); //set all known accounts in the ComboBox @@ -749,7 +763,7 @@ void MainWindow::createDockDatedTransfers() { QDockWidget *dock = new QDockWidget(tr("Terminüberweisungen"), this); - dock->setObjectName("dockDatedTransfers"); + dock->setObjectName(QString::fromUtf8("dockDatedTransfers")); QVBoxLayout *layoutDock = new QVBoxLayout(); QHBoxLayout *layoutAcc = new QHBoxLayout(); @@ -789,7 +803,7 @@ dock->setAllowedAreas(Qt::AllDockWidgetAreas); dock->setFloating(false); dock->hide(); - dock->toggleViewAction()->setIcon(QIcon(":/icons/dauerauftrag")); + dock->toggleViewAction()->setIcon(QIcon(QString::fromUtf8(":/icons/dauerauftrag"))); this->addDockWidget(Qt::RightDockWidgetArea, dock); this->dock_KnownDatedTransfers = dock; @@ -812,7 +826,7 @@ } //get the last selected account (from settings) - int selAccID = settings->loadSelAccountInWidget("DatedTransfers"); + int selAccID = settings->loadSelAccountInWidget(QString::fromUtf8("DatedTransfers")); const aqb_AccountInfo *lastAcc = this->accounts->getAccount(selAccID); //set all known accounts in the ComboBox @@ -884,7 +898,8 @@ //get all account data from the relevant file ctx = abt_parser::load_local_ctx(settings->getAccountDataFilename(), - "ctxfile", "default"); + QString::fromUtf8("ctxfile"), + QString::fromUtf8("default")); abt_parser::parse_ctx(ctx, this->accounts); AB_ImExporterContext_free(ctx); //ctx no longer needed, all loaded } @@ -902,7 +917,8 @@ if (!ctx) return; //if no ctx created, we have nothing to save abt_parser::save_local_ctx(ctx, settings->getAccountDataFilename(), - "ctxfile", "default"); + QString::fromUtf8("ctxfile"), + QString::fromUtf8("default")); AB_ImExporterContext_free(ctx); } @@ -919,7 +935,8 @@ //load all history items from the relevant file ctx = abt_parser::load_local_ctx(settings->getHistoryFilename(), - "ctxfile", "default"); + QString::fromUtf8("ctxfile"), + QString::fromUtf8("default")); abt_parser::parse_ctx(ctx, this->accounts, this->history); AB_ImExporterContext_free(ctx); } @@ -935,7 +952,8 @@ //get the AB_IMEXPORTER_CONTEXT for the history and save it to file ctx = this->history->getContext(); abt_parser::save_local_ctx(ctx, settings->getHistoryFilename(), - "ctxfile", "default"); + QString::fromUtf8("ctxfile"), + QString::fromUtf8("default")); AB_ImExporterContext_free(ctx); } @@ -962,7 +980,7 @@ tr("Der Auftrag \"%1\" wurde erfolgreich zum " "Ausgangskorb hinzugefügt").arg(ji->getType()), QDialogButtonBox::Ok, QDialogButtonBox::Ok, - QMessageBox::Information, "JobAddOutput"); + QMessageBox::Information, QString::fromUtf8("JobAddOutput")); dia.exec(); } @@ -996,18 +1014,20 @@ licenseDialog->setWindowTitle(tr("Lizenz")); QVBoxLayout *licenseLayout = new QVBoxLayout(licenseDialog); QLabel *licenseText = new QLabel(licenseDialog); - QString lt = "Copyright (C) 2011-2013 Patrick Wacker

" - "This program is free software; you can redistribute it and/or
" - "modify it under the terms of the GNU General Public License
" - "as published by the Free Software Foundation; either version 2
" - "of the License, or (at your option) any later version.

" - "This program is distributed in the hope that it will be useful,
" - "but WITHOUT ANY WARRANTY; without even the implied warranty of
" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" - "GNU General Public License for more details.

" - "You should have received a copy of the GNU General Public License
" - "along with this program; if not, write to the Free Software
" - "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

"; + QString lt = QString::fromUtf8( + "Copyright (C) 2011-2013 Patrick Wacker

" + "This program is free software; you can redistribute it and/or
" + "modify it under the terms of the GNU General Public License
" + "as published by the Free Software Foundation; either version 2
" + "of the License, or (at your option) any later version.

" + "This program is distributed in the hope that it will be useful,
" + "but WITHOUT ANY WARRANTY; without even the implied warranty of
" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" + "GNU General Public License for more details.

" + "You should have received a copy of the GNU General Public License
" + "along with this program; if not, write to the Free Software
" + "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

" + ); lt.append(tr("siehe auch http://www.gnu.de/documents/gpl-2.0.de.html")); licenseText->setText(lt); licenseText->setOpenExternalLinks(true); @@ -1021,7 +1041,7 @@ QHBoxLayout *hbox = new QHBoxLayout(); //Icon-Image as graphic top left QLabel *img = new QLabel(about); - QPixmap *iconpic = new QPixmap(":/icons/bank-icon"); + QPixmap *iconpic = new QPixmap(QString::fromUtf8(":/icons/bank-icon")); img->setPixmap(*iconpic); img->setScaledContents(true); img->setMaximumSize(100, 100); @@ -1041,31 +1061,31 @@ vbox->addSpacing(16); - QLabel *author = new QLabel(QString("Author: Patrick Wacker")); + QLabel *author = new QLabel(QString::fromUtf8("Author: Patrick Wacker")); vbox->addWidget(author, 0, Qt::AlignCenter); - QLabel *version = new QLabel(QString("Version: %1").arg(qApp->applicationVersion())); + QLabel *version = new QLabel(QString::fromUtf8("Version: %1").arg(qApp->applicationVersion())); vbox->addWidget(version, 0, Qt::AlignCenter); #ifdef ABTRANSFER_VERSION_EXTRA - QLabel *versionExtra = new QLabel(QString("%1").arg(ABTRANSFER_VERSION_EXTRA)); + QLabel *versionExtra = new QLabel(QString::fromUtf8("%1").arg(QString::fromUtf8(ABTRANSFER_VERSION_EXTRA))); vbox->addWidget(versionExtra, 0, Qt::AlignCenter); #endif - QLabel *versionSVN = new QLabel(QString("svn revision: %1").arg(ABTRANSFER_SVN_REVISION)); + QLabel *versionSVN = new QLabel(QString::fromUtf8("svn revision: %1").arg(QString::fromUtf8(ABTRANSFER_SVN_REVISION))); vbox->addWidget(versionSVN, 0, Qt::AlignCenter); vbox->addSpacing(10); - QLabel *webURL = new QLabel(tr("Website: %1").arg("http://schmufu.dyndns.org/dokuwiki/ab_transfer:start")); + QLabel *webURL = new QLabel(tr("Website: %1").arg(QString::fromUtf8("http://schmufu.dyndns.org/dokuwiki/ab_transfer:start"))); webURL->setOpenExternalLinks(true); webURL->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard); vbox->addWidget(webURL, 0, Qt::AlignLeft); - QLabel *svnURL = new QLabel(tr("svn repo: %1").arg("http://schmufu.dyndns.org/svn/ab_transfers/")); + QLabel *svnURL = new QLabel(tr("svn repo: %1").arg(QString::fromUtf8("http://schmufu.dyndns.org/svn/ab_transfers/"))); svnURL->setOpenExternalLinks(true); svnURL->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard); vbox->addWidget(svnURL, 0, Qt::AlignLeft); - QLabel *tracUrl = new QLabel(tr("trac: %1").arg("http://schmufu.dyndns.org/trac/abtransfers/")); + QLabel *tracUrl = new QLabel(tr("trac: %1").arg(QString::fromUtf8("http://schmufu.dyndns.org/trac/abtransfers/"))); tracUrl->setOpenExternalLinks(true); tracUrl->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard); vbox->addWidget(tracUrl, 0, Qt::AlignLeft); @@ -1086,11 +1106,12 @@ QLabel *usedImages = new QLabel(tr("genutzte Grafiken:")); vbox->addWidget(usedImages, 0, Qt::AlignLeft); - QLabel *iconsUrl = new QLabel(QString("Icons used from Oxygen %1
" - "and from 'Ecommerce Business icon pack'
" - "%2") - .arg("http://www.oxygen-icons.org") - .arg("http://www.iconspedia.com/pack/ecommerce-business-icons-4074")); + QLabel *iconsUrl = new QLabel(QString::fromUtf8( + "Icons used from Oxygen %1
" + "and from 'Ecommerce Business icon pack'
" + "%2") + .arg(QString::fromUtf8("http://www.oxygen-icons.org")) + .arg(QString::fromUtf8("http://www.iconspedia.com/pack/ecommerce-business-icons-4074"))); iconsUrl->setOpenExternalLinks(true); iconsUrl->setAlignment(Qt::AlignHCenter); iconsUrl->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard); @@ -1141,7 +1162,7 @@ } #else //QtWebKit is available, we use a QWebView. (supporting 'local links') QWebView *view = new QWebView(); - view->settings()->setDefaultTextEncoding("utf-8"); + view->settings()->setDefaultTextEncoding(QString::fromUtf8("utf-8")); view->setMinimumSize(520, 600); if (helpText.open(QFile::ReadOnly)) { @@ -1170,8 +1191,8 @@ { DialogSettings DiaSettings(settings, banking->getAqBanking(), this); - QString classname = QObject::sender()->metaObject()->className(); - if (classname == "page_history") { + QString classname = QString::fromUtf8(QObject::sender()->metaObject()->className()); + if (classname == QString::fromUtf8("page_history")) { //we were called from the history page DiaSettings.setActiveTab(1); //set im-/export as active tab } @@ -1202,14 +1223,14 @@ void MainWindow::selectedStandingOrdersAccountChanged(const aqb_AccountInfo* acc) { if (acc == NULL) return; //cancel if no account is supplied - settings->saveSelAccountInWidget("StandingOrders", acc); + settings->saveSelAccountInWidget(QString::fromUtf8("StandingOrders"), acc); } //private slot void MainWindow::selectedDatedTransfersAccountChanged(const aqb_AccountInfo* acc) { if (acc == NULL) return; //cancel if no account is supplied - settings->saveSelAccountInWidget("DatedTransfers", acc); + settings->saveSelAccountInWidget(QString::fromUtf8("DatedTransfers"), acc); } //private slot @@ -1262,6 +1283,8 @@ BankAccountsWidget *acc = this->dock_Accounts->findChild(); if (!acc) return; //cancel if no BankAccountsWidget was found this->jobctrl->addGetStandingOrders(acc->getSelectedAccount()); + //disable above and enable below to test the SEPA StandingOrders + //this->jobctrl->addGetSepaStandingOrders(acc->getSelectedAccount()); } //private slot @@ -1308,8 +1331,10 @@ gl->setRowMinimumHeight(1, 12); //one row as seperator //prepare used icons - QIcon icoSup = QIcon::fromTheme("dialog-ok-apply", QIcon(":/icons/ok")); - QIcon icoNotSup = QIcon::fromTheme("edit-delete", QIcon(":/icons/delete")); + QIcon icoSup = QIcon::fromTheme(QString::fromUtf8("dialog-ok-apply"), + QIcon(QString::fromUtf8(":/icons/ok"))); + QIcon icoNotSup = QIcon::fromTheme(QString::fromUtf8("edit-delete"), + QIcon(QString::fromUtf8(":/icons/delete"))); const QPixmap pixSup = icoSup.pixmap(16, QIcon::Normal); //supported const QPixmap pixNotSup = icoNotSup.pixmap(16, QIcon::Normal); //not supported const QPixmap pixLatSup = icoSup.pixmap(16, QIcon::Disabled); //later supported @@ -1845,9 +1870,11 @@ break; } //switch(period) - QString strFirstDate = correctFirstDate.toString("ddd dd.MM.yyyy"); - QString strLastDate = correctLastDate.isValid() ? correctLastDate.toString("ddd dd.MM.yyyy") : tr("Bis auf weiteres"); - QString strNextDate = correctNextDate.toString("ddd dd.MM.yyyy"); + QString strFirstDate = correctFirstDate.toString(QString::fromUtf8("ddd dd.MM.yyyy")); + QString strLastDate = correctLastDate.isValid() ? + correctLastDate.toString(QString::fromUtf8("ddd dd.MM.yyyy")) : + tr("Bis auf weiteres"); + QString strNextDate = correctNextDate.toString(QString::fromUtf8("ddd dd.MM.yyyy")); int ret; ret = QMessageBox::question( @@ -2098,8 +2125,10 @@ abt_jobInfo *job = this->jobctrl->jobqueueList()->at(itemNr); QString jobAccBankcode, jobAccNumber; - jobAccBankcode = AB_Account_GetBankCode(AB_Job_GetAccount(job->getJob())); - jobAccNumber =AB_Account_GetAccountNumber(AB_Job_GetAccount(job->getJob())); + jobAccBankcode = QString::fromUtf8( + AB_Account_GetBankCode(AB_Job_GetAccount(job->getJob()))); + jobAccNumber = QString::fromUtf8( + AB_Account_GetAccountNumber(AB_Job_GetAccount(job->getJob()))); //get the account that matches the local transaction data acc = this->accounts->getAccount(jobAccNumber, jobAccBankcode); @@ -2182,7 +2211,7 @@ const QString langFile = this->translations->currentLanguageFile(); - if (langFile.startsWith(":") || langFile.isEmpty()) { + if (langFile.startsWith(QChar::fromLatin1(':')) || langFile.isEmpty()) { //language file from embedded resource or the default language //(German) is selected. Everthing fine ;) return; @@ -2212,8 +2241,9 @@ .arg(langFile), QDialogButtonBox::Ok, QDialogButtonBox::Ok, QMessageBox::Warning, - QString("WarnTrans_%1-%2").arg(this->translations->currentLanguage()) - .arg(appVersion), + QString::fromUtf8("WarnTrans_%1-%2") + .arg(this->translations->currentLanguage()) + .arg(appVersion), true, tr("Diese Meldung nicht wieder anzeigen " "(nicht reaktivierbar!).")); dia.exec(); @@ -2262,7 +2292,7 @@ void MainWindow::createAndSendEUTransfer(const widgetTransfer* /* not used yet: sender */) { qWarning() << "create EU Transfer not implemented yet!"; - this->statusBar()->showMessage("create EU Transfer not implemented yet!"); + this->statusBar()->showMessage(QString::fromUtf8("create EU Transfer not implemented yet!")); return; // const aqb_AccountInfo *acc = sender->localAccount->getAccount(); @@ -2469,7 +2499,7 @@ void MainWindow::createAndSendDebitNote(const widgetTransfer *sender) { qWarning() << "create Debit Note not implemented yet!"; - this->statusBar()->showMessage("create Debit Note not implemented yet!"); + this->statusBar()->showMessage(QString::fromUtf8("create Debit Note not implemented yet!")); return; const aqb_AccountInfo *acc = sender->localAccount->getAccount(); @@ -2533,7 +2563,7 @@ void MainWindow::createAndSendSepaDebitNote(const widgetTransfer* /* not used yet: sender */) { qWarning() << "create SEPA Debit Note not implemented yet!"; - this->statusBar()->showMessage("create SEPA Debit Note not implemented yet!"); + this->statusBar()->showMessage(QString::fromUtf8("create SEPA Debit Note not implemented yet!")); return; // const aqb_AccountInfo *acc = sender->localAccount->getAccount(); @@ -2595,18 +2625,18 @@ //private void MainWindow::checkReachedDatedTransfers() { - QString msgText = ""; + QString msgText = QString(); foreach(aqb_AccountInfo *acc, this->accounts->getAccountHash().values()) { //next account if this account does not have a datedTransfers-List if (acc->getKnownDatedTransfers() == NULL) continue; for(int i=0; i < acc->getKnownDatedTransfers()->size(); ++i) { abt_datedTransferInfo *dt = acc->getKnownDatedTransfers()->at(i); if (dt->getTransaction()->getDate() <= QDate::currentDate()) { - msgText.append(""); + msgText.append(QString::fromUtf8("
")); msgText.append(tr("").arg(dt->getTransaction()->getRemoteName().at(0))); msgText.append(tr("").arg(abt_conv::ABValueToString(dt->getTransaction()->getValue(), true))); msgText.append(tr("").arg(dt->getTransaction()->getDate().toString(Qt::SystemLocaleShortDate))); - msgText.append("
Begünstigter:%1
Betrag:%1
Ausführen am:%1
"); + msgText.append(QString::fromUtf8("")); } } } diff --git a/src/mainwindow.h b/src/mainwindow.h --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -32,9 +32,9 @@ #define MAINWINDOW_H #include -#include -#include -#include +#include +#include +#include #include "aqb_accounts.h" #include "abt_job_ctrl.h" @@ -45,7 +45,7 @@ #include "pages/page_history.h" //uncomment the following if access to pagewidgettests.cpp is wanted -//#define TESTWIDGETACCESS +#define TESTWIDGETACCESS class widgetTransfer; class widgetRecurrence; diff --git a/src/pages/page_ausgang.cpp b/src/pages/page_ausgang.cpp --- a/src/pages/page_ausgang.cpp +++ b/src/pages/page_ausgang.cpp @@ -101,7 +101,8 @@ this->actDelete = new QAction(this); this->actDelete->setText(tr("Löschen")); this->actDelete->setToolTip(tr("Ausgewählten Job löschen")); - this->actDelete->setIcon(QIcon::fromTheme("edit-delete", QIcon(":/icons/delete"))); + this->actDelete->setIcon(QIcon::fromTheme(QString::fromUtf8("edit-delete"), + QIcon(QString::fromUtf8(":/icons/delete")))); connect(this->ui->pushButton_del, SIGNAL(clicked()), this->actDelete, SLOT(trigger())); connect(this->actDelete, SIGNAL(triggered()), @@ -110,14 +111,15 @@ this->actEdit = new QAction(this); this->actEdit->setText(tr("Bearbeiten")); this->actEdit->setToolTip(tr("Ausgewählten Job bearbeiten")); - this->actEdit->setIcon(QIcon::fromTheme("document-edit", QIcon(":/icons/document-edit"))); + this->actEdit->setIcon(QIcon::fromTheme(QString::fromUtf8("document-edit"), + QIcon(QString::fromUtf8(":/icons/document-edit")))); connect(this->actEdit, SIGNAL(triggered()), this, SLOT(onActionEditTriggered())); this->actUp = new QAction(this); this->actUp->setText(tr("Auf")); this->actUp->setToolTip(tr("Ausgewählten Job nach oben verschieben")); - this->actUp->setIcon(QIcon(":/icons/up")); + this->actUp->setIcon(QIcon(QString::fromUtf8(":/icons/up"))); connect(this->ui->pushButton_up, SIGNAL(clicked()), this->actUp, SLOT(trigger())); connect(this->actUp, SIGNAL(triggered()), @@ -126,7 +128,7 @@ this->actDown = new QAction(this); this->actDown->setText(tr("Ab")); this->actDown->setToolTip(tr("Ausgewählten Job nach unten verschieben")); - this->actDown->setIcon(QIcon(":/icons/down")); + this->actDown->setIcon(QIcon(QString::fromUtf8(":/icons/down"))); connect(this->actDown, SIGNAL(triggered()), this, SLOT(onActionDownTriggered())); connect(this->ui->pushButton_down, SIGNAL(clicked()), @@ -214,7 +216,7 @@ JobInfo = jql->at(i)->getInfo(); for (int j=0; jsize(); j++) { item = new QTreeWidgetItem(); - item->setData(0, Qt::DisplayRole, ""); + item->setData(0, Qt::DisplayRole, QString()); item->setData(1, Qt::DisplayRole, JobInfo->at(j)); item->setFlags(Qt::NoItemFlags); topItem->addChild(item); @@ -245,7 +247,8 @@ { bool enabled = (this->ui->treeWidget->selectedItems().size() > 0); bool one_selected = (this->ui->treeWidget->selectedItems().size() == 1); - bool adv_wanted = this->settings->isAdvancedOptionSet("ManualOutboxRearrange"); + bool adv_wanted = this->settings->isAdvancedOptionSet( + QString::fromUtf8("ManualOutboxRearrange")); this->ui->pushButton_del->setEnabled(enabled); this->ui->pushButton_up->setEnabled(one_selected && adv_wanted); diff --git a/src/pages/page_history.cpp b/src/pages/page_history.cpp --- a/src/pages/page_history.cpp +++ b/src/pages/page_history.cpp @@ -33,9 +33,9 @@ #include "ui_page_history.h" #include -#include -#include -#include +#include +#include +#include #include "../dialogs/abt_dialog.h" #include "../abt_history.h" @@ -56,11 +56,14 @@ ui->setupUi(this); QIcon ico; - ico = QIcon::fromTheme("document-new", QIcon(":/icons/document-new")); + ico = QIcon::fromTheme(QString::fromUtf8("document-new"), + QIcon(QString::fromUtf8(":/icons/document-new"))); this->ui->toolButton_new->setIcon(ico); - ico = QIcon::fromTheme("document-export", QIcon(":/icons/document-export")); + ico = QIcon::fromTheme(QString::fromUtf8("document-export"), + QIcon(QString::fromUtf8(":/icons/document-export"))); this->ui->toolButton_export->setIcon(ico); - ico = QIcon::fromTheme("edit-delete", QIcon(":/icons/delete")); + ico = QIcon::fromTheme(QString::fromUtf8("edit-delete"), + QIcon(QString::fromUtf8(":/icons/delete"))); this->ui->toolButton_delete->setIcon(ico); this->history = history; @@ -130,15 +133,15 @@ if (ui->treeWidget->isHeaderHidden()) return; //do nothing! No items shown. - int width = settings->getColWidth("history", 0, 210); + int width = settings->getColWidth(QString::fromUtf8("history"), 0, 210); ui->treeWidget->setColumnWidth(0, width); //type - width = settings->getColWidth("history", 1, 135); + width = settings->getColWidth(QString::fromUtf8("history"), 1, 135); ui->treeWidget->setColumnWidth(1, width); //recipient - width = settings->getColWidth("history", 2, 200); + width = settings->getColWidth(QString::fromUtf8("history"), 2, 200); ui->treeWidget->setColumnWidth(2, width); //purpose - width = settings->getColWidth("history", 3, 90); + width = settings->getColWidth(QString::fromUtf8("history"), 3, 90); ui->treeWidget->setColumnWidth(3, width); //value - width = settings->getColWidth("history", 4, 105); + width = settings->getColWidth(QString::fromUtf8("history"), 4, 105); ui->treeWidget->setColumnWidth(4, width); //date } @@ -284,7 +287,7 @@ abt_dialog dialog(this, msgTitle, msgText, QDialogButtonBox::Yes | QDialogButtonBox::No, QDialogButtonBox::Yes, QMessageBox::Question, - "HistoryConfirmDelete"); + QString::fromUtf8("HistoryConfirmDelete")); int ret = dialog.exec(); if (ret != QDialogButtonBox::Yes) { @@ -309,9 +312,12 @@ * @returns a context-menu which can be used for user-selection */ //private -QMenu *page_history::createExportContextMenu(QWidget *parent, const aqb_imexporters *iep) const +QMenu *page_history::createExportContextMenu(QWidget* /* parent */, + const aqb_imexporters *iep) const { - QMenu *menu = new QMenu(parent); + //when we set the parent of the created menu, the program crashes + //when it is closed! + QMenu *menu = new QMenu(); QMenu *preferredMenu = new QMenu(tr("Favorit"), menu); @@ -329,7 +335,7 @@ foreach (aqb_ieProfile *profile, *plugin->getProfiles()) { //if this is not an export-profile, we cant use it. //Therefore, export must exist and must be unequal 0 - if (!profile->getNames()->contains("export") || + if (!profile->getNames()->contains(QString::fromUtf8("export")) || profile->getValue("export").toInt() == 0) { continue; //next profile } @@ -346,12 +352,12 @@ //check if the profile is favorite and add it to the //preferred submenu with the plugin-name as prefix QString key = plugin->getName(); - key.append("/"); + key.append(QString::fromUtf8("/")); key.append(profile->getValue("name").toString()); if (settings->isProfileFavorit(key)) { QAction *prefItem = new QAction(preferredMenu); QString itemText = item->text(); - itemText.prepend(" - "); + itemText.prepend(QString::fromUtf8(" - ")); itemText.prepend(plugin->getName()); prefItem->setText(itemText); prefItem->setUserData(0, @@ -400,9 +406,10 @@ AB_IMEXPORTER_CONTEXT *ctx = NULL; aqb_iePlugin *plugin = NULL; aqb_ieProfile *profile = NULL; - QString saveFilename = ""; - QString dialogTitle = ""; - QString tmpstr = ""; + QString saveFilename = QString(); + QString dialogTitle = QString(); + QString tmpstr = QString(); + QString profileName = QString(); aqb_imexporters *iep = new aqb_imexporters(banking->getAqBanking()); QMenu *exportConextMenu = this->createExportContextMenu(this, iep); @@ -448,13 +455,14 @@ goto ONACTEXPORTSELECTED_CLEANUP; } + profileName = profile->getValue("name").toString(); qDebug() << Q_FUNC_INFO << "selected Plugin :" << plugin->getName(); - qDebug() << Q_FUNC_INFO << "selected Profile:" << profile->getValue("name").toString(); + qDebug() << Q_FUNC_INFO << "selected Profile:" << profileName; //Now we need to know where to store the data dialogTitle = tr("(%1 / %2) Export ...") .arg(plugin->getName()) - .arg(profile->getValue("name").toString()); + .arg(profileName); saveFilename = QFileDialog::getSaveFileName(this, dialogTitle, settings->getDataDir()); @@ -468,10 +476,10 @@ } if (ctx) { - err = AB_Banking_ExportToFile(banking->getAqBanking(), - ctx, plugin->getName(), - profile->getValue("name").toString().toUtf8(), - saveFilename.toUtf8()); + err = AB_Banking_ExportToFile(banking->getAqBanking(), ctx, + plugin->getName().toStdString().c_str(), + profileName.toStdString().c_str(), + saveFilename.toStdString().c_str()); } else { err = 99; //no ctx available! } @@ -497,7 +505,8 @@ //we must free the ctx after using it AB_ImExporterContext_free(ctx); } - delete exportConextMenu; //menu and all childs no longer needed + //The following deletion lets the program crash. Why? I dont know. + //delete exportConextMenu; //menu and all childs no longer needed delete iep; //also deletes ALL childs objects from aqb_imexporters! } @@ -558,7 +567,7 @@ topItem->setData(2, Qt::DisplayRole, trans->getPurpose().at(0)); QString value = abt_conv::ABValueToString(trans->getValue(), true); - value.append(" EUR"); + value.append(QString::fromUtf8(" EUR")); topItem->setData(3, Qt::DisplayRole, value); //the idForApplication is the unix timestamp of the creation @@ -641,7 +650,7 @@ if (!this->ui->treeWidget->isHeaderHidden()) { //if no header is displayed there are no columns. //Only save the width when headers are visible. - settings->saveColWidth("history", column, newSize); + settings->saveColWidth(QString::fromUtf8("history"), column, newSize); } } diff --git a/src/pages/page_history.h b/src/pages/page_history.h --- a/src/pages/page_history.h +++ b/src/pages/page_history.h @@ -32,8 +32,8 @@ #ifndef PAGE_HISTORY_H #define PAGE_HISTORY_H -#include -#include +#include +#include #include "../abt_jobinfo.h" diff --git a/src/pages/page_log.cpp b/src/pages/page_log.cpp --- a/src/pages/page_log.cpp +++ b/src/pages/page_log.cpp @@ -57,7 +57,7 @@ void page_log::setLogText(const QStringList *strList) { - this->ui->textEdit->setHtml(strList->join("
")); + this->ui->textEdit->setHtml(strList->join(QString::fromUtf8("
"))); } void page_log::appendLogText(const QString &str) diff --git a/src/pages/pagewidgettests.cpp b/src/pages/pagewidgettests.cpp --- a/src/pages/pagewidgettests.cpp +++ b/src/pages/pagewidgettests.cpp @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (C) 2011 Patrick Wacker + * Copyright (C) 2011, 2014-2015 Patrick Wacker * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) @@ -31,6 +31,10 @@ #include "pagewidgettests.h" #include +#include +#include + +#include pageWidgetTests::pageWidgetTests(aqb_Accounts *accs, QWidget *parent) : @@ -38,14 +42,14 @@ { qDebug() << Q_FUNC_INFO << "constructor started"; QHBoxLayout *hb = new QHBoxLayout(); - this->button1 = new QPushButton("Button 1"); - this->button2 = new QPushButton("Button 2"); - this->button3 = new QPushButton("Button 3"); - this->button4 = new QPushButton("Button 4"); - this->button5 = new QPushButton("Button 5"); - this->button6 = new QPushButton("Button 6"); - this->button7 = new QPushButton("Button 7"); - this->button8 = new QPushButton("Button 8"); + this->button1 = new QPushButton(QString::fromUtf8("Button 1")); + this->button2 = new QPushButton(QString::fromUtf8("Button 2")); + this->button3 = new QPushButton(QString::fromUtf8("Button 3")); + this->button4 = new QPushButton(QString::fromUtf8("Button 4")); + this->button5 = new QPushButton(QString::fromUtf8("Button 5")); + this->button6 = new QPushButton(QString::fromUtf8("Button 6")); + this->button7 = new QPushButton(QString::fromUtf8("Button 7")); + this->button8 = new QPushButton(QString::fromUtf8("Button 8")); hb->addWidget(this->button1); hb->addWidget(this->button2); hb->addWidget(this->button3); @@ -54,6 +58,23 @@ hb->addWidget(this->button6); hb->addWidget(this->button7); hb->addWidget(this->button8); + this->edit1 = new QLineEdit(); + this->edit2 = new QLineEdit(); + this->edit3 = new QLineEdit(); + this->edit4 = new QLineEdit(); + this->edit5 = new QLineEdit(); + this->edit6 = new QLineEdit(); + this->edit7 = new QLineEdit(); + this->edit8 = new QLineEdit(); + QHBoxLayout *hb2 = new QHBoxLayout(); + hb2->addWidget(this->edit1); + hb2->addWidget(this->edit2); + hb2->addWidget(this->edit3); + hb2->addWidget(this->edit4); + hb2->addWidget(this->edit5); + hb2->addWidget(this->edit6); + hb2->addWidget(this->edit7); + hb2->addWidget(this->edit8); connect(this->button1, SIGNAL(clicked()), this, SLOT(onButton1Clicked())); connect(this->button2, SIGNAL(clicked()), this, SLOT(onButton2Clicked())); @@ -67,6 +88,7 @@ this->textEdit = new QPlainTextEdit(); QVBoxLayout *vb = new QVBoxLayout(); vb->addLayout(hb); + vb->addLayout(hb2); vb->addWidget(this->textEdit); this->setLayout(vb); @@ -87,24 +109,26 @@ void pageWidgetTests::onButton1Clicked() { - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" started")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" started"))); - aqb_AccountInfo *acc = this->accounts->getAccount(5); + aqb_AccountInfo *acc = this->accounts->getAccount(QString::fromUtf8("1234567891")); if (acc == NULL) { - this->textEdit->appendPlainText("Account == NULL --> abort"); + this->textEdit->appendPlainText(QString::fromUtf8("Account == NULL --> abort")); return; } abt_transaction *t = new abt_transaction(); t->fillLocalFromAccount(acc->get_AB_ACCOUNT()); - t->setRemoteAccountNumber("123456"); - t->setRemoteBankCode("29050101"); - t->setRemoteBankName("Sparkasse Bremen"); - t->setRemoteName(QStringList("Test User")); - t->setValue(abt_conv::ABValueFromString("5.44", "EUR")); - t->setPurpose(QStringList("Verwendungszweck Test1")); + t->setRemoteAccountNumber(QString::fromUtf8("123456")); + t->setRemoteBankCode(QString::fromUtf8("29050101")); + t->setRemoteBankName(QString::fromUtf8("Sparkasse Brämen")); + t->setRemoteName(QStringList(QString::fromUtf8("Test Üser"))); + t->setValue(abt_conv::ABValueFromString(QString::fromUtf8("5.44"), + QString::fromUtf8("EUR"))); + t->setPurpose(QStringList(QString::fromUtf8("Überweisung Öfter"))); t->setTextKey(51); @@ -117,11 +141,26 @@ AB_ImExporterContext_AddAccountInfo(this->iec1, this->iea1); const QList *stos; stos = acc->getKnownStandingOrders(); - for (int i=0; isize(); i++) { - AB_ImExporterContext_AddStandingOrder(this->iec1, AB_Transaction_dup(stos->at(i)->getTransaction()->getAB_Transaction())); + if (stos != NULL) { + for (int i=0; isize(); i++) { + AB_ImExporterContext_AddStandingOrder(this->iec1, AB_Transaction_dup(stos->at(i)->getTransaction()->getAB_Transaction())); + } } + AB_TRANSACTION *t2 = AB_Transaction_dup(t->getAB_Transaction()); + QString bn = QString::fromUtf8("Sparkasse AeÄ UeÜ OeÖ aeä ueü oeö"); + QTextCodec *codec = QTextCodec::codecForName("UTF-8"); + QByteArray encodedString = codec->fromUnicode(bn); + qDebug() << encodedString; + qDebug() << bn; + + + +// AB_Transaction_SetRemoteBankName(t2, abt_conv::encodeToAb(bn)); + AB_Transaction_SetRemoteBankName(t2, bn.toStdString().c_str()); + AB_Transaction_SetPurpose(t2, abt_conv::QStringListToGwenStringList(QStringList(QString::fromUtf8("AeÄ UeÜ OeÖ aeä ueü oeö")))); + AB_ImExporterContext_AddTransfer(this->iec1, t2); // int AB_Banking_FillGapsInImExporterContext (AB_BANKING *ab, AB_IMEXPORTER_CONTEXT *iec) @@ -135,7 +174,7 @@ int ret = AB_Banking_ExportToFile(banking->getAqBanking(), this->iec1, "ctxfile", "default", "/tmp/exporterFilename.ctx"); - this->textEdit->appendPlainText(QString("%1").arg(ret)); + this->textEdit->appendPlainText(QString::fromUtf8("/tmp/exporterFilename.ctx saved (0=OK): %1").arg(ret)); delete t; @@ -143,18 +182,20 @@ - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" ended")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" ended"))); } void pageWidgetTests::onButton2Clicked() { - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" started")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" started"))); this->iec2 = AB_ImExporterContext_new(); int ret = AB_Banking_ImportFileWithProfile(banking->getAqBanking(), "ctxfile", this->iec2, "default", NULL, "/tmp/exporterFilename.ctx"); - this->textEdit->appendPlainText(QString("return value from import: %1").arg(ret)); + this->textEdit->appendPlainText(QString::fromUtf8("return value from import: %1").arg(ret)); //parse the incoming context this->parseContext(this->iec2); @@ -164,61 +205,158 @@ AB_ImExporterContext_free(this->iec2); - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" ended")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" ended"))); } void pageWidgetTests::onButton3Clicked() { - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" started")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" started"))); + QString t1 = QString::fromUtf8("Grün Weiß"); + addlog(t1); + addlog(QString::fromUtf8(t1.toStdString().c_str())); + addlog(QString::fromUtf8("Grün Weiß")); + //qDebug() << QTextCodec::codecForCStrings()->availableCodecs()); + addlog(QString::fromUtf8(QTextCodec::codecForLocale()->name())); + addlog(QString::fromUtf8(QTextCodec::codecForUtfText(QByteArray("Mäüö"))->name())); + QTextCodec *codec = QTextCodec::codecForName("UTF-8"); + addlog(codec->toUnicode(QByteArray::fromPercentEncoding("Gr%C3%BCn Wei%C3%9F"))); + addlog(QString::fromUtf8(QByteArray::fromPercentEncoding("Gr%C3%BCn Wei%C3%9F"))); + t1 = QString::fromUtf8("Gr%C3%BCn Wei%C3%9F"); + addlog(t1); + QByteArray a = QByteArray::fromRawData(t1.toStdString().c_str(), t1.length()); + addlog(QString::fromUtf8("%1 - %2").arg(t1).arg(QString::fromUtf8(a.toPercentEncoding()))); - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" ended")); + + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" ended"))); } void pageWidgetTests::onButton4Clicked() { - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" started")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" started"))); - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" ended")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" ended"))); } void pageWidgetTests::onButton5Clicked() { - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" started")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" started"))); - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" ended")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" ended"))); } void pageWidgetTests::onButton6Clicked() { - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" started")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" started"))); + aqb_AccountInfo *acc = this->accounts->getAccount(QString::fromUtf8("1234567891")); - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" ended")); + if (acc == NULL) { + this->textEdit->appendPlainText(QString::fromUtf8("Account == NULL --> abort")); + return; + } + + abt_transaction *t = new abt_transaction(); + t->fillLocalFromAccount(acc->get_AB_ACCOUNT()); + t->setRemoteAccountNumber(QString::fromUtf8("123456")); + t->setRemoteBankCode(QString::fromUtf8("29050101")); + t->setRemoteBankName(QString::fromUtf8("Sparkasse Brämen")); + t->setRemoteName(QStringList(QString::fromUtf8("Test Üser"))); + t->setValue(abt_conv::ABValueFromString(QString::fromUtf8("5.44"), + QString::fromUtf8("EUR"))); + t->setPurpose(QStringList(QString::fromUtf8("Überweisung Öfter"))); + t->setTextKey(51); + + + this->iec1 = AB_ImExporterContext_new(); + //AB_ImExporterContext_Add + this->iea1 = AB_ImExporterAccountInfo_new(); + AB_ImExporterAccountInfo_FillFromAccount(this->iea1, acc->get_AB_ACCOUNT()); + + AB_ImExporterContext_AddAccountInfo(this->iec1, this->iea1); + + AB_TRANSACTION *t2 = AB_Transaction_dup(t->getAB_Transaction()); + + QString bn = QString::fromUtf8("Sparkasse AeÄ UeÜ OeÖ aeä ueü oeö"); +// QString bn = this->edit6->text(); + QTextCodec *codec = QTextCodec::codecForName("UTF-8"); + QByteArray encodedString = codec->fromUnicode(bn); + qDebug() << encodedString; + qDebug() << bn; + + + +// AB_Transaction_SetRemoteBankName(t2, abt_conv::encodeToAb(bn)); + AB_Transaction_SetRemoteBankName(t2, encodedString); + AB_Transaction_SetRemoteAddrStreet(t2, this->edit5->text().toStdString().c_str()); + AB_Transaction_SetPurpose(t2, abt_conv::QStringListToGwenStringList(QStringList(QString::fromUtf8("AeÄ UeÜ OeÖ aeä ueü oeö")))); + AB_ImExporterContext_AddTransfer(this->iec1, t2); + + +// int AB_Banking_FillGapsInImExporterContext (AB_BANKING *ab, AB_IMEXPORTER_CONTEXT *iec) +// int AB_Banking_ExportToBuffer (AB_BANKING *ab, AB_IMEXPORTER_CONTEXT *ctx, const char *exporterName, const char *profileName, GWEN_BUFFER *buf) +// int AB_Banking_ExportToFile (AB_BANKING *ab, AB_IMEXPORTER_CONTEXT *ctx, const char *exporterName, const char *profileName, const char *fileName) +// int AB_Banking_ExportToFileWithProfile (AB_BANKING *ab, const char *exporterName, AB_IMEXPORTER_CONTEXT *ctx, const char *profileName, const char *profileFile, const char *outputFileName) +// int AB_Banking_ExportWithProfile (AB_BANKING *ab, const char *exporterName, AB_IMEXPORTER_CONTEXT *ctx, const char *profileName, const char *profileFile, GWEN_SYNCIO *sio) +// int AB_Banking_ImportBuffer (AB_BANKING *ab, AB_IMEXPORTER_CONTEXT *ctx, const char *exporterName, const char *profileName, GWEN_BUFFER *buf) +// int AB_Banking_ImportFileWithProfile (AB_BANKING *ab, const char *importerName, AB_IMEXPORTER_CONTEXT *ctx, const char *profileName, const char *profileFile, const char *inputFileName) +// int AB_Banking_ImportWithProfile (AB_BANKING *ab, const char *importerName, AB_IMEXPORTER_CONTEXT *ctx, const char *profileName, const char *profileFile, GWEN_SYNCIO *sio) + + int ret = AB_Banking_ExportToFile(banking->getAqBanking(), this->iec1, "ctxfile", "default", "/tmp/exporterFilename.ctx"); + + this->textEdit->appendPlainText(QString::fromUtf8("/tmp/exporterFilename.ctx saved (0=OK): %1").arg(ret)); + + + delete t; + AB_ImExporterContext_free(this->iec1); + + + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" ended"))); } void pageWidgetTests::onButton7Clicked() { - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" started")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" started"))); - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" ended")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" ended"))); } void pageWidgetTests::onButton8Clicked() { - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" started")); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" started"))); - - - this->textEdit->appendPlainText(QString(Q_FUNC_INFO).append(" ended")); + qDebug() << "\n" << "AVAILABLE CODECS:"; + qDebug() << QTextCodec::availableCodecs(); + qDebug() << "\n"; +// qDebug() << "for CStrings:" << QTextCodec::codecForCStrings(); + qDebug() << "for Locale :" << QTextCodec::codecForLocale()->name(); +// qDebug() << "for Tr() :" << QTextCodec::codecForTr()->name(); + qDebug() << "for UtfText :" << QTextCodec::codecForUtfText(QByteArray("Sparkasse Brämen"))->name(); + qDebug() << "for System :" << QTextCodec::codecForName("System")->name(); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" printed supported codecs at stdout"))); + this->textEdit->appendPlainText(QString::fromUtf8(Q_FUNC_INFO) + .append(QString::fromUtf8(" ended"))); } @@ -227,390 +365,492 @@ void pageWidgetTests::addlog(const QString &logMsg) { - this->textEdit->appendPlainText(QString("LOG: ").append(logMsg)); + this->textEdit->appendPlainText(QString::fromUtf8("LOG: ").append(logMsg)); } void pageWidgetTests::parseContext(AB_IMEXPORTER_CONTEXT *ctx) { - AB_IMEXPORTER_ACCOUNTINFO *ai; + Q_UNUSED(ctx); +// AB_IMEXPORTER_ACCOUNTINFO *ai; - QString log = AB_ImExporterContext_GetLog(ctx); - this->addlog(QString("CTX-LOG: ").append(log)); +// QString log = AB_ImExporterContext_GetLog(ctx); +// this->addlog(QString("CTX-LOG: ").append(log)); - QString logmsg; - QString logmsg2; - int cnt = 0; +// QString logmsg; +// QString logmsg2; +// int cnt = 0; - /**********************************************************************/ - //this->parseImExporterContext_Messages(ctx); - /**********************************************************************/ - AB_MESSAGE *msg; - logmsg = "Recvd-Message: "; - cnt = 0; +// /**********************************************************************/ +// //this->parseImExporterContext_Messages(ctx); +// /**********************************************************************/ +// AB_MESSAGE *msg; +// logmsg = "Recvd-Message: "; +// cnt = 0; - msg = AB_ImExporterContext_GetFirstMessage(ctx); - while (msg) { - logmsg2 = QString("Empfangsdatum:\t"); - logmsg2.append(abt_conv::GwenTimeToQDate( - AB_Message_GetDateReceived(msg)).toString( - Qt::DefaultLocaleLongDate)); - this->addlog(logmsg + logmsg2); - logmsg2 = QString("Betreff:\t"); - logmsg2.append(AB_Message_GetSubject(msg)); - this->addlog(logmsg + logmsg2); - logmsg2 = QString("Text:\t"); - logmsg2.append(AB_Message_GetText(msg)); - this->addlog(logmsg + logmsg2); - msg = AB_ImExporterContext_GetNextMessage(ctx); - cnt++; - } +// msg = AB_ImExporterContext_GetFirstMessage(ctx); +// while (msg) { +// logmsg2 = QString("Empfangsdatum:\t"); +// logmsg2.append(abt_conv::GwenTimeToQDate( +// AB_Message_GetDateReceived(msg)).toString( +// Qt::DefaultLocaleLongDate)); +// this->addlog(logmsg + logmsg2); +// logmsg2 = QString("Betreff:\t"); +// logmsg2.append(AB_Message_GetSubject(msg)); +// this->addlog(logmsg + logmsg2); +// logmsg2 = QString("Text:\t"); +// logmsg2.append(AB_Message_GetText(msg)); +// this->addlog(logmsg + logmsg2); +// msg = AB_ImExporterContext_GetNextMessage(ctx); +// cnt++; +// } - logmsg2 = QString("Count: %1").arg(cnt); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("Count: %1").arg(cnt); +// this->addlog(logmsg + logmsg2); - /**********************************************************************/ - //this->parseImExporterContext_Securitys(ctx); - /**********************************************************************/ - AB_SECURITY *s; - logmsg = "Recvd-Security: "; - const AB_VALUE *v; - cnt = 0; +// /**********************************************************************/ +// //this->parseImExporterContext_Securitys(ctx); +// /**********************************************************************/ +// AB_SECURITY *s; +// logmsg = "Recvd-Security: "; +// const AB_VALUE *v; +// cnt = 0; - s = AB_ImExporterContext_GetFirstSecurity(ctx); - while (s) { - logmsg2 = QString("Name:\t"); - logmsg2.append(AB_Security_GetName(s)); - this->addlog(logmsg + logmsg2); +// s = AB_ImExporterContext_GetFirstSecurity(ctx); +// while (s) { +// logmsg2 = QString("Name:\t"); +// logmsg2.append(AB_Security_GetName(s)); +// this->addlog(logmsg + logmsg2); - logmsg2 = QString("UnitPriceValue:\t"); - v = AB_Security_GetUnitPriceValue(s); - logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("UnitPriceValue:\t"); +// v = AB_Security_GetUnitPriceValue(s); +// logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); +// this->addlog(logmsg + logmsg2); - s = AB_ImExporterContext_GetNextSecurity(ctx); - cnt++; - } +// s = AB_ImExporterContext_GetNextSecurity(ctx); +// cnt++; +// } - logmsg2 = QString("Count: %1").arg(cnt); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("Count: %1").arg(cnt); +// this->addlog(logmsg + logmsg2); - ai=AB_ImExporterContext_GetFirstAccountInfo(ctx); - while(ai) { - //Beim Anlegen einer Terminüberweisung wird hierher nicht verzweigt! - /**********************************************************************/ - //this->parseImExporterAccountInfo_Status(ai); - /**********************************************************************/ - AB_ACCOUNT_STATUS *s; - logmsg = "Recvd-AccountStatus: "; - const AB_BALANCE *b; - cnt = 0; +// ai=AB_ImExporterContext_GetFirstAccountInfo(ctx); +// while(ai) { +// //Beim Anlegen einer Terminüberweisung wird hierher nicht verzweigt! +// /**********************************************************************/ +// //this->parseImExporterAccountInfo_Status(ai); +// /**********************************************************************/ +// AB_ACCOUNT_STATUS *s; +// logmsg = "Recvd-AccountStatus: "; +// const AB_BALANCE *b; +// cnt = 0; - s = AB_ImExporterAccountInfo_GetFirstAccountStatus(ai); - while (s) { - logmsg2 = QString("Balance for: "); - logmsg2.append(AB_ImExporterAccountInfo_GetAccountNumber(ai)); - logmsg2.append("("); - logmsg2.append(AB_ImExporterAccountInfo_GetAccountName(ai)); - logmsg2.append(")"); - this->addlog(logmsg + logmsg2); +// s = AB_ImExporterAccountInfo_GetFirstAccountStatus(ai); +// while (s) { +// logmsg2 = QString("Balance for: "); +// logmsg2.append(AB_ImExporterAccountInfo_GetAccountNumber(ai)); +// logmsg2.append("("); +// logmsg2.append(AB_ImExporterAccountInfo_GetAccountName(ai)); +// logmsg2.append(")"); +// this->addlog(logmsg + logmsg2); - v = AB_AccountStatus_GetBankLine(s); - if (v != NULL) { - logmsg2 = QString("BankLine:\t"); - logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2)); - this->addlog(logmsg + logmsg2); - } +// v = AB_AccountStatus_GetBankLine(s); +// if (v != NULL) { +// logmsg2 = QString("BankLine:\t"); +// logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2)); +// this->addlog(logmsg + logmsg2); +// } - b = AB_AccountStatus_GetNotedBalance(s); - if (b != NULL) { - v = AB_Balance_GetValue(b); - if (v != NULL) { - logmsg2 = QString("NotedBalance:\t"); - logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2)); - this->addlog(logmsg + logmsg2); - } - } +// b = AB_AccountStatus_GetNotedBalance(s); +// if (b != NULL) { +// v = AB_Balance_GetValue(b); +// if (v != NULL) { +// logmsg2 = QString("NotedBalance:\t"); +// logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2)); +// this->addlog(logmsg + logmsg2); +// } +// } - b = AB_AccountStatus_GetBookedBalance(s); - if (b != NULL) { - v = AB_Balance_GetValue(b); - if (v != NULL) { - logmsg2 = QString("BookedBalance:\t"); - logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2)); - this->addlog(logmsg + logmsg2); - } - } +// b = AB_AccountStatus_GetBookedBalance(s); +// if (b != NULL) { +// v = AB_Balance_GetValue(b); +// if (v != NULL) { +// logmsg2 = QString("BookedBalance:\t"); +// logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2)); +// this->addlog(logmsg + logmsg2); +// } +// } - v = AB_AccountStatus_GetDisposable(s); - if (v != NULL) { - logmsg2 = QString("Disposable:\t"); - logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2)); - this->addlog(logmsg + logmsg2); - } +// v = AB_AccountStatus_GetDisposable(s); +// if (v != NULL) { +// logmsg2 = QString("Disposable:\t"); +// logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2)); +// this->addlog(logmsg + logmsg2); +// } - v = AB_AccountStatus_GetDisposed(s); - if (v != NULL) { - logmsg2 = QString("Disposed:\t"); - logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2)); - this->addlog(logmsg + logmsg2); - } +// v = AB_AccountStatus_GetDisposed(s); +// if (v != NULL) { +// logmsg2 = QString("Disposed:\t"); +// logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v), 0, 'f', 2)); +// this->addlog(logmsg + logmsg2); +// } - logmsg2 = QString("Time:\t"); - logmsg2.append(abt_conv::GwenTimeToQDate( - AB_AccountStatus_GetTime(s)).toString( - Qt::DefaultLocaleLongDate)); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("Time:\t"); +// logmsg2.append(abt_conv::GwenTimeToQDate( +// AB_AccountStatus_GetTime(s)).toString( +// Qt::DefaultLocaleLongDate)); +// this->addlog(logmsg + logmsg2); - s = AB_ImExporterAccountInfo_GetNextAccountStatus(ai); - cnt++; - } +// s = AB_ImExporterAccountInfo_GetNextAccountStatus(ai); +// cnt++; +// } - logmsg2 = QString("Count: %1").arg(cnt); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("Count: %1").arg(cnt); +// this->addlog(logmsg + logmsg2); - /**********************************************************************/ - //this->parseImExporterAccountInfo_DatedTransfers(ai); //Terminüberweisungen - /**********************************************************************/ - AB_TRANSACTION *t; - logmsg = "Recvd-DatedTransfers: "; - QStringList strList; - const GWEN_STRINGLIST *l; - cnt = 0; +// /**********************************************************************/ +// //this->parseImExporterAccountInfo_DatedTransfers(ai); //Terminüberweisungen +// /**********************************************************************/ +// AB_TRANSACTION *t; +// logmsg = "Recvd-DatedTransfers: "; +// QStringList strList; +// const GWEN_STRINGLIST *l; +// cnt = 0; - cnt = AB_ImExporterAccountInfo_GetDatedTransferCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - this->addlog(logmsg + logmsg2); +// cnt = AB_ImExporterAccountInfo_GetDatedTransferCount(ai); +// logmsg2 = QString("Count: %1").arg(cnt); +// this->addlog(logmsg + logmsg2); - t = AB_ImExporterAccountInfo_GetFirstDatedTransfer(ai); - while (t) { +// t = AB_ImExporterAccountInfo_GetFirstDatedTransfer(ai); +// while (t) { - logmsg2 = QString("Purpose:\t"); - l = AB_Transaction_GetPurpose(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2.append(strList.join(" - ")); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("Purpose:\t"); +// l = AB_Transaction_GetPurpose(t); +// strList = abt_conv::GwenStringListToQStringList(l); +// logmsg2.append(strList.join(" - ")); +// this->addlog(logmsg + logmsg2); - logmsg2 = QString("Value:\t"); - v = AB_Transaction_GetValue(t); - logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("Value:\t"); +// v = AB_Transaction_GetValue(t); +// logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); +// this->addlog(logmsg + logmsg2); - logmsg2 = QString("RemoteName:\t"); - l = AB_Transaction_GetRemoteName(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2.append(strList.join(" - ")); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("RemoteName:\t"); +// l = AB_Transaction_GetRemoteName(t); +// strList = abt_conv::GwenStringListToQStringList(l); +// logmsg2.append(strList.join(" - ")); +// this->addlog(logmsg + logmsg2); - switch (AB_Transaction_GetStatus(t)) { - case AB_Transaction_StatusRevoked: - //Bei der Bank hinterlegte Terminüberweisung wurde gelöscht - this->addlog(QString( - "Lösche bei der Bank gelöschte Terminüberweisung (ID: %1)" - ).arg(AB_Transaction_GetFiId(t))); - break; - case AB_Transaction_StatusManuallyReconciled: - case AB_Transaction_StatusAutoReconciled: - //Bei der Bank hinterlegte Terminüberweisung wurde geändert - this->addlog(QString( - "Speichere bei der Bank geänderte Terminüberweisung (ID: %1)" - ).arg(AB_Transaction_GetFiId(t))); - break; - default: - //Bei der Bank hinterlegte Terminüberweisung auch lokal speichern - this->addlog(QString( - "Speichere bei der Bank hinterlegte Terminüberweisung (ID: %1)" - ).arg(AB_Transaction_GetFiId(t))); - break; - } +// switch (AB_Transaction_GetStatus(t)) { +// case AB_Transaction_StatusRevoked: +// //Bei der Bank hinterlegte Terminüberweisung wurde gelöscht +// this->addlog(QString( +// "Lösche bei der Bank gelöschte Terminüberweisung (ID: %1)" +// ).arg(AB_Transaction_GetFiId(t))); +// break; +// case AB_Transaction_StatusManuallyReconciled: +// case AB_Transaction_StatusAutoReconciled: +// //Bei der Bank hinterlegte Terminüberweisung wurde geändert +// this->addlog(QString( +// "Speichere bei der Bank geänderte Terminüberweisung (ID: %1)" +// ).arg(AB_Transaction_GetFiId(t))); +// break; +// default: +// //Bei der Bank hinterlegte Terminüberweisung auch lokal speichern +// this->addlog(QString( +// "Speichere bei der Bank hinterlegte Terminüberweisung (ID: %1)" +// ).arg(AB_Transaction_GetFiId(t))); +// break; +// } - t = AB_ImExporterAccountInfo_GetNextDatedTransfer(ai); - } +// t = AB_ImExporterAccountInfo_GetNextDatedTransfer(ai); +// } - /**********************************************************************/ - //this->parseImExporterAccountInfo_NotedTransactions(ai); //geplante Buchungen - /**********************************************************************/ - //AB_TRANSACTION *t; - logmsg = "Recvd-NotedTransactions: "; - strList.clear(); - const AB_VALUE *v; - //const GWEN_STRINGLIST *l; - cnt = 0; +// /**********************************************************************/ +// //this->parseImExporterAccountInfo_NotedTransactions(ai); //geplante Buchungen +// /**********************************************************************/ +// //AB_TRANSACTION *t; +// logmsg = "Recvd-NotedTransactions: "; +// strList.clear(); +// const AB_VALUE *v; +// //const GWEN_STRINGLIST *l; +// cnt = 0; - cnt = AB_ImExporterAccountInfo_GetNotedTransactionCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - this->addlog(logmsg + logmsg2); +// cnt = AB_ImExporterAccountInfo_GetNotedTransactionCount(ai); +// logmsg2 = QString("Count: %1").arg(cnt); +// this->addlog(logmsg + logmsg2); - t = AB_ImExporterAccountInfo_GetFirstNotedTransaction(ai); - while (t) { - logmsg2 = QString("Purpose:\t"); - l = AB_Transaction_GetPurpose(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2.append(strList.join(" - ")); - this->addlog(logmsg + logmsg2); +// t = AB_ImExporterAccountInfo_GetFirstNotedTransaction(ai); +// while (t) { +// logmsg2 = QString("Purpose:\t"); +// l = AB_Transaction_GetPurpose(t); +// strList = abt_conv::GwenStringListToQStringList(l); +// logmsg2.append(strList.join(" - ")); +// this->addlog(logmsg + logmsg2); - logmsg2 = QString("Value:\t"); - v = AB_Transaction_GetValue(t); - logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("Value:\t"); +// v = AB_Transaction_GetValue(t); +// logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); +// this->addlog(logmsg + logmsg2); - logmsg2 = QString("RemoteName:\t"); - l = AB_Transaction_GetRemoteName(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2.append(strList.join(" - ")); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("RemoteName:\t"); +// l = AB_Transaction_GetRemoteName(t); +// strList = abt_conv::GwenStringListToQStringList(l); +// logmsg2.append(strList.join(" - ")); +// this->addlog(logmsg + logmsg2); - t = AB_ImExporterAccountInfo_GetNextNotedTransaction(ai); - } +// t = AB_ImExporterAccountInfo_GetNextNotedTransaction(ai); +// } - /**********************************************************************/ - //this->parseImExporterAccountInfo_StandingOrders(ai); //Daueraufträge - /**********************************************************************/ -// AB_TRANSACTION *t; - logmsg = "Recvd-StandingOrders: "; - strList.clear(); -// const AB_VALUE *v; -// const GWEN_STRINGLIST *l; - cnt = 0; +// /**********************************************************************/ +// //this->parseImExporterAccountInfo_StandingOrders(ai); //Daueraufträge +// /**********************************************************************/ +//// AB_TRANSACTION *t; +// logmsg = "Recvd-StandingOrders: "; +// strList.clear(); +//// const AB_VALUE *v; +//// const GWEN_STRINGLIST *l; +// cnt = 0; - cnt = AB_ImExporterAccountInfo_GetStandingOrderCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - this->addlog(logmsg + logmsg2); +// cnt = AB_ImExporterAccountInfo_GetStandingOrderCount(ai); +// logmsg2 = QString("Count: %1").arg(cnt); +// this->addlog(logmsg + logmsg2); - t = AB_ImExporterAccountInfo_GetFirstStandingOrder(ai); - while (t) { - logmsg2 = QString("Purpose:\t"); - l = AB_Transaction_GetPurpose(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2.append(strList.join(" - ")); - this->addlog(logmsg + logmsg2); +// t = AB_ImExporterAccountInfo_GetFirstStandingOrder(ai); +// while (t) { +// logmsg2 = QString("Purpose:\t"); +// l = AB_Transaction_GetPurpose(t); +// strList = abt_conv::GwenStringListToQStringList(l); +// logmsg2.append(strList.join(" - ")); +// this->addlog(logmsg + logmsg2); - logmsg2 = QString("Value:\t"); - v = AB_Transaction_GetValue(t); - logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("Value:\t"); +// v = AB_Transaction_GetValue(t); +// logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); +// this->addlog(logmsg + logmsg2); - logmsg2 = QString("RemoteName:\t"); - l = AB_Transaction_GetRemoteName(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2.append(strList.join(" - ")); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("RemoteName:\t"); +// l = AB_Transaction_GetRemoteName(t); +// strList = abt_conv::GwenStringListToQStringList(l); +// logmsg2.append(strList.join(" - ")); +// this->addlog(logmsg + logmsg2); - switch (AB_Transaction_GetStatus(t)) { - case AB_Transaction_StatusRevoked: - //Bei der Bank hinterlegter Dauerauftrag wurde gelöscht - this->addlog(QString( - "Lösche bei der Bank gelöschten Dauerauftrag (ID: %1)" - ).arg(AB_Transaction_GetFiId(t))); - break; - case AB_Transaction_StatusManuallyReconciled: - case AB_Transaction_StatusAutoReconciled: - //Bei der Bank hinterlegter Dauerauftrag wurde geändert - this->addlog(QString( - "Speichere bei der Bank geänderten Dauerauftrag (ID: %1)" - ).arg(AB_Transaction_GetFiId(t))); - break; - default: - //Bei der Bank hinterlegten Dauerauftrag auch lokal speichern - this->addlog(QString( - "Speichere bei der Bank hinterlegten Dauerauftrag (ID: %1)" - ).arg(AB_Transaction_GetFiId(t))); - break; - } +// switch (AB_Transaction_GetStatus(t)) { +// case AB_Transaction_StatusRevoked: +// //Bei der Bank hinterlegter Dauerauftrag wurde gelöscht +// this->addlog(QString( +// "Lösche bei der Bank gelöschten Dauerauftrag (ID: %1)" +// ).arg(AB_Transaction_GetFiId(t))); +// break; +// case AB_Transaction_StatusManuallyReconciled: +// case AB_Transaction_StatusAutoReconciled: +// //Bei der Bank hinterlegter Dauerauftrag wurde geändert +// this->addlog(QString( +// "Speichere bei der Bank geänderten Dauerauftrag (ID: %1)" +// ).arg(AB_Transaction_GetFiId(t))); +// break; +// default: +// //Bei der Bank hinterlegten Dauerauftrag auch lokal speichern +// this->addlog(QString( +// "Speichere bei der Bank hinterlegten Dauerauftrag (ID: %1)" +// ).arg(AB_Transaction_GetFiId(t))); +// break; +// } - t = AB_ImExporterAccountInfo_GetNextStandingOrder(ai); - } +// t = AB_ImExporterAccountInfo_GetNextStandingOrder(ai); +// } - /**********************************************************************/ - //this->parseImExporterAccountInfo_Transactions(ai); //Buchungen - /**********************************************************************/ -// AB_TRANSACTION *t; - logmsg = "Recvd-Transactions: "; - strList.clear();; -// const AB_VALUE *v; -// const GWEN_STRINGLIST *l; - cnt = 0; +// /**********************************************************************/ +// //this->parseImExporterAccountInfo_Transactions(ai); //Buchungen +// /**********************************************************************/ +//// AB_TRANSACTION *t; +// logmsg = "Recvd-Transactions: "; +// strList.clear();; +//// const AB_VALUE *v; +//// const GWEN_STRINGLIST *l; +// cnt = 0; - cnt = AB_ImExporterAccountInfo_GetTransactionCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - this->addlog(logmsg + logmsg2); +// cnt = AB_ImExporterAccountInfo_GetTransactionCount(ai); +// logmsg2 = QString("Count: %1").arg(cnt); +// this->addlog(logmsg + logmsg2); - t = AB_ImExporterAccountInfo_GetFirstTransaction(ai); - while (t) { - logmsg2 = QString("Purpose:\t"); - l = AB_Transaction_GetPurpose(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2.append(strList.join(" - ")); - this->addlog(logmsg + logmsg2); +// t = AB_ImExporterAccountInfo_GetFirstTransaction(ai); +// while (t) { +// logmsg2 = QString("Purpose:\t"); +// l = AB_Transaction_GetPurpose(t); +// strList = abt_conv::GwenStringListToQStringList(l); +// logmsg2.append(strList.join(" - ")); +// this->addlog(logmsg + logmsg2); - logmsg2 = QString("Value:\t"); - v = AB_Transaction_GetValue(t); - logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("Value:\t"); +// v = AB_Transaction_GetValue(t); +// logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); +// this->addlog(logmsg + logmsg2); - logmsg2 = QString("RemoteName:\t"); - l = AB_Transaction_GetRemoteName(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2.append(strList.join(" - ")); - this->addlog(logmsg + logmsg2); +// logmsg2 = QString("RemoteName:\t"); +// l = AB_Transaction_GetRemoteName(t); +// strList = abt_conv::GwenStringListToQStringList(l); +// logmsg2.append(strList.join(" - ")); +// this->addlog(logmsg + logmsg2); - t = AB_ImExporterAccountInfo_GetNextTransaction(ai); - } +// t = AB_ImExporterAccountInfo_GetNextTransaction(ai); +// } - /**********************************************************************/ - //this->parseImExporterAccountInfo_Transfers(ai); //Überweisungen - /**********************************************************************/ -// AB_TRANSACTION *t; - logmsg = "Recvd-Transfers: "; - strList.clear(); -// const AB_VALUE *v; -// const GWEN_STRINGLIST *l; - cnt = 0; +// /**********************************************************************/ +// //this->parseImExporterAccountInfo_Transfers(ai); //Überweisungen +// /**********************************************************************/ +//// AB_TRANSACTION *t; +// logmsg = "Recvd-Transfers: "; +// strList.clear(); +//// const AB_VALUE *v; +//// const GWEN_STRINGLIST *l; +// cnt = 0; - cnt = AB_ImExporterAccountInfo_GetTransferCount(ai); - logmsg2 = QString("Count: %1").arg(cnt); - this->addlog(logmsg + logmsg2); +// cnt = AB_ImExporterAccountInfo_GetTransferCount(ai); +// logmsg2 = QString("Count: %1").arg(cnt); +// this->addlog(logmsg + logmsg2); - t = AB_ImExporterAccountInfo_GetFirstTransfer(ai); - while (t) { - logmsg2 = QString("Purpose:\t"); - l = AB_Transaction_GetPurpose(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2.append(strList.join(" - ")); - this->addlog(logmsg + logmsg2); +// t = AB_ImExporterAccountInfo_GetFirstTransfer(ai); +// while (t) { +// qDebug() << Q_FUNC_INFO << "RemoteBankName:" << AB_Transaction_GetRemoteBankName(t); +// qDebug() << Q_FUNC_INFO << "RemoteBankName:" << QString(AB_Transaction_GetRemoteBankName(t)); +// qDebug() << Q_FUNC_INFO << "RemoteBankName:" << QString(QByteArray::fromPercentEncoding(AB_Transaction_GetRemoteBankName(t))); +//// qDebug() << Q_FUNC_INFO << "RemoteBankName:" << QString::fromAscii(AB_Transaction_GetRemoteBankName(t)); +// qDebug() << Q_FUNC_INFO << "RemoteBankName:" << QString::fromLatin1(AB_Transaction_GetRemoteBankName(t)); +// qDebug() << Q_FUNC_INFO << "RemoteBankName:" << QString::fromLocal8Bit(AB_Transaction_GetRemoteBankName(t)); +// qDebug() << Q_FUNC_INFO << "RemoteBankName:" << QString::fromStdString(AB_Transaction_GetRemoteBankName(t)); +// qDebug() << Q_FUNC_INFO << "RemoteBankName:" << QString::fromUtf8(AB_Transaction_GetRemoteBankName(t)); +// qDebug() << Q_FUNC_INFO << "RemoteBankName:" << QByteArray::fromPercentEncoding(QString::fromLatin1(AB_Transaction_GetRemoteBankName(t)).toLatin1()); +// qDebug() << Q_FUNC_INFO << "RemoteBankName:" << QString::fromUtf8(QByteArray::fromPercentEncoding(AB_Transaction_GetRemoteBankName(t))); - logmsg2 = QString("Value:\t"); - v = AB_Transaction_GetValue(t); - logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); - this->addlog(logmsg + logmsg2); +// QByteArray encodedString = AB_Transaction_GetRemoteBankName(t); +// QTextCodec *codec = QTextCodec::codecForName("UTF-8"); +// qDebug() << Q_FUNC_INFO << "1" << codec->name(); +// qDebug() << Q_FUNC_INFO << "1 Should always work1:" << codec->toUnicode(encodedString); +// qDebug() << Q_FUNC_INFO << "1 Should always work2:" << codec->toUnicode(AB_Transaction_GetRemoteBankName(t)); +// codec = QTextCodec::codecForCStrings(); +// if (codec) { +// qDebug() << Q_FUNC_INFO << "2" << codec->name(); +// qDebug() << Q_FUNC_INFO << "2 Should always work1:" << codec->toUnicode(encodedString); +// qDebug() << Q_FUNC_INFO << "2 Should always work2:" << codec->toUnicode(AB_Transaction_GetRemoteBankName(t)); +// } +// codec = QTextCodec::codecForLocale(); +// qDebug() << Q_FUNC_INFO << "3" << codec->name(); +// qDebug() << Q_FUNC_INFO << "3 Should always work1:" << QString(codec->toUnicode(encodedString).toStdString().c_str()); +// qDebug() << Q_FUNC_INFO << "3 Should always work2:" << QString::fromAscii(codec->toUnicode(encodedString).toStdString().c_str()); +// qDebug() << Q_FUNC_INFO << "3 Should always work3:" << QString::fromUtf8(codec->toUnicode(encodedString).toStdString().c_str()); +// qDebug() << Q_FUNC_INFO << "3 Should always work4:" << codec->toUnicode(AB_Transaction_GetRemoteBankName(t)); +// qDebug() << Q_FUNC_INFO << "3 Should always work5:" << QString::fromUtf8(AB_Transaction_GetRemoteBankName(t)); +// codec = QTextCodec::codecForUtfText(encodedString); +// qDebug() << Q_FUNC_INFO << "4" << codec->name(); +// qDebug() << Q_FUNC_INFO << "4 Should always work1:" << codec->toUnicode(encodedString); +// qDebug() << Q_FUNC_INFO << "4 Should always work2:" << codec->toUnicode(AB_Transaction_GetRemoteBankName(t)); - logmsg2 = QString("RemoteName:\t"); - l = AB_Transaction_GetRemoteName(t); - strList = abt_conv::GwenStringListToQStringList(l); - logmsg2.append(strList.join(" - ")); - this->addlog(logmsg + logmsg2); +// qDebug() << Q_FUNC_INFO << "WORKS!:" << abt_conv::encodeFromAb(AB_Transaction_GetRemoteBankName(t)); - t = AB_ImExporterAccountInfo_GetNextTransfer(ai); - } +// const char* str = AB_Transaction_GetRemoteBankName(t); +// while (*str != 0) { +// qDebug("*str = 0x%4X = %c", *str, *str); +// fprintf(stdout, "0x%4X ", *str); +// str++; +// } +// fprintf(stdout, "\n"); +// //qDebug() << Q_FUNC_INFO << "RemoteBankName:" << QByteArray::fromRawData(str); +// logmsg2 = QString("RemoteBankName:\t"); +// QString s = QString("%1").arg(AB_Transaction_GetRemoteBankName(t)); +// logmsg2.append(s); +// this->addlog(logmsg + logmsg2); +// logmsg2 = QString("RemoteBankName:\t"); +// QString bankName = abt_conv::encodeFromAb(AB_Transaction_GetRemoteBankName(t)); +// logmsg2.append(bankName); +// this->addlog(logmsg + logmsg2); +// logmsg2 = QString("RemoteBankName:\t"); +// bankName = AB_Transaction_GetRemoteBankName(t); +// logmsg2.append(bankName); +// this->addlog(logmsg + logmsg2); - ai=AB_ImExporterContext_GetNextAccountInfo(ctx); - } /* while ai */ +// logmsg2 = QString("RemoteBankName:\t"); +// bankName = QString::fromLocal8Bit(AB_Transaction_GetRemoteBankName(t)); +// logmsg2.append(bankName); +// this->addlog(logmsg + logmsg2); + +// logmsg2 = QString("RemoteBankName:\t"); +// bankName = QString::fromUtf8(AB_Transaction_GetRemoteBankName(t)); +// logmsg2.append(bankName); +// this->addlog(logmsg + logmsg2); + +// logmsg2 = QString("RemoteBankName:\t"); +// bankName = QString::fromAscii(AB_Transaction_GetRemoteBankName(t)); +// logmsg2.append(bankName); +// this->addlog(logmsg + logmsg2); + +// logmsg2 = QString("RemoteBankName:\t"); +// bankName = QString::fromLatin1(AB_Transaction_GetRemoteBankName(t)); +// logmsg2.append(bankName); +// this->addlog(logmsg + logmsg2); + +// logmsg2 = QString("Purpose:\t"); +// l = AB_Transaction_GetPurpose(t); +// strList = abt_conv::GwenStringListToQStringList(l); +// logmsg2.append(strList.join(" - ")); +// this->addlog(logmsg + logmsg2); + +// logmsg2 = QString("Value:\t"); +// v = AB_Transaction_GetValue(t); +// qDebug() << Q_FUNC_INFO << "Value:" << abt_conv::ABValueToString(v); +// logmsg2.append(QString("%1").arg(AB_Value_GetValueAsDouble(v))); +// this->addlog(logmsg + logmsg2); + +// logmsg2 = QString("RemoteName:\t"); +// l = AB_Transaction_GetRemoteName(t); +// strList = abt_conv::GwenStringListToQStringList(l); +// logmsg2.append(strList.join(" - ")); +// this->addlog(logmsg + logmsg2); + +// logmsg2 = QString("LocalName:\t"); +// bankName = QString::fromUtf8(AB_Transaction_GetLocalName(t)); +// logmsg2.append(bankName); +// this->addlog(logmsg + logmsg2); + +// abt_transaction trans(t); +// this->addlog("----- abt_transaction usage below -----"); + +// logmsg2 = QString("LocalName:\t"); +// bankName = trans.getLocalName(); +// logmsg2.append(bankName); +// this->addlog(logmsg + logmsg2); + +// logmsg2 = QString("RemoteBankName:\t"); +// bankName = trans.getRemoteBankName(); +// logmsg2.append(bankName); +// this->addlog(logmsg + logmsg2); + + +// t = AB_ImExporterAccountInfo_GetNextTransfer(ai); +// } + + + + + +// ai=AB_ImExporterContext_GetNextAccountInfo(ctx); +// } /* while ai */ //return true; } diff --git a/src/pages/pagewidgettests.h b/src/pages/pagewidgettests.h --- a/src/pages/pagewidgettests.h +++ b/src/pages/pagewidgettests.h @@ -28,11 +28,14 @@ * ******************************************************************************/ +/** \todo translation of documentation and comments needed */ + #ifndef PAGEWIDGETTESTS_H #define PAGEWIDGETTESTS_H -#include -#include +#include +#include +#include #include #include @@ -61,6 +64,7 @@ #include "../abt_conv.h" #include "../aqb_accounts.h" + /*! \brief NUR FÜR TESTZECKE! * * Diese Klasse wird nur genutzt um widgets zu testen, im eigentlichen @@ -83,6 +87,14 @@ QPushButton *button6; QPushButton *button7; QPushButton *button8; + QLineEdit *edit1; + QLineEdit *edit2; + QLineEdit *edit3; + QLineEdit *edit4; + QLineEdit *edit5; + QLineEdit *edit6; + QLineEdit *edit7; + QLineEdit *edit8; QPlainTextEdit *textEdit; aqb_Accounts *accounts; diff --git a/src/translationchooser.cpp b/src/translationchooser.cpp --- a/src/translationchooser.cpp +++ b/src/translationchooser.cpp @@ -49,31 +49,31 @@ * application executeable is used (TARGET from .pro file), otherwise the * name defined here. */ -QT_STATIC_CONST QString TC_APPNAME = "abtransfers"; +static const QString TC_APPNAME = QString::fromUtf8("abtransfers"); /** default language (tr() in the source is used with this language) */ -QT_STATIC_CONST QString TC_DEFAULT_LANGUAGE = "Deutsch"; +static const QString TC_DEFAULT_LANGUAGE = QString::fromUtf8("Deutsch"); /** default locale for TC_DEFAULT_LANGUAGE */ -QT_STATIC_CONST QString TC_DEFAULT_LOCALE = "de_DE"; +static const QString TC_DEFAULT_LOCALE = QString::fromUtf8("de_DE"); /** default translation verison number (if none is supplied by the translator) */ -QT_STATIC_CONST double TC_DEFAULT_VERSION_NR = 0.0; +static const double TC_DEFAULT_VERSION_NR = 0.0; /** directory in the resources under which the *.qm files are */ -QT_STATIC_CONST QString TC_TRANS_RESOURCE_DIRNAME = "translation/"; +static const QString TC_TRANS_RESOURCE_DIRNAME = QString::fromUtf8("translation/"); /** addional directory for nearly every path */ -QT_STATIC_CONST QString TC_TRANSLATION_DIRNAME = "translation/"; +static const QString TC_TRANSLATION_DIRNAME = QString::fromUtf8("translation/"); /** directory for system wide shared data (mainly used under Linux) */ -QT_STATIC_CONST QString TC_SYSTEM_SHARED = "/usr/share/"; +static const QString TC_SYSTEM_SHARED = QString::fromUtf8("/usr/share/"); /** directory for Mac OS resources within an Application package * (only supported unter Mac OS) */ -QT_STATIC_CONST QString TC_RESOURCES_MAC = "/../Resources/"; +static const QString TC_RESOURCES_MAC = QString::fromUtf8("/../Resources/"); /** convenient access to TC_TRANS_RESOURCE_DIRNAME */ -QT_STATIC_CONST QString TC_TRANS_RESOURCE_STRING = - QString(":/").append(TC_TRANS_RESOURCE_DIRNAME); +static const QString TC_TRANS_RESOURCE_STRING = + QString::fromUtf8(":/").append(TC_TRANS_RESOURCE_DIRNAME); /** directory for translations within the users home directory */ -QT_STATIC_CONST QString APP_SETTINGS_DIRNAME = "/.abtransfers/"; +static const QString APP_SETTINGS_DIRNAME = QString::fromUtf8("/.abtransfers/"); /** \brief data class that is only used within the TranslationChooser class. @@ -167,7 +167,7 @@ this->appFilename = TC_APPNAME; this->activeTranslators.clear(); - this->activeLanguageName = ""; //is updated by setLanguage(); + this->activeLanguageName = QString::fromUtf8(""); //updated by setLanguage(); this->langMenu = NULL; //the calling order is important! @@ -206,7 +206,7 @@ qDebug() << "Translations -" << "searching:" << location; QDir dir(location); - QString nameFilter = this->appFilename + QString("*.qm"); + QString nameFilter = this->appFilename + QString::fromUtf8("*.qm"); QStringList fileNames = dir.entryList(QStringList(nameFilter), QDir::Files, QDir::Name); @@ -288,12 +288,14 @@ locations.append(TC_TRANS_RESOURCE_STRING); //e.g.: /usr/share/APPNAME/ - locations.append(TC_SYSTEM_SHARED + appName + QString("/"));; + locations.append(TC_SYSTEM_SHARED + appName + QString::fromUtf8("/"));; //e.g.: /usr/share/APPNAME/translation - locations.append(TC_SYSTEM_SHARED + appName + QString("/") + TC_TRANSLATION_DIRNAME); + locations.append(TC_SYSTEM_SHARED + appName + QString::fromUtf8("/") + + TC_TRANSLATION_DIRNAME); locations.append(appPath); //app dir - locations.append(appPath + QString("/") + TC_TRANSLATION_DIRNAME); + locations.append(appPath + QString::fromUtf8("/") + + TC_TRANSLATION_DIRNAME); #if defined(Q_OS_MAC) locations.append(appPath + TC_RESOURCES_MAC); @@ -366,7 +368,7 @@ //: used version of the application. appVersion = translator.translate("TranslationChooser", "APP_VERSION"); - if (appVersion == "APP_VERSION") { + if (appVersion == QString::fromUtf8("APP_VERSION")) { //translator did not set any version appVersion = QString(); //use an empty strings } @@ -394,7 +396,7 @@ { QString localeStr; localeStr = QFileInfo(qmFile).fileName().remove(this->appFilename); - localeStr = localeStr.remove(".qm", Qt::CaseInsensitive); + localeStr = localeStr.remove(QString::fromUtf8(".qm"), Qt::CaseInsensitive); //there must be _one_ separation between program name and locale localeStr = localeStr.remove(0, 1); return localeStr; @@ -431,8 +433,8 @@ { QTranslator *qtTranslator = new QTranslator(); QString libDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); - if (!qtTranslator->load("qt_" + locale, libDir)) { - if (!locale.startsWith("en")) { + if (!qtTranslator->load(QString::fromUtf8("qt_") + locale, libDir)) { + if (!locale.startsWith(QString::fromUtf8("en"))) { //the locale en is built in qt, this could not be loaded qWarning() << Q_FUNC_INFO << "could not load qt" << "translations for locale" << locale; @@ -544,8 +546,8 @@ */ void TranslationChooser::setLanguage(const QString &language) { - QString qtLocale = ""; - QString qmFile = ""; + QString qtLocale = QString(); + QString qmFile = QString(); const TranslationChooserData *tData; tData = this->supportedTranslations.value(language, NULL); @@ -605,8 +607,8 @@ QStringList localeStrList; localeStrList.append(localeStr); - while (localeStr.contains("_")) { - int pos = localeStr.lastIndexOf("_"); + while (localeStr.contains(QString::fromUtf8("_"))) { + int pos = localeStr.lastIndexOf(QString::fromUtf8("_")); localeStr.truncate(pos); qDebug() << Q_FUNC_INFO << "localeStr =" << localeStr; localeStrList.append(localeStr); @@ -678,7 +680,7 @@ if (!tdata) return QString(); - return QString("%1").arg(tdata->translationVersion); + return QString::fromUtf8("%1").arg(tdata->translationVersion); } //public @@ -721,13 +723,14 @@ */ QString TranslationChooser::helpTextFilename() const { - static const QString defVal(TC_TRANS_RESOURCE_STRING + "abtransfers-helptext_de.html"); + static const QString defVal(TC_TRANS_RESOURCE_STRING + + QString::fromUtf8("abtransfers-helptext_de.html")); //: The filename of the help text. //: The same directories as for the qm-files are searched! QString helpFilename = tr("HELPTEXTFILENAME"); - if (helpFilename == "HELPTEXTFILENAME") { + if (helpFilename == QString::fromUtf8("HELPTEXTFILENAME")) { //no translation supplied, use default (german) return defVal; } diff --git a/src/widgets/bankaccountswidget.cpp b/src/widgets/bankaccountswidget.cpp --- a/src/widgets/bankaccountswidget.cpp +++ b/src/widgets/bankaccountswidget.cpp @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include @@ -151,10 +153,10 @@ QTextStream(&result) << a; qDebug() << result; //Nur dieselbe Instanz darf diesen Pointer verwenden! - QString mimetype = QString("application/x-abBanking_%1_AccountInfo").arg(app); - mimeData->setData(mimetype, QByteArray(result.toAscii())); + QString mimetype = QString::fromUtf8("application/x-abBanking_%1_AccountInfo").arg(app); + mimeData->setData(mimetype, QByteArray(result.toLatin1())); drag->setMimeData(mimeData); - drag->setPixmap(QPixmap(":/icons/bank-icon")); + drag->setPixmap(QPixmap(QString::fromUtf8(":/icons/bank-icon"))); drag->exec(Qt::CopyAction); @@ -276,7 +278,10 @@ item->setData(3, Qt::DisplayRole, acc->Currency()); item->setData(4, Qt::DisplayRole, acc->getBankLine()); item->setData(4, Qt::TextAlignmentRole, Qt::AlignRight); //Dispo rechtsbündig - item->setData(5, Qt::DisplayRole, QString("%1").arg(acc->getDate().toString("ddd dd. MMM yyyy"))); + QDate date = acc->getDate(); + QString format = QString::fromUtf8("ddd dd. MMM yyyy"); + QString value = QString::fromUtf8("%1").arg(date.toString(format)); + item->setData(5, Qt::DisplayRole, value); item->setData(5, Qt::TextAlignmentRole, Qt::AlignHCenter); //Datum mittig item->setData(6, Qt::DisplayRole, acc->AccountType()); item->setData(7, Qt::DisplayRole, acc->Country()); diff --git a/src/widgets/knownempfaengerwidget.cpp b/src/widgets/knownempfaengerwidget.cpp --- a/src/widgets/knownempfaengerwidget.cpp +++ b/src/widgets/knownempfaengerwidget.cpp @@ -41,6 +41,8 @@ #include #include #include +#include +#include KnownEmpfaengerWidget::KnownEmpfaengerWidget(const QList *list, QWidget *parent) : QGroupBox(parent), @@ -155,11 +157,11 @@ QTextStream(&result) << a; qDebug() << result; //Nur dieselbe Instanz darf diesen Pointer verwenden! - QString mimetype = QString("application/x-abBanking_%1_KnownRecipient").arg(app); - mimeData->setData(mimetype, QByteArray(result.toAscii())); + QString mimetype = QString::fromUtf8("application/x-abBanking_%1_KnownRecipient").arg(app); + mimeData->setData(mimetype, QByteArray(result.toLatin1())); //mimeData->setData("text/plain", info); drag->setMimeData(mimeData); - drag->setPixmap(QPixmap(":/icons/knownEmpfaenger")); + drag->setPixmap(QPixmap(QString::fromUtf8(":/icons/knownEmpfaenger"))); drag->exec(Qt::CopyAction); //evt. später auch den return wert auswerten um zu wissen was mit dem @@ -175,19 +177,22 @@ this->actNew = new QAction(this); this->actNew->setText(tr("Neu")); this->actNew->setToolTip(tr("Einen neuen Empfänger anlegen")); - this->actNew->setIcon(QIcon::fromTheme("document-new", QIcon(":/icons/document-new"))); + this->actNew->setIcon(QIcon::fromTheme(QString::fromUtf8("document-new"), + QIcon(QString::fromUtf8(":/icons/document-new")))); connect(this->actNew, SIGNAL(triggered()), this, SLOT(onActionNewTriggered())); this->actDelete = new QAction(this); this->actDelete->setText(tr("Löschen")); this->actDelete->setToolTip(tr("Ausgewählten Empfänger löschen")); - this->actDelete->setIcon(QIcon::fromTheme("edit-delete", QIcon(":/icons/delete"))); + this->actDelete->setIcon(QIcon::fromTheme(QString::fromUtf8("edit-delete"), + QIcon(QString::fromUtf8(":/icons/delete")))); connect(this->actDelete, SIGNAL(triggered()), this, SLOT(onActionDeleteTriggered())); this->actEdit = new QAction(this); this->actEdit->setText(tr("Ändern")); this->actEdit->setToolTip(tr("Ausgewählten Empfänger bearbeiten")); - this->actEdit->setIcon(QIcon::fromTheme("document-edit", QIcon(":/icons/document-edit"))); + this->actEdit->setIcon(QIcon::fromTheme(QString::fromUtf8("document-edit"), + QIcon(QString::fromUtf8(":/icons/document-edit")))); connect(this->actEdit, SIGNAL(triggered()), this, SLOT(onActionEditTriggered())); } diff --git a/src/widgets/widgetaccountcombobox.cpp b/src/widgets/widgetaccountcombobox.cpp --- a/src/widgets/widgetaccountcombobox.cpp +++ b/src/widgets/widgetaccountcombobox.cpp @@ -28,8 +28,10 @@ * ******************************************************************************/ +/** \todo translation of documentation and comments needed */ + #include "widgetaccountcombobox.h" -#include +#include #include "../aqb_accounts.h" #include "../aqb_accountinfo.h" @@ -76,7 +78,7 @@ this->comboBox->setDisabled(false); //es sind Accounts vorhanden foreach(const aqb_AccountInfo *account, this->m_allAccounts->getAccountHash().values()) { - QString cbText = QString("%1").arg(account->Name()); + QString cbText = QString::fromUtf8("%1").arg(account->Name()); this->comboBox->addItem(cbText, QVariant::fromValue(account)); } } diff --git a/src/widgets/widgetaccountcombobox.h b/src/widgets/widgetaccountcombobox.h --- a/src/widgets/widgetaccountcombobox.h +++ b/src/widgets/widgetaccountcombobox.h @@ -32,7 +32,7 @@ #define WIDGETACCOUNTCOMBOBOX_H #include -#include +#include class aqb_AccountInfo; class aqb_Accounts; diff --git a/src/widgets/widgetaccountdata.cpp b/src/widgets/widgetaccountdata.cpp --- a/src/widgets/widgetaccountdata.cpp +++ b/src/widgets/widgetaccountdata.cpp @@ -30,15 +30,16 @@ #include "widgetaccountdata.h" -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -#include //um qApp verwenden zu können +#include //to use qApp #include "widgetlineeditwithlabel.h" #include "widgetaccountcombobox.h" @@ -109,17 +110,17 @@ QHBoxLayout *hl_acc = new QHBoxLayout(); // layout for kto, blz QHBoxLayout *hl_sepa = new QHBoxLayout(); // layout for iban, bic - validatorAccNr->setRegExp(QRegExp("\\d*", Qt::CaseSensitive)); - validatorBLZ->setRegExp(QRegExp("\\d{3} ?\\d{3} ?\\d{2}", Qt::CaseSensitive)); - validatorIBAN->setRegExp(QRegExp("[a-zA-Z]{2}[0-9]{2} ?[a-zA-Z0-9]{4} ?[0-9]{4} ?[0-9]{3}([a-zA-Z0-9]?){0,1} ?([ a-zA-Z0-9]?){0,15}", Qt::CaseSensitive)); - validatorBIC->setRegExp(QRegExp("([a-zA-Z]{4}[a-zA-Z]{2}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?)", Qt::CaseSensitive)); + validatorAccNr->setRegExp(QRegExp(QString::fromUtf8("\\d*"), Qt::CaseSensitive)); + validatorBLZ->setRegExp(QRegExp(QString::fromUtf8("\\d{3} ?\\d{3} ?\\d{2}"), Qt::CaseSensitive)); + validatorIBAN->setRegExp(QRegExp(QString::fromUtf8("[a-zA-Z]{2}[0-9]{2} ?[a-zA-Z0-9]{4} ?[0-9]{4} ?[0-9]{3}([a-zA-Z0-9]?){0,1} ?([ a-zA-Z0-9]?){0,15}"), Qt::CaseSensitive)); + validatorBIC->setRegExp(QRegExp(QString::fromUtf8("([a-zA-Z]{4}[a-zA-Z]{2}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?)"), Qt::CaseSensitive)); - this->llName = new widgetLineEditWithLabel(tr("Name"), "", Qt::AlignTop, this); + this->llName = new widgetLineEditWithLabel(tr("Name"), QString(), Qt::AlignTop, this); if (!sepaFields || recipientInput) { - this->llAccountNumber = new widgetLineEditWithLabel(tr("Kontonummer"), "", Qt::AlignTop, this); + this->llAccountNumber = new widgetLineEditWithLabel(tr("Kontonummer"), QString(), Qt::AlignTop, this); this->llAccountNumber->lineEdit->setMinimumWidth(170); - this->llBankCode = new widgetLineEditWithLabel(tr("Bankleitzahl"), "", Qt::AlignTop, this); + this->llBankCode = new widgetLineEditWithLabel(tr("Bankleitzahl"), QString(), Qt::AlignTop, this); this->llBankCode->lineEdit->setMinimumWidth(110); this->llAccountNumber->lineEdit->setValidator(validatorAccNr); this->llBankCode->lineEdit->setValidator(validatorBLZ); @@ -140,9 +141,9 @@ this, SLOT(lineEditBankCode_editingFinished())); } if (sepaFields) { - this->llIBAN = new widgetLineEditWithLabel(tr("IBAN"), "", Qt::AlignTop, this); + this->llIBAN = new widgetLineEditWithLabel(tr("IBAN"), QString(), Qt::AlignTop, this); this->llIBAN->lineEdit->setMinimumWidth(170); - this->llBIC = new widgetLineEditWithLabel(tr("BIC"), "", Qt::AlignTop, this); + this->llBIC = new widgetLineEditWithLabel(tr("BIC"), QString(), Qt::AlignTop, this); this->llBIC->lineEdit->setMinimumWidth(110); this->llIBAN->lineEdit->setValidator(validatorIBAN); this->llBIC->lineEdit->setValidator(validatorBIC); @@ -166,15 +167,13 @@ hl_acc->setSpacing(0); hl_sepa->setSpacing(0); - this->llBankName = new widgetLineEditWithLabel(tr("Kreditinstitut"), "", Qt::AlignTop, this); + this->llBankName = new widgetLineEditWithLabel(tr("Kreditinstitut"), QString(), Qt::AlignTop, this); - //Nur Zeichen gemäß ZKA-Zeichensatz zulassen -// UppercaseValidator *validatorText = new UppercaseValidator(this); -// validatorText->setRegExp(QRegExp("[-+ .,/*&%0-9A-Z]*", Qt::CaseSensitive)); - - //Nur Zeichen gemäß ZKA-Zeichensatz, aber auch Kleinbuchstaben, zulassen + //only allow characters that match the regex from the settings + //default: "[-+ .,/*&%0-9A-Za-z]" QRegExpValidator *validatorText = new QRegExpValidator(this); - validatorText->setRegExp(QRegExp("[-+ .,/*&%0-9A-Za-z]*", Qt::CaseSensitive)); + QRegExp regex(settings->allowedCharsRecipientRegex().append(QString::fromUtf8("*")), Qt::CaseSensitive); + validatorText->setRegExp(regex); this->llName->lineEdit->setValidator(validatorText); this->llBankName->lineEdit->setValidator(validatorText); @@ -565,7 +564,7 @@ if (this->llName->isEnabled()) { return this->llName->lineEdit->text(); } else { - return QString(""); + return QString(); } } @@ -582,7 +581,7 @@ if (this->llAccountNumber->isEnabled()) { return this->llAccountNumber->lineEdit->text(); } else { - return QString(""); + return QString(); } } @@ -597,9 +596,10 @@ } if (this->llIBAN->isEnabled()) { - return this->llIBAN->lineEdit->text().replace(" ", ""); + return this->llIBAN->lineEdit->text().replace(QString::fromUtf8(" "), + QString::fromUtf8("")); } else { - return QString(""); + return QString(); } } @@ -624,12 +624,13 @@ if (this->llBankCode->isEnabled()) { //Eingabe ist durch die "Limits" erlaubt. //Wir geben eine BLZ ohne Leerzeichen zurück. - return this->llBankCode->lineEdit->text().replace(" ", ""); + return this->llBankCode->lineEdit->text().replace(QString::fromUtf8(" "), + QString::fromUtf8("")); } //Wir sind kein "localAccount" und die Eingabe als "remoteAccount" ist //nicht erlaubt. Wir geben einen leeren String zurück. - return QString(""); + return QString(); } @@ -654,12 +655,13 @@ if (this->llBIC->isEnabled()) { //Eingabe ist durch die "Limits" erlaubt. //Wir geben eine BIC ohne Leerzeichen zurück. - return this->llBIC->lineEdit->text().replace(" ", ""); + return this->llBIC->lineEdit->text().replace(QString::fromUtf8(" "), + QString::fromUtf8("")); } //Wir sind kein "localAccount" und die Eingabe als "remoteAccount" ist //nicht erlaubt. Wir geben einen leeren String zurück. - return QString(""); + return QString(); } @@ -676,7 +678,7 @@ if (this->llBankName->isEnabled()) { return this->llBankName->lineEdit->text(); } else { - return QString(""); + return QString(); } } @@ -732,8 +734,8 @@ */ qulonglong app = (qulonglong)qApp; - QString mimetypeRecipient = QString("application/x-abBanking_%1_KnownRecipient").arg(app); - QString mimetypeAccount = QString("application/x-abBanking_%1_AccountInfo").arg(app); + QString mimetypeRecipient = QString::fromUtf8("application/x-abBanking_%1_KnownRecipient").arg(app); + QString mimetypeAccount = QString::fromUtf8("application/x-abBanking_%1_AccountInfo").arg(app); //qDebug() << "dragEnterEvent: Format =" << event->mimeData()->formats(); @@ -766,8 +768,8 @@ //Über den mimeType wird auch sichergestellt das nur dieselbe Instanz //den übergebenen Pointer verwendet! qulonglong app = (qulonglong)qApp; - QString mimetypeRecipient = QString("application/x-abBanking_%1_KnownRecipient").arg(app); - QString mimetypeAccount = QString("application/x-abBanking_%1_AccountInfo").arg(app); + QString mimetypeRecipient = QString::fromUtf8("application/x-abBanking_%1_KnownRecipient").arg(app); + QString mimetypeAccount = QString::fromUtf8("application/x-abBanking_%1_AccountInfo").arg(app); if (event->mimeData()->hasFormat(mimetypeRecipient)) { QByteArray encoded = event->mimeData()->data(mimetypeRecipient); diff --git a/src/widgets/widgetcalculator.cpp b/src/widgets/widgetcalculator.cpp --- a/src/widgets/widgetcalculator.cpp +++ b/src/widgets/widgetcalculator.cpp @@ -80,26 +80,26 @@ this->display->setAlignment(Qt::AlignRight | Qt::AlignVCenter); grid->addWidget(display, 0, 0, 1, 5); - this->buttons[0] = new QPushButton("0", this); - this->buttons[1] = new QPushButton("1", this); - this->buttons[2] = new QPushButton("2", this); - this->buttons[3] = new QPushButton("3", this); - this->buttons[4] = new QPushButton("4", this); - this->buttons[5] = new QPushButton("5", this); - this->buttons[6] = new QPushButton("6", this); - this->buttons[7] = new QPushButton("7", this); - this->buttons[8] = new QPushButton("8", this); - this->buttons[9] = new QPushButton("9", this); - this->buttons[PLUS] = new QPushButton("+", this); - this->buttons[MINUS] = new QPushButton("-", this); - this->buttons[STAR] = new QPushButton("X", this); + this->buttons[0] = new QPushButton(QString::fromUtf8("0"), this); + this->buttons[1] = new QPushButton(QString::fromUtf8("1"), this); + this->buttons[2] = new QPushButton(QString::fromUtf8("2"), this); + this->buttons[3] = new QPushButton(QString::fromUtf8("3"), this); + this->buttons[4] = new QPushButton(QString::fromUtf8("4"), this); + this->buttons[5] = new QPushButton(QString::fromUtf8("5"), this); + this->buttons[6] = new QPushButton(QString::fromUtf8("6"), this); + this->buttons[7] = new QPushButton(QString::fromUtf8("7"), this); + this->buttons[8] = new QPushButton(QString::fromUtf8("8"), this); + this->buttons[9] = new QPushButton(QString::fromUtf8("9"), this); + this->buttons[PLUS] = new QPushButton(QString::fromUtf8("+"), this); + this->buttons[MINUS] = new QPushButton(QString::fromUtf8("-"), this); + this->buttons[STAR] = new QPushButton(QString::fromUtf8("X"), this); this->buttons[COMMA] = new QPushButton(comma, this); - this->buttons[EQUAL] = new QPushButton("=", this); - this->buttons[SLASH] = new QPushButton("/", this); - this->buttons[CLEAR] = new QPushButton("C", this); - this->buttons[CLEARALL] = new QPushButton("AC", this); - this->buttons[PLUSMINUS] = new QPushButton("+-", this); - this->buttons[PERCENT] = new QPushButton("%", this); + this->buttons[EQUAL] = new QPushButton(QString::fromUtf8("="), this); + this->buttons[SLASH] = new QPushButton(QString::fromUtf8("/"), this); + this->buttons[CLEAR] = new QPushButton(QString::fromUtf8("C"), this); + this->buttons[CLEARALL] = new QPushButton(QString::fromUtf8("AC"), this); + this->buttons[PLUSMINUS] = new QPushButton(QString::fromUtf8("+-"), this); + this->buttons[PERCENT] = new QPushButton(QString::fromUtf8("%"), this); grid->addWidget(buttons[7], 1, 0); grid->addWidget(buttons[8], 1, 1); @@ -128,7 +128,7 @@ this->op1 = 0.0; this->stackedOp = op = 0; this->operand.clear(); - this->changeDisplay("0"); + this->changeDisplay(QString::fromUtf8("0")); // connect the digit signals through a signal mapper QSignalMapper* mapper = new QSignalMapper(this); @@ -193,9 +193,9 @@ void WidgetCalculator::commaClicked(void) { if (this->operand.length() == 0) - this->operand = '0'; - if (this->operand.contains('.', Qt::CaseInsensitive) == 0) - this->operand.append('.'); + this->operand = QString::fromUtf8("0"); + if (this->operand.contains(QString::fromUtf8("."), Qt::CaseInsensitive) == 0) + this->operand.append(QString::fromUtf8(".")); if (this->operand.length() > 16) this->operand = operand.left(16); @@ -212,10 +212,10 @@ } if (this->operand.length() > 0) { - if (this->operand.indexOf('-') != -1) { - this->operand.remove('-'); + if (this->operand.indexOf(QString::fromUtf8("-")) != -1) { + this->operand.remove(QString::fromUtf8("-")); } else { - this->operand.prepend('-'); + this->operand.prepend(QString::fromUtf8("-")); } this->changeDisplay(operand); } @@ -281,7 +281,7 @@ if (error) { this->op = 0; - this->changeDisplay("Error"); + this->changeDisplay(QString::fromUtf8("Error")); this->operand.clear(); } else { this->op1 = op2; @@ -315,14 +315,14 @@ QString str; str.setNum(val, 'f'); int i = str.length(); - while (i > 1 && str[i-1] == '0') { + while (i > 1 && str.at(i-1) == QChar::fromLatin1('0')) { --i; } // cut off trailing 0's str.remove(i, str.length()); if (str.length() > 0) { // possibly remove trailing period - if (str[str.length()-1] == '.') { + if (str[str.length()-1] == QChar::fromLatin1('.')) { str.remove(str.length() - 1, 1); } } @@ -337,7 +337,7 @@ this->operand = this->operand.left(this->operand.length() - 1); } if (this->operand.length() == 0) - this->changeDisplay("0"); + this->changeDisplay(QString::fromUtf8("0")); else this->changeDisplay(this->operand); } @@ -348,7 +348,7 @@ { this->operand.clear(); this->op = 0; - this->changeDisplay("0"); + this->changeDisplay(QString::fromUtf8("0")); } //protected slot @@ -384,12 +384,12 @@ const QString WidgetCalculator::result(void) const { QString txt = lastResult; - txt.replace(QRegExp("\\."), this->comma); - if (txt[0] == '-') { + txt.replace(QRegExp(QString::fromUtf8("\\.")), this->comma); + if (txt[0] == QChar::fromLatin1('-')) { txt = txt.mid(1); // get rid of the minus sign QString mask; mask = QLocale::system().negativeSign(); - mask.append("%1"); + mask.append(QString::fromUtf8("%1")); txt = QString(mask).arg(txt); } return txt; @@ -425,8 +425,9 @@ void WidgetCalculator::changeDisplay(const QString& str) { QString txt = str; - txt.replace(QRegExp("\\."), comma); - this->display->setText("" + txt + ""); + txt.replace(QRegExp(QString::fromUtf8("\\.")), comma); + this->display->setText(QString::fromUtf8("") + txt + + QString::fromUtf8("")); } //protected @@ -522,20 +523,21 @@ */ //operand.replace(QRegExp(QString('\\') + KGlobal::locale()->thousandsSeparator()), QChar()); //this->operand.replace(QRegExp(QString('\\') + QLocale::system().groupSeparator()), QChar()); - this->operand.replace(QRegExp(QString('\\') + this->comma), "."); - if (this->operand.contains('(')) { + this->operand.replace(QRegExp(QString::fromUtf8("\\") + this->comma), + QString::fromUtf8(".")); + if (this->operand.contains(QString::fromUtf8("("))) { negative = true; - this->operand.remove('('); - this->operand.remove(')'); + this->operand.remove(QString::fromUtf8("(")); + this->operand.remove(QString::fromUtf8(")")); } - if (this->operand.contains('-')) { + if (this->operand.contains(QString::fromUtf8("-"))) { negative = true; - this->operand.remove('-'); + this->operand.remove(QString::fromUtf8("-")); } if (this->operand.isEmpty()) - this->operand = '0'; + this->operand = QString::fromUtf8("0"); else if (negative) - this->operand = QString("-%1").arg(operand); + this->operand = QString::fromUtf8("-%1").arg(operand); this->changeDisplay(this->operand); diff --git a/src/widgets/widgetdate.cpp b/src/widgets/widgetdate.cpp --- a/src/widgets/widgetdate.cpp +++ b/src/widgets/widgetdate.cpp @@ -30,11 +30,11 @@ #include "widgetdate.h" -#include -#include -#include +#include +#include +#include -#include +#include widgetDate::widgetDate(const QString &labelText, Qt::Alignment labelAt, QWidget *parent) : QWidget(parent) @@ -51,7 +51,7 @@ this->allowedWeekDays.clear(); //Alle Wochentage erlaubt this->dateEdit = new QDateEdit(this); - this->dateEdit->setDisplayFormat("ddd dd.MM.yyyy"); //z.B. Mi. 07.09.2011 + this->dateEdit->setDisplayFormat(QString::fromUtf8("ddd dd.MM.yyyy")); //z.B. Mi. 07.09.2011 this->dateEdit->setCalendarPopup(true); this->dateEdit->calendarWidget()->setFirstDayOfWeek(Qt::Monday); this->dateEdit->setDate(QDate::currentDate()); @@ -244,7 +244,7 @@ */ void widgetDate::setLimitValuesExecutionDayWeek(const QStringList &execWeekdays) { - if (execWeekdays.isEmpty() || execWeekdays.contains("0")) { + if (execWeekdays.isEmpty() || execWeekdays.contains(QString::fromUtf8("0"))) { this->allowedWeekDays.clear(); //Alle Tage erlaubt return; //Fertig } diff --git a/src/widgets/widgetdate.h b/src/widgets/widgetdate.h --- a/src/widgets/widgetdate.h +++ b/src/widgets/widgetdate.h @@ -32,10 +32,10 @@ #define WIDGETDATE_H #include -#include -#include +#include +#include -#include +#include /** \brief Widget zur Anzeige und Einstellung eines Datums * diff --git a/src/widgets/widgetknowndatedtransfers.cpp b/src/widgets/widgetknowndatedtransfers.cpp --- a/src/widgets/widgetknowndatedtransfers.cpp +++ b/src/widgets/widgetknowndatedtransfers.cpp @@ -28,9 +28,11 @@ * ******************************************************************************/ +/** \todo translation of documentation and comments needed */ + #include "widgetknowndatedtransfers.h" -#include -#include +#include +#include #include #include "../aqb_accountinfo.h" @@ -94,19 +96,22 @@ actDelete = new QAction(this); actDelete->setText(tr("Löschen")); actDelete->setToolTip(tr("Ausgewählte terminierte Überweisung löschen")); - actDelete->setIcon(QIcon::fromTheme("edit-delete", QIcon(":/icons/delete"))); + actDelete->setIcon(QIcon::fromTheme(QString::fromUtf8("edit-delete"), + QIcon(QString::fromUtf8(":/icons/delete")))); connect(actDelete, SIGNAL(triggered()), this, SLOT(onActionDeleteTriggered())); actEdit= new QAction(this); actEdit->setText(tr("Ändern")); actEdit->setToolTip(tr("Ausgewählte terminierte Überweisung bearbeiten")); - actEdit->setIcon(QIcon::fromTheme("document-edit", QIcon(":/icons/document-edit"))); + actEdit->setIcon(QIcon::fromTheme(QString::fromUtf8("document-edit"), + QIcon(QString::fromUtf8(":/icons/document-edit")))); connect(actEdit, SIGNAL(triggered()), this, SLOT(onActionEditTriggered())); actRefresh= new QAction(this); actRefresh->setText(tr("Aktualisieren")); actRefresh->setToolTip(tr("Holt alle beim Institut hinterlegten terminierten Überweisungen")); - actRefresh->setIcon(QIcon::fromTheme("edit-redo", QIcon(":/icons/edit-redo"))); + actRefresh->setIcon(QIcon::fromTheme(QString::fromUtf8("edit-redo"), + QIcon(QString::fromUtf8(":/icons/edit-redo")))); connect(actRefresh, SIGNAL(triggered()), this, SLOT(onActionRefreshTriggered())); } @@ -178,9 +183,9 @@ v = trans->getValue(); //abt_conv::ABValueToString() gibt "" zurück wenn v == NULL! QString Betrag = abt_conv::ABValueToString(v, true); - if (v) Betrag.append(QString(" %1").arg(AB_Value_GetCurrency(v))); + if (v) Betrag.append(QString::fromUtf8(" %1").arg(QString::fromUtf8(AB_Value_GetCurrency(v)))); Item->setData(3, Qt::DisplayRole, Betrag); - Item->setData(4, Qt::DisplayRole, trans->getDate().toString("dd.MM.yyyy")); + Item->setData(4, Qt::DisplayRole, trans->getDate().toString(QString::fromUtf8("dd.MM.yyyy"))); this->treeWidget->addTopLevelItem(Item); } diff --git a/src/widgets/widgetknowndatedtransfers.h b/src/widgets/widgetknowndatedtransfers.h --- a/src/widgets/widgetknowndatedtransfers.h +++ b/src/widgets/widgetknowndatedtransfers.h @@ -32,8 +32,8 @@ #define WIDGETKNOWNDATEDTRANSFERS_H #include -#include -#include +#include +#include class aqb_AccountInfo; class abt_datedTransferInfo; diff --git a/src/widgets/widgetknownstandingorders.cpp b/src/widgets/widgetknownstandingorders.cpp --- a/src/widgets/widgetknownstandingorders.cpp +++ b/src/widgets/widgetknownstandingorders.cpp @@ -30,9 +30,9 @@ ******************************************************************************/ #include "widgetknownstandingorders.h" -#include -#include -#include +#include +#include +#include #include #include "../aqb_accountinfo.h" @@ -103,19 +103,22 @@ actDelete = new QAction(this); actDelete->setText(tr("Löschen")); actDelete->setToolTip(tr("Ausgewählten Dauerauftrag löschen")); - actDelete->setIcon(QIcon::fromTheme("edit-delete", QIcon(":/icons/delete"))); + actDelete->setIcon(QIcon::fromTheme(QString::fromUtf8("edit-delete"), + QIcon(QString::fromUtf8(":/icons/delete")))); connect(actDelete, SIGNAL(triggered()), this, SLOT(onActionDeleteTriggered())); actEdit= new QAction(this); actEdit->setText(tr("Ändern")); actEdit->setToolTip(tr("Ausgewählten Dauerauftrag bearbeiten")); - actEdit->setIcon(QIcon::fromTheme("document-edit", QIcon(":/icons/document-edit"))); + actEdit->setIcon(QIcon::fromTheme(QString::fromUtf8("document-edit"), + QIcon(QString::fromUtf8(":/icons/document-edit")))); connect(actEdit, SIGNAL(triggered()), this, SLOT(onActionEditTriggered())); actRefresh= new QAction(this); actRefresh->setText(tr("Aktualisieren")); actRefresh->setToolTip(tr("Holt alle beim Institut hinterlegten Daueraufträge")); - actRefresh->setIcon(QIcon::fromTheme("edit-redo", QIcon(":/icons/edit-redo"))); + actRefresh->setIcon(QIcon::fromTheme(QString::fromUtf8("edit-redo"), + QIcon(QString::fromUtf8(":/icons/edit-redo")))); connect(actRefresh, SIGNAL(triggered()), this, SLOT(onActionRefreshTriggered())); } @@ -145,10 +148,10 @@ item->setData(2, Qt::DisplayRole, t->getRemoteName().at(0)); const AB_VALUE *v = t->getValue(); - QString amount = ""; + QString amount = QString(); if (v != NULL) { amount = abt_conv::ABValueToString(v, true); - amount.append(QString(" %1").arg(AB_Value_GetCurrency(v))); + amount.append(QString::fromUtf8(" %1").arg(QString::fromUtf8(AB_Value_GetCurrency(v)))); } item->setData(3, Qt::DisplayRole, amount); diff --git a/src/widgets/widgetlineeditwithlabel.cpp b/src/widgets/widgetlineeditwithlabel.cpp --- a/src/widgets/widgetlineeditwithlabel.cpp +++ b/src/widgets/widgetlineeditwithlabel.cpp @@ -30,9 +30,9 @@ #include "widgetlineeditwithlabel.h" -#include -#include -#include +#include +#include +#include widgetLineEditWithLabel::widgetLineEditWithLabel(const QString &labelText, const QString &editText, diff --git a/src/widgets/widgetlineeditwithlabel.h b/src/widgets/widgetlineeditwithlabel.h --- a/src/widgets/widgetlineeditwithlabel.h +++ b/src/widgets/widgetlineeditwithlabel.h @@ -33,7 +33,7 @@ #include -#include +#include class QLabel; class QLayout; @@ -48,7 +48,7 @@ Q_OBJECT public: explicit widgetLineEditWithLabel(const QString &labelText, - const QString &editText = "", + const QString &editText = QString(), Qt::Alignment labelAt = Qt::AlignTop, QWidget *parent = 0); ~widgetLineEditWithLabel(); diff --git a/src/widgets/widgetpurpose.cpp b/src/widgets/widgetpurpose.cpp --- a/src/widgets/widgetpurpose.cpp +++ b/src/widgets/widgetpurpose.cpp @@ -30,9 +30,10 @@ #include "widgetpurpose.h" -#include -#include -#include +#include +#include +#include +#include "../globalvars.h" /*! \bug @@ -128,8 +129,9 @@ return true; } - //Nur Zeichen gemäß ZKA-Zeichensatz, aber auch Kleinbuchstaben, zulassen - QRegExp regex("^[-+ .,/*&%0-9A-Za-z]$", Qt::CaseSensitive); + //only allow characters that match the regex from the settings + //default: "[-+ .,/*&%0-9A-Za-z]" + QRegExp regex(settings->allowedCharsPurposeRegex(), Qt::CaseSensitive); //ev->setModifiers(Qt::ShiftModifier); if (regex.indexIn(ev->text()) != -1) { //Zeichen ist erlaubt! @@ -229,7 +231,7 @@ //public slot void widgetPurpose::setPurpose(const QStringList &text) { - this->setPurpose(text.join("\n")); + this->setPurpose(text.join(QString::fromUtf8("\n"))); } //public slot diff --git a/src/widgets/widgetpurpose.h b/src/widgets/widgetpurpose.h --- a/src/widgets/widgetpurpose.h +++ b/src/widgets/widgetpurpose.h @@ -33,9 +33,9 @@ #include -#include -#include -#include +#include +#include +#include /** \brief Widget zur Darstellung und Eingabe des Verwendungszwecks diff --git a/src/widgets/widgetrecurrence.cpp b/src/widgets/widgetrecurrence.cpp --- a/src/widgets/widgetrecurrence.cpp +++ b/src/widgets/widgetrecurrence.cpp @@ -28,12 +28,14 @@ * ******************************************************************************/ +/** \todo translation of documentation and comments needed */ + #include "widgetrecurrence.h" -#include +#include -#include -#include +#include +#include widgetRecurrence::widgetRecurrence(QWidget *parent) : QWidget(parent) @@ -67,7 +69,7 @@ this, SLOT(spinBoxValueChanged(int))); //Beschreibendes Label erstellen - this->label_week_month = new QLabel("Monat", this); + this->label_week_month = new QLabel(QString::fromUtf8("Monat"), this); this->label_week_month->setMinimumWidth(60); this->label_week_month->setAlignment(Qt::AlignCenter); QLabel *labelAt = new QLabel(tr("am"), this); @@ -250,8 +252,8 @@ itemhint = tr("Immer 2 Tage vor dem letzten des Monats"); break; default: - itemtext = QString("%1").arg(day); - itemhint = QString("Immer am %1. des Monats").arg(day); + itemtext = QString::fromUtf8("%1").arg(day); + itemhint = QString::fromUtf8("Immer am %1. des Monats").arg(day); break; } diff --git a/src/widgets/widgetrecurrence.h b/src/widgets/widgetrecurrence.h --- a/src/widgets/widgetrecurrence.h +++ b/src/widgets/widgetrecurrence.h @@ -32,11 +32,11 @@ #define WIDGETRECURRENCE_H #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include diff --git a/src/widgets/widgettextkey.cpp b/src/widgets/widgettextkey.cpp --- a/src/widgets/widgettextkey.cpp +++ b/src/widgets/widgettextkey.cpp @@ -30,10 +30,10 @@ #include "widgettextkey.h" -#include -#include -#include -#include +#include +#include +#include +#include #include "../globalvars.h" diff --git a/src/widgets/widgettransfer.cpp b/src/widgets/widgettransfer.cpp --- a/src/widgets/widgettransfer.cpp +++ b/src/widgets/widgettransfer.cpp @@ -28,14 +28,16 @@ * ******************************************************************************/ +/** \todo translation of documentation and comments needed */ + #include "widgettransfer.h" -#include -#include -#include -#include +#include +#include +#include +#include -#include +#include #include "../aqb_accountinfo.h" #include "../globalvars.h" //for the global "banking" object @@ -158,11 +160,14 @@ this->setAllLimits(this->m_limits); QIcon ico; - ico = QIcon::fromTheme("edit-undo", QIcon(":/icons/edit-undo")); + ico = QIcon::fromTheme(QString::fromUtf8("edit-undo"), + QIcon(QString::fromUtf8(":/icons/edit-undo"))); this->pushButtonRevert = new QPushButton(ico, tr("Rückgängig"), this); - ico = QIcon::fromTheme("dialog-close", QIcon(":/icons/dialog-close")); + ico = QIcon::fromTheme(QString::fromUtf8("dialog-close"), + QIcon(QString::fromUtf8(":/icons/dialog-close"))); this->pushButtonCancel = new QPushButton(ico, tr("Abbrechen"), this); - ico = QIcon::fromTheme("dialog-ok-apply", QIcon(":/icons/ok")); + ico = QIcon::fromTheme(QString::fromUtf8("dialog-ok-apply"), + QIcon(QString::fromUtf8(":/icons/ok"))); this->pushButtonOK = new QPushButton(ico, tr("Senden"), this); connect(this->pushButtonOK, SIGNAL(clicked()), this, SLOT(onOkButtonPressed())); @@ -219,10 +224,10 @@ BankName = tr("unbekannt"); KontoName = tr("unbekannt"); } else { - BankName = QString("%1 [%2]").arg( + BankName = QString::fromUtf8("%1 [%2]").arg( this->m_accountAtCreation->BankName(), this->m_accountAtCreation->BankCode()); - KontoName = QString("%1 [%2]").arg( + KontoName = QString::fromUtf8("%1 [%2]").arg( this->m_accountAtCreation->Name(), this->m_accountAtCreation->Number()); } @@ -767,9 +772,9 @@ QString colNum; for(int i=0; itextKey != NULL) { if (!this->m_limits->ValuesTextKey.contains( - QString("%1").arg(this->textKey->getTextKey()))) { + QString::fromUtf8("%1").arg(this->textKey->getTextKey()))) { errorMsg.append(tr(" - Textschlüssel nicht erlaubt
")); } } @@ -1123,7 +1128,7 @@ if (this->value != NULL) { this->value->setValue(t->getValue()); //! \todo currency der Transaction verwenden - this->value->setCurrency("EUR"); + this->value->setCurrency(QString::fromUtf8("EUR")); } if (this->purpose != NULL) { diff --git a/src/widgets/widgetvalue.cpp b/src/widgets/widgetvalue.cpp --- a/src/widgets/widgetvalue.cpp +++ b/src/widgets/widgetvalue.cpp @@ -30,7 +30,7 @@ #include "widgetvalue.h" -#include +#include #include #include @@ -49,9 +49,10 @@ this->calcFrame->hide(); BetragValidator *validatorBetrag = new BetragValidator(this); - validatorBetrag->setRegExp(QRegExp("[0-9]+,[0-9][0-9]", Qt::CaseSensitive)); + validatorBetrag->setRegExp(QRegExp(QString::fromUtf8("[0-9]+,[0-9][0-9]"), + Qt::CaseSensitive)); - this->currency->setText("EUR"); + this->currency->setText(QString::fromUtf8("EUR")); this->currency->setReadOnly(true); this->currency->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); this->currency->setMaximumWidth(45); @@ -63,8 +64,9 @@ this->value->installEventFilter(this); QHBoxLayout *layout = new QHBoxLayout(); - QIcon ico = QIcon::fromTheme("accessories-calculator", QIcon(":/icons/calculator")); - QPushButton *calcBtn = new QPushButton(ico, "", this); + QIcon ico = QIcon::fromTheme(QString::fromUtf8("accessories-calculator"), + QIcon(QString::fromUtf8(":/icons/calculator"))); + QPushButton *calcBtn = new QPushButton(ico, QString(), this); calcBtn->setFocusProxy(this->value); connect(calcBtn, SIGNAL(clicked()), this, SLOT(showCalculator())); @@ -111,7 +113,7 @@ // no '-' sign at the first position. if (k->key() == Qt::Key_Minus) { if (this->value->cursorPosition() == 0 && - this->value->text()[0] != '-') { + this->value->text()[0] != QChar::fromLatin1('-')) { rc = false; break; } @@ -220,13 +222,15 @@ if (!this->calcFrame) this->createCalcFrame(); - /* only works when the comma is set to ',' regardless of the comma + /* TODO: only works when the comma is set to ',' regardless of the comma * character the comma in the value text must be replaced with a * period. This should be further investigated, but for the moment * this works. */ - this->calculator->setComma(','); - this->calculator->setInitialValues(this->value->text().replace(',','.'), e); + this->calculator->setComma(QChar::fromLatin1(',')); + this->calculator->setInitialValues(this->value->text().replace( + QChar::fromLatin1(','), + QChar::fromLatin1('.')), e); int h = this->calcFrame->height(); int w = this->calcFrame->width(); diff --git a/src/widgets/widgetvalue.h b/src/widgets/widgetvalue.h --- a/src/widgets/widgetvalue.h +++ b/src/widgets/widgetvalue.h @@ -32,8 +32,8 @@ #define WIDGETVALUE_H #include -#include -#include +#include +#include #include "../abt_conv.h" #include "widgetcalculator.h" @@ -80,7 +80,7 @@ void setValue(const AB_VALUE *abv); void setCurrency(const QString ¤cy); //void setValueCurrency(const AB_VALUE *abv); - void setValueCurrency(const QString &value, const QString ¤cy = "EUR"); + void setValueCurrency(const QString &value, const QString ¤cy = QString::fromUtf8("EUR")); void setLimitAllowChange(int b); diff --git a/translation/scripts/make-translations.bash b/translation/scripts/make-translations.bash --- a/translation/scripts/make-translations.bash +++ b/translation/scripts/make-translations.bash @@ -13,14 +13,14 @@ if [ `uname` = "Darwin" ]; then - PREFIX=/opt/macports-test + PREFIX=/opt/local else PREFIX=/usr fi BIN=${PREFIX}/bin TC_APPNAME=abtransfers -APP_RESOURCES=../abtransfers-build-Qt_4_8_4_macports_test-Release/build/AB-Transfers.app/Contents/Resources/ +APP_RESOURCES=../build-abtransfers-Desktop-Release/build/AB-Transfers.app/Contents/Resources/ LANGS="en_GB" if [ "$1" == "up" ]