• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

kabc

  • sources
  • kde-4.12
  • kdepimlibs
  • kabc
  • vcardparser
testread2.cpp
1 /*
2  This file is part of libkabc.
3  Copyright (c) 2007 KDE-PIM team <kde-pim@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "testutils.h"
22 #include <kabc/addressee.h>
23 #include <vcardconverter.h>
24 #include <kdebug.h>
25 
26 using namespace KABC;
27 
28 int main()
29 {
30  Addressee::List l = vCardsAsAddresseeList();
31  QByteArray vcards = vCardsAsText();
32 
33  VCardConverter vct;
34 
35  Addressee::List parsed = vct.parseVCards( vcards );
36 
37  if ( l.size() != parsed.size() ) {
38  kDebug() << "\tSize - FAILED :" << l.size() << "vs. parsed" << parsed.size();
39  } else {
40  kDebug() << "\tSize - PASSED";
41  }
42 
43  Addressee::List::iterator itr1;
44  Addressee::List::iterator itr2;
45  for ( itr1 = l.begin(), itr2 = parsed.begin();
46  itr1 != l.end(); ++itr1, ++itr2 ) {
47  if ( ( *itr1 ).fullEmail() == ( *itr2 ).fullEmail() &&
48  ( *itr1 ).organization() == ( *itr2 ).organization() &&
49  ( *itr1 ).phoneNumbers() == ( *itr2 ).phoneNumbers() &&
50  ( *itr1 ).emails() == ( *itr2 ).emails() &&
51  ( *itr1 ).role() == ( *itr2 ).role() ) {
52  kDebug() << "\tAddressee - PASSED";
53  kDebug() << "\t\t" << ( *itr1 ).fullEmail() << "VS." << ( *itr2 ).fullEmail();
54  } else {
55  kDebug() << "\tAddressee - FAILED";
56  kDebug() << ( *itr1 ).toString();
57  kDebug() << ( *itr2 ).toString();
58  //kDebug()<<"\t\t"<< (*itr1).fullEmail() << "VS." << (*itr2).fullEmail();
59  }
60  }
61 }
KABC::AddresseeList
a QValueList of Addressee, with sorting functionality
Definition: addresseelist.h:288
KABC::VCardConverter::parseVCards
Addressee::List parseVCards(const QByteArray &vcard) const
Parses a string in vCard format and returns a list of contact objects.
Definition: vcardconverter.cpp:72
KABC::VCardConverter
Class to converting contact objects into vCard format and vice versa.
Definition: vcardconverter.h:53
KABC::AddresseeList::toString
QString toString() const
Returns a string representation of the addressee list.
Definition: addresseelist.cpp:205
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:01:05 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kabc

Skip menu "kabc"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal