--===============1521245460== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cQXOx3fnlpmgJsTP" Content-Disposition: inline --cQXOx3fnlpmgJsTP Content-Type: multipart/mixed; boundary="8NvZYKFJsRX2Djef" Content-Disposition: inline --8NvZYKFJsRX2Djef Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, the attached patch factors out the readConfig() and load() method from KCal::CalendarResources, so the following code CalendarResources *calendar =3D new CalendarResources(); has to be written as CalendarResources *calendar =3D new CalendarResources(); calendar->readConfig(); calendar->load(); now to get the same results. This refactoring is neccassary to get code like the following working: CalendarResources *calendar =3D new CalendarResources(); ResourcesLocal *res =3D new ResourceLocal( "/home/user/events.ics" ); calendar->resourceManager()->add( res ); calendar->load(); With the old implementation the 'standard' calendars would also be loaded and the new resource was written back to the config file (see other kresources patch), now only the dates from events.ics are loaded and stored. This behaviour is needed to get KNotes(Part/Summary) working with locking and change notifications. The patch also includes the neccessary changes in the whole kdepim sources. Ok for commit? Ciao, Tobias --=20 Can a government that shoots at reporters be democratic? Separate politics from religion and economy! --8NvZYKFJsRX2Djef Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: attachment; filename="calendarresources_with_kdepim_fixes.patch" Content-Transfer-Encoding: quoted-printable Index: konsolekalendar/main.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/kdepim/konsolekalendar/main.cpp,v retrieving revision 1.48 diff -p -u -b -r1.48 main.cpp --- konsolekalendar/main.cpp 26 Nov 2003 09:21:50 -0000 1.48 +++ konsolekalendar/main.cpp 27 Nov 2003 14:33:07 -0000 @@ -494,6 +494,8 @@ int main(int argc, char *argv[]) variables.setCalendar( localCalendar ); =20 } else { calendarResource =3D new CalendarResources(); =20 + calendarResource->readConfig(); + calendarResource->load(); variables.setCalendarResources( calendarResource ); =20 } =20 Index: korganizer/kocore.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/kdepim/korganizer/kocore.cpp,v retrieving revision 1.29 diff -p -u -b -r1.29 kocore.cpp --- korganizer/kocore.cpp 25 Nov 2003 21:35:39 -0000 1.29 +++ korganizer/kocore.cpp 27 Nov 2003 14:33:08 -0000 @@ -311,6 +311,8 @@ KCal::CalendarResources *KOCore::calenda { if ( !mCalendarResources ) { mCalendarResources =3D new KCal::CalendarResources( KOPrefs::instance(= )->mTimeZoneId ); + mCalendarResources->readConfig(); + mCalendarResources->load(); =20 KCal::CalendarResourceManager *manager =3D mCalendarResources->resourc= eManager(); =20 Index: korganizer/korgac/koalarmclient.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/kdepim/korganizer/korgac/koalarmclient.cpp,v retrieving revision 1.15 diff -p -u -b -r1.15 koalarmclient.cpp --- korganizer/korgac/koalarmclient.cpp 16 Nov 2003 19:28:40 -0000 1.15 +++ korganizer/korgac/koalarmclient.cpp 27 Nov 2003 14:33:08 -0000 @@ -53,6 +53,8 @@ KOAlarmClient::KOAlarmClient( QObject *p SLOT( suspend( int ) ) ); =20 mCalendar =3D new CalendarResources(); + mCalendar->readConfig(); + mCalendar->load(); =20 KConfig c( locate( "config", "korganizerrc" ) ); c.setGroup( "Time & Date" ); Index: kpilot/conduits/vcalconduit/vcal-conduitbase.cc =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/kdepim/kpilot/conduits/vcalconduit/vcal-conduitbase.cc,v retrieving revision 1.48 diff -p -u -b -r1.48 vcal-conduitbase.cc --- kpilot/conduits/vcalconduit/vcal-conduitbase.cc 19 Oct 2003 20:38:58 -0= 000 1.48 +++ kpilot/conduits/vcalconduit/vcal-conduitbase.cc 27 Nov 2003 14:33:10 -0= 000 @@ -318,6 +318,8 @@ error: "object for ResourceCalendar"<readConfig(); + fCalendar->load(); break; default: break; Index: libkcal/calendarresources.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/kdepim/libkcal/calendarresources.cpp,v retrieving revision 1.35 diff -p -u -b -r1.35 calendarresources.cpp --- libkcal/calendarresources.cpp 9 Nov 2003 23:23:26 -0000 1.35 +++ libkcal/calendarresources.cpp 27 Nov 2003 14:33:11 -0000 @@ -85,9 +85,29 @@ void CalendarResources::init() kdDebug(5800) << "CalendarResources::init" << endl; =20 mManager =3D new CalendarResourceManager( "calendar" ); - mManager->readConfig( 0 ); mManager->addObserver( this ); =20 + mStandardPolicy =3D new StandardDestinationPolicy( mManager ); + mAskPolicy =3D new AskDestinationPolicy( mManager ); + mDestinationPolicy =3D mStandardPolicy; +} + +CalendarResources::~CalendarResources() +{ + kdDebug(5800) << "CalendarResources::destructor" << endl; + + close(); + + delete mManager; +} + +void CalendarResources::readConfig( KConfig *config ) +{ + mManager->readConfig( config ); +} + +void CalendarResources::load() +{ if ( !mManager->standardResource() ) { kdDebug(5800) << "Warning! No standard resource yet." << endl; } @@ -108,23 +128,9 @@ void CalendarResources::init() connectResource( *it ); } =20 - mStandardPolicy =3D new StandardDestinationPolicy( mManager ); - mAskPolicy =3D new AskDestinationPolicy( mManager ); - mDestinationPolicy =3D mStandardPolicy; - mOpen =3D true; } =20 - -CalendarResources::~CalendarResources() -{ - kdDebug(5800) << "CalendarResources::destructor" << endl; - - close(); - - delete mManager; -} - void CalendarResources::setStandardDestinationPolicy() { mDestinationPolicy =3D mStandardPolicy; Index: libkcal/calendarresources.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/kdepim/libkcal/calendarresources.h,v retrieving revision 1.26 diff -p -u -b -r1.26 calendarresources.h --- libkcal/calendarresources.h 9 Nov 2003 23:23:26 -0000 1.26 +++ libkcal/calendarresources.h 27 Nov 2003 14:33:11 -0000 @@ -99,6 +99,22 @@ class CalendarResources : public Calenda ~CalendarResources(); =20 /** + Read the resources settings from a config file. You have to call this + method before load(). + + @param config The KConfig object which points to the config file. + If no object is given (null pointer) the standard conf= ig + file is used. + */ + void readConfig( KConfig *config =3D 0 ); + + /** + Loads all events from the resources. You have to add the resources f= irst + or call readConfig() to load the system resources. + */ + void load(); + + /** Return ResourceManager used by this calendar. */ CalendarResourceManager *resourceManager() const --8NvZYKFJsRX2Djef-- --cQXOx3fnlpmgJsTP 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/xg3BSvFUKpY6VLARAnbVAJ9RnUp1pWUFcBi98iH9cCJSTL6pKQCgp1RF 1hhqf4/XchB4opObCqiQfAU= =Hm6w -----END PGP SIGNATURE----- --cQXOx3fnlpmgJsTP-- --===============1521245460== 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/ --===============1521245460==--