1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
/*
This file is part of KAddressbook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
As a special exception, permission is given to link this program
with any edition of TQt, and distribute the resulting executable,
without including the source code for TQt in the source distribution.
*/
#ifndef KAB_XXPORT_H
#define KAB_XXPORT_H
#include <tqobject.h>
#include <tdeabc/addressbook.h>
#include <tdeabc/addresseelist.h>
#include <klibloader.h>
#include <kxmlguiclient.h>
#include <tdepimmacros.h>
#define KAB_XXPORT_PLUGIN_VERSION 1
class TDEApplication;
/**
K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG() creates the stub for a KAddressbook import/export filter.
@libname filename of the shared library, e.g. libkaddrbk_bookmark_xxport
@XXPortClass the import/export class - derived from the XXPort class
@catalog catalog file to search for translation lookup (NULL if no catalog needed)
@see: K_EXPORT_COMPONENT_FACTORY()
*/
#define K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libname, XXPortClass, catalog ) \
class KDE_NO_EXPORT localXXPortFactory : public KAB::XXPortFactory { \
KAB::XXPort *xxportObject( KABC::AddressBook *ab, TQWidget *parent, const char *name ) \
{ const char *cat = catalog; \
if (cat) TDEGlobal::locale()->insertCatalogue(cat); \
return new XXPortClass( ab, parent, name ); \
} \
}; \
K_EXPORT_COMPONENT_FACTORY( libname, localXXPortFactory )
/**
K_EXPORT_KADDRESSBOOK_XXFILTER() creates the stub for a KAddressbook import/export filter.
@libname filename of the shared library, e.g. libkaddrbk_bookmark_xxport
@XXPortClass the import/export class - derived from the XXPort class
@see: K_EXPORT_COMPONENT_FACTORY()
*/
#define K_EXPORT_KADDRESSBOOK_XXFILTER( libname, XXPortClass ) \
K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libname, XXPortClass, NULL )
namespace KAB {
class KDE_EXPORT XXPort : public TQObject, virtual public KXMLGUIClient
{
Q_OBJECT
public:
XXPort( KABC::AddressBook *ab, TQWidget *parent, const char *name = 0 );
~XXPort();
/**
Returns the unique identifier of this xxport modul, it should
be the lowercase name of the import/export format e.g. 'vcard'
*/
virtual TQString identifier() const = 0;
/**
Reimplement this method if the XXPortManager shall
pass a sorted list to @ref exportContacts().
*/
virtual bool requiresSorting() const { return false; }
/**
set the TDEApplication pointer.
@see: processEvents()
*/
void setTDEApplication( TDEApplication *app );
/**
Processes outstanding TDEApplication events. It should be called
occasionally when the import/export filter is busy performing
a long operation (e.g. reading from slow external devices).
@see: TQApplication::processEvents()
*/
void processEvents() const;
public slots:
/**
Reimplement this method for exporting the contacts.
*/
virtual bool exportContacts( const KABC::AddresseeList &list, const TQString& identifier );
/**
Reimplement this method for importing the contacts.
*/
virtual KABC::AddresseeList importContacts( const TQString& identifier ) const;
signals:
/**
Emitted whenever the export action is activated.
The parameter contains the @ref identifier() for
unique identification.
*/
void exportActivated( const TQString&, const TQString& );
/**
Emitted whenever the import action is activated.
The parameter contains the @ref identifier() for
unique identification.
*/
void importActivated( const TQString&, const TQString& );
protected:
/**
Create the import action. The identifier is passed in the import slot.
*/
void createImportAction( const TQString &label, const TQString &identifier = TQString() );
/**
Create the export action. The identifier is passed in the export slot.
*/
void createExportAction( const TQString &label, const TQString &identifier = TQString() );
/**
Returns a pointer to the address book object.
*/
KABC::AddressBook *addressBook() const;
/**
Returns a pointer to the parent widget. It can be used as parent for
message boxes.
*/
TQWidget *parentWidget() const;
private slots:
void slotImportActivated( const TQString& );
void slotExportActivated( const TQString& );
private:
KABC::AddressBook *mAddressBook;
TQWidget *mParentWidget;
class XXPortPrivate;
XXPortPrivate *d;
};
class XXPortFactory : public KLibFactory
{
public:
virtual XXPort *xxportObject( KABC::AddressBook *ab, TQWidget *parent,
const char *name = 0 ) = 0;
protected:
virtual TQObject* createObject( TQObject*, const char*, const char*,
const TQStringList & )
{
return 0;
}
};
} /* namespace KAB */
#endif
|