kaddressbook

xxport.h
1/*
2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4
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
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
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
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of TQt, and distribute the resulting executable,
21 without including the source code for TQt in the source distribution.
22*/
23
24#ifndef KAB_XXPORT_H
25#define KAB_XXPORT_H
26
27#include <tqobject.h>
28
29#include <tdeabc/addressbook.h>
30#include <tdeabc/addresseelist.h>
31#include <klibloader.h>
32#include <kxmlguiclient.h>
33#include <tdemacros.h>
34
35#define KAB_XXPORT_PLUGIN_VERSION 1
36
37class TDEApplication;
38
46#define K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libname, XXPortClass, catalog ) \
47 class TDE_NO_EXPORT localXXPortFactory : public KAB::XXPortFactory { \
48 KAB::XXPort *xxportObject( TDEABC::AddressBook *ab, TQWidget *parent, const char *name ) \
49 { const char *cat = catalog; \
50 if (cat) TDEGlobal::locale()->insertCatalogue(cat); \
51 return new XXPortClass( ab, parent, name ); \
52 } \
53 }; \
54 K_EXPORT_COMPONENT_FACTORY( libname, localXXPortFactory )
55
62#define K_EXPORT_KADDRESSBOOK_XXFILTER( libname, XXPortClass ) \
63 K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libname, XXPortClass, NULL )
64
65
66namespace KAB {
67
68class TDE_EXPORT XXPort : public TQObject, virtual public KXMLGUIClient
69{
70 TQ_OBJECT
71
72
73 public:
74 XXPort( TDEABC::AddressBook *ab, TQWidget *parent, const char *name = 0 );
75 ~XXPort();
76
81 virtual TQString identifier() const = 0;
82
87 virtual bool requiresSorting() const { return false; }
88
93 void setTDEApplication( TDEApplication *app );
94
101 void processEvents() const;
102
103 public slots:
107 virtual bool exportContacts( const TDEABC::AddresseeList &list, const TQString& identifier );
108
112 virtual TDEABC::AddresseeList importContacts( const TQString& identifier ) const;
113
114 signals:
120 void exportActivated( const TQString&, const TQString& );
121
127 void importActivated( const TQString&, const TQString& );
128
129 protected:
133 void createImportAction( const TQString &label, const TQString &identifier = TQString() );
134
138 void createExportAction( const TQString &label, const TQString &identifier = TQString() );
139
143 TDEABC::AddressBook *addressBook() const;
144
149 TQWidget *parentWidget() const;
150
151 private slots:
152 void slotImportActivated( const TQString& );
153 void slotExportActivated( const TQString& );
154
155 private:
156 TDEABC::AddressBook *mAddressBook;
157 TQWidget *mParentWidget;
158
159 class XXPortPrivate;
160 XXPortPrivate *d;
161};
162
163class XXPortFactory : public KLibFactory
164{
165 public:
166 virtual XXPort *xxportObject( TDEABC::AddressBook *ab, TQWidget *parent,
167 const char *name = 0 ) = 0;
168
169 protected:
170 virtual TQObject* createObject( TQObject*, const char*, const char*,
171 const TQStringList & )
172 {
173 return 0;
174 }
175};
176
177
178} /* namespace KAB */
179
180#endif