KNewStuff
downloaddialog.h
Go to the documentation of this file.
00001 /* 00002 This file is part of KNewStuff2. 00003 Copyright (C) 2005 by Enrico Ros <eros.kde@email.it> 00004 Copyright (C) 2005 - 2007 Josef Spillner <spillner@kde.org> 00005 Copyright (C) 2007 Dirk Mueller <mueller@kde.org> 00006 Copyright (C) 2007 Jeremy Whiting <jpwhiting@kde.org> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Lesser General Public 00010 License as published by the Free Software Foundation; either 00011 version 2.1 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 #ifndef KNEWSTUFF2_UI_DOWNLOADDIALOG_H 00023 #define KNEWSTUFF2_UI_DOWNLOADDIALOG_H 00024 00025 #include <QMutex> 00026 00027 #include <kdialog.h> 00028 #include <ktitlewidget.h> 00029 00030 #include <knewstuff2/dxs/dxsengine.h> 00031 #include <knewstuff2/core/category.h> 00032 00033 #include "ui_DownloadDialog.h" 00034 00035 class KJob; 00036 class KLineEdit; 00037 class QComboBox; 00038 class QHideEvent; 00039 class QLabel; 00040 class QProgressIndicator; 00041 class QSortFilterProxyModel; 00042 00043 namespace KNS 00044 { 00045 00046 class DownloadDialog; 00047 class ItemsModel; 00048 class ItemsViewDelegate; 00049 00068 class DownloadDialog : public KDialog, public Ui::DownloadDialog 00069 { 00070 Q_OBJECT 00071 00072 public: 00073 DownloadDialog(DxsEngine* engine, QWidget * parent); 00074 ~DownloadDialog(); 00075 00076 enum EntryAction { 00077 kViewInfo, 00078 kComments, 00079 kChanges, 00080 kContactEmail, 00081 kContactJabber, 00082 kCollabTranslate, 00083 kCollabRemoval, 00084 kCollabSubscribe, 00085 kUninstall, 00086 kInstall, 00087 kCollabComment, 00088 kCollabRate 00089 }; 00090 00091 void refresh(); 00092 00093 // show a message in the bottom bar 00094 void displayMessage(const QString & msg, 00095 KTitleWidget::MessageType type = KTitleWidget::PlainMessage, 00096 int timeOutMs = 0); 00097 00098 // begin installing that item 00099 void installItem(Entry * entry); 00100 00101 // remove an already installed item 00102 void removeItem(Entry * entry); 00103 00104 private Q_SLOTS: 00106 void slotEntryLoaded(KNS::Entry *entry, const KNS::Feed *feed, const KNS::Provider *provider); 00107 void slotEntryRemoved(KNS::Entry *entry, const KNS::Feed *feed); 00108 void slotEntriesFailed(); 00109 void slotPayloadFailed(KNS::Entry * entry); 00110 void slotPayloadLoaded(KUrl url); 00111 00112 void slotResetMessage(); 00113 void slotNetworkTimeout(); 00114 void slotSortingSelected(int sortType); 00115 void slotSearchTextChanged(); 00116 void slotUpdateSearch(); 00117 00118 void slotInfo(QString provider, QString server, QString version); 00119 void slotComments(QStringList comments); 00120 // DXS 00121 void slotLoadProvidersListDXS(); 00122 void slotLoadProviderDXS(); 00123 void slotCategories(QList<Category*> categories); 00124 void slotEntries(QList<Entry*> entries); 00125 void slotFault(); 00126 void slotError(); 00127 // file downloading 00128 void slotEntryChanged(KNS::Entry *); 00129 //void slotItemMessage( KJob *, const QString & ); 00130 //void slotItemPercentage( KJob *, unsigned long ); 00131 //void slotItemResult( KJob * ); 00132 void slotProgress(const QString & text, int percentage); 00133 void slotProvidersFailed(); 00134 00135 void slotPerformAction(DownloadDialog::EntryAction action, KNS::Entry * entry); 00136 void slotCollabAction(QAction * action); 00137 00138 void slotListIndexChanged(const QModelIndex &index, const QModelIndex &old); 00139 protected: 00140 virtual void hideEvent(QHideEvent * event); 00141 00142 private: 00143 00144 void populateSortCombo(const Provider * provider); 00145 00146 // Contents 00147 // gui related vars 00148 //Ui::DownloadDialog * m_ui; 00149 00150 // other classes 00151 QTimer * m_searchTimer; 00152 QTimer * messageTimer; 00153 QTimer * networkTimer; 00154 00155 DxsEngine *m_engine; 00156 QMap<QString, QString> categorymap; 00157 QMap<const Feed*, KNS::ItemsModel*> m_models; 00158 QSortFilterProxyModel * m_filteredModel; 00159 ItemsViewDelegate * mDelegate; 00160 00161 //QList<Entry*> m_entries; 00162 QMap<const Feed*, Entry::List> entries; 00163 QMap<const Provider*, Entry::List> m_entriesByProvider; 00164 QMap<Entry*, const Provider*> m_providers; 00165 00166 QMutex mMutex; 00167 bool m_hasDxs; 00168 }; 00169 00170 } 00171 00172 #endif
KDE 4.6 API Reference