Skip to content

Commit 7c393cc

Browse files
committedDec 6, 2011
implement #4615: save as spatialite
1 parent 8432ddb commit 7c393cc

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed
 

‎src/app/ogr/qgsvectorlayersaveasdialog.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ QgsVectorLayerSaveAsDialog::QgsVectorLayerSaveAsDialog( QWidget* parent, Qt::WFl
3636
for ( QMap< QString, QString>::const_iterator it = map.constBegin(); it != map.constEnd(); ++it )
3737
{
3838
mFormatComboBox->addItem( it.key(), it.value() );
39+
if ( it.key() == "SQLite" )
40+
{
41+
mFormatComboBox->addItem( "SpatiaLite", tr( "SpatiaLite" ) );
42+
}
3943
}
4044

4145
QString format = settings.value( "/UI/lastVectorFormat", "ESRI Shapefile" ).toString();

‎src/app/qgisapp.cpp

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,7 @@ extern "C"
251251

252252
#ifndef WIN32
253253
#include <dlfcn.h>
254-
#endif
255-
256-
#ifdef WIN32
254+
#else
257255
#include <windows.h>
258256
#endif
259257

@@ -1730,7 +1728,7 @@ void QgisApp::initLegend()
17301728

17311729
QWidget *w = new QWidget( this );
17321730
QLayout *l = new QVBoxLayout;
1733-
l->setMargin(0);
1731+
l->setMargin( 0 );
17341732
l->addWidget( mMapLegend );
17351733
l->addWidget( legendCb );
17361734
w->setLayout( l );
@@ -1747,7 +1745,7 @@ void QgisApp::initLegend()
17471745

17481746
w = new QWidget( this );
17491747
l = new QVBoxLayout;
1750-
l->setMargin(0);
1748+
l->setMargin( 0 );
17511749
l->addWidget( mMapLayerOrder );
17521750
l->addWidget( orderCb );
17531751
w->setLayout( l );
@@ -3331,6 +3329,14 @@ void QgisApp::saveAsVectorFileGeneral( bool saveOnlySelection )
33313329
QString encoding = dialog->encoding();
33323330
QString vectorFilename = dialog->filename();
33333331
QString format = dialog->format();
3332+
QStringList datasourceOptions = dialog->datasourceOptions();
3333+
3334+
if ( format == "SpatiaLite" )
3335+
{
3336+
if ( !datasourceOptions.contains( "SPATIALITE=YES" ) )
3337+
datasourceOptions.append( "SPATIALITE=YES" );
3338+
format = "SQLite";
3339+
}
33343340

33353341
if ( dialog->crs() < 0 )
33363342
{
@@ -3358,7 +3364,7 @@ void QgisApp::saveAsVectorFileGeneral( bool saveOnlySelection )
33583364
vlayer, vectorFilename, encoding, &destCRS, format,
33593365
saveOnlySelection,
33603366
&errorMessage,
3361-
dialog->datasourceOptions(), dialog->layerOptions(),
3367+
datasourceOptions, dialog->layerOptions(),
33623368
dialog->skipAttributeCreation() );
33633369

33643370
QApplication::restoreOverrideCursor();
@@ -6390,14 +6396,14 @@ void QgisApp::oldProjectVersionWarning( QString oldVersion )
63906396

63916397
#ifdef ANDROID
63926398
//this is needed to deal with http://hub.qgis.org/issues/4573
6393-
QMessageBox box(QMessageBox::Warning,title, tr("This project file was saved by an older version of QGIS"), QMessageBox::Ok, NULL);
6399+
QMessageBox box( QMessageBox::Warning, title, tr( "This project file was saved by an older version of QGIS" ), QMessageBox::Ok, NULL );
63946400
box.setDetailedText(
6395-
text.remove(0, 3)
6396-
.replace(QString("<p>"),QString("\n\n"))
6397-
.replace(QString("<br>"),QString("\n"))
6398-
.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"))
6399-
.replace(QRegExp("</?tt>"),QString(""))
6400-
);
6401+
text.remove( 0, 3 )
6402+
.replace( QString( "<p>" ), QString( "\n\n" ) )
6403+
.replace( QString( "<br>" ), QString( "\n" ) )
6404+
.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" ) )
6405+
.replace( QRegExp( "</?tt>" ), QString( "" ) )
6406+
);
64016407
box.exec();
64026408
#else
64036409
QMessageBox::warning( NULL, title, text );

0 commit comments

Comments
 (0)
Please sign in to comment.