Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneytransaction.cpp
Context not available. | |||||
36 | using namespace MyMoneyStorageNodes; | 36 | using namespace MyMoneyStorageNodes; | ||
---|---|---|---|---|---|
37 | 37 | | |||
38 | MyMoneyTransaction::MyMoneyTransaction() : | 38 | MyMoneyTransaction::MyMoneyTransaction() : | ||
39 | MyMoneyObject(), | 39 | MyMoneyObject(*new MyMoneyTransactionPrivate) | ||
40 | d_ptr(new MyMoneyTransactionPrivate) | | |||
41 | { | 40 | { | ||
42 | Q_D(MyMoneyTransaction); | 41 | Q_D(MyMoneyTransaction); | ||
43 | d->m_nextSplitID = 1; | 42 | d->m_nextSplitID = 1; | ||
Context not available. | |||||
46 | } | 45 | } | ||
47 | 46 | | |||
48 | MyMoneyTransaction::MyMoneyTransaction(const QDomElement& node, const bool forceId) : | 47 | MyMoneyTransaction::MyMoneyTransaction(const QDomElement& node, const bool forceId) : | ||
49 | MyMoneyObject(node, forceId), | 48 | MyMoneyObject(*new MyMoneyTransactionPrivate, node, forceId) | ||
50 | d_ptr(new MyMoneyTransactionPrivate) | | |||
51 | { | 49 | { | ||
52 | Q_D(MyMoneyTransaction); | 50 | Q_D(MyMoneyTransaction); | ||
53 | if (nodeNames[nnTransaction] != node.tagName()) | 51 | if (nodeNames[nnTransaction] != node.tagName()) | ||
Context not available. | |||||
89 | } | 87 | } | ||
90 | 88 | | |||
91 | MyMoneyTransaction::MyMoneyTransaction(const MyMoneyTransaction& other) : | 89 | MyMoneyTransaction::MyMoneyTransaction(const MyMoneyTransaction& other) : | ||
92 | MyMoneyObject(other.id()), | 90 | MyMoneyObject(*new MyMoneyTransactionPrivate(*other.d_func()), other.id()), | ||
93 | MyMoneyKeyValueContainer(other), | 91 | MyMoneyKeyValueContainer(other) | ||
94 | d_ptr(new MyMoneyTransactionPrivate(*other.d_func())) | | |||
95 | { | 92 | { | ||
96 | } | 93 | } | ||
97 | 94 | | |||
98 | MyMoneyTransaction::MyMoneyTransaction(const QString& id, const MyMoneyTransaction& other) : | 95 | MyMoneyTransaction::MyMoneyTransaction(const QString& id, const MyMoneyTransaction& other) : | ||
99 | MyMoneyObject(id), | 96 | MyMoneyObject(*new MyMoneyTransactionPrivate(*other.d_func()), id), | ||
100 | MyMoneyKeyValueContainer(other), | 97 | MyMoneyKeyValueContainer(other) | ||
101 | d_ptr(new MyMoneyTransactionPrivate(*other.d_func())) | | |||
102 | { | 98 | { | ||
103 | Q_D(MyMoneyTransaction); | 99 | Q_D(MyMoneyTransaction); | ||
104 | if (d->m_entryDate == QDate()) | 100 | if (d->m_entryDate == QDate()) | ||
Context not available. | |||||
110 | 106 | | |||
111 | MyMoneyTransaction::~MyMoneyTransaction() | 107 | MyMoneyTransaction::~MyMoneyTransaction() | ||
112 | { | 108 | { | ||
113 | Q_D(MyMoneyTransaction); | | |||
114 | delete d; | | |||
115 | } | 109 | } | ||
116 | 110 | | |||
117 | QDate MyMoneyTransaction::entryDate() const | 111 | QDate MyMoneyTransaction::entryDate() const | ||
Context not available. | |||||
435 | Q_D(const MyMoneyTransaction); | 429 | Q_D(const MyMoneyTransaction); | ||
436 | auto el = document.createElement(nodeNames[nnTransaction]); | 430 | auto el = document.createElement(nodeNames[nnTransaction]); | ||
437 | 431 | | |||
438 | writeBaseXML(document, el); | 432 | d->writeBaseXML(document, el); | ||
439 | el.setAttribute(d->getAttrName(Transaction::Attribute::PostDate), MyMoneyUtils::dateToString(d->m_postDate)); | 433 | el.setAttribute(d->getAttrName(Transaction::Attribute::PostDate), MyMoneyUtils::dateToString(d->m_postDate)); | ||
440 | el.setAttribute(d->getAttrName(Transaction::Attribute::Memo), d->m_memo); | 434 | el.setAttribute(d->getAttrName(Transaction::Attribute::Memo), d->m_memo); | ||
441 | el.setAttribute(d->getAttrName(Transaction::Attribute::EntryDate), MyMoneyUtils::dateToString(d->m_entryDate)); | 435 | el.setAttribute(d->getAttrName(Transaction::Attribute::EntryDate), MyMoneyUtils::dateToString(d->m_entryDate)); | ||
Context not available. | |||||
497 | 491 | | |||
498 | QString MyMoneyTransaction::uniqueSortKey() const | 492 | QString MyMoneyTransaction::uniqueSortKey() const | ||
499 | { | 493 | { | ||
494 | Q_D(const MyMoneyTransaction); | ||||
500 | QString year, month, day, key; | 495 | QString year, month, day, key; | ||
501 | const QDate& postdate = postDate(); | 496 | const auto postdate = postDate(); | ||
502 | year = year.setNum(postdate.year()).rightJustified(MyMoneyTransactionPrivate::YEAR_SIZE, '0'); | 497 | year = year.setNum(postdate.year()).rightJustified(MyMoneyTransactionPrivate::YEAR_SIZE, '0'); | ||
503 | month = month.setNum(postdate.month()).rightJustified(MyMoneyTransactionPrivate::MONTH_SIZE, '0'); | 498 | month = month.setNum(postdate.month()).rightJustified(MyMoneyTransactionPrivate::MONTH_SIZE, '0'); | ||
504 | day = day.setNum(postdate.day()).rightJustified(MyMoneyTransactionPrivate::DAY_SIZE, '0'); | 499 | day = day.setNum(postdate.day()).rightJustified(MyMoneyTransactionPrivate::DAY_SIZE, '0'); | ||
505 | key = QString(QLatin1String("%1-%2-%3-%4")).arg(year, month, day, m_id); | 500 | key = QString::fromLatin1("%1-%2-%3-%4").arg(year, month, day, d->m_id); | ||
506 | return key; | 501 | return key; | ||
507 | } | 502 | } | ||
508 | 503 | | |||
Context not available. |