summaryrefslogtreecommitdiffabout
path: root/kaddressbook/xxportobject.h
Side-by-side diff
Diffstat (limited to 'kaddressbook/xxportobject.h') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/xxportobject.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/kaddressbook/xxportobject.h b/kaddressbook/xxportobject.h
index fddc219..d547855 100644
--- a/kaddressbook/xxportobject.h
+++ b/kaddressbook/xxportobject.h
@@ -14,72 +14,83 @@
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef XXPORTOBJECT_H
#define XXPORTOBJECT_H
#include <qobject.h>
#include <kabc/addressbook.h>
#include <kabc/addresseelist.h>
+#include <kabc/resource.h>
#include <kxmlguiclient.h>
#include <klibloader.h>
+
+
+
class XXPortObject : public QObject, virtual public KXMLGUIClient
{
Q_OBJECT
public:
XXPortObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 );
~XXPortObject();
/**
Returns the unique identifier of this xxport modul, it should
be the lowercase name of the import/export format e.g. 'vcard'
*/
virtual QString identifier() const = 0;
/**
Reimplement this method if the XXPortManager shall
pass a sorted list to @ref exportContacts().
*/
virtual bool requiresSorting() const { return false; }
+ /**
+ Returns true if the XXPortObject can be used.
+ One case it can not be used is for example if a needed lib could not be loaded.
+ */
+ virtual bool isAvailable() const { return true; };
+
+
public slots:
/**
Reimplement this method for exporting the contacts.
*/
virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier );
/**
Reimplement this method for importing the contacts.
*/
virtual KABC::AddresseeList importContacts( const QString& identifier ) const;
signals:
/**
Emitted whenever the export action is activated.
The parameter contains the @ref identifier() for
unique identification.
*/
void exportActivated( const QString&, const QString& );
/**
Emitted whenever the import action is activated.
The parameter contains the @ref identifier() for
unique identification.
*/
@@ -99,39 +110,61 @@ class XXPortObject : public QObject, virtual public KXMLGUIClient
/**
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.
*/
QWidget *parentWidget() const;
private slots:
void slotImportActivated( const QString& );
void slotExportActivated( const QString& );
private:
KABC::AddressBook *mAddressBook;
QWidget *mParentWidget;
class XXPortObjectPrivate;
XXPortObjectPrivate *d;
};
+
+
+class XXPortResourceObject : public XXPortObject
+{
+ Q_OBJECT
+
+ public:
+ XXPortResourceObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 );
+ ~XXPortResourceObject();
+
+ /**
+ Returns true if the XXPortObject can be used.
+ One case it can not be used is for example if a needed lib could not be loaded.
+ */
+ virtual bool isAvailable();
+ protected:
+ KABC::Resource* mResource;
+};
+
+
+
+
class XXPortFactory : public KLibFactory
{
public:
virtual XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent,
const char *name = 0 ) = 0;
protected:
virtual QObject* createObject( QObject*, const char*, const char*,
const QStringList & )
{
return 0;
}
};
#endif