X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/f32987d719f4b396ea2679b59a712a8bc288b8d2..148282e2d856b47ceb191eeef4c834118c8cdffd:/src/tagcloud/resourcetaggingwidget.cpp diff --git a/src/tagcloud/resourcetaggingwidget.cpp b/src/tagcloud/resourcetaggingwidget.cpp index 1ac829952..1e3fffe8f 100644 --- a/src/tagcloud/resourcetaggingwidget.cpp +++ b/src/tagcloud/resourcetaggingwidget.cpp @@ -20,6 +20,7 @@ #include "resourcetaggingwidget.h" #include "tagcloud.h" #include "taggingpopup.h" +#include "../nepomukmassupdatejob.h" #include #include @@ -49,7 +50,10 @@ public: void showTaggingPopup( const QPoint& ); void _k_slotShowTaggingPopup(); + void _k_metadataUpdateDone(); static QList intersectTags( const QList& ); + + ResourceTaggingWidget* q; }; @@ -63,9 +67,11 @@ void Nepomuk::ResourceTaggingWidget::Private::showTaggingPopup( const QPoint& po popup->exec( pos ); - foreach( Resource res, resources ) { - res.setTags( resourceTags ); - } + MassUpdateJob* job = MassUpdateJob::tagResources( resources, resourceTags ); + connect( job, SIGNAL( result( KJob* ) ), + q, SLOT( _k_metadataUpdateDone() ) ); + q->setEnabled( false ); // no updates during execution + job->start(); resourceTagCloud->showTags( resourceTags ); } @@ -77,6 +83,12 @@ void Nepomuk::ResourceTaggingWidget::Private::_k_slotShowTaggingPopup() } +void Nepomuk::ResourceTaggingWidget::Private::_k_metadataUpdateDone() +{ + q->setEnabled( true ); +} + + QList Nepomuk::ResourceTaggingWidget::Private::intersectTags( const QList& res ) { if ( res.count() == 1 ) { @@ -101,11 +113,13 @@ Nepomuk::ResourceTaggingWidget::ResourceTaggingWidget( QWidget* parent ) : QWidget( parent ), d( new Private() ) { + d->q = this; + QVBoxLayout* layout = new QVBoxLayout( this ); layout->setMargin( 0 ); d->resourceTagCloud = new TagCloud( this ); layout->addWidget( d->resourceTagCloud ); - QLabel* changeTagsLabel = new QLabel( "

" + i18nc( "@label", "Change tags..." ) + "", this ); + QLabel* changeTagsLabel = new QLabel( "

" + i18nc( "@label", "Change Tags..." ) + "", this ); connect( changeTagsLabel, SIGNAL( linkActivated( const QString ) ), this, SLOT( _k_slotShowTaggingPopup() ) ); layout->addWidget( changeTagsLabel ); @@ -170,4 +184,10 @@ void Nepomuk::ResourceTaggingWidget::contextMenuEvent( QContextMenuEvent* e ) d->showTaggingPopup( e->globalPos() ); } + +void Nepomuk::ResourceTaggingWidget::showTagPopup( const QPoint& pos ) +{ + d->showTaggingPopup( pos ); +} + #include "resourcetaggingwidget.moc"