[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [nepomuk-core/KDE/4.9] services/storage: ResourceWatcher: Change the order of the signals
From:       Vishesh Handa <me () vhanda ! in>
Date:       2012-09-27 21:07:45
Message-ID: 20120927210745.15582A6042 () git ! kde ! org
[Download RAW message or body]

Git commit 8c02d358e1c504fd4eb5b89ea6c22d4a102ef2b8 by Vishesh Handa.
Committed on 27/09/2012 at 15:18.
Pushed by vhanda into branch 'KDE/4.9'.

ResourceWatcher: Change the order of the signals

Everyone - Inform about propertyAdded before propertyChanged
StoreResource - Inform about the new types before informing about the
                change in their properties

M  +14   -13   services/storage/resourcemerger.cpp
M  +6    -6    services/storage/resourcewatchermanager.cpp

http://commits.kde.org/nepomuk-core/8c02d358e1c504fd4eb5b89ea6c22d4a102ef2b8

diff --git a/services/storage/resourcemerger.cpp b/services/storage/resourcemerger.cpp
index b636645..8528a3f 100644
--- a/services/storage/resourcemerger.cpp
+++ b/services/storage/resourcemerger.cpp
@@ -927,6 +927,20 @@ bool Nepomuk2::ResourceMerger::merge( const Soprano::Graph& stGraph )
     // make sure we do not leave trailing empty graphs
     m_model->removeTrailingGraphs(m_trailingGraphCandidates);
 
+    // Inform the ResourceWatcherManager of these new types
+    QHash<QUrl, QUrl>::const_iterator typeIt = typeHash.constBegin();
+    QHash<QUrl, QUrl>::const_iterator typeItEnd = typeHash.constEnd();
+    for( ; typeIt != typeItEnd; ) {
+        const QUrl blankUri = typeIt.key();
+        QList<QUrl> types;
+        for( ; typeIt != typeItEnd && typeIt.key() == blankUri ; typeIt++)
+            types << typeIt.value();
+
+        // Get its resource uri
+        const QUrl resUri = m_mappings.value( blankUri );
+        m_rvm->createResource( resUri, types );
+    }
+
     // Inform the ResourceWatcherManager of the changed properties
     QHash<QUrl, QHash<QUrl, QList<Soprano::Node> > > addedProperties;
     QHash<QUrl, QHash<QUrl, QList<Soprano::Node> > > removedProperties;
@@ -942,19 +956,6 @@ bool Nepomuk2::ResourceMerger::merge( const Soprano::Graph& stGraph )
         }
     }
 
-    // Inform the ResourceWatcherManager of these new types
-    QHash<QUrl, QUrl>::const_iterator typeIt = typeHash.constBegin();
-    QHash<QUrl, QUrl>::const_iterator typeItEnd = typeHash.constEnd();
-    for( ; typeIt != typeItEnd; ) {
-        const QUrl blankUri = typeIt.key();
-        QList<QUrl> types;
-        for( ; typeIt != typeItEnd && typeIt.key() == blankUri ; typeIt++)
-            types << typeIt.value();
-
-        // Get its resource uri
-        const QUrl resUri = m_mappings.value( blankUri );
-        m_rvm->createResource( resUri, types );
-    }
 
     // Push all the duplicateStatements
     QHashIterator<QUrl, Soprano::Statement> hashIter( m_duplicateStatements );
diff --git a/services/storage/resourcewatchermanager.cpp b/services/storage/resourcewatchermanager.cpp
index 5d95ee6..8f2ace6 100644
--- a/services/storage/resourcewatchermanager.cpp
+++ b/services/storage/resourcewatchermanager.cpp
@@ -211,12 +211,6 @@ void Nepomuk2::ResourceWatcherManager::changeProperty(const QUrl &res, const QUr
     //
     foreach(ResourceWatcherConnection* con, connections) {
         // make sure we emit from the correct thread through a queued connection
-        QMetaObject::invokeMethod(con,
-                                  "propertyChanged",
-                                  Q_ARG(QString, convertUri(res)),
-                                  Q_ARG(QString, convertUri(property)),
-                                  Q_ARG(QVariantList, nodeListToVariantList(addedValues)),
-                                  Q_ARG(QVariantList, nodeListToVariantList(removedValues)));
         if(!addedValues.isEmpty()) {
             QMetaObject::invokeMethod(con,
                                       "propertyAdded",
@@ -231,6 +225,12 @@ void Nepomuk2::ResourceWatcherManager::changeProperty(const QUrl &res, const QUr
                                       Q_ARG(QString, convertUri(property)),
                                       Q_ARG(QVariantList, nodeListToVariantList(removedValues)));
         }
+        QMetaObject::invokeMethod(con,
+                                  "propertyChanged",
+                                  Q_ARG(QString, convertUri(res)),
+                                  Q_ARG(QString, convertUri(property)),
+                                  Q_ARG(QVariantList, nodeListToVariantList(addedValues)),
+                                  Q_ARG(QVariantList, nodeListToVariantList(removedValues)));
     }
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic