summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxportmanager.cpp78
-rw-r--r--kaddressbook/xxportobject.h20
2 files changed, 27 insertions, 71 deletions
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp
index 6cfa9cb..20cde49 100644
--- a/kaddressbook/xxportmanager.cpp
+++ b/kaddressbook/xxportmanager.cpp
@@ -1,269 +1,245 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
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 <qlayout.h> 31#include <qlayout.h>
32#include <qlist.h>
32 33
33#include <kabc/addressbook.h> 34#include <kabc/addressbook.h>
34#include <kabc/resource.h> 35#include <kabc/resource.h>
35#include <kdebug.h> 36#include <kdebug.h>
36#include <kdialogbase.h> 37#include <kdialogbase.h>
37#include <klocale.h> 38#include <klocale.h>
38#include <kmessagebox.h> 39#include <kmessagebox.h>
39 40
40#ifndef KAB_EMBEDDED 41#ifndef KAB_EMBEDDED
41#include <ktrader.h> 42#include <ktrader.h>
42#else //KAB_EMBEDDED 43#else //KAB_EMBEDDED
43#include "xxport/csv_xxport.h" 44extern "C"
44#include "xxport/kde2_xxport.h" 45{
45#include "xxport/vcard_xxport.h" 46 void* init_kaddrbk_csv_xxport();
47 void* init_kaddrbk_kde2_xxport();
48 void* init_kaddrbk_vcard_xxport();
49}
46#endif //KAB_EMBEDDED 50#endif //KAB_EMBEDDED
47 51
48#include <libkdepim/addresseeview.h> 52#include <libkdepim/addresseeview.h>
49 53
50#include "kabcore.h" 54#include "kabcore.h"
51#include "undocmds.h" 55#include "undocmds.h"
52#include "xxportselectdialog.h" 56#include "xxportselectdialog.h"
53 57
54#include "xxportmanager.h" 58#include "xxportmanager.h"
55 59
56KURL XXPortManager::importURL = KURL(); 60KURL XXPortManager::importURL = KURL();
57QString XXPortManager::importData = QString::null; 61QString XXPortManager::importData = QString::null;
58 62
59class PreviewDialog : public KDialogBase 63class PreviewDialog : public KDialogBase
60{ 64{
61 public: 65 public:
62 PreviewDialog( const KABC::Addressee &addr, 66 PreviewDialog( const KABC::Addressee &addr,
63 QWidget *parent, const char *name = 0 ); 67 QWidget *parent, const char *name = 0 );
64}; 68};
65 69
66XXPortManager::XXPortManager( KABCore *core, QObject *parent, const char *name ) 70XXPortManager::XXPortManager( KABCore *core, QObject *parent, const char *name )
67 : QObject( parent, name ), mCore( core ), mShowPreview( false ) 71 : QObject( parent, name ), mCore( core ), mShowPreview( false )
68{ 72{
69 loadPlugins(); 73 loadPlugins();
70} 74}
71 75
72XXPortManager::~XXPortManager() 76XXPortManager::~XXPortManager()
73{ 77{
74} 78}
75 79
76void XXPortManager::restoreSettings() 80void XXPortManager::restoreSettings()
77{ 81{
78} 82}
79 83
80void XXPortManager::saveSettings() 84void XXPortManager::saveSettings()
81{ 85{
82} 86}
83 87
84void XXPortManager::importVCard( const KURL &url ) 88void XXPortManager::importVCard( const KURL &url )
85{ 89{
86 importVCard( url, false ); 90 importVCard( url, false );
87} 91}
88 92
89void XXPortManager::importVCard( const KURL &url, bool showPreview ) 93void XXPortManager::importVCard( const KURL &url, bool showPreview )
90{ 94{
91 importURL = url; 95 importURL = url;
92 mShowPreview = showPreview; 96 mShowPreview = showPreview;
93 slotImport( "vcard", "<empty>" ); 97 slotImport( "vcard", "<empty>" );
94 mShowPreview = false; 98 mShowPreview = false;
95 importURL = KURL(); 99 importURL = KURL();
96} 100}
97 101
98void XXPortManager::importVCard( const QString &vCard, bool showPreview ) 102void XXPortManager::importVCard( const QString &vCard, bool showPreview )
99{ 103{
100 importData = vCard; 104 importData = vCard;
101 mShowPreview = showPreview; 105 mShowPreview = showPreview;
102 slotImport( "vcard", "<empty>" ); 106 slotImport( "vcard", "<empty>" );
103 mShowPreview = false; 107 mShowPreview = false;
104 importData = ""; 108 importData = "";
105} 109}
106 110
107void XXPortManager::slotImport( const QString &identifier, const QString &data ) 111void XXPortManager::slotImport( const QString &identifier, const QString &data )
108{ 112{
109 XXPortObject *obj = mXXPortObjects[ identifier ]; 113 XXPortObject *obj = mXXPortObjects[ identifier ];
110 if ( !obj ) { 114 if ( !obj ) {
111 KMessageBox::error( mCore, i18n( "<qt>No import plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); 115 KMessageBox::error( mCore, i18n( "<qt>No import plugin available for <b>%1</b>.</qt>" ).arg( identifier ) );
112 return; 116 return;
113 } 117 }
114 118
115 KABC::Resource *resource = mCore->requestResource( mCore ); 119 KABC::Resource *resource = mCore->requestResource( mCore );
116 if ( !resource ) 120 if ( !resource )
117 return; 121 return;
118 122
119 KABC::AddresseeList list = obj->importContacts( data ); 123 KABC::AddresseeList list = obj->importContacts( data );
120 KABC::AddresseeList::Iterator it; 124 KABC::AddresseeList::Iterator it;
121 bool imported = false; 125 bool imported = false;
122 for ( it = list.begin(); it != list.end(); ++it ) { 126 for ( it = list.begin(); it != list.end(); ++it ) {
123 if ( mShowPreview ) { 127 if ( mShowPreview ) {
124 PreviewDialog dlg( *it, mCore ); 128 PreviewDialog dlg( *it, mCore );
125 if ( !dlg.exec() ) 129 if ( !dlg.exec() )
126 continue; 130 continue;
127 } 131 }
128 132
129 (*it).setResource( resource ); 133 (*it).setResource( resource );
130 // We use a PwNewCommand so the user can undo it. 134 // We use a PwNewCommand so the user can undo it.
131 PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it ); 135 PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it );
132 UndoStack::instance()->push( command ); 136 UndoStack::instance()->push( command );
133 RedoStack::instance()->clear(); 137 RedoStack::instance()->clear();
134 imported = true; 138 imported = true;
135 } 139 }
136 140
137 if ( imported ) { 141 if ( imported ) {
138 KMessageBox::information( mCore, i18n( "contacts successfully imported." ) ); 142 KMessageBox::information( mCore, i18n( "contacts successfully imported." ) );
139 143
140 emit modified(); 144 emit modified();
141 } 145 }
142} 146}
143 147
144void XXPortManager::slotExport( const QString &identifier, const QString &data ) 148void XXPortManager::slotExport( const QString &identifier, const QString &data )
145{ 149{
146 XXPortObject *obj = mXXPortObjects[ identifier ]; 150 XXPortObject *obj = mXXPortObjects[ identifier ];
147 if ( !obj ) { 151 if ( !obj ) {
148 KMessageBox::error( mCore, i18n( "<qt>No export plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); 152 KMessageBox::error( mCore, i18n( "<qt>No export plugin available for <b>%1</b>.</qt>" ).arg( identifier ) );
149 return; 153 return;
150 } 154 }
151 155
152 KABC::AddresseeList addrList; 156 KABC::AddresseeList addrList;
153 XXPortSelectDialog dlg( mCore, obj->requiresSorting(), mCore ); 157 XXPortSelectDialog dlg( mCore, obj->requiresSorting(), mCore );
154 if ( dlg.exec() ) 158 if ( dlg.exec() )
155 addrList = dlg.contacts(); 159 addrList = dlg.contacts();
156 else 160 else
157 return; 161 return;
158 162
159 if ( !obj->exportContacts( addrList, data ) ) 163 if ( !obj->exportContacts( addrList, data ) )
160 KMessageBox::error( mCore, i18n( "Unable to export contacts." ) ); 164 KMessageBox::error( mCore, i18n( "Unable to export contacts." ) );
161 else 165 else
162 KMessageBox::information( mCore, i18n( "contacts successfully exported." ) ); 166 KMessageBox::information( mCore, i18n( "contacts successfully exported." ) );
163} 167}
164 168
165void XXPortManager::loadPlugins() 169void XXPortManager::loadPlugins()
166{ 170{
167 mXXPortObjects.clear(); 171 mXXPortObjects.clear();
168 172
169#ifndef KAB_EMBEDDED 173#ifndef KAB_EMBEDDED
170 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); 174 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" );
171 KTrader::OfferList::ConstIterator it; 175 KTrader::OfferList::ConstIterator it;
172 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 176 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
173 if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) 177 if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) )
174 continue; 178 continue;
175 179
176 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); 180 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
177 if ( !factory ) { 181 if ( !factory ) {
178 kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; 182 kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl;
179 continue; 183 continue;
180 } 184 }
181 185
182 XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); 186 XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory );
183 187
184 if ( !xxportFactory ) { 188 if ( !xxportFactory ) {
185 kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; 189 kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl;
186 continue; 190 continue;
187 } 191 }
192
193#else //KAB_EMBEDDED
194 QList<XXPortFactory> factorylist;
195 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_csv_xxport()));
196 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_kde2_xxport()));
197 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_vcard_xxport()));
198
199 //now add the opie import library dynamically
200 KLibFactory *factory = KLibLoader::self()->factory( "kaddrbk_opie_xxport" );
201 if ( factory ) {
202 XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory );
203 factorylist.append(xxportFactory);
204 }
205
206 QListIterator<XXPortFactory> it(factorylist);
207 for ( ; it.current(); ++it )
208 {
209 XXPortFactory *xxportFactory = it.current();
210#endif //KAB_EMBEDDED
188 211
189 XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); 212 XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore );
190 if ( obj ) { 213 if ( obj ) {
191 mCore->addGUIClient( obj ); 214 mCore->addGUIClient( obj );
192 mXXPortObjects.insert( obj->identifier(), obj ); 215 mXXPortObjects.insert( obj->identifier(), obj );
193 connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ), 216 connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ),
194 this, SLOT( slotExport( const QString&, const QString& ) ) ); 217 this, SLOT( slotExport( const QString&, const QString& ) ) );
195 connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ), 218 connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ),
196 this, SLOT( slotImport( const QString&, const QString& ) ) ); 219 this, SLOT( slotImport( const QString&, const QString& ) ) );
197 } 220 }
198 } 221 }
199 222
200#else //KAB_EMBEDDED
201//lets load the export/import stubs directly. Is dynamic loading necessary for KA/Pi?
202
203 // CVS import/export
204 XXPortFactory *xxportFactory = new CSVXXPortFactory();
205
206 XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore );
207 if ( obj ) {
208 mCore->addGUIClient( obj );
209 mXXPortObjects.insert( obj->identifier(), obj );
210 connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ),
211 this, SLOT( slotExport( const QString&, const QString& ) ) );
212 connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ),
213 this, SLOT( slotImport( const QString&, const QString& ) ) );
214 }
215
216
217
218 // KDE2 import/export
219 xxportFactory = new KDE2XXPortFactory();
220
221 obj = xxportFactory->xxportObject( mCore->addressBook(), mCore );
222 if ( obj ) {
223 mCore->addGUIClient( obj );
224 mXXPortObjects.insert( obj->identifier(), obj );
225 connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ),
226 this, SLOT( slotExport( const QString&, const QString& ) ) );
227 connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ),
228 this, SLOT( slotImport( const QString&, const QString& ) ) );
229 }
230
231
232
233 // VCARD import/export
234 xxportFactory = new VCardXXPortFactory();
235
236 obj = xxportFactory->xxportObject( mCore->addressBook(), mCore );
237 if ( obj ) {
238 mCore->addGUIClient( obj );
239 mXXPortObjects.insert( obj->identifier(), obj );
240 connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ),
241 this, SLOT( slotExport( const QString&, const QString& ) ) );
242 connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ),
243 this, SLOT( slotImport( const QString&, const QString& ) ) );
244 }
245#endif //KAB_EMBEDDED
246
247} 223}
248 224
249 225
250PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, 226PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent,
251 const char *name ) 227 const char *name )
252 : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, 228 : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent,
253 name, true, true ) 229 name, true, true )
254{ 230{
255 QWidget *page = plainPage(); 231 QWidget *page = plainPage();
256 QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); 232 QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() );
257 233
258 KPIM::AddresseeView *view = new KPIM::AddresseeView( page ); 234 KPIM::AddresseeView *view = new KPIM::AddresseeView( page );
259 view->setAddressee( addr ); 235 view->setAddressee( addr );
260 236
261 layout->addWidget( view ); 237 layout->addWidget( view );
262 238
263 resize( 400, 300 ); 239 resize( 400, 300 );
264} 240}
265 241
266#ifndef KAB_EMBEDDED 242#ifndef KAB_EMBEDDED
267#include "xxportmanager.moc" 243#include "xxportmanager.moc"
268#endif //KAB_EMBEDDED 244#endif //KAB_EMBEDDED
269 245
diff --git a/kaddressbook/xxportobject.h b/kaddressbook/xxportobject.h
index d697700..fddc219 100644
--- a/kaddressbook/xxportobject.h
+++ b/kaddressbook/xxportobject.h
@@ -1,157 +1,137 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
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#ifndef XXPORTOBJECT_H 31#ifndef XXPORTOBJECT_H
32#define XXPORTOBJECT_H 32#define XXPORTOBJECT_H
33 33
34#include <qobject.h> 34#include <qobject.h>
35 35
36#include <kabc/addressbook.h> 36#include <kabc/addressbook.h>
37#include <kabc/addresseelist.h> 37#include <kabc/addresseelist.h>
38#include <kxmlguiclient.h> 38#include <kxmlguiclient.h>
39#ifndef KAB_EMBEDDED
40#include <klibloader.h> 39#include <klibloader.h>
41#endif //KAB_EMBEDDED
42 40
43 41
44class XXPortObject : public QObject, virtual public KXMLGUIClient 42class XXPortObject : public QObject, virtual public KXMLGUIClient
45{ 43{
46 Q_OBJECT 44 Q_OBJECT
47 45
48 public: 46 public:
49 XXPortObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); 47 XXPortObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 );
50 ~XXPortObject(); 48 ~XXPortObject();
51 49
52 /** 50 /**
53 Returns the unique identifier of this xxport modul, it should 51 Returns the unique identifier of this xxport modul, it should
54 be the lowercase name of the import/export format e.g. 'vcard' 52 be the lowercase name of the import/export format e.g. 'vcard'
55 */ 53 */
56 virtual QString identifier() const = 0; 54 virtual QString identifier() const = 0;
57 55
58 /** 56 /**
59 Reimplement this method if the XXPortManager shall 57 Reimplement this method if the XXPortManager shall
60 pass a sorted list to @ref exportContacts(). 58 pass a sorted list to @ref exportContacts().
61 */ 59 */
62 virtual bool requiresSorting() const { return false; } 60 virtual bool requiresSorting() const { return false; }
63 61
64 public slots: 62 public slots:
65 /** 63 /**
66 Reimplement this method for exporting the contacts. 64 Reimplement this method for exporting the contacts.
67 */ 65 */
68 virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier ); 66 virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier );
69 67
70 /** 68 /**
71 Reimplement this method for importing the contacts. 69 Reimplement this method for importing the contacts.
72 */ 70 */
73 virtual KABC::AddresseeList importContacts( const QString& identifier ) const; 71 virtual KABC::AddresseeList importContacts( const QString& identifier ) const;
74 72
75 signals: 73 signals:
76 /** 74 /**
77 Emitted whenever the export action is activated. 75 Emitted whenever the export action is activated.
78 The parameter contains the @ref identifier() for 76 The parameter contains the @ref identifier() for
79 unique identification. 77 unique identification.
80 */ 78 */
81 void exportActivated( const QString&, const QString& ); 79 void exportActivated( const QString&, const QString& );
82 80
83 /** 81 /**
84 Emitted whenever the import action is activated. 82 Emitted whenever the import action is activated.
85 The parameter contains the @ref identifier() for 83 The parameter contains the @ref identifier() for
86 unique identification. 84 unique identification.
87 */ 85 */
88 void importActivated( const QString&, const QString& ); 86 void importActivated( const QString&, const QString& );
89 87
90 protected: 88 protected:
91 /** 89 /**
92 Create the import action. The identifier is passed in the import slot. 90 Create the import action. The identifier is passed in the import slot.
93 */ 91 */
94 void createImportAction( const QString &label, const QString &identifier = QString::null ); 92 void createImportAction( const QString &label, const QString &identifier = QString::null );
95 93
96 /** 94 /**
97 Create the export action. The identifier is passed in the export slot. 95 Create the export action. The identifier is passed in the export slot.
98 */ 96 */
99 void createExportAction( const QString &label, const QString &identifier = QString::null ); 97 void createExportAction( const QString &label, const QString &identifier = QString::null );
100 98
101 /** 99 /**
102 Returns a pointer to the address book object. 100 Returns a pointer to the address book object.
103 */ 101 */
104 KABC::AddressBook *addressBook() const; 102 KABC::AddressBook *addressBook() const;
105 103
106 /** 104 /**
107 Returns a pointer to the parent widget. It can be used as parent for 105 Returns a pointer to the parent widget. It can be used as parent for
108 message boxes. 106 message boxes.
109 */ 107 */
110 QWidget *parentWidget() const; 108 QWidget *parentWidget() const;
111 109
112 110
113 private slots: 111 private slots:
114 void slotImportActivated( const QString& ); 112 void slotImportActivated( const QString& );
115 void slotExportActivated( const QString& ); 113 void slotExportActivated( const QString& );
116 114
117 private: 115 private:
118 KABC::AddressBook *mAddressBook; 116 KABC::AddressBook *mAddressBook;
119 QWidget *mParentWidget; 117 QWidget *mParentWidget;
120 118
121 class XXPortObjectPrivate; 119 class XXPortObjectPrivate;
122 XXPortObjectPrivate *d; 120 XXPortObjectPrivate *d;
123}; 121};
124 122
125#ifndef KAB_EMBEDDED
126class XXPortFactory : public KLibFactory 123class XXPortFactory : public KLibFactory
127{ 124{
128 public: 125 public:
129 virtual XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, 126 virtual XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent,
130 const char *name = 0 ) = 0; 127 const char *name = 0 ) = 0;
131 128
132 protected: 129 protected:
133 virtual QObject* createObject( QObject*, const char*, const char*, 130 virtual QObject* createObject( QObject*, const char*, const char*,
134 const QStringList & ) 131 const QStringList & )
135 { 132 {
136 return 0; 133 return 0;
137 } 134 }
138}; 135};
139 136
140#else //KAB_EMBEDDED
141class XXPortFactory
142{
143 public:
144 virtual XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent,
145 const char *name = 0 ) = 0;
146
147 protected:
148 virtual QObject* createObject( QObject*, const char*, const char*,
149 const QStringList & )
150 {
151 return 0;
152 }
153};
154#endif //KAB_EMBEDDED
155
156
157#endif 137#endif