From 59d76cf573f9d35afd789991086d49f9437599f3 Mon Sep 17 00:00:00 2001 From: Thomas McGuire Date: Mon, 5 May 2008 09:49:38 +0000 Subject: [PATCH] Q3PtrList-- svn path=/trunk/KDE/kdepim/; revision=804184 --- kmfilterdlg.cpp | 16 ++++++++-------- kmfilterdlg.h | 2 +- kmmsgpart.h | 3 --- kmsearchpatternedit.cpp | 39 ++++++++++++++++++--------------------- 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/kmfilterdlg.cpp b/kmfilterdlg.cpp index 4bf630993..eebf6c8f8 100644 --- a/kmfilterdlg.cpp +++ b/kmfilterdlg.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 *aList ) // load the actions into the widgets QList::const_iterator aIt; - Q3PtrListIterator wIt( mWidgetList ); - for ( aIt = mActionList->begin(), wIt.toFirst() ; - (aIt != mActionList->end()) && wIt.current() ; ++aIt, ++wIt ) - ((KMFilterActionWidget*)(*wIt))->setAction( (*aIt) ); + QList::Iterator wIt = mWidgetList.begin(); + for ( aIt = mActionList->begin(); + ( aIt != mActionList->end() && wIt != mWidgetList.end() ); + ++aIt, ++wIt ) + static_cast( *wIt )->setAction( ( *aIt ) ); } void KMFilterActionWidgetLister::reset() @@ -1263,9 +1264,8 @@ void KMFilterActionWidgetLister::regenerateActionListFromWidgets() mActionList->clear(); - Q3PtrListIterator it( mWidgetList ); - for ( it.toFirst() ; it.current() ; ++it ) { - KMFilterAction *a = ((KMFilterActionWidget*)(*it))->action(); + foreach ( const QWidget* w, mWidgetList ) { + KMFilterAction *a = static_cast( w )->action(); if ( a ) mActionList->append( a ); } diff --git a/kmfilterdlg.h b/kmfilterdlg.h index feea4b863..e1d37ede0 100644 --- a/kmfilterdlg.h +++ b/kmfilterdlg.h @@ -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 diff --git a/kmmsgpart.h b/kmmsgpart.h index bce79387a..bb2671718 100644 --- a/kmmsgpart.h +++ b/kmmsgpart.h @@ -21,9 +21,6 @@ #define kmmsgpart_h #include -#include -//Added by qt3to4: -#include template class QList; diff --git a/kmsearchpatternedit.cpp b/kmsearchpatternedit.cpp index dcf0bee91..06ecf2410 100644 --- a/kmsearchpatternedit.cpp +++ b/kmsearchpatternedit.cpp @@ -315,7 +315,7 @@ void KMSearchRuleWidgetLister::setRuleList( QList *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 *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 *aList ) // load the actions into the widgets QList::const_iterator rIt; - Q3PtrListIterator wIt( mWidgetList ); - for ( rIt = mRuleList->begin(), wIt.toFirst() ; - rIt != mRuleList->end() && wIt.current() ; ++rIt, ++wIt ) { - static_cast(*wIt)->setRule( (*rIt) ); + QList::Iterator wIt = mWidgetList.begin(); + for ( rIt = mRuleList->begin(); + rIt != mRuleList->end() && wIt != mWidgetList.end(); ++rIt, ++wIt ) { + static_cast( *wIt )->setRule( (*rIt) ); } - for ( ; wIt.current() ; ++wIt ) - ((KMSearchRuleWidget*)(*wIt))->reset(); + for ( ; wIt != mWidgetList.end() ; ++wIt ) + static_cast( *wIt )->reset(); - assert( mWidgetList.first() ); + assert( !mWidgetList.isEmpty() ); mWidgetList.first()->blockSignals(false); } void KMSearchRuleWidgetLister::setHeadersOnly( bool headersOnly ) { - Q3PtrListIterator wIt( mWidgetList ); - for ( wIt.toFirst() ; wIt.current() ; ++wIt ) { - (static_cast(*wIt))->setHeadersOnly( headersOnly ); + foreach ( QWidget *w, mWidgetList ) { + static_cast( w )->setHeadersOnly( headersOnly ); } } @@ -386,9 +384,8 @@ void KMSearchRuleWidgetLister::regenerateRuleListFromWidgets() mRuleList->clear(); - Q3PtrListIterator it( mWidgetList ); - for ( it.toFirst() ; it.current() ; ++it ) { - KMSearchRule *r = ((KMSearchRuleWidget*)(*it))->rule(); + foreach ( const QWidget *w, mWidgetList ) { + KMSearchRule *r = static_cast( 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( 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 ); }