provider.h
00001 /* 00002 This file is part of KOrganizer. 00003 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef KNEWSTUFF_PROVIDER_H 00021 #define KNEWSTUFF_PROVIDER_H 00022 00023 #include <tqcstring.h> 00024 #include <tqdom.h> 00025 #include <tqobject.h> 00026 #include <tqptrlist.h> 00027 #include <tqstring.h> 00028 00029 #include <kurl.h> 00030 00031 namespace KIO { class Job; } 00032 00033 namespace KNS { 00034 00046 class KDE_EXPORT Provider 00047 { 00048 public: 00049 typedef TQPtrList<Provider> List; 00050 00054 Provider(); 00055 00059 Provider( const TQDomElement & ); 00060 00064 ~Provider(); 00065 00069 void setName( const TQString & ); 00070 00076 TQString name() const; 00077 00081 void setDownloadUrl( const KURL & ); 00082 00088 KURL downloadUrl() const; 00089 00096 KURL downloadUrlVariant( TQString variant ) const; 00097 00101 void setUploadUrl( const KURL & ); 00102 00108 KURL uploadUrl() const; 00109 00116 void setNoUploadUrl( const KURL & ); 00117 00124 KURL noUploadUrl() const; 00125 00129 void setNoUpload( bool ); 00130 00136 bool noUpload() const; 00137 00143 void setIcon( const KURL & ); 00144 00150 KURL icon() const; 00151 00152 protected: 00153 void parseDomElement( const TQDomElement & ); 00154 00155 TQDomElement createDomElement( TQDomDocument &, TQDomElement &parent ); 00156 00157 private: 00158 TQString mName; 00159 KURL mDownloadUrl; 00160 KURL mUploadUrl; 00161 KURL mNoUploadUrl; 00162 KURL mIcon; 00163 bool mNoUpload; 00164 }; 00165 00172 class KDE_EXPORT ProviderLoader : public TQObject 00173 { 00174 Q_OBJECT 00175 public: 00181 ProviderLoader( TQWidget *parentWidget ); 00182 00192 void load( const TQString &type, const TQString &providerList = TQString::null ); 00193 00194 signals: 00198 void providersLoaded( Provider::List * ); 00199 00200 protected slots: 00201 void slotJobData( KIO::Job *, const TQByteArray & ); 00202 void slotJobResult( KIO::Job * ); 00203 00204 private: 00205 TQWidget *mParentWidget; 00206 00207 TQString mJobData; 00208 00209 Provider::List mProviders; 00210 }; 00211 00212 } 00213 00214 #endif