From 7c393cc9b4f740cca369db0b94132b51e7219500 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Tue, 6 Dec 2011 23:21:15 +0100 Subject: [PATCH] implement #4615: save as spatialite --- src/app/ogr/qgsvectorlayersaveasdialog.cpp | 4 +++ src/app/qgisapp.cpp | 32 +++++++++++++--------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/app/ogr/qgsvectorlayersaveasdialog.cpp b/src/app/ogr/qgsvectorlayersaveasdialog.cpp index 833f336104a4..9ee33a95eb21 100644 --- a/src/app/ogr/qgsvectorlayersaveasdialog.cpp +++ b/src/app/ogr/qgsvectorlayersaveasdialog.cpp @@ -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(); diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 44a3b560198b..b669465e57e0 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -251,9 +251,7 @@ extern "C" #ifndef WIN32 #include -#endif - -#ifdef WIN32 +#else #include #endif @@ -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 ); @@ -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 ); @@ -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 ) { @@ -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(); @@ -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("

"),QString("\n\n")) - .replace(QString("
"),QString("\n")) - .replace(QString("http://hub.qgis.org/projects/quantum-gis "),QString("\nhttp://hub.qgis.org/projects/quantum-gis")) - .replace(QRegExp(""),QString("")) - ); + text.remove( 0, 3 ) + .replace( QString( "

" ), QString( "\n\n" ) ) + .replace( QString( "
" ), QString( "\n" ) ) + .replace( QString( "http://hub.qgis.org/projects/quantum-gis " ), QString( "\nhttp://hub.qgis.org/projects/quantum-gis" ) ) + .replace( QRegExp( "" ), QString( "" ) ) + ); box.exec(); #else QMessageBox::warning( NULL, title, text );