Skip to content

Commit a1b0f20

Browse files
author
jef
committedDec 2, 2009
fix #2179
git-svn-id: http://svn.osgeo.org/qgis/trunk@12312 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 74b924a commit a1b0f20

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed
 

‎src/app/qgsspatialitesourceselect.cpp

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -304,39 +304,33 @@ void QgsSpatiaLiteSourceSelect::addNewConnection()
304304
// Retrieve last used project dir from persistent settings
305305
sqlite3 *handle;
306306
QSettings settings;
307-
QString fullPath;
308307
QString lastUsedDir = settings.value( "/UI/lastSpatiaLiteDir", "." ).toString();
309308

310309
QString myFile = QFileDialog::getOpenFileName( this,
311-
tr( "Choose a SpatiaLite/SQLite DB to open" ),
312-
lastUsedDir, QObject::tr( "SQLite DB (*.sqlite);;All files (*.*)" ) );
310+
tr( "Choose a SpatiaLite/SQLite DB to open" ),
311+
lastUsedDir, QObject::tr( "SQLite DB (*.sqlite);;All files (*.*)" ) );
313312

314313
if ( myFile.isEmpty() )
315-
{
316-
QFileInfo myFI( myFile );
317-
QString myPath = myFI.path();
318-
QString myName = myFI.fileName();
314+
return;
319315

320-
handle = openSpatiaLiteDb( myFI.canonicalFilePath() );
321-
if ( handle )
322-
{
323-
// OK, this one is a valid SpatiaLite DB
324-
closeSpatiaLiteDb( handle );
325-
326-
// Persist last used SpatiaLite dir
327-
settings.setValue( "/UI/lastSpatiaLiteDir", myPath );
328-
// inserting this SQLite DB path
329-
QString baseKey = "/SpatiaLite/connections/";
330-
settings.setValue( baseKey + "selected", myName );
331-
baseKey += myName;
332-
settings.setValue( baseKey + "/sqlitepath", fullPath );
333-
}
334-
}
335-
else
336-
{
337-
// if they didn't select anything, just return
316+
QFileInfo myFI( myFile );
317+
QString myPath = myFI.path();
318+
QString myName = myFI.fileName();
319+
320+
handle = openSpatiaLiteDb( myFI.canonicalFilePath() );
321+
if ( !handle )
338322
return;
339-
}
323+
324+
// OK, this one is a valid SpatiaLite DB
325+
closeSpatiaLiteDb( handle );
326+
327+
// Persist last used SpatiaLite dir
328+
settings.setValue( "/UI/lastSpatiaLiteDir", myPath );
329+
// inserting this SQLite DB path
330+
QString baseKey = "/SpatiaLite/connections/";
331+
settings.setValue( baseKey + "selected", myName );
332+
baseKey += myName;
333+
settings.setValue( baseKey + "/sqlitepath", myFI.canonicalFilePath() );
340334

341335
populateConnectionList();
342336
}

0 commit comments

Comments
 (0)
Please sign in to comment.