Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
argumentname containerType
  • Loading branch information
signedav committed Jul 6, 2018
1 parent 774b4f6 commit f442485
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/core/qgsofflineediting.cpp
Expand Up @@ -76,14 +76,14 @@ QgsOfflineEditing::QgsOfflineEditing()
* - remove remote layers
* - mark as offline project
*/
bool QgsOfflineEditing::convertToOfflineProject( const QString &offlineDataPath, const QString &offlineDbFile, const QStringList &layerIds, bool onlySelected, ContainerType dbContainerType )
bool QgsOfflineEditing::convertToOfflineProject( const QString &offlineDataPath, const QString &offlineDbFile, const QStringList &layerIds, bool onlySelected, ContainerType containerType )
{
if ( layerIds.isEmpty() )
{
return false;
}
QString dbPath = QDir( offlineDataPath ).absoluteFilePath( offlineDbFile );
if ( createOfflineDb( dbPath, dbContainerType ) )
if ( createOfflineDb( dbPath, containerType ) )
{
spatialite_database_unique_ptr database;
int rc = database.open( dbPath );
Expand Down Expand Up @@ -138,7 +138,7 @@ bool QgsOfflineEditing::convertToOfflineProject( const QString &offlineDataPath,
if ( vl )
{
QString origLayerId = vl->id();
QgsVectorLayer *newLayer = copyVectorLayer( vl, database.get(), dbPath, onlySelected, dbContainerType );
QgsVectorLayer *newLayer = copyVectorLayer( vl, database.get(), dbPath, onlySelected, containerType );
if ( newLayer )
{
layerIdMapping.insert( origLayerId, newLayer );
Expand Down Expand Up @@ -385,7 +385,7 @@ void QgsOfflineEditing::initializeSpatialMetadata( sqlite3 *sqlite_handle )
spatial_ref_sys_init( sqlite_handle, 0 );
}

bool QgsOfflineEditing::createOfflineDb( const QString &offlineDbPath, ContainerType dbContainerType )
bool QgsOfflineEditing::createOfflineDb( const QString &offlineDbPath, ContainerType containerType )
{
int ret;
char *errMsg = nullptr;
Expand All @@ -407,7 +407,7 @@ bool QgsOfflineEditing::createOfflineDb( const QString &offlineDbPath, Container
QString dbPath = newDb.fileName();

// creating geopackage
if ( dbContainerType == GPKG )
if ( containerType == GPKG )
{
OGRSFDriverH hGpkgDriver = OGRGetDriverByName( "GPKG" );
if ( !hGpkgDriver )
Expand Down Expand Up @@ -492,7 +492,7 @@ void QgsOfflineEditing::createLoggingTables( sqlite3 *db )
*/
}

QgsVectorLayer *QgsOfflineEditing::copyVectorLayer( QgsVectorLayer *layer, sqlite3 *db, const QString &offlineDbPath, bool onlySelected, ContainerType dbContainerType )
QgsVectorLayer *QgsOfflineEditing::copyVectorLayer( QgsVectorLayer *layer, sqlite3 *db, const QString &offlineDbPath, bool onlySelected, ContainerType containerType )
{
if ( !layer )
return nullptr;
Expand All @@ -503,7 +503,7 @@ QgsVectorLayer *QgsOfflineEditing::copyVectorLayer( QgsVectorLayer *layer, sqlit
// new layer
QgsVectorLayer *newLayer = nullptr;

if ( dbContainerType != GPKG )
if ( containerType != GPKG )
{
// create table
QString sql = QStringLiteral( "CREATE TABLE '%1' (" ).arg( tableName );
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsofflineediting.h
Expand Up @@ -64,7 +64,7 @@ class CORE_EXPORT QgsOfflineEditing : public QObject
* \param layerIds List of layer names to convert
* \param onlySelected Only copy selected features from layers where a selection is present
*/
bool convertToOfflineProject( const QString &offlineDataPath, const QString &offlineDbFile, const QStringList &layerIds, bool onlySelected = false, ContainerType dbContainerType = SpatiaLite );
bool convertToOfflineProject( const QString &offlineDataPath, const QString &offlineDbFile, const QStringList &layerIds, bool onlySelected = false, ContainerType containerType = SpatiaLite );

//! Returns true if current project is offline
bool isOfflineProject() const;
Expand Down Expand Up @@ -113,10 +113,10 @@ class CORE_EXPORT QgsOfflineEditing : public QObject

private:
void initializeSpatialMetadata( sqlite3 *sqlite_handle );
bool createOfflineDb( const QString &offlineDbPath, ContainerType dbContainerType = SpatiaLite );
bool createOfflineDb( const QString &offlineDbPath, ContainerType containerType = SpatiaLite );
void createLoggingTables( sqlite3 *db );

QgsVectorLayer *copyVectorLayer( QgsVectorLayer *layer, sqlite3 *db, const QString &offlineDbPath, bool onlySelected, ContainerType dbContainerType = SpatiaLite );
QgsVectorLayer *copyVectorLayer( QgsVectorLayer *layer, sqlite3 *db, const QString &offlineDbPath, bool onlySelected, ContainerType containerType = SpatiaLite );

void applyAttributesAdded( QgsVectorLayer *remoteLayer, sqlite3 *db, int layerId, int commitNo );
void applyFeaturesAdded( QgsVectorLayer *offlineLayer, QgsVectorLayer *remoteLayer, sqlite3 *db, int layerId );
Expand Down

0 comments on commit f442485

Please sign in to comment.