You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
223 lines
5.7 KiB
223 lines
5.7 KiB
//
|
|
// 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.,
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 TQValueList<KServiceOffer> OfferList;
|
|
int preference (const TQString&) const;
|
|
bool allowAsDefault (const TQString&) const;
|
|
KServiceTypeProfile::OfferList offers () const;
|
|
static KService::Ptr preferredService (const TQString&, const TQString&);
|
|
static KServiceTypeProfile* serviceTypeProfile (const TQString&, const TQString&);
|
|
static KServiceTypeProfile::OfferList offers (const TQString&, const TQString&);
|
|
static const TQPtrList<KServiceTypeProfile>& serviceTypeProfiles ();
|
|
static void clear ();
|
|
static void setConfigurationMode ();
|
|
static bool configurationMode ();
|
|
|
|
protected:
|
|
KServiceTypeProfile (const TQString&, const TQString& = TQString ::null );
|
|
void addService (const TQString&, 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>
|
|
%End
|
|
|
|
%ConvertFromTypeCode
|
|
if (!sipCpp)
|
|
return PyList_New(0);
|
|
|
|
// Create the list
|
|
PyObject *pylist;
|
|
if ((pylist = PyList_New(0)) == NULL)
|
|
return NULL;
|
|
|
|
TQValueList<KServiceOffer> *cpplist = (TQValueList<KServiceOffer> *)sipCpp;
|
|
PyObject *inst;
|
|
|
|
// Get it.
|
|
TQValueList<KServiceOffer>::Iterator it;
|
|
for( it = cpplist->begin(); it != cpplist->end(); ++it )
|
|
{
|
|
if (((inst = sipConvertFromNewType(new KServiceOffer(*it), sipType_KServiceOffer, NULL)) == NULL)
|
|
|| PyList_Append (pylist, inst) < 0)
|
|
{
|
|
Py_DECREF (pylist);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return pylist;
|
|
%End
|
|
|
|
%ConvertToTypeCode
|
|
if (sipIsErr == NULL)
|
|
return PyList_Check(sipPy);
|
|
|
|
TQValueList<KServiceOffer> *cpplist = new TQValueList<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 *)sipForceConvertToType(elem, sipType_KServiceOffer, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);
|
|
|
|
if (iserr)
|
|
{
|
|
*sipIsErr = 1;
|
|
delete cpplist;
|
|
return 0;
|
|
}
|
|
|
|
cpplist->append (*cpp);
|
|
}
|
|
|
|
*sipCppPtr = cpplist;
|
|
|
|
return 1;
|
|
%End
|
|
};
|
|
|
|
|
|
%MappedType TQPtrList<KServiceTypeProfile>
|
|
//converts a Python list of KServiceTypeProfile
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qptrlist.h>
|
|
#include <kservicetype.h>
|
|
//typedef TQPtrList<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.
|
|
|
|
TQPtrList<KServiceTypeProfile> *cList = (TQPtrList<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);
|
|
|
|
TQPtrList<KServiceTypeProfile> *cList = new TQPtrList<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 *)sipForceConvertToType(elem, sipType_KServiceTypeProfile, sipTransferObj, SIP_NO_CONVERTORS, NULL, &iserr);
|
|
|
|
if (iserr)
|
|
{
|
|
*sipIsErr = 1;
|
|
delete cList;
|
|
return 0;
|
|
}
|
|
|
|
cList->append (service);
|
|
}
|
|
|
|
*sipCppPtr = cList;
|
|
|
|
return 1;
|
|
%End
|
|
};
|
|
|
|
|