summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/komonthview.cpp6
-rw-r--r--libkcal/calendarlocal.cpp1
-rw-r--r--libkcal/icalformat.cpp9
-rw-r--r--libkcal/icalformat.h3
-rw-r--r--libkcal/todo.cpp5
5 files changed, 19 insertions, 5 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index eea9a4d..4aeb20c 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1104,17 +1104,21 @@ void MonthViewCell::contextMenu( QListBoxItem *item )
1104 if ( !item ) { 1104 if ( !item ) {
1105 mMonthView->showContextMenu( 0 ); 1105 mMonthView->showContextMenu( 0 );
1106 return; 1106 return;
1107 } 1107 }
1108 //selection( item ); 1108 //selection( item );
1109 //qApp->processEvents(); 1109 //qApp->processEvents();
1110 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1110 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1111 Incidence *incidence = eventItem->incidence(); 1111 Incidence *incidence = eventItem->incidence();
1112 if ( incidence ) mMonthView->showContextMenu( incidence ); 1112 if ( incidence ) {
1113 mMonthView->showContextMenu( incidence );
1114 selection( item );
1115 doHighLight( incidence );
1116 }
1113} 1117}
1114 1118
1115void MonthViewCell::selection( QListBoxItem *item ) 1119void MonthViewCell::selection( QListBoxItem *item )
1116{ 1120{
1117 if ( !item ) { 1121 if ( !item ) {
1118 emit highlightIncidence( 0 , this, 0 ); 1122 emit highlightIncidence( 0 , this, 0 );
1119 return; 1123 return;
1120 } 1124 }
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e37a7ad..eef8327 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -60,16 +60,17 @@ CalendarLocal::CalendarLocal(const QString &timeZoneId)
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 registerObserver( 0 );
68 if ( mDeleteIncidencesOnClose ) 69 if ( mDeleteIncidencesOnClose )
69 close(); 70 close();
70} 71}
71bool CalendarLocal::mergeCalendarFile( QString name ) 72bool CalendarLocal::mergeCalendarFile( QString name )
72{ 73{
73 CalendarLocal calendar( timeZoneId() ); 74 CalendarLocal calendar( timeZoneId() );
74 calendar.setDefaultCalendar( 1 ); 75 calendar.setDefaultCalendar( 1 );
75 if ( calendar.load( name ) ) { 76 if ( calendar.load( name ) ) {
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp
index 5877406..6f3a799 100644
--- a/libkcal/icalformat.cpp
+++ b/libkcal/icalformat.cpp
@@ -45,18 +45,19 @@ extern "C" {
45 45
46#include "icalformat.h" 46#include "icalformat.h"
47#include "icalformatimpl.h" 47#include "icalformatimpl.h"
48 48
49#define _ICAL_VERSION "2.0" 49#define _ICAL_VERSION "2.0"
50 50
51using namespace KCal; 51using namespace KCal;
52 52
53ICalFormat::ICalFormat( ) 53ICalFormat::ICalFormat( bool pe )
54{ 54{
55 mProcessEvents = pe;
55 mImpl = new ICalFormatImpl( this ); 56 mImpl = new ICalFormatImpl( this );
56 tzOffsetMin = 0; 57 tzOffsetMin = 0;
57 //qDebug("new ICalFormat() "); 58 //qDebug("new ICalFormat() ");
58} 59}
59 60
60ICalFormat::~ICalFormat() 61ICalFormat::~ICalFormat()
61{ 62{
62 delete mImpl; 63 delete mImpl;
@@ -184,40 +185,46 @@ QString ICalFormat::toString( Calendar *cal )
184 185
185 // todos 186 // todos
186 QPtrList<Todo> todoList = cal->rawTodos(); 187 QPtrList<Todo> todoList = cal->rawTodos();
187 QPtrListIterator<Todo> qlt(todoList); 188 QPtrListIterator<Todo> qlt(todoList);
188 for (; qlt.current(); ++qlt) { 189 for (; qlt.current(); ++qlt) {
189 component = mImpl->writeTodo(qlt.current()); 190 component = mImpl->writeTodo(qlt.current());
190 icalcomponent_add_component(calendar,component); 191 icalcomponent_add_component(calendar,component);
191 //qDebug(" todos "); 192 //qDebug(" todos ");
193 if ( mProcessEvents ) {
194 //qDebug("mProcessEvents ");
192 qApp->processEvents(); 195 qApp->processEvents();
193 } 196 }
197 }
194 // events 198 // events
195 QPtrList<Event> events = cal->rawEvents(); 199 QPtrList<Event> events = cal->rawEvents();
196 Event *ev; 200 Event *ev;
197 for(ev=events.first();ev;ev=events.next()) { 201 for(ev=events.first();ev;ev=events.next()) {
198 component = mImpl->writeEvent(ev); 202 component = mImpl->writeEvent(ev);
199 icalcomponent_add_component(calendar,component); 203 icalcomponent_add_component(calendar,component);
200 //qDebug("events "); 204 //qDebug("events ");
205 if ( mProcessEvents )
201 qApp->processEvents(); 206 qApp->processEvents();
202 } 207 }
203 208
204 // journals 209 // journals
205 QPtrList<Journal> journals = cal->journals(); 210 QPtrList<Journal> journals = cal->journals();
206 Journal *j; 211 Journal *j;
207 for(j=journals.first();j;j=journals.next()) { 212 for(j=journals.first();j;j=journals.next()) {
208 component = mImpl->writeJournal(j); 213 component = mImpl->writeJournal(j);
209 icalcomponent_add_component(calendar,component); 214 icalcomponent_add_component(calendar,component);
210 //qDebug("journals "); 215 //qDebug("journals ");
216 if ( mProcessEvents )
211 qApp->processEvents(); 217 qApp->processEvents();
212 } 218 }
213 const char *text; 219 const char *text;
214 QString ret =""; 220 QString ret ="";
215 text = icalcomponent_as_ical_string( calendar ); 221 text = icalcomponent_as_ical_string( calendar );
222 if ( mProcessEvents )
216 qApp->processEvents(); 223 qApp->processEvents();
217 224
218 // text = "BEGIN:VCALENDAR\nPRODID\n :-//K Desktop Environment//NONSGML libkcal 3.1//EN\nVERSION\n :2.0\nBEGIN:VEVENT\nDTSTAMP\n :20031231T213514Z\nORGANIZER\n :MAILTO:lutz@putz.de\nCREATED\n :20031231T213513Z\nUID\n :libkcal-1295166342.120\nSEQUENCE\n :0\nLAST-MODIFIED\n :20031231T213513Z\nSUMMARY\n :test1\nCLASS\n :PUBLIC\nPRIORITY\n :3\nDTSTART\n :20040101T090000Z\nDTEND\n :20040101T110000Z\nTRANSP\n :OPAQUE\nEND:VEVENT\nEND:VCALENDAR\n"; 225 // text = "BEGIN:VCALENDAR\nPRODID\n :-//K Desktop Environment//NONSGML libkcal 3.1//EN\nVERSION\n :2.0\nBEGIN:VEVENT\nDTSTAMP\n :20031231T213514Z\nORGANIZER\n :MAILTO:lutz@putz.de\nCREATED\n :20031231T213513Z\nUID\n :libkcal-1295166342.120\nSEQUENCE\n :0\nLAST-MODIFIED\n :20031231T213513Z\nSUMMARY\n :test1\nCLASS\n :PUBLIC\nPRIORITY\n :3\nDTSTART\n :20040101T090000Z\nDTEND\n :20040101T110000Z\nTRANSP\n :OPAQUE\nEND:VEVENT\nEND:VCALENDAR\n";
219 226
220 227
221 if ( text ) { 228 if ( text ) {
222 ret = QString ( text ); 229 ret = QString ( text );
223 } 230 }
diff --git a/libkcal/icalformat.h b/libkcal/icalformat.h
index 485ab6e..a770dbb 100644
--- a/libkcal/icalformat.h
+++ b/libkcal/icalformat.h
@@ -35,17 +35,17 @@ class ICalFormatImpl;
35 loading/saving/converting iCalendar format data into the internal KOrganizer 35 loading/saving/converting iCalendar format data into the internal KOrganizer
36 representation as Calendar and Events. 36 representation as Calendar and Events.
37 37
38 @short iCalendar format implementation 38 @short iCalendar format implementation
39*/ 39*/
40class ICalFormat : public CalFormat { 40class ICalFormat : public CalFormat {
41 public: 41 public:
42 /** Create new iCalendar format. */ 42 /** Create new iCalendar format. */
43 ICalFormat( ); 43 ICalFormat( bool pe = true);
44 virtual ~ICalFormat(); 44 virtual ~ICalFormat();
45 45
46 /** 46 /**
47 Loads a calendar on disk in iCalendar format into calendar. 47 Loads a calendar on disk in iCalendar format into calendar.
48 Returns true if successful, else returns false. Provides more error 48 Returns true if successful, else returns false. Provides more error
49 information by exception(). 49 information by exception().
50 @param calendar Calendar object to be filled. 50 @param calendar Calendar object to be filled.
51 @param fileName The name of the calendar file on disk. 51 @param fileName The name of the calendar file on disk.
@@ -98,16 +98,17 @@ class ICalFormat : public CalFormat {
98 /** Set id of used time zone and whether this time zone is UTC or not. */ 98 /** Set id of used time zone and whether this time zone is UTC or not. */
99 void setTimeZone( const QString &id, bool utc ); 99 void setTimeZone( const QString &id, bool utc );
100 QString timeZoneId() const; 100 QString timeZoneId() const;
101 int timeOffset(); 101 int timeOffset();
102 const char * tzString(); 102 const char * tzString();
103 bool utc() const; 103 bool utc() const;
104 104
105 private: 105 private:
106 bool mProcessEvents;
106 ICalFormatImpl *mImpl; 107 ICalFormatImpl *mImpl;
107 QString mTimeZoneId; 108 QString mTimeZoneId;
108 QCString mTzString; 109 QCString mTzString;
109 int tzOffsetMin; 110 int tzOffsetMin;
110 bool mUtc; 111 bool mUtc;
111}; 112};
112 113
113} 114}
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 4ada2d8..7bf756a 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -61,16 +61,17 @@ Todo::~Todo()
61 //qDebug("Todo::~Todo() "); 61 //qDebug("Todo::~Todo() ");
62} 62}
63 63
64void Todo::setRunningFalse( QString s ) 64void Todo::setRunningFalse( QString s )
65{ 65{
66 if ( ! mRunning ) 66 if ( ! mRunning )
67 return; 67 return;
68 mRunning = false; 68 mRunning = false;
69 if ( mRunSaveTimer )
69 mRunSaveTimer->stop(); 70 mRunSaveTimer->stop();
70 saveRunningInfoToFile( s ); 71 saveRunningInfoToFile( s );
71} 72}
72void Todo::stopRunning() 73void Todo::stopRunning()
73{ 74{
74 if ( !mRunning ) 75 if ( !mRunning )
75 return; 76 return;
76 if ( mRunSaveTimer ) 77 if ( mRunSaveTimer )
@@ -134,17 +135,17 @@ void Todo::saveRunningInfoToFile( QString comment )
134 if ( !comment.isEmpty() ) { 135 if ( !comment.isEmpty() ) {
135 QString des = to->description(); 136 QString des = to->description();
136 if ( des.isEmpty () ) 137 if ( des.isEmpty () )
137 to->setDescription( "TT-Note: " + comment ); 138 to->setDescription( "TT-Note: " + comment );
138 else 139 else
139 to->setDescription( "TT-Note: " + comment +"\n" + des ); 140 to->setDescription( "TT-Note: " + comment +"\n" + des );
140 } 141 }
141 cal.addIncidence( to ); 142 cal.addIncidence( to );
142 ICalFormat format; 143 ICalFormat format( false );
143 file = dir +"/" +file +".ics"; 144 file = dir +"/" +file +".ics";
144 format.save( &cal, file ); 145 format.save( &cal, file );
145 saveParents(); 146 saveParents();
146 147
147} 148}
148void Todo::saveParents() 149void Todo::saveParents()
149{ 150{
150 if (!relatedTo() ) 151 if (!relatedTo() )
@@ -162,17 +163,17 @@ void Todo::saveParents()
162 } else { 163 } else {
163 saveTodo = true; 164 saveTodo = true;
164 } 165 }
165 if ( saveTodo ) { 166 if ( saveTodo ) {
166 CalendarLocal cal; 167 CalendarLocal cal;
167 cal.setLocalTime(); 168 cal.setLocalTime();
168 Todo * par = (Todo *) to->clone(); 169 Todo * par = (Todo *) to->clone();
169 cal.addIncidence( par ); 170 cal.addIncidence( par );
170 ICalFormat format; 171 ICalFormat format( false );
171 format.save( &cal, file ); 172 format.save( &cal, file );
172 } 173 }
173 to->saveParents(); 174 to->saveParents();
174} 175}
175 176
176int Todo::runTime() 177int Todo::runTime()
177{ 178{
178 if ( !mRunning ) 179 if ( !mRunning )