diff --git a/kmymoney/mymoney/mymoneyaccount.cpp b/kmymoney/mymoney/mymoneyaccount.cpp --- a/kmymoney/mymoney/mymoneyaccount.cpp +++ b/kmymoney/mymoney/mymoneyaccount.cpp @@ -169,11 +169,6 @@ void MyMoneyAccount::setLastReconciliationDate(const QDate& date) { Q_D(MyMoneyAccount); - // FIXME: for a limited time (maybe until we delivered 1.0) we - // keep the last reconciliation date also in the KVP for backward - // compatibility. After that, the setValue() statemetn should be removed - // and the XML ctor should remove the value completely from the KVP - setValue("lastStatementDate", date.toString(Qt::ISODate)); d->m_lastReconciliationDate = date; } diff --git a/kmymoney/plugins/qif/import/mymoneyqifreader.cpp b/kmymoney/plugins/qif/import/mymoneyqifreader.cpp --- a/kmymoney/plugins/qif/import/mymoneyqifreader.cpp +++ b/kmymoney/plugins/qif/import/mymoneyqifreader.cpp @@ -1919,7 +1919,7 @@ tmp = extractLine('/'); if (tmp.length() > 0) - account.setValue("lastStatementDate", m_qifProfile.date(tmp).toString("yyyy-MM-dd")); + account.setLastReconciliationDate(m_qifProfile.date(tmp)); QifEntryTypeE transactionType = EntryTransaction; QString type = extractLine('T').toLower().remove(QRegExp("\\s+")); diff --git a/kmymoney/plugins/xml/mymoneystorageanon.cpp b/kmymoney/plugins/xml/mymoneystorageanon.cpp --- a/kmymoney/plugins/xml/mymoneystorageanon.cpp +++ b/kmymoney/plugins/xml/mymoneystorageanon.cpp @@ -48,7 +48,7 @@ #include "mymoneykeyvaluecontainer.h" #include "mymoneyexception.h" -QStringList MyMoneyStorageANON::zKvpNoModify = QString("kmm-baseCurrency,OpeningBalanceAccount,PreferredAccount,Tax,fixed-interest,interest-calculation,payee,schedule,term,kmm-online-source,kmm-brokerage-account,lastStatementDate,kmm-sort-reconcile,kmm-sort-std,kmm-iconpos,mm-closed,payee,schedule,term,lastImportedTransactionDate,VatAccount,VatRate,kmm-matched-tx,Imported,priceMode").split(','); +QStringList MyMoneyStorageANON::zKvpNoModify = QString("kmm-baseCurrency,OpeningBalanceAccount,PreferredAccount,Tax,fixed-interest,interest-calculation,payee,schedule,term,kmm-online-source,kmm-brokerage-account,kmm-sort-reconcile,kmm-sort-std,kmm-iconpos,mm-closed,payee,schedule,term,lastImportedTransactionDate,VatAccount,VatRate,kmm-matched-tx,Imported,priceMode").split(','); QStringList MyMoneyStorageANON::zKvpXNumber = QString("final-payment,loan-amount,periodic-payment,lastStatementBalance").split(','); diff --git a/kmymoney/plugins/xml/mymoneystoragexml.cpp b/kmymoney/plugins/xml/mymoneystoragexml.cpp --- a/kmymoney/plugins/xml/mymoneystoragexml.cpp +++ b/kmymoney/plugins/xml/mymoneystoragexml.cpp @@ -695,20 +695,10 @@ acc.setLastModified(QDate::fromString(node.attribute(attributeName(Attribute::Account::LastModified)), Qt::ISODate)); acc.setLastReconciliationDate(QDate::fromString(node.attribute(attributeName(Attribute::Account::LastReconciled)), Qt::ISODate)); - if (!acc.lastReconciliationDate().isValid()) { - // for some reason, I was unable to access our own kvp at this point through - // the value() method. It always returned empty strings. The workaround for - // this is to construct a local kvp the same way as we have done before and - // extract the value from it. - // - // Since we want to get rid of the lastStatementDate record anyway, this seems - // to be ok for now. (ipwizard - 2008-08-14) - - auto txt = acc.value(QStringLiteral("lastStatementDate")); - if (!txt.isEmpty()) { - acc.setLastReconciliationDate(QDate::fromString(txt, Qt::ISODate)); - } - } + // Very old versions of KMyMoney used to store the reconciliation date in + // the KVP as "lastStatementDate". Since we don't use it anymore, we get + // rid of it in case we read such an old file. + acc.deletePair(QStringLiteral("lastStatementDate")); acc.setInstitutionId(node.attribute(attributeName(Attribute::Account::Institution))); acc.setNumber(node.attribute(attributeName(Attribute::Account::Number))); @@ -809,12 +799,6 @@ el.appendChild(onlinesettings); } - // FIXME drop the lastStatementDate record from the KVP when it is - // not stored there after setLastReconciliationDate() has been changed - // See comment there when this will happen - // deletePair("lastStatementDate"); - - //Add in Key-Value Pairs for accounts. writeKeyValueContainer(account, document, el); diff --git a/kmymoney/plugins/xml/tests/mymoneyxmlcontenthandler-test.cpp b/kmymoney/plugins/xml/tests/mymoneyxmlcontenthandler-test.cpp --- a/kmymoney/plugins/xml/tests/mymoneyxmlcontenthandler-test.cpp +++ b/kmymoney/plugins/xml/tests/mymoneyxmlcontenthandler-test.cpp @@ -650,6 +650,7 @@ " \n" " \n" " \n" + " \n" " \n" " \n" "\n"). @@ -690,26 +691,26 @@ try { a = MyMoneyXmlContentHandler::readAccount(node); - QVERIFY(a.id() == "A000001"); - QVERIFY(a.name() == "AccountName"); - QVERIFY(a.parentAccountId() == "Parent"); - QVERIFY(a.lastModified() == QDate::currentDate()); - QVERIFY(a.lastReconciliationDate() == QDate()); - QVERIFY(a.institutionId() == "B000001"); - QVERIFY(a.number() == "465500"); - QVERIFY(a.openingDate() == QDate::currentDate()); - QVERIFY(a.accountType() == eMyMoney::Account::Type::Asset); - QVERIFY(a.description() == "Desc"); - QVERIFY(a.accountList().count() == 2); - QVERIFY(a.accountList()[0] == "A000002"); - QVERIFY(a.accountList()[1] == "A000003"); - QVERIFY(a.pairs().count() == 4); - QVERIFY(a.value("key") == "value"); - QVERIFY(a.value("Key") == "Value"); - QVERIFY(a.value("lastStatementDate").isEmpty()); - QVERIFY(a.reconciliationHistory().count() == 2); - QVERIFY(a.reconciliationHistory()[QDate(2011, 1, 1)] == MyMoneyMoney(123, 100)); - QVERIFY(a.reconciliationHistory()[QDate(2011, 2, 1)] == MyMoneyMoney(456, 100)); + QCOMPARE(a.id(), QStringLiteral("A000001")); + QCOMPARE(a.name(), QStringLiteral("AccountName")); + QCOMPARE(a.parentAccountId(), QStringLiteral("Parent")); + QCOMPARE(a.lastModified(), QDate::currentDate()); + QCOMPARE(a.lastReconciliationDate(), QDate()); + QCOMPARE(a.institutionId(), QStringLiteral("B000001")); + QCOMPARE(a.number(), QStringLiteral("465500")); + QCOMPARE(a.openingDate(), QDate::currentDate()); + QCOMPARE(a.accountType(), eMyMoney::Account::Type::Asset); + QCOMPARE(a.description(), QStringLiteral("Desc")); + QCOMPARE(a.accountList().count(), 2); + QCOMPARE(a.accountList()[0], QStringLiteral("A000002")); + QCOMPARE(a.accountList()[1], QStringLiteral("A000003")); + QCOMPARE(a.pairs().count(), 3); + QCOMPARE(a.value("key"), QStringLiteral("value")); + QCOMPARE(a.value("Key"), QStringLiteral("Value")); + QCOMPARE(a.pairs().contains("lastStatementDate"), false); + QCOMPARE(a.reconciliationHistory().count(), 2); + QCOMPARE(a.reconciliationHistory()[QDate(2011, 1, 1)].toString(), MyMoneyMoney(123, 100).toString()); + QCOMPARE(a.reconciliationHistory()[QDate(2011, 2, 1)].toString(), MyMoneyMoney(456, 100).toString()); } catch (const MyMoneyException &) { QFAIL("Unexpected exception"); }