downloaddialog.h
00001 /* 00002 This file is part of TDENewStuff. 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 <tdenewstuff/provider.h> 00025 00026 namespace TDEIO 00027 { 00028 class Job; 00029 } 00030 00031 class TDEListView; 00032 class TQTextBrowser; 00033 class TQFrame; 00034 class TDENewStuffGeneric; 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(TDEIO::Job *job); 00215 void slotData(TDEIO::Job *job, const TQByteArray &a); 00216 void slotJobData( TDEIO::Job *, const TQByteArray & ); 00217 void slotJobResult( TDEIO::Job * ); 00218 void slotInstall(); 00219 void slotInstallPhase2(); 00220 void slotDetails(); 00221 void slotInstalled(TDEIO::Job *job); 00222 void slotTab(); 00223 void slotSelected(); 00224 void slotPage(TQWidget *w); 00225 void slotFinish(); 00226 void slotEmail(const TQString& link); 00227 00228 private: 00229 void init(Engine *e); 00230 Entry *getEntry(); 00231 void loadProvider(Provider *p); 00232 void install(Entry *e); 00233 int installStatus(Entry *e); 00234 TQListViewItem *currentEntryItem(); 00235 00236 ProviderLoader *m_loader; 00237 TQString m_entryname; 00238 TDEListView *lv_r, *lv_d, *lv_l; 00239 TQTextBrowser *m_rt; 00240 TQFrame *m_frame; 00241 TQListViewItem *m_entryitem; 00242 TQPtrList<Entry> m_entries; 00243 Entry *m_entry; 00244 TDENewStuffGeneric *m_s; 00245 int m_curtab; 00246 TQMap<TQWidget*, TQValueList<TDEListView*>* > m_map; 00247 TQMap<TQWidget*, Provider*> m_providers; 00248 TQMap<TQWidget*, TQTextBrowser*> m_rts; 00249 TQMap<TQWidget*, TQValueList<TQPushButton*>* > m_buttons; 00250 TQMap<TDEIO::Job*, Provider*> m_jobs; 00251 TQMap<TDEIO::Job*, TQString> m_data; 00252 TQString m_filter; 00253 TQString mJobData; 00254 Engine *m_engine; 00255 Private *d; 00256 }; 00257 00258 } 00259 00260 #endif 00261