From kde-pim Thu Nov 27 14:37:25 2003 From: Tobias Koenig Date: Thu, 27 Nov 2003 14:37:25 +0000 To: kde-pim Subject: [Kde-pim] [PATCH] libkresources don't write config file in add() X-MARC-Message: https://marc.info/?l=kde-pim&m=106994395630847 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0910904309==" --===============0910904309== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EuxKj2iCbKjpUGkD" Content-Disposition: inline --EuxKj2iCbKjpUGkD Content-Type: multipart/mixed; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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! --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: attachment; filename="kresources.patch" Content-Transfer-Encoding: quoted-printable Index: managerimpl.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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; =20 @@ -119,6 +119,8 @@ void ManagerImpl::readConfig( KConfig *c for ( QStringList::Iterator it =3D keys.begin(); it !=3D keys.end(); ++i= t ) { readResourceConfig( *it, false ); } + + mConfigRead =3D true; } =20 void ManagerImpl::writeConfig( KConfig *cfg ) @@ -171,6 +173,7 @@ void ManagerImpl::add( Resource *resourc =20 mResources.append( resource ); =20 + if ( mConfigRead ) writeResourceConfig( resource, true ); =20 signalKResourceAdded( mId, resource->identifier() ); Index: managerimpl.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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; }; =20 } --vtzGhvizbBRQ85DL-- --EuxKj2iCbKjpUGkD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQE/xgwlSvFUKpY6VLARAi/ZAJ4tUyHD03vGVR/DhhhxGWyBsOL3bACeMESU QhrjKBkBdh3BNNTrqY4Phzg= =GXno -----END PGP SIGNATURE----- --EuxKj2iCbKjpUGkD-- --===============0910904309== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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/ --===============0910904309==--