kmail Library API Documentation

vcardviewer.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 Daniel Molkentin <molkentin@kde.org>
00003 
00004    This program is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018  */
00019 
00020 #ifdef HAVE_CONFIG_H
00021 #include <config.h>
00022 #endif
00023 
00024 #include "vcardviewer.h"
00025 #include "kmaddrbook.h"
00026 
00027 #include <addresseeview.h>
00028 using KPIM::AddresseeView;
00029 
00030 #include <kabc/vcardconverter.h>
00031 #include <kabc/addressee.h>
00032 using KABC::VCardConverter;
00033 using KABC::Addressee;
00034 
00035 #include <klocale.h>
00036 
00037 #include <qstring.h>
00038 
00039 // FIXME The title should be "VCard Viewer" instead of "VCard viewer",
00040 // can't change now because of KDE 3.2 string freeze
00041 KMail::VCardViewer::VCardViewer(QWidget *parent, const QString& vCard, const char* name)
00042   : KDialogBase( parent, name, false, i18n("VCard viewer"), User1|Close, Close,
00043          true, i18n("&Import"))
00044 {
00045   mAddresseeView = new AddresseeView(this);
00046   mAddresseeView->setVScrollBarMode(QScrollView::Auto);
00047   setMainWidget(mAddresseeView);
00048 
00049   Addressee::List al;
00050   VCardConverter t;
00051     
00052   al = t.parseVCards( vCard );
00053   if ( !al.empty() ) 
00054       mAddresseeView->setAddressee( *(al.begin()) );
00055   else {
00056     mAddresseeView->setText(i18n("Failed to parse vCard!"));
00057     enableButton(User1, false);
00058   }
00059 
00060   resize(300,400);
00061 }
00062 
00063 KMail::VCardViewer::~VCardViewer()
00064 {
00065 }
00066 
00067 void KMail::VCardViewer::slotUser1()
00068 {
00069   if (KMAddrBookExternal::addVCard(mAddresseeView->addressee(), this))
00070     enableButton(User1, false);
00071 }
00072 
00073 #include "vcardviewer.moc"
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:37:35 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003