summaryrefslogtreecommitdiffabout
path: root/kabc/vcard/VCardv.cpp
Side-by-side diff
Diffstat (limited to 'kabc/vcard/VCardv.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/VCardv.cpp77
1 files changed, 36 insertions, 41 deletions
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
@@ -25,2 +25,5 @@
#include <qstrlist.h>
+#include <qstringlist.h>
+#include <qstring.h>
+#include <qvaluelist.h>
@@ -98,19 +101,18 @@ VCard::_parse()
{
- vDebug("parse() called");
- QStrList l;
+
+ QStringList l;
+ QStrList sl;
- RTokenise(strRep_, "\r\n", l);
+ RTokenise(strRep_, "\r\n", sl);
- if (l.count() < 3) { // Invalid VCARD !
- vDebug("Invalid vcard");
+ if (sl.count() < 3) { // Invalid VCARD !
+ //qDebug("invalid vcard ");
return;
}
-
+ l = QStringList::fromStrList( sl );
// Get the first line
- QCString beginLine = QCString(l.at(0)).stripWhiteSpace();
-
- vDebug("Begin line == \"" + beginLine + "\"");
+ QString beginLine = l[0].stripWhiteSpace();
// Remove extra blank lines
- while (QCString(l.last()).isEmpty())
+ while (l.last().isEmpty())
l.remove(l.last());
@@ -118,6 +120,6 @@ VCard::_parse()
// Now we know this is the last line
- QCString endLine = l.last();
+ QString endLine = l.last();
// Trash the first and last lines as we have seen them.
- l.remove(0u);
+ l.remove(l.first());
l.remove(l.last());
@@ -134,4 +136,4 @@ VCard::_parse()
- QCString firstPart(beginLine.left(split));
- QCString valuePart(beginLine.mid(split + 1));
+ QString firstPart(beginLine.left(split));
+ QString valuePart(beginLine.mid(split + 1));
@@ -144,4 +146,4 @@ VCard::_parse()
- if (qstrnicmp(firstPart, "BEGIN", 5) != 0) { // No BEGIN !
- vDebug("No BEGIN");
+ if (firstPart.left(5) != "BEGIN" ) { // No BEGIN !
+ qDebug("no BEGIN in vcard ");
return;
@@ -149,4 +151,4 @@ VCard::_parse()
- if (qstrnicmp(valuePart, "VCARD", 5) != 0) { // Not a vcard !
- vDebug("No VCARD");
+ if (valuePart.left(5) != "VCARD") { // Not a vcard !
+ qDebug("not a VCARD ");
return;
@@ -161,34 +163,22 @@ VCard::_parse()
- QStrList refolded;
-
- QStrListIterator it(l);
+ QStringList refolded;
- QCString cur;
- for (; it.current(); ++it) {
+ QStringList::Iterator it = l.begin();
- cur = it.current();
+ QString cur;
+ for (; it != l.end(); ++it) {
+ cur = (*it);
++it;
-
- while (
- it.current() &&
- it.current()[0] == ' ' &&
- strlen(it.current()) != 1)
- {
- cur += it.current() + 1;
+ while ( it!= l.end() && (*it).at(0) == ' ' && (*it).length()!= 1) {
+ cur += (*it) ;
++it;
}
-
--it;
-
refolded.append(cur);
}
-
- QStrListIterator it2(refolded);
-
- for (; it2.current(); ++it2) {
- vDebug("New contentline using \"" + QCString(it2.current()) + "\"");
- ContentLine * cl = new ContentLine(it2.current());
-
+ QStringList::Iterator it2 = refolded.begin();
+ for (; it2 != refolded.end(); ++it2) {
+ ContentLine * cl = new ContentLine(QCString((*it2).latin1()));
cl->parse();
@@ -196,3 +186,3 @@ VCard::_parse()
{
- qDebug("Content line could not be parsed. Discarded: %s", it2.current());
+ qDebug("Content line could not be parsed. Discarded: %s", (*it2).latin1());
delete cl;
@@ -206,2 +196,6 @@ VCard::_parse()
+
+ // LR: sorry, but the remaining code in this method makes no sense
+
+#if 0
split = endLine.find(':');
@@ -226,2 +220,3 @@ VCard::_parse()
return;
+#endif
}