Q3PtrList--

svn path=/trunk/KDE/kdepim/; revision=804184
wilder-work
Thomas McGuire 18 years ago
parent d97c3adad5
commit 59d76cf573
  1. 16
      kmfilterdlg.cpp
  2. 2
      kmfilterdlg.h
  3. 3
      kmmsgpart.h
  4. 39
      kmsearchpatternedit.cpp

@ -1166,7 +1166,7 @@ void KMFilterActionWidget::setAction( const KMFilterAction* aAction )
mWidgetStack->setCurrentIndex( count) ;
}
KMFilterAction * KMFilterActionWidget::action()
KMFilterAction * KMFilterActionWidget::action() const
{
// look up the action description via the label
// returned by QComboBox::currentText()...
@ -1230,10 +1230,11 @@ void KMFilterActionWidgetLister::setActionList( QList<KMFilterAction*> *aList )
// load the actions into the widgets
QList<KMFilterAction*>::const_iterator aIt;
Q3PtrListIterator<QWidget> wIt( mWidgetList );
for ( aIt = mActionList->begin(), wIt.toFirst() ;
(aIt != mActionList->end()) && wIt.current() ; ++aIt, ++wIt )
((KMFilterActionWidget*)(*wIt))->setAction( (*aIt) );
QList<QWidget*>::Iterator wIt = mWidgetList.begin();
for ( aIt = mActionList->begin();
( aIt != mActionList->end() && wIt != mWidgetList.end() );
++aIt, ++wIt )
static_cast<KMFilterActionWidget*>( *wIt )->setAction( ( *aIt ) );
}
void KMFilterActionWidgetLister::reset()
@ -1263,9 +1264,8 @@ void KMFilterActionWidgetLister::regenerateActionListFromWidgets()
mActionList->clear();
Q3PtrListIterator<QWidget> it( mWidgetList );
for ( it.toFirst() ; it.current() ; ++it ) {
KMFilterAction *a = ((KMFilterActionWidget*)(*it))->action();
foreach ( const QWidget* w, mWidgetList ) {
KMFilterAction *a = static_cast<const KMFilterActionWidget*>( w )->action();
if ( a )
mActionList->append( a );
}

@ -217,7 +217,7 @@ public:
of actions can change during editing. Therefore the widget
always creates a new action object from the data in the combo
box and the widget stack and returns that. */
KMFilterAction *action();
KMFilterAction *action() const;
private:
/** This list holds an instance of every KMFilterAction

@ -21,9 +21,6 @@
#define kmmsgpart_h
#include <QString>
#include <q3dict.h>
//Added by qt3to4:
#include <QList>
template <typename T>
class QList;

@ -315,7 +315,7 @@ void KMSearchRuleWidgetLister::setRuleList( QList<KMSearchRule*> *aList )
mRuleList = aList;
if ( mWidgetList.first() ) // move this below next 'if'?
if ( !mWidgetList.isEmpty() ) // move this below next 'if'?
mWidgetList.first()->blockSignals(true);
if ( aList->count() == 0 ) {
@ -326,8 +326,7 @@ void KMSearchRuleWidgetLister::setRuleList( QList<KMSearchRule*> *aList )
int superfluousItems = (int)mRuleList->count() - mMaxWidgets ;
if ( superfluousItems > 0 ) {
kDebug(5006) <<"KMSearchRuleWidgetLister: Clipping rule list to"
<< mMaxWidgets << "items!";
kDebug(5006) << "Clipping rule list to" << mMaxWidgets << "items!";
for ( ; superfluousItems ; superfluousItems-- )
mRuleList->removeLast();
@ -340,23 +339,22 @@ void KMSearchRuleWidgetLister::setRuleList( QList<KMSearchRule*> *aList )
// load the actions into the widgets
QList<KMSearchRule*>::const_iterator rIt;
Q3PtrListIterator<QWidget> wIt( mWidgetList );
for ( rIt = mRuleList->begin(), wIt.toFirst() ;
rIt != mRuleList->end() && wIt.current() ; ++rIt, ++wIt ) {
static_cast<KMSearchRuleWidget*>(*wIt)->setRule( (*rIt) );
QList<QWidget*>::Iterator wIt = mWidgetList.begin();
for ( rIt = mRuleList->begin();
rIt != mRuleList->end() && wIt != mWidgetList.end(); ++rIt, ++wIt ) {
static_cast<KMSearchRuleWidget*>( *wIt )->setRule( (*rIt) );
}
for ( ; wIt.current() ; ++wIt )
((KMSearchRuleWidget*)(*wIt))->reset();
for ( ; wIt != mWidgetList.end() ; ++wIt )
static_cast<KMSearchRuleWidget*>( *wIt )->reset();
assert( mWidgetList.first() );
assert( !mWidgetList.isEmpty() );
mWidgetList.first()->blockSignals(false);
}
void KMSearchRuleWidgetLister::setHeadersOnly( bool headersOnly )
{
Q3PtrListIterator<QWidget> wIt( mWidgetList );
for ( wIt.toFirst() ; wIt.current() ; ++wIt ) {
(static_cast<KMSearchRuleWidget*>(*wIt))->setHeadersOnly( headersOnly );
foreach ( QWidget *w, mWidgetList ) {
static_cast<KMSearchRuleWidget*>( w )->setHeadersOnly( headersOnly );
}
}
@ -386,9 +384,8 @@ void KMSearchRuleWidgetLister::regenerateRuleListFromWidgets()
mRuleList->clear();
Q3PtrListIterator<QWidget> it( mWidgetList );
for ( it.toFirst() ; it.current() ; ++it ) {
KMSearchRule *r = ((KMSearchRuleWidget*)(*it))->rule();
foreach ( const QWidget *w, mWidgetList ) {
KMSearchRule *r = static_cast<const KMSearchRuleWidget*>( w )->rule();
if ( r )
mRuleList->append( r );
}
@ -452,14 +449,14 @@ void KMSearchPatternEdit::initLayout(bool headersOnly, bool absoluteDates)
mRuleLister = new KMSearchRuleWidgetLister( this, "swl", headersOnly, absoluteDates );
mRuleLister->slotClear();
KMSearchRuleWidget *srw = (KMSearchRuleWidget*)mRuleLister->mWidgetList.first();
if ( srw ) {
if ( !mRuleLister->mWidgetList.isEmpty() ) {
KMSearchRuleWidget *srw = static_cast<KMSearchRuleWidget*>( mRuleLister->mWidgetList.first() );
connect( srw, SIGNAL(fieldChanged(const QString &)),
this, SLOT(slotAutoNameHack()) );
this, SLOT(slotAutoNameHack()) );
connect( srw, SIGNAL(contentsChanged(const QString &)),
this, SLOT(slotAutoNameHack()) );
this, SLOT(slotAutoNameHack()) );
} else
kDebug(5006) <<"KMSearchPatternEdit: no first KMSearchRuleWidget, though slotClear() has been called!";
kDebug(5006) << "No first KMSearchRuleWidget, though slotClear() has been called!";
layout->addWidget( mRuleLister );
}

Loading…
Cancel
Save