summaryrefslogtreecommitdiffabout
path: root/kaddressbook/xxport/kde2_xxport.cpp
Unidiff
Diffstat (limited to 'kaddressbook/xxport/kde2_xxport.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxport/kde2_xxport.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/kaddressbook/xxport/kde2_xxport.cpp b/kaddressbook/xxport/kde2_xxport.cpp
index d5fc075..3fdb36d 100644
--- a/kaddressbook/xxport/kde2_xxport.cpp
+++ b/kaddressbook/xxport/kde2_xxport.cpp
@@ -12,105 +12,110 @@
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <qfile.h> 31#include <qfile.h>
32 32
33#include <kdebug.h> 33#include <kdebug.h>
34#include <kfiledialog.h> 34#include <kfiledialog.h>
35#ifndef KAB_EMBEDDED 35#ifndef KAB_EMBEDDED
36#include <kio/netaccess.h> 36#include <kio/netaccess.h>
37#endif //KAB_EMBEDDED 37#endif //KAB_EMBEDDED
38#include <klocale.h> 38#include <klocale.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40#include <kprocess.h> 40#include <kprocess.h>
41#include <kstandarddirs.h> 41#include <kstandarddirs.h>
42#include <ktempfile.h> 42#include <ktempfile.h>
43#include <kurl.h> 43#include <kurl.h>
44 44
45#include "xxportmanager.h" 45#include "xxportmanager.h"
46 46
47#include "kde2_xxport.h" 47#include "kde2_xxport.h"
48 48
49#ifndef KAB_EMBEDDED 49#ifndef KAB_EMBEDDED
50 50
51class KDE2XXPortFactory : public XXPortFactory 51class KDE2XXPortFactory : public XXPortFactory
52{ 52{
53 public: 53 public:
54 XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name ) 54 XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name )
55 { 55 {
56 return new KDE2XXPort( ab, parent, name ); 56 return new KDE2XXPort( ab, parent, name );
57 } 57 }
58}; 58};
59 59
60#endif //KAB_EMBEDDED
61
60 62
61extern "C" 63extern "C"
62{ 64{
65#ifndef KAB_EMBEDDED
63 void *init_libkaddrbk_kde2_xxport() 66 void *init_libkaddrbk_kde2_xxport()
67#else //KAB_EMBEDDED
68 void *init_kaddrbk_kde2_xxport()
69#endif //KAB_EMBEDDED
64 { 70 {
65 return ( new KDE2XXPortFactory() ); 71 return ( new KDE2XXPortFactory() );
66 } 72 }
67} 73}
68#endif //KAB_EMBEDDED
69 74
70 75
71KDE2XXPort::KDE2XXPort( KABC::AddressBook *ab, QWidget *parent, const char *name ) 76KDE2XXPort::KDE2XXPort( KABC::AddressBook *ab, QWidget *parent, const char *name )
72 : XXPortObject( ab, parent, name ) 77 : XXPortObject( ab, parent, name )
73{ 78{
74 createImportAction( i18n( "Import KDE 2 Addressbook..." ) ); 79 createImportAction( i18n( "Import KDE 2 Addressbook..." ) );
75} 80}
76 81
77KABC::AddresseeList KDE2XXPort::importContacts( const QString& ) const 82KABC::AddresseeList KDE2XXPort::importContacts( const QString& ) const
78{ 83{
79 QString fileName = locateLocal( "data", "kabc/std.vcf" ); 84 QString fileName = locateLocal( "data", "kabc/std.vcf" );
80 if ( !QFile::exists( fileName ) ) { 85 if ( !QFile::exists( fileName ) ) {
81 KMessageBox::sorry( parentWidget(), i18n( "<qt>Couldn't find a KDE 2 address book <b>%1</b>.</qt>" ).arg( fileName ) ); 86 KMessageBox::sorry( parentWidget(), i18n( "<qt>Couldn't find a KDE 2 address book <b>%1</b>.</qt>" ).arg( fileName ) );
82 return KABC::AddresseeList(); 87 return KABC::AddresseeList();
83 } 88 }
84 89
85#ifndef KAB_EMBEDDED 90#ifndef KAB_EMBEDDED
86 int result = KMessageBox::questionYesNoCancel( parentWidget(), 91 int result = KMessageBox::questionYesNoCancel( parentWidget(),
87 i18n( "Override previously imported entries?" ), 92 i18n( "Override previously imported entries?" ),
88 i18n( "Import KDE 2 Addressbook" ) ); 93 i18n( "Import KDE 2 Addressbook" ) );
89#else //KAB_EMBEDDED 94#else //KAB_EMBEDDED
90 int result = KMessageBox::warningYesNoCancel( parentWidget(), 95 int result = KMessageBox::warningYesNoCancel( parentWidget(),
91 i18n( "Override previously imported entries?" ), 96 i18n( "Override previously imported entries?" ),
92 i18n( "Import KDE 2 Addressbook" ) ); 97 i18n( "Import KDE 2 Addressbook" ) );
93#endif //KAB_EMBEDDED 98#endif //KAB_EMBEDDED
94 99
95 if ( !result ) return KABC::AddresseeList(); 100 if ( !result ) return KABC::AddresseeList();
96 101
97 KProcess proc; 102 KProcess proc;
98 103
99 if ( result == KMessageBox::Yes ) { 104 if ( result == KMessageBox::Yes ) {
100 proc << "kab2kabc"; 105 proc << "kab2kabc";
101 proc << "--override"; 106 proc << "--override";
102 } else if ( result == KMessageBox::No ) 107 } else if ( result == KMessageBox::No )
103 proc << "kab2kabc"; 108 proc << "kab2kabc";
104 else 109 else
105 kdDebug(5720) << "KAddressBook::importKDE2(): Unknow return value." << endl; 110 kdDebug(5720) << "KAddressBook::importKDE2(): Unknow return value." << endl;
106 111
107 proc.start( KProcess::Block ); 112 proc.start( KProcess::Block );
108 113
109 addressBook()->load(); 114 addressBook()->load();
110 115
111 return KABC::AddresseeList(); 116 return KABC::AddresseeList();
112} 117}
113 118
114#ifndef KAB_EMBEDDED 119#ifndef KAB_EMBEDDED
115#include "kde2_xxport.moc" 120#include "kde2_xxport.moc"
116#endif //KAB_EMBEDDED 121#endif //KAB_EMBEDDED