engine.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_ENGINE_H 00021 #define KNEWSTUFF_ENGINE_H 00022 00023 #include <tqmap.h> 00024 #include <tqobject.h> 00025 #include <tqstring.h> 00026 00027 #include "entry.h" 00028 #include "provider.h" 00029 00030 namespace KIO { class Job; } 00031 00032 class KNewStuff; 00033 00034 namespace KNS { 00035 00036 class DownloadDialog; 00037 class UploadDialog; 00038 class ProviderDialog; 00039 00051 class KDE_EXPORT Engine : public TQObject 00052 { 00053 Q_OBJECT 00054 struct Private; 00055 public: 00063 Engine( KNewStuff *newStuff, const TQString &type, TQWidget *parentWidget = 0 ); 00072 Engine( KNewStuff *newStuff, const TQString &type, const TQString &providerList, TQWidget *parentWidget = 0 ); 00073 00077 virtual ~Engine(); 00078 00084 TQString type() const { return mType; } 00085 00091 TQWidget *parentWidget() const { return mParentWidget; } 00092 00097 void download(); 00098 00106 void upload( const TQString &fileName = TQString::null, const TQString &previewName = TQString::null ); 00107 00113 void download( Entry *entry ); 00114 00121 void requestMetaInformation( Provider *provider ); 00122 00128 void upload( Entry *entry ); 00129 00135 void ignoreInstallResult(bool ignore); 00136 00137 signals: 00141 void uploadFinished( bool result ); 00142 protected slots: 00143 void getMetaInformation( Provider::List *providers ); 00144 void selectUploadProvider( Provider::List *providers ); 00145 00146 void slotNewStuffJobData( KIO::Job *job, const TQByteArray &data ); 00147 void slotNewStuffJobResult( KIO::Job *job ); 00148 00149 void slotDownloadJobResult( KIO::Job *job ); 00150 00151 void slotUploadPayloadJobResult( KIO::Job *job ); 00152 void slotUploadPreviewJobResult (KIO::Job *job ); 00153 void slotUploadMetaJobResult( KIO::Job *job ); 00154 00155 protected: 00156 bool createMetaFile( Entry * ); 00157 00158 private: 00159 TQWidget *mParentWidget; 00160 00161 ProviderLoader *mProviderLoader; 00162 00163 TQMap<KIO::Job *,TQString> mNewStuffJobData; 00164 TQMap<KIO::Job *,Provider *> mProviderJobs; 00165 00166 TQPtrList<Entry> mNewStuffList; 00167 00168 DownloadDialog *mDownloadDialog; 00169 UploadDialog *mUploadDialog; 00170 ProviderDialog *mProviderDialog; 00171 00172 TQString mDownloadDestination; 00173 00174 Provider *mUploadProvider; 00175 00176 TQString mUploadMetaFile; 00177 TQString mUploadFile; 00178 TQString mPreviewFile; 00179 TQString mProviderList; 00180 00181 Private* d; 00182 00183 TQString mType; 00184 }; 00185 00186 } 00187 00188 #endif