Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneypayee_p.h
Show All 29 Lines | |||||
30 | #include <QMap> | 30 | #include <QMap> | ||
31 | #include <QHash> | 31 | #include <QHash> | ||
32 | 32 | | |||
33 | // ---------------------------------------------------------------------------- | 33 | // ---------------------------------------------------------------------------- | ||
34 | // Project Includes | 34 | // Project Includes | ||
35 | 35 | | |||
36 | #include "mymoneyobject_p.h" | 36 | #include "mymoneyobject_p.h" | ||
37 | 37 | | |||
38 | namespace Payee | | |||
39 | { | | |||
40 | enum class Element { Address }; | | |||
41 | uint qHash(const Element key, uint seed) { return ::qHash(static_cast<uint>(key), seed); } | | |||
42 | | ||||
43 | enum class Attribute { Name = 0, | | |||
44 | Type, | | |||
45 | Reference, | | |||
46 | Notes, | | |||
47 | MatchingEnabled, | | |||
48 | UsingMatchKey, | | |||
49 | MatchIgnoreCase, | | |||
50 | MatchKey, | | |||
51 | DefaultAccountID, | | |||
52 | Street, | | |||
53 | City, | | |||
54 | PostCode, | | |||
55 | Email, | | |||
56 | State, | | |||
57 | Telephone, | | |||
58 | // insert new entries above this line | | |||
59 | LastAttribute | | |||
60 | }; | | |||
61 | uint qHash(const Attribute key, uint seed) { return ::qHash(static_cast<uint>(key), seed); } | | |||
62 | } | | |||
63 | | ||||
64 | class MyMoneyPayeePrivate : public MyMoneyObjectPrivate | 38 | class MyMoneyPayeePrivate : public MyMoneyObjectPrivate | ||
65 | { | 39 | { | ||
66 | public: | 40 | public: | ||
67 | 41 | | |||
68 | MyMoneyPayeePrivate() : | 42 | MyMoneyPayeePrivate() : | ||
69 | m_matchingEnabled(false), | 43 | m_matchingEnabled(false), | ||
70 | m_usingMatchKey(false), | 44 | m_usingMatchKey(false), | ||
71 | m_matchKeyIgnoreCase(true) | 45 | m_matchKeyIgnoreCase(true) | ||
72 | { | 46 | { | ||
73 | } | 47 | } | ||
74 | 48 | | |||
75 | static QString getElName(const Payee::Element el) | | |||
76 | { | | |||
77 | static const QMap<Payee::Element, QString> elNames { | | |||
78 | {Payee::Element::Address, QStringLiteral("ADDRESS")} | | |||
79 | }; | | |||
80 | return elNames[el]; | | |||
81 | } | | |||
82 | | ||||
83 | static QString getAttrName(const Payee::Attribute attr) | | |||
84 | { | | |||
85 | static const QHash<Payee::Attribute, QString> attrNames { | | |||
86 | {Payee::Attribute::Name, QStringLiteral("name")}, | | |||
87 | {Payee::Attribute::Type, QStringLiteral("type")}, | | |||
88 | {Payee::Attribute::Reference, QStringLiteral("reference")}, | | |||
89 | {Payee::Attribute::Notes, QStringLiteral("notes")}, | | |||
90 | {Payee::Attribute::MatchingEnabled, QStringLiteral("matchingenabled")}, | | |||
91 | {Payee::Attribute::UsingMatchKey, QStringLiteral("usingmatchkey")}, | | |||
92 | {Payee::Attribute::MatchIgnoreCase, QStringLiteral("matchignorecase")}, | | |||
93 | {Payee::Attribute::MatchKey, QStringLiteral("matchkey")}, | | |||
94 | {Payee::Attribute::DefaultAccountID, QStringLiteral("defaultaccountid")}, | | |||
95 | {Payee::Attribute::Street, QStringLiteral("street")}, | | |||
96 | {Payee::Attribute::City, QStringLiteral("city")}, | | |||
97 | {Payee::Attribute::PostCode, QStringLiteral("postcode")}, | | |||
98 | {Payee::Attribute::Email, QStringLiteral("email")}, | | |||
99 | {Payee::Attribute::State, QStringLiteral("state")}, | | |||
100 | {Payee::Attribute::Telephone, QStringLiteral("telephone")}, | | |||
101 | }; | | |||
102 | return attrNames[attr]; | | |||
103 | } | | |||
104 | | ||||
105 | // Simple fields | 49 | // Simple fields | ||
106 | QString m_name; | 50 | QString m_name; | ||
107 | QString m_address; | 51 | QString m_address; | ||
108 | QString m_city; | 52 | QString m_city; | ||
109 | QString m_state; | 53 | QString m_state; | ||
110 | QString m_postcode; | 54 | QString m_postcode; | ||
111 | QString m_telephone; | 55 | QString m_telephone; | ||
112 | QString m_email; | 56 | QString m_email; | ||
Show All 32 Lines |