knewstuff Library API Documentation

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., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 #ifndef KNEWSTUFF_ENGINE_H
00021 #define KNEWSTUFF_ENGINE_H
00022 
00023 #include <qmap.h>
00024 #include <qobject.h>
00025 #include <qstring.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 Engine : public QObject
00052 {
00053     Q_OBJECT
00054   public:
00062     Engine( KNewStuff *newStuff, const QString &type, QWidget *parentWidget = 0 );
00071     Engine( KNewStuff *newStuff, const QString &type, const QString &providerList, QWidget *parentWidget = 0 );
00072 
00076     virtual ~Engine();
00077 
00083     QString type() const { return mType; }
00084 
00090     QWidget *parentWidget() const { return mParentWidget; }
00091 
00096     void download();
00097 
00105     void upload( const QString &fileName = QString::null, const QString &previewName = QString::null );
00106 
00112     void download( Entry *entry );
00113 
00120     void requestMetaInformation( Provider *provider );
00121 
00127     void upload( Entry *entry );
00128 
00129   protected slots:
00130     void getMetaInformation( Provider::List *providers );
00131     void selectUploadProvider( Provider::List *providers );
00132 
00133     void slotNewStuffJobData( KIO::Job *job, const QByteArray &data );
00134     void slotNewStuffJobResult( KIO::Job *job );
00135 
00136     void slotDownloadJobResult( KIO::Job *job );
00137 
00138     void slotUploadPayloadJobResult( KIO::Job *job );
00139     void slotUploadPreviewJobResult (KIO::Job *job );
00140     void slotUploadMetaJobResult( KIO::Job *job );
00141 
00142   protected:
00143     bool createMetaFile( Entry * );
00144 
00145   private:
00146     QWidget *mParentWidget;
00147 
00148     ProviderLoader *mProviderLoader;
00149 
00150     QMap<KIO::Job *,QString> mNewStuffJobData;
00151     QMap<KIO::Job *,Provider *> mProviderJobs;
00152 
00153     QPtrList<Entry> mNewStuffList;
00154 
00155     DownloadDialog *mDownloadDialog;
00156     UploadDialog *mUploadDialog;
00157     ProviderDialog *mProviderDialog;
00158 
00159     QString mDownloadDestination;
00160 
00161     Provider *mUploadProvider;
00162 
00163     QString mUploadMetaFile;
00164     QString mUploadFile;
00165     QString mPreviewFile;
00166     QString mProviderList;
00167 
00168     KNewStuff *mNewStuff;
00169 
00170     QString mType;
00171 };
00172 
00173 }
00174 
00175 #endif
KDE Logo
This file is part of the documentation for knewstuff Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Feb 18 15:10:56 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003