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

List:       kde-pim
Subject:    [Kde-pim] [PATCH] Make KAddressbook's embedded contact editor work
From:       Reinhold Kainhofer <reinhold () kainhofer ! com>
Date:       2004-07-28 16:43:54
Message-ID: 200407281843.58693.reinhold () kainhofer ! com
[Download RAW message or body]

Here's a patch for kaddressbook that fixes the refresh / focus stealing 
problem in kaddressbook's embedded editor (in connection with the list view). 
If you entered any character in any of the fields, the cursor would jump to 
the end of the name field.
This problem is still there for the card view, but I'm working on that, too.

Okay to commit?

Reinhold
-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna, Austria
email: reinhold@kainhofer.com, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at
 * Deltasoft mathematics, http://www.deltasoft.at/

["2004-07-28_KAddressbook_EmbeddedEditorUnusable1.patch" (text/x-diff)]

? 2004-07-28_KAddressbook_EmbeddedEditorUnusable1.patch
? cvs.diff
Index: addresseeeditorwidget.cpp
===================================================================
RCS file: /home/kde/kdepim/kaddressbook/addresseeeditorwidget.cpp,v
retrieving revision 1.85
diff -u -p -3 -w -b -B -r1.85 addresseeeditorwidget.cpp
--- addresseeeditorwidget.cpp	26 Jul 2004 15:49:21 -0000	1.85
+++ addresseeeditorwidget.cpp	28 Jul 2004 16:43:27 -0000
@@ -89,6 +89,7 @@ AddresseeEditorWidget::~AddresseeEditorW
 
 void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr )
 {
+  if ( mAddressee.uid() != addr.uid() ) {
   mAddressee = addr;
 
   bool readOnly = ( !addr.resource() ? false : addr.resource()->readOnly() );
@@ -98,6 +99,7 @@ void AddresseeEditorWidget::setAddressee
 
   mNameEdit->setFocus();
 }
+}
 
 const KABC::Addressee &AddresseeEditorWidget::addressee()
 {
@@ -762,15 +764,15 @@ void AddresseeEditorWidget::emitModified
 {
   mDirty = true;
 
+  if ( isExtension() && !mBlockSignals ) {
   KABC::Addressee::List list;
 
-  if ( isExtension() && !mBlockSignals ) {
     save();
     list.append( mAddressee );
-  }
 
   emit modified( list );
 }
+}
 
 void AddresseeEditorWidget::dateChanged( QDate )
 {
Index: views/kaddressbooktableview.cpp
===================================================================
RCS file: /home/kde/kdepim/kaddressbook/views/kaddressbooktableview.cpp,v
retrieving revision 1.20
diff -u -p -3 -w -b -B -r1.20 kaddressbooktableview.cpp
--- views/kaddressbooktableview.cpp	17 Jun 2004 00:06:10 -0000	1.20
+++ views/kaddressbooktableview.cpp	28 Jul 2004 16:43:27 -0000
@@ -219,6 +219,7 @@ void KAddressBookTableView::readConfig(K
 
 void KAddressBookTableView::refresh(QString uid)
 {
+kdDebug()<<"Refresh called with uid "<<uid.latin1()<<endl;
   if (uid.isNull()) {
     // Clear the list view
     QString currentUID, nextUID;
@@ -255,16 +256,15 @@ void KAddressBookTableView::refresh(QStr
   } else {
     // Only need to update on entry. Iterate through and try to find it
     ContactListViewItem *ceItem;
-    QListViewItemIterator it( mListView );
-    while ( it.current() ) {
-      ceItem = dynamic_cast<ContactListViewItem*>( it.current() );
+    QPtrList<QListViewItem> selectedItems( mListView->selectedItems() );
+    QListViewItem *it;
+    for ( it = selectedItems.first(); it; it = selectedItems.next() ) {
+      ceItem = dynamic_cast<ContactListViewItem*>( it );
       if ( ceItem && ceItem->addressee().uid() == uid ) {
         ceItem->refresh();
         return;
       }
-      ++it;
     }
-
     refresh( QString::null );
   }
 }


_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
https://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