961 changes: 634 additions & 327 deletions resources/customization.xml

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions src/app/qgscustomprojectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ long QgsCustomProjectionDialog::getRecordCount()
int myResult;
long myRecordCount = 0;
//check the db is available
myResult = sqlite3_open( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult != SQLITE_OK )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down Expand Up @@ -198,7 +198,7 @@ QString QgsCustomProjectionDialog::getProjectionFamilyName( QString theProjectio
int myResult;
QString myName;
//check the db is available
myResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult != SQLITE_OK )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down Expand Up @@ -229,7 +229,7 @@ QString QgsCustomProjectionDialog::getEllipsoidName( QString theEllipsoidAcronym
int myResult;
QString myName;
//check the db is available
myResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult != SQLITE_OK )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down Expand Up @@ -260,7 +260,7 @@ QString QgsCustomProjectionDialog::getProjectionFamilyAcronym( QString theProjec
int myResult;
QString myName;
//check the db is available
myResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult != SQLITE_OK )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down Expand Up @@ -291,7 +291,7 @@ QString QgsCustomProjectionDialog::getEllipsoidAcronym( QString theEllipsoidName
int myResult;
QString myName;
//check the db is available
myResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult != SQLITE_OK )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down Expand Up @@ -323,7 +323,7 @@ void QgsCustomProjectionDialog::on_pbnFirst_clicked()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult != SQLITE_OK )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down Expand Up @@ -395,7 +395,7 @@ void QgsCustomProjectionDialog::on_pbnPrevious_clicked()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult != SQLITE_OK )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down Expand Up @@ -468,7 +468,7 @@ void QgsCustomProjectionDialog::on_pbnNext_clicked()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult != SQLITE_OK )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down Expand Up @@ -537,7 +537,7 @@ void QgsCustomProjectionDialog::on_pbnLast_clicked()
sqlite3_stmt *myPreparedStatement;
int myResult;
//check the db is available
myResult = sqlite3_open( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult != SQLITE_OK )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ void QgsOptions::getEllipsoidList()

cmbEllipsoid->addItem( ELLIPS_FLAT_DESC );
//check the db is available
myResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down Expand Up @@ -1015,7 +1015,7 @@ QString QgsOptions::getEllipsoidAcronym( QString theEllipsoidName )
int myResult;
QString myName( ELLIPS_FLAT );
//check the db is available
myResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down Expand Up @@ -1047,7 +1047,7 @@ QString QgsOptions::getEllipsoidName( QString theEllipsoidAcronym )
int myResult;
QString myName( ELLIPS_FLAT_DESC );
//check the db is available
myResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down
18 changes: 12 additions & 6 deletions src/core/qgsdataitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,12 @@ QgsZipItem::~QgsZipItem()

// internal function to scan a vsidir (zip or tar file) recursively
// GDAL trunk has this since r24423 (05/16/12) - VSIReadDirRecursive()
// use a copy of the function internally for now
// use a copy of the function internally for now,
// but use char ** and CSLAddString, because CPLStringList was added in gdal-1.9
char **VSIReadDirRecursive1( const char *pszPath )
{
CPLStringList oFiles = NULL;
// CPLStringList oFiles = NULL;
char **papszOFiles = NULL;
char **papszFiles1 = NULL;
char **papszFiles2 = NULL;
VSIStatBufL psStatBuf;
Expand All @@ -805,7 +807,8 @@ char **VSIReadDirRecursive1( const char *pszPath )
if ( VSIStatL( osTemp1.c_str(), &psStatBuf ) == 0 &&
VSI_ISREG( psStatBuf.st_mode ) )
{
oFiles.AddString( papszFiles1[i] );
// oFiles.AddString( papszFiles1[i] );
papszOFiles = CSLAddString( papszOFiles, papszFiles1[i] );
}
else if ( VSIStatL( osTemp1.c_str(), &psStatBuf ) == 0 &&
VSI_ISDIR( psStatBuf.st_mode ) )
Expand All @@ -814,7 +817,8 @@ char **VSIReadDirRecursive1( const char *pszPath )
osTemp2.clear();
osTemp2.append( papszFiles1[i] );
osTemp2.append( "/" );
oFiles.AddString( osTemp2.c_str() );
// oFiles.AddString( osTemp2.c_str() );
papszOFiles = CSLAddString( papszOFiles, osTemp2.c_str() );

// recursively add files inside directory
papszFiles2 = VSIReadDirRecursive1( osTemp1.c_str() );
Expand All @@ -827,15 +831,17 @@ char **VSIReadDirRecursive1( const char *pszPath )
osTemp2.append( papszFiles1[i] );
osTemp2.append( "/" );
osTemp2.append( papszFiles2[j] );
oFiles.AddString( osTemp2.c_str() );
// oFiles.AddString( osTemp2.c_str() );
papszOFiles = CSLAddString( papszOFiles, osTemp2.c_str() );
}
CSLDestroy( papszFiles2 );
}
}
}
CSLDestroy( papszFiles1 );

