diff --git a/include/ResourceItem.h b/include/ResourceItem.h index 4bf589c8e..294b9798e 100644 --- a/include/ResourceItem.h +++ b/include/ResourceItem.h @@ -70,6 +70,7 @@ public: BaseDirectory _base_dir = BaseWorkingDir, const QString & _path = QString::null, const QString & _hash = QString::null, + const QString & _author = QString::null, const QString & _tags = QString::null, int _size = -1, const QDateTime & _last_mod = QDateTime() ); @@ -125,6 +126,11 @@ public: return m_hash; } + const QString & author( void ) const + { + return m_author; + } + int size( void ) const { return m_size; @@ -208,6 +214,7 @@ private: BaseDirectory m_baseDir; QString m_path; QString m_hash; + QString m_author; int m_size; QDateTime m_lastMod; QString m_tags; diff --git a/src/core/LocalResourceProvider.cpp b/src/core/LocalResourceProvider.cpp index f346143ba..427bf871c 100644 --- a/src/core/LocalResourceProvider.cpp +++ b/src/core/LocalResourceProvider.cpp @@ -245,7 +245,11 @@ printf("read dir: %s\n", d.canonicalPath().toAscii().constData() ); new ResourceItem( this, f.fileName(), ResourceItem::TypeUnknown, - m_baseDir, _dir ); + m_baseDir, + _dir, + QString::null, // hash + QString::null // TODO: author + ); newItem->setLastMod( f.lastModified() ); database()->addItem( newItem ); ResourceTreeItem * rti = diff --git a/src/core/ResourceDB.cpp b/src/core/ResourceDB.cpp index ad5f2142d..0495d1197 100644 --- a/src/core/ResourceDB.cpp +++ b/src/core/ResourceDB.cpp @@ -139,6 +139,7 @@ void ResourceDB::saveTreeItem( const ResourceTreeItem * _i, e.setAttribute( "basedir", baseDirName( it->baseDir() ) ); e.setAttribute( "path", it->path() ); e.setAttribute( "hash", it->hash() ); + e.setAttribute( "author", it->author() ); e.setAttribute( "size", it->size() ); e.setAttribute( "tags", it->tags() ); e.setAttribute( "lastmod", it->lastMod(). @@ -167,6 +168,7 @@ ResourceItem * item = new ResourceItem( m_provider, baseDirFromName( e.attribute( "basedir" ) ), e.attribute( "path" ), h, + e.attribute( "author" ), e.attribute( "tags" ), e.attribute( "size" ).toInt(), QDateTime::fromString( e.attribute( "lastmod" ), Qt::ISODate ) ); diff --git a/src/core/ResourceItem.cpp b/src/core/ResourceItem.cpp index 838c27db1..99616f280 100644 --- a/src/core/ResourceItem.cpp +++ b/src/core/ResourceItem.cpp @@ -39,6 +39,7 @@ ResourceItem::ResourceItem( ResourceProvider * _provider, BaseDirectory _base_dir, const QString & _path, const QString & _hash, + const QString & _author, const QString & _tags, int _size, const QDateTime & _last_mod ) : @@ -49,6 +50,7 @@ ResourceItem::ResourceItem( ResourceProvider * _provider, m_baseDir( _base_dir ), m_path( _path ), m_hash( _hash ), + m_author( _author ), m_size( _size ), m_lastMod( _last_mod ), m_tags( _tags ), @@ -77,6 +79,7 @@ bool ResourceItem::operator==( const ResourceItem & _other ) const m_type == _other.m_type && m_path == _other.m_path && m_hash == _other.m_hash && + m_author == _other.m_author && m_size == _other.m_size && m_tags == _other.m_tags; } @@ -107,6 +110,11 @@ int ResourceItem::equalityLevel( const ResourceItem & _other ) const l += 5; } + if( m_author == _other.m_author ) + { + l += 5; + } + if( !m_tags.isEmpty() && !_other.m_tags.isEmpty() ) { QStringList my_tags = m_tags.split( " " ); diff --git a/src/core/ResourceTreeModel.cpp b/src/core/ResourceTreeModel.cpp index b938cb463..01c748f63 100644 --- a/src/core/ResourceTreeModel.cpp +++ b/src/core/ResourceTreeModel.cpp @@ -245,6 +245,7 @@ bool ResourceTreeModel::filterItems( ResourceTreeItem * _item, { if( !( i->name().toLower().contains( *it ) || i->path().toLower().contains( *it ) || + i->author().toLower().contains( *it ) || i->tags().toLower().contains( *it ) ) ) { accept = false; diff --git a/src/core/WebResourceProvider.cpp b/src/core/WebResourceProvider.cpp index d69c05997..414fe43d6 100644 --- a/src/core/WebResourceProvider.cpp +++ b/src/core/WebResourceProvider.cpp @@ -179,6 +179,7 @@ void WebResourceProvider::importNodeIntoDB( const QDomNode & _n, ResourceItem::BaseURL, path, n.firstChildElement( "hash" ).text(), + n.firstChildElement( "author" ).text(), n.firstChildElement( "tags" ).text(), n.firstChildElement( "size" ).text().toInt() ); database()->addItem( item );