summaryrefslogtreecommitdiffabout
path: root/kabc
Unidiff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp2
-rw-r--r--kabc/picture.cpp38
-rw-r--r--kabc/vcard/ContentLine.cpp30
-rw-r--r--kabc/vcard/VCardv.cpp77
4 files changed, 99 insertions, 48 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 3ce733d..568dfc4 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -1684,4 +1684,5 @@ void Addressee::dump() const
1684{ 1684{
1685 return; 1685 return;
1686#if 0
1686 kdDebug(5700) << "Addressee {" << endl; 1687 kdDebug(5700) << "Addressee {" << endl;
1687 1688
@@ -1747,4 +1748,5 @@ void Addressee::dump() const
1747 1748
1748 kdDebug(5700) << "}" << endl; 1749 kdDebug(5700) << "}" << endl;
1750#endif
1749} 1751}
1750 1752
diff --git a/kabc/picture.cpp b/kabc/picture.cpp
index 6a34b98..57aa297 100644
--- a/kabc/picture.cpp
+++ b/kabc/picture.cpp
@@ -54,14 +54,40 @@ Picture::~Picture()
54bool Picture::operator==( const Picture &p ) const 54bool Picture::operator==( const Picture &p ) const
55{ 55{
56 if ( mIntern != p.mIntern ) return false; 56 //qDebug("compare PIC ");
57 57 if ( mUndefined && p.mUndefined ) {
58 //qDebug("compare PIC true 1 ");
59 return true;
60 }
61 if ( mUndefined || p.mUndefined ) {
62 //qDebug("compare PIC false 1");
63 return false;
64 }
65 // now we should deal with two defined pics!
66 if ( mIntern != p.mIntern ) {
67 //qDebug("compare PIC false 2");
68 return false;
69 }
58 if ( mIntern ) { 70 if ( mIntern ) {
59 if ( mData != p.mData ) 71 //qDebug("mIntern ");
72 if ( mData.isNull() && p.mData.isNull() ) {
73 //qDebug("compare PIC true 2 ");
74 return true;
75 }
76 if ( mData.isNull() || p.mData.isNull() ){
77 //qDebug("compare PIC false 3-1");
78
79 return false;
80 }
81 if ( mData != p.mData ) {
82 //qDebug("compare PIC false 3");
60 return false; 83 return false;
84 }
61 } else { 85 } else {
62 if ( mUrl != p.mUrl ) 86 if ( mUrl != p.mUrl ) {
63 return false; 87 //qDebug("compare PIC false 4");
88 return false;
89 }
64 } 90 }
65 91 //qDebug("compare PIC true ");
66 return true; 92 return true;
67} 93}
diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp
index c368172..2f88cde 100644
--- a/kabc/vcard/ContentLine.cpp
+++ b/kabc/vcard/ContentLine.cpp
@@ -274,4 +274,31 @@ ContentLine::_parse()
274ContentLine::_assemble() 274ContentLine::_assemble()
275{ 275{
276 //strRep_.truncate(0);
277 QString line;
278 if (!group_.isEmpty())
279 line = group_ + '.';
280 line += name_;
281 ParamListIterator it(paramList_);
282 for (; it.current(); ++it)
283 line += ";" + it.current()->asString();
284
285 if (value_ != 0)
286 line += ":" + value_->asString();
287
288 line = line.replace( QRegExp( "\n" ), "\\n" );
289
290 // Fold lines longer than 72 chars
291 const int maxLen = 72;
292 uint cursor = 0;
293 QString cut;
294 while( line.length() > ( cursor + 1 ) * maxLen ) {
295 cut += line.mid( cursor * maxLen, maxLen );
296 cut += "\r\n ";
297 ++cursor;
298 }
299 cut += line.mid( cursor * maxLen );
300 strRep_ = cut.latin1();
301 //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data());
302#if 0
276 vDebug("Assemble (argl) - my name is \"" + name_ + "\""); 303 vDebug("Assemble (argl) - my name is \"" + name_ + "\"");
277 strRep_.truncate(0); 304 strRep_.truncate(0);
@@ -308,5 +335,6 @@ ContentLine::_assemble()
308 } 335 }
309 strRep_ += line.mid( cursor * maxLen ); 336 strRep_ += line.mid( cursor * maxLen );
310 //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); 337 qDebug("ContentLine::_assemble()\n%s*****", strRep_.data());
338#endif
311} 339}
312 340
diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp
index bc80707..49bfe43 100644
--- a/kabc/vcard/VCardv.cpp
+++ b/kabc/vcard/VCardv.cpp
@@ -24,4 +24,7 @@
24#include <qcstring.h> 24#include <qcstring.h>
25#include <qstrlist.h> 25#include <qstrlist.h>
26#include <qstringlist.h>
27#include <qstring.h>
28#include <qvaluelist.h>
26 29
27#include <VCardEntity.h> 30#include <VCardEntity.h>
@@ -97,28 +100,27 @@ VCard::~VCard()
97VCard::_parse() 100VCard::_parse()
98{ 101{
99 vDebug("parse() called"); 102
100 QStrList l; 103 QStringList l;
104 QStrList sl;
101 105
102 RTokenise(strRep_, "\r\n", l); 106 RTokenise(strRep_, "\r\n", sl);
103 107
104 if (l.count() < 3) { // Invalid VCARD ! 108 if (sl.count() < 3) { // Invalid VCARD !
105 vDebug("Invalid vcard"); 109 //qDebug("invalid vcard ");
106 return; 110 return;
107 } 111 }
108 112 l = QStringList::fromStrList( sl );
109 // Get the first line 113 // Get the first line
110 QCString beginLine = QCString(l.at(0)).stripWhiteSpace(); 114 QString beginLine = l[0].stripWhiteSpace();
111
112 vDebug("Begin line == \"" + beginLine + "\"");
113 115
114 // Remove extra blank lines 116 // Remove extra blank lines
115 while (QCString(l.last()).isEmpty()) 117 while (l.last().isEmpty())
116 l.remove(l.last()); 118 l.remove(l.last());
117 119
118 // Now we know this is the last line 120 // Now we know this is the last line
119 QCString endLine = l.last(); 121 QString endLine = l.last();
120 122
121 // Trash the first and last lines as we have seen them. 123 // Trash the first and last lines as we have seen them.
122 l.remove(0u); 124 l.remove(l.first());
123 l.remove(l.last()); 125 l.remove(l.last());
124 126
@@ -133,6 +135,6 @@ VCard::_parse()
133 } 135 }
134 136
135 QCString firstPart(beginLine.left(split)); 137 QString firstPart(beginLine.left(split));
136 QCString valuePart(beginLine.mid(split + 1)); 138 QString valuePart(beginLine.mid(split + 1));
137 139
138 split = firstPart.find('.'); 140 split = firstPart.find('.');
@@ -143,11 +145,11 @@ VCard::_parse()
143 } 145 }
144 146
145 if (qstrnicmp(firstPart, "BEGIN", 5) != 0) { // No BEGIN ! 147 if (firstPart.left(5) != "BEGIN" ) { // No BEGIN !
146 vDebug("No BEGIN"); 148 qDebug("no BEGIN in vcard ");
147 return; 149 return;
148 } 150 }
149 151
150 if (qstrnicmp(valuePart, "VCARD", 5) != 0) { // Not a vcard ! 152 if (valuePart.left(5) != "VCARD") { // Not a vcard !
151 vDebug("No VCARD"); 153 qDebug("not a VCARD ");
152 return; 154 return;
153 } 155 }
@@ -160,40 +162,28 @@ VCard::_parse()
160 // Handle folded lines. 162 // Handle folded lines.
161 163
162 QStrList refolded; 164 QStringList refolded;
163
164 QStrListIterator it(l);
165 165
166 QCString cur;
167 166
168 for (; it.current(); ++it) { 167 QStringList::Iterator it = l.begin();
169 168
170 cur = it.current(); 169 QString cur;
171 170
171 for (; it != l.end(); ++it) {
172 cur = (*it);
172 ++it; 173 ++it;
173 174 while ( it!= l.end() && (*it).at(0) == ' '&& (*it).length()!= 1) {
174 while ( 175 cur += (*it) ;
175 it.current() &&
176 it.current()[0] == ' '&&
177 strlen(it.current()) != 1)
178 {
179 cur += it.current() + 1;
180 ++it; 176 ++it;
181 } 177 }
182
183 --it; 178 --it;
184
185 refolded.append(cur); 179 refolded.append(cur);
186 } 180 }
187 181 QStringList::Iterator it2 = refolded.begin();
188 QStrListIterator it2(refolded); 182 for (; it2 != refolded.end(); ++it2) {
189 183 ContentLine * cl = new ContentLine(QCString((*it2).latin1()));
190 for (; it2.current(); ++it2) {
191 vDebug("New contentline using \"" + QCString(it2.current()) + "\"");
192 ContentLine * cl = new ContentLine(it2.current());
193
194 cl->parse(); 184 cl->parse();
195 if (cl->value() == 0) 185 if (cl->value() == 0)
196 { 186 {
197 qDebug("Content line could not be parsed. Discarded: %s", it2.current()); 187 qDebug("Content line could not be parsed. Discarded: %s", (*it2).latin1());
198 delete cl; 188 delete cl;
199 } 189 }
@@ -205,4 +195,8 @@ VCard::_parse()
205 // LAST LINE 195 // LAST LINE
206 196
197
198 // LR: sorry, but the remaining code in this method makes no sense
199
200#if 0
207 split = endLine.find(':'); 201 split = endLine.find(':');
208 202
@@ -225,4 +219,5 @@ VCard::_parse()
225 if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard ! 219 if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard !
226 return; 220 return;
221#endif
227} 222}
228 223