@@ -201,11 +201,10 @@ QList<QAction *> QgsGeoPackageConnectionItem::actions()
201201{
202202 QList<QAction *> lst;
203203
204- // TODO: implement layer deletion
205204
206- // QAction *actionRemoveConnection = new QAction( tr( "Remove connection" ), this );
207- // connect( actionDeleteLayer , &QAction::triggered, this, &QgsGeoPackageLayerItem::deleteLayer );
208- // lst.append( actionRemoveConnection );
205+ QAction *actiondeleteConnection = new QAction ( tr ( " Remove connection" ), this );
206+ connect ( actiondeleteConnection , &QAction::triggered, this , &QgsGeoPackageConnectionItem::deleteConnection );
207+ lst.append ( actiondeleteConnection );
209208 return lst;
210209}
211210#endif
@@ -240,15 +239,18 @@ QgsLayerItem::LayerType QgsGeoPackageConnectionItem::layerTypeFromDb( const QStr
240239 return QgsLayerItem::LayerType::NoType;
241240}
242241
242+ void QgsGeoPackageConnectionItem::deleteConnection ()
243+ {
244+ QgsGeoPackageConnection::deleteConnection ( name () );
245+ mParent ->refreshConnections ();
246+ }
247+
243248#ifdef HAVE_GUI
244249QList<QAction *> QgsGeoPackageAbstractLayerItem::actions ()
245250{
246251 QList<QAction *> lst;
247252
248- QAction *actionDeleteLayer = new QAction ( tr ( " Delete Layer" ), this );
249- // TODO connect( actionDeleteLayer, &QAction::triggered, this, &QgsGeoPackageLayerItem::deleteLayer );
250- lst.append ( actionDeleteLayer );
251-
253+ // TODO: delete layer when the provider supports it (not currently implemented)
252254 return lst;
253255}
254256#endif
@@ -266,6 +268,7 @@ QgsGeoPackageVectorLayerItem::QgsGeoPackageVectorLayerItem( QgsDataItem *parent,
266268
267269}
268270
271+
269272QgsGeoPackageRasterLayerItem::QgsGeoPackageRasterLayerItem ( QgsDataItem *parent, QString name, QString path, QString uri )
270273 : QgsGeoPackageAbstractLayerItem( parent, name, path, uri, QgsLayerItem::LayerType::Raster, QStringLiteral( " gdal" ) )
271274{
0 commit comments