Version: 1.8.2 (using KDE KDE 3.4.2) Installed from: SuSE RPMs OS: Linux when kontact is launched, composer cannot find addressbook-entries except recent entries. The full addressbook is only shown after a 2nd launch of composer.
I see the same bug happening with KMail in the 3.5 branch (7 January 2006).
Created attachment 14176 [details] Load adresses sync Just sent this patch to kde-pim@kde.org for approval. It loads addresses in sync instead of async. It solves the problem anyhow.
SVN commit 497767 by bram: Fix bug 117118: composer kaddressbook no adresses at first launch Update the list again once the resource is loaded. BUG:117118 M +23 -15 recipientspicker.cpp M +7 -1 recipientspicker.h --- branches/KDE/3.5/kdepim/kmail/recipientspicker.cpp #497766:497767 @@ -27,7 +27,6 @@ #include <klistview.h> #include <klocale.h> -#include <kabc/stdaddressbook.h> #include <kabc/resource.h> #include <kiconloader.h> #include <kdialog.h> @@ -324,6 +323,13 @@ buttonLayout->addWidget( closeButton ); connect( closeButton, SIGNAL( clicked() ), SLOT( close() ) ); + { + using namespace KABC; + mAddressBook = KABC::StdAddressBook::self( true ); + connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), + this, SLOT( insertAddressBook( AddressBook * ) ) ); + } + initCollections(); mCollectionCombo->setCurrentItem( 0 ); @@ -355,8 +361,21 @@ void RecipientsPicker::initCollections() { - KABC::StdAddressBook *addressbook = KABC::StdAddressBook::self( true ); + mAllRecipients = new RecipientsCollection; + mAllRecipients->setTitle( i18n("All") ); + insertCollection( mAllRecipients ); + insertDistributionLists(); + + insertRecentAddresses(); + + mSelectedRecipients = new RecipientsCollection; + mSelectedRecipients->setTitle( i18n("Selected Recipients") ); + insertCollection( mSelectedRecipients ); +} + +void RecipientsPicker::insertAddressBook( KABC::AddressBook *addressbook ) +{ QMap<KABC::Resource *,RecipientsCollection *> collectionMap; QPtrList<KABC::Resource> resources = addressbook->resources(); @@ -369,9 +388,6 @@ QMap<QString,RecipientsCollection *> categoryMap; - mAllRecipients = new RecipientsCollection; - mAllRecipients->setTitle( i18n("All") ); - KABC::AddressBook::Iterator it; for( it = addressbook->begin(); it != addressbook->end(); ++it ) { QStringList emails = (*it).emails(); @@ -405,8 +421,6 @@ } } - insertCollection( mAllRecipients ); - QMap<KABC::Resource *,RecipientsCollection *>::ConstIterator it2; for( it2 = collectionMap.begin(); it2 != collectionMap.end(); ++it2 ) { insertCollection( *it2 ); @@ -416,14 +430,8 @@ for( it3 = categoryMap.begin(); it3 != categoryMap.end(); ++it3 ) { insertCollection( *it3 ); } - - insertDistributionLists(); - - insertRecentAddresses(); - - mSelectedRecipients = new RecipientsCollection; - mSelectedRecipients->setTitle( i18n("Selected Recipients") ); - insertCollection( mSelectedRecipients ); + + updateList(); } void RecipientsPicker::insertDistributionLists() --- branches/KDE/3.5/kdepim/kmail/recipientspicker.h #497766:497767 @@ -26,6 +26,7 @@ #include <klistview.h> #include <klistviewsearchline.h> #include <kabc/addressee.h> +#include <kabc/stdaddressbook.h> #include <qwidget.h> #include <qdialog.h> @@ -133,6 +134,8 @@ void keyPressEvent( QKeyEvent * ); }; +using namespace KABC; + class RecipientsPicker : public QDialog { Q_OBJECT @@ -172,8 +175,11 @@ void slotPicked(); void setFocusList(); void resetSearch(); - + void insertAddressBook( AddressBook * ); + private: + KABC::StdAddressBook *mAddressBook; + QComboBox *mCollectionCombo; KListView *mRecipientList; KListViewSearchLine *mSearchLine;