downloaddialog.h
00001 /* 00002 This file is part of KNewStuff. 00003 Copyright (c) 2003 Josef Spillner <spillner@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef KNEWSTUFF_DOWNLOADDIALOG_H 00021 #define KNEWSTUFF_DOWNLOADDIALOG_H 00022 00023 #include <kdialogbase.h> 00024 #include <knewstuff/provider.h> 00025 00026 namespace KIO 00027 { 00028 class Job; 00029 } 00030 00031 class KListView; 00032 class TQTextBrowser; 00033 class TQFrame; 00034 class KNewStuffGeneric; 00035 00036 namespace KNS 00037 { 00038 00039 class ProviderLoader; 00040 class Entry; 00041 class Provider; 00042 class Engine; 00043 00057 class KDE_EXPORT DownloadDialog : public KDialogBase 00058 { 00059 Q_OBJECT 00060 struct Private; 00061 public: 00070 DownloadDialog(Engine *engine, TQWidget *parent, const TQString& caption); 00071 00079 DownloadDialog(TQWidget *parent, const TQString& caption); 00080 00084 ~DownloadDialog(); 00085 00091 void setType(TQString type); 00092 // ### KDE 4.0: use const TQString& 00093 00098 void load(); 00099 00108 void setProviderList(const TQString& providerList); 00109 00118 void load(TQString providerList); // KDE4: merge with load() above 00119 00126 void addProvider(Provider *p); 00127 00134 void addEntry(Entry *entry); 00135 00144 void addEntry(Entry *entry, const TQStringList& variants); 00145 00150 void clear(); 00151 00159 DownloadDialog(Engine *engine, TQWidget *parent = 0); 00160 // ### KDE 4.0: remove and make caption/parent argument optional 00161 00168 DownloadDialog(TQWidget *parent = 0); 00169 // ### KDE 4.0: remove and make caption/parent argument optional 00170 00180 static void open(const TQString& type, const TQString& caption); 00181 00191 static void open(TQString type) KDE_DEPRECATED; // ### KDE 4.0: remove and make caption/parent argument optional 00192 00198 TQPtrList<Entry> installedEntries(); 00199 // ### KDE 4.0: the open() method should return this 00200 00201 public slots: 00207 void slotProviders(Provider::List *list); 00208 00209 protected slots: 00210 void slotApply(); 00211 void slotOk(); 00212 00213 private slots: 00214 void slotResult(KIO::Job *job); 00215 void slotData(KIO::Job *job, const TQByteArray &a); 00216 void slotInstall(); 00217 void slotDetails(); 00218 void slotInstalled(KIO::Job *job); 00219 void slotTab(); 00220 void slotSelected(); 00221 void slotPage(TQWidget *w); 00222 void slotFinish(); 00223 void slotEmail(const TQString& link); 00224 00225 private: 00226 void init(Engine *e); 00227 Entry *getEntry(); 00228 void loadProvider(Provider *p); 00229 void install(Entry *e); 00230 int installStatus(Entry *e); 00231 TQListViewItem *currentEntryItem(); 00232 00233 ProviderLoader *m_loader; 00234 TQString m_entryname; 00235 KListView *lv_r, *lv_d, *lv_l; 00236 TQTextBrowser *m_rt; 00237 TQFrame *m_frame; 00238 TQListViewItem *m_entryitem; 00239 TQPtrList<Entry> m_entries; 00240 Entry *m_entry; 00241 KNewStuffGeneric *m_s; 00242 int m_curtab; 00243 TQMap<TQWidget*, TQValueList<KListView*>* > m_map; 00244 TQMap<TQWidget*, Provider*> m_providers; 00245 TQMap<TQWidget*, TQTextBrowser*> m_rts; 00246 TQMap<TQWidget*, TQValueList<TQPushButton*>* > m_buttons; 00247 TQMap<KIO::Job*, Provider*> m_jobs; 00248 TQMap<KIO::Job*, TQString> m_data; 00249 TQString m_filter; 00250 Engine *m_engine; 00251 Private *d; 00252 }; 00253 00254 } 00255 00256 #endif 00257