mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-04 00:30:59 -05:00
[geonode] fix data item context menu
This commit is contained in:
parent
9d49a8e9e2
commit
f225ee06b7
@ -102,10 +102,7 @@ QStringList QgsGeoNodeConnectionUtils::connectionList()
|
||||
|
||||
void QgsGeoNodeConnectionUtils::deleteConnection( const QString &name )
|
||||
{
|
||||
QgsSettings settings;
|
||||
// Add Section manually
|
||||
settings.remove( QStringLiteral( "qgis/connections-geonode/" ) + name );
|
||||
settings.remove( QStringLiteral( "qgis/geonode/" ) + name );
|
||||
QgsOwsConnection::deleteConnection( QStringLiteral( "GEONODE" ), name );
|
||||
}
|
||||
|
||||
QString QgsGeoNodeConnectionUtils::pathGeoNodeConnection()
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "qgsgeonodedataitems.h"
|
||||
#include "qgsgeonodenewconnection.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
void QgsGeoNodeDataItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *menu, const QList<QgsDataItem *> &, QgsDataItemGuiContext )
|
||||
{
|
||||
if ( QgsGeoNodeRootItem *rootItem = qobject_cast< QgsGeoNodeRootItem * >( item ) )
|
||||
@ -25,7 +27,7 @@ void QgsGeoNodeDataItemGuiProvider::populateContextMenu( QgsDataItem *item, QMen
|
||||
connect( actionNew, &QAction::triggered, this, [rootItem] { newConnection( rootItem ); } );
|
||||
menu->addAction( actionNew );
|
||||
}
|
||||
else if ( QgsGeoNodeRootItem *connItem = qobject_cast< QgsGeoNodeRootItem * >( item ) )
|
||||
else if ( QgsGeoNodeConnectionItem *connItem = qobject_cast< QgsGeoNodeConnectionItem * >( item ) )
|
||||
{
|
||||
QAction *actionEdit = new QAction( tr( "Edit Connection…" ), menu );
|
||||
connect( actionEdit, &QAction::triggered, this, [connItem] { editConnection( connItem ); } );
|
||||
@ -61,6 +63,10 @@ void QgsGeoNodeDataItemGuiProvider::editConnection( QgsDataItem *item )
|
||||
|
||||
void QgsGeoNodeDataItemGuiProvider::deleteConnection( QgsDataItem *item )
|
||||
{
|
||||
if ( QMessageBox::question( nullptr, tr( "Delete Connection" ), tr( "Are you sure you want to delete the connection “%1”?" ).arg( item->name() ),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
|
||||
return;
|
||||
|
||||
QgsGeoNodeConnectionUtils::deleteConnection( item->name() );
|
||||
item->parent()->refresh();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user