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

List:       kde-pim
Subject:    [Kde-pim] [PATCH] libkresources don't write config file in add()
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2003-11-27 14:37:25
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Hi,

the attached patch fixes KRES::ManagerImpl::add() to write the resource
settings only when the settings are read before.
In the past this caused often duplicated resources and it avoids the
easy manual usage of KCal::CalendarResources and KABC::AddressBook.

Ok to commit?

P.S.: this patch is not BIC, so you have to recompile libkcal and
libkabc, otherwise you will get strange crashes...

Ciao,
Tobias
--=20
Can a government that shoots at reporters be democratic?
Separate politics from religion and economy!

["kresources.patch" (text/plain)]

Index: managerimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/kresources/managerimpl.cpp,v
retrieving revision 1.19
diff -p -u -b -r1.19 managerimpl.cpp
--- managerimpl.cpp	9 Nov 2003 23:22:49 -0000	1.19
+++ managerimpl.cpp	26 Nov 2003 17:15:48 -0000
@@ -41,7 +41,7 @@ ManagerImpl::ManagerImpl( ManagerNotifie
   : DCOPObject( "ManagerIface_" + family.utf8() ),
     mNotifier( notifier ),
     mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ),
-    mFactory( 0 )
+    mFactory( 0 ), mConfigRead( false )
 {
   kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl;
 
@@ -119,6 +119,8 @@ void ManagerImpl::readConfig( KConfig *c
   for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) {
     readResourceConfig( *it, false );
   }
+
+  mConfigRead = true;
 }
 
 void ManagerImpl::writeConfig( KConfig *cfg )
@@ -171,6 +173,7 @@ void ManagerImpl::add( Resource *resourc
 
   mResources.append( resource );
 
+  if ( mConfigRead )
   writeResourceConfig( resource, true );
 
   signalKResourceAdded( mId, resource->identifier() );
Index: managerimpl.h
===================================================================
RCS file: /home/kde/kdelibs/kresources/managerimpl.h,v
retrieving revision 1.16
diff -p -u -b -r1.16 managerimpl.h
--- managerimpl.h	9 Nov 2003 23:22:49 -0000	1.16
+++ managerimpl.h	26 Nov 2003 17:15:48 -0000
@@ -96,6 +96,10 @@ class ManagerImpl : virtual public Manag
     Factory *mFactory;
     Resource::List mResources;
     QString mId;
+    bool mConfigRead;
+
+    class ManagerImplPrivate;
+    ManagerImplPrivate *d;
 };
 
 }

["signature.asc" (application/pgp-signature)]

_______________________________________________
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