From kmail-devel Fri Apr 30 18:54:16 2004 From: Andreas Gungl Date: Fri, 30 Apr 2004 18:54:16 +0000 To: kmail-devel Subject: [PATCH] for bug #78030 - (quick search) status filter doesn't work Message-Id: <200404302054.49952 () gungl-dd ! de> X-MARC-Message: https://marc.info/?l=kmail-devel&m=108335134820812 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_YDqkAPvDYXML6+K" --Boundary-00=_YDqkAPvDYXML6+K Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline =2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, in the attached fix I changed the string based status determination to an=20 index based algorithm. It's used in the filter dialog in a similar manner,= =20 just the Any Status item is missing. I verified that it is working correctly with an English language=20 installation, but I don't have another language installed for KDE 3.2 (no=20 i18n package here on my system). Can anybody check the patch with another=20 language? Perhaps it might also be enough if Ingo or Till can have a look. TIA, Andreas =2D --=20 ~ ' v ' // \\ /( )\ Powered by Penguin. ^ ' ^ =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) iD8DBQFAkqDpVhjiFd4beU8RAgrVAKCk+iPhUiohLhtVn8nzuzI4rOaEGQCdH+35 94UiiDlO4ZyDW2hRoQEvtJM=3D =3D9+zR =2D----END PGP SIGNATURE----- --Boundary-00=_YDqkAPvDYXML6+K Content-Type: text/x-diff; charset="us-ascii"; name="headerlistquicksearch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="headerlistquicksearch.diff" Index: headerlistquicksearch.cpp =================================================================== RCS file: /home/kde/kdepim/kmail/headerlistquicksearch.cpp,v retrieving revision 1.2 diff -u -3 -p -r1.2 headerlistquicksearch.cpp --- headerlistquicksearch.cpp 15 Apr 2004 10:09:11 -0000 1.2 +++ headerlistquicksearch.cpp 30 Apr 2004 18:46:38 -0000 @@ -66,11 +66,13 @@ HeaderListQuickSearch::HeaderListQuickSe QLabel *label = new QLabel( i18n("Stat&us:"), parent, "kde toolbar widget" ); mStatusCombo = new QComboBox( parent, "quick search status combo box" ); - mStatusCombo->insertItem( i18n("Any Status") ); for ( int i = 0; i < KMail::StatusValueCount; i++ ) mStatusCombo->insertItem( i18n( KMail::StatusValues[i] ) ); - connect( mStatusCombo, SIGNAL ( activated( const QString& ) ), - this, SLOT( slotStatusChanged( const QString& ) ) ); + // add this as last item to be able to rely on the index for tracking back the value + mStatusCombo->insertItem( i18n("Any Status") ); + mStatusCombo->setCurrentItem( KMail::StatusValueCount ); + connect( mStatusCombo, SIGNAL ( activated( int ) ), + this, SLOT( slotStatusChanged( int ) ) ); label->setBuddy( mStatusCombo ); @@ -96,16 +98,16 @@ bool HeaderListQuickSearch::itemMatches( void HeaderListQuickSearch::reset() { clear(); - mStatusCombo->setCurrentItem( 0 ); - slotStatusChanged( mStatusCombo->currentText()); + mStatusCombo->setCurrentItem( KMail::StatusValueCount ); + slotStatusChanged( KMail::StatusValueCount ); } -void HeaderListQuickSearch::slotStatusChanged( const QString & statusString) +void HeaderListQuickSearch::slotStatusChanged( int index ) { - if ( mStatusCombo->currentItem() == 0 ) + if ( index >= KMail::StatusValueCount ) mStatus = 0; else - mStatus = KMSearchRuleStatus::statusFromEnglishName( statusString ); + mStatus = KMSearchRuleStatus::statusFromEnglishName( KMail::StatusValues[index] ); updateSearch(); } Index: headerlistquicksearch.h =================================================================== RCS file: /home/kde/kdepim/kmail/headerlistquicksearch.h,v retrieving revision 1.2 diff -u -3 -p -r1.2 headerlistquicksearch.h --- headerlistquicksearch.h 1 Apr 2004 23:45:52 -0000 1.2 +++ headerlistquicksearch.h 30 Apr 2004 18:46:38 -0000 @@ -64,7 +64,7 @@ private slots: * cache the status in mStatus so as to avoid having to do the comparatively * expensive string comparison for each item in itemMatches */ - void slotStatusChanged( const QString & statusString ); + void slotStatusChanged( int index ); private: QComboBox *mStatusCombo; --Boundary-00=_YDqkAPvDYXML6+K Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ KMail developers mailing list KMail-devel@kde.org https://mail.kde.org/mailman/listinfo/kmail-devel --Boundary-00=_YDqkAPvDYXML6+K--