summaryrefslogtreecommitdiffabout
path: root/kaddressbook/xxportobject.h
authorulf69 <ulf69>2004-08-02 18:28:27 (UTC)
committer ulf69 <ulf69>2004-08-02 18:28:27 (UTC)
commit983127ce46c9ff6663d08dedd450da3fe7dd549b (patch) (side-by-side diff)
treeb6c5bf6bffbddb80ef405a6fc322bfa8bfe13d98 /kaddressbook/xxportobject.h
parent09fe5a5325105b5051d22feb8dae6bb1f9875ff3 (diff)
downloadkdepimpi-983127ce46c9ff6663d08dedd450da3fe7dd549b.zip
kdepimpi-983127ce46c9ff6663d08dedd450da3fe7dd549b.tar.gz
kdepimpi-983127ce46c9ff6663d08dedd450da3fe7dd549b.tar.bz2
implemented the exportclasses for opie, qtopia and sharp as part of kaddressbook and not as additional libraries.
Diffstat (limited to 'kaddressbook/xxportobject.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxportobject.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/kaddressbook/xxportobject.h b/kaddressbook/xxportobject.h
index fddc219..d547855 100644
--- a/kaddressbook/xxportobject.h
+++ b/kaddressbook/xxportobject.h
@@ -1,137 +1,170 @@
/*
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 <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.
*/
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;
};
+
+
+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