Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneyfile.h
Context not available. | |||||
2 | mymoneyfile.h | 2 | mymoneyfile.h | ||
---|---|---|---|---|---|
3 | ------------------- | 3 | ------------------- | ||
4 | copyright : (C) 2002, 2007 by Thomas Baumgart <ipwizard@users.sourceforge.net> | 4 | copyright : (C) 2002, 2007 by Thomas Baumgart <ipwizard@users.sourceforge.net> | ||
5 | (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> | ||||
5 | 6 | | |||
6 | ***************************************************************************/ | 7 | ***************************************************************************/ | ||
7 | 8 | | |||
Context not available. | |||||
21 | // QT Includes | 22 | // QT Includes | ||
22 | 23 | | |||
23 | #include <QObject> | 24 | #include <QObject> | ||
24 | #include <QString> | | |||
25 | #include <QMap> | | |||
26 | #include <QStringList> | | |||
27 | 25 | | |||
28 | // ---------------------------------------------------------------------------- | 26 | // ---------------------------------------------------------------------------- | ||
29 | // Project Includes | 27 | // Project Includes | ||
30 | | ||||
31 | #include "mymoneyinstitution.h" | | |||
32 | #include "mymoneyaccount.h" | | |||
33 | #include "mymoneytransaction.h" | | |||
34 | #include "mymoneypayee.h" | | |||
35 | #include "mymoneytag.h" | | |||
36 | #include "mymoneysecurity.h" | | |||
37 | #include "mymoneyprice.h" | | |||
38 | #include "mymoneyreport.h" | | |||
39 | #include <mymoneybudget.h> | | |||
40 | #include <onlinejob.h> | | |||
41 | #include "mymoneyschedule.h" | | |||
42 | #include "kmm_mymoney_export.h" | 28 | #include "kmm_mymoney_export.h" | ||
43 | #include "mymoneyunittestable.h" | 29 | #include "mymoneyunittestable.h" | ||
30 | #include "mymoneyenums.h" | ||||
31 | | ||||
32 | using namespace eMyMoney; | ||||
44 | 33 | | |||
45 | /** | 34 | /** | ||
46 | * @author Thomas Baumgart, Michael Edwardes, Kevin Tambascio, Christian Dávid | 35 | * @author Thomas Baumgart, Michael Edwardes, Kevin Tambascio, Christian Dávid | ||
Context not available. | |||||
131 | * while the engine code is running. The MyMoneyException:: object | 120 | * while the engine code is running. The MyMoneyException:: object | ||
132 | * describes the problem. | 121 | * describes the problem. | ||
133 | */ | 122 | */ | ||
123 | template <class Key, class T> class QMap; | ||||
124 | class QString; | ||||
125 | class QStringList; | ||||
126 | class QBitArray; | ||||
134 | class IMyMoneyStorage; | 127 | class IMyMoneyStorage; | ||
135 | class MyMoneyCostCenter; | 128 | class MyMoneyCostCenter; | ||
136 | class QBitArray; | 129 | class MyMoneyAccount; | ||
130 | class MyMoneyInstitution; | ||||
131 | class MyMoneySecurity; | ||||
132 | class MyMoneyPrice; | ||||
133 | typedef QPair<QString, QString> MyMoneySecurityPair; | ||||
134 | typedef QMap<QDate, MyMoneyPrice> MyMoneyPriceEntries; | ||||
135 | typedef QMap<MyMoneySecurityPair, MyMoneyPriceEntries> MyMoneyPriceList; | ||||
136 | class MyMoneySchedule; | ||||
137 | class MyMoneyTag; | ||||
138 | class MyMoneyPayee; | ||||
139 | class MyMoneyBudget; | ||||
140 | class MyMoneyReport; | ||||
141 | class MyMoneyMoney; | ||||
142 | class MyMoneySplit; | ||||
143 | class MyMoneyObject; | ||||
144 | class MyMoneyTransaction; | ||||
145 | class MyMoneyTransactionFilter; | ||||
146 | class onlineJob; | ||||
137 | class KMM_MYMONEY_EXPORT MyMoneyFile : public QObject | 147 | class KMM_MYMONEY_EXPORT MyMoneyFile : public QObject | ||
138 | { | 148 | { | ||
139 | Q_OBJECT | 149 | Q_OBJECT | ||
140 | KMM_MYMONEY_UNIT_TESTABLE | 150 | KMM_MYMONEY_UNIT_TESTABLE | ||
141 | 151 | | |||
142 | public: | 152 | public: | ||
143 | /** | | |||
144 | * notificationObject identifies the type of the object | | |||
145 | * for which this notification is stored | | |||
146 | */ | | |||
147 | typedef enum { | | |||
148 | notifyAccount = 1, | | |||
149 | notifyInstitution, | | |||
150 | notifyPayee, | | |||
151 | notifyTransaction, | | |||
152 | notifyTag, | | |||
153 | notifySchedule, | | |||
154 | notifySecurity, | | |||
155 | notifyOnlineJob | | |||
156 | } notificationObjectT; | | |||
157 | | ||||
158 | /** | | |||
159 | * notificationMode identifies the type of notifiation | | |||
160 | * (add, modify, remove) | | |||
161 | */ | | |||
162 | typedef enum { | | |||
163 | notifyAdd = 1, | | |||
164 | notifyModify, | | |||
165 | notifyRemove | | |||
166 | } notificationModeT; | | |||
167 | | ||||
168 | friend class MyMoneyNotifier; | 153 | friend class MyMoneyNotifier; | ||
169 | 154 | | |||
170 | /** | 155 | /** | ||
Context not available. | |||||
625 | * @param date return balance for specific date (default = QDate()) | 610 | * @param date return balance for specific date (default = QDate()) | ||
626 | * @return balance of the account as MyMoneyMoney object | 611 | * @return balance of the account as MyMoneyMoney object | ||
627 | */ | 612 | */ | ||
628 | const MyMoneyMoney balance(const QString& id, const QDate& date = QDate()) const; | 613 | const MyMoneyMoney balance(const QString& id, const QDate& date) const; | ||
614 | const MyMoneyMoney balance(const QString& id) const; | ||||
629 | 615 | | |||
630 | /** | 616 | /** | ||
631 | * This method is used to return the cleared balance of an account | 617 | * This method is used to return the cleared balance of an account | ||
Context not available. | |||||
651 | * @param date return balance for specific date (default = QDate()) | 637 | * @param date return balance for specific date (default = QDate()) | ||
652 | * @return balance of the account as MyMoneyMoney object | 638 | * @return balance of the account as MyMoneyMoney object | ||
653 | */ | 639 | */ | ||
654 | const MyMoneyMoney totalBalance(const QString& id, const QDate& date = QDate()) const; | 640 | const MyMoneyMoney totalBalance(const QString& id, const QDate& date) const; | ||
641 | const MyMoneyMoney totalBalance(const QString& id) const; | ||||
655 | 642 | | |||
656 | /** | 643 | /** | ||
657 | * This method returns the number of transactions currently known to file | 644 | * This method returns the number of transactions currently known to file | ||
Context not available. | |||||
664 | * | 651 | * | ||
665 | * @return number of transactions in journal/account | 652 | * @return number of transactions in journal/account | ||
666 | */ | 653 | */ | ||
667 | unsigned int transactionCount(const QString& account = QString()) const; | 654 | unsigned int transactionCount(const QString& account) const; | ||
655 | unsigned int transactionCount() const; | ||||
668 | 656 | | |||
669 | /** | 657 | /** | ||
670 | * This method returns a QMap filled with the number of transactions | 658 | * This method returns a QMap filled with the number of transactions | ||
Context not available. | |||||
783 | * MyMoneyAccount::AccountSeperator. | 771 | * MyMoneyAccount::AccountSeperator. | ||
784 | * | 772 | * | ||
785 | * @param category const reference to QString containing the category | 773 | * @param category const reference to QString containing the category | ||
786 | * @param type account type if a specific type is required (defaults to UnknownAccountType) | 774 | * @param type account type if a specific type is required (defaults to Unknown) | ||
787 | * | 775 | * | ||
788 | * @return QString of the corresponding account. If account was not found | 776 | * @return QString of the corresponding account. If account was not found | ||
789 | * the return value will be an empty string. | 777 | * the return value will be an empty string. | ||
790 | */ | 778 | */ | ||
791 | QString categoryToAccount(const QString& category, MyMoneyAccount::accountTypeE type = MyMoneyAccount::UnknownAccountType) const; | 779 | QString categoryToAccount(const QString& category, eMyMoney::Account type = eMyMoney::Account::Unknown) const; | ||
792 | 780 | | |||
793 | /** | 781 | /** | ||
794 | * This method is used to convert a string representing an asset or | 782 | * This method is used to convert a string representing an asset or | ||
Context not available. | |||||
1030 | * account @p accountId. If accountId is the empty string, | 1018 | * account @p accountId. If accountId is the empty string, | ||
1031 | * this filter is off. Default is @p QString(). | 1019 | * this filter is off. Default is @p QString(). | ||
1032 | * @param type only schedules of type @p type are searched for. | 1020 | * @param type only schedules of type @p type are searched for. | ||
1033 | * See MyMoneySchedule::typeE for details. | 1021 | * See eMyMoney::Schedule::Type for details. | ||
1034 | * Default is MyMoneySchedule::TYPE_ANY | 1022 | * Default is eMyMoney::Schedule::Type::Any | ||
1035 | * @param occurrence only schedules of occurrence type @p occurrence are searched for. | 1023 | * @param occurrence only schedules of occurrence type @p occurrence are searched for. | ||
1036 | * See MyMoneySchedule::occurrenceE for details. | 1024 | * See eMyMoney::Schedule::Occurence for details. | ||
1037 | * Default is MyMoneySchedule::OCCUR_ANY | 1025 | * Default is eMyMoney::Schedule::Occurrence::Any | ||
1038 | * @param paymentType only schedules of payment method @p paymentType | 1026 | * @param paymentType only schedules of payment method @p paymentType | ||
1039 | * are searched for. | 1027 | * are searched for. | ||
1040 | * See MyMoneySchedule::paymentTypeE for details. | 1028 | * See eMyMoney::Schedule::PaymentType for details. | ||
1041 | * Default is MyMoneySchedule::STYPE_ANY | 1029 | * Default is eMyMoney::Schedule::PaymentType::Any | ||
1042 | * @param startDate only schedules with payment dates after @p startDate | 1030 | * @param startDate only schedules with payment dates after @p startDate | ||
1043 | * are searched for. Default is all dates (QDate()). | 1031 | * are searched for. Default is all dates (QDate()). | ||
1044 | * @param endDate only schedules with payment dates ending prior to @p endDate | 1032 | * @param endDate only schedules with payment dates ending prior to @p endDate | ||
Context not available. | |||||
1048 | * | 1036 | * | ||
1049 | * @return const QList<MyMoneySchedule> list of schedule objects. | 1037 | * @return const QList<MyMoneySchedule> list of schedule objects. | ||
1050 | */ | 1038 | */ | ||
1051 | const QList<MyMoneySchedule> scheduleList(const QString& accountId = QString(), | 1039 | const QList<MyMoneySchedule> scheduleList(const QString& accountId, | ||
1052 | const MyMoneySchedule::typeE type = MyMoneySchedule::TYPE_ANY, | 1040 | const eMyMoney::Schedule::Type type, | ||
1053 | const MyMoneySchedule::occurrenceE occurrence = MyMoneySchedule::OCCUR_ANY, | 1041 | const eMyMoney::Schedule::Occurrence occurrence, | ||
1054 | const MyMoneySchedule::paymentTypeE paymentType = MyMoneySchedule::STYPE_ANY, | 1042 | const eMyMoney::Schedule::PaymentType paymentType, | ||
1055 | const QDate& startDate = QDate(), | 1043 | const QDate& startDate, | ||
1056 | const QDate& endDate = QDate(), | 1044 | const QDate& endDate, | ||
1057 | const bool overdue = false) const; | 1045 | const bool overdue) const; | ||
1046 | const QList<MyMoneySchedule> scheduleList(const QString& accountId) const; | ||||
1047 | const QList<MyMoneySchedule> scheduleList() const; | ||||
1058 | 1048 | | |||
1059 | const QStringList consistencyCheck(); | 1049 | const QStringList consistencyCheck(); | ||
1060 | 1050 | | |||
Context not available. | |||||
1292 | * @return price found as MyMoneyPrice object | 1282 | * @return price found as MyMoneyPrice object | ||
1293 | * @note This throws an exception when the base currency is not set and toId is empty | 1283 | * @note This throws an exception when the base currency is not set and toId is empty | ||
1294 | */ | 1284 | */ | ||
1295 | MyMoneyPrice price(const QString& fromId, const QString& toId = QString(), const QDate& date = QDate::currentDate(), const bool exactDate = false) const; | 1285 | MyMoneyPrice price(const QString& fromId, const QString& toId, const QDate& date, const bool exactDate = false) const; | ||
1286 | MyMoneyPrice price(const QString& fromId, const QString& toId) const; | ||||
1287 | MyMoneyPrice price(const QString& fromId) const; | ||||
1296 | 1288 | | |||
1297 | /** | 1289 | /** | ||
1298 | * This method returns a list of all prices. | 1290 | * This method returns a list of all prices. | ||
Context not available. | |||||
1546 | * @param state @p state reconciliation state | 1538 | * @param state @p state reconciliation state | ||
1547 | * @return number of transactions with state @p state | 1539 | * @return number of transactions with state @p state | ||
1548 | */ | 1540 | */ | ||
1549 | int countTransactionsWithSpecificReconciliationState(const QString& accId, enum MyMoneyTransactionFilter::stateOptionE state) const; | 1541 | int countTransactionsWithSpecificReconciliationState(const QString& accId, TransactionFilter::State state) const; | ||
1550 | 1542 | | |||
1551 | /** | 1543 | /** | ||
1552 | * @brief Saves a new onlineJob | 1544 | * @brief Saves a new onlineJob | ||
Context not available. | |||||
1622 | * had been added. The data for the new object is contained in | 1614 | * had been added. The data for the new object is contained in | ||
1623 | * @a obj. | 1615 | * @a obj. | ||
1624 | */ | 1616 | */ | ||
1625 | void objectAdded(MyMoneyFile::notificationObjectT objType, const MyMoneyObject * const obj); | 1617 | void objectAdded(eMyMoney::File::Object objType, const MyMoneyObject * const obj); | ||
1626 | 1618 | | |||
1627 | /** | 1619 | /** | ||
1628 | * This signal is emitted by the engine whenever an object | 1620 | * This signal is emitted by the engine whenever an object | ||
Context not available. | |||||
1633 | * method anymore as the object is already deleted in the storage | 1625 | * method anymore as the object is already deleted in the storage | ||
1634 | * when the signal is emitted. | 1626 | * when the signal is emitted. | ||
1635 | */ | 1627 | */ | ||
1636 | void objectRemoved(MyMoneyFile::notificationObjectT objType, const QString& id); | 1628 | void objectRemoved(eMyMoney::File::Object objType, const QString& id); | ||
1637 | 1629 | | |||
1638 | /** | 1630 | /** | ||
1639 | * This signal is emitted by the engine whenever an object | 1631 | * This signal is emitted by the engine whenever an object | ||
1640 | * had been changed. The new state of the object is contained | 1632 | * had been changed. The new state of the object is contained | ||
1641 | * in @a obj. | 1633 | * in @a obj. | ||
1642 | */ | 1634 | */ | ||
1643 | void objectModified(MyMoneyFile::notificationObjectT objType, const MyMoneyObject * const obj); | 1635 | void objectModified(eMyMoney::File::Object objType, const MyMoneyObject * const obj); | ||
1644 | 1636 | | |||
1645 | /** | 1637 | /** | ||
1646 | * This signal is emitted by the engine whenever the balance | 1638 | * This signal is emitted by the engine whenever the balance | ||
Context not available. |