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.
262 lines
7.1 KiB
262 lines
7.1 KiB
15 years ago
|
/*
|
||
10 years ago
|
This file is part of TDENewStuff.
|
||
15 years ago
|
Copyright (c) 2003 Josef Spillner <spillner@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_DOWNLOADDIALOG_H
|
||
|
#define KNEWSTUFF_DOWNLOADDIALOG_H
|
||
|
|
||
|
#include <kdialogbase.h>
|
||
10 years ago
|
#include <tdenewstuff/provider.h>
|
||
15 years ago
|
|
||
12 years ago
|
namespace TDEIO
|
||
15 years ago
|
{
|
||
|
class Job;
|
||
|
}
|
||
|
|
||
12 years ago
|
class TDEListView;
|
||
14 years ago
|
class TQTextBrowser;
|
||
|
class TQFrame;
|
||
10 years ago
|
class TDENewStuffGeneric;
|
||
15 years ago
|
|
||
|
namespace KNS
|
||
|
{
|
||
|
|
||
|
class ProviderLoader;
|
||
|
class Entry;
|
||
|
class Provider;
|
||
|
class Engine;
|
||
|
|
||
|
/**
|
||
|
* @short Common download dialog for data browsing and installation.
|
||
|
*
|
||
|
* It provides an easy-to-use convenience method named open() which does all
|
||
|
* the work, unless a more complex operation is needed.
|
||
|
* \code
|
||
10 years ago
|
* TDENewStuff::DownloadDialog::open("kdesktop/wallpapers");
|
||
15 years ago
|
* \endcode
|
||
|
*
|
||
|
* @author Josef Spillner (spillner@kde.org)
|
||
|
* \par Maintainer:
|
||
|
* Josef Spillner (spillner@kde.org)
|
||
|
*/
|
||
|
class KDE_EXPORT DownloadDialog : public KDialogBase
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
struct Private;
|
||
|
public:
|
||
|
/**
|
||
|
Constructor.
|
||
|
|
||
|
@param engine a pre-built engine object, or NULL if the download
|
||
|
dialog should create an engine on its own
|
||
|
@param parent the parent window
|
||
|
@param caption the dialog caption
|
||
|
*/
|
||
15 years ago
|
DownloadDialog(Engine *engine, TQWidget *parent, const TQString& caption);
|
||
15 years ago
|
|
||
|
/**
|
||
|
Alternative constructor.
|
||
|
Always uses an internal engine.
|
||
|
|
||
|
@param parent the parent window
|
||
|
@param caption the dialog caption
|
||
|
*/
|
||
15 years ago
|
DownloadDialog(TQWidget *parent, const TQString& caption);
|
||
15 years ago
|
|
||
|
/**
|
||
|
Destructor.
|
||
|
*/
|
||
|
~DownloadDialog();
|
||
|
|
||
|
/**
|
||
|
Restricts the display of available data to a certain data type.
|
||
|
|
||
|
@param type a Hotstuff data type such as "korganizer/calendar"
|
||
|
*/
|
||
15 years ago
|
void setType(TQString type);
|
||
|
// ### KDE 4.0: use const TQString&
|
||
15 years ago
|
|
||
|
/**
|
||
|
Fetches descriptions of all available data, optionally considering
|
||
|
a previously set type.
|
||
|
*/
|
||
|
void load();
|
||
|
|
||
|
/**
|
||
|
Explicitly uses this provider list instead of the one read from
|
||
|
the application configuration.
|
||
|
|
||
|
@param providerList the URL of the provider list
|
||
|
|
||
|
@since 3.4
|
||
|
*/
|
||
15 years ago
|
void setProviderList(const TQString& providerList);
|
||
15 years ago
|
|
||
|
/**
|
||
|
Fetches descriptions of all available data, optionally considering
|
||
|
a previously set type.
|
||
|
|
||
|
@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(TQString providerList); // KDE4: merge with load() above
|
||
15 years ago
|
|
||
|
/**
|
||
|
Adds another provider to the download dialog.
|
||
|
This is normally done internally.
|
||
|
|
||
|
@param p the Hotstuff provider to be added
|
||
|
*/
|
||
|
void addProvider(Provider *p);
|
||
|
|
||
|
/**
|
||
|
Adds an additional entry to the current provider.
|
||
|
This is normally done internally.
|
||
|
|
||
|
@param entry a Hotstuff data entry to be added
|
||
|
*/
|
||
|
void addEntry(Entry *entry);
|
||
|
|
||
|
/**
|
||
|
Adds an additional entry to the current provider.
|
||
|
This is normally done internal.
|
||
|
This version takes into accounts the download variant.
|
||
|
|
||
|
@param entry a Hotstuff data entry to be added
|
||
|
@param variants all variants this entry is intended for
|
||
|
*/
|
||
15 years ago
|
void addEntry(Entry *entry, const TQStringList& variants);
|
||
15 years ago
|
|
||
|
/**
|
||
|
Clears the entry list of the current provider.
|
||
|
This is normally done internally.
|
||
|
*/
|
||
|
void clear();
|
||
|
|
||
|
/**
|
||
|
Constructor.
|
||
|
|
||
|
@param engine a pre-built engine object, or NULL if the download
|
||
|
dialog should create an engine on its own
|
||
|
@param parent the parent window
|
||
|
*/
|
||
15 years ago
|
DownloadDialog(Engine *engine, TQWidget *parent = 0);
|
||
15 years ago
|
// ### KDE 4.0: remove and make caption/parent argument optional
|
||
|
|
||
|
/**
|
||
|
Alternative constructor.
|
||
|
Always uses an internal engine.
|
||
|
|
||
|
@param parent the parent window
|
||
|
*/
|
||
15 years ago
|
DownloadDialog(TQWidget *parent = 0);
|
||
15 years ago
|
// ### KDE 4.0: remove and make caption/parent argument optional
|
||
|
|
||
|
/**
|
||
|
Opens the download dialog.
|
||
|
This is a convenience method which automatically sets up the dialog.
|
||
|
@see setType()
|
||
|
@see load()
|
||
|
|
||
|
@param type a data type such as "korganizer/calendar"
|
||
|
@param caption the dialog caption
|
||
|
*/
|
||
15 years ago
|
static void open(const TQString& type, const TQString& caption);
|
||
15 years ago
|
|
||
|
/**
|
||
|
Opens the download dialog.
|
||
|
This is a convenience method which automatically sets up the dialog.
|
||
|
@see setType()
|
||
|
@see load()
|
||
|
|
||
|
@param type a data type such as "korganizer/calendar"
|
||
15 years ago
|
@deprecated use open( const TQString& type, const TQString& caption );
|
||
15 years ago
|
*/
|
||
15 years ago
|
static void open(TQString type) KDE_DEPRECATED; // ### KDE 4.0: remove and make caption/parent argument optional
|
||
15 years ago
|
|
||
|
/**
|
||
|
Returns the list of installed data entries.
|
||
|
|
||
|
@return list of data entries which have been installed
|
||
|
*/
|
||
15 years ago
|
TQPtrList<Entry> installedEntries();
|
||
15 years ago
|
// ### KDE 4.0: the open() method should return this
|
||
|
|
||
|
public slots:
|
||
|
/**
|
||
|
Availability of the provider list.
|
||
|
|
||
|
@param list list of Hotstuff providers
|
||
|
*/
|
||
|
void slotProviders(Provider::List *list);
|
||
|
|
||
|
protected slots:
|
||
|
void slotApply();
|
||
|
void slotOk();
|
||
|
|
||
|
private slots:
|
||
12 years ago
|
void slotResult(TDEIO::Job *job);
|
||
|
void slotData(TDEIO::Job *job, const TQByteArray &a);
|
||
10 years ago
|
void slotJobData( TDEIO::Job *, const TQByteArray & );
|
||
|
void slotJobResult( TDEIO::Job * );
|
||
15 years ago
|
void slotInstall();
|
||
10 years ago
|
void slotInstallPhase2();
|
||
15 years ago
|
void slotDetails();
|
||
12 years ago
|
void slotInstalled(TDEIO::Job *job);
|
||
15 years ago
|
void slotTab();
|
||
|
void slotSelected();
|
||
15 years ago
|
void slotPage(TQWidget *w);
|
||
15 years ago
|
void slotFinish();
|
||
15 years ago
|
void slotEmail(const TQString& link);
|
||
15 years ago
|
|
||
|
private:
|
||
|
void init(Engine *e);
|
||
|
Entry *getEntry();
|
||
|
void loadProvider(Provider *p);
|
||
|
void install(Entry *e);
|
||
14 years ago
|
int installStatus(Entry *e);
|
||
15 years ago
|
TQListViewItem *currentEntryItem();
|
||
15 years ago
|
|
||
|
ProviderLoader *m_loader;
|
||
15 years ago
|
TQString m_entryname;
|
||
12 years ago
|
TDEListView *lv_r, *lv_d, *lv_l;
|
||
15 years ago
|
TQTextBrowser *m_rt;
|
||
|
TQFrame *m_frame;
|
||
|
TQListViewItem *m_entryitem;
|
||
|
TQPtrList<Entry> m_entries;
|
||
15 years ago
|
Entry *m_entry;
|
||
10 years ago
|
TDENewStuffGeneric *m_s;
|
||
15 years ago
|
int m_curtab;
|
||
12 years ago
|
TQMap<TQWidget*, TQValueList<TDEListView*>* > m_map;
|
||
15 years ago
|
TQMap<TQWidget*, Provider*> m_providers;
|
||
|
TQMap<TQWidget*, TQTextBrowser*> m_rts;
|
||
|
TQMap<TQWidget*, TQValueList<TQPushButton*>* > m_buttons;
|
||
12 years ago
|
TQMap<TDEIO::Job*, Provider*> m_jobs;
|
||
|
TQMap<TDEIO::Job*, TQString> m_data;
|
||
15 years ago
|
TQString m_filter;
|
||
10 years ago
|
TQString mJobData;
|
||
15 years ago
|
Engine *m_engine;
|
||
|
Private *d;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|
||
|
|