Skip to content
Permalink
Browse files

fix #1650

git-svn-id: http://svn.osgeo.org/qgis/trunk@12378 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Dec 8, 2009
1 parent 1002f8e commit eef0367ba336cbb58e374a507bdf40ca045af1dc
@@ -89,18 +89,21 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
mZoomMapToSelectedRowsButton->setIcon( getThemeIcon( "/mActionZoomToSelected.png" ) );
mInvertSelectionButton->setIcon( getThemeIcon( "/mActionInvertSelection.png" ) );
mToggleEditingButton->setIcon( getThemeIcon( "/mActionToggleEditing.png" ) );
mDeleteSelectedButton->setIcon( getThemeIcon( "/mActionDeleteSelected.png" ) );
mOpenFieldCalculator->setIcon( getThemeIcon( "/mActionCalculateField.png" ) );
mAddAttribute->setIcon( getThemeIcon( "/mActionNewAttribute.png" ) );
mRemoveAttribute->setIcon( getThemeIcon( "/mActionDeleteAttribute.png" ) );

// toggle editing
bool canChangeAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues;
bool canDeleteFeatures = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteFeatures;
bool canAddAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes;
bool canDeleteAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteAttributes;
mToggleEditingButton->setCheckable( true );
mToggleEditingButton->setChecked( mLayer->isEditable() );
mToggleEditingButton->setEnabled( canChangeAttributes );
mOpenFieldCalculator->setEnabled( canChangeAttributes && mLayer->isEditable() );
mDeleteSelectedButton->setEnabled( canDeleteFeatures && mLayer->isEditable() );
mAddAttribute->setEnabled( canAddAttributes && mLayer->isEditable() );
mRemoveAttribute->setEnabled( canDeleteAttributes && mLayer->isEditable() );

@@ -230,6 +233,11 @@ void QgsAttributeTableDialog::on_mRemoveSelectionButton_clicked()
mLayer->removeSelection();
}

void QgsAttributeTableDialog::on_mDeleteSelectedButton_clicked()
{
mLayer->deleteSelectedFeatures();
}

void QgsAttributeTableDialog::on_cbxShowSelectedOnly_toggled( bool theFlag )
{
mFilterModel->setHideUnselected( theFlag );
@@ -615,9 +623,11 @@ void QgsAttributeTableDialog::editingToggled()
mToggleEditingButton->blockSignals( false );

bool canChangeAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues;
bool canDeleteFeatures = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteFeatures;
bool canAddAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes;
bool canDeleteAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteAttributes;
mOpenFieldCalculator->setEnabled( canChangeAttributes && mLayer->isEditable() );
mDeleteSelectedButton->setEnabled( canDeleteFeatures && mLayer->isEditable() );
mAddAttribute->setEnabled( canAddAttributes && mLayer->isEditable() );
mRemoveAttribute->setEnabled( canDeleteAttributes && mLayer->isEditable() );

@@ -145,6 +145,11 @@ class QgsAttributeTableDialog : public QDialog, private Ui::QgsAttributeTableDia
*/
void on_mOpenFieldCalculator_clicked();

/**
* deletes the selected features
*/
void on_mDeleteSelectedButton_clicked();

signals:
/**
* Informs that editing mode ha been toggled
@@ -21,6 +21,57 @@
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout">
<item>
<widget class="QCheckBox" name="cbxShowSelectedOnly">
<property name="text">
<string>Show selected records only</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbxSearchSelectedOnly">
<property name="text">
<string>Search selected records only</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Advanced search</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mAdvancedSearchButton">
<property name="text">
<string>...</string>
</property>
<property name="iconSize">
<size>
<width>12</width>
<height>12</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@@ -170,6 +221,17 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mDeleteSelectedButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionDeleteSelected.png</normaloff>../../images/themes/default/mActionDeleteSelected.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mAddAttribute">
<property name="toolTip">
@@ -259,57 +321,6 @@
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout">
<item>
<widget class="QCheckBox" name="cbxShowSelectedOnly">
<property name="text">
<string>Show selected records only</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbxSearchSelectedOnly">
<property name="text">
<string>Search selected records only</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Advanced search</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mAdvancedSearchButton">
<property name="text">
<string>...</string>
</property>
<property name="iconSize">
<size>
<width>12</width>
<height>12</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>

0 comments on commit eef0367

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