Skip to content
Permalink
Browse files

Standardise browser item behavior for AFS provider

  • Loading branch information
nyalldawson committed Jul 25, 2018
1 parent 3425046 commit 6d5ba5a7866290d64653d3ab256f4ac2b53ffa5b
Showing with 17 additions and 2 deletions.
  1. +16 −2 src/providers/arcgisrest/qgsafsdataitems.cpp
  2. +1 −0 src/providers/arcgisrest/qgsafsdataitems.h
@@ -23,6 +23,7 @@
#include "qgsafssourceselect.h"
#endif

#include <QMessageBox>
#include <QCoreApplication>
#include <QSettings>
#include <QUrl>
@@ -131,11 +132,19 @@ QList<QAction *> QgsAfsConnectionItem::actions( QWidget *parent )
{
QList<QAction *> lst;

QAction *actionEdit = new QAction( tr( "Edit…" ), parent );
QAction *actionRefresh = new QAction( tr( "Refresh" ), parent );
connect( actionRefresh, &QAction::triggered, this, &QgsAfsConnectionItem::refreshConnection );
lst.append( actionRefresh );

QAction *separator = new QAction( parent );
separator->setSeparator( true );
lst.append( separator );

QAction *actionEdit = new QAction( tr( "Edit Connection…" ), parent );
connect( actionEdit, &QAction::triggered, this, &QgsAfsConnectionItem::editConnection );
lst.append( actionEdit );

QAction *actionDelete = new QAction( tr( "Delete" ), parent );
QAction *actionDelete = new QAction( tr( "Delete Connection" ), parent );
connect( actionDelete, &QAction::triggered, this, &QgsAfsConnectionItem::deleteConnection );
lst.append( actionDelete );

@@ -155,6 +164,11 @@ void QgsAfsConnectionItem::editConnection()

void QgsAfsConnectionItem::deleteConnection()
{
if ( QMessageBox::question( nullptr, QObject::tr( "Delete Connection" ),
QObject::tr( "Are you sure you want to delete the connection to %1?" ).arg( mName ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
return;

QgsOwsConnection::deleteConnection( QStringLiteral( "arcgisfeatureserver" ), mName );
mParent->refresh();
}
@@ -56,6 +56,7 @@ class QgsAfsConnectionItem : public QgsDataCollectionItem
#ifdef HAVE_GUI
void editConnection();
void deleteConnection();
void refreshConnection();
#endif

private:

0 comments on commit 6d5ba5a

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