diff --git a/images/images.qrc b/images/images.qrc
index 8cac208846e..d2b7bf0fce2 100644
--- a/images/images.qrc
+++ b/images/images.qrc
@@ -775,6 +775,8 @@
themes/default/mIconClearItem.svg
themes/default/mIndicatorLayerError.svg
themes/default/mActionShowUnplacedLabel.svg
+ themes/default/mActionHandleStoreFilterExpressionChecked.svg
+ themes/default/mActionHandleStoreFilterExpressionUnchecked.svg
qgis_tips/symbol_levels.png
diff --git a/images/themes/default/mActionHandleStoreFilterExpressionChecked.svg b/images/themes/default/mActionHandleStoreFilterExpressionChecked.svg
new file mode 100644
index 00000000000..857edd81fb3
--- /dev/null
+++ b/images/themes/default/mActionHandleStoreFilterExpressionChecked.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/images/themes/default/mActionHandleStoreFilterExpressionUnchecked.svg b/images/themes/default/mActionHandleStoreFilterExpressionUnchecked.svg
new file mode 100644
index 00000000000..d7a81a5b877
--- /dev/null
+++ b/images/themes/default/mActionHandleStoreFilterExpressionUnchecked.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/app/qgsattributetabledialog.cpp b/src/app/qgsattributetabledialog.cpp
index 17389b7ab25..b5c9e237fef 100644
--- a/src/app/qgsattributetabledialog.cpp
+++ b/src/app/qgsattributetabledialog.cpp
@@ -197,7 +197,6 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *layer, QgsAttr
// Set button to store or delete stored filter expressions
mStoreFilterExpressionButton->setDefaultAction( mActionHandleStoreFilterExpression );
- //connect all options though delete is not available yet
connect( mActionSaveAsStoredFilterExpression, &QAction::triggered, this, &QgsAttributeTableDialog::saveAsStoredFilterExpression );
mApplyFilterButton->setDefaultAction( mActionApplyFilter );
@@ -505,13 +504,15 @@ void QgsAttributeTableDialog::storeExpressionButtonInit()
if ( mActionHandleStoreFilterExpression->isChecked() )
{
mActionHandleStoreFilterExpression->setToolTip( tr( "Delete stored filter expression" ) );
- mActionHandleStoreFilterExpression->setText( tr( "D" ) );
+ mActionHandleStoreFilterExpression->setText( tr( "Delete Stored Expression" ) );
+ mActionHandleStoreFilterExpression->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionHandleStoreFilterExpressionChecked.svg" ) ) );
mStoreFilterExpressionButton->removeAction( mActionSaveAsStoredFilterExpression );
}
else
{
- mActionHandleStoreFilterExpression->setToolTip( tr( "Store filter expression" ) );
- mActionHandleStoreFilterExpression->setText( tr( "S" ) );
+ mActionHandleStoreFilterExpression->setToolTip( tr( "Save filter expression" ) );
+ mActionHandleStoreFilterExpression->setText( tr( "Save Expression" ) );
+ mActionHandleStoreFilterExpression->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionHandleStoreFilterExpressionUnchecked.svg" ) ) );
mStoreFilterExpressionButton->addAction( mActionSaveAsStoredFilterExpression );
}
}
@@ -1109,21 +1110,27 @@ void QgsAttributeTableDialog::openConditionalStyles()
void QgsAttributeTableDialog::saveAsStoredFilterExpression()
{
mLayer->storedExpressions()->addStoredExpression( "test", mFilterQuery->text() );
+ mActionHandleStoreFilterExpression->setChecked( false );
storeExpressionButtonInit();
+ storedFilterExpressionBoxInit();
}
void QgsAttributeTableDialog::handleStoreFilterExpression()
{
- if ( mActionHandleStoreFilterExpression->isChecked() )
+ if ( !mActionHandleStoreFilterExpression->isChecked() )
{
- qDebug() << "its checked, here we would delete it...";
+ //care for deleting by name
+ mLayer->storedExpressions()->removeStoredExpression( mFilterQuery->text() );
+ qDebug() << "changed to unchecked, here we would delete it...";
}
else
{
+ //care for updating it by name
mLayer->storedExpressions()->addStoredExpression( mFilterQuery->text(), mFilterQuery->text() );
- qDebug() << "its not checked, here we would add it...";
+ qDebug() << "changed to checked, here we would add it...";
}
storeExpressionButtonInit();
+ storedFilterExpressionBoxInit();
}
void QgsAttributeTableDialog::setFilterExpression( const QString &filterString, QgsAttributeForm::FilterType type,
diff --git a/src/ui/qgsattributetabledialog.ui b/src/ui/qgsattributetabledialog.ui
index d6a7a368aac..69197f174d3 100644
--- a/src/ui/qgsattributetabledialog.ui
+++ b/src/ui/qgsattributetabledialog.ui
@@ -678,17 +678,28 @@
true
+
+
+ :/images/themes/default/mActionHandleStoreFilterExpressionUnchecked.svg:/images/themes/default/mActionHandleStoreFilterExpressionUnchecked.svg
+
- ...
+
Handle Filter Expression (save or delete)
+
+
+ :/images/themes/default/mActionHandleStoreFilterExpressionUnchecked.svg:/images/themes/default/mActionHandleStoreFilterExpressionUnchecked.svg
+
Save Expression as...
+
+ Save expression under defined name
+