Ejemplo n.º 1
0
void KScoringManager::editRule( KScoringRule *e, QWidget *w )
{
  KScoringEditor *edit = KScoringEditor::createEditor( this, w );
  edit->setRule( e );
  edit->show();
  delete edit;
}
Ejemplo n.º 2
0
KScoringRule *KScoringManager::addRule( const ScorableArticle &a,
                                        const QString &group, short score )
{
  KScoringRule *rule = new KScoringRule( findUniqueName() );
  rule->addGroup( group );
  rule->addExpression( new KScoringExpression( "From","CONTAINS", a.from(), "0" ) );
  if ( score ) {
    rule->addAction( new ActionSetScore( score ) );
  }
  rule->setExpireDate( QDate::currentDate().addDays( 30 ) );
  KScoringEditor *edit = KScoringEditor::createEditor( this );
  // Note: the call to createEditor() call this->pushRuleList(). So addRule(KScoringRule)
  // must be place after it, otherwise the cancel button of the editor is not effective (bug #101092).
  addRule( rule );
  edit->setRule( rule );
  edit->show();
  setCacheValid( false );
  return rule;
}