kaddressbook

pab_xxport.cpp
1 /*
2  This file is part of KAddressbook.
3  Copyright (c) 2000 Hans Dijkema <kmailcvt@hum.org>
4  Copyright (c) 2003 Helge Deller <deller@kde.org>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of TQt, and distribute the resulting executable,
22  without including the source code for TQt in the source distribution.
23 */
24 
25 #include <tqfile.h>
26 
27 #include <kdebug.h>
28 #include <tdefiledialog.h>
29 #include <tdeio/netaccess.h>
30 #include <tdelocale.h>
31 #include <tdemessagebox.h>
32 #include <tdeprocess.h>
33 #include <kstandarddirs.h>
34 #include <tdetempfile.h>
35 #include <kurl.h>
36 
37 #include "xxportmanager.h"
38 
39 #include "pab_xxport.h"
40 
41 K_EXPORT_KADDRESSBOOK_XXFILTER( libkaddrbk_pab_xxport, PABXXPort )
42 
43 PABXXPort::PABXXPort( TDEABC::AddressBook *ab, TQWidget *parent, const char *name )
44  : KAB::XXPort( ab, parent, name )
45 {
46  createImportAction( i18n("Import MS Exchange Personal Address Book (.PAB)") );
47 }
48 
49 TDEABC::AddresseeList PABXXPort::importContacts( const TQString& ) const
50 {
51  TDEABC::AddresseeList addrList;
52 
53  TQString fileName = KFileDialog::getOpenFileName( TQDir::homeDirPath(),
54  "*.[pP][aA][bB]|" + i18n("MS Exchange Personal Address Book Files (*.pab)"), 0 );
55  if ( fileName.isEmpty() )
56  return addrList;
57  if ( !TQFile::exists( fileName ) ) {
58  KMessageBox::sorry( parentWidget(), i18n( "<qt>Could not find a MS Exchange Personal Address Book <b>%1</b>.</qt>" ).arg( fileName ) );
59  return addrList;
60  }
61 
62  // pab PAB(TQFile::encodeName(file),this,info);
63  // info->setFrom(file);
64  // PAB.convert();
65 
66  return addrList;
67 }
68 
69 #include "pab_xxport.moc"