Skip to content

Commit

Permalink
implement #4615: save as spatialite
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n authored and alexbruy committed Jan 28, 2012
1 parent 67f3b01 commit 376a021
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/app/ogr/qgsvectorlayersaveasdialog.cpp
Expand Up @@ -36,6 +36,10 @@ QgsVectorLayerSaveAsDialog::QgsVectorLayerSaveAsDialog( QWidget* parent, Qt::WFl
for ( QMap< QString, QString>::const_iterator it = map.constBegin(); it != map.constEnd(); ++it )
{
mFormatComboBox->addItem( it.key(), it.value() );
if ( it.key() == "SQLite" )
{
mFormatComboBox->addItem( "SpatiaLite", tr( "SpatiaLite" ) );
}
}

QString format = settings.value( "/UI/lastVectorFormat", "ESRI Shapefile" ).toString();
Expand Down
14 changes: 10 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -251,9 +251,7 @@ extern "C"

#ifndef WIN32
#include <dlfcn.h>
#endif

#ifdef WIN32
#else
#include <windows.h>
#endif

Expand Down Expand Up @@ -3373,6 +3371,14 @@ void QgisApp::saveAsVectorFileGeneral( bool saveOnlySelection )
QString encoding = dialog->encoding();
QString vectorFilename = dialog->filename();
QString format = dialog->format();
QStringList datasourceOptions = dialog->datasourceOptions();

if ( format == "SpatiaLite" )
{
if ( !datasourceOptions.contains( "SPATIALITE=YES" ) )
datasourceOptions.append( "SPATIALITE=YES" );
format = "SQLite";
}

if ( dialog->crs() < 0 )
{
Expand Down Expand Up @@ -3400,7 +3406,7 @@ void QgisApp::saveAsVectorFileGeneral( bool saveOnlySelection )
vlayer, vectorFilename, encoding, &destCRS, format,
saveOnlySelection,
&errorMessage,
dialog->datasourceOptions(), dialog->layerOptions(),
datasourceOptions, dialog->layerOptions(),
dialog->skipAttributeCreation() );

QApplication::restoreOverrideCursor();
Expand Down

0 comments on commit 376a021

Please sign in to comment.