Skip to content

Commit

Permalink
added refresh action on wms connection items
Browse files Browse the repository at this point in the history
  • Loading branch information
Samweli authored and nyalldawson committed Jan 18, 2020
1 parent 35550ef commit 7340f6a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/providers/wms/qgswmsdataitemguiproviders.cpp
Expand Up @@ -43,6 +43,12 @@ void QgsWmsDataItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *m
{
if ( QgsWMSConnectionItem *connItem = qobject_cast< QgsWMSConnectionItem * >( item ) )
{
QAction *actionRefresh = new QAction( tr( "Refresh" ), this );
connect( actionRefresh, &QAction::triggered, this, [connItem] { refreshConnection( connItem ); } );
menu->addAction( actionRefresh );

menu->addSeparator();

QAction *actionEdit = new QAction( tr( "Edit…" ), this );
connect( actionEdit, &QAction::triggered, this, [connItem] { editConnection( connItem ); } );
menu->addAction( actionEdit );
Expand Down Expand Up @@ -97,6 +103,14 @@ void QgsWmsDataItemGuiProvider::newConnection( QgsDataItem *item )
}
}

void QgsWmsDataItemGuiProvider::refreshConnection( QgsDataItem *item )
{
item->refresh();
// the parent should be updated
if ( item->parent() )
item->parent()->refreshConnections();
}


// -----------

Expand Down
1 change: 1 addition & 0 deletions src/providers/wms/qgswmsdataitemguiproviders.h
Expand Up @@ -31,6 +31,7 @@ class QgsWmsDataItemGuiProvider : public QObject, public QgsDataItemGuiProvider
QWidget *createParamWidget( QgsDataItem *root, QgsDataItemGuiContext ) override;

private:
static void refreshConnection( QgsDataItem *item );
static void editConnection( QgsDataItem *item );
static void deleteConnection( QgsDataItem *item );
static void newConnection( QgsDataItem *item );
Expand Down

0 comments on commit 7340f6a

Please sign in to comment.