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

List:       kde-pim
Subject:    [Kde-pim] PATCH: KAddressbook resets default-filter for view when configuration is changed
From:       Martin Thierer <thierer () web ! de>
Date:       2002-10-29 20:26:11
[Download RAW message or body]

The attached patch fixes two little bugs in kaddressbook:

1. If a default filter is set for a view the configuration-key isn't 
correctly loaded in the view-configuration dialog. Therefore the filter 
for this view is reset when the configuration is changed.

2. The combo-box for the filter-configuration in the view-configuration 
dialog shows filter names with an "&" in them with two "&"s instead. 
That's because the name is changed in "FilterDialog::setFilters" to 
prevent KSelectAction from displaying a shortcut.

Although I know that I'm to blame for this (as I bugged Tobias to do it 
:-), I don't like this solution. To keep the patch simple I've just added 
"&&" -> "&" and "&" -> "&&" conversions for now, but I think that should 
be changed after the 3.1 release.

There's a new "setMenuAccelsEnabled" method in KSelectAction which should 
be sufficient for a clean solution.

Bye,

Martin





["configureviewfilterpage.diff" (text/x-diff)]

Index: configureviewfilterpage.cpp
===================================================================
RCS file: /home/kde/kdepim/kaddressbook/configureviewfilterpage.cpp,v
retrieving revision 1.2
diff -u -3 -p -r1.2 configureviewfilterpage.cpp
--- configureviewfilterpage.cpp	20 Sep 2002 21:55:41 -0000	1.2
+++ configureviewfilterpage.cpp	29 Oct 2002 20:21:01 -0000
@@ -24,7 +24,9 @@
 #include <qbuttongroup.h>
 #include <qlabel.h>
 #include <qlayout.h>
+#include <qregexp.h>
 #include <qradiobutton.h>
+#include <qstring.h>
 
 #include <kconfig.h>
 #include <kcombobox.h>
@@ -83,11 +85,15 @@ void ConfigureViewFilterPage::readConfig
   // Load the filter combo
   Filter::List list = Filter::restore( config, "Filter" );
   Filter::List::Iterator it;
-  for ( it = list.begin(); it != list.end(); ++it )
-    mFilterCombo->insertItem( (*it).name() );
-    
-  if ( config->hasKey( "DefaultFilter" ) )
-    mFilterCombo->setCurrentText( config->readEntry( "DefaultFilterName" ) );
+  for ( it = list.begin(); it != list.end(); ++it ) {
+    QString tmp = (*it).name();
+    mFilterCombo->insertItem( tmp.replace( QRegExp( "&&" ), "&" ) );
+  }
+  
+  if ( config->hasKey( "DefaultFilterName" ) ) {
+    QString tmp = config->readEntry( "DefaultFilterName" );
+    mFilterCombo->setCurrentText( tmp.replace( QRegExp( "&&" ), "&" ) );
+  }
   
   int id = config->readNumEntry( "DefaultFilterType", 1 );
   mFilterGroup->setButton( id );
@@ -96,7 +102,9 @@ void ConfigureViewFilterPage::readConfig
 
 void ConfigureViewFilterPage::writeConfig( KConfig *config )
 {
-  config->writeEntry( "DefaultFilterName", mFilterCombo->currentText() );
+  QString tmp = mFilterCombo->currentText();
+  
+  config->writeEntry( "DefaultFilterName", tmp.replace( QRegExp( "&" ), "&&" ) );
   config->writeEntry( "DefaultFilterType", mFilterGroup->id( mFilterGroup->selected() ) );
 }
     

_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/

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

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