summaryrefslogtreecommitdiffstats
path: root/lib/compatibility/knewstuff/downloaddialog.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite9ae80694875f869892f13f4fcaf1170a00dea41 (patch)
treeaa2f8d8a217e2d376224c8d46b7397b68d35de2d /lib/compatibility/knewstuff/downloaddialog.h
downloadtdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.tar.gz
tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/compatibility/knewstuff/downloaddialog.h')
-rw-r--r--lib/compatibility/knewstuff/downloaddialog.h237
1 files changed, 237 insertions, 0 deletions
diff --git a/lib/compatibility/knewstuff/downloaddialog.h b/lib/compatibility/knewstuff/downloaddialog.h
new file mode 100644
index 00000000..34b2b22b
--- /dev/null
+++ b/lib/compatibility/knewstuff/downloaddialog.h
@@ -0,0 +1,237 @@
+/*
+ This file is part of KNewStuff.
+ 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>
+#include <knewstuff/provider.h>
+
+namespace KIO
+{
+ class Job;
+}
+
+class KListView;
+class QTextBrowser;
+class QFrame;
+class KNewStuffGeneric;
+
+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
+ * KNewStuff::DownloadDialog::open("kdesktop/wallpapers");
+ * \endcode
+ *
+ * @author Josef Spillner (spillner@kde.org)
+ * \par Maintainer:
+ * Josef Spillner (spillner@kde.org)
+ */
+class KDE_EXPORT DownloadDialog : public KDialogBase
+{
+ Q_OBJECT
+ 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
+ */
+ DownloadDialog(Engine *engine, QWidget *parent, const QString& caption);
+
+ /**
+ Alternative constructor.
+ Always uses an internal engine.
+
+ @param parent the parent window
+ @param caption the dialog caption
+ */
+ DownloadDialog(QWidget *parent, const QString& caption);
+
+ /**
+ Destructor.
+ */
+ ~DownloadDialog();
+
+ /**
+ Restricts the display of available data to a certain data type.
+
+ @param type a Hotstuff data type such as "korganizer/calendar"
+ */
+ void setType(QString type);
+ // ### KDE 4.0: use const QString&
+
+ /**
+ 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
+ */
+ void setProviderList(const QString& providerList);
+
+ /**
+ Fetches descriptions of all available data, optionally considering
+ a previously set type.
+
+ @param providerList the URl to the list of providers; if empty
+ we first try the ProvidersUrl from KGlobal::config, then we
+ fall back to a hardcoded value.
+ */
+ void load(QString providerList); // KDE4: merge with load() above
+
+ /**
+ 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);
+
+ /**
+ Clears the entry list of the current provider.
+ This is normally done internally.
+ */
+ void clear();
+
+ /**
+ 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
+ */
+ static void open(const QString& type, const QString& caption);
+
+ /**
+ 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
+ */
+ DownloadDialog(Engine *engine, QWidget *parent = 0);
+ // ### KDE 4.0: remove and make caption/parent argument optional
+
+ /**
+ Alternative constructor.
+ Always uses an internal engine.
+
+ @param parent the parent window
+ */
+ DownloadDialog(QWidget *parent = 0);
+ // ### 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"
+ */
+ static void open(QString type);
+ // ### KDE 4.0: remove and make caption/parent argument optional
+
+ 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:
+ void slotResult(KIO::Job *job);
+ void slotData(KIO::Job *job, const QByteArray &a);
+ void slotInstall();
+ void slotDetails();
+ void slotInstalled(KIO::Job *job);
+ void slotTab(int tab);
+ void slotSelected();
+ void slotPage(QWidget *w);
+ void slotFinish();
+
+ private:
+ void init(Engine *e);
+ Entry *getEntry();
+ void loadProvider(Provider *p);
+ void install(Entry *e);
+ int installStatus(Entry *e);
+
+ ProviderLoader *m_loader;
+ QString m_entryname;
+ KListView *lv_r, *lv_d, *lv_l;
+ QTextBrowser *m_rt;
+ QFrame *m_frame;
+ QListViewItem *m_entryitem;
+ QPtrList<Entry> m_entries;
+ Entry *m_entry;
+ KNewStuffGeneric *m_s;
+ int m_curtab;
+ QMap<QWidget*, QValueList<KListView*>* > m_map;
+ QMap<QWidget*, Provider*> m_providers;
+ QMap<QWidget*, QTextBrowser*> m_rts;
+ QMap<QWidget*, QValueList<QPushButton*>* > m_buttons;
+ QMap<KIO::Job*, Provider*> m_jobs;
+ QMap<KIO::Job*, QString> m_data;
+ QString m_filter;
+ QString m_providerlist;
+ Engine *m_engine;
+ QWidget *m_page;
+};
+
+}
+
+#endif
+