Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneyfile.cpp
Context not available. | |||||
3 | ------------------- | 3 | ------------------- | ||
---|---|---|---|---|---|
4 | copyright : (C) 2000 by Michael Edwardes <mte@users.sourceforge.net> | 4 | copyright : (C) 2000 by Michael Edwardes <mte@users.sourceforge.net> | ||
5 | (C) 2002, 2007-2011 by Thomas Baumgart <ipwizard@users.sourceforge.net> | 5 | (C) 2002, 2007-2011 by Thomas Baumgart <ipwizard@users.sourceforge.net> | ||
6 | (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> | ||||
6 | 7 | | |||
7 | ***************************************************************************/ | 8 | ***************************************************************************/ | ||
8 | 9 | | |||
Context not available. | |||||
37 | // Project Includes | 38 | // Project Includes | ||
38 | #include "imymoneystorage.h" | 39 | #include "imymoneystorage.h" | ||
39 | #include "mymoneyaccount.h" | 40 | #include "mymoneyaccount.h" | ||
41 | #include "mymoneysecurity.h" | ||||
40 | #include "mymoneyreport.h" | 42 | #include "mymoneyreport.h" | ||
41 | #include "mymoneybalancecache.h" | 43 | #include "mymoneybalancecache.h" | ||
42 | #include "mymoneybudget.h" | 44 | #include "mymoneybudget.h" | ||
Context not available. | |||||
49 | // include the following line to get a 'cout' for debug purposes | 51 | // include the following line to get a 'cout' for debug purposes | ||
50 | // #include <iostream> | 52 | // #include <iostream> | ||
51 | 53 | | |||
54 | using namespace eMyMoney; | ||||
55 | | ||||
52 | const QString MyMoneyFile::AccountSeperator = QChar(':'); | 56 | const QString MyMoneyFile::AccountSeperator = QChar(':'); | ||
53 | 57 | | |||
54 | MyMoneyFile MyMoneyFile::file; | 58 | MyMoneyFile MyMoneyFile::file; | ||
Context not available. | |||||
60 | class MyMoneyNotification | 64 | class MyMoneyNotification | ||
61 | { | 65 | { | ||
62 | public: | 66 | public: | ||
63 | MyMoneyNotification(MyMoneyFile::notificationModeT mode, const MyMoneyTransaction& t) : | 67 | MyMoneyNotification(File::Mode mode, const MyMoneyTransaction& t) : | ||
64 | m_objType(MyMoneyFile::notifyTransaction), | 68 | m_objType(File::Object::Transaction), | ||
65 | m_notificationMode(mode), | 69 | m_notificationMode(mode), | ||
66 | m_id(t.id()) { | 70 | m_id(t.id()) { | ||
67 | } | 71 | } | ||
68 | 72 | | |||
69 | MyMoneyNotification(MyMoneyFile::notificationModeT mode, const MyMoneyAccount& acc) : | 73 | MyMoneyNotification(File::Mode mode, const MyMoneyAccount& acc) : | ||
70 | m_objType(MyMoneyFile::notifyAccount), | 74 | m_objType(File::Object::Account), | ||
71 | m_notificationMode(mode), | 75 | m_notificationMode(mode), | ||
72 | m_id(acc.id()) { | 76 | m_id(acc.id()) { | ||
73 | } | 77 | } | ||
74 | 78 | | |||
75 | MyMoneyNotification(MyMoneyFile::notificationModeT mode, const MyMoneyInstitution& institution) : | 79 | MyMoneyNotification(File::Mode mode, const MyMoneyInstitution& institution) : | ||
76 | m_objType(MyMoneyFile::notifyInstitution), | 80 | m_objType(File::Object::Institution), | ||
77 | m_notificationMode(mode), | 81 | m_notificationMode(mode), | ||
78 | m_id(institution.id()) { | 82 | m_id(institution.id()) { | ||
79 | } | 83 | } | ||
80 | 84 | | |||
81 | MyMoneyNotification(MyMoneyFile::notificationModeT mode, const MyMoneyPayee& payee) : | 85 | MyMoneyNotification(File::Mode mode, const MyMoneyPayee& payee) : | ||
82 | m_objType(MyMoneyFile::notifyPayee), | 86 | m_objType(File::Object::Payee), | ||
83 | m_notificationMode(mode), | 87 | m_notificationMode(mode), | ||
84 | m_id(payee.id()) { | 88 | m_id(payee.id()) { | ||
85 | } | 89 | } | ||
86 | 90 | | |||
87 | MyMoneyNotification(MyMoneyFile::notificationModeT mode, const MyMoneyTag& tag) : | 91 | MyMoneyNotification(File::Mode mode, const MyMoneyTag& tag) : | ||
88 | m_objType(MyMoneyFile::notifyTag), | 92 | m_objType(File::Object::Tag), | ||
89 | m_notificationMode(mode), | 93 | m_notificationMode(mode), | ||
90 | m_id(tag.id()) { | 94 | m_id(tag.id()) { | ||
91 | } | 95 | } | ||
92 | 96 | | |||
93 | MyMoneyNotification(MyMoneyFile::notificationModeT mode, const MyMoneySchedule& schedule) : | 97 | MyMoneyNotification(File::Mode mode, const MyMoneySchedule& schedule) : | ||
94 | m_objType(MyMoneyFile::notifySchedule), | 98 | m_objType(File::Object::Schedule), | ||
95 | m_notificationMode(mode), | 99 | m_notificationMode(mode), | ||
96 | m_id(schedule.id()) { | 100 | m_id(schedule.id()) { | ||
97 | } | 101 | } | ||
98 | 102 | | |||
99 | MyMoneyNotification(MyMoneyFile::notificationModeT mode, const MyMoneySecurity& security) : | 103 | MyMoneyNotification(File::Mode mode, const MyMoneySecurity& security) : | ||
100 | m_objType(MyMoneyFile::notifySecurity), | 104 | m_objType(File::Object::Security), | ||
101 | m_notificationMode(mode), | 105 | m_notificationMode(mode), | ||
102 | m_id(security.id()) { | 106 | m_id(security.id()) { | ||
103 | } | 107 | } | ||
104 | 108 | | |||
105 | MyMoneyNotification(MyMoneyFile::notificationModeT mode, const onlineJob& job) : | 109 | MyMoneyNotification(File::Mode mode, const onlineJob& job) : | ||
106 | m_objType(MyMoneyFile::notifyOnlineJob), | 110 | m_objType(File::Object::OnlineJob), | ||
107 | m_notificationMode(mode), | 111 | m_notificationMode(mode), | ||
108 | m_id(job.id()) { | 112 | m_id(job.id()) { | ||
109 | } | 113 | } | ||
110 | 114 | | |||
111 | MyMoneyFile::notificationObjectT objectType() const { | 115 | File::Object objectType() const { | ||
112 | return m_objType; | 116 | return m_objType; | ||
113 | } | 117 | } | ||
114 | MyMoneyFile::notificationModeT notificationMode() const { | 118 | File::Mode notificationMode() const { | ||
115 | return m_notificationMode; | 119 | return m_notificationMode; | ||
116 | } | 120 | } | ||
117 | const QString& id() const { | 121 | const QString& id() const { | ||
Context not available. | |||||
119 | } | 123 | } | ||
120 | 124 | | |||
121 | protected: | 125 | protected: | ||
122 | MyMoneyNotification(MyMoneyFile::notificationObjectT obj, | 126 | MyMoneyNotification(File::Object obj, | ||
123 | MyMoneyFile::notificationModeT mode, | 127 | File::Mode mode, | ||
124 | const QString& id) : | 128 | const QString& id) : | ||
125 | m_objType(obj), | 129 | m_objType(obj), | ||
126 | m_notificationMode(mode), | 130 | m_notificationMode(mode), | ||
127 | m_id(id) {} | 131 | m_id(id) {} | ||
128 | 132 | | |||
129 | private: | 133 | private: | ||
130 | MyMoneyFile::notificationObjectT m_objType; | 134 | File::Object m_objType; | ||
131 | MyMoneyFile::notificationModeT m_notificationMode; | 135 | File::Mode m_notificationMode; | ||
132 | QString m_id; | 136 | QString m_id; | ||
133 | }; | 137 | }; | ||
134 | 138 | | |||
Context not available. | |||||
408 | // signals about addition, modification and removal of engine objects | 412 | // signals about addition, modification and removal of engine objects | ||
409 | QList<MyMoneyNotification>::const_iterator it = d->m_changeSet.constBegin(); | 413 | QList<MyMoneyNotification>::const_iterator it = d->m_changeSet.constBegin(); | ||
410 | while (it != d->m_changeSet.constEnd()) { | 414 | while (it != d->m_changeSet.constEnd()) { | ||
411 | if ((*it).notificationMode() == notifyRemove) { | 415 | if ((*it).notificationMode() == File::Mode::Remove) { | ||
412 | emit objectRemoved((*it).objectType(), (*it).id()); | 416 | emit objectRemoved((*it).objectType(), (*it).id()); | ||
413 | // if there is a balance change recorded for this account remove it since the account itself will be removed | 417 | // if there is a balance change recorded for this account remove it since the account itself will be removed | ||
414 | // this can happen when deleting categories that have transactions and the reassign category feature was used | 418 | // this can happen when deleting categories that have transactions and the reassign category feature was used | ||
Context not available. | |||||
418 | MyMoneyTransaction tr; | 422 | MyMoneyTransaction tr; | ||
419 | 423 | | |||
420 | switch((*it).objectType()) { | 424 | switch((*it).objectType()) { | ||
421 | case MyMoneyFile::notifyTransaction: | 425 | case File::Object::Transaction: | ||
422 | tr = transaction((*it).id()); | 426 | tr = transaction((*it).id()); | ||
423 | obj = &tr; | 427 | obj = &tr; | ||
424 | break; | 428 | break; | ||
Context not available. | |||||
428 | break; | 432 | break; | ||
429 | } | 433 | } | ||
430 | if (obj) { | 434 | if (obj) { | ||
431 | if ((*it).notificationMode() == notifyAdd) { | 435 | if ((*it).notificationMode() == File::Mode::Add) { | ||
432 | emit objectAdded((*it).objectType(), obj); | 436 | emit objectAdded((*it).objectType(), obj); | ||
433 | 437 | | |||
434 | } else { | 438 | } else { | ||
Context not available. | |||||
503 | // load new objects. So we simply force loading of the new one here | 507 | // load new objects. So we simply force loading of the new one here | ||
504 | d->m_cache.preloadInstitution(institution); | 508 | d->m_cache.preloadInstitution(institution); | ||
505 | 509 | | |||
506 | d->m_changeSet += MyMoneyNotification(notifyAdd, institution); | 510 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, institution); | ||
507 | } | 511 | } | ||
508 | 512 | | |||
509 | void MyMoneyFile::modifyInstitution(const MyMoneyInstitution& institution) | 513 | void MyMoneyFile::modifyInstitution(const MyMoneyInstitution& institution) | ||
Context not available. | |||||
516 | d->m_storage->modifyInstitution(institution); | 520 | d->m_storage->modifyInstitution(institution); | ||
517 | 521 | | |||
518 | d->addCacheNotification(institution.id()); | 522 | d->addCacheNotification(institution.id()); | ||
519 | d->m_changeSet += MyMoneyNotification(notifyModify, institution); | 523 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, institution); | ||
520 | } | 524 | } | ||
521 | 525 | | |||
522 | void MyMoneyFile::modifyTransaction(const MyMoneyTransaction& transaction) | 526 | void MyMoneyFile::modifyTransaction(const MyMoneyTransaction& transaction) | ||
Context not available. | |||||
584 | //FIXME-ALEX Do I need to add d->addCacheNotification((*it_s).tagList()); ?? | 588 | //FIXME-ALEX Do I need to add d->addCacheNotification((*it_s).tagList()); ?? | ||
585 | } | 589 | } | ||
586 | 590 | | |||
587 | d->m_changeSet += MyMoneyNotification(notifyModify, transaction); | 591 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, transaction); | ||
588 | } | 592 | } | ||
589 | 593 | | |||
590 | void MyMoneyFile::modifyAccount(const MyMoneyAccount& _account) | 594 | void MyMoneyFile::modifyAccount(const MyMoneyAccount& _account) | ||
Context not available. | |||||
639 | d->m_storage->modifyAccount(account); | 643 | d->m_storage->modifyAccount(account); | ||
640 | 644 | | |||
641 | d->addCacheNotification(account.id()); | 645 | d->addCacheNotification(account.id()); | ||
642 | d->m_changeSet += MyMoneyNotification(notifyModify, account); | 646 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, account); | ||
643 | } | 647 | } | ||
644 | 648 | | |||
645 | void MyMoneyFile::reparentAccount(MyMoneyAccount &acc, MyMoneyAccount& parent) | 649 | void MyMoneyFile::reparentAccount(MyMoneyAccount &acc, MyMoneyAccount& parent) | ||
Context not available. | |||||
651 | throw MYMONEYEXCEPTION("Unable to reparent the standard account groups"); | 655 | throw MYMONEYEXCEPTION("Unable to reparent the standard account groups"); | ||
652 | 656 | | |||
653 | if (acc.accountGroup() == parent.accountGroup() | 657 | if (acc.accountGroup() == parent.accountGroup() | ||
654 | || (acc.accountType() == MyMoneyAccount::Income && parent.accountType() == MyMoneyAccount::Expense) | 658 | || (acc.accountType() == Account::Income && parent.accountType() == Account::Expense) | ||
655 | || (acc.accountType() == MyMoneyAccount::Expense && parent.accountType() == MyMoneyAccount::Income)) { | 659 | || (acc.accountType() == Account::Expense && parent.accountType() == Account::Income)) { | ||
656 | 660 | | |||
657 | if (acc.isInvest() && parent.accountType() != MyMoneyAccount::Investment) | 661 | if (acc.isInvest() && parent.accountType() != Account::Investment) | ||
658 | throw MYMONEYEXCEPTION("Unable to reparent Stock to non-investment account"); | 662 | throw MYMONEYEXCEPTION("Unable to reparent Stock to non-investment account"); | ||
659 | 663 | | |||
660 | if (parent.accountType() == MyMoneyAccount::Investment && !acc.isInvest()) | 664 | if (parent.accountType() == Account::Investment && !acc.isInvest()) | ||
661 | throw MYMONEYEXCEPTION("Unable to reparent non-stock to investment account"); | 665 | throw MYMONEYEXCEPTION("Unable to reparent non-stock to investment account"); | ||
662 | 666 | | |||
663 | // clear all changed objects from cache | 667 | // clear all changed objects from cache | ||
Context not available. | |||||
674 | d->addCacheNotification(acc.id()); | 678 | d->addCacheNotification(acc.id()); | ||
675 | d->addCacheNotification(parent.id()); | 679 | d->addCacheNotification(parent.id()); | ||
676 | 680 | | |||
677 | d->m_changeSet += MyMoneyNotification(notifyModify, curParent); | 681 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, curParent); | ||
678 | d->m_changeSet += MyMoneyNotification(notifyModify, parent); | 682 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, parent); | ||
679 | d->m_changeSet += MyMoneyNotification(notifyModify, acc); | 683 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | ||
680 | 684 | | |||
681 | } else | 685 | } else | ||
682 | throw MYMONEYEXCEPTION("Unable to reparent to different account type"); | 686 | throw MYMONEYEXCEPTION("Unable to reparent to different account type"); | ||
Context not available. | |||||
743 | } | 747 | } | ||
744 | } | 748 | } | ||
745 | 749 | | |||
746 | d->m_changeSet += MyMoneyNotification(notifyRemove, transaction); | 750 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, transaction); | ||
747 | } | 751 | } | ||
748 | 752 | | |||
749 | 753 | | |||
Context not available. | |||||
771 | d->m_storage->setAccountName(id, name); | 775 | d->m_storage->setAccountName(id, name); | ||
772 | d->addCacheNotification(id); | 776 | d->addCacheNotification(id); | ||
773 | 777 | | |||
774 | d->m_changeSet += MyMoneyNotification(notifyModify, acc); | 778 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | ||
775 | } | 779 | } | ||
776 | 780 | | |||
777 | void MyMoneyFile::removeAccount(const MyMoneyAccount& account) | 781 | void MyMoneyFile::removeAccount(const MyMoneyAccount& account) | ||
Context not available. | |||||
804 | foreach (const QString& id, acc.accountList()) { | 808 | foreach (const QString& id, acc.accountList()) { | ||
805 | d->addCacheNotification(id); | 809 | d->addCacheNotification(id); | ||
806 | const MyMoneyAccount& acc = MyMoneyFile::account(id); | 810 | const MyMoneyAccount& acc = MyMoneyFile::account(id); | ||
807 | d->m_changeSet += MyMoneyNotification(notifyModify, acc); | 811 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | ||
808 | } | 812 | } | ||
809 | // don't forget the parent and a possible institution | 813 | // don't forget the parent and a possible institution | ||
810 | d->addCacheNotification(parent.id()); | 814 | d->addCacheNotification(parent.id()); | ||
Context not available. | |||||
813 | if (!institution.id().isEmpty()) { | 817 | if (!institution.id().isEmpty()) { | ||
814 | institution.removeAccountId(account.id()); | 818 | institution.removeAccountId(account.id()); | ||
815 | d->m_storage->modifyInstitution(institution); | 819 | d->m_storage->modifyInstitution(institution); | ||
816 | d->m_changeSet += MyMoneyNotification(notifyModify, institution); | 820 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, institution); | ||
817 | } | 821 | } | ||
818 | acc.setInstitutionId(QString()); | 822 | acc.setInstitutionId(QString()); | ||
819 | 823 | | |||
Context not available. | |||||
823 | d->m_cache.clear(acc.id()); | 827 | d->m_cache.clear(acc.id()); | ||
824 | d->m_balanceCache.clear(acc.id()); | 828 | d->m_balanceCache.clear(acc.id()); | ||
825 | 829 | | |||
826 | d->m_changeSet += MyMoneyNotification(notifyModify, parent); | 830 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, parent); | ||
827 | d->m_changeSet += MyMoneyNotification(notifyRemove, acc); | 831 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, acc); | ||
828 | } | 832 | } | ||
829 | 833 | | |||
830 | void MyMoneyFile::removeAccountList(const QStringList& account_list, unsigned int level) | 834 | void MyMoneyFile::removeAccountList(const QStringList& account_list, unsigned int level) | ||
Context not available. | |||||
893 | MyMoneyAccount acc = account(*it_a); | 897 | MyMoneyAccount acc = account(*it_a); | ||
894 | acc.setInstitutionId(QString()); | 898 | acc.setInstitutionId(QString()); | ||
895 | modifyAccount(acc); | 899 | modifyAccount(acc); | ||
896 | d->m_changeSet += MyMoneyNotification(notifyModify, acc); | 900 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | ||
897 | } | 901 | } | ||
898 | blockSignals(blocked); | 902 | blockSignals(blocked); | ||
899 | 903 | | |||
900 | d->m_storage->removeInstitution(institution); | 904 | d->m_storage->removeInstitution(institution); | ||
901 | 905 | | |||
902 | d->m_changeSet += MyMoneyNotification(notifyRemove, institution); | 906 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, institution); | ||
903 | 907 | | |||
904 | d->addCacheNotification(institution.id(), false); | 908 | d->addCacheNotification(institution.id(), false); | ||
905 | } | 909 | } | ||
Context not available. | |||||
935 | addAccount(newAccount, parentAccount); | 939 | addAccount(newAccount, parentAccount); | ||
936 | 940 | | |||
937 | // in case of a loan account, we add the initial payment | 941 | // in case of a loan account, we add the initial payment | ||
938 | if ((newAccount.accountType() == MyMoneyAccount::Loan | 942 | if ((newAccount.accountType() == Account::Loan | ||
939 | || newAccount.accountType() == MyMoneyAccount::AssetLoan) | 943 | || newAccount.accountType() == Account::AssetLoan) | ||
940 | && !newAccount.value("kmm-loan-payment-acc").isEmpty() | 944 | && !newAccount.value("kmm-loan-payment-acc").isEmpty() | ||
941 | && !newAccount.value("kmm-loan-payment-date").isEmpty()) { | 945 | && !newAccount.value("kmm-loan-payment-date").isEmpty()) { | ||
942 | MyMoneyAccountLoan acc(newAccount); | 946 | MyMoneyAccountLoan acc(newAccount); | ||
Context not available. | |||||
945 | a.setAccountId(acc.id()); | 949 | a.setAccountId(acc.id()); | ||
946 | b.setAccountId(acc.value("kmm-loan-payment-acc").toLatin1()); | 950 | b.setAccountId(acc.value("kmm-loan-payment-acc").toLatin1()); | ||
947 | a.setValue(acc.loanAmount()); | 951 | a.setValue(acc.loanAmount()); | ||
948 | if (acc.accountType() == MyMoneyAccount::Loan) | 952 | if (acc.accountType() == Account::Loan) | ||
949 | a.setValue(-a.value()); | 953 | a.setValue(-a.value()); | ||
950 | 954 | | |||
951 | a.setShares(a.value()); | 955 | a.setShares(a.value()); | ||
Context not available. | |||||
965 | 969 | | |||
966 | // in case of an investment account we check if we should create | 970 | // in case of an investment account we check if we should create | ||
967 | // a brokerage account | 971 | // a brokerage account | ||
968 | } else if (newAccount.accountType() == MyMoneyAccount::Investment | 972 | } else if (newAccount.accountType() == Account::Investment | ||
969 | && !brokerageAccount.name().isEmpty()) { | 973 | && !brokerageAccount.name().isEmpty()) { | ||
970 | addAccount(brokerageAccount, parentAccount); | 974 | addAccount(brokerageAccount, parentAccount); | ||
971 | 975 | | |||
Context not available. | |||||
1006 | if (!account.parentAccountId().isEmpty()) | 1010 | if (!account.parentAccountId().isEmpty()) | ||
1007 | throw MYMONEYEXCEPTION("New account must have no parent-id"); | 1011 | throw MYMONEYEXCEPTION("New account must have no parent-id"); | ||
1008 | 1012 | | |||
1009 | if (account.accountType() == MyMoneyAccount::UnknownAccountType) | 1013 | if (account.accountType() == Account::Unknown) | ||
1010 | throw MYMONEYEXCEPTION("Account has invalid type"); | 1014 | throw MYMONEYEXCEPTION("Account has invalid type"); | ||
1011 | 1015 | | |||
1012 | // make sure, that the parent account exists | 1016 | // make sure, that the parent account exists | ||
Context not available. | |||||
1042 | if (parent.isInvest()) | 1046 | if (parent.isInvest()) | ||
1043 | throw MYMONEYEXCEPTION("Stock account cannot be parent account"); | 1047 | throw MYMONEYEXCEPTION("Stock account cannot be parent account"); | ||
1044 | 1048 | | |||
1045 | if (account.isInvest() && parent.accountType() != MyMoneyAccount::Investment) | 1049 | if (account.isInvest() && parent.accountType() != Account::Investment) | ||
1046 | throw MYMONEYEXCEPTION("Stock account must have investment account as parent "); | 1050 | throw MYMONEYEXCEPTION("Stock account must have investment account as parent "); | ||
1047 | 1051 | | |||
1048 | if (!account.isInvest() && parent.accountType() == MyMoneyAccount::Investment) | 1052 | if (!account.isInvest() && parent.accountType() == Account::Investment) | ||
1049 | throw MYMONEYEXCEPTION("Investment account can only have stock accounts as children"); | 1053 | throw MYMONEYEXCEPTION("Investment account can only have stock accounts as children"); | ||
1050 | 1054 | | |||
1051 | // clear all changed objects from cache | 1055 | // clear all changed objects from cache | ||
Context not available. | |||||
1078 | account.setParentAccountId(parent.id()); | 1082 | account.setParentAccountId(parent.id()); | ||
1079 | 1083 | | |||
1080 | d->m_storage->addAccount(account); | 1084 | d->m_storage->addAccount(account); | ||
1081 | d->m_changeSet += MyMoneyNotification(notifyAdd, account); | 1085 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, account); | ||
1082 | 1086 | | |||
1083 | d->m_storage->addAccount(parent, account); | 1087 | d->m_storage->addAccount(parent, account); | ||
1084 | d->m_changeSet += MyMoneyNotification(notifyModify, parent); | 1088 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, parent); | ||
1085 | 1089 | | |||
1086 | if (account.institutionId().length() != 0) { | 1090 | if (account.institutionId().length() != 0) { | ||
1087 | institution.addAccountId(account.id()); | 1091 | institution.addAccountId(account.id()); | ||
1088 | d->m_storage->modifyInstitution(institution); | 1092 | d->m_storage->modifyInstitution(institution); | ||
1089 | d->m_changeSet += MyMoneyNotification(notifyModify, institution); | 1093 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, institution); | ||
1090 | d->addCacheNotification(institution.id()); | 1094 | d->addCacheNotification(institution.id()); | ||
1091 | } | 1095 | } | ||
1092 | 1096 | | |||
Context not available. | |||||
1263 | name += QString(" (%1)").arg(security.id()); | 1267 | name += QString(" (%1)").arg(security.id()); | ||
1264 | } | 1268 | } | ||
1265 | acc.setName(name); | 1269 | acc.setName(name); | ||
1266 | acc.setAccountType(MyMoneyAccount::Equity); | 1270 | acc.setAccountType(Account::Equity); | ||
1267 | acc.setCurrencyId(security.id()); | 1271 | acc.setCurrencyId(security.id()); | ||
1268 | acc.setValue("OpeningBalanceAccount", "Yes"); | 1272 | acc.setValue("OpeningBalanceAccount", "Yes"); | ||
1269 | 1273 | | |||
Context not available. | |||||
1341 | //FIXME-ALEX Do I need to add d->addCacheNotification((*it_s).tagList()); ?? | 1345 | //FIXME-ALEX Do I need to add d->addCacheNotification((*it_s).tagList()); ?? | ||
1342 | } | 1346 | } | ||
1343 | 1347 | | |||
1344 | d->m_changeSet += MyMoneyNotification(notifyAdd, transaction); | 1348 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, transaction); | ||
1345 | } | 1349 | } | ||
1346 | 1350 | | |||
1347 | const MyMoneyTransaction MyMoneyFile::transaction(const QString& id) const | 1351 | const MyMoneyTransaction MyMoneyFile::transaction(const QString& id) const | ||
Context not available. | |||||
1371 | // load new objects. So we simply force loading of the new one here | 1375 | // load new objects. So we simply force loading of the new one here | ||
1372 | d->m_cache.preloadPayee(payee); | 1376 | d->m_cache.preloadPayee(payee); | ||
1373 | 1377 | | |||
1374 | d->m_changeSet += MyMoneyNotification(notifyAdd, payee); | 1378 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, payee); | ||
1375 | } | 1379 | } | ||
1376 | 1380 | | |||
1377 | const MyMoneyPayee& MyMoneyFile::payee(const QString& id) const | 1381 | const MyMoneyPayee& MyMoneyFile::payee(const QString& id) const | ||
Context not available. | |||||
1397 | 1401 | | |||
1398 | d->m_storage->modifyPayee(payee); | 1402 | d->m_storage->modifyPayee(payee); | ||
1399 | 1403 | | |||
1400 | d->m_changeSet += MyMoneyNotification(notifyModify, payee); | 1404 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, payee); | ||
1401 | } | 1405 | } | ||
1402 | 1406 | | |||
1403 | void MyMoneyFile::removePayee(const MyMoneyPayee& payee) | 1407 | void MyMoneyFile::removePayee(const MyMoneyPayee& payee) | ||
Context not available. | |||||
1413 | 1417 | | |||
1414 | d->addCacheNotification(payee.id(), false); | 1418 | d->addCacheNotification(payee.id(), false); | ||
1415 | 1419 | | |||
1416 | d->m_changeSet += MyMoneyNotification(notifyRemove, payee); | 1420 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, payee); | ||
1417 | } | 1421 | } | ||
1418 | 1422 | | |||
1419 | void MyMoneyFile::addTag(MyMoneyTag& tag) | 1423 | void MyMoneyFile::addTag(MyMoneyTag& tag) | ||
Context not available. | |||||
1429 | // load new objects. So we simply force loading of the new one here | 1433 | // load new objects. So we simply force loading of the new one here | ||
1430 | d->m_cache.preloadTag(tag); | 1434 | d->m_cache.preloadTag(tag); | ||
1431 | 1435 | | |||
1432 | d->m_changeSet += MyMoneyNotification(notifyAdd, tag); | 1436 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, tag); | ||
1433 | } | 1437 | } | ||
1434 | 1438 | | |||
1435 | const MyMoneyTag& MyMoneyFile::tag(const QString& id) const | 1439 | const MyMoneyTag& MyMoneyFile::tag(const QString& id) const | ||
Context not available. | |||||
1455 | 1459 | | |||
1456 | d->m_storage->modifyTag(tag); | 1460 | d->m_storage->modifyTag(tag); | ||
1457 | 1461 | | |||
1458 | d->m_changeSet += MyMoneyNotification(notifyModify, tag); | 1462 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, tag); | ||
1459 | } | 1463 | } | ||
1460 | 1464 | | |||
1461 | void MyMoneyFile::removeTag(const MyMoneyTag& tag) | 1465 | void MyMoneyFile::removeTag(const MyMoneyTag& tag) | ||
Context not available. | |||||
1471 | 1475 | | |||
1472 | d->addCacheNotification(tag.id(), false); | 1476 | d->addCacheNotification(tag.id(), false); | ||
1473 | 1477 | | |||
1474 | d->m_changeSet += MyMoneyNotification(notifyRemove, tag); | 1478 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, tag); | ||
1475 | } | 1479 | } | ||
1476 | 1480 | | |||
1477 | void MyMoneyFile::accountList(QList<MyMoneyAccount>& list, const QStringList& idlist, const bool recursive) const | 1481 | void MyMoneyFile::accountList(QList<MyMoneyAccount>& list, const QStringList& idlist, const bool recursive) const | ||
Context not available. | |||||
1615 | 1619 | | |||
1616 | return d->m_storage->transactionCount(account); | 1620 | return d->m_storage->transactionCount(account); | ||
1617 | } | 1621 | } | ||
1622 | unsigned int MyMoneyFile::transactionCount() const | ||||
1623 | { | ||||
1624 | return transactionCount(QString()); | ||||
1625 | } | ||||
1618 | 1626 | | |||
1619 | const QMap<QString, unsigned long> MyMoneyFile::transactionCountMap() const | 1627 | const QMap<QString, unsigned long> MyMoneyFile::transactionCountMap() const | ||
1620 | { | 1628 | { | ||
Context not available. | |||||
1648 | 1656 | | |||
1649 | return returnValue; | 1657 | return returnValue; | ||
1650 | } | 1658 | } | ||
1659 | const MyMoneyMoney MyMoneyFile::balance(const QString& id) const | ||||
1660 | { | ||||
1661 | return balance(id, QDate()); | ||||
1662 | } | ||||
1651 | 1663 | | |||
1652 | const MyMoneyMoney MyMoneyFile::clearedBalance(const QString &id, const QDate& date) const | 1664 | const MyMoneyMoney MyMoneyFile::clearedBalance(const QString &id, const QDate& date) const | ||
1653 | { | 1665 | { | ||
Context not available. | |||||
1658 | 1670 | | |||
1659 | MyMoneyAccount account = this->account(id); | 1671 | MyMoneyAccount account = this->account(id); | ||
1660 | MyMoneyMoney factor(1, 1); | 1672 | MyMoneyMoney factor(1, 1); | ||
1661 | if (account.accountGroup() == MyMoneyAccount::Liability || account.accountGroup() == MyMoneyAccount::Equity) | 1673 | if (account.accountGroup() == Account::Liability || account.accountGroup() == Account::Equity) | ||
1662 | factor = -factor; | 1674 | factor = -factor; | ||
1663 | 1675 | | |||
1664 | MyMoneyTransactionFilter filter; | 1676 | MyMoneyTransactionFilter filter; | ||
1665 | filter.addAccount(id); | 1677 | filter.addAccount(id); | ||
1666 | filter.setDateFilter(QDate(), date); | 1678 | filter.setDateFilter(QDate(), date); | ||
1667 | filter.setReportAllSplits(false); | 1679 | filter.setReportAllSplits(false); | ||
1668 | filter.addState(MyMoneyTransactionFilter::notReconciled); | 1680 | filter.addState((int)TransactionFilter::State::NotReconciled); | ||
1669 | transactionList(list, filter); | 1681 | transactionList(list, filter); | ||
1670 | 1682 | | |||
1671 | for (QList<MyMoneyTransaction>::const_iterator it_t = list.constBegin(); it_t != list.constEnd(); ++it_t) { | 1683 | for (QList<MyMoneyTransaction>::const_iterator it_t = list.constBegin(); it_t != list.constEnd(); ++it_t) { | ||
Context not available. | |||||
1687 | return d->m_storage->totalBalance(id, date); | 1699 | return d->m_storage->totalBalance(id, date); | ||
1688 | } | 1700 | } | ||
1689 | 1701 | | |||
1702 | const MyMoneyMoney MyMoneyFile::totalBalance(const QString& id) const | ||||
1703 | { | ||||
1704 | return totalBalance(id, QDate()); | ||||
1705 | } | ||||
1706 | | ||||
1690 | void MyMoneyFile::warningMissingRate(const QString& fromId, const QString& toId) const | 1707 | void MyMoneyFile::warningMissingRate(const QString& fromId, const QString& toId) const | ||
1691 | { | 1708 | { | ||
1692 | MyMoneySecurity from, to; | 1709 | MyMoneySecurity from, to; | ||
Context not available. | |||||
1750 | return rc; | 1767 | return rc; | ||
1751 | } | 1768 | } | ||
1752 | 1769 | | |||
1753 | QString MyMoneyFile::categoryToAccount(const QString& category, MyMoneyAccount::accountTypeE type) const | 1770 | QString MyMoneyFile::categoryToAccount(const QString& category, Account type) const | ||
1754 | { | 1771 | { | ||
1755 | QString id; | 1772 | QString id; | ||
1756 | 1773 | | |||
1757 | // search the category in the expense accounts and if it is not found, try | 1774 | // search the category in the expense accounts and if it is not found, try | ||
1758 | // to locate it in the income accounts | 1775 | // to locate it in the income accounts | ||
1759 | if (type == MyMoneyAccount::UnknownAccountType | 1776 | if (type == Account::Unknown | ||
1760 | || type == MyMoneyAccount::Expense) { | 1777 | || type == Account::Expense) { | ||
1761 | id = locateSubAccount(MyMoneyFile::instance()->expense(), category); | 1778 | id = locateSubAccount(MyMoneyFile::instance()->expense(), category); | ||
1762 | } | 1779 | } | ||
1763 | 1780 | | |||
1764 | if ((id.isEmpty() && type == MyMoneyAccount::UnknownAccountType) | 1781 | if ((id.isEmpty() && type == Account::Unknown) | ||
1765 | || type == MyMoneyAccount::Income) { | 1782 | || type == Account::Income) { | ||
1766 | id = locateSubAccount(MyMoneyFile::instance()->income(), category); | 1783 | id = locateSubAccount(MyMoneyFile::instance()->income(), category); | ||
1767 | } | 1784 | } | ||
1768 | 1785 | | |||
Context not available. | |||||
1861 | // load new objects. So we simply force loading of the new one here | 1878 | // load new objects. So we simply force loading of the new one here | ||
1862 | d->m_cache.preloadSchedule(sched); | 1879 | d->m_cache.preloadSchedule(sched); | ||
1863 | 1880 | | |||
1864 | d->m_changeSet += MyMoneyNotification(notifyAdd, sched); | 1881 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, sched); | ||
1865 | } | 1882 | } | ||
1866 | 1883 | | |||
1867 | void MyMoneyFile::modifySchedule(const MyMoneySchedule& sched) | 1884 | void MyMoneyFile::modifySchedule(const MyMoneySchedule& sched) | ||
Context not available. | |||||
1886 | d->m_storage->modifySchedule(sched); | 1903 | d->m_storage->modifySchedule(sched); | ||
1887 | 1904 | | |||
1888 | d->addCacheNotification(sched.id()); | 1905 | d->addCacheNotification(sched.id()); | ||
1889 | d->m_changeSet += MyMoneyNotification(notifyModify, sched); | 1906 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, sched); | ||
1890 | } | 1907 | } | ||
1891 | 1908 | | |||
1892 | void MyMoneyFile::removeSchedule(const MyMoneySchedule& sched) | 1909 | void MyMoneyFile::removeSchedule(const MyMoneySchedule& sched) | ||
Context not available. | |||||
1899 | d->m_storage->removeSchedule(sched); | 1916 | d->m_storage->removeSchedule(sched); | ||
1900 | 1917 | | |||
1901 | d->addCacheNotification(sched.id(), false); | 1918 | d->addCacheNotification(sched.id(), false); | ||
1902 | d->m_changeSet += MyMoneyNotification(notifyRemove, sched); | 1919 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, sched); | ||
1903 | } | 1920 | } | ||
1904 | 1921 | | |||
1905 | const MyMoneySchedule MyMoneyFile::schedule(const QString& id) const | 1922 | const MyMoneySchedule MyMoneyFile::schedule(const QString& id) const | ||
Context not available. | |||||
1909 | 1926 | | |||
1910 | const QList<MyMoneySchedule> MyMoneyFile::scheduleList( | 1927 | const QList<MyMoneySchedule> MyMoneyFile::scheduleList( | ||
1911 | const QString& accountId, | 1928 | const QString& accountId, | ||
1912 | const MyMoneySchedule::typeE type, | 1929 | const Schedule::Type type, | ||
1913 | const MyMoneySchedule::occurrenceE occurrence, | 1930 | const Schedule::Occurrence occurrence, | ||
1914 | const MyMoneySchedule::paymentTypeE paymentType, | 1931 | const Schedule::PaymentType paymentType, | ||
1915 | const QDate& startDate, | 1932 | const QDate& startDate, | ||
1916 | const QDate& endDate, | 1933 | const QDate& endDate, | ||
1917 | const bool overdue) const | 1934 | const bool overdue) const | ||
Context not available. | |||||
1921 | return d->m_storage->scheduleList(accountId, type, occurrence, paymentType, startDate, endDate, overdue); | 1938 | return d->m_storage->scheduleList(accountId, type, occurrence, paymentType, startDate, endDate, overdue); | ||
1922 | } | 1939 | } | ||
1923 | 1940 | | |||
1941 | const QList<MyMoneySchedule> MyMoneyFile::scheduleList( | ||||
1942 | const QString& accountId) const | ||||
1943 | { | ||||
1944 | return scheduleList(accountId, Schedule::Type::Any, Schedule::Occurrence::Any, Schedule::PaymentType::Any, | ||||
1945 | QDate(), QDate(), false); | ||||
1946 | } | ||||
1947 | | ||||
1948 | const QList<MyMoneySchedule> MyMoneyFile::scheduleList() const | ||||
1949 | { | ||||
1950 | return scheduleList(QString(), Schedule::Type::Any, Schedule::Occurrence::Any, Schedule::PaymentType::Any, | ||||
1951 | QDate(), QDate(), false); | ||||
1952 | } | ||||
1924 | 1953 | | |||
1925 | const QStringList MyMoneyFile::consistencyCheck() | 1954 | const QStringList MyMoneyFile::consistencyCheck() | ||
1926 | { | 1955 | { | ||
Context not available. | |||||
1967 | } | 1996 | } | ||
1968 | 1997 | | |||
1969 | switch ((*it_a).accountGroup()) { | 1998 | switch ((*it_a).accountGroup()) { | ||
1970 | case MyMoneyAccount::Asset: | 1999 | case Account::Asset: | ||
1971 | toplevel = asset(); | 2000 | toplevel = asset(); | ||
1972 | break; | 2001 | break; | ||
1973 | case MyMoneyAccount::Liability: | 2002 | case Account::Liability: | ||
1974 | toplevel = liability(); | 2003 | toplevel = liability(); | ||
1975 | break; | 2004 | break; | ||
1976 | case MyMoneyAccount::Expense: | 2005 | case Account::Expense: | ||
1977 | toplevel = expense(); | 2006 | toplevel = expense(); | ||
1978 | break; | 2007 | break; | ||
1979 | case MyMoneyAccount::Income: | 2008 | case Account::Income: | ||
1980 | toplevel = income(); | 2009 | toplevel = income(); | ||
1981 | break; | 2010 | break; | ||
1982 | case MyMoneyAccount::Equity: | 2011 | case Account::Equity: | ||
1983 | toplevel = equity(); | 2012 | toplevel = equity(); | ||
1984 | break; | 2013 | break; | ||
1985 | default: | 2014 | default: | ||
Context not available. | |||||
2224 | interestAccounts[(*it_s).accountId()] = true; | 2253 | interestAccounts[(*it_s).accountId()] = true; | ||
2225 | } | 2254 | } | ||
2226 | } | 2255 | } | ||
2227 | QSet<MyMoneyAccount::accountTypeE> supportedAccountTypes; | 2256 | QSet<Account> supportedAccountTypes; | ||
2228 | supportedAccountTypes << MyMoneyAccount::Checkings | 2257 | supportedAccountTypes << Account::Checkings | ||
2229 | << MyMoneyAccount::Savings | 2258 | << Account::Savings | ||
2230 | << MyMoneyAccount::Cash | 2259 | << Account::Cash | ||
2231 | << MyMoneyAccount::CreditCard | 2260 | << Account::CreditCard | ||
2232 | << MyMoneyAccount::Asset | 2261 | << Account::Asset | ||
2233 | << MyMoneyAccount::Liability; | 2262 | << Account::Liability; | ||
2234 | QSet<QString> reportedUnsupportedAccounts; | 2263 | QSet<QString> reportedUnsupportedAccounts; | ||
2235 | 2264 | | |||
2236 | for (it_t = tList.begin(); it_t != tList.end(); ++it_t) { | 2265 | for (it_t = tList.begin(); it_t != tList.end(); ++it_t) { | ||
Context not available. | |||||
2685 | } else { | 2714 | } else { | ||
2686 | parent = account(newAccount.parentAccountId()); | 2715 | parent = account(newAccount.parentAccountId()); | ||
2687 | } | 2716 | } | ||
2688 | newAccount.setAccountType((!value.isNegative() && value2.isNegative()) ? MyMoneyAccount::Income : MyMoneyAccount::Expense); | 2717 | newAccount.setAccountType((!value.isNegative() && value2.isNegative()) ? Account::Income : Account::Expense); | ||
2689 | MyMoneyAccount brokerage; | 2718 | MyMoneyAccount brokerage; | ||
2690 | // clear out the parent id, because createAccount() does not like that | 2719 | // clear out the parent id, because createAccount() does not like that | ||
2691 | newAccount.setParentAccountId(QString()); | 2720 | newAccount.setParentAccountId(QString()); | ||
Context not available. | |||||
2721 | // load new objects. So we simply force loading of the new one here | 2750 | // load new objects. So we simply force loading of the new one here | ||
2722 | d->m_cache.preloadSecurity(security); | 2751 | d->m_cache.preloadSecurity(security); | ||
2723 | 2752 | | |||
2724 | d->m_changeSet += MyMoneyNotification(notifyAdd, security); | 2753 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, security); | ||
2725 | } | 2754 | } | ||
2726 | 2755 | | |||
2727 | void MyMoneyFile::modifySecurity(const MyMoneySecurity& security) | 2756 | void MyMoneyFile::modifySecurity(const MyMoneySecurity& security) | ||
Context not available. | |||||
2735 | 2764 | | |||
2736 | d->addCacheNotification(security.id()); | 2765 | d->addCacheNotification(security.id()); | ||
2737 | 2766 | | |||
2738 | d->m_changeSet += MyMoneyNotification(notifyModify, security); | 2767 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, security); | ||
2739 | } | 2768 | } | ||
2740 | 2769 | | |||
2741 | void MyMoneyFile::removeSecurity(const MyMoneySecurity& security) | 2770 | void MyMoneyFile::removeSecurity(const MyMoneySecurity& security) | ||
Context not available. | |||||
2751 | 2780 | | |||
2752 | d->addCacheNotification(security.id(), false); | 2781 | d->addCacheNotification(security.id(), false); | ||
2753 | 2782 | | |||
2754 | d->m_changeSet += MyMoneyNotification(notifyRemove, security); | 2783 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, security); | ||
2755 | } | 2784 | } | ||
2756 | 2785 | | |||
2757 | const MyMoneySecurity& MyMoneyFile::security(const QString& id) const | 2786 | const MyMoneySecurity& MyMoneyFile::security(const QString& id) const | ||
Context not available. | |||||
2782 | // load new objects. So we simply force loading of the new one here | 2811 | // load new objects. So we simply force loading of the new one here | ||
2783 | d->m_cache.preloadSecurity(currency); | 2812 | d->m_cache.preloadSecurity(currency); | ||
2784 | 2813 | | |||
2785 | d->m_changeSet += MyMoneyNotification(notifyAdd, currency); | 2814 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, currency); | ||
2786 | } | 2815 | } | ||
2787 | 2816 | | |||
2788 | void MyMoneyFile::modifyCurrency(const MyMoneySecurity& currency) | 2817 | void MyMoneyFile::modifyCurrency(const MyMoneySecurity& currency) | ||
Context not available. | |||||
2800 | 2829 | | |||
2801 | d->addCacheNotification(currency.id()); | 2830 | d->addCacheNotification(currency.id()); | ||
2802 | 2831 | | |||
2803 | d->m_changeSet += MyMoneyNotification(notifyModify, currency); | 2832 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, currency); | ||
2804 | } | 2833 | } | ||
2805 | 2834 | | |||
2806 | void MyMoneyFile::removeCurrency(const MyMoneySecurity& currency) | 2835 | void MyMoneyFile::removeCurrency(const MyMoneySecurity& currency) | ||
Context not available. | |||||
2820 | 2849 | | |||
2821 | d->addCacheNotification(currency.id(), false); | 2850 | d->addCacheNotification(currency.id(), false); | ||
2822 | 2851 | | |||
2823 | d->m_changeSet += MyMoneyNotification(notifyRemove, currency); | 2852 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, currency); | ||
2824 | } | 2853 | } | ||
2825 | 2854 | | |||
2826 | const MyMoneySecurity& MyMoneyFile::currency(const QString& id) const | 2855 | const MyMoneySecurity& MyMoneyFile::currency(const QString& id) const | ||
Context not available. | |||||
3177 | return rc; | 3206 | return rc; | ||
3178 | } | 3207 | } | ||
3179 | 3208 | | |||
3209 | MyMoneyPrice MyMoneyFile::price(const QString& fromId, const QString& toId) const | ||||
3210 | { | ||||
3211 | return price(fromId, toId, QDate::currentDate(), false); | ||||
3212 | } | ||||
3213 | | ||||
3214 | MyMoneyPrice MyMoneyFile::price(const QString& fromId) const | ||||
3215 | { | ||||
3216 | return price(fromId, QString(), QDate::currentDate(), false); | ||||
3217 | } | ||||
3218 | | ||||
3180 | const MyMoneyPriceList MyMoneyFile::priceList() const | 3219 | const MyMoneyPriceList MyMoneyFile::priceList() const | ||
3181 | { | 3220 | { | ||
3182 | d->checkStorage(); | 3221 | d->checkStorage(); | ||
Context not available. | |||||
3322 | MyMoneyNotifier notifier(d); | 3361 | MyMoneyNotifier notifier(d); | ||
3323 | d->m_storage->addOnlineJob(job); | 3362 | d->m_storage->addOnlineJob(job); | ||
3324 | d->m_cache.preloadOnlineJob(job); | 3363 | d->m_cache.preloadOnlineJob(job); | ||
3325 | d->m_changeSet += MyMoneyNotification(notifyAdd, job); | 3364 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, job); | ||
3326 | } | 3365 | } | ||
3327 | 3366 | | |||
3328 | void MyMoneyFile::modifyOnlineJob(const onlineJob job) | 3367 | void MyMoneyFile::modifyOnlineJob(const onlineJob job) | ||
3329 | { | 3368 | { | ||
3330 | d->checkTransaction(Q_FUNC_INFO); | 3369 | d->checkTransaction(Q_FUNC_INFO); | ||
3331 | d->m_storage->modifyOnlineJob(job); | 3370 | d->m_storage->modifyOnlineJob(job); | ||
3332 | d->m_changeSet += MyMoneyNotification(notifyModify, job); | 3371 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, job); | ||
3333 | d->addCacheNotification(job.id()); | 3372 | d->addCacheNotification(job.id()); | ||
3334 | } | 3373 | } | ||
3335 | 3374 | | |||
Context not available. | |||||
3365 | return; | 3404 | return; | ||
3366 | } | 3405 | } | ||
3367 | d->addCacheNotification(job.id(), false); | 3406 | d->addCacheNotification(job.id(), false); | ||
3368 | d->m_changeSet += MyMoneyNotification(notifyRemove, job); | 3407 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, job); | ||
3369 | d->m_storage->removeOnlineJob(job); | 3408 | d->m_storage->removeOnlineJob(job); | ||
3370 | } | 3409 | } | ||
3371 | 3410 | | |||
Context not available. | |||||
3616 | return balance == accBalance; | 3655 | return balance == accBalance; | ||
3617 | } | 3656 | } | ||
3618 | 3657 | | |||
3619 | int MyMoneyFile::countTransactionsWithSpecificReconciliationState(const QString& accId, enum MyMoneyTransactionFilter::stateOptionE state) const | 3658 | int MyMoneyFile::countTransactionsWithSpecificReconciliationState(const QString& accId, TransactionFilter::State state) const | ||
3620 | { | 3659 | { | ||
3621 | MyMoneyTransactionFilter filter; | 3660 | MyMoneyTransactionFilter filter; | ||
3622 | filter.addAccount(accId); | 3661 | filter.addAccount(accId); | ||
3623 | filter.addState(state); | 3662 | filter.addState((int)state); | ||
3624 | return transactionList(filter).count(); | 3663 | return transactionList(filter).count(); | ||
3625 | } | 3664 | } | ||
3626 | 3665 | | |||
Context not available. |