]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/tagcloud/resourcetaggingwidget.cpp
use a smaller step size when using the scroll wheel
[dolphin.git] / src / tagcloud / resourcetaggingwidget.cpp
index 1ac829952210d878714abf74fc95ede554b19221..1e3fffe8f6b5172379b02b33b7a4a4ba43c8fdba 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,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( "<p align=center><a style=\"font-size:small;\" href=\"dummy\">" + i18nc( "@label", "Change tags..." ) + "</a>", this );
+    QLabel* changeTagsLabel = new QLabel( "<p align=center><a style=\"font-size:small;\" href=\"dummy\">" + i18nc( "@label", "Change Tags..." ) + "</a>", 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"