engine.h
00001 /* 00002 This file is part of KOrganizer. 00003 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 00004 Copyright (c) 2014 Timothy Pearson <kb9vqf@pearsoncomputing.net> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 #ifndef KNEWSTUFF_ENGINE_H 00022 #define KNEWSTUFF_ENGINE_H 00023 00024 #include <tqmap.h> 00025 #include <tqobject.h> 00026 #include <tqstring.h> 00027 00028 #include "entry.h" 00029 #include "provider.h" 00030 00031 namespace TDEIO { class Job; } 00032 00033 class TDENewStuff; 00034 00035 namespace KNS { 00036 00037 class DownloadDialog; 00038 class UploadDialog; 00039 class ProviderDialog; 00040 00052 class KDE_EXPORT Engine : public TQObject 00053 { 00054 Q_OBJECT 00055 struct Private; 00056 public: 00064 Engine( TDENewStuff *newStuff, const TQString &type, TQWidget *parentWidget = 0 ); 00073 Engine( TDENewStuff *newStuff, const TQString &type, const TQString &providerList, TQWidget *parentWidget = 0 ); 00074 00078 virtual ~Engine(); 00079 00085 TQString type() const { return mType; } 00086 00092 TQWidget *parentWidget() const { return mParentWidget; } 00093 00098 void download(); 00099 00107 void upload( const TQString &fileName = TQString::null, const TQString &previewName = TQString::null ); 00108 00114 void download( Entry *entry ); 00115 00122 void requestMetaInformation( Provider *provider ); 00123 00129 void upload( Entry *entry ); 00130 00136 void ignoreInstallResult(bool ignore); 00137 00138 signals: 00142 void uploadFinished( bool result ); 00143 protected slots: 00144 void getMetaInformation( Provider::List *providers ); 00145 void selectUploadProvider( Provider::List *providers ); 00146 00147 void slotNewStuffJobData( TDEIO::Job *job, const TQByteArray &data ); 00148 void slotNewStuffJobResult( TDEIO::Job *job ); 00149 00150 void slotDownloadJobResult( TDEIO::Job *job ); 00151 00152 void slotUploadPayloadJobResult( TDEIO::Job *job ); 00153 void slotUploadPreviewJobResult (TDEIO::Job *job ); 00154 void slotUploadMetaJobResult( TDEIO::Job *job ); 00155 00156 protected: 00157 bool createMetaFile( Entry * ); 00158 00159 private: 00160 TQWidget *mParentWidget; 00161 00162 ProviderLoader *mProviderLoader; 00163 00164 TQMap<TDEIO::Job *,TQString> mNewStuffJobData; 00165 TQMap<TDEIO::Job *,Provider *> mProviderJobs; 00166 00167 TQPtrList<Entry> mNewStuffList; 00168 00169 DownloadDialog *mDownloadDialog; 00170 UploadDialog *mUploadDialog; 00171 ProviderDialog *mProviderDialog; 00172 00173 TQString mDownloadDestination; 00174 00175 Provider *mUploadProvider; 00176 00177 TQString mUploadMetaFile; 00178 TQString mUploadFile; 00179 TQString mPreviewFile; 00180 TQString mProviderList; 00181 00182 Private* d; 00183 00184 TQString mType; 00185 }; 00186 00187 } 00188 00189 #endif