Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/plugins/csvimport/csvimporter.cpp
Context not available. | |||||
40 | // Project Includes | 40 | // Project Includes | ||
---|---|---|---|---|---|
41 | 41 | | |||
42 | #include "mymoneyfile.h" | 42 | #include "mymoneyfile.h" | ||
43 | #include "mymoneysecurity.h" | ||||
44 | #include "mymoneytransaction.h" | ||||
43 | #include "csvutil.h" | 45 | #include "csvutil.h" | ||
44 | #include "convdate.h" | 46 | #include "convdate.h" | ||
45 | 47 | | |||
Context not available. | |||||
674 | MyMoneyFile *file = MyMoneyFile::instance(); | 676 | MyMoneyFile *file = MyMoneyFile::instance(); | ||
675 | file->accountList(accounts); | 677 | file->accountList(accounts); | ||
676 | 678 | | |||
677 | QList<MyMoneyAccount::accountTypeE> accountTypes; | 679 | QList<eMyMoney::Account> accountTypes; | ||
678 | accountTypes << MyMoneyAccount::Checkings << | 680 | accountTypes << eMyMoney::Account::Checkings << | ||
679 | MyMoneyAccount::Savings << | 681 | eMyMoney::Account::Savings << | ||
680 | MyMoneyAccount::Liability << | 682 | eMyMoney::Account::Liability << | ||
681 | MyMoneyAccount::Checkings << | 683 | eMyMoney::Account::Checkings << | ||
682 | MyMoneyAccount::Savings << | 684 | eMyMoney::Account::Savings << | ||
683 | MyMoneyAccount::Cash << | 685 | eMyMoney::Account::Cash << | ||
684 | MyMoneyAccount::CreditCard << | 686 | eMyMoney::Account::CreditCard << | ||
685 | MyMoneyAccount::Loan << | 687 | eMyMoney::Account::Loan << | ||
686 | MyMoneyAccount::Asset << | 688 | eMyMoney::Account::Asset << | ||
687 | MyMoneyAccount::Liability; | 689 | eMyMoney::Account::Liability; | ||
688 | 690 | | |||
689 | QSet<QString> currencySymbols; | 691 | QSet<QString> currencySymbols; | ||
690 | foreach (const auto account, accounts) { | 692 | foreach (const auto account, accounts) { | ||
Context not available. | |||||
707 | return ret; | 709 | return ret; | ||
708 | } | 710 | } | ||
709 | 711 | | |||
710 | QList<MyMoneyAccount> CSVImporter::findAccounts(const QList<MyMoneyAccount::accountTypeE> &accountTypes, const QString &statementHeader) | 712 | QList<MyMoneyAccount> CSVImporter::findAccounts(const QList<eMyMoney::Account> &accountTypes, const QString &statementHeader) | ||
711 | { | 713 | { | ||
712 | MyMoneyFile* file = MyMoneyFile::instance(); | 714 | MyMoneyFile* file = MyMoneyFile::instance(); | ||
713 | QList<MyMoneyAccount> accountList; | 715 | QList<MyMoneyAccount> accountList; | ||
Context not available. | |||||
804 | statementHeader.remove(QRegularExpression(QStringLiteral("[-., ]"))); | 806 | statementHeader.remove(QRegularExpression(QStringLiteral("[-., ]"))); | ||
805 | 807 | | |||
806 | QList<MyMoneyAccount> accounts; | 808 | QList<MyMoneyAccount> accounts; | ||
807 | QList<MyMoneyAccount::accountTypeE> accountTypes; | 809 | QList<eMyMoney::Account> accountTypes; | ||
808 | 810 | | |||
809 | switch(m_profile->type()) { | 811 | switch(m_profile->type()) { | ||
810 | default: | 812 | default: | ||
811 | case Profile::Banking: | 813 | case Profile::Banking: | ||
812 | accountTypes << MyMoneyAccount::Checkings << | 814 | accountTypes << eMyMoney::Account::Checkings << | ||
813 | MyMoneyAccount::Savings << | 815 | eMyMoney::Account::Savings << | ||
814 | MyMoneyAccount::Liability << | 816 | eMyMoney::Account::Liability << | ||
815 | MyMoneyAccount::Checkings << | 817 | eMyMoney::Account::Checkings << | ||
816 | MyMoneyAccount::Savings << | 818 | eMyMoney::Account::Savings << | ||
817 | MyMoneyAccount::Cash << | 819 | eMyMoney::Account::Cash << | ||
818 | MyMoneyAccount::CreditCard << | 820 | eMyMoney::Account::CreditCard << | ||
819 | MyMoneyAccount::Loan << | 821 | eMyMoney::Account::Loan << | ||
820 | MyMoneyAccount::Asset << | 822 | eMyMoney::Account::Asset << | ||
821 | MyMoneyAccount::Liability; | 823 | eMyMoney::Account::Liability; | ||
822 | accounts = findAccounts(accountTypes, statementHeader); | 824 | accounts = findAccounts(accountTypes, statementHeader); | ||
823 | break; | 825 | break; | ||
824 | case Profile::Investment: | 826 | case Profile::Investment: | ||
825 | accountTypes << MyMoneyAccount::Investment; // take investment accounts... | 827 | accountTypes << eMyMoney::Account::Investment; // take investment accounts... | ||
826 | accounts = findAccounts(accountTypes, statementHeader); //...and search them in statement header | 828 | accounts = findAccounts(accountTypes, statementHeader); //...and search them in statement header | ||
827 | break; | 829 | break; | ||
828 | } | 830 | } | ||
Context not available. | |||||
833 | st.m_accountId = accounts.first().id(); | 835 | st.m_accountId = accounts.first().id(); | ||
834 | 836 | | |||
835 | switch (accounts.first().accountType()) { | 837 | switch (accounts.first().accountType()) { | ||
836 | case MyMoneyAccount::Checkings: | 838 | case eMyMoney::Account::Checkings: | ||
837 | st.m_eType = MyMoneyStatement::etCheckings; | 839 | st.m_eType = MyMoneyStatement::etCheckings; | ||
838 | break; | 840 | break; | ||
839 | case MyMoneyAccount::Savings: | 841 | case eMyMoney::Account::Savings: | ||
840 | st.m_eType = MyMoneyStatement::etSavings; | 842 | st.m_eType = MyMoneyStatement::etSavings; | ||
841 | break; | 843 | break; | ||
842 | case MyMoneyAccount::Investment: | 844 | case eMyMoney::Account::Investment: | ||
843 | st.m_eType = MyMoneyStatement::etInvestment; | 845 | st.m_eType = MyMoneyStatement::etInvestment; | ||
844 | break; | 846 | break; | ||
845 | case MyMoneyAccount::CreditCard: | 847 | case eMyMoney::Account::CreditCard: | ||
846 | st.m_eType = MyMoneyStatement::etCreditCard; | 848 | st.m_eType = MyMoneyStatement::etCreditCard; | ||
847 | break; | 849 | break; | ||
848 | default: | 850 | default: | ||
Context not available. |