summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-30 08:08:47 (UTC)
committer zautrix <zautrix>2005-07-30 08:08:47 (UTC)
commit055928e26613f4ab249bd82be86890ed278372f6 (patch) (unidiff)
tree0dfc4cba815a2ba0b30c71fbd74b340e2bcc8572
parent9cbd19485635dc0edacd14403e4c63d6d469bfce (diff)
downloadkdepimpi-055928e26613f4ab249bd82be86890ed278372f6.zip
kdepimpi-055928e26613f4ab249bd82be86890ed278372f6.tar.gz
kdepimpi-055928e26613f4ab249bd82be86890ed278372f6.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendarlocal.cpp31
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkcal/journal.cpp4
3 files changed, 24 insertions, 12 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 5baa7dc..e8c969f 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -265,13 +265,26 @@ void CalendarLocal::close()
265 mEventList.setAutoDelete( false ); 265 mEventList.setAutoDelete( false );
266 mTodoList.setAutoDelete( false ); 266 mTodoList.setAutoDelete( false );
267 mJournalList.setAutoDelete( false ); 267 mJournalList.setAutoDelete( false );
268 268
269 setModified( false ); 269 setModified( false );
270} 270}
271 271 void CalendarLocal::clearUndo()
272{
273 if ( mUndoIncidence ) {
274 if ( mUndoIncidence->typeID() == eventID )
275 delete ((Event*) mUndoIncidence) ;
276 else if ( mUndoIncidence->typeID() == todoID )
277 delete ( (Todo*) mUndoIncidence );
278 else if ( mUndoIncidence->typeID() == journalID )
279 delete ( (Journal*) mUndoIncidence );
280 else
281 delete mUndoIncidence;
282 }
283 mUndoIncidence = 0;
284}
272bool CalendarLocal::addAnniversaryNoDup( Event *event ) 285bool CalendarLocal::addAnniversaryNoDup( Event *event )
273{ 286{
274 QString cat; 287 QString cat;
275 bool isBirthday = true; 288 bool isBirthday = true;
276 if( event->categoriesStr() == i18n( "Anniversary" ) ) { 289 if( event->categoriesStr() == i18n( "Anniversary" ) ) {
277 isBirthday = false; 290 isBirthday = false;
@@ -324,14 +337,14 @@ bool CalendarLocal::addEvent( Event *event )
324 337
325 return true; 338 return true;
326} 339}
327 340
328void CalendarLocal::deleteEvent( Event *event ) 341void CalendarLocal::deleteEvent( Event *event )
329{ 342{
330 if ( mUndoIncidence ) delete mUndoIncidence; 343 clearUndo();
331 mUndoIncidence = event->clone(); 344 mUndoIncidence = event;
332 if ( mEventList.removeRef( event ) ) { 345 if ( mEventList.removeRef( event ) ) {
333 setModified( true ); 346 setModified( true );
334 } 347 }
335} 348}
336 349
337 350
@@ -379,15 +392,15 @@ bool CalendarLocal::addTodo( Todo *todo )
379 return true; 392 return true;
380} 393}
381 394
382void CalendarLocal::deleteTodo( Todo *todo ) 395void CalendarLocal::deleteTodo( Todo *todo )
383{ 396{
384 // Handle orphaned children 397 // Handle orphaned children
385 if ( mUndoIncidence ) delete mUndoIncidence; 398 clearUndo();
386 removeRelations( todo ); 399 removeRelations( todo );
387 mUndoIncidence = todo->clone(); 400 mUndoIncidence = todo;
388 401
389 if ( mTodoList.removeRef( todo ) ) { 402 if ( mTodoList.removeRef( todo ) ) {
390 setModified( true ); 403 setModified( true );
391 } 404 }
392} 405}
393 406
@@ -883,15 +896,14 @@ bool CalendarLocal::addJournal(Journal *journal)
883 journal->setCalEnabled( true ); 896 journal->setCalEnabled( true );
884 return true; 897 return true;
885} 898}
886 899
887void CalendarLocal::deleteJournal( Journal *journal ) 900void CalendarLocal::deleteJournal( Journal *journal )
888{ 901{
889 if ( mUndoIncidence ) delete mUndoIncidence; 902 clearUndo();
890 mUndoIncidence = journal->clone(); 903 mUndoIncidence = journal;
891 mUndoIncidence->setSummary( mUndoIncidence->description().left(25));
892 if ( mJournalList.removeRef(journal) ) { 904 if ( mJournalList.removeRef(journal) ) {
893 setModified( true ); 905 setModified( true );
894 } 906 }
895} 907}
896 908
897QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date ) 909QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date )
@@ -964,14 +976,13 @@ void CalendarLocal::setCalendarRemove( int id )
964 if ( ev->calID() == id ) 976 if ( ev->calID() == id )
965 deleteJournal( ev ); 977 deleteJournal( ev );
966 ev = JournalList.next(); 978 ev = JournalList.next();
967 } 979 }
968 } 980 }
969 981
970 if ( mUndoIncidence ) delete mUndoIncidence; 982 clearUndo();
971 mUndoIncidence = 0;
972 983
973} 984}
974 985
975void CalendarLocal::setCalendarEnabled( int id, bool enable ) 986void CalendarLocal::setCalendarEnabled( int id, bool enable )
976{ 987{
977 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 988 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index a7a85c8..ae7e30c 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -66,12 +66,13 @@ class CalendarLocal : public Calendar
66 bool save( const QString &fileName, CalFormat *format = 0 ); 66 bool save( const QString &fileName, CalFormat *format = 0 );
67 67
68 /** 68 /**
69 Clears out the current calendar, freeing all used memory etc. etc. 69 Clears out the current calendar, freeing all used memory etc. etc.
70 */ 70 */
71 void close(); 71 void close();
72 void clearUndo();
72 73
73 void save() {} 74 void save() {}
74 75
75 /** 76 /**
76 Add Event to calendar. 77 Add Event to calendar.
77 */ 78 */
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp
index c4e4474..328db46 100644
--- a/libkcal/journal.cpp
+++ b/libkcal/journal.cpp
@@ -21,18 +21,18 @@
21#include "journal.h" 21#include "journal.h"
22 22
23using namespace KCal; 23using namespace KCal;
24 24
25Journal::Journal() 25Journal::Journal()
26{ 26{
27 qDebug("New JJJ "); 27
28} 28}
29 29
30Journal::~Journal() 30Journal::~Journal()
31{ 31{
32 qDebug("delete JJJ "); 32
33} 33}
34 34
35Incidence *Journal::clone() 35Incidence *Journal::clone()
36{ 36{
37 return new Journal(*this); 37 return new Journal(*this);
38} 38}