Skip to content
Permalink
Browse files

bring layerAdded signal back to fix synchronize

  • Loading branch information
vinayan committed May 13, 2013
1 parent 778f223 commit 0dcd9ebe8eace3d5cf33c764fb7d8373924e4711
Showing with 12 additions and 5 deletions.
  1. +11 −4 src/core/qgsofflineediting.cpp
  2. +1 −1 src/core/qgsofflineediting.h
@@ -51,6 +51,7 @@ extern "C"

QgsOfflineEditing::QgsOfflineEditing()
{
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ), this, SLOT( layerAdded( QgsMapLayer* ) ) );
}

QgsOfflineEditing::~QgsOfflineEditing()
@@ -558,7 +559,6 @@ void QgsOfflineEditing::copyVectorLayer( QgsVectorLayer* layer, sqlite3* db, con
emit progressUpdated( featureCount++ );
}
sqlExec( db, "COMMIT" );
listenStartStopEdits( newLayer );
}
else
{
@@ -1219,8 +1219,15 @@ void QgsOfflineEditing::stopListenFeatureChanges()
this, SLOT( committedGeometriesChanges( const QString&, const QgsGeometryMap& ) ) );
}

void QgsOfflineEditing::listenStartStopEdits( QgsVectorLayer *vLayer )
void QgsOfflineEditing::layerAdded( QgsMapLayer* layer )
{
connect( vLayer, SIGNAL( editingStarted() ), this, SLOT( startListenFeatureChanges() ) );
connect( vLayer, SIGNAL( editingStopped() ), this, SLOT( stopListenFeatureChanges() ) );
// detect offline layer
if ( layer->customProperty( CUSTOM_PROPERTY_IS_OFFLINE_EDITABLE, false ).toBool() )
{
QgsVectorLayer* vLayer = qobject_cast<QgsVectorLayer *>( layer );
connect( vLayer, SIGNAL( editingStarted() ), this, SLOT( startListenFeatureChanges() ) );
connect( vLayer, SIGNAL( editingStopped() ), this, SLOT( stopListenFeatureChanges() ) );
}
}


@@ -134,9 +134,9 @@ class CORE_EXPORT QgsOfflineEditing : public QObject
};
typedef QList<GeometryChange> GeometryChanges;
GeometryChanges sqlQueryGeometryChanges( sqlite3* db, const QString& sql );
void listenStartStopEdits( QgsVectorLayer* vLayer );

private slots:
void layerAdded( QgsMapLayer* layer );
void committedAttributesAdded( const QString& qgisLayerId, const QList<QgsField>& addedAttributes );
void committedFeaturesAdded( const QString& qgisLayerId, const QgsFeatureList& addedFeatures );
void committedFeaturesRemoved( const QString& qgisLayerId, const QgsFeatureIds& deletedFeatureIds );

0 comments on commit 0dcd9eb

Please sign in to comment.
You can’t perform that action at this time.