22 #include <QMessageBox>
33 mCondCombo->addItem(
tr(
"has the tag" ), QVariant(
"tag" ) );
34 mCondCombo->addItem(
tr(
"is a member of group" ), QVariant(
"group" ) );
35 mCondCombo->addItem(
tr(
"has a part of name matching" ), QVariant(
"name" ) );
36 mCondCombo->addItem(
tr(
"does NOT have the tag" ), QVariant(
"!tag" ) );
37 mCondCombo->addItem(
tr(
"is NOT a member of group" ), QVariant(
"!group" ) );
38 mCondCombo->addItem(
tr(
"has NO part of name matching" ), QVariant(
"!name" ) );
42 connect( mRemoveBtn, SIGNAL( clicked() ),
this, SLOT(
destruct() ) );
52 return mCondCombo->itemData( mCondCombo->currentIndex() ).toString();
57 return mCondLineEdit->text();
62 mCondCombo->setCurrentIndex( mCondCombo->findData( QVariant( constraint ) ) );
67 mCondLineEdit->setText( param );
72 mRemoveBtn->setVisible( !hide );
80 : QDialog( parent ), mStyle( style )
86 mAndOrCombo->addItem(
tr(
"ALL the constraints" ), QVariant(
"AND" ) );
87 mAndOrCombo->addItem(
tr(
"any ONE of the constraints" ), QVariant(
"OR" ) );
89 mLayout =
new QGridLayout( mConditionsBox );
92 connect( mAddConditionBtn, SIGNAL( clicked() ),
this, SLOT(
addCondition() ) );
101 return mNameLineEdit->text();
117 connect( cond, SIGNAL( removed(
int ) ),
this, SLOT(
removeCondition(
int ) ) );
155 return mAndOrCombo->itemData( mAndOrCombo->currentIndex() ).toString();
160 QStringList constraints;
161 constraints <<
"tag" <<
"group" <<
"name" <<
"!tag" <<
"!group" <<
"!name";
171 foreach (
const QString &constr, constraints )
173 QStringList params = map.values( constr );
174 foreach (
const QString ¶m, params )
182 connect( cond, SIGNAL( removed(
int ) ),
this, SLOT(
removeCondition(
int ) ) );
192 mAndOrCombo->setCurrentIndex( mAndOrCombo->findData( QVariant( op ) ) );
197 mNameLineEdit->setText( name );
202 if ( mNameLineEdit->text().isEmpty() )
204 QMessageBox::critical(
this,
tr(
"Invalid name" ),
tr(
"The smart group name field is empty. Kindly provide a name" ) );