KNewStuff
itemsmodel.h
Go to the documentation of this file.
00001 /* 00002 knewstuff3/ui/itemsmodel.h. 00003 Copyright (C) 2008 Jeremy Whiting <jpwhiting@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 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 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #ifndef KNEWSTUFF3_UI_ITEMSMODEL_H 00020 #define KNEWSTUFF3_UI_ITEMSMODEL_H 00021 00022 #include <QAbstractListModel> 00023 #include <QtGui/QImage> 00024 00025 #include "core/entryinternal.h" 00026 00027 class KJob; 00028 00029 namespace KNS3 00030 { 00031 class Engine; 00032 00033 class ItemsModel: public QAbstractListModel 00034 { 00035 Q_OBJECT 00036 public: 00037 explicit ItemsModel(Engine* engine, QObject * parent = 0); 00038 ~ItemsModel(); 00039 00040 int rowCount(const QModelIndex & parent = QModelIndex()) const; 00041 QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; 00042 00043 void addEntry(const EntryInternal& entry); 00044 void removeEntry(const EntryInternal& entry); 00045 00046 bool hasPreviewImages() const; 00047 bool hasWebService() const; 00048 00049 Q_SIGNALS: 00050 void jobStarted(KJob*, const QString& label); 00051 00052 public Q_SLOTS: 00053 void slotEntryChanged(const KNS3::EntryInternal& entry); 00054 void slotEntriesLoaded(KNS3::EntryInternal::List entries); 00055 void clearEntries(); 00056 void slotEntryPreviewLoaded(const KNS3::EntryInternal& entry, KNS3::EntryInternal::PreviewType type); 00057 00058 private: 00059 Engine* m_engine; 00060 // the list of entries 00061 QList<EntryInternal> m_entries; 00062 bool m_hasPreviewImages; 00063 }; 00064 00065 } // end KNS namespace 00066 00067 Q_DECLARE_METATYPE(KNS3::EntryInternal) 00068 00069 #endif
KDE 4.6 API Reference