return oFiles.StealList();
// return oFiles.StealList();
return papszOFiles;
}

QVector<QgsDataItem*> QgsZipItem::createChildren( )
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsdistancearea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )
}

//check the db is available
myResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult )
{
QgsMessageLog::logMessage( QObject::tr( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ bool QgsMapLayer::loadNamedStyleFromDb( const QString db, const QString theURI,
if ( !QFile( db ).exists() )
return false;

myResult = sqlite3_open( db.toUtf8().data(), &myDatabase );
myResult = sqlite3_open_v2( db.toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL );
if ( myResult != SQLITE_OK )
{
return false;
Expand Down
18 changes: 17 additions & 1 deletion src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2403,7 +2403,23 @@ int QgsVectorLayer::splitFeatures( const QList<QgsPoint>& splitLine, bool topolo
newGeometry = newGeometries.at( i );
QgsFeature newFeature;
newFeature.setGeometry( newGeometry );
newFeature.setAttributeMap( select_it->attributeMap() );

//use default value where possible (primary key issue), otherwise the value from the original (splitted) feature
QgsAttributeMap newAttributes = select_it->attributeMap();
QVariant defaultValue;
for ( int j = 0; j < newAttributes.size(); ++j )
{
if ( mDataProvider )
{
defaultValue = mDataProvider->defaultValue( j );
if ( !defaultValue.isNull() )
{
newAttributes.insert( j, defaultValue );
}
}
}

newFeature.setAttributeMap( newAttributes );
newFeatures.append( newFeature );
}

Expand Down
14 changes: 7 additions & 7 deletions src/gui/qgsprojectionselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ QString QgsProjectionSelector::selectedProj4String()
QgsDebugMsg( "db = " + databaseFileName );

sqlite3 *database;
int rc = sqlite3_open( databaseFileName.toUtf8().data(), &database );
int rc = sqlite3_open_v2( databaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL );
if ( rc )
{
showDBMissingWarning( databaseFileName );
Expand Down Expand Up @@ -401,7 +401,7 @@ QString QgsProjectionSelector::getSelectedExpression( QString expression )
// assuming that it will never be used anywhere else. Given the low overhead,
// opening it each time seems to be a reasonable approach at this time.
sqlite3 *database;
int rc = sqlite3_open( databaseFileName.toUtf8().data(), &database );
int rc = sqlite3_open_v2( databaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL );
if ( rc )
{
showDBMissingWarning( databaseFileName );
Expand Down Expand Up @@ -520,7 +520,7 @@ void QgsProjectionSelector::loadUserCrsList( QSet<QString> *crsFilter )
const char *tail;
sqlite3_stmt *stmt;
//check the db is available
int result = sqlite3_open( databaseFileName.toUtf8().constData(), &database );
int result = sqlite3_open_v2( databaseFileName.toUtf8().constData(), &database, SQLITE_OPEN_READONLY, NULL );
if ( result )
{
// XXX This will likely never happen since on open, sqlite creates the
Expand Down Expand Up @@ -599,7 +599,7 @@ void QgsProjectionSelector::loadCrsList( QSet<QString> *crsFilter )

// open the database containing the spatial reference data
sqlite3 *database;
int rc = sqlite3_open( mSrsDatabaseFileName.toUtf8().data(), &database );
int rc = sqlite3_open_v2( mSrsDatabaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL );
if ( rc )
{
// XXX This will likely never happen since on open, sqlite creates the
Expand Down Expand Up @@ -873,7 +873,7 @@ long QgsProjectionSelector::getLargestCRSIDMatch( QString theSql )
QString databaseFileName = QgsApplication::qgisUserDbFilePath();
if ( QFileInfo( databaseFileName ).exists() ) //only bother trying to open if the file exists
{
result = sqlite3_open( databaseFileName.toUtf8().data(), &database );
result = sqlite3_open_v2( databaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL );
if ( result )
{
// XXX This will likely never happen since on open, sqlite creates the
Expand All @@ -899,7 +899,7 @@ long QgsProjectionSelector::getLargestCRSIDMatch( QString theSql )
else
{
//only bother looking in srs.db if it wasnt found above
result = sqlite3_open( mSrsDatabaseFileName.toUtf8().data(), &database );
result = sqlite3_open_v2( mSrsDatabaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL );
if ( result )
{
QgsDebugMsg( QString( "Can't open * user * database: %1" ).arg( sqlite3_errmsg( database ) ) );
Expand Down Expand Up @@ -929,7 +929,7 @@ QStringList QgsProjectionSelector::authorities()
const char *tail;
sqlite3_stmt *stmt;

int result = sqlite3_open( mSrsDatabaseFileName.toUtf8().data(), &database );
int result = sqlite3_open_v2( mSrsDatabaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL );
if ( result )
{
QgsDebugMsg( QString( "Can't open * user * database: %1" ).arg( sqlite3_errmsg( database ) ) );
Expand Down
14 changes: 10 additions & 4 deletions src/gui/symbology-ng/qgssymbollevelsv2dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,18 @@ QgsSymbolLevelsV2Dialog::QgsSymbolLevelsV2Dialog( QgsLegendSymbolList list, bool

connect( chkEnable, SIGNAL( clicked() ), this, SLOT( updateUi() ) );

if ( mList.count() > 0 && !mList[0].second )
{
// remove symbolless entry (probably classifier of categorized renderer)
mList.removeFirst();
}

int maxLayers = 0;
tableLevels->setRowCount( list.count() );
for ( int i = 0; i < list.count(); i++ )
tableLevels->setRowCount( mList.count() );
for ( int i = 0; i < mList.count(); i++ )
{
QgsSymbolV2* sym = list[i].second;
QString label = list[i].first;
QgsSymbolV2* sym = mList[i].second;
QString label = mList[i].first;

// set icons for the rows
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( sym, QSize( 16, 16 ) );
Expand Down
2 changes: 1 addition & 1 deletion src/helpviewer/qgshelpviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ int QgsHelpViewer::connectDb( const QString &helpDbPath )
if ( QFileInfo( helpDbPath ).exists() )
{
int rc;
rc = sqlite3_open( helpDbPath.toUtf8().data(), &db );
rc = sqlite3_open_v2( helpDbPath.toUtf8().data(), &db, SQLITE_OPEN_READONLY, NULL );
result = rc;
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/providers/mssql/qgsmssqlprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ QString QgsMssqlProvider::name() const
return TEXT_PROVIDER_KEY;
} // ::name()

bool QgsMssqlProvider::setSubsetString( QString theSQL, bool updateFeatureCount )
bool QgsMssqlProvider::setSubsetString( QString theSQL, bool )
{
Q_UNUSED(updateFeatureCount);
QString prevWhere = mSqlWhereClause;
Expand Down
18 changes: 18 additions & 0 deletions tests/src/core/testziplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class TestZipLayer: public QObject
void testGZipItemVectorTransparency();
void testZipItemRasterTransparency();
void testGZipItemRasterTransparency();
//make sure items inside subfolders can be read
void testZipItemSubfolder();
};


Expand Down Expand Up @@ -215,6 +217,12 @@ void TestZipLayer::initTestCase()
{
QgsApplication::init();
QgsApplication::initQgis();

// output test environment
QgsApplication::showSettings();
qDebug() << "GDAL version (build): " << GDAL_RELEASE_NAME;
qDebug() << "GDAL version (runtime): " << GDALVersionInfo( "RELEASE_NAME" );

// save data dir
mDataDir = QString( TEST_DATA_DIR ) + QDir::separator();
// Set up the QSettings environment
Expand Down Expand Up @@ -370,5 +378,15 @@ void TestZipLayer::testGZipItemRasterTransparency()
QVERIFY2(( myTransparency == myTarget ), QString( "Transparency is %1, should be %2" ).arg( myTransparency ).arg( myTarget ).toLocal8Bit().data() );
}

void TestZipLayer::testZipItemSubfolder()
{
QSettings settings;
for ( int i = 2 ; i <= mMaxScanZipSetting ; i++ )
{
settings.setValue( "/qgis/scanZipInBrowser", i );
QVERIFY( i == settings.value( "/qgis/scanZipInBrowser" ).toInt() );
QVERIFY( testZipItem( mDataDir + "testzip.zip", "folder/folder2/landsat_b2.tif" ) );
}
}
QTEST_MAIN( TestZipLayer )
#include "moc_testziplayer.cxx"
Binary file modified tests/testdata/testzip.zip
Binary file not shown.