5
5
#include " qgswmsconnection.h"
6
6
#include " qgswmssourceselect.h"
7
7
8
+ #include " qgsnewhttpconnection.h"
9
+
8
10
// ---------------------------------------------------------------------------
9
11
QgsWMSConnectionItem::QgsWMSConnectionItem ( QgsDataItem* parent, QString name, QString path )
10
12
: QgsDataCollectionItem( parent, name, path )
@@ -60,7 +62,43 @@ bool QgsWMSConnectionItem::equal( const QgsDataItem *other )
60
62
const QgsWMSConnectionItem *o = dynamic_cast <const QgsWMSConnectionItem *>( other );
61
63
return ( mPath == o->mPath && mName == o->mName && mConnInfo == o->mConnInfo );
62
64
}
65
+
66
+ QList<QAction*> QgsWMSConnectionItem::actions ()
67
+ {
68
+ QList<QAction*> lst;
69
+
70
+ QAction* actionEdit = new QAction ( tr ( " Edit..." ), this );
71
+ connect ( actionEdit, SIGNAL ( triggered () ), this , SLOT ( editConnection () ) );
72
+ lst.append ( actionEdit );
73
+
74
+ QAction* actionDelete = new QAction ( tr ( " Delete" ), this );
75
+ connect ( actionDelete, SIGNAL ( triggered () ), this , SLOT ( deleteConnection () ) );
76
+ lst.append ( actionDelete );
77
+
78
+ return lst;
79
+ }
80
+
81
+ void QgsWMSConnectionItem::editConnection ()
82
+ {
83
+ QgsNewHttpConnection nc ( 0 , " /Qgis/connections-wms/" , mName );
84
+
85
+ if ( nc.exec () )
86
+ {
87
+ // the parent should be updated
88
+ mParent ->refresh ();
89
+ }
90
+ }
91
+
92
+ void QgsWMSConnectionItem::deleteConnection ()
93
+ {
94
+ QgsWMSConnection::deleteConnection ( mName );
95
+ // the parent should be updated
96
+ mParent ->refresh ();
97
+ }
98
+
99
+
63
100
// ---------------------------------------------------------------------------
101
+
64
102
QgsWMSLayerItem::QgsWMSLayerItem ( QgsDataItem* parent, QString name, QString path, QgsWmsCapabilitiesProperty capabilitiesProperty, QString connInfo, QgsWmsLayerProperty layerProperty )
65
103
: QgsLayerItem( parent, name, path, QString(), QgsLayerItem::Raster, "wms" ),
66
104
mCapabilitiesProperty( capabilitiesProperty ),
@@ -170,6 +208,18 @@ QVector<QgsDataItem*>QgsWMSRootItem::createChildren()
170
208
return connections;
171
209
}
172
210
211
+ QList<QAction*> QgsWMSRootItem::actions ()
212
+ {
213
+ QList<QAction*> lst;
214
+
215
+ QAction* actionNew = new QAction ( tr ( " New..." ), this );
216
+ connect ( actionNew, SIGNAL ( triggered () ), this , SLOT ( newConnection () ) );
217
+ lst.append ( actionNew );
218
+
219
+ return lst;
220
+ }
221
+
222
+
173
223
QWidget * QgsWMSRootItem::paramWidget ()
174
224
{
175
225
QgsWMSSourceSelect *select = new QgsWMSSourceSelect ( 0 , 0 , true , true );
@@ -181,6 +231,17 @@ void QgsWMSRootItem::connectionsChanged()
181
231
refresh ();
182
232
}
183
233
234
+ void QgsWMSRootItem::newConnection ()
235
+ {
236
+ QgsNewHttpConnection nc ( 0 );
237
+
238
+ if ( nc.exec () )
239
+ {
240
+ refresh ();
241
+ }
242
+ }
243
+
244
+
184
245
// ---------------------------------------------------------------------------
185
246
186
247
QGISEXTERN QgsDataItem * dataItem ( QString thePath, QgsDataItem* parentItem )
0 commit comments