Advertisement
Guest User

Untitled

a guest
Jul 25th, 2009
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.19 KB | None | 0 0
  1. diff --git kmail/kmfilteraction.cpp kmail/kmfilteraction.cpp
  2. index bb8e6a9..a7ceb53 100644
  3. --- kmail/kmfilteraction.cpp (revision 1002105)
  4. +++ kmail/kmfilteraction.cpp (working copy)
  5. -208,25 +208,29 @@ KMFilterActionWithString::KMFilterActionWithString( const char* aName, const QSt
  6.  
  7. QWidget* KMFilterActionWithString::createParamWidget( QWidget* parent ) const
  8. {
  9. - KLineEdit *le = new KLineEdit(parent);
  10. + QWidget *w = new QWidget( parent );
  11. + QVBoxLayout *layout = new QVBoxLayout( w );
  12. + KLineEdit *le = new KLineEdit( w );
  13. + le->setObjectName( "LineEdit" );
  14. le->setClearButtonShown( true );
  15. le->setText( mParameter );
  16. - return le;
  17. + layout->addWidget( le );
  18. + return w;
  19. }
  20.  
  21. void KMFilterActionWithString::applyParamWidgetValue( QWidget* paramWidget )
  22. {
  23. - mParameter = ((KLineEdit*)paramWidget)->text();
  24. + mParameter = paramWidget->findChild<KLineEdit*>( "LineEdit" )->text();
  25. }
  26.  
  27. void KMFilterActionWithString::setParamWidgetValue( QWidget* paramWidget ) const
  28. {
  29. - ((KLineEdit*)paramWidget)->setText( mParameter );
  30. + paramWidget->findChild<KLineEdit*>( "LineEdit" )->setText( mParameter );
  31. }
  32.  
  33. void KMFilterActionWithString::clearParamWidget( QWidget* paramWidget ) const
  34. {
  35. - ((KLineEdit*)paramWidget)->clear();
  36. + paramWidget->findChild<KLineEdit*>( "LineEdit" )->clear();
  37. }
  38.  
  39. void KMFilterActionWithString::argsFromString( const QString &argsStr )
  40. -259,27 +263,34 @@ KMFilterActionWithStringList::KMFilterActionWithStringList( const char* aName, c
  41.  
  42. QWidget* KMFilterActionWithStringList::createParamWidget( QWidget* parent ) const
  43. {
  44. - KComboBox *cb = new KComboBox( parent );
  45. + QWidget *w = new QWidget( parent );
  46. + QVBoxLayout *layout = new QVBoxLayout ( w );
  47. + KComboBox *cb = new KComboBox( w );
  48. cb->setEditable( false );
  49. cb->addItems( mParameterList );
  50. - setParamWidgetValue( cb );
  51. - return cb;
  52. + cb->setObjectName( "combo" );
  53. + layout->addWidget( cb );
  54. + setParamWidgetValue( w );
  55. + return w;
  56. }
  57.  
  58. void KMFilterActionWithStringList::applyParamWidgetValue( QWidget* paramWidget )
  59. {
  60. - mParameter = ((KComboBox*)paramWidget)->currentText();
  61. + KComboBox *cb = paramWidget->findChild<KComboBox*>( "combo" );
  62. + mParameter = cb->currentText();
  63. }
  64.  
  65. void KMFilterActionWithStringList::setParamWidgetValue( QWidget* paramWidget ) const
  66. {
  67. + KComboBox *cb = paramWidget->findChild<KComboBox*>( "combo" );
  68. int idx = mParameterList.indexOf( mParameter );
  69. - ((KComboBox*)paramWidget)->setCurrentIndex( idx >= 0 ? idx : 0 );
  70. + cb->setCurrentIndex( idx >= 0 ? idx : 0 );
  71. }
  72.  
  73. void KMFilterActionWithStringList::clearParamWidget( QWidget* paramWidget ) const
  74. {
  75. - ((KComboBox*)paramWidget)->setCurrentIndex(0);
  76. + KComboBox *cb = paramWidget->findChild<KComboBox*>( "combo" );
  77. + cb->setCurrentIndex( 0 );
  78. }
  79.  
  80. void KMFilterActionWithStringList::argsFromString( const QString &argsStr )
  81. -729,21 +740,25 @@ KMFilterAction::ReturnCode KMFilterActionIdentity::process(KMMessage* msg) const
  82.  
  83. QWidget * KMFilterActionIdentity::createParamWidget( QWidget * parent ) const
  84. {
  85. - KPIMIdentities::IdentityCombo * ic = new KPIMIdentities::IdentityCombo( kmkernel->identityManager(), parent );
  86. + QWidget *w = new QWidget( parent );
  87. + QVBoxLayout *layout = new QVBoxLayout( w );
  88. + KPIMIdentities::IdentityCombo *ic = new KPIMIdentities::IdentityCombo( kmkernel->identityManager(), w );
  89. ic->setCurrentIdentity( mParameter );
  90. - return ic;
  91. + ic->setObjectName( "IdentityCombo" );
  92. + layout->addWidget( ic );
  93. + return w;
  94. }
  95.  
  96. void KMFilterActionIdentity::applyParamWidgetValue( QWidget * paramWidget )
  97. {
  98. - KPIMIdentities::IdentityCombo * ic = dynamic_cast<KPIMIdentities::IdentityCombo*>( paramWidget );
  99. + KPIMIdentities::IdentityCombo *ic = paramWidget->findChild<KPIMIdentities::IdentityCombo*>( "IdentityCombo" );
  100. assert( ic );
  101. mParameter = ic->currentIdentity();
  102. }
  103.  
  104. void KMFilterActionIdentity::clearParamWidget( QWidget * paramWidget ) const
  105. {
  106. - KPIMIdentities::IdentityCombo * ic = dynamic_cast<KPIMIdentities::IdentityCombo*>( paramWidget );
  107. + KPIMIdentities::IdentityCombo *ic = paramWidget->findChild<KPIMIdentities::IdentityCombo*>( "IdentityCombo" );
  108. assert( ic );
  109. ic->setCurrentIndex( 0 );
  110. //ic->setCurrentIdentity( kmkernel->identityManager()->defaultIdentity() );
  111. -751,7 +766,7 @@ void KMFilterActionIdentity::clearParamWidget( QWidget * paramWidget ) const
  112.  
  113. void KMFilterActionIdentity::setParamWidgetValue( QWidget * paramWidget ) const
  114. {
  115. - KPIMIdentities::IdentityCombo * ic = dynamic_cast<KPIMIdentities::IdentityCombo*>( paramWidget );
  116. + KPIMIdentities::IdentityCombo *ic = paramWidget->findChild<KPIMIdentities::IdentityCombo*>( "IdentityCombo" );
  117. assert( ic );
  118. ic->setCurrentIdentity( mParameter );
  119. }
  120. -1085,11 +1100,17 @@ KMFilterActionRemoveHeader::KMFilterActionRemoveHeader()
  121.  
  122. QWidget* KMFilterActionRemoveHeader::createParamWidget( QWidget* parent ) const
  123. {
  124. - KComboBox *cb = new KComboBox( parent );
  125. + QWidget *w = new QWidget( parent );
  126. + QVBoxLayout *layout = new QVBoxLayout( w );
  127. +
  128. + KComboBox *cb = new KComboBox( w );
  129. cb->setEditable( true );
  130. cb->setInsertPolicy( QComboBox::InsertAtBottom );
  131. - setParamWidgetValue( cb );
  132. - return cb;
  133. + cb->setObjectName( "combo" );
  134. + layout->addWidget( cb );
  135. +
  136. + setParamWidgetValue( w );
  137. + return w;
  138. }
  139.  
  140. KMFilterAction::ReturnCode KMFilterActionRemoveHeader::process(KMMessage* msg) const
  141. -1103,7 +1124,7 @@ KMFilterAction::ReturnCode KMFilterActionRemoveHeader::process(KMMessage* msg) c
  142.  
  143. void KMFilterActionRemoveHeader::setParamWidgetValue( QWidget* paramWidget ) const
  144. {
  145. - KComboBox * cb = dynamic_cast<KComboBox*>(paramWidget);
  146. + KComboBox *cb = paramWidget->findChild<KComboBox*>( "combo" );
  147. Q_ASSERT( cb );
  148.  
  149. int idx = mParameterList.indexOf( mParameter );
  150. -2236,7 +2257,7 @@ KMFilterAction::ReturnCode KMFilterActionAddToAddressBook::process( KMMessage* m
  151. QWidget* KMFilterActionAddToAddressBook::createParamWidget( QWidget* parent ) const
  152. {
  153. QWidget *w = new QWidget( parent );
  154. - QGridLayout *gridlayout = new QGridLayout ( w );
  155. + QGridLayout *gridlayout = new QGridLayout( w );
  156.  
  157. KComboBox *cb = new KComboBox( w );
  158. cb->setObjectName( "FilterTargetCombo" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement