Showing with 35 additions and 7 deletions.
  1. +2 −2 python/plugins/db_manager/dlg_import_vector.py
  2. +33 −5 src/app/qgisapp.cpp
4 changes: 2 additions & 2 deletions python/plugins/db_manager/dlg_import_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def chooseInputFile(self):
lastDir = settings.value("/db_manager/lastUsedDir", "")
lastVectorFormat = settings.value("/UI/lastVectorFileFilter", "")
# ask for a filename
filename = QFileDialog.getOpenFileName(self, self.tr("Choose the file to import"), lastDir, vectorFormats, lastVectorFormat)
(filename, lastVectorFormat) = QFileDialog.getOpenFileNameAndFilter(self, self.tr("Choose the file to import"), lastDir, vectorFormats, lastVectorFormat)
if filename == "":
return
# store the last used dir and format
settings.setValue("/db_manager/lastUsedDir", QFileInfo(filename).filePath())
#settings.setValue("/UI/lastVectorFileFilter", lastVectorFormat)
settings.setValue("/UI/lastVectorFileFilter", lastVectorFormat)

self.cboInputLayer.setEditText( filename )

Expand Down
38 changes: 33 additions & 5 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2657,10 +2657,17 @@ void QgisApp::askUserForGDALSublayers( QgsRasterLayer *layer )
name.replace( path, "" );
}
// remove any : or " left over
if ( name.startsWith( ":" ) ) name.remove( 0, 1 );
if ( name.startsWith( "\"" ) ) name.remove( 0, 1 );
if ( name.endsWith( ":" ) ) name.chop( 1 );
if ( name.endsWith( "\"" ) ) name.chop( 1 );
if ( name.startsWith( ":" ) )
name.remove( 0, 1 );

if ( name.startsWith( "\"" ) )
name.remove( 0, 1 );

if ( name.endsWith( ":" ) )
name.chop( 1 );

if ( name.endsWith( "\"" ) )
name.chop( 1 );

names << name;
layers << QString( "%1|%2" ).arg( i ).arg( name );
Expand Down Expand Up @@ -6555,7 +6562,8 @@ void QgisApp::histogramStretch( bool visibleAreaOnly, QgsRaster::ContrastEnhance
}

QgsRectangle myRectangle;
if ( visibleAreaOnly ) myRectangle = mMapCanvas->mapRenderer()->outputExtentToLayerExtent( myRasterLayer, mMapCanvas->extent() );
if ( visibleAreaOnly )
myRectangle = mMapCanvas->mapRenderer()->outputExtentToLayerExtent( myRasterLayer, mMapCanvas->extent() );

myRasterLayer->setContrastEnhancement( QgsContrastEnhancement::StretchToMinimumMaximum, theLimits, myRectangle );

Expand Down Expand Up @@ -7954,6 +7962,12 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )

mActionLocalHistogramStretch->setEnabled( false );
mActionFullHistogramStretch->setEnabled( false );
mActionLocalCumulativeCutStretch->setEnabled( false );
mActionFullCumulativeCutStretch->setEnabled( false );
mActionIncreaseBrightness->setEnabled( false );
mActionDecreaseBrightness->setEnabled( false );
mActionIncreaseContrast->setEnabled( false );
mActionDecreaseContrast->setEnabled( false );
mActionZoomActualSize->setEnabled( false );
mActionZoomToLayer->setEnabled( false );
return;
Expand Down Expand Up @@ -7985,6 +7999,12 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )

mActionLocalHistogramStretch->setEnabled( false );
mActionFullHistogramStretch->setEnabled( false );
mActionLocalCumulativeCutStretch->setEnabled( false );
mActionFullCumulativeCutStretch->setEnabled( false );
mActionIncreaseBrightness->setEnabled( false );
mActionDecreaseBrightness->setEnabled( false );
mActionIncreaseContrast->setEnabled( false );
mActionDecreaseContrast->setEnabled( false );
mActionZoomActualSize->setEnabled( false );
mActionLabeling->setEnabled( true );

Expand Down Expand Up @@ -8132,6 +8152,14 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionLocalHistogramStretch->setEnabled( false );
mActionFullHistogramStretch->setEnabled( false );
}

mActionLocalCumulativeCutStretch->setEnabled( true );
mActionFullCumulativeCutStretch->setEnabled( true );
mActionIncreaseBrightness->setEnabled( true );
mActionDecreaseBrightness->setEnabled( true );
mActionIncreaseContrast->setEnabled( true );
mActionDecreaseContrast->setEnabled( true );

mActionLayerSubsetString->setEnabled( false );
mActionFeatureAction->setEnabled( false );
mActionSelect->setEnabled( false );
Expand Down