diff options
Diffstat (limited to 'python/pykde/sip/kio/kuserprofile.sip')
-rw-r--r-- | python/pykde/sip/kio/kuserprofile.sip | 224 |
1 files changed, 224 insertions, 0 deletions
diff --git a/python/pykde/sip/kio/kuserprofile.sip b/python/pykde/sip/kio/kuserprofile.sip new file mode 100644 index 00000000..7d3d406f --- /dev/null +++ b/python/pykde/sip/kio/kuserprofile.sip @@ -0,0 +1,224 @@ +// +// Copyright 2006 Jim Bublitz <jbublitz@nwinternet.com> +// Earlier copyrights 1998 - 2005 Jim Bublitz and/or Phil Thompson +// may also apply + + +// Generated by preSip +// module kio 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., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +class KServiceOffer +{ +%TypeHeaderCode +#include <kuserprofile.h> +%End + + +public: + KServiceOffer (); + KServiceOffer (const KServiceOffer&); + KServiceOffer (KService::Ptr, int, bool); + +%If ( KDE_3_1_4 - ) + bool operator < (const KServiceOffer&) const; +%End + + bool allowAsDefault () const; + int preference () const; + KService::Ptr service () const; + bool isValid () const; + +}; // class KServiceOffer + + +class KServiceTypeProfile +{ +%TypeHeaderCode +#include <kuserprofile.h> +%End + + +public: + typedef QValueList<KServiceOffer> OfferList; + int preference (const QString&) const; + bool allowAsDefault (const QString&) const; + KServiceTypeProfile::OfferList offers () const; + static KService::Ptr preferredService (const QString&, const QString&); + static KServiceTypeProfile* serviceTypeProfile (const QString&, const QString&); + static KServiceTypeProfile::OfferList offers (const QString&, const QString&); + static const QPtrList<KServiceTypeProfile>& serviceTypeProfiles (); + static void clear (); + static void setConfigurationMode (); + static bool configurationMode (); + +protected: + KServiceTypeProfile (const QString&, const QString& = QString ::null ); + void addService (const QString&, int = 1, bool = 1); + +}; // class KServiceTypeProfile + + + +%MappedType KServiceTypeProfile::OfferList +//converts a Python list of KServiceOffer +{ +%TypeHeaderCode +#include <qvaluelist.h> +#include <kservicetype.h> +#include <kuserprofile.h> +#include <sipkioKServiceOffer.h> +%End + +%ConvertFromTypeCode + if (!sipCpp) + return PyList_New(0); + + // Create the list + PyObject *pylist; + if ((pylist = PyList_New(0)) == NULL) + return NULL; + + QValueList<KServiceOffer> *cpplist = (QValueList<KServiceOffer> *)sipCpp; + PyObject *inst; + + // Get it. + QValueList<KServiceOffer>::Iterator it; + for( it = cpplist->begin(); it != cpplist->end(); ++it ) + { + if (((inst = sipBuildResult (NULL, "N", new KServiceOffer (*it), sipClass_KServiceOffer)) == NULL) + || PyList_Append (pylist, inst) < 0) + { + Py_DECREF (pylist); + return NULL; + } + } + + return pylist; +%End + +%ConvertToTypeCode + if (sipIsErr == NULL) + return PyList_Check(sipPy); + + QValueList<KServiceOffer> *cpplist = new QValueList<KServiceOffer>; + + PyObject *elem; + KServiceOffer *cpp; + int iserr = 0; + + for (int i = 0; i < PyList_Size (sipPy); i++) + { + elem = PyList_GET_ITEM (sipPy, i); + cpp = (KServiceOffer *)sipForceConvertTo_KServiceOffer (elem, &iserr); + + if (iserr) + { + *sipIsErr = 1; + delete cpplist; + return 0; + } + + cpplist->append (*cpp); + } + + *sipCppPtr = cpplist; + + return 1; +%End +}; + + +%MappedType QPtrList<KServiceTypeProfile> +//converts a Python list of KServiceTypeProfile +{ +%TypeHeaderCode +#include <qptrlist.h> +#include <kservicetype.h> +#include <sipkioKServiceTypeProfile.h> +//typedef QPtrList<KServiceTypeProfile> SvcTypeProfileList; +%End + +%ConvertFromTypeCode + // Convert to a Python list of KServiceTypeProfile + + if (!sipCpp) + return PyList_New (0); + + PyObject *plist; + + // Create the list + + if ((plist = PyList_New(0)) == NULL) + return NULL; + + // Get it. + + QPtrList<KServiceTypeProfile> *cList = (QPtrList<KServiceTypeProfile> *)sipCpp; + PyObject *inst; + KServiceTypeProfile *svc; + + for( svc = cList->first (); svc; svc = cList->next ()) + { + inst = sipConvertFromInstance (svc, sipClass_KServiceTypeProfile, sipTransferObj); + if ((inst == NULL) || (PyList_Append (plist, inst) < 0)) + { + Py_XDECREF (inst); + Py_DECREF (plist); + return NULL; + } + } + + return plist; +%End + +%ConvertToTypeCode + // Convert a Python list to SvcTypeProfileList on the heap. + + if (sipIsErr == NULL) + return PyList_Check(sipPy); + + QPtrList<KServiceTypeProfile> *cList = new QPtrList<KServiceTypeProfile>; + + PyObject *elem; + KServiceTypeProfile *service; + int iserr = 0; + + for (int i = 0; i < PyList_Size (sipPy); i++) + { + elem = PyList_GET_ITEM (sipPy, i); + service = (KServiceTypeProfile *)sipForceConvertTo_KServiceTypeProfile (elem, &iserr); + + if (iserr) + { + *sipIsErr = 1; + delete cList; + return 0; + } + + cList->append (service); + } + + *sipCppPtr = cList; + + return 1; +%End +}; + + |