Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git kmail/kmfilteraction.cpp kmail/kmfilteraction.cpp
- index bb8e6a9..a7ceb53 100644
- --- kmail/kmfilteraction.cpp (revision 1002105)
- +++ kmail/kmfilteraction.cpp (working copy)
- -208,25 +208,29 @@ KMFilterActionWithString::KMFilterActionWithString( const char* aName, const QSt
- QWidget* KMFilterActionWithString::createParamWidget( QWidget* parent ) const
- {
- - KLineEdit *le = new KLineEdit(parent);
- + QWidget *w = new QWidget( parent );
- + QVBoxLayout *layout = new QVBoxLayout( w );
- + KLineEdit *le = new KLineEdit( w );
- + le->setObjectName( "LineEdit" );
- le->setClearButtonShown( true );
- le->setText( mParameter );
- - return le;
- + layout->addWidget( le );
- + return w;
- }
- void KMFilterActionWithString::applyParamWidgetValue( QWidget* paramWidget )
- {
- - mParameter = ((KLineEdit*)paramWidget)->text();
- + mParameter = paramWidget->findChild<KLineEdit*>( "LineEdit" )->text();
- }
- void KMFilterActionWithString::setParamWidgetValue( QWidget* paramWidget ) const
- {
- - ((KLineEdit*)paramWidget)->setText( mParameter );
- + paramWidget->findChild<KLineEdit*>( "LineEdit" )->setText( mParameter );
- }
- void KMFilterActionWithString::clearParamWidget( QWidget* paramWidget ) const
- {
- - ((KLineEdit*)paramWidget)->clear();
- + paramWidget->findChild<KLineEdit*>( "LineEdit" )->clear();
- }
- void KMFilterActionWithString::argsFromString( const QString &argsStr )
- -259,27 +263,34 @@ KMFilterActionWithStringList::KMFilterActionWithStringList( const char* aName, c
- QWidget* KMFilterActionWithStringList::createParamWidget( QWidget* parent ) const
- {
- - KComboBox *cb = new KComboBox( parent );
- + QWidget *w = new QWidget( parent );
- + QVBoxLayout *layout = new QVBoxLayout ( w );
- + KComboBox *cb = new KComboBox( w );
- cb->setEditable( false );
- cb->addItems( mParameterList );
- - setParamWidgetValue( cb );
- - return cb;
- + cb->setObjectName( "combo" );
- + layout->addWidget( cb );
- + setParamWidgetValue( w );
- + return w;
- }
- void KMFilterActionWithStringList::applyParamWidgetValue( QWidget* paramWidget )
- {
- - mParameter = ((KComboBox*)paramWidget)->currentText();
- + KComboBox *cb = paramWidget->findChild<KComboBox*>( "combo" );
- + mParameter = cb->currentText();
- }
- void KMFilterActionWithStringList::setParamWidgetValue( QWidget* paramWidget ) const
- {
- + KComboBox *cb = paramWidget->findChild<KComboBox*>( "combo" );
- int idx = mParameterList.indexOf( mParameter );
- - ((KComboBox*)paramWidget)->setCurrentIndex( idx >= 0 ? idx : 0 );
- + cb->setCurrentIndex( idx >= 0 ? idx : 0 );
- }
- void KMFilterActionWithStringList::clearParamWidget( QWidget* paramWidget ) const
- {
- - ((KComboBox*)paramWidget)->setCurrentIndex(0);
- + KComboBox *cb = paramWidget->findChild<KComboBox*>( "combo" );
- + cb->setCurrentIndex( 0 );
- }
- void KMFilterActionWithStringList::argsFromString( const QString &argsStr )
- -729,21 +740,25 @@ KMFilterAction::ReturnCode KMFilterActionIdentity::process(KMMessage* msg) const
- QWidget * KMFilterActionIdentity::createParamWidget( QWidget * parent ) const
- {
- - KPIMIdentities::IdentityCombo * ic = new KPIMIdentities::IdentityCombo( kmkernel->identityManager(), parent );
- + QWidget *w = new QWidget( parent );
- + QVBoxLayout *layout = new QVBoxLayout( w );
- + KPIMIdentities::IdentityCombo *ic = new KPIMIdentities::IdentityCombo( kmkernel->identityManager(), w );
- ic->setCurrentIdentity( mParameter );
- - return ic;
- + ic->setObjectName( "IdentityCombo" );
- + layout->addWidget( ic );
- + return w;
- }
- void KMFilterActionIdentity::applyParamWidgetValue( QWidget * paramWidget )
- {
- - KPIMIdentities::IdentityCombo * ic = dynamic_cast<KPIMIdentities::IdentityCombo*>( paramWidget );
- + KPIMIdentities::IdentityCombo *ic = paramWidget->findChild<KPIMIdentities::IdentityCombo*>( "IdentityCombo" );
- assert( ic );
- mParameter = ic->currentIdentity();
- }
- void KMFilterActionIdentity::clearParamWidget( QWidget * paramWidget ) const
- {
- - KPIMIdentities::IdentityCombo * ic = dynamic_cast<KPIMIdentities::IdentityCombo*>( paramWidget );
- + KPIMIdentities::IdentityCombo *ic = paramWidget->findChild<KPIMIdentities::IdentityCombo*>( "IdentityCombo" );
- assert( ic );
- ic->setCurrentIndex( 0 );
- //ic->setCurrentIdentity( kmkernel->identityManager()->defaultIdentity() );
- -751,7 +766,7 @@ void KMFilterActionIdentity::clearParamWidget( QWidget * paramWidget ) const
- void KMFilterActionIdentity::setParamWidgetValue( QWidget * paramWidget ) const
- {
- - KPIMIdentities::IdentityCombo * ic = dynamic_cast<KPIMIdentities::IdentityCombo*>( paramWidget );
- + KPIMIdentities::IdentityCombo *ic = paramWidget->findChild<KPIMIdentities::IdentityCombo*>( "IdentityCombo" );
- assert( ic );
- ic->setCurrentIdentity( mParameter );
- }
- -1085,11 +1100,17 @@ KMFilterActionRemoveHeader::KMFilterActionRemoveHeader()
- QWidget* KMFilterActionRemoveHeader::createParamWidget( QWidget* parent ) const
- {
- - KComboBox *cb = new KComboBox( parent );
- + QWidget *w = new QWidget( parent );
- + QVBoxLayout *layout = new QVBoxLayout( w );
- +
- + KComboBox *cb = new KComboBox( w );
- cb->setEditable( true );
- cb->setInsertPolicy( QComboBox::InsertAtBottom );
- - setParamWidgetValue( cb );
- - return cb;
- + cb->setObjectName( "combo" );
- + layout->addWidget( cb );
- +
- + setParamWidgetValue( w );
- + return w;
- }
- KMFilterAction::ReturnCode KMFilterActionRemoveHeader::process(KMMessage* msg) const
- -1103,7 +1124,7 @@ KMFilterAction::ReturnCode KMFilterActionRemoveHeader::process(KMMessage* msg) c
- void KMFilterActionRemoveHeader::setParamWidgetValue( QWidget* paramWidget ) const
- {
- - KComboBox * cb = dynamic_cast<KComboBox*>(paramWidget);
- + KComboBox *cb = paramWidget->findChild<KComboBox*>( "combo" );
- Q_ASSERT( cb );
- int idx = mParameterList.indexOf( mParameter );
- -2236,7 +2257,7 @@ KMFilterAction::ReturnCode KMFilterActionAddToAddressBook::process( KMMessage* m
- QWidget* KMFilterActionAddToAddressBook::createParamWidget( QWidget* parent ) const
- {
- QWidget *w = new QWidget( parent );
- - QGridLayout *gridlayout = new QGridLayout ( w );
- + QGridLayout *gridlayout = new QGridLayout( w );
- KComboBox *cb = new KComboBox( w );
- cb->setObjectName( "FilterTargetCombo" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement