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.
236 lines
5.5 KiB
236 lines
5.5 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_PROVIDER_H
|
||
|
#define KNEWSTUFF_PROVIDER_H
|
||
|
|
||
15 years ago
|
#include <tqcstring.h>
|
||
|
#include <tqdom.h>
|
||
|
#include <tqobject.h>
|
||
|
#include <tqptrlist.h>
|
||
|
#include <tqstring.h>
|
||
15 years ago
|
|
||
|
#include <kurl.h>
|
||
|
|
||
12 years ago
|
namespace TDEIO { class Job; }
|
||
15 years ago
|
|
||
|
namespace KNS {
|
||
|
|
||
|
/**
|
||
10 years ago
|
* @short TDENewStuff provider container.
|
||
15 years ago
|
*
|
||
|
* This class provides accessors for the provider object.
|
||
10 years ago
|
* as used by TDENewStuff.
|
||
15 years ago
|
* It should probably not be used directly by the application.
|
||
|
*
|
||
|
* @author Cornelius Schumacher (schumacher@kde.org)
|
||
|
* \par Maintainer:
|
||
|
* Josef Spillner (spillner@kde.org)
|
||
|
*/
|
||
10 years ago
|
class KDE_EXPORT Provider : public TQObject
|
||
15 years ago
|
{
|
||
10 years ago
|
Q_OBJECT
|
||
15 years ago
|
public:
|
||
15 years ago
|
typedef TQPtrList<Provider> List;
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Constructor.
|
||
|
*/
|
||
10 years ago
|
Provider( TQString type = TQString::null, TQWidget* parent = 0 );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Constructor with XML feed.
|
||
|
*/
|
||
10 years ago
|
Provider( const TQDomElement &, TQString type = TQString::null, TQWidget* parent = 0 );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Destructor.
|
||
|
*/
|
||
10 years ago
|
virtual ~Provider();
|
||
|
|
||
|
/**
|
||
|
* @return provider load status
|
||
|
*/
|
||
|
bool loaded();
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Sets the common name of the provider.
|
||
|
*/
|
||
15 years ago
|
void setName( const TQString & );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Retrieves the common name of the provider.
|
||
|
*
|
||
|
* @return provider name
|
||
|
*/
|
||
15 years ago
|
TQString name() const;
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Sets the download URL.
|
||
|
*/
|
||
|
void setDownloadUrl( const KURL & );
|
||
|
|
||
|
/**
|
||
|
* Retrieves the download URL.
|
||
|
*
|
||
|
* @return download URL
|
||
|
*/
|
||
|
KURL downloadUrl() const;
|
||
|
|
||
|
/**
|
||
|
* Variant to retrieve 'tagged' download URLs.
|
||
|
* Variant can be one of 'score', 'downloads', 'latest'.
|
||
|
*
|
||
|
* @return download specific URL
|
||
|
*/
|
||
15 years ago
|
KURL downloadUrlVariant( TQString variant ) const;
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Sets the upload URL.
|
||
|
*/
|
||
|
void setUploadUrl( const KURL & );
|
||
|
|
||
|
/**
|
||
|
* Retrieves the upload URL.
|
||
|
*
|
||
|
* @return upload URL
|
||
|
*/
|
||
|
KURL uploadUrl() const;
|
||
|
|
||
|
/**
|
||
|
* Sets the URL where a user is led if the provider does not support
|
||
|
* uploads.
|
||
|
*
|
||
|
* @see setNoUpload
|
||
|
*/
|
||
|
void setNoUploadUrl( const KURL & );
|
||
|
|
||
|
/**
|
||
|
* Retrieves the URL where a user is led if the provider does not
|
||
|
* support uploads.
|
||
|
*
|
||
|
* @return website URL
|
||
|
*/
|
||
|
KURL noUploadUrl() const;
|
||
|
|
||
|
/**
|
||
|
* Indicate whether provider supports uploads.
|
||
|
*/
|
||
|
void setNoUpload( bool );
|
||
|
|
||
|
/**
|
||
|
* Query whether provider supports uploads.
|
||
|
*
|
||
|
* @return upload support status
|
||
|
*/
|
||
|
bool noUpload() const;
|
||
|
|
||
|
/**
|
||
|
* Sets the URL for an icon for this provider.
|
||
|
* The icon should be in 32x32 format. If not set, the default icon
|
||
|
* of KDialogBase is used.
|
||
|
*/
|
||
|
void setIcon( const KURL & );
|
||
|
|
||
|
/**
|
||
|
* Retrieves the icon URL for this provider.
|
||
|
*
|
||
|
* @return icon URL
|
||
|
*/
|
||
|
KURL icon() const;
|
||
|
|
||
|
protected:
|
||
15 years ago
|
void parseDomElement( const TQDomElement & );
|
||
15 years ago
|
|
||
15 years ago
|
TQDomElement createDomElement( TQDomDocument &, TQDomElement &parent );
|
||
15 years ago
|
|
||
10 years ago
|
protected slots:
|
||
|
void slotJobData( TDEIO::Job *, const TQByteArray & );
|
||
|
void slotJobResult( TDEIO::Job * );
|
||
|
|
||
|
signals:
|
||
|
void providerLoaded();
|
||
|
|
||
15 years ago
|
private:
|
||
15 years ago
|
TQString mName;
|
||
15 years ago
|
KURL mDownloadUrl;
|
||
|
KURL mUploadUrl;
|
||
|
KURL mNoUploadUrl;
|
||
|
KURL mIcon;
|
||
|
bool mNoUpload;
|
||
10 years ago
|
TQString mJobData;
|
||
|
TQString mBaseURL;
|
||
|
TQWidget* mParent;
|
||
|
bool mLoaded;
|
||
|
TQString mContentType;
|
||
15 years ago
|
};
|
||
|
|
||
|
/**
|
||
10 years ago
|
* TDENewStuff provider loader.
|
||
15 years ago
|
* This class sets up a list of all possible providers by querying
|
||
|
* the main provider database for this specific application.
|
||
|
* It should probably not be used directly by the application.
|
||
|
*/
|
||
14 years ago
|
class KDE_EXPORT ProviderLoader : public TQObject
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
/**
|
||
|
* Constructor.
|
||
|
*
|
||
14 years ago
|
* @param parentWidget the parent widget
|
||
15 years ago
|
*/
|
||
14 years ago
|
ProviderLoader( TQWidget *parentWidget );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Starts asynchronously loading the list of providers of the
|
||
|
* specified type.
|
||
|
*
|
||
|
* @param type data type such as 'kdesktop/wallpaper'.
|
||
|
* @param providerList the URl to the list of providers; if empty
|
||
12 years ago
|
* we first try the ProvidersUrl from TDEGlobal::config, then we
|
||
15 years ago
|
* fall back to a hardcoded value.
|
||
|
*/
|
||
15 years ago
|
void load( const TQString &type, const TQString &providerList = TQString::null );
|
||
15 years ago
|
|
||
|
signals:
|
||
|
/**
|
||
|
* Indicates that the list of providers has been successfully loaded.
|
||
|
*/
|
||
|
void providersLoaded( Provider::List * );
|
||
|
|
||
|
protected slots:
|
||
12 years ago
|
void slotJobData( TDEIO::Job *, const TQByteArray & );
|
||
|
void slotJobResult( TDEIO::Job * );
|
||
10 years ago
|
void providerLoaded();
|
||
15 years ago
|
|
||
|
private:
|
||
15 years ago
|
TQWidget *mParentWidget;
|
||
15 years ago
|
|
||
15 years ago
|
TQString mJobData;
|
||
10 years ago
|
TQString mContentType;
|
||
15 years ago
|
|
||
|
Provider::List mProviders;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|