Commit abe0b038 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Expose the tag iterator to the cache db

parent 2f8e6616
......@@ -435,13 +435,13 @@ bool KisResourceCacheDb::addTag(KisResourceStorageSP storage, const QString &res
bool KisResourceCacheDb::addTags(KisResourceStorageSP storage, QString resourceType)
{
// QSharedPointer<KisResourceStorage::TagIterator> iter = storage->tags(resourceType);
// while(iter->hasNext()) {
// iter->next();
// if (!addTag(storage, resourceType, iter->url(), iter->name(), iter->comment())) {
// qWarning() << "Could not add resource" << res->filename() << "to the database";
// }
// }
QSharedPointer<KisResourceStorage::TagIterator> iter = storage->tags(resourceType);
while(iter->hasNext()) {
iter->next();
if (!addTag(storage, resourceType, iter->url(), iter->name(), iter->comment())) {
qWarning() << "Could not add resource" << iter->url() << "to the database";
}
}
return true;
}
......
......@@ -105,11 +105,16 @@ KoResourceSP KisResourceStorage::resource(const QString &url)
return d->storagePlugin->resource(url);
}
QSharedPointer<KisResourceStorage::ResourceIterator> KisResourceStorage::resources(const QString &resourceType)
QSharedPointer<KisResourceStorage::ResourceIterator> KisResourceStorage::resources(const QString &resourceType) const
{
return d->storagePlugin->resources(resourceType);
}
QSharedPointer<KisResourceStorage::TagIterator> KisResourceStorage::tags(const QString &resourceType) const
{
return d->storagePlugin->tags(resourceType);
}
bool KisResourceStorage::valid() const
{
......
......@@ -110,7 +110,8 @@ public:
ResourceItem resourceItem(const QString &url);
KoResourceSP resource(const QString &url);
QSharedPointer<ResourceIterator> resources(const QString &resourceType);
QSharedPointer<ResourceIterator> resources(const QString &resourceType) const;
QSharedPointer<TagIterator> tags(const QString &resourceType) const;
private:
class Private;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment