// // Copyright 2006 Jim Bublitz // Earlier copyrights 1998 - 2005 Jim Bublitz and/or Phil Thompson // may also apply // Generated by preSip // module tdeio 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 KService : KSycocaEntry { %TypeHeaderCode #include %End public: //ig typedef TDESharedPtr Ptr; //ig typedef TQValueList List; public: KService (const TQString&, const TQString&, const TQString&); KService (const TQString&); KService (KDesktopFile*); KService (TQDataStream&, int); virtual TQString type () /PyName=type_/; virtual TQString name () const; TQString exec () /PyName=exec_/; TQString library () const; TQString init () const; TQString icon () const; TQPixmap pixmap (TDEIcon::Group, int = 0, int = 0, TQString* = 0) const; bool terminal () const; TQString terminalOptions () const; bool substituteUid () const; TQString username () const; TQString desktopEntryPath () const; TQString desktopEntryName () const; %If ( KDE_3_2_0 - ) TQString menuId () const; TQString storageId () const; %End enum DCOPServiceType_t { DCOP_None, DCOP_Unique, DCOP_Multi, DCOP_Wait }; DCOPServiceType_t DCOPServiceType () const; TQString path () const; TQString comment () const; TQString genericName () const; %If ( KDE_3_2_0 - ) TQString untranslatedGenericName () const; %End TQStringList keywords () const; %If ( KDE_3_1_0 - ) TQStringList categories () const; %End TQStringList serviceTypes () const; bool hasServiceType (const TQString&) const; bool allowAsDefault () const; bool allowMultipleFiles () const; int initialPreference () const; %If ( KDE_3_2_0 - ) int initialPreferenceForMimeType (const TQString&) const; %End void setInitialPreference (int); bool noDisplay () const; %If ( KDE_3_1_0 - ) TQString parentApp () const; %End virtual TQVariant property (const TQString&) const; %If ( KDE_3_2_0 - ) TQVariant property (const TQString&, TQVariant::Type) const; %End virtual TQStringList propertyNames () const; bool isValid () const; %If ( KDE_3_2_0 - ) TQString locateLocal (); %End virtual void load (TQDataStream&); virtual void save (TQDataStream&); %If ( KDE_3_2_0 - ) void setMenuId (const TQString&); void setTerminal (bool); void setTerminalOptions (const TQString&); %End static KService::Ptr serviceByName (const TQString&); static KService::Ptr serviceByDesktopPath (const TQString&); static KService::Ptr serviceByDesktopName (const TQString&); %If ( KDE_3_2_0 - ) static KService::Ptr serviceByMenuId (const TQString&); static KService::Ptr serviceByStorageId (const TQString&); %End static KService::List allServices (); static KService::List allInitServices (); %If ( KDE_3_2_0 - ) static TQString newServicePath (bool, const TQString&, TQString* = 0, const TQStringList* = 0); static void rebuildKSycoca (TQWidget* /Transfer/); %End protected: void init (KDesktopFile*); TQStringList& accessServiceTypes (); %If ( KDE_3_1_1 - ) private: KService (const KService&); %End protected: //igx virtual void virtual_hook (int, void*); }; // class KService %MappedType KService::Ptr //converts KService { %TypeHeaderCode #include #include //typedef TDESharedPtr SvcPtr; //typedef KService::Ptr SvcPtr; %End %ConvertFromTypeCode // Convert to a Python instance if (!sipCpp) return NULL; TDESharedPtr *cPtr = new TDESharedPtr (*(TDESharedPtr *)sipCpp); KService *cpp = cPtr->data (); PyObject *obj = sipConvertFromInstance (cpp, sipClass_KService, sipTransferObj); return obj; %End %ConvertToTypeCode // Convert a Python instance to a Ptr on the heap. if (sipIsErr == NULL) return sipCanConvertToType(sipPy, sipType_KService, SIP_NO_CONVERTORS); int iserr = 0; KService *cpp = (KService *)sipConvertToType(sipPy, sipType_KService, sipTransferObj, SIP_NO_CONVERTORS, NULL, &iserr); if (iserr) { *sipIsErr = 1; return 0; } *sipCppPtr = new TDESharedPtr (cpp); return 1; %End }; %MappedType KService::List //converts a Python list of KService { %TypeHeaderCode #include #include //typedef TDESharedPtr Ptr; //typedef TQValueList SvcList; //typedef KService::List SvcList; typedef TQValueList List; %End %ConvertFromTypeCode // Convert to a Python list of Ptr (KService). #define QUOTE "" if (!sipCpp) return PyList_New (0); PyObject *plist; // Create the list if ((plist = PyList_New(0)) == NULL) return NULL; // Get it. KService::List *cList = (KService::List *)sipCpp; PyObject *inst; TDESharedPtr *svc; KService::List::Iterator it; for( it = cList->begin(); it != cList->end(); ++it ) { TDESharedPtr svcptr = static_cast(*it); svc = &svcptr; inst = sipConvertFromType(svc, sipType_KService_Ptr, 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 List on the heap. if (sipIsErr == NULL) return PyList_Check(sipPy); KService::List *cList = new KService::List; PyObject *elem; KService *service; int iserr = 0; for (int i = 0; i < PyList_Size (sipPy); i++) { elem = PyList_GET_ITEM (sipPy, i); service = (KService *)sipForceConvertToType(elem, sipType_KService, sipTransferObj, SIP_NO_CONVERTORS, NULL, &iserr); if (iserr) { *sipIsErr = 1; delete cList; return 0; } KService::Ptr ptr(service); cList->append (ptr); } *sipCppPtr = cList; return 1; %End };