@@ -50,6 +50,8 @@ QgsAttributeActionDialog::QgsAttributeActionDialog( QgsAttributeAction* actions,
50
50
connect ( moveUpButton, SIGNAL ( clicked () ), this , SLOT ( moveUp () ) );
51
51
connect ( moveDownButton, SIGNAL ( clicked () ), this , SLOT ( moveDown () ) );
52
52
connect ( removeButton, SIGNAL ( clicked () ), this , SLOT ( remove () ) );
53
+ connect ( addDefaultActionsButton, SIGNAL ( clicked () ), this , SLOT ( addDefaultActions () ) );
54
+
53
55
connect ( browseButton, SIGNAL ( clicked () ), this , SLOT ( browse () ) );
54
56
connect ( insertButton, SIGNAL ( clicked () ), this , SLOT ( insert () ) );
55
57
connect ( updateButton, SIGNAL ( clicked () ), this , SLOT ( update () ) );
@@ -319,6 +321,18 @@ void QgsAttributeActionDialog::apply()
319
321
}
320
322
}
321
323
324
+ void QgsAttributeActionDialog::addDefaultActions ()
325
+ {
326
+ int pos = 0 ;
327
+ insertRow ( pos++, QgsAction::Generic, tr ( " Echo attribute's value" ), " echo \" [% \" MY_FIELD\" %]\" " , true );
328
+ insertRow ( pos++, QgsAction::Generic, tr ( " Run an application" ), " ogr2ogr -f \" ESRI Shapefile\" \" [% \" OUTPUT_PATH\" %]\" \" [% \" INPUT_FILE\" %]\" " , true );
329
+ insertRow ( pos++, QgsAction::GenericPython, tr ( " Get feature id" ), " QtGui.QMessageBox.information(None, \" Feature id\" , \" feature id is [% $id %]\" )" , false );
330
+ insertRow ( pos++, QgsAction::GenericPython, tr ( " Selected field's value (Identify features tool)" ), " QtGui.QMessageBox.information(None, \" Current field's value\" , \" [% $currentfield %]\" )" , false );
331
+ insertRow ( pos++, QgsAction::GenericPython, tr ( " Clicked coordinates (Run feature actions tool)" ), " QtGui.QMessageBox.information(None, \" Clicked coords\" , \" layer: [% $layerid %]\\ ncoords: ([% $clickx %],[% $clickx %])\" )" , false );
332
+ insertRow ( pos++, QgsAction::OpenUrl, tr ( " Open file" ), " [% \" PATH\" %]" , false );
333
+ insertRow ( pos++, QgsAction::OpenUrl, tr ( " Search on web based on attribute's value" ), " http://www.google.it/?q=[% \" ATTRIBUTE\" %]" , false );
334
+ }
335
+
322
336
void QgsAttributeActionDialog::itemSelectionChanged ()
323
337
{
324
338
QList<QTableWidgetItem *> selection = attributeActionTable->selectedItems ();
0 commit comments