Skip to content
Permalink
Browse files

Delete gpkg connections

  • Loading branch information
elpaso committed Aug 9, 2017
1 parent bc921b4 commit 92da3084668cce87cf108e4e39e4e21e9e455590
Showing with 13 additions and 13 deletions.
  1. +11 −8 src/providers/ogr/qgsgeopackagedataitems.cpp
  2. +2 −5 src/providers/ogr/qgsgeopackagedataitems.h
@@ -201,11 +201,10 @@ QList<QAction *> QgsGeoPackageConnectionItem::actions()
{
QList<QAction *> lst;

// TODO: implement layer deletion

//QAction *actionRemoveConnection = new QAction( tr( "Remove connection" ), this );
// connect( actionDeleteLayer, &QAction::triggered, this, &QgsGeoPackageLayerItem::deleteLayer );
//lst.append( actionRemoveConnection );
QAction *actiondeleteConnection = new QAction( tr( "Remove connection" ), this );
connect( actiondeleteConnection, &QAction::triggered, this, &QgsGeoPackageConnectionItem::deleteConnection );
lst.append( actiondeleteConnection );
return lst;
}
#endif
@@ -240,15 +239,18 @@ QgsLayerItem::LayerType QgsGeoPackageConnectionItem::layerTypeFromDb( const QStr
return QgsLayerItem::LayerType::NoType;
}

void QgsGeoPackageConnectionItem::deleteConnection()
{
QgsGeoPackageConnection::deleteConnection( name() );
mParent->refreshConnections();
}

#ifdef HAVE_GUI
QList<QAction *> QgsGeoPackageAbstractLayerItem::actions()
{
QList<QAction *> lst;

QAction *actionDeleteLayer = new QAction( tr( "Delete Layer" ), this );
// TODO connect( actionDeleteLayer, &QAction::triggered, this, &QgsGeoPackageLayerItem::deleteLayer );
lst.append( actionDeleteLayer );

// TODO: delete layer when the provider supports it (not currently implemented)
return lst;
}
#endif
@@ -266,6 +268,7 @@ QgsGeoPackageVectorLayerItem::QgsGeoPackageVectorLayerItem( QgsDataItem *parent,

}


QgsGeoPackageRasterLayerItem::QgsGeoPackageRasterLayerItem( QgsDataItem *parent, QString name, QString path, QString uri )
: QgsGeoPackageAbstractLayerItem( parent, name, path, uri, QgsLayerItem::LayerType::Raster, QStringLiteral( "gdal" ) )
{
@@ -32,11 +32,6 @@ class QgsGeoPackageAbstractLayerItem : public QgsLayerItem
#ifdef HAVE_GUI
QList<QAction *> actions() override;
#endif

public slots:
#ifdef HAVE_GUI
void deleteLayer();
#endif
};


@@ -45,6 +40,7 @@ class QgsGeoPackageRasterLayerItem : public QgsGeoPackageAbstractLayerItem
Q_OBJECT
public:
QgsGeoPackageRasterLayerItem( QgsDataItem *parent, QString name, QString path, QString uri );

};


@@ -53,6 +49,7 @@ class QgsGeoPackageVectorLayerItem : public QgsGeoPackageAbstractLayerItem
Q_OBJECT
public:
QgsGeoPackageVectorLayerItem( QgsDataItem *parent, QString name, QString path, QString uri, LayerType layerType );

};


0 comments on commit 92da308

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