]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Also use the Nepomuk MassUpdateJob for tagging
authorSebastian Trueg <sebastian@trueg.de>
Wed, 8 Oct 2008 08:15:06 +0000 (08:15 +0000)
committerSebastian Trueg <sebastian@trueg.de>
Wed, 8 Oct 2008 08:15:06 +0000 (08:15 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=869130

src/tagcloud/resourcetaggingwidget.cpp
src/tagcloud/resourcetaggingwidget.h

index c39c55530e233641aadbf40d7ff5826959427176..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 );
index 9acb934e7f0e5b5bc736666c9b56648490c94fd0..4ddcea881134456ad7409d9480b1eca0bcdf5718 100644 (file)
@@ -56,6 +56,7 @@ namespace Nepomuk {
         Private* const d;
 
         Q_PRIVATE_SLOT( d, void _k_slotShowTaggingPopup() )
+        Q_PRIVATE_SLOT( d, void _k_metadataUpdateDone() )
     };
 }