• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

kabc

testread2.cpp

00001 /*
00002     This file is part of libkabc.
00003     Copyright (c) 2007 KDE-PIM team <kde-pim@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "testutils.h"
00022 #include <kabc/addressee.h>
00023 #include <vcardconverter.h>
00024 #include <kdebug.h>
00025 
00026 using namespace KABC;
00027 
00028 int main()
00029 {
00030   Addressee::List l = vCardsAsAddresseeList();
00031   QByteArray vcards = vCardsAsText();
00032 
00033   VCardConverter vct;
00034 
00035   Addressee::List parsed = vct.parseVCards( vcards );
00036 
00037   if ( l.size() != parsed.size() ) {
00038     kDebug()<<"\tSize - FAILED :"<<l.size()<<"vs. parsed"<<parsed.size();
00039   } else {
00040     kDebug()<<"\tSize - PASSED";
00041   }
00042 
00043   Addressee::List::iterator itr1;
00044   Addressee::List::iterator itr2;
00045   for ( itr1 = l.begin(), itr2 = parsed.begin();
00046         itr1 != l.end(); ++itr1, ++itr2 ) {
00047     if ( (*itr1).fullEmail() == (*itr2).fullEmail() &&
00048          (*itr1).organization() == (*itr2).organization() &&
00049          (*itr1).phoneNumbers() == (*itr2).phoneNumbers()  &&
00050          (*itr1).emails() == (*itr2).emails() &&
00051          (*itr1).role() == (*itr2).role() ) {
00052       kDebug()<<"\tAddressee  - PASSED";
00053       kDebug()<<"\t\t"<< (*itr1).fullEmail() << "VS." << (*itr2).fullEmail();
00054     } else {
00055       kDebug()<<"\tAddressee  - FAILED";
00056       kDebug()<<(*itr1).toString();
00057       kDebug()<<(*itr2).toString();
00058       //kDebug()<<"\t\t"<< (*itr1).fullEmail() << "VS." << (*itr2).fullEmail();
00059     }
00060   }
00061 }

kabc

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal