Skip to content
Permalink
Browse files
fix #2763
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13600 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed May 30, 2010
1 parent 5ee6a71 commit 83d33b391dfd95eb1ce04e38c1b90de30afb97ff
Showing with 18 additions and 32 deletions.
  1. +11 −29 src/app/qgisapp.cpp
  2. +7 −0 src/providers/ogr/qgsogrprovider.cpp
  3. +0 −3 src/providers/spatialite/qgsspatialiteprovider.cpp
@@ -2990,33 +2990,24 @@ void QgisApp::newVectorLayer()
std::list<std::pair<QString, QString> > attributes;
geomDialog.attributes( attributes );

bool haveLastUsedFilter = false; // by default, there is no last
// used filter
QString enc;
QString fileName;

QSettings settings; // where we keep last used filter in
// persistent state

haveLastUsedFilter = settings.contains( "/UI/lastVectorFileFilter" );
QString lastUsedFilter = settings.value( "/UI/lastVectorFileFilter",
QVariant( QString::null ) ).toString();

QString lastUsedDir = settings.value( "/UI/lastVectorFileFilterDir",
"." ).toString();
QSettings settings;
QString lastUsedDir = settings.value( "/UI/lastVectorFileFilterDir", "." ).toString();

QgsDebugMsg( "Saving vector file dialog without filters: " );

QgsEncodingFileDialog* openFileDialog = new QgsEncodingFileDialog( this,
tr( "Save As" ), lastUsedDir, "", QString( "" ) );
QgsEncodingFileDialog* openFileDialog =
new QgsEncodingFileDialog( this, tr( "Save As" ), lastUsedDir, "", QString( "" ) );

// allow for selection of more than one file
openFileDialog->setFileMode( QFileDialog::AnyFile );
openFileDialog->setAcceptMode( QFileDialog::AcceptSave );
openFileDialog->setConfirmOverwrite( true );

if ( haveLastUsedFilter ) // set the filter to the last one used
if ( settings.contains( "/UI/lastVectorFileFilter" ) )
{
QString lastUsedFilter = settings.value( "/UI/lastVectorFileFilter", QVariant( QString::null ) ).toString();
openFileDialog->selectFilter( lastUsedFilter );
}

@@ -3026,23 +3017,14 @@ void QgisApp::newVectorLayer()
return;
}

enc = openFileDialog->encoding();
fileName = openFileDialog->selectedFiles().first();

// If the file exists, delete it otherwise we'll end up loading that
// file, which can cause problems (e.g., if the file contains
// linestrings, but we're wanting to create points, we'll end up
// with a linestring file).
if ( fileformat == "ESRI Shapefile" )
{
QgsVectorFileWriter::deleteShapeFile( fileName );
}
else
{
QFile::remove( fileName );
}
if( fileformat == "ESRI Shapefile" && !fileName.endsWith( ".shp", Qt::CaseInsensitive ) )
fileName += ".shp";

settings.setValue( "/UI/lastVectorFileFilter", openFileDialog->selectedFilter() );
enc = openFileDialog->encoding();

settings.setValue( "/UI/lastVectorFileFilter", openFileDialog->selectedFilter() );
settings.setValue( "/UI/lastVectorFileFilterDir", openFileDialog->directory().absolutePath() );

delete openFileDialog;
@@ -43,6 +43,7 @@ email : sherman at mrcc.com
#include "qgsgeometry.h"
#include "qgslogger.h"
#include "qgscoordinatereferencesystem.h"
#include "qgsvectorfilewriter.h"

static const QString TEXT_PROVIDER_KEY = "ogr";
static const QString TEXT_PROVIDER_DESCRIPTION =
@@ -1575,6 +1576,12 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
}
fieldNames << name;
}

QgsVectorFileWriter::deleteShapeFile( uri );
}
else
{
QFile::remove( uri );
}

OGRDataSourceH dataSource;
@@ -23,9 +23,6 @@ email : a.furieri@lqt.it
#include <qgsrectangle.h>
#include <qgscoordinatereferencesystem.h>

#include "qgsprovidercountcalcevent.h"
#include "qgsproviderextentcalcevent.h"

#include "qgsspatialiteprovider.h"

#include "qgslogger.h"

0 comments on commit 83d33b3

Please sign in to comment.