@@ -51,6 +51,7 @@ extern "C"
51
51
52
52
QgsOfflineEditing::QgsOfflineEditing ()
53
53
{
54
+ connect ( QgsMapLayerRegistry::instance (), SIGNAL ( layerWasAdded ( QgsMapLayer* ) ), this , SLOT ( layerAdded ( QgsMapLayer* ) ) );
54
55
}
55
56
56
57
QgsOfflineEditing::~QgsOfflineEditing ()
@@ -558,7 +559,6 @@ void QgsOfflineEditing::copyVectorLayer( QgsVectorLayer* layer, sqlite3* db, con
558
559
emit progressUpdated ( featureCount++ );
559
560
}
560
561
sqlExec ( db, " COMMIT" );
561
- listenStartStopEdits ( newLayer );
562
562
}
563
563
else
564
564
{
@@ -1219,8 +1219,15 @@ void QgsOfflineEditing::stopListenFeatureChanges()
1219
1219
this , SLOT ( committedGeometriesChanges ( const QString&, const QgsGeometryMap& ) ) );
1220
1220
}
1221
1221
1222
- void QgsOfflineEditing::listenStartStopEdits ( QgsVectorLayer *vLayer )
1222
+ void QgsOfflineEditing::layerAdded ( QgsMapLayer* layer )
1223
1223
{
1224
- connect ( vLayer, SIGNAL ( editingStarted () ), this , SLOT ( startListenFeatureChanges () ) );
1225
- connect ( vLayer, SIGNAL ( editingStopped () ), this , SLOT ( stopListenFeatureChanges () ) );
1224
+ // detect offline layer
1225
+ if ( layer->customProperty ( CUSTOM_PROPERTY_IS_OFFLINE_EDITABLE, false ).toBool () )
1226
+ {
1227
+ QgsVectorLayer* vLayer = qobject_cast<QgsVectorLayer *>( layer );
1228
+ connect ( vLayer, SIGNAL ( editingStarted () ), this , SLOT ( startListenFeatureChanges () ) );
1229
+ connect ( vLayer, SIGNAL ( editingStopped () ), this , SLOT ( stopListenFeatureChanges () ) );
1230
+ }
1226
1231
}
1232
+
1233
+
0 commit comments