You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
190 lines
5.2 KiB
190 lines
5.2 KiB
15 years ago
|
/*
|
||
|
This file is part of KOrganizer.
|
||
|
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
|
||
10 years ago
|
Copyright (c) 2014 Timothy Pearson <kb9vqf@pearsoncomputing.net>
|
||
15 years ago
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library 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
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
#ifndef KNEWSTUFF_ENGINE_H
|
||
|
#define KNEWSTUFF_ENGINE_H
|
||
|
|
||
15 years ago
|
#include <tqmap.h>
|
||
|
#include <tqobject.h>
|
||
|
#include <tqstring.h>
|
||
15 years ago
|
|
||
|
#include "entry.h"
|
||
|
#include "provider.h"
|
||
|
|
||
12 years ago
|
namespace TDEIO { class Job; }
|
||
15 years ago
|
|
||
10 years ago
|
class TDENewStuff;
|
||
15 years ago
|
|
||
|
namespace KNS {
|
||
|
|
||
|
class DownloadDialog;
|
||
|
class UploadDialog;
|
||
|
class ProviderDialog;
|
||
|
|
||
|
/**
|
||
10 years ago
|
* @short Central class combining all possible TDENewStuff operations.
|
||
15 years ago
|
*
|
||
|
* In most cases, Engine objects are built and used internally.
|
||
|
* Using this class explicitely does however give fine-grained control about the
|
||
|
* upload and download operations.
|
||
|
*
|
||
|
* @author Cornelius Schumacher (schumacher@kde.org)
|
||
|
* \par Maintainer:
|
||
|
* Josef Spillner (spillner@kde.org)
|
||
|
*/
|
||
14 years ago
|
class KDE_EXPORT Engine : public TQObject
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
|
struct Private;
|
||
|
public:
|
||
|
/**
|
||
|
Constructor.
|
||
|
|
||
10 years ago
|
@param newStuff a TDENewStuff object
|
||
15 years ago
|
@param type the Hotstuff data type such as "korganizer/calendar"
|
||
14 years ago
|
@param parentWidget the parent window
|
||
15 years ago
|
*/
|
||
10 years ago
|
Engine( TDENewStuff *newStuff, const TQString &type, TQWidget *parentWidget = 0 );
|
||
15 years ago
|
/**
|
||
|
Constructor.
|
||
|
|
||
10 years ago
|
@param newStuff a TDENewStuff object
|
||
15 years ago
|
@param type the Hotstuff data type such as "korganizer/calendar"
|
||
|
@param providerList the URL of the provider list
|
||
14 years ago
|
@param parentWidget the parent window
|
||
15 years ago
|
*/
|
||
10 years ago
|
Engine( TDENewStuff *newStuff, const TQString &type, const TQString &providerList, TQWidget *parentWidget = 0 );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Destructor.
|
||
|
*/
|
||
|
virtual ~Engine();
|
||
|
|
||
|
/**
|
||
|
Returns the previously set data type.
|
||
|
|
||
|
@return the Hotstuff data type
|
||
|
*/
|
||
15 years ago
|
TQString type() const { return mType; }
|
||
15 years ago
|
|
||
|
/**
|
||
|
Returns the previously set parent widget.
|
||
|
|
||
|
@return parent widget
|
||
|
*/
|
||
14 years ago
|
TQWidget *parentWidget() const { return mParentWidget; }
|
||
15 years ago
|
|
||
|
/**
|
||
|
Initiates the download process, retrieving provider lists and invoking
|
||
|
the download dialog.
|
||
|
*/
|
||
|
void download();
|
||
|
|
||
|
/**
|
||
|
Initiates the upload process, invoking the provider selection dialog
|
||
|
and the file upload dialog.
|
||
|
|
||
|
@param fileName name of the payload data file
|
||
|
@param previewName name of the preview image file
|
||
|
*/
|
||
15 years ago
|
void upload( const TQString &fileName = TQString::null, const TQString &previewName = TQString::null );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Downloads the specified data file.
|
||
|
|
||
|
@param entry the Hotstuff data object to be downloaded
|
||
|
*/
|
||
|
void download( Entry *entry );
|
||
|
|
||
|
/**
|
||
|
Asynchronous lookup of provider information such as upload and
|
||
|
download locations, icon etc.
|
||
|
|
||
|
@param provider the Hotstuff provider to request information from
|
||
|
*/
|
||
|
void requestMetaInformation( Provider *provider );
|
||
|
|
||
|
/**
|
||
|
Uploads the specified data file to the provider-dependent location.
|
||
|
|
||
|
@param entry the Hotstuff data object to be uploaded
|
||
|
*/
|
||
|
void upload( Entry *entry );
|
||
|
|
||
|
/**
|
||
|
Ignores the return value of the install method. Used internally to
|
||
|
avoid showing of the success/failure dialog when installation is done
|
||
10 years ago
|
in another place, like in @ref TDENewStuffSecure
|
||
15 years ago
|
*/
|
||
|
void ignoreInstallResult(bool ignore);
|
||
|
|
||
|
signals:
|
||
|
/** Emitted when the upload has finished.
|
||
|
@param result indicates the success/failure of the upload
|
||
|
*/
|
||
|
void uploadFinished( bool result );
|
||
|
protected slots:
|
||
|
void getMetaInformation( Provider::List *providers );
|
||
|
void selectUploadProvider( Provider::List *providers );
|
||
|
|
||
12 years ago
|
void slotNewStuffJobData( TDEIO::Job *job, const TQByteArray &data );
|
||
|
void slotNewStuffJobResult( TDEIO::Job *job );
|
||
15 years ago
|
|
||
12 years ago
|
void slotDownloadJobResult( TDEIO::Job *job );
|
||
15 years ago
|
|
||
12 years ago
|
void slotUploadPayloadJobResult( TDEIO::Job *job );
|
||
|
void slotUploadPreviewJobResult (TDEIO::Job *job );
|
||
|
void slotUploadMetaJobResult( TDEIO::Job *job );
|
||
15 years ago
|
|
||
|
protected:
|
||
|
bool createMetaFile( Entry * );
|
||
|
|
||
|
private:
|
||
15 years ago
|
TQWidget *mParentWidget;
|
||
15 years ago
|
|
||
|
ProviderLoader *mProviderLoader;
|
||
|
|
||
12 years ago
|
TQMap<TDEIO::Job *,TQString> mNewStuffJobData;
|
||
|
TQMap<TDEIO::Job *,Provider *> mProviderJobs;
|
||
15 years ago
|
|
||
15 years ago
|
TQPtrList<Entry> mNewStuffList;
|
||
15 years ago
|
|
||
|
DownloadDialog *mDownloadDialog;
|
||
|
UploadDialog *mUploadDialog;
|
||
|
ProviderDialog *mProviderDialog;
|
||
|
|
||
15 years ago
|
TQString mDownloadDestination;
|
||
15 years ago
|
|
||
|
Provider *mUploadProvider;
|
||
|
|
||
15 years ago
|
TQString mUploadMetaFile;
|
||
|
TQString mUploadFile;
|
||
|
TQString mPreviewFile;
|
||
|
TQString mProviderList;
|
||
15 years ago
|
|
||
|
Private* d;
|
||
|
|
||
15 years ago
|
TQString mType;
|
||
15 years ago
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|