diff options
Diffstat (limited to 'sip/kabc/addressbook.sip')
-rw-r--r-- | sip/kabc/addressbook.sip | 229 |
1 files changed, 229 insertions, 0 deletions
diff --git a/sip/kabc/addressbook.sip b/sip/kabc/addressbook.sip new file mode 100644 index 0000000..a3fa824 --- /dev/null +++ b/sip/kabc/addressbook.sip @@ -0,0 +1,229 @@ +// +// Copyright 2006 Jim Bublitz <jbublitz@nwinternet.com> +// Earlier copyrights 1998 - 2005 Jim Bublitz and/or Phil Thompson +// may also apply + + +// Generated by preSip +// module kabc version KDE 3.5.3 + + +// This software 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 software 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 library; see the file COPYING. +// If not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +namespace KABC +{ + +class AddressBook : QObject +{ +%TypeHeaderCode +#include <resource.h> +#include <addressbook.h> +%End + + +public: + +//ig class Iterator; + + +//ig class ConstIterator; + + AddressBook (); + +%If ( KDE_3_2_0 - ) + AddressBook (const QString&); +%End + + KABC::Ticket* requestSaveTicket (KABC::Resource* = 0); + +%If ( KDE_3_2_0 - ) + void releaseSaveTicket (KABC::Ticket*); +%End + + bool load (); + +%If ( KDE_3_2_0 - ) + bool asyncLoad (); +%End + + bool save (KABC::Ticket*); + +%If ( KDE_3_2_0 - ) + bool asyncSave (KABC::Ticket*); +%End + +//igx KABC::AddressBook::ConstIterator begin () const; +//igx KABC::AddressBook::Iterator begin (); +//igx KABC::AddressBook::ConstIterator end () const; +//igx KABC::AddressBook::Iterator end (); + void clear (); + void insertAddressee (const KABC::Addressee&); + void removeAddressee (const KABC::Addressee&); +//ig void removeAddressee (const KABC::AddressBook::Iterator&); +//igx KABC::AddressBook::Iterator find (const Addressee&); + KABC::Addressee findByUid (const QString&); + +%If ( KDE_3_2_0 - ) + KABC::Addressee::List allAddressees (); +%End + + KABC::Addressee::List findByName (const QString&); + KABC::Addressee::List findByEmail (const QString&); + KABC::Addressee::List findByCategory (const QString&); + virtual QString identifier (); + +%If ( KDE_3_1_0 - ) + KABC::Field::List fields (int = KABC ::Field ::All ); + bool addCustomField (const QString&, int = KABC ::Field ::All , const QString& = QString ::null , const QString& = QString ::null ); +%End + + bool addResource (KABC::Resource*); + +%If ( KDE_3_1_0 - ) + bool removeResource (KABC::Resource*); + QPtrList<KABC::Resource> resources (); + void setErrorHandler (KABC::ErrorHandler*); + void error (const QString&); + void cleanUp (); +%End + + void dump () const; + void emitAddressBookLocked (); + void emitAddressBookUnlocked (); + void emitAddressBookChanged (); + +%If ( KDE_3_5_0 - ) + bool loadingHasFinished () const; +%End + + +signals: + void addressBookChanged (KABC::AddressBook*); + void addressBookLocked (KABC::AddressBook*); + void addressBookUnlocked (KABC::AddressBook*); + +%If ( KDE_3_2_0 - ) + void loadingFinished (KABC::Resource*); + void savingFinished (KABC::Resource*); +%End + + +protected slots: + +%If ( KDE_3_2_0 - ) + void resourceLoadingFinished (KABC::Resource*); + void resourceSavingFinished (KABC::Resource*); + void resourceLoadingError (KABC::Resource*, const QString&); + void resourceSavingError (KABC::Resource*, const QString&); +%End + + +protected: + +%If ( KDE_3_1_0 - ) + void deleteRemovedAddressees (); + void setStandardResource (KABC::Resource*); + KABC::Resource* standardResource (); + +%If ( KDE_3_2_0 - ) +//ig KRES::Manager<KABC::Resource>* resourceManager (); +%End + +%End + + +}; // class AddressBook + + +%If ( KDE_3_1_0 - ) +//igx QDataStream& operator << (QDataStream&, const KABC::AddressBook&); +//igx QDataStream& operator >> (QDataStream&, KABC::AddressBook&); +%End + +}; // namespace KABC + + + +%MappedType QPtrList<KABC::Resource> +//converts a Python list of KABC::Resource +{ +%TypeHeaderCode +#include <qptrlist.h> +%End + +%ConvertFromTypeCode + if (!sipCpp) + return PyList_New (0); + + PyObject *pylist; + + // Create the list + + if ((pylist = PyList_New(0)) == NULL) + return NULL; + + // Get it. + + QPtrList<KABC::Resource> *cpplist = (QPtrList<KABC::Resource> *)sipCpp; + KABC::Resource *cpp; + PyObject *inst; + + // the loop depends on the type of iterator the tmeplate makes available + for(cpp = cpplist->first (); cpp != 0; cpp = cpplist->next () ) + { + if (((inst = sipConvertFromInstance (cpp, sipClass_KABC_Resource, sipTransferObj)) == NULL) + || PyList_Append (pylist, inst) < 0) + { + Py_DECREF (pylist); + return NULL; + } + } + + return pylist; +%End + +%ConvertToTypeCode + if (sipIsErr == NULL) + return PyList_Check(sipPy); + + QPtrList<KABC::Resource> *cpplist = new QPtrList<KABC::Resource>; + + PyObject *elem; + KABC::Resource *cpp; + int iserr = 0; + + for (int i = 0; i < PyList_Size (sipPy); i++) + { + elem = PyList_GET_ITEM (sipPy, i); + cpp = (KABC::Resource *)sipForceConvertToType(elem, sipType_KABC_Resource, sipTransferObj, SIP_NO_CONVERTORS, NULL, &iserr); + + if (iserr) + { + *sipIsErr = 1; + delete cpplist; + return 0; + } + + cpplist->append (cpp); + } + + *sipCppPtr = cpplist; + + return 1; +%End +}; + + |