// // Copyright 2006 Jim Bublitz // 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. %ModuleHeaderCode #include #include #include %End namespace KIO { typedef longlong fileoffset_t; typedef ulonglong filesize_t; QString convertSize (KIO::filesize_t); %If ( KDE_3_5_0 - ) QString convertSizeWithBytes (KIO::filesize_t); %End QString number (KIO::filesize_t); QString convertSizeFromKB (KIO::filesize_t); %If ( KDE_3_4_0 - ) uint calculateRemainingSeconds (KIO::filesize_t, KIO::filesize_t, KIO::filesize_t); QString convertSeconds (uint); %End QTime calculateRemaining (KIO::filesize_t, KIO::filesize_t, KIO::filesize_t); QString itemsSummaryString (uint, uint, uint, KIO::filesize_t, bool); QString encodeFileName (const QString&); QString decodeFileName (const QString&); %If ( KDE_3_2_0 - ) enum Command { CMD_HOST, CMD_CONNECT, CMD_DISCONNECT, CMD_SLAVE_STATUS, CMD_SLAVE_CONNECT, CMD_SLAVE_HOLD, CMD_NONE, CMD_TESTDIR, CMD_GET, CMD_PUT, CMD_STAT, CMD_MIMETYPE, CMD_LISTDIR, CMD_MKDIR, CMD_RENAME, CMD_COPY, CMD_DEL, CMD_CHMOD, CMD_SPECIAL, CMD_USERPASS, CMD_REPARSECONFIGURATION, CMD_META_DATA, CMD_SYMLINK, CMD_SUBURL, CMD_MESSAGEBOXANSWER, CMD_RESUMEANSWER, CMD_CONFIG, CMD_MULTI_GET }; %End %If ( KDE_3_1_0 - ) enum Error { ERR_CANNOT_OPEN_FOR_READING, ERR_CANNOT_OPEN_FOR_WRITING, ERR_CANNOT_LAUNCH_PROCESS, ERR_INTERNAL, ERR_MALFORMED_URL, ERR_UNSUPPORTED_PROTOCOL, ERR_NO_SOURCE_PROTOCOL, ERR_UNSUPPORTED_ACTION, ERR_IS_DIRECTORY, ERR_IS_FILE, ERR_DOES_NOT_EXIST, ERR_FILE_ALREADY_EXIST, ERR_DIR_ALREADY_EXIST, ERR_UNKNOWN_HOST, ERR_ACCESS_DENIED, ERR_WRITE_ACCESS_DENIED, ERR_CANNOT_ENTER_DIRECTORY, ERR_PROTOCOL_IS_NOT_A_FILESYSTEM, ERR_CYCLIC_LINK, ERR_USER_CANCELED, ERR_CYCLIC_COPY, ERR_COULD_NOT_CREATE_SOCKET, ERR_COULD_NOT_CONNECT, ERR_CONNECTION_BROKEN, ERR_NOT_FILTER_PROTOCOL, ERR_COULD_NOT_MOUNT, ERR_COULD_NOT_UNMOUNT, ERR_COULD_NOT_READ, ERR_COULD_NOT_WRITE, ERR_COULD_NOT_BIND, ERR_COULD_NOT_LISTEN, ERR_COULD_NOT_ACCEPT, ERR_COULD_NOT_LOGIN, ERR_COULD_NOT_STAT, ERR_COULD_NOT_CLOSEDIR, ERR_COULD_NOT_MKDIR, ERR_COULD_NOT_RMDIR, ERR_CANNOT_RESUME, ERR_CANNOT_RENAME, ERR_CANNOT_CHMOD, ERR_CANNOT_DELETE, ERR_SLAVE_DIED, ERR_OUT_OF_MEMORY, ERR_UNKNOWN_PROXY_HOST, ERR_COULD_NOT_AUTHENTICATE, ERR_ABORTED, ERR_INTERNAL_SERVER, ERR_SERVER_TIMEOUT, ERR_SERVICE_NOT_AVAILABLE, ERR_UNKNOWN, ERR_UNKNOWN_INTERRUPT, ERR_CANNOT_DELETE_ORIGINAL, ERR_CANNOT_DELETE_PARTIAL, ERR_CANNOT_RENAME_ORIGINAL, ERR_CANNOT_RENAME_PARTIAL, ERR_NEED_PASSWD, ERR_CANNOT_SYMLINK, ERR_NO_CONTENT, ERR_DISK_FULL, ERR_IDENTICAL_FILES, ERR_SLAVE_DEFINED, ERR_UPGRADE_REQUIRED, ERR_POST_DENIED }; %End QString buildErrorString (int, const QString&); //ig QString buildHTMLErrorString (int, const QString&, const KURL* = 0, int = -1); QByteArray rawErrorDetail (int, const QString&, const KURL* = 0, int = -1); %If ( KDE_3_2_0 - ) QString unsupportedActionErrorString (const QString&, int); %If ( KDE_3_5_1 - ) enum UDSAtomTypes { UDS_STRING, UDS_LONG, UDS_TIME, UDS_SIZE, UDS_SIZE_LARGE, UDS_USER, UDS_ICON_NAME, UDS_GROUP, UDS_EXTRA, UDS_NAME, UDS_LOCAL_PATH, UDS_HIDDEN, UDS_EXTENDED_ACL, UDS_ACL_STRING, UDS_DEFAULT_ACL_STRING, UDS_ACCESS, UDS_MODIFICATION_TIME, UDS_ACCESS_TIME, UDS_CREATION_TIME, UDS_FILE_TYPE, UDS_LINK_DEST, UDS_URL, UDS_MIME_TYPE, UDS_GUESSED_MIME_TYPE, UDS_XML_PROPERTIES }; %End %End %If ( KDE_3_0_1 - ) enum CacheControl { CC_CacheOnly, CC_Cache, CC_Verify, CC_Refresh, CC_Reload }; %End KIO::CacheControl parseCacheControl (const QString&); QString getCacheControlString (KIO::CacheControl); QString findDeviceMountPoint (const QString&); QString findPathMountPoint (const QString&); bool probably_slow_mounted (const QString&); %If ( KDE_3_1_0 - ) bool manually_mounted (const QString&); %If ( KDE_3_2_0 - ) enum FileSystemFlag { SupportsChmod, SupportsChown, SupportsUTime, SupportsSymlinks, CaseInsensitive }; bool testFileSystemFlag (const QString&, KIO::FileSystemFlag); %End %End class UDSAtom { %TypeHeaderCode #include %End public: QString m_str; long m_long; uint m_uds; }; // class UDSAtom //ig typedef QValueList UDSEntry; //ig typedef QValueList UDSEntryList; //ig typedef QValueListIterator UDSEntryListIterator; //ig typedef QValueListConstIterator UDSEntryListConstIterator; %If ( KDE_3_4_0 - KDE_3_5_1 ) enum UDSAtomTypes { UDS_STRING, UDS_LONG, UDS_TIME, UDS_SIZE, UDS_SIZE_LARGE, UDS_USER, UDS_ICON_NAME, UDS_GROUP, UDS_EXTRA, UDS_NAME, UDS_LOCAL_PATH, UDS_ACCESS, UDS_MODIFICATION_TIME, UDS_ACCESS_TIME, UDS_CREATION_TIME, UDS_FILE_TYPE, UDS_LINK_DEST, UDS_URL, UDS_MIME_TYPE, UDS_GUESSED_MIME_TYPE, UDS_XML_PROPERTIES }; %End %If ( KDE_3_2_0 - KDE_3_4_0 ) enum UDSAtomTypes { UDS_STRING, UDS_LONG, UDS_TIME, UDS_SIZE, UDS_SIZE_LARGE, UDS_USER, UDS_ICON_NAME, UDS_GROUP, UDS_EXTRA, UDS_NAME, UDS_ACCESS, UDS_MODIFICATION_TIME, UDS_ACCESS_TIME, UDS_CREATION_TIME, UDS_FILE_TYPE, UDS_LINK_DEST, UDS_URL, UDS_MIME_TYPE, UDS_GUESSED_MIME_TYPE, UDS_XML_PROPERTIES }; %End %If ( KDE_3_1_0 - KDE_3_2_0 ) enum UDSAtomTypes { UDS_STRING, UDS_LONG, UDS_TIME, UDS_SIZE, UDS_SIZE_LARGE, UDS_USER, UDS_GROUP, UDS_NAME, UDS_ACCESS, UDS_MODIFICATION_TIME, UDS_ACCESS_TIME, UDS_CREATION_TIME, UDS_FILE_TYPE, UDS_LINK_DEST, UDS_URL, UDS_MIME_TYPE, UDS_GUESSED_MIME_TYPE, UDS_XML_PROPERTIES }; %End %If ( - KDE_3_1_0 ) enum UDSAtomTypes { UDS_STRING, UDS_LONG, UDS_TIME, UDS_SIZE, UDS_SIZE_LARGE, UDS_USER, UDS_GROUP, UDS_NAME, UDS_ACCESS, UDS_MODIFICATION_TIME, UDS_ACCESS_TIME, UDS_CREATION_TIME, UDS_FILE_TYPE, UDS_LINK_DEST, UDS_URL, UDS_MIME_TYPE, UDS_GUESSED_MIME_TYPE }; enum Error { ERR_CANNOT_OPEN_FOR_READING, ERR_CANNOT_OPEN_FOR_WRITING, ERR_CANNOT_LAUNCH_PROCESS, ERR_INTERNAL, ERR_MALFORMED_URL, ERR_UNSUPPORTED_PROTOCOL, ERR_NO_SOURCE_PROTOCOL, ERR_UNSUPPORTED_ACTION, ERR_IS_DIRECTORY, ERR_IS_FILE, ERR_DOES_NOT_EXIST, ERR_FILE_ALREADY_EXIST, ERR_DIR_ALREADY_EXIST, ERR_UNKNOWN_HOST, ERR_ACCESS_DENIED, ERR_WRITE_ACCESS_DENIED, ERR_CANNOT_ENTER_DIRECTORY, ERR_PROTOCOL_IS_NOT_A_FILESYSTEM, ERR_CYCLIC_LINK, ERR_USER_CANCELED, ERR_CYCLIC_COPY, ERR_COULD_NOT_CREATE_SOCKET, ERR_COULD_NOT_CONNECT, ERR_CONNECTION_BROKEN, ERR_NOT_FILTER_PROTOCOL, ERR_COULD_NOT_MOUNT, ERR_COULD_NOT_UNMOUNT, ERR_COULD_NOT_READ, ERR_COULD_NOT_WRITE, ERR_COULD_NOT_BIND, ERR_COULD_NOT_LISTEN, ERR_COULD_NOT_ACCEPT, ERR_COULD_NOT_LOGIN, ERR_COULD_NOT_STAT, ERR_COULD_NOT_CLOSEDIR, ERR_COULD_NOT_MKDIR, ERR_COULD_NOT_RMDIR, ERR_CANNOT_RESUME, ERR_CANNOT_RENAME, ERR_CANNOT_CHMOD, ERR_CANNOT_DELETE, ERR_SLAVE_DIED, ERR_OUT_OF_MEMORY, ERR_UNKNOWN_PROXY_HOST, ERR_COULD_NOT_AUTHENTICATE, ERR_ABORTED, ERR_INTERNAL_SERVER, ERR_SERVER_TIMEOUT, ERR_SERVICE_NOT_AVAILABLE, ERR_UNKNOWN, ERR_UNKNOWN_INTERRUPT, ERR_CANNOT_DELETE_ORIGINAL, ERR_CANNOT_DELETE_PARTIAL, ERR_CANNOT_RENAME_ORIGINAL, ERR_CANNOT_RENAME_PARTIAL, ERR_NEED_PASSWD, ERR_CANNOT_SYMLINK, ERR_NO_CONTENT, ERR_DISK_FULL, ERR_IDENTICAL_FILES, ERR_SLAVE_DEFINED }; %If ( - KDE_3_0_1 ) enum CacheControl { CC_CacheOnly, CC_Cache, CC_Verify, CC_Reload }; %End %End //force //ig typedef QMap MetaData; //end }; // namespace KIO //force KIO::UDSEntry testKIOUDSEntry (KIO::UDSEntry); %MethodCode //takes list | (KIO.UDSEntry) //returns (KIO.UDSEntry) sipRes = a0; %End %ModuleHeaderCode #include %End KIO::UDSEntryList testKIOUDSEntryList (KIO::UDSEntryList); %MethodCode //takes list | (KIO.UDSEntryList) //returns (KIO.UDSEntryList) sipRes = a0; %End %ModuleHeaderCode #include #include %End KIO::MetaData testKIOMetaData (KIO::MetaData); %MethodCode //takes dict | (KIO.MetaData) //returns (KIO.MetaData) PyObject *dict; if (sipParseArgs(&sipArgsParsed,sipArgs,"T", &PyDict_Type, &dict)) { int isErr = 0; KIO::MetaData *map = (KIO::MetaData *)sipForceConvertTo_KIO_MetaData (dict, &isErr); if (isErr) { Py_INCREF (Py_None); return Py_None; } return sipConvertFrom_KIO_MetaData ((KIO::MetaData *)map, NULL); } %End //end %MappedType KIO::UDSEntry //converts a Python list of KIO.UDSAtom { %TypeHeaderCode #include #include #include #include %End %ConvertFromTypeCode if (!sipCpp) return PyList_New(0); // Create the list PyObject *pylist; if ((pylist = PyList_New(0)) == NULL) return NULL; QValueList *cpplist = (QValueList *)sipCpp; PyObject *inst; // Get it. QValueList::Iterator it; for( it = cpplist->begin(); it != cpplist->end(); ++it ) { if (((inst = sipBuildResult (NULL, "N", new KIO::UDSAtom (*it), sipClass_KIO_UDSAtom)) == NULL) || PyList_Append (pylist, inst) < 0) { Py_DECREF (pylist); return NULL; } } return pylist; %End %ConvertToTypeCode if (sipIsErr == NULL) return PyList_Check(sipPy); QValueList *cpplist = new QValueList; PyObject *elem; KIO::UDSAtom *cpp; int iserr = 0; for (int i = 0; i < PyList_Size (sipPy); i++) { elem = PyList_GET_ITEM (sipPy, i); cpp = (KIO::UDSAtom *)sipForceConvertTo_KIO_UDSAtom (elem, &iserr); if (iserr) { *sipIsErr = 1; delete cpplist; return 0; } cpplist->append (*cpp); } *sipCppPtr = cpplist; return 1; %End }; %MappedType KIO::UDSEntryList //converts a Python list of KIO.UDSEntry { %TypeHeaderCode #include #include #include %End %ConvertFromTypeCode if (!sipCpp) return PyList_New(0); // Create the list PyObject *pylist; if ((pylist = PyList_New(0)) == NULL) return NULL; QValueList *cpplist = (QValueList *)sipCpp; PyObject *inst; // Get it. QValueList::Iterator it; for( it = cpplist->begin(); it != cpplist->end(); ++it ) { KIO::UDSEntry cpp = *it; inst = sipConvertFrom_KIO_UDSEntry (&cpp, sipTransferObj); if (PyList_Append (pylist, inst) < 0) { Py_DECREF (pylist); return NULL; } } return pylist; %End %ConvertToTypeCode if (sipIsErr == NULL) return PyList_Check(sipPy); QValueList *cpplist = new QValueList; PyObject *elem; KIO::UDSEntry *cpp; int iserr = 0; for (int i = 0; i < PyList_Size (sipPy); i++) { elem = PyList_GET_ITEM (sipPy, i); cpp = (KIO::UDSEntry *)sipForceConvertTo_KIO_UDSEntry (elem, &iserr); if (iserr) { *sipIsErr = 1; delete cpplist; return 0; } cpplist->append (*cpp); } *sipCppPtr = cpplist; return 1; %End }; %MappedType KIO::MetaData //converts a Python dict of QString, QString { %TypeHeaderCode #include #include #include %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 cppmap = *sipCpp; QMap::ConstIterator it; for (it = cppmap.begin (); it != cppmap.end (); ++it) { QString acpp = it.key (); QString bcpp = it.data (); PyObject *ainst; PyObject *binst; if (((ainst = sipBuildResult (NULL, "N", new QString (acpp), sipClass_QString)) == NULL) || ((binst = sipBuildResult (NULL, "N", new QString (bcpp), sipClass_QString)) == NULL) || (PyDict_SetItem (dict, ainst, binst) < 0)) { Py_XDECREF (ainst); Py_XDECREF (binst); Py_DECREF (dict); return NULL; } } return dict; %End %ConvertToTypeCode // Convert a Python dictionary to a QMap on the heap. if (sipIsErr == NULL) return PyDict_Check(sipPy); QMap *cppmap = new QMap; PyObject *aelem, *belem; int pos = 0; QString *acpp; QString *bcpp; while (PyDict_Next(sipPy, &pos, &aelem, &belem)) { int iserr = 0; acpp = (QString *)sipForceConvertTo_QString (aelem, &iserr); bcpp = (QString *)sipForceConvertTo_QString (belem, &iserr); if (iserr) { *sipIsErr = 1; delete cppmap; return 0; } cppmap->insert (*acpp, *bcpp); } *sipCppPtr = (KIO::MetaData *)cppmap; return 1; %End };