kaddressbook Library API Documentation

pab_xxport.cpp

00001 /*
00002     This file is part of KAddressbook.
00003     Copyright (c) 2000 Hans Dijkema <kmailcvt@hum.org>
00004     Copyright (c) 2003 Helge Deller <deller@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 
00025 #include <qfile.h>
00026 
00027 #include <kdebug.h>
00028 #include <kfiledialog.h>
00029 #include <kio/netaccess.h>
00030 #include <klocale.h>
00031 #include <kmessagebox.h>
00032 #include <kprocess.h>
00033 #include <kstandarddirs.h>
00034 #include <ktempfile.h>
00035 #include <kurl.h>
00036 
00037 #include "xxportmanager.h"
00038 
00039 #include "pab_xxport.h"
00040 
00041 class PABXXPortFactory : public KAB::XXPortFactory
00042 {
00043   public:
00044     KAB::XXPort *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name )
00045     {
00046       return new PABXXPort( ab, parent, name );
00047     }
00048 };
00049 
00050 extern "C"
00051 {
00052   void *init_libkaddrbk_pab_xxport()
00053   {
00054     return ( new PABXXPortFactory() );
00055   }
00056 }
00057 
00058 
00059 PABXXPort::PABXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name )
00060   : KAB::XXPort( ab, parent, name )
00061 {
00062   createImportAction( i18n("Import MS Exchange Personal Address Book (.PAB)") );
00063 }
00064 
00065 KABC::AddresseeList PABXXPort::importContacts( const QString& ) const
00066 {
00067   KABC::AddresseeList addrList;
00068 
00069   QString fileName = KFileDialog::getOpenFileName( QDir::homeDirPath(), 
00070             "*.[pP][aA][bB]|" + i18n("MS Exchange Personal Address Book Files (*.pab)"), 0 );
00071   if ( fileName.isEmpty() )
00072     return addrList;
00073   if ( !QFile::exists( fileName ) ) {
00074     KMessageBox::sorry( parentWidget(), i18n( "<qt>Couldn't find a MS Exchange Personal Address Book <b>%1</b>.</qt>" ).arg( fileName ) );
00075     return addrList;
00076   }
00077 
00078   // pab PAB(QFile::encodeName(file),this,info);
00079   // info->setFrom(file);
00080   // PAB.convert();
00081 
00082   return addrList;
00083 }
00084 
00085 #include "pab_xxport.moc"
00086 
00087 // vim: ts=2 sw=2 et
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:53 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003