diff --git a/src/app/ogr/qgsogrsublayersdialog.cpp b/src/app/ogr/qgsogrsublayersdialog.cpp
index 5cac3bd..78df471 100644
--- a/src/app/ogr/qgsogrsublayersdialog.cpp
+++ b/src/app/ogr/qgsogrsublayersdialog.cpp
@@ -55,7 +55,12 @@ void QgsOGRSublayersDialog::populateLayerTable( QStringList theList, QString del
     QString line = theList.at( i );
     QStringList elements = line.split( delim );
     QStringList item = QStringList();
-    item << elements.at( 0 ) << elements.at( 1 ) << elements.at( 2 ) << elements.at( 3 );
+    for ( int j=0; j < elements.size(); j++ )
+        item << elements.at( j );
     layersTable->addTopLevelItem( new QTreeWidgetItem( item ) );
   }
+  /* resize columns */
+  for ( int j = 0; j < layersTable->columnCount(); j++ )
+      layersTable->resizeColumnToContents( j );
+  layersTable->setColumnWidth( 1, layersTable->columnWidth(1) + 10 ); 
 }
diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp
index 399f841..68132c2 100644
--- a/src/app/qgisapp.cpp
+++ b/src/app/qgisapp.cpp
@@ -2270,6 +2270,29 @@ void QgisApp::askUserForGDALSublayers( QgsRasterLayer *layer )
   }
 }
 
+bool shouldAskUserForGdalSublayers( QgsRasterLayer *layer ) 
+{
+  // return false if layer is empty or raster has no sublayers
+  if ( !layer ) 
+    return false;
+
+  if ( layer->subLayers().size() <= 0 )
+      return false;
+
+  QSettings settings;
+  int promptLayers = settings.value( "/qgis/promptForRasterSublayers", "if_need" ).toInt();
+  // 0 = Always -> always ask (if there are existing sublayers)
+  // 1 = If needed -> ask if layer has no bands but has sublayers
+  // 2 = Never
+
+  if ( (promptLayers == 0) || 
+       ( (promptLayers == 1) && (layer->bandCount() == 0) ) )
+    return true;
+  else //TODO log a message informing that the layer was not loaded because of prompLayers value
+    return false;
+}
+
+
 // This method is the method that does the real job. If the layer given in
 // parameter is NULL, then the method tries to act on the activeLayer.
 void QgisApp::askUserForOGRSublayers( QgsVectorLayer *layer )
