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.
162 lines
5.2 KiB
162 lines
5.2 KiB
15 years ago
|
/*
|
||
|
This file is part of KOrganizer.
|
||
|
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
|
||
|
|
||
|
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_H
|
||
|
#define KNEWSTUFF_H
|
||
|
|
||
14 years ago
|
#include <tqstring.h>
|
||
15 years ago
|
|
||
|
#include <kdemacros.h>
|
||
|
|
||
14 years ago
|
class TQObject;
|
||
|
class TQWidget;
|
||
12 years ago
|
class TDEAction;
|
||
|
class TDEActionCollection;
|
||
15 years ago
|
|
||
|
namespace KNS {
|
||
|
class Engine;
|
||
|
class Entry;
|
||
|
|
||
12 years ago
|
KDE_EXPORT TDEAction* standardAction(const TQString& what,
|
||
14 years ago
|
const TQObject *recvr,
|
||
15 years ago
|
const char *slot,
|
||
12 years ago
|
TDEActionCollection* parent,
|
||
15 years ago
|
const char *name = 0);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @short This class provides the functionality to download and upload "new stuff".
|
||
|
*
|
||
10 years ago
|
* Applications have to subclass TDENewStuff, implement the pure virtual functions
|
||
15 years ago
|
* and link to against libknewstuff.
|
||
|
*
|
||
|
* By calling download() the download process is started which means that a list
|
||
|
* of "providers" is fetched from a "master server", information about new stuff
|
||
|
* is collected from the providers and presented to the user. Selected entries
|
||
|
* get downloaded and installed to the application. The required functions to
|
||
|
* install new stuff are provided by implementing install(). The location where
|
||
|
* the downloaded files are stored can be customized by reimplementing
|
||
|
* downloadDestination().
|
||
|
*
|
||
|
* By calling upload() the upload process is started which means the user has to
|
||
|
* select a provider from the list fetched from the master server and to put in
|
||
|
* information about the entry to be uploaded. Then the file to be uploaded is
|
||
|
* fetched from the application by calling createUploadFile() and transfered to
|
||
|
* the upload destination specified in the provider list.
|
||
|
*
|
||
|
* @author Cornelius Schumacher (schumacher@kde.org)
|
||
|
* \par Maintainer:
|
||
|
* Josef Spillner (spillner@kde.org)
|
||
|
*
|
||
|
* @since 3.3
|
||
|
*/
|
||
10 years ago
|
class KDE_EXPORT TDENewStuff
|
||
15 years ago
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Constructor.
|
||
|
|
||
|
@param type type of data to be handled, should be something like
|
||
|
korganizer/calendar, kword/template, kdesktop/wallpaper
|
||
10 years ago
|
@param parentWidget parent widget of dialogs opened by the TDENewStuff
|
||
15 years ago
|
engine
|
||
|
*/
|
||
10 years ago
|
TDENewStuff( const TQString &type, TQWidget *parentWidget = 0 );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Constructor.
|
||
|
|
||
|
@param type type of data to be handled, should be something like
|
||
|
korganizer/calendar, kword/template, kdesktop/wallpaper
|
||
|
@param providerList the URL of the provider list
|
||
10 years ago
|
@param parentWidget parent widget of dialogs opened by the TDENewStuff
|
||
15 years ago
|
engine
|
||
|
*/
|
||
10 years ago
|
TDENewStuff( const TQString &type, const TQString &providerList, TQWidget *parentWidget = 0 );
|
||
|
virtual ~TDENewStuff();
|
||
15 years ago
|
|
||
|
/**
|
||
|
Return type of data.
|
||
|
*/
|
||
14 years ago
|
TQString type() const;
|
||
15 years ago
|
|
||
|
/**
|
||
|
Return parent widget.
|
||
|
*/
|
||
14 years ago
|
TQWidget *parentWidget() const;
|
||
15 years ago
|
|
||
|
/**
|
||
|
Start download process.
|
||
|
*/
|
||
|
void download();
|
||
|
|
||
|
/**
|
||
|
Start upload process.
|
||
|
*/
|
||
|
void upload();
|
||
|
|
||
|
/**
|
||
|
Upload with pre-defined files.
|
||
|
*/
|
||
14 years ago
|
void upload( const TQString &fileName, const TQString previewName );
|
||
15 years ago
|
|
||
|
/**
|
||
|
Install file to application. The given fileName points to the file
|
||
10 years ago
|
downloaded by the TDENewStuff engine. This is a temporary file by default.
|
||
15 years ago
|
The application can do whatever is needed to handle the information
|
||
|
contained in the file.
|
||
|
|
||
|
The function returns true, when the installation
|
||
|
was successful and false if were errors.
|
||
|
|
||
|
@param fileName name of downloaded file
|
||
|
*/
|
||
14 years ago
|
virtual bool install( const TQString &fileName ) = 0;
|
||
15 years ago
|
/**
|
||
|
Create a file to be uploaded to a "new stuff provider" and return the
|
||
|
filename. The format of the file is application specific. The only
|
||
|
constraint is that the corresponding install() implementation is able to
|
||
|
use the file.
|
||
|
|
||
|
@param fileName name of the file to be written
|
||
|
@return @c true on success, @c false on error.
|
||
|
*/
|
||
14 years ago
|
virtual bool createUploadFile( const TQString &fileName ) = 0;
|
||
15 years ago
|
|
||
|
/**
|
||
|
Return a filename which should be used as destination for downloading the
|
||
|
specified new stuff entry. Reimplement this function, if you don't want
|
||
|
the new stuff to be downloaded to a temporary file.
|
||
|
*/
|
||
14 years ago
|
virtual TQString downloadDestination( KNS::Entry *entry );
|
||
15 years ago
|
|
||
|
|
||
|
protected:
|
||
|
/**
|
||
|
Get the pointer to the engine. Needed by subclasses to access the KNS::Engine object.
|
||
|
*/
|
||
|
KNS::Engine *engine() { return mEngine; }
|
||
|
|
||
|
|
||
|
private:
|
||
|
KNS::Engine *mEngine;
|
||
|
};
|
||
|
|
||
|
#endif
|