summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp10
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkcal/incidencebase.cpp2
4 files changed, 14 insertions, 0 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 2243e28..3b7b183 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -55,48 +55,49 @@ namespace KCal {
55 care of deleting it. All Events returned by the query functions are returned 55 care of deleting it. All Events returned by the query functions are returned
56 as pointers, that means all changes to the returned events are immediately 56 as pointers, that means all changes to the returned events are immediately
57 visible in the Calendar. You shouldn't delete any Event object you get from 57 visible in the Calendar. You shouldn't delete any Event object you get from
58 Calendar. 58 Calendar.
59*/ 59*/
60class Calendar : public QObject, public CustomProperties, 60class Calendar : public QObject, public CustomProperties,
61 public IncidenceBase::Observer 61 public IncidenceBase::Observer
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
65 Calendar(); 65 Calendar();
66 Calendar(const QString &timeZoneId); 66 Calendar(const QString &timeZoneId);
67 virtual ~Calendar(); 67 virtual ~Calendar();
68 Incidence * undoIncidence() { return mUndoIncidence; }; 68 Incidence * undoIncidence() { return mUndoIncidence; };
69 bool undoDeleteIncidence(); 69 bool undoDeleteIncidence();
70 void deleteIncidence(Incidence *in); 70 void deleteIncidence(Incidence *in);
71 void resetTempSyncStat(); 71 void resetTempSyncStat();
72 void resetPilotStat(int id); 72 void resetPilotStat(int id);
73 /** 73 /**
74 Clears out the current calendar, freeing all used memory etc. 74 Clears out the current calendar, freeing all used memory etc.
75 */ 75 */
76 virtual void close() = 0; 76 virtual void close() = 0;
77 virtual void addCalendar( Calendar* ) = 0; 77 virtual void addCalendar( Calendar* ) = 0;
78 virtual bool addCalendarFile( QString name, int id ) = 0; 78 virtual bool addCalendarFile( QString name, int id ) = 0;
79 virtual void setSyncEventsReadOnly() = 0;
79 80
80 /** 81 /**
81 Sync changes in memory to persistant storage. 82 Sync changes in memory to persistant storage.
82 */ 83 */
83 virtual void save() = 0; 84 virtual void save() = 0;
84 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 85 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
85 virtual void removeSyncInfo( QString syncProfile) = 0; 86 virtual void removeSyncInfo( QString syncProfile) = 0;
86 virtual bool isSaving() { return false; } 87 virtual bool isSaving() { return false; }
87 88
88 /** 89 /**
89 Return the owner of the calendar's full name. 90 Return the owner of the calendar's full name.
90 */ 91 */
91 const QString &getOwner() const; 92 const QString &getOwner() const;
92 /** 93 /**
93 Set the owner of the calendar. Should be owner's full name. 94 Set the owner of the calendar. Should be owner's full name.
94 */ 95 */
95 void setOwner( const QString &os ); 96 void setOwner( const QString &os );
96 /** 97 /**
97 Return the email address of the calendar owner. 98 Return the email address of the calendar owner.
98 */ 99 */
99 const QString &getEmail(); 100 const QString &getEmail();
100 /** 101 /**
101 Set the email address of the calendar owner. 102 Set the email address of the calendar owner.
102 */ 103 */
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 336c3e8..8c4dde1 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -57,48 +57,58 @@ CalendarLocal::CalendarLocal(const QString &timeZoneId)
57 init(); 57 init();
58} 58}
59 59
60void CalendarLocal::init() 60void CalendarLocal::init()
61{ 61{
62 mNextAlarmIncidence = 0; 62 mNextAlarmIncidence = 0;
63} 63}
64 64
65 65
66CalendarLocal::~CalendarLocal() 66CalendarLocal::~CalendarLocal()
67{ 67{
68 if ( mDeleteIncidencesOnClose ) 68 if ( mDeleteIncidencesOnClose )
69 close(); 69 close();
70} 70}
71bool CalendarLocal::addCalendarFile( QString name, int id ) 71bool CalendarLocal::addCalendarFile( QString name, int id )
72{ 72{
73 CalendarLocal calendar( timeZoneId() ); 73 CalendarLocal calendar( timeZoneId() );
74 calendar.setDefaultCalendar( id ); 74 calendar.setDefaultCalendar( id );
75 if ( calendar.load( name ) ) { 75 if ( calendar.load( name ) ) {
76 addCalendar( &calendar ); 76 addCalendar( &calendar );
77 return true; 77 return true;
78 } 78 }
79 return false; 79 return false;
80} 80}
81void CalendarLocal::setSyncEventsReadOnly()
82{
83 Event * ev;
84 ev = mEventList.first();
85 while ( ev ) {
86 if ( ev->uid().left(15) == QString("last-syncEvent-") )
87 ev->setReadOnly( true );
88 ev = mEventList.next();
89 }
90}
81void CalendarLocal::addCalendar( Calendar* cal ) 91void CalendarLocal::addCalendar( Calendar* cal )
82{ 92{
83 cal->setDontDeleteIncidencesOnClose(); 93 cal->setDontDeleteIncidencesOnClose();
84 { 94 {
85 QPtrList<Event> EventList = cal->rawEvents(); 95 QPtrList<Event> EventList = cal->rawEvents();
86 Event * ev = EventList.first(); 96 Event * ev = EventList.first();
87 while ( ev ) { 97 while ( ev ) {
88 ev->unRegisterObserver( cal ); 98 ev->unRegisterObserver( cal );
89 ev->registerObserver( this ); 99 ev->registerObserver( this );
90 mEventList.append( ev ); 100 mEventList.append( ev );
91 ev = EventList.next(); 101 ev = EventList.next();
92 } 102 }
93 } 103 }
94 { 104 {
95 105
96 QPtrList<Todo> TodoList = cal->rawTodos(); 106 QPtrList<Todo> TodoList = cal->rawTodos();
97 Todo * ev = TodoList.first(); 107 Todo * ev = TodoList.first();
98 while ( ev ) { 108 while ( ev ) {
99 QString rel = ev->relatedToUid(); 109 QString rel = ev->relatedToUid();
100 if ( !rel.isEmpty() ){ 110 if ( !rel.isEmpty() ){
101 ev->setRelatedTo ( 0 ); 111 ev->setRelatedTo ( 0 );
102 ev->setRelatedToUid( rel ); 112 ev->setRelatedToUid( rel );
103 } 113 }
104 ev = TodoList.next(); 114 ev = TodoList.next();
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 5bbe55f..0286b48 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -24,48 +24,49 @@
24 24
25#include "calendar.h" 25#include "calendar.h"
26 26
27namespace KCal { 27namespace KCal {
28 28
29class CalFormat; 29class CalFormat;
30 30
31/** 31/**
32 This class provides a calendar stored as a local file. 32 This class provides a calendar stored as a local file.
33*/ 33*/
34class CalendarLocal : public Calendar 34class CalendarLocal : public Calendar
35{ 35{
36 public: 36 public:
37 /** 37 /**
38 Constructs a new calendar, with variables initialized to sane values. 38 Constructs a new calendar, with variables initialized to sane values.
39 */ 39 */
40 CalendarLocal(); 40 CalendarLocal();
41 /** 41 /**
42 Constructs a new calendar, with variables initialized to sane values. 42 Constructs a new calendar, with variables initialized to sane values.
43 */ 43 */
44 CalendarLocal( const QString &timeZoneId ); 44 CalendarLocal( const QString &timeZoneId );
45 ~CalendarLocal(); 45 ~CalendarLocal();
46 void addCalendar( Calendar* ); 46 void addCalendar( Calendar* );
47 bool addCalendarFile( QString name, int id ); 47 bool addCalendarFile( QString name, int id );
48 void setSyncEventsReadOnly();
48 /** 49 /**
49 Loads a calendar on disk in vCalendar or iCalendar format into the current 50 Loads a calendar on disk in vCalendar or iCalendar format into the current
50 calendar. Any information already present is lost. 51 calendar. Any information already present is lost.
51 @return true, if successfull, false on error. 52 @return true, if successfull, false on error.
52 @param fileName the name of the calendar on disk. 53 @param fileName the name of the calendar on disk.
53 */ 54 */
54 bool load( const QString &fileName ); 55 bool load( const QString &fileName );
55 /** 56 /**
56 Writes out the calendar to disk in the specified \a format. 57 Writes out the calendar to disk in the specified \a format.
57 CalendarLocal takes ownership of the CalFormat object. 58 CalendarLocal takes ownership of the CalFormat object.
58 @return true, if successfull, false on error. 59 @return true, if successfull, false on error.
59 @param fileName the name of the file 60 @param fileName the name of the file
60 */ 61 */
61 bool save( const QString &fileName, CalFormat *format = 0 ); 62 bool save( const QString &fileName, CalFormat *format = 0 );
62 63
63 /** 64 /**
64 Clears out the current calendar, freeing all used memory etc. etc. 65 Clears out the current calendar, freeing all used memory etc. etc.
65 */ 66 */
66 void close(); 67 void close();
67 68
68 void save() {} 69 void save() {}
69 70
70 /** 71 /**
71 Add Event to calendar. 72 Add Event to calendar.
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 2ddbb01..96039df 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -120,48 +120,50 @@ bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 )
120 } 120 }
121 } else { 121 } else {
122 return false; 122 return false;
123 } 123 }
124 124
125 return ( i1.organizer() == i2.organizer() && 125 return ( i1.organizer() == i2.organizer() &&
126 // i1.uid() == i2.uid() && 126 // i1.uid() == i2.uid() &&
127 // Don't compare lastModified, otherwise the operator is not 127 // Don't compare lastModified, otherwise the operator is not
128 // of much use. We are not comparing for identity, after all. 128 // of much use. We are not comparing for identity, after all.
129 i1.doesFloat() == i2.doesFloat() && 129 i1.doesFloat() == i2.doesFloat() &&
130 i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); 130 i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() );
131 // no need to compare mObserver 131 // no need to compare mObserver
132} 132}
133 133
134 134
135QDateTime IncidenceBase::getEvenTime( QDateTime dt ) 135QDateTime IncidenceBase::getEvenTime( QDateTime dt )
136{ 136{
137 QTime t = dt.time(); 137 QTime t = dt.time();
138 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 138 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) );
139 return dt; 139 return dt;
140} 140}
141 141
142void IncidenceBase::setCalID( int id ) 142void IncidenceBase::setCalID( int id )
143{ 143{
144 if ( mCalID > 0 )
145 updated();
144 mCalID = id; 146 mCalID = id;
145} 147}
146int IncidenceBase::calID() const 148int IncidenceBase::calID() const
147{ 149{
148 return mCalID; 150 return mCalID;
149} 151}
150void IncidenceBase::setCalEnabled( bool b ) 152void IncidenceBase::setCalEnabled( bool b )
151{ 153{
152 mCalEnabled = b; 154 mCalEnabled = b;
153} 155}
154bool IncidenceBase::calEnabled() const 156bool IncidenceBase::calEnabled() const
155{ 157{
156 return mCalEnabled; 158 return mCalEnabled;
157} 159}
158 160
159void IncidenceBase::setAlarmEnabled( bool b ) 161void IncidenceBase::setAlarmEnabled( bool b )
160{ 162{
161 mAlarmEnabled = b; 163 mAlarmEnabled = b;
162} 164}
163bool IncidenceBase::alarmEnabled() const 165bool IncidenceBase::alarmEnabled() const
164{ 166{
165 return mAlarmEnabled; 167 return mAlarmEnabled;
166} 168}
167 169