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 committed Dec 6, 2011
1 parent 8432ddb commit 7c393cc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 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
32 changes: 19 additions & 13 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 @@ -1730,7 +1728,7 @@ void QgisApp::initLegend()

QWidget *w = new QWidget( this );
QLayout *l = new QVBoxLayout;
l->setMargin(0);
l->setMargin( 0 );
l->addWidget( mMapLegend );
l->addWidget( legendCb );
w->setLayout( l );
Expand All @@ -1747,7 +1745,7 @@ void QgisApp::initLegend()

w = new QWidget( this );
l = new QVBoxLayout;
l->setMargin(0);
l->setMargin( 0 );
l->addWidget( mMapLayerOrder );
l->addWidget( orderCb );
w->setLayout( l );
Expand Down Expand Up @@ -3331,6 +3329,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 @@ -3358,7 +3364,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 Expand Up @@ -6390,14 +6396,14 @@ void QgisApp::oldProjectVersionWarning( QString oldVersion )

#ifdef ANDROID
//this is needed to deal with http://hub.qgis.org/issues/4573
QMessageBox box(QMessageBox::Warning,title, tr("This project file was saved by an older version of QGIS"), QMessageBox::Ok, NULL);
QMessageBox box( QMessageBox::Warning, title, tr( "This project file was saved by an older version of QGIS" ), QMessageBox::Ok, NULL );
box.setDetailedText(
text.remove(0, 3)
.replace(QString("<p>"),QString("\n\n"))
.replace(QString("<br>"),QString("\n"))
.replace(QString("<a href=\"http://hub.qgis.org/projects/quantum-gis\">http://hub.qgis.org/projects/quantum-gis</a> "),QString("\nhttp://hub.qgis.org/projects/quantum-gis"))
.replace(QRegExp("</?tt>"),QString(""))
);
text.remove( 0, 3 )
.replace( QString( "<p>" ), QString( "\n\n" ) )
.replace( QString( "<br>" ), QString( "\n" ) )
.replace( QString( "<a href=\"http://hub.qgis.org/projects/quantum-gis\">http://hub.qgis.org/projects/quantum-gis</a> " ), QString( "\nhttp://hub.qgis.org/projects/quantum-gis" ) )
.replace( QRegExp( "</?tt>" ), QString( "" ) )
);
box.exec();
#else
QMessageBox::warning( NULL, title, text );
Expand Down

0 comments on commit 7c393cc

Please sign in to comment.