author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /libkcal/scheduler.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | libkcal/scheduler.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libkcal/scheduler.cpp b/libkcal/scheduler.cpp index 253d8b7..234cfcf 100644 --- a/libkcal/scheduler.cpp +++ b/libkcal/scheduler.cpp | |||
@@ -1,355 +1,357 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qdir.h> | 21 | #include <qdir.h> |
22 | #include <qfile.h> | 22 | #include <qfile.h> |
23 | #include <qtextstream.h> | 23 | #include <q3textstream.h> |
24 | //Added by qt3to4: | ||
25 | #include <Q3PtrList> | ||
24 | 26 | ||
25 | #include <klocale.h> | 27 | #include <klocale.h> |
26 | #include <kdebug.h> | 28 | #include <kdebug.h> |
27 | #include <kstandarddirs.h> | 29 | #include <kstandarddirs.h> |
28 | 30 | ||
29 | #include "event.h" | 31 | #include "event.h" |
30 | #include "todo.h" | 32 | #include "todo.h" |
31 | #include "freebusy.h" | 33 | #include "freebusy.h" |
32 | #include "icalformat.h" | 34 | #include "icalformat.h" |
33 | #include "calendar.h" | 35 | #include "calendar.h" |
34 | 36 | ||
35 | #include "scheduler.h" | 37 | #include "scheduler.h" |
36 | 38 | ||
37 | using namespace KCal; | 39 | using namespace KCal; |
38 | 40 | ||
39 | ScheduleMessage::ScheduleMessage(IncidenceBase *incidence,int method,ScheduleMessage::Status status) | 41 | ScheduleMessage::ScheduleMessage(IncidenceBase *incidence,int method,ScheduleMessage::Status status) |
40 | { | 42 | { |
41 | mIncidence = incidence; | 43 | mIncidence = incidence; |
42 | mMethod = method; | 44 | mMethod = method; |
43 | mStatus = status; | 45 | mStatus = status; |
44 | } | 46 | } |
45 | 47 | ||
46 | QString ScheduleMessage::statusName(ScheduleMessage::Status status) | 48 | QString ScheduleMessage::statusName(ScheduleMessage::Status status) |
47 | { | 49 | { |
48 | switch (status) { | 50 | switch (status) { |
49 | case PublishNew: | 51 | case PublishNew: |
50 | return i18n("Publish"); | 52 | return i18n("Publish"); |
51 | case Obsolete: | 53 | case Obsolete: |
52 | return i18n("Obsolete"); | 54 | return i18n("Obsolete"); |
53 | case RequestNew: | 55 | case RequestNew: |
54 | return i18n("New Request"); | 56 | return i18n("New Request"); |
55 | case RequestUpdate: | 57 | case RequestUpdate: |
56 | return i18n("Updated Request"); | 58 | return i18n("Updated Request"); |
57 | default: | 59 | default: |
58 | return i18n("Unknown Status: %1").arg(QString::number(status)); | 60 | return i18n("Unknown Status: %1").arg(QString::number(status)); |
59 | } | 61 | } |
60 | } | 62 | } |
61 | 63 | ||
62 | Scheduler::Scheduler(Calendar *calendar) | 64 | Scheduler::Scheduler(Calendar *calendar) |
63 | { | 65 | { |
64 | mCalendar = calendar; | 66 | mCalendar = calendar; |
65 | mFormat = new ICalFormat(); | 67 | mFormat = new ICalFormat(); |
66 | } | 68 | } |
67 | 69 | ||
68 | Scheduler::~Scheduler() | 70 | Scheduler::~Scheduler() |
69 | { | 71 | { |
70 | delete mFormat; | 72 | delete mFormat; |
71 | } | 73 | } |
72 | 74 | ||
73 | bool Scheduler::acceptTransaction(IncidenceBase *incidence,Method method,ScheduleMessage::Status status) | 75 | bool Scheduler::acceptTransaction(IncidenceBase *incidence,Method method,ScheduleMessage::Status status) |
74 | { | 76 | { |
75 | kdDebug() << "Scheduler::acceptTransaction " << endl; | 77 | kdDebug() << "Scheduler::acceptTransaction " << endl; |
76 | switch (method) { | 78 | switch (method) { |
77 | case Publish: | 79 | case Publish: |
78 | return acceptPublish(incidence, status, method); | 80 | return acceptPublish(incidence, status, method); |
79 | case Request: | 81 | case Request: |
80 | return acceptRequest(incidence, status); | 82 | return acceptRequest(incidence, status); |
81 | case Add: | 83 | case Add: |
82 | return acceptAdd(incidence, status); | 84 | return acceptAdd(incidence, status); |
83 | case Cancel: | 85 | case Cancel: |
84 | return acceptCancel(incidence, status); | 86 | return acceptCancel(incidence, status); |
85 | case Declinecounter: | 87 | case Declinecounter: |
86 | return acceptDeclineCounter(incidence, status); | 88 | return acceptDeclineCounter(incidence, status); |
87 | case Reply: | 89 | case Reply: |
88 | return acceptReply(incidence, status, method); | 90 | return acceptReply(incidence, status, method); |
89 | case Refresh: | 91 | case Refresh: |
90 | return acceptRefresh(incidence, status); | 92 | return acceptRefresh(incidence, status); |
91 | case Counter: | 93 | case Counter: |
92 | return acceptCounter(incidence, status); | 94 | return acceptCounter(incidence, status); |
93 | default: | 95 | default: |
94 | deleteTransaction(incidence); | 96 | deleteTransaction(incidence); |
95 | return false; | 97 | return false; |
96 | } | 98 | } |
97 | deleteTransaction(incidence); | 99 | deleteTransaction(incidence); |
98 | return false; | 100 | return false; |
99 | } | 101 | } |
100 | 102 | ||
101 | QString Scheduler::methodName(Method method) | 103 | QString Scheduler::methodName(Method method) |
102 | { | 104 | { |
103 | switch (method) { | 105 | switch (method) { |
104 | case Publish: | 106 | case Publish: |
105 | return QString::fromLatin1("Publish"); | 107 | return QString::fromLatin1("Publish"); |
106 | case Request: | 108 | case Request: |
107 | return QString::fromLatin1("Request"); | 109 | return QString::fromLatin1("Request"); |
108 | case Refresh: | 110 | case Refresh: |
109 | return QString::fromLatin1("Refresh"); | 111 | return QString::fromLatin1("Refresh"); |
110 | case Cancel: | 112 | case Cancel: |
111 | return QString::fromLatin1("Cancel"); | 113 | return QString::fromLatin1("Cancel"); |
112 | case Add: | 114 | case Add: |
113 | return QString::fromLatin1("Add"); | 115 | return QString::fromLatin1("Add"); |
114 | case Reply: | 116 | case Reply: |
115 | return QString::fromLatin1("Reply"); | 117 | return QString::fromLatin1("Reply"); |
116 | case Counter: | 118 | case Counter: |
117 | return QString::fromLatin1("Counter"); | 119 | return QString::fromLatin1("Counter"); |
118 | case Declinecounter: | 120 | case Declinecounter: |
119 | return QString::fromLatin1("Decline Counter"); | 121 | return QString::fromLatin1("Decline Counter"); |
120 | default: | 122 | default: |
121 | return QString::fromLatin1("Unknown"); | 123 | return QString::fromLatin1("Unknown"); |
122 | } | 124 | } |
123 | } | 125 | } |
124 | 126 | ||
125 | QString Scheduler::translatedMethodName(Method method) | 127 | QString Scheduler::translatedMethodName(Method method) |
126 | { | 128 | { |
127 | switch (method) { | 129 | switch (method) { |
128 | case Publish: | 130 | case Publish: |
129 | return i18n("Publish"); | 131 | return i18n("Publish"); |
130 | case Request: | 132 | case Request: |
131 | return i18n("Request"); | 133 | return i18n("Request"); |
132 | case Refresh: | 134 | case Refresh: |
133 | return i18n("Refresh"); | 135 | return i18n("Refresh"); |
134 | case Cancel: | 136 | case Cancel: |
135 | return i18n("Cancel"); | 137 | return i18n("Cancel"); |
136 | case Add: | 138 | case Add: |
137 | return i18n("Add"); | 139 | return i18n("Add"); |
138 | case Reply: | 140 | case Reply: |
139 | return i18n("Reply"); | 141 | return i18n("Reply"); |
140 | case Counter: | 142 | case Counter: |
141 | return i18n("counter proposal","Counter"); | 143 | return i18n("counter proposal","Counter"); |
142 | case Declinecounter: | 144 | case Declinecounter: |
143 | return i18n("decline counter proposal","Decline Counter"); | 145 | return i18n("decline counter proposal","Decline Counter"); |
144 | default: | 146 | default: |
145 | return i18n("Unknown"); | 147 | return i18n("Unknown"); |
146 | } | 148 | } |
147 | } | 149 | } |
148 | 150 | ||
149 | bool Scheduler::deleteTransaction(IncidenceBase *) | 151 | bool Scheduler::deleteTransaction(IncidenceBase *) |
150 | { | 152 | { |
151 | return true; | 153 | return true; |
152 | } | 154 | } |
153 | 155 | ||
154 | bool Scheduler::acceptPublish(IncidenceBase *incidence,ScheduleMessage::Status status, Method method) | 156 | bool Scheduler::acceptPublish(IncidenceBase *incidence,ScheduleMessage::Status status, Method method) |
155 | { | 157 | { |
156 | if(incidence->type()=="FreeBusy") { | 158 | if(incidence->type()=="FreeBusy") { |
157 | return acceptFreeBusy(incidence, method); | 159 | return acceptFreeBusy(incidence, method); |
158 | } | 160 | } |
159 | switch (status) { | 161 | switch (status) { |
160 | case ScheduleMessage::Unknown: | 162 | case ScheduleMessage::Unknown: |
161 | case ScheduleMessage::PublishNew: | 163 | case ScheduleMessage::PublishNew: |
162 | if (!mCalendar->event(incidence->uid())) { | 164 | if (!mCalendar->event(incidence->uid())) { |
163 | Incidence *inc = static_cast<Incidence *>(incidence); | 165 | Incidence *inc = static_cast<Incidence *>(incidence); |
164 | mCalendar->addIncidence(inc); | 166 | mCalendar->addIncidence(inc); |
165 | deleteTransaction(incidence); | 167 | deleteTransaction(incidence); |
166 | } | 168 | } |
167 | return true; | 169 | return true; |
168 | case ScheduleMessage::Obsolete: | 170 | case ScheduleMessage::Obsolete: |
169 | return true; | 171 | return true; |
170 | default: | 172 | default: |
171 | deleteTransaction(incidence); | 173 | deleteTransaction(incidence); |
172 | return false; | 174 | return false; |
173 | } | 175 | } |
174 | deleteTransaction(incidence); | 176 | deleteTransaction(incidence); |
175 | return false; | 177 | return false; |
176 | } | 178 | } |
177 | 179 | ||
178 | bool Scheduler::acceptRequest(IncidenceBase *incidence,ScheduleMessage::Status status) | 180 | bool Scheduler::acceptRequest(IncidenceBase *incidence,ScheduleMessage::Status status) |
179 | { | 181 | { |
180 | Incidence *inc = static_cast<Incidence *>(incidence); | 182 | Incidence *inc = static_cast<Incidence *>(incidence); |
181 | if (inc->type()=="FreeBusy") { | 183 | if (inc->type()=="FreeBusy") { |
182 | // reply to this request is handled in korganizer's incomingdialog | 184 | // reply to this request is handled in korganizer's incomingdialog |
183 | return true; | 185 | return true; |
184 | } else { | 186 | } else { |
185 | Event *even = mCalendar->event(incidence->uid()); | 187 | Event *even = mCalendar->event(incidence->uid()); |
186 | if (even) { | 188 | if (even) { |
187 | if ( even->revision()<=inc->revision() ) { | 189 | if ( even->revision()<=inc->revision() ) { |
188 | if ( even->revision()==inc->revision() && | 190 | if ( even->revision()==inc->revision() && |
189 | even->lastModified()>inc->lastModified()) { | 191 | even->lastModified()>inc->lastModified()) { |
190 | deleteTransaction(incidence); | 192 | deleteTransaction(incidence); |
191 | return false; | 193 | return false; |
192 | } | 194 | } |
193 | mCalendar->deleteEvent(even); | 195 | mCalendar->deleteEvent(even); |
194 | } else { | 196 | } else { |
195 | deleteTransaction(incidence); | 197 | deleteTransaction(incidence); |
196 | return false; | 198 | return false; |
197 | } | 199 | } |
198 | } else { | 200 | } else { |
199 | Todo *todo = mCalendar->todo(incidence->uid()); | 201 | Todo *todo = mCalendar->todo(incidence->uid()); |
200 | if (todo) { | 202 | if (todo) { |
201 | if ( todo->revision()<=inc->revision() ) { | 203 | if ( todo->revision()<=inc->revision() ) { |
202 | if ( todo->revision()==inc->revision() && | 204 | if ( todo->revision()==inc->revision() && |
203 | todo->lastModified()>inc->lastModified()) { | 205 | todo->lastModified()>inc->lastModified()) { |
204 | deleteTransaction(incidence); | 206 | deleteTransaction(incidence); |
205 | return false; | 207 | return false; |
206 | } | 208 | } |
207 | mCalendar->deleteTodo(todo); | 209 | mCalendar->deleteTodo(todo); |
208 | } else { | 210 | } else { |
209 | deleteTransaction(incidence); | 211 | deleteTransaction(incidence); |
210 | return false; | 212 | return false; |
211 | } | 213 | } |
212 | } | 214 | } |
213 | } | 215 | } |
214 | } | 216 | } |
215 | mCalendar->addIncidence(inc); | 217 | mCalendar->addIncidence(inc); |
216 | deleteTransaction(incidence); | 218 | deleteTransaction(incidence); |
217 | return true; | 219 | return true; |
218 | } | 220 | } |
219 | 221 | ||
220 | bool Scheduler::acceptAdd(IncidenceBase *incidence,ScheduleMessage::Status status) | 222 | bool Scheduler::acceptAdd(IncidenceBase *incidence,ScheduleMessage::Status status) |
221 | { | 223 | { |
222 | deleteTransaction(incidence); | 224 | deleteTransaction(incidence); |
223 | return false; | 225 | return false; |
224 | } | 226 | } |
225 | 227 | ||
226 | bool Scheduler::acceptCancel(IncidenceBase *incidence,ScheduleMessage::Status status) | 228 | bool Scheduler::acceptCancel(IncidenceBase *incidence,ScheduleMessage::Status status) |
227 | { | 229 | { |
228 | bool ret = false; | 230 | bool ret = false; |
229 | Event *even = mCalendar->event(incidence->uid()); | 231 | Event *even = mCalendar->event(incidence->uid()); |
230 | if (even) { | 232 | if (even) { |
231 | mCalendar->deleteEvent(even); | 233 | mCalendar->deleteEvent(even); |
232 | ret = true; | 234 | ret = true; |
233 | } else { | 235 | } else { |
234 | Todo *todo = mCalendar->todo(incidence->uid()); | 236 | Todo *todo = mCalendar->todo(incidence->uid()); |
235 | if (todo) { | 237 | if (todo) { |
236 | mCalendar->deleteTodo(todo); | 238 | mCalendar->deleteTodo(todo); |
237 | ret = true; | 239 | ret = true; |
238 | } | 240 | } |
239 | } | 241 | } |
240 | deleteTransaction(incidence); | 242 | deleteTransaction(incidence); |
241 | return ret; | 243 | return ret; |
242 | } | 244 | } |
243 | 245 | ||
244 | bool Scheduler::acceptDeclineCounter(IncidenceBase *incidence,ScheduleMessage::Status status) | 246 | bool Scheduler::acceptDeclineCounter(IncidenceBase *incidence,ScheduleMessage::Status status) |
245 | { | 247 | { |
246 | deleteTransaction(incidence); | 248 | deleteTransaction(incidence); |
247 | return false; | 249 | return false; |
248 | } | 250 | } |
249 | 251 | ||
250 | //bool Scheduler::acceptFreeBusy(Incidence *incidence,ScheduleMessage::Status status) | 252 | //bool Scheduler::acceptFreeBusy(Incidence *incidence,ScheduleMessage::Status status) |
251 | //{ | 253 | //{ |
252 | // deleteTransaction(incidence); | 254 | // deleteTransaction(incidence); |
253 | // return false; | 255 | // return false; |
254 | //} | 256 | //} |
255 | 257 | ||
256 | bool Scheduler::acceptReply(IncidenceBase *incidence,ScheduleMessage::Status status, Method method) | 258 | bool Scheduler::acceptReply(IncidenceBase *incidence,ScheduleMessage::Status status, Method method) |
257 | { | 259 | { |
258 | if(incidence->type()=="FreeBusy") { | 260 | if(incidence->type()=="FreeBusy") { |
259 | return acceptFreeBusy(incidence, method); | 261 | return acceptFreeBusy(incidence, method); |
260 | } | 262 | } |
261 | bool ret = false; | 263 | bool ret = false; |
262 | Event *ev = mCalendar->event(incidence->uid()); | 264 | Event *ev = mCalendar->event(incidence->uid()); |
263 | Todo *to = mCalendar->todo(incidence->uid()); | 265 | Todo *to = mCalendar->todo(incidence->uid()); |
264 | if (ev || to) { | 266 | if (ev || to) { |
265 | //get matching attendee in calendar | 267 | //get matching attendee in calendar |
266 | kdDebug(5800) << "Scheduler::acceptTransaction match found!" << endl; | 268 | kdDebug(5800) << "Scheduler::acceptTransaction match found!" << endl; |
267 | QPtrList<Attendee> attendeesIn = incidence->attendees(); | 269 | Q3PtrList<Attendee> attendeesIn = incidence->attendees(); |
268 | QPtrList<Attendee> attendeesEv; | 270 | Q3PtrList<Attendee> attendeesEv; |
269 | if (ev) attendeesEv = ev->attendees(); | 271 | if (ev) attendeesEv = ev->attendees(); |
270 | if (to) attendeesEv = to->attendees(); | 272 | if (to) attendeesEv = to->attendees(); |
271 | Attendee *attIn; | 273 | Attendee *attIn; |
272 | Attendee *attEv; | 274 | Attendee *attEv; |
273 | for ( attIn = attendeesIn.first(); attIn; attIn = attendeesIn.next() ) { | 275 | for ( attIn = attendeesIn.first(); attIn; attIn = attendeesIn.next() ) { |
274 | for ( attEv = attendeesEv.first(); attEv; attEv = attendeesEv.next() ) { | 276 | for ( attEv = attendeesEv.first(); attEv; attEv = attendeesEv.next() ) { |
275 | if (attIn->email()==attEv->email()) { | 277 | if (attIn->email()==attEv->email()) { |
276 | //update attendee-info | 278 | //update attendee-info |
277 | kdDebug(5800) << "Scheduler::acceptTransaction update attendee" << endl; | 279 | kdDebug(5800) << "Scheduler::acceptTransaction update attendee" << endl; |
278 | attEv->setStatus(attIn->status()); | 280 | attEv->setStatus(attIn->status()); |
279 | attEv->setRSVP(false); | 281 | attEv->setRSVP(false); |
280 | // better to not update the sequence number with replys | 282 | // better to not update the sequence number with replys |
281 | //if (ev) ev->setRevision(ev->revision()+1); | 283 | //if (ev) ev->setRevision(ev->revision()+1); |
282 | //if (to) to->setRevision(to->revision()+1); | 284 | //if (to) to->setRevision(to->revision()+1); |
283 | ret = true; | 285 | ret = true; |
284 | } | 286 | } |
285 | } | 287 | } |
286 | } | 288 | } |
287 | } | 289 | } |
288 | if (ret) deleteTransaction(incidence); | 290 | if (ret) deleteTransaction(incidence); |
289 | return ret; | 291 | return ret; |
290 | } | 292 | } |
291 | 293 | ||
292 | bool Scheduler::acceptRefresh(IncidenceBase *incidence,ScheduleMessage::Status status) | 294 | bool Scheduler::acceptRefresh(IncidenceBase *incidence,ScheduleMessage::Status status) |
293 | { | 295 | { |
294 | // handled in korganizer's IncomingDialog | 296 | // handled in korganizer's IncomingDialog |
295 | deleteTransaction(incidence); | 297 | deleteTransaction(incidence); |
296 | return false; | 298 | return false; |
297 | } | 299 | } |
298 | 300 | ||
299 | bool Scheduler::acceptCounter(IncidenceBase *incidence,ScheduleMessage::Status status) | 301 | bool Scheduler::acceptCounter(IncidenceBase *incidence,ScheduleMessage::Status status) |
300 | { | 302 | { |
301 | deleteTransaction(incidence); | 303 | deleteTransaction(incidence); |
302 | return false; | 304 | return false; |
303 | } | 305 | } |
304 | 306 | ||
305 | bool Scheduler::acceptFreeBusy(IncidenceBase *incidence, Method method) | 307 | bool Scheduler::acceptFreeBusy(IncidenceBase *incidence, Method method) |
306 | { | 308 | { |
307 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); | 309 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); |
308 | 310 | ||
309 | QString freeBusyDirName = locateLocal("appdata","freebusy"); | 311 | QString freeBusyDirName = locateLocal("appdata","freebusy"); |
310 | kdDebug() << "acceptFreeBusy:: freeBusyDirName: " << freeBusyDirName << endl; | 312 | kdDebug() << "acceptFreeBusy:: freeBusyDirName: " << freeBusyDirName << endl; |
311 | 313 | ||
312 | QString from; | 314 | QString from; |
313 | if(method == Scheduler::Publish) { | 315 | if(method == Scheduler::Publish) { |
314 | from = freebusy->organizer(); | 316 | from = freebusy->organizer(); |
315 | } | 317 | } |
316 | if((method == Scheduler::Reply) && (freebusy->attendeeCount() == 1)) { | 318 | if((method == Scheduler::Reply) && (freebusy->attendeeCount() == 1)) { |
317 | Attendee *attendee = freebusy->attendees().first(); | 319 | Attendee *attendee = freebusy->attendees().first(); |
318 | from = attendee->email(); | 320 | from = attendee->email(); |
319 | } | 321 | } |
320 | 322 | ||
321 | QDir freeBusyDir(freeBusyDirName); | 323 | QDir freeBusyDir(freeBusyDirName); |
322 | if (!freeBusyDir.exists()) { | 324 | if (!freeBusyDir.exists()) { |
323 | kdDebug() << "Directory " << freeBusyDirName << " does not exist!" << endl; | 325 | kdDebug() << "Directory " << freeBusyDirName << " does not exist!" << endl; |
324 | kdDebug() << "Creating directory: " << freeBusyDirName << endl; | 326 | kdDebug() << "Creating directory: " << freeBusyDirName << endl; |
325 | 327 | ||
326 | if(!freeBusyDir.mkdir(freeBusyDirName, TRUE)) { | 328 | if(!freeBusyDir.mkdir(freeBusyDirName, TRUE)) { |
327 | kdDebug() << "Could not create directory: " << freeBusyDirName << endl; | 329 | kdDebug() << "Could not create directory: " << freeBusyDirName << endl; |
328 | return false; | 330 | return false; |
329 | } | 331 | } |
330 | } | 332 | } |
331 | 333 | ||
332 | QString filename(freeBusyDirName); | 334 | QString filename(freeBusyDirName); |
333 | filename += "/"; | 335 | filename += "/"; |
334 | filename += from; | 336 | filename += from; |
335 | filename += ".ifb"; | 337 | filename += ".ifb"; |
336 | QFile f(filename); | 338 | QFile f(filename); |
337 | 339 | ||
338 | kdDebug() << "acceptFreeBusy: filename" << filename << endl; | 340 | kdDebug() << "acceptFreeBusy: filename" << filename << endl; |
339 | 341 | ||
340 | freebusy->clearAttendees(); | 342 | freebusy->clearAttendees(); |
341 | freebusy->setOrganizer(from); | 343 | freebusy->setOrganizer(from); |
342 | 344 | ||
343 | QString messageText = mFormat->createScheduleMessage(freebusy, Publish); | 345 | QString messageText = mFormat->createScheduleMessage(freebusy, Publish); |
344 | 346 | ||
345 | if (!f.open(IO_ReadWrite)) { | 347 | if (!f.open(QIODevice::ReadWrite)) { |
346 | kdDebug() << "acceptFreeBusy: Can't open:" << filename << " for writing" << endl; | 348 | kdDebug() << "acceptFreeBusy: Can't open:" << filename << " for writing" << endl; |
347 | return false; | 349 | return false; |
348 | } | 350 | } |
349 | QTextStream t(&f); | 351 | Q3TextStream t(&f); |
350 | t << messageText; | 352 | t << messageText; |
351 | f.close(); | 353 | f.close(); |
352 | 354 | ||
353 | deleteTransaction(incidence); | 355 | deleteTransaction(incidence); |
354 | return true; | 356 | return true; |
355 | } | 357 | } |