diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-16 09:06:37 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-16 09:06:37 +0000 |
commit | 39d98386f72c65826e162e3e8fd36752ec469252 (patch) | |
tree | 5cec746207c4c892d064beafca1de94568a3aeb9 /sip/kio/authinfo.sip | |
download | pytde-39d98386f72c65826e162e3e8fd36752ec469252.tar.gz pytde-39d98386f72c65826e162e3e8fd36752ec469252.zip |
Move python-kde3 to the more correct python-trinity
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/libraries/python-trinity@1247483 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'sip/kio/authinfo.sip')
-rw-r--r-- | sip/kio/authinfo.sip | 210 |
1 files changed, 210 insertions, 0 deletions
diff --git a/sip/kio/authinfo.sip b/sip/kio/authinfo.sip new file mode 100644 index 0000000..0a835a6 --- /dev/null +++ b/sip/kio/authinfo.sip @@ -0,0 +1,210 @@ +// +// Copyright 2006 Jim Bublitz <[email protected]> +// 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. + +namespace KIO +{ + +class AuthInfo +{ +%TypeHeaderCode +#include <authinfo.h> +%End + + +public: + AuthInfo (); + AuthInfo (const KIO::AuthInfo&); + bool isModified () const; + void setModified (bool); + KURL url; + QString username; + QString password; + QString prompt; + QString caption; + QString comment; + QString commentLabel; + QString realmValue; + QString digestInfo; + bool verifyPath; + bool readOnly; + bool keepPassword; + +protected: + +}; // class AuthInfo + + +%If ( KDE_3_1_4 - ) +//igx QDataStream& operator << (QDataStream&, const KIO::AuthInfo&); +//igx QDataStream& operator >> (QDataStream&, KIO::AuthInfo&); +%End + + +class NetRC +{ +%TypeHeaderCode +#include <authinfo.h> +%End + + +public: + + enum LookUpMode + { + exactOnly, + defaultOnly, + presetOnly + }; + + + class AutoLogin + { + + public: + QString type; + QString machine; + QString login; + QString password; + KStringListMap macdef; + + }; // class AutoLogin + + +public: + static KIO::NetRC* self (); + bool lookup (const KURL&, KIO::NetRC::AutoLogin&, bool = 0, QString = QString ::null , int = 6); + void reload (); + +protected: +//ig QString extract (const char*, const char*, int&); + int openf (const QString&); + +%If ( KDE_3_2_0 - ) + bool parse (int); +%End + + +private: + NetRC (); + ~NetRC (); + +protected: + +%If ( - KDE_3_2_0 ) + void parse (int); +%End + + +}; // class NetRC + +}; // namespace KIO + + + +%MappedType KStringListMap +{ +//converts a Python dict of QString:QStringList +%TypeHeaderCode +#include <qmap.h> +typedef QMap<QString, QStringList> KStringListMap; +%End + +%ConvertFromTypeCode + // Convert to a Python dict. + + if (!sipCpp) + return PyDict_New(); + + PyObject *dict; + + // Create the dictionary. + + if ((dict = PyDict_New()) == NULL) + return NULL; + + // Get it. + + const QMap<QString, QStringList> map = *sipCpp; + QMap<QString, QStringList>::ConstIterator it; + + for (it = map.begin (); it != map.end (); ++it) + { + PyObject *sKey = PyString_FromString ((const char *)((QString)it.key ())); + PyObject *sData = sipConvertFromInstance ((void *)&it.data (), sipClass_QStringList, sipTransferObj); + + if ((sKey == NULL) || (sData == NULL) || (PyDict_SetItem (dict, sKey, sData) < 0)) + { + Py_XDECREF (sKey); + Py_XDECREF (sData); + Py_DECREF (dict); + return NULL; + } + } + + return dict; +%End + + +%ConvertToTypeCode + if (sipIsErr == NULL) + return PyDict_Check(sipPy); + + QMap<QString, QStringList> *map = new QMap<QString, QStringList>; + + PyObject *key, *value; + SIP_SSIZE_T pos = 0; + QString *sKey; + QStringList *sData; + + while (PyDict_Next(sipPy, &pos, &key, &value)) + { + int iserr = 0, sKey_state, sData_state; + + sKey = (QString *)sipForceConvertToType(key, sipType_QString, sipTransferObj, SIP_NOT_NONE, &sKey_state, &iserr); + sData = (QStringList *)sipForceConvertToType(value, sipType_QStringList, sipTransferObj, SIP_NOT_NONE, &sData_state, &iserr); + + if (iserr) + { + if (sKey) + sipReleaseType(sKey, sipType_QString, sKey_state); + + *sipIsErr = 1; + delete map; + return 0; + } + + map->insert (*sKey, *sData); + + sipReleaseType(sKey, sipType_QString, sKey_state); + sipReleaseType(sData, sipType_QStringList, sData_state); + } + + *sipCppPtr = map; + + return 1; +%End +}; + + |