Skip to content
Permalink
Browse files

do not pass item as argument

  • Loading branch information
signedav committed Nov 15, 2018
1 parent fa06246 commit be0ce0ca4ce345f413f520a6cedb11db3f0d4ecd
Showing with 9 additions and 9 deletions.
  1. +8 −8 src/providers/ogr/qgsgeopackagedataitems.cpp
  2. +1 −1 src/providers/ogr/qgsgeopackagedataitems.h
@@ -86,10 +86,10 @@ QList<QAction *> QgsGeoPackageAbstractLayerItem::actions( QWidget * )
connect( actionDeleteLayer, &QAction::triggered, this, [ = ]
{
QList<QgsDataItem *> items = selectedItems();
for ( const QgsDataItem *item : items )
for ( QgsDataItem *item : items )
{
if ( const QgsGeoPackageAbstractLayerItem *gpkgAbstractItem = qobject_cast<const QgsGeoPackageAbstractLayerItem *>( item ) )
deleteLayer( gpkgAbstractItem );
if ( QgsGeoPackageAbstractLayerItem *gpkgAbstractItem = qobject_cast< QgsGeoPackageAbstractLayerItem *>( item ) )
gpkgAbstractItem->deleteLayer();
}
} ) ;
lst.append( actionDeleteLayer );
@@ -499,15 +499,15 @@ void QgsGeoPackageCollectionItem::vacuumGeoPackageDbAction()
}
}

void QgsGeoPackageAbstractLayerItem::deleteLayer( const QgsGeoPackageAbstractLayerItem *item )
void QgsGeoPackageAbstractLayerItem::deleteLayer()
{
//dave: here we are - we need to find out what other layers in the gpkg are selected and delete em
// Check if the layer(s) are in the registry
QList<QgsMapLayer *> layersList;
const auto mapLayers( QgsProject::instance()->mapLayers() );
for ( QgsMapLayer *layer : mapLayers )
{
if ( layer->publicSource() == item->uri() )
if ( layer->publicSource() == mUri )
{
layersList << layer;
}
@@ -516,13 +516,13 @@ void QgsGeoPackageAbstractLayerItem::deleteLayer( const QgsGeoPackageAbstractLay
if ( ! layersList.isEmpty( ) )
{
if ( QMessageBox::question( nullptr, QObject::tr( "Delete Layer" ), QObject::tr( "The layer <b>%1</b> exists in the current project <b>%2</b>,"
" do you want to remove it from the project and delete it?" ).arg( item->name(), layersList.at( 0 )->name() ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
" do you want to remove it from the project and delete it?" ).arg( mName, layersList.at( 0 )->name() ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
{
return;
}
}
else if ( QMessageBox::question( nullptr, QObject::tr( "Delete Layer" ),
QObject::tr( "Are you sure you want to delete layer <b>%1</b> from GeoPackage?" ).arg( item->name() ),
QObject::tr( "Are you sure you want to delete layer <b>%1</b> from GeoPackage?" ).arg( mName ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
{
return;
@@ -541,7 +541,7 @@ void QgsGeoPackageAbstractLayerItem::deleteLayer( const QgsGeoPackageAbstractLay
}
else
{
QMessageBox::information( nullptr, tr( "Delete Layer" ), tr( "Layer <b>%1</b> deleted successfully." ).arg( item->name() ) );
QMessageBox::information( nullptr, tr( "Delete Layer" ), tr( "Layer <b>%1</b> deleted successfully." ).arg( mName ) );
if ( mParent )
mParent->refreshConnections();
}
@@ -42,7 +42,7 @@ class QgsGeoPackageAbstractLayerItem : public QgsLayerItem
#ifdef HAVE_GUI
QList<QAction *> actions( QWidget *menu ) override;
public slots:
virtual void deleteLayer( const QgsGeoPackageAbstractLayerItem *item );
virtual void deleteLayer();
#endif
};

0 comments on commit be0ce0c

Please sign in to comment.
You can’t perform that action at this time.