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.
pytde/sip/kio/authinfo.sip

211 lines
4.9 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.
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
};