[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    [PATCH] for bug #78030 - (quick search) status filter doesn't work
From:       Andreas Gungl <a.gungl () gmx ! de>
Date:       2004-04-30 18:54:16
Message-ID: 200404302054.49952 () gungl-dd ! de
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

in the attached fix I changed the string based status determination to an 
index based algorithm. It's used in the filter dialog in a similar manner, 
just the Any Status item is missing.
I verified that it is working correctly with an English language 
installation, but I don't have another language installed for KDE 3.2 (no 
i18n package here on my system). Can anybody check the patch with another 
language? Perhaps it might also be enough if Ingo or Till can have a look.

TIA,
Andreas
- -- 
    ~
  ' v '
 //   \\
/(     )\  Powered by Penguin.
  ^ ' ^

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQFAkqDpVhjiFd4beU8RAgrVAKCk+iPhUiohLhtVn8nzuzI4rOaEGQCdH+35
94UiiDlO4ZyDW2hRoQEvtJM=
=9+zR
-----END PGP SIGNATURE-----

["headerlistquicksearch.diff" (text/x-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;


_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic