Skip to content

Commit

Permalink
Delete gpkg connections
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Aug 9, 2017
1 parent bc921b4 commit 92da308
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
19 changes: 11 additions & 8 deletions src/providers/ogr/qgsgeopackagedataitems.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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" ) )
{
Expand Down
7 changes: 2 additions & 5 deletions src/providers/ogr/qgsgeopackagedataitems.h
Expand Up @@ -32,11 +32,6 @@ class QgsGeoPackageAbstractLayerItem : public QgsLayerItem
#ifdef HAVE_GUI
QList<QAction *> actions() override;
#endif

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


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

};


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

};


Expand Down

0 comments on commit 92da308

Please sign in to comment.