summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-09-29 00:44:07 (UTC)
committer ulf69 <ulf69>2004-09-29 00:44:07 (UTC)
commitbb0e15259ccb1883410435ad76eb0de08b7e2069 (patch) (side-by-side diff)
tree83617ff0d7a2e188c4944783450d7370eae965f1
parent0804930f54a4d7226b62db7878eaedabdf3ebcf6 (diff)
downloadkdepimpi-bb0e15259ccb1883410435ad76eb0de08b7e2069.zip
kdepimpi-bb0e15259ccb1883410435ad76eb0de08b7e2069.tar.gz
kdepimpi-bb0e15259ccb1883410435ad76eb0de08b7e2069.tar.bz2
fixed display bug that I built in with the previous fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/VCardv.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp
index d19a004..bc80707 100644
--- a/kabc/vcard/VCardv.cpp
+++ b/kabc/vcard/VCardv.cpp
@@ -69,231 +69,231 @@ VCard::operator = (VCard & x)
for (; it.current(); ++it) {
ContentLine * c = new ContentLine(*it.current());
contentLineList_.append(c);
}
Entity::operator = (x);
return *this;
}
VCard &
VCard::operator = (const QCString & s)
{
Entity::operator = (s);
return *this;
}
bool
VCard::operator == (VCard & x)
{
x.parse();
return false;
}
VCard::~VCard()
{
}
void
VCard::_parse()
{
vDebug("parse() called");
QStrList l;
RTokenise(strRep_, "\r\n", l);
if (l.count() < 3) { // Invalid VCARD !
vDebug("Invalid vcard");
return;
}
// Get the first line
QCString beginLine = QCString(l.at(0)).stripWhiteSpace();
vDebug("Begin line == \"" + beginLine + "\"");
// Remove extra blank lines
while (QCString(l.last()).isEmpty())
l.remove(l.last());
// Now we know this is the last line
QCString endLine = l.last();
// Trash the first and last lines as we have seen them.
l.remove(0u);
l.remove(l.last());
///////////////////////////////////////////////////////////////
// FIRST LINE
int split = beginLine.find(':');
if (split == -1) { // invalid, no BEGIN
vDebug("No split");
return;
}
QCString firstPart(beginLine.left(split));
QCString valuePart(beginLine.mid(split + 1));
split = firstPart.find('.');
if (split != -1) {
group_ = firstPart.left(split);
firstPart = firstPart.right(firstPart.length() - split - 1);
}
if (qstrnicmp(firstPart, "BEGIN", 5) != 0) { // No BEGIN !
vDebug("No BEGIN");
return;
}
if (qstrnicmp(valuePart, "VCARD", 5) != 0) { // Not a vcard !
vDebug("No VCARD");
return;
}
///////////////////////////////////////////////////////////////
// CONTENT LINES
//
vDebug("Content lines");
// Handle folded lines.
QStrList refolded;
QStrListIterator it(l);
QCString cur;
for (; it.current(); ++it) {
cur = it.current();
++it;
while (
it.current() &&
it.current()[0] == ' ' &&
strlen(it.current()) != 1)
{
cur += it.current() + 1;
++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());
cl->parse();
if (cl->value() == 0)
{
- qDebug("Content line could not be parsed. Discarded: %s" + QCString(it2.current()));
+ qDebug("Content line could not be parsed. Discarded: %s", it2.current());
delete cl;
}
else
contentLineList_.append(cl);
}
///////////////////////////////////////////////////////////////
// LAST LINE
split = endLine.find(':');
if (split == -1) // invalid, no END
return;
firstPart = endLine.left(split);
valuePart = endLine.right(firstPart.length() - split - 1);
split = firstPart.find('.');
if (split != -1) {
group_ = firstPart.left(split);
firstPart = firstPart.right(firstPart.length() - split - 1);
}
if (qstricmp(firstPart, "END") != 0) // No END !
return;
if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard !
return;
}
void
VCard::_assemble()
{
vDebug("Assembling vcard");
strRep_ = "BEGIN:VCARD\r\n";
strRep_ += "VERSION:3.0\r\n";
QPtrListIterator<ContentLine> it(contentLineList_);
for (; it.current(); ++it)
strRep_ += it.current()->asString() + "\r\n";
strRep_ += "END:VCARD\r\n";
}
bool
VCard::has(EntityType t)
{
parse();
return contentLine(t) == 0 ? false : true;
}
bool
VCard::has(const QCString & s)
{
parse();
return contentLine(s) == 0 ? false : true;
}
void
VCard::add(const ContentLine & cl)
{
parse();
ContentLine * c = new ContentLine(cl);
contentLineList_.append(c);
}
void
VCard::add(const QCString & s)
{
parse();
ContentLine * c = new ContentLine(s);
contentLineList_.append(c);
}
ContentLine *
VCard::contentLine(EntityType t)
{
parse();
QPtrListIterator<ContentLine> it(contentLineList_);
for (; it.current(); ++it)
if (it.current()->entityType() == t)
return it.current();
return 0;
}
ContentLine *
VCard::contentLine(const QCString & s)
{
parse();
QPtrListIterator<ContentLine> it(contentLineList_);
for (; it.current(); ++it)
if (it.current()->entityType() == EntityNameToEntityType(s))
return it.current();
return 0;
}