KNewStuff
downloaddialog.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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 EntryView;
00048 class ItemsView;
00049 class ItemsModel;
00050 class ItemsViewDelegate;
00051
00070 class DownloadDialog : public KDialog, public Ui::DownloadDialog
00071 {
00072 Q_OBJECT
00073
00074 public:
00075 DownloadDialog(DxsEngine* engine, QWidget * parent);
00076 ~DownloadDialog();
00077
00078 enum EntryAction {
00079 kViewInfo,
00080 kComments,
00081 kChanges,
00082 kContactEmail,
00083 kContactJabber,
00084 kCollabTranslate,
00085 kCollabRemoval,
00086 kCollabSubscribe,
00087 kUninstall,
00088 kInstall,
00089 kCollabComment,
00090 kCollabRate
00091 };
00092
00093 void refresh();
00094
00095
00096 void displayMessage(const QString & msg,
00097 KTitleWidget::MessageType type = KTitleWidget::PlainMessage,
00098 int timeOutMs = 0);
00099
00100
00101 void installItem(Entry * entry);
00102
00103
00104 void removeItem(Entry * entry);
00105
00106 private Q_SLOTS:
00108 void slotEntryLoaded(KNS::Entry *entry, const KNS::Feed *feed, const KNS::Provider *provider);
00109 void slotEntryRemoved(KNS::Entry *entry, const KNS::Feed *feed);
00110 void slotEntriesFailed();
00111 void slotPayloadFailed(KNS::Entry * entry);
00112
00113 void slotResetMessage();
00114 void slotNetworkTimeout();
00115 void slotSortingSelected(int sortType);
00116 void slotSearchTextChanged();
00117 void slotUpdateSearch();
00118
00119 void slotInfo(QString provider, QString server, QString version);
00120 void slotComments(QStringList comments);
00121
00122 void slotLoadProvidersListDXS();
00123 void slotLoadProviderDXS();
00124 void slotCategories(QList<Category*> categories);
00125 void slotEntries(QList<Entry*> entries);
00126 void slotFault();
00127 void slotError();
00128
00129 void slotEntryChanged(KNS::Entry *);
00130
00131
00132
00133 void slotProgress(const QString & text, int percentage);
00134 void slotProvidersFailed();
00135
00136 void slotPerformAction(DownloadDialog::EntryAction action, KNS::Entry * entry);
00137 void slotCollabAction(DownloadDialog::EntryAction action);
00138
00139 void slotListIndexChanged(const QModelIndex &index, const QModelIndex &old);
00140 protected:
00141 virtual void hideEvent(QHideEvent * event);
00142
00143 private:
00144
00145 void populateSortCombo(const Provider * provider);
00146
00147
00148
00149
00150
00151
00152 QTimer * m_searchTimer;
00153 QTimer * messageTimer;
00154 QTimer * networkTimer;
00155
00156 DxsEngine *m_engine;
00157 QMap<QString, QString> categorymap;
00158 QMap<const Feed*, KNS::ItemsModel*> m_models;
00159 QSortFilterProxyModel * m_filteredModel;
00160 ItemsViewDelegate * mDelegate;
00161
00162
00163 QMap<const Feed*, Entry::List> entries;
00164 QMap<const Provider*, Entry::List> m_entriesByProvider;
00165 QMap<Entry*, const Provider*> m_providers;
00166
00167 QMutex mMutex;
00168 };
00169
00170 }
00171
00172 #endif