@@ -6472,7 +6495,22 @@ QgsRasterLayer* QgisApp::addRasterLayer( QString const & rasterFile, QString con
   QgsRasterLayer *layer =
     new QgsRasterLayer( rasterFile, baseName ); // fi.completeBaseName());
 
-  if ( !addRasterLayer( layer ) )
+  bool bOK = false;
+
+  if ( shouldAskUserForGdalSublayers( layer ) )
+  {
+    askUserForGDALSublayers( layer );
+    bOK = TRUE;
+    // The first layer loaded is not useful in that case. The user can select it in
+    // the list if he wants to load it.
+    delete layer;
+  }
+  else
+  {
+    bOK = addRasterLayer( layer );
+  }
+
+  if ( ! bOK )
   {
     mMapCanvas->freeze( false );
     QApplication::restoreOverrideCursor();
@@ -6556,7 +6594,15 @@ QgsRasterLayer* QgisApp::addRasterLayer(
 
   QgsDebugMsg( "Constructed new layer." );
 
-  if ( layer && layer->isValid() )
+  if ( layer && shouldAskUserForGdalSublayers( layer ) )
+  { 
+    askUserForGDALSublayers( layer );
+
+    // The first layer loaded is not useful in that case. The user can select it in
+    // the list if he wants to load it.
+    delete layer;
+  }
+  else if ( layer && layer->isValid() )
   {
     addRasterLayer( layer );
 
@@ -6582,7 +6628,6 @@ QgsRasterLayer* QgisApp::addRasterLayer(
 } // QgisApp::addRasterLayer
 
 
-
 //create a raster layer object and delegate to addRasterLayer(QgsRasterLayer *)
 bool QgisApp::addRasterLayers( QStringList const &theFileNameQStringList, bool guiWarning )
 {
@@ -6627,9 +6672,8 @@ bool QgisApp::addRasterLayers( QStringList const &theFileNameQStringList, bool g
 
       // create the layer
       QgsRasterLayer *layer = new QgsRasterLayer( *myIterator, myBaseNameQString );
-      QStringList sublayers = layer->subLayers();
 
-      if ( sublayers.size() > 0 )
+      if ( shouldAskUserForGdalSublayers( layer ) )
       {
         askUserForGDALSublayers( layer );
 
diff --git a/src/app/qgsbrowserdockwidget.cpp b/src/app/qgsbrowserdockwidget.cpp
index 5906bc9..b4616de 100644
--- a/src/app/qgsbrowserdockwidget.cpp
+++ b/src/app/qgsbrowserdockwidget.cpp
@@ -129,8 +129,8 @@ void QgsBrowserDockWidget::itemClicked( const QModelIndex& index )
   QgsMapLayer* layer = NULL;
   if ( type == QgsMapLayer::VectorLayer )
   {
-    layer = new QgsVectorLayer( uri, layerItem->name(), providerKey );
-  }
+    layer = QgisApp::instance()->addVectorLayer( uri, layerItem->name(), providerKey );
+   }
   if ( type == QgsMapLayer::RasterLayer )
   {
     // This should go to WMS provider
@@ -159,18 +159,8 @@ void QgsBrowserDockWidget::itemClicked( const QModelIndex& index )
     QgsDebugMsg( "rasterLayerPath = " + rasterLayerPath );
     QgsDebugMsg( "layers = " + layers.join( " " ) );
 
-    layer = new QgsRasterLayer( 0, rasterLayerPath, layerItem->name(), providerKey, layers, styles, format, crs );
-  }
-
-  if ( !layer || !layer->isValid() )
-  {
-    qDebug( "No layer" );
-    delete layer;
-    return;
+    layer = QgisApp::instance()->addRasterLayer( rasterLayerPath, layerItem->name(), providerKey, layers, styles, format, crs );
   }
-
-  // add layer to the application
-  QgsMapLayerRegistry::instance()->addMapLayer( layer );
 }
 
 void QgsBrowserDockWidget::showContextMenu( const QPoint & pt )
diff --git a/src/app/qgsoptions.cpp b/src/app/qgsoptions.cpp
index e48f4c9..a9b5151 100644
--- a/src/app/qgsoptions.cpp
+++ b/src/app/qgsoptions.cpp
@@ -184,6 +184,13 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
 
   spinBoxAttrTableRowCache->setValue( settings.value( "/qgis/attributeTableRowCache", 10000 ).toInt() );
 
+  // set the prompt for raster sublayers
+  cmbPromptRasterSublayers->clear();
+  cmbPromptRasterSublayers->addItem( tr( "Always" ) );
+  cmbPromptRasterSublayers->addItem( tr( "If needed" ) ); //this means, prompt if there are sublayers but no band in the main dataset
+  cmbPromptRasterSublayers->addItem( tr( "Never" ) );
+  cmbPromptRasterSublayers->setCurrentIndex( settings.value( "/qgis/promptForRasterSublayers", 0 ).toInt() );
+
   // set the display update threshold
   spinBoxUpdateThreshold->setValue( settings.value( "/Map/updateThreshold" ).toInt() );
   //set the default projection behaviour radio buttongs
@@ -600,6 +607,7 @@ void QgsOptions::saveOptions()
   settings.setValue( "/qgis/dockAttributeTable", cbxAttributeTableDocked->isChecked() );
   settings.setValue( "/qgis/attributeTableBehaviour", cmbAttrTableBehaviour->currentIndex() );
   settings.setValue( "/qgis/attributeTableRowCache", spinBoxAttrTableRowCache->value() );
+  settings.setValue( "/qgis/promptForRasterSublayers", cmbPromptRasterSublayers->currentIndex() );
   settings.setValue( "/qgis/dockIdentifyResults", cbxIdentifyResultsDocked->isChecked() );
   settings.setValue( "/qgis/dockSnapping", cbxSnappingOptionsDocked->isChecked() );
   settings.setValue( "/qgis/addPostgisDC", cbxAddPostgisDC->isChecked() );
diff --git a/src/providers/gdal/qgsgdalprovider.cpp b/src/providers/gdal/qgsgdalprovider.cpp
index b2666fc..138c028 100644
--- a/src/providers/gdal/qgsgdalprovider.cpp
+++ b/src/providers/gdal/qgsgdalprovider.cpp
@@ -172,15 +172,29 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri )
   GDALRasterBandH myGDALBand = GDALGetRasterBand( mGdalDataset, 1 ); //just use the first band
   if ( myGDALBand == NULL )
   {
-    QMessageBox::warning( 0, QObject::tr( "Warning" ),
-                          QObject::tr( "Cannot get GDAL raster band: %1" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
-
-    GDALDereferenceDataset( mGdalBaseDataset );
-    mGdalBaseDataset = NULL;
+    QString msg= QString::fromUtf8( CPLGetLastErrorMsg() );
+    QStringList layers = subLayers();
 
-    GDALClose( mGdalDataset );
-    mGdalDataset = NULL;
-    return;
+    /* if there are no subdatasets, then close the dataset */
+    if ( layers.size() == 0 )
+    {
+      QMessageBox::warning( 0, QObject::tr( "Warning" ),
+                              QObject::tr( "Cannot get GDAL raster band: %1" ).arg( msg ) );
+        
+      GDALDereferenceDataset( mGdalBaseDataset );
+      mGdalBaseDataset = NULL;
+      
+      GDALClose( mGdalDataset );
+      mGdalDataset = NULL;
+      return;
+    }
+    /* if there are subdatasets, leave the dataset open for subsequent queries */
+    else
+    {
+      QgsDebugMsg( QObject::tr( "Cannot get GDAL raster band: %1" ).arg( msg ) + 
+                   QString(" but dataset has %1 subdatasets").arg( layers.size() ) );
+      return;
+    }
   }
 
   mHasPyramids = GDALGetOverviewCount( myGDALBand ) > 0;
@@ -1231,8 +1245,13 @@ QString QgsGdalProvider::description() const
 QStringList subLayers_( GDALDatasetH dataset )
 {
   QStringList subLayers;
+  char **metadata = NULL;
+
+  if ( dataset == NULL )
+    QgsDebugMsg( "QgsGdalProvider subLayers_(), dataset is NULL" );
+  else
+    metadata = GDALGetMetadata( dataset, "SUBDATASETS" );
 
-  char **metadata = GDALGetMetadata( dataset, "SUBDATASETS" );
   if ( metadata )
   {
     for ( int i = 0; metadata[i] != NULL; i++ )
diff --git a/src/ui/qgsoptionsbase.ui b/src/ui/qgsoptionsbase.ui
index d6a06a7..d007fc8 100644
--- a/src/ui/qgsoptionsbase.ui
+++ b/src/ui/qgsoptionsbase.ui
@@ -553,6 +553,48 @@
                 </item>
                </layout>
               </item>
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_12">
+                <item>
+                 <widget class="QLabel" name="textLabel1_13">
+                  <property name="sizePolicy">
+                   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                    <horstretch>0</horstretch>
+                    <verstretch>0</verstretch>
+                   </sizepolicy>
+                  </property>
+                  <property name="text">
+                   <string>Prompt for Raster sublayers</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="horizontalSpacer_10">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+                <item>
+                 <widget class="QComboBox" name="cmbPromptRasterSublayers">
+                  <property name="duplicatesEnabled">
+                   <bool>false</bool>
+                  </property>
+                  <item>
+                   <property name="text">
+                    <string/>
+                   </property>
+                  </item>
+                 </widget>
+                </item>
+               </layout>
+              </item>
              </layout>
             </widget>
            </item>
