-rw-r--r-- | kabc/vcard/VCardEntity.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kabc/vcard/VCardEntity.cpp b/kabc/vcard/VCardEntity.cpp index 0cd2086..5fca3bc 100644 --- a/kabc/vcard/VCardEntity.cpp +++ b/kabc/vcard/VCardEntity.cpp | |||
@@ -24,99 +24,106 @@ | |||
24 | #include <qregexp.h> | 24 | #include <qregexp.h> |
25 | 25 | ||
26 | #include <VCardDefines.h> | 26 | #include <VCardDefines.h> |
27 | #include <VCardVCardEntity.h> | 27 | #include <VCardVCardEntity.h> |
28 | 28 | ||
29 | using namespace VCARD; | 29 | using namespace VCARD; |
30 | 30 | ||
31 | VCardEntity::VCardEntity() | 31 | VCardEntity::VCardEntity() |
32 | :Entity() | 32 | :Entity() |
33 | { | 33 | { |
34 | cardList_.setAutoDelete( TRUE ); | 34 | cardList_.setAutoDelete( TRUE ); |
35 | } | 35 | } |
36 | 36 | ||
37 | VCardEntity::VCardEntity(const VCardEntity & x) | 37 | VCardEntity::VCardEntity(const VCardEntity & x) |
38 | :Entity(x) | 38 | :Entity(x) |
39 | { | 39 | { |
40 | cardList_.setAutoDelete( TRUE ); | 40 | cardList_.setAutoDelete( TRUE ); |
41 | } | 41 | } |
42 | 42 | ||
43 | VCardEntity::VCardEntity(const QCString & s) | 43 | VCardEntity::VCardEntity(const QCString & s) |
44 | :Entity(s) | 44 | :Entity(s) |
45 | { | 45 | { |
46 | cardList_.setAutoDelete( TRUE ); | 46 | cardList_.setAutoDelete( TRUE ); |
47 | } | 47 | } |
48 | 48 | ||
49 | VCardEntity & | 49 | VCardEntity & |
50 | VCardEntity::operator = (VCardEntity & x) | 50 | VCardEntity::operator = (VCardEntity & x) |
51 | { | 51 | { |
52 | if (*this == x) return *this; | 52 | if (*this == x) return *this; |
53 | 53 | ||
54 | Entity::operator = (x); | 54 | Entity::operator = (x); |
55 | return *this; | 55 | return *this; |
56 | } | 56 | } |
57 | 57 | ||
58 | VCardEntity & | 58 | VCardEntity & |
59 | VCardEntity::operator = (const QCString & s) | 59 | VCardEntity::operator = (const QCString & s) |
60 | { | 60 | { |
61 | Entity::operator = (s); | 61 | Entity::operator = (s); |
62 | return *this; | 62 | return *this; |
63 | } | 63 | } |
64 | 64 | ||
65 | bool | 65 | bool |
66 | VCardEntity::operator == (VCardEntity & x) | 66 | VCardEntity::operator == (VCardEntity & x) |
67 | { | 67 | { |
68 | x.parse(); | 68 | x.parse(); |
69 | return false; | 69 | return false; |
70 | } | 70 | } |
71 | 71 | ||
72 | VCardEntity::~VCardEntity() | 72 | VCardEntity::~VCardEntity() |
73 | { | 73 | { |
74 | } | 74 | } |
75 | 75 | ||
76 | void | 76 | void |
77 | VCardEntity::_parse() | 77 | VCardEntity::_parse() |
78 | { | 78 | { |
79 | vDebug("parse"); | 79 | vDebug("parse"); |
80 | QCString s(strRep_); | 80 | QCString s(strRep_); |
81 | 81 | ||
82 | int i = s.find(QRegExp("BEGIN:VCARD", false)); | 82 | int i = s.find(QRegExp("BEGIN:VCARD", false)); |
83 | 83 | ||
84 | while (i != -1) { | 84 | while (i != -1) { |
85 | 85 | ||
86 | i = s.find(QRegExp("BEGIN:VCARD", false), 11); | 86 | i = s.find(QRegExp("BEGIN:VCARD", false), 11); |
87 | 87 | ||
88 | QCString cardStr(s.left(i)); | 88 | QCString cardStr(s.left(i)); |
89 | 89 | ||
90 | VCard * v = new VCard(cardStr); | 90 | VCard * v = new VCard(cardStr); |
91 | 91 | ||
92 | cardList_.append(v); | 92 | cardList_.append(v); |
93 | 93 | ||
94 | v->parse(); | 94 | v->parse(); |
95 | 95 | ||
96 | s.remove(0, i); | 96 | s.remove(0, i); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | void | 100 | void |
101 | VCardEntity::_assemble() | 101 | VCardEntity::_assemble() |
102 | { | 102 | { |
103 | VCardListIterator it(cardList_); | 103 | VCardListIterator it(cardList_); |
104 | 104 | ||
105 | for (; it.current(); ++it) | 105 | for (; it.current(); ++it) |
106 | strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck. | 106 | strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck. |
107 | } | 107 | } |
108 | 108 | ||
109 | VCardList & | 109 | VCardList & |
110 | VCardEntity::cardList() | 110 | VCardEntity::cardList() |
111 | { | 111 | { |
112 | parse(); | 112 | parse(); |
113 | return cardList_; | 113 | return cardList_; |
114 | } | 114 | } |
115 | 115 | ||
116 | void | 116 | void |
117 | VCardEntity::setCardList(const VCardList & l) | 117 | VCardEntity::setCardList(const VCardList & l) |
118 | { | 118 | { |
119 | parse(); | 119 | parse(); |
120 | cardList_ = l; | 120 | //UScardList_ = l; |
121 | VCardListIterator it(l); | ||
122 | |||
123 | for (; it.current(); ++it) { | ||
124 | VCard* v = new VCard(*it.current()); | ||
125 | cardList_.append(v); | ||
126 | } | ||
127 | |||
121 | } | 128 | } |
122 | 129 | ||