Changeset View
Changeset View
Standalone View
Standalone View
src/core/itemsmodel.cpp
- This file was moved from src/ui/itemsmodel.cpp.
Context not available. | |||||
18 | 18 | | |||
---|---|---|---|---|---|
19 | #include "itemsmodel_p.h" | 19 | #include "itemsmodel_p.h" | ||
20 | 20 | | |||
21 | #include <knewstuff_debug.h> | 21 | #include <knewstuffcore_debug.h> | ||
22 | #include "klocalizedstring.h" | 22 | #include "klocalizedstring.h" | ||
23 | 23 | | |||
24 | #include "core/entryinternal_p.h" | 24 | #include "entryinternal_p.h" | ||
25 | #include "core/engine_p.h" | 25 | #include "engine_p.h" | ||
26 | #include "imageloader_p.h" | 26 | #include "imageloader_p.h" | ||
27 | 27 | | |||
28 | namespace KNS3 | 28 | namespace KNSCore | ||
29 | { | 29 | { | ||
30 | ItemsModel::ItemsModel(Engine *engine, QObject *parent) | 30 | ItemsModel::ItemsModel(Engine *engine, QObject *parent) | ||
31 | : QAbstractListModel(parent) | 31 | : QAbstractListModel(parent) | ||
Context not available. | |||||
52 | return QVariant::fromValue(entry); | 52 | return QVariant::fromValue(entry); | ||
53 | } | 53 | } | ||
54 | 54 | | |||
55 | void ItemsModel::slotEntriesLoaded(EntryInternal::List entries) | 55 | void ItemsModel::slotEntriesLoaded(const KNSCore::EntryInternal::List& entries) | ||
56 | { | 56 | { | ||
57 | foreach (const KNS3::EntryInternal &entry, entries) { | 57 | foreach (const KNSCore::EntryInternal &entry, entries) { | ||
58 | addEntry(entry); | 58 | addEntry(entry); | ||
59 | } | 59 | } | ||
60 | } | 60 | } | ||
Context not available. | |||||
69 | } | 69 | } | ||
70 | } | 70 | } | ||
71 | 71 | | |||
72 | qCDebug(KNEWSTUFF) << "adding entry " << entry.name() << " to the model"; | 72 | qCDebug(KNEWSTUFFCORE) << "adding entry " << entry.name() << " to the model"; | ||
73 | beginInsertRows(QModelIndex(), m_entries.count(), m_entries.count()); | 73 | beginInsertRows(QModelIndex(), m_entries.count(), m_entries.count()); | ||
74 | m_entries.append(entry); | 74 | m_entries.append(entry); | ||
75 | endInsertRows(); | 75 | endInsertRows(); | ||
Context not available. | |||||
81 | 81 | | |||
82 | void ItemsModel::removeEntry(const EntryInternal &entry) | 82 | void ItemsModel::removeEntry(const EntryInternal &entry) | ||
83 | { | 83 | { | ||
84 | qCDebug(KNEWSTUFF) << "removing entry " << entry.name() << " from the model"; | 84 | qCDebug(KNEWSTUFFCORE) << "removing entry " << entry.name() << " from the model"; | ||
85 | int index = m_entries.indexOf(entry); | 85 | int index = m_entries.indexOf(entry); | ||
86 | if (index > -1) { | 86 | if (index > -1) { | ||
87 | beginRemoveRows(QModelIndex(), index, index); | 87 | beginRemoveRows(QModelIndex(), index, index); | ||
Context not available. |