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 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
00094 void displayMessage(const QString & msg,
00095 KTitleWidget::MessageType type = KTitleWidget::PlainMessage,
00096 int timeOutMs = 0);
00097
00098
00099 void installItem(Entry * entry);
00100
00101
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
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
00128 void slotEntryChanged(KNS::Entry *);
00129
00130
00131
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
00147
00148
00149
00150
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
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