]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/tagcloud/resourcetaggingwidget.cpp
when changing the view mode if the preview is turned on, the directory must get reloa...
[dolphin.git] / src / tagcloud / resourcetaggingwidget.cpp
index 1ac829952210d878714abf74fc95ede554b19221..067c395fbe591d07a33d3d95b2727a957d177335 100644 (file)
@@ -20,6 +20,7 @@
 #include "resourcetaggingwidget.h"
 #include "tagcloud.h"
 #include "taggingpopup.h"
+#include "../nepomukmassupdatejob.h"
 
 #include <QtGui/QVBoxLayout>
 #include <QtGui/QContextMenuEvent>
@@ -49,7 +50,10 @@ public:
 
     void showTaggingPopup( const QPoint& );
     void _k_slotShowTaggingPopup();
+    void _k_metadataUpdateDone();
     static QList<Tag> intersectTags( const QList<Resource>& );
+
+    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::Tag> Nepomuk::ResourceTaggingWidget::Private::intersectTags( const QList<Resource>& res )
 {
     if ( res.count() == 1 ) {
@@ -101,6 +113,8 @@ 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 );
@@ -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"