Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneyschedule.cpp
Context not available. | |||||
48 | static IMyMoneyProcessingCalendar* processingCalendarPtr = 0; | 48 | static IMyMoneyProcessingCalendar* processingCalendarPtr = 0; | ||
---|---|---|---|---|---|
49 | 49 | | |||
50 | MyMoneySchedule::MyMoneySchedule() : | 50 | MyMoneySchedule::MyMoneySchedule() : | ||
51 | MyMoneyObject(), | 51 | MyMoneyObject(*new MyMoneySchedulePrivate) | ||
52 | d_ptr(new MyMoneySchedulePrivate) | | |||
53 | { | 52 | { | ||
54 | } | 53 | } | ||
55 | 54 | | |||
Context not available. | |||||
62 | const QDate& endDate, | 61 | const QDate& endDate, | ||
63 | bool fixed, | 62 | bool fixed, | ||
64 | bool autoEnter) : | 63 | bool autoEnter) : | ||
65 | MyMoneyObject(), | 64 | MyMoneyObject(*new MyMoneySchedulePrivate) | ||
66 | d_ptr(new MyMoneySchedulePrivate) | | |||
67 | { | 65 | { | ||
68 | Q_D(MyMoneySchedule); | 66 | Q_D(MyMoneySchedule); | ||
69 | // Set up the values possibly differeing from defaults | 67 | // Set up the values possibly differeing from defaults | ||
Context not available. | |||||
79 | } | 77 | } | ||
80 | 78 | | |||
81 | MyMoneySchedule::MyMoneySchedule(const QDomElement& node) : | 79 | MyMoneySchedule::MyMoneySchedule(const QDomElement& node) : | ||
82 | MyMoneyObject(node), | 80 | MyMoneyObject(*new MyMoneySchedulePrivate, node) | ||
83 | d_ptr(new MyMoneySchedulePrivate) | | |||
84 | { | 81 | { | ||
85 | if (nodeNames[nnScheduleTX] != node.tagName()) | 82 | if (nodeNames[nnScheduleTX] != node.tagName()) | ||
86 | throw MYMONEYEXCEPTION("Node was not SCHEDULED_TX"); | 83 | throw MYMONEYEXCEPTION("Node was not SCHEDULED_TX"); | ||
Context not available. | |||||
149 | } | 146 | } | ||
150 | 147 | | |||
151 | MyMoneySchedule::MyMoneySchedule(const MyMoneySchedule& other) : | 148 | MyMoneySchedule::MyMoneySchedule(const MyMoneySchedule& other) : | ||
152 | MyMoneyObject(other.id()), | 149 | MyMoneyObject(*new MyMoneySchedulePrivate(*other.d_func()), other.id()) | ||
153 | d_ptr(new MyMoneySchedulePrivate(*other.d_func())) | | |||
154 | { | 150 | { | ||
155 | } | 151 | } | ||
156 | 152 | | |||
157 | MyMoneySchedule::MyMoneySchedule(const QString& id, const MyMoneySchedule& other) : | 153 | MyMoneySchedule::MyMoneySchedule(const QString& id, const MyMoneySchedule& other) : | ||
158 | MyMoneyObject(id), | 154 | MyMoneyObject(*new MyMoneySchedulePrivate(*other.d_func()), id) | ||
159 | d_ptr(new MyMoneySchedulePrivate(*other.d_func())) | | |||
160 | { | 155 | { | ||
161 | } | 156 | } | ||
162 | 157 | | |||
163 | MyMoneySchedule::~MyMoneySchedule() | 158 | MyMoneySchedule::~MyMoneySchedule() | ||
164 | { | 159 | { | ||
165 | Q_D(MyMoneySchedule); | | |||
166 | delete d; | | |||
167 | } | 160 | } | ||
168 | 161 | | |||
169 | Schedule::Occurrence MyMoneySchedule::occurrence() const | 162 | Schedule::Occurrence MyMoneySchedule::occurrence() const | ||
Context not available. | |||||
453 | * m_transaction | 446 | * m_transaction | ||
454 | * the transaction must contain at least one split (two is better ;-) ) | 447 | * the transaction must contain at least one split (two is better ;-) ) | ||
455 | */ | 448 | */ | ||
456 | if (id_check && !m_id.isEmpty()) | 449 | Q_D(const MyMoneySchedule); | ||
450 | if (id_check && !d->m_id.isEmpty()) | ||||
457 | throw MYMONEYEXCEPTION("ID for schedule not empty when required"); | 451 | throw MYMONEYEXCEPTION("ID for schedule not empty when required"); | ||
458 | 452 | | |||
459 | Q_D(const MyMoneySchedule); | | |||
460 | if (d->m_occurrence == Schedule::Occurrence::Any) | 453 | if (d->m_occurrence == Schedule::Occurrence::Any) | ||
461 | throw MYMONEYEXCEPTION("Invalid occurrence type for schedule"); | 454 | throw MYMONEYEXCEPTION("Invalid occurrence type for schedule"); | ||
462 | 455 | | |||
Context not available. | |||||
943 | { | 936 | { | ||
944 | auto el = document.createElement(nodeNames[nnScheduleTX]); | 937 | auto el = document.createElement(nodeNames[nnScheduleTX]); | ||
945 | 938 | | |||
946 | writeBaseXML(document, el); | | |||
947 | | ||||
948 | Q_D(const MyMoneySchedule); | 939 | Q_D(const MyMoneySchedule); | ||
940 | d->writeBaseXML(document, el); | ||||
941 | | ||||
949 | el.setAttribute(d->getAttrName(Schedule::Attribute::Name), d->m_name); | 942 | el.setAttribute(d->getAttrName(Schedule::Attribute::Name), d->m_name); | ||
950 | el.setAttribute(d->getAttrName(Schedule::Attribute::Type), (int)d->m_type); | 943 | el.setAttribute(d->getAttrName(Schedule::Attribute::Type), (int)d->m_type); | ||
951 | el.setAttribute(d->getAttrName(Schedule::Attribute::Occurrence), (int)d->m_occurrence); | 944 | el.setAttribute(d->getAttrName(Schedule::Attribute::Occurrence), (int)d->m_occurrence); | ||
Context not available. |