diff options
| author | Sebastian Trueg <[email protected]> | 2008-04-01 12:36:33 +0000 |
|---|---|---|
| committer | Sebastian Trueg <[email protected]> | 2008-04-01 12:36:33 +0000 |
| commit | bfb7d56d937d653438ab18342450254bf490c614 (patch) | |
| tree | 33bbe5c44ef2828b319e59b5c8c6fed73dd1636b /src/tagcloud/tagcloud.cpp | |
| parent | bd64849b07d79e799517acf1ed504532dd50e8cf (diff) | |
Do not show the 'No Tags' message and properly handle tags with spaces in their URI
svn path=/trunk/KDE/kdebase/apps/; revision=792521
Diffstat (limited to 'src/tagcloud/tagcloud.cpp')
| -rw-r--r-- | src/tagcloud/tagcloud.cpp | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/src/tagcloud/tagcloud.cpp b/src/tagcloud/tagcloud.cpp index f22a39aa2..5f406a796 100644 --- a/src/tagcloud/tagcloud.cpp +++ b/src/tagcloud/tagcloud.cpp @@ -204,7 +204,7 @@ int Nepomuk::TagCloud::Private::calculateWeight( const Nepomuk::Tag& tag ) Soprano::QueryResultIterator it = ResourceManager::instance()->mainModel()->executeQuery( QString( "select ?r where { ?r <%1> <%2> . }" ) .arg( Soprano::Vocabulary::NAO::hasTag().toString() ) - .arg( tag.resourceUri().toString() ), + .arg( QString::fromAscii( tag.resourceUri().toEncoded() ) ), Soprano::Query::QueryLanguageSparql ); int w = 0; while ( it.next() ) { @@ -832,46 +832,41 @@ void Nepomuk::TagCloud::paintEvent( QPaintEvent* e ) QPainter p( this ); QRegion paintRegion = e->region(); - if ( d->nodes.isEmpty() && !d->newTagButtonEnabled ) { - p.drawText( contentsRect(), d->alignment, i18n( "No Tags" ) ); - } - else { - p.save(); - p.setMatrix( d->zoomMatrix ); + p.save(); + p.setMatrix( d->zoomMatrix ); - for ( QList<TagNode>::iterator it = d->nodes.begin(); - it != d->nodes.end(); ++it ) { - TagNode& node = *it; + for ( QList<TagNode>::iterator it = d->nodes.begin(); + it != d->nodes.end(); ++it ) { + TagNode& node = *it; - if ( paintRegion.contains( node.zoomedRect ) ) { - p.setFont( node.font ); + if ( paintRegion.contains( node.zoomedRect ) ) { + p.setFont( node.font ); - if ( &node == d->hoverTag ) { - p.setPen( hoverTextBrush.brush( this ).color() ); - } - else if ( d->selectionEnabled && node.selected ) { - p.setPen( activeTextBrush.brush( this ).color() ); - } - else { - p.setPen( normalTextBrush.brush( this ).color() ); - } - p.drawText( node.rect, Qt::AlignCenter, node.text ); - } - } - - if ( d->newTagButtonEnabled ) { - p.setFont( d->newTagNode.font ); - if ( &d->newTagNode == d->hoverTag ) { + if ( &node == d->hoverTag ) { p.setPen( hoverTextBrush.brush( this ).color() ); } + else if ( d->selectionEnabled && node.selected ) { + p.setPen( activeTextBrush.brush( this ).color() ); + } else { p.setPen( normalTextBrush.brush( this ).color() ); } - p.drawText( d->newTagNode.rect, Qt::AlignCenter, d->customNewTagAction ? d->customNewTagAction->text() : d->newTagNode.text ); + p.drawText( node.rect, Qt::AlignCenter, node.text ); } + } - p.restore(); + if ( d->newTagButtonEnabled ) { + p.setFont( d->newTagNode.font ); + if ( &d->newTagNode == d->hoverTag ) { + p.setPen( hoverTextBrush.brush( this ).color() ); + } + else { + p.setPen( normalTextBrush.brush( this ).color() ); + } + p.drawText( d->newTagNode.rect, Qt::AlignCenter, d->customNewTagAction ? d->customNewTagAction->text() : d->newTagNode.text ); } + + p.restore(); } |
