@@ -138,8 +138,7 @@ bool QgsOfflineEditing::convertToOfflineProject( const QString &offlineDataPath,
138
138
if ( vl )
139
139
{
140
140
QString origLayerId = vl->id ();
141
- QgsVectorLayer *newLayer;
142
- newLayer = copyVectorLayer ( vl, database.get (), dbPath, onlySelected, gpkg );
141
+ QgsVectorLayer *newLayer = copyVectorLayer ( vl, database.get (), dbPath, onlySelected, gpkg );
143
142
if ( newLayer )
144
143
{
145
144
layerIdMapping.insert ( origLayerId, newLayer );
@@ -171,6 +170,7 @@ bool QgsOfflineEditing::convertToOfflineProject( const QString &offlineDataPath,
171
170
}
172
171
}
173
172
173
+
174
174
emit progressStopped ();
175
175
176
176
// save offline project
@@ -406,6 +406,7 @@ bool QgsOfflineEditing::createSpatialiteDB( const QString &offlineDbPath, bool g
406
406
// creating/opening the new database
407
407
QString dbPath = newDb.fileName ();
408
408
409
+ // creating geopackage
409
410
if ( gpkg )
410
411
{
411
412
OGRSFDriverH hGpkgDriver = OGRGetDriverByName ( " GPKG" );
@@ -600,13 +601,15 @@ QgsVectorLayer *QgsOfflineEditing::copyVectorLayer( QgsVectorLayer *layer, sqlit
600
601
rc = sqlExec ( db, sqlCreateIndex );
601
602
}
602
603
}
603
- if ( rc != SQLITE_OK )
604
- {
605
- showWarning ( tr ( " Filling SpatiaLite for layer %1 failed" ).arg ( layer->name () ) );
606
- return nullptr ;
607
- }
608
604
}
609
605
606
+ if ( rc != SQLITE_OK )
607
+ {
608
+ showWarning ( tr ( " Filling SpatiaLite for layer %1 failed" ).arg ( layer->name () ) );
609
+ return nullptr ;
610
+ }
611
+
612
+ // add new layer
610
613
QString connectionString = QStringLiteral ( " dbname='%1' table='%2'%3 sql=" )
611
614
.arg ( offlineDbPath,
612
615
tableName, layer->isSpatial () ? " (Geometry)" : " " );
@@ -760,6 +763,7 @@ QgsVectorLayer *QgsOfflineEditing::copyVectorLayer( QgsVectorLayer *layer, sqlit
760
763
updateLayerOrder ( layer, newLayer );
761
764
762
765
766
+
763
767
}
764
768
return newLayer;
765
769
}
@@ -1352,7 +1356,6 @@ void QgsOfflineEditing::committedFeaturesAdded( const QString &qgisLayerId, cons
1352
1356
// only store feature ids
1353
1357
QString sql = QStringLiteral ( " SELECT ROWID FROM '%1' ORDER BY ROWID DESC LIMIT %2" ).arg ( tableName ).arg ( addedFeatures.size () );
1354
1358
QList<int > newFeatureIds = sqlQueryInts ( database.get (), sql );
1355
-
1356
1359
for ( int i = newFeatureIds.size () - 1 ; i >= 0 ; i-- )
1357
1360
{
1358
1361
QString sql = QStringLiteral ( " INSERT INTO 'log_added_features' VALUES ( %1, %2 )" )
0 commit comments