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

List:       kde-commits
Subject:    kdepim/libkdepim
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2005-04-13 16:43:33
Message-ID: 20050413164333.17036492 () office ! kde ! org
[Download RAW message or body]

CVS commit by tokoe: 

Wait until all contacts are loaded before saving the addressbook again.
That prevents data lose. You need a current kdelibs.


  M +12 -0     kaddrbook.cpp   1.10


--- kdepim/libkdepim/kaddrbook.cpp  #1.9:1.10
@@ -13,4 +13,5 @@
 #include <klocale.h>
 #include <kmessagebox.h>
+#include <kdeversion.h>
 #include <kabc/distributionlist.h>
 #include <kabc/resource.h>
@@ -21,4 +22,5 @@
 #include <dcopclient.h> 
 
+#include <qeventloop.h>
 #include <qregexp.h>
 
@@ -128,4 +130,14 @@ bool KAddrBookExternal::addAddressee( co
   KABC::AddressBook *addressBook = KABC::StdAddressBook::self( true );
 
+#if KDE_IS_VERSION(3,4,89)
+  // This ugly hack will be removed in 4.0
+  while ( !addressBook->loadingHasFinished() ) {
+    QApplication::eventLoop()->processEvents( QEventLoop::ExcludeUserInput );
+
+    // use sleep here to reduce cpu usage
+    usleep( 100 );
+  }
+#endif
+
   // Select a resource
   QPtrList<KABC::Resource> kabcResources = addressBook->resources();


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

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