summaryrefslogtreecommitdiffabout
path: root/kaddressbook/xxportobject.h
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (side-by-side diff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /kaddressbook/xxportobject.h
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'kaddressbook/xxportobject.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxportobject.h157
1 files changed, 157 insertions, 0 deletions
diff --git a/kaddressbook/xxportobject.h b/kaddressbook/xxportobject.h
new file mode 100644
index 0000000..d697700
--- a/dev/null
+++ b/kaddressbook/xxportobject.h
@@ -0,0 +1,157 @@
+/*
+ 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., 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 <kxmlguiclient.h>
+#ifndef KAB_EMBEDDED
+#include <klibloader.h>
+#endif //KAB_EMBEDDED
+
+
+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; }
+
+ 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.
+ */
+ void importActivated( const QString&, const QString& );
+
+ protected:
+ /**
+ Create the import action. The identifier is passed in the import slot.
+ */
+ void createImportAction( const QString &label, const QString &identifier = QString::null );
+
+ /**
+ Create the export action. The identifier is passed in the export slot.
+ */
+ void createExportAction( const QString &label, const QString &identifier = QString::null );
+
+ /**
+ 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;
+};
+
+#ifndef KAB_EMBEDDED
+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;
+ }
+};
+
+#else //KAB_EMBEDDED
+class XXPortFactory
+{
+ 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 //KAB_EMBEDDED
+
+
+#endif