Diffstat (limited to 'korganizer/outgoingdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/outgoingdialog.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/korganizer/outgoingdialog.cpp b/korganizer/outgoingdialog.cpp index 7253c8e..ab31274 100644 --- a/korganizer/outgoingdialog.cpp +++ b/korganizer/outgoingdialog.cpp | |||
@@ -1,82 +1,82 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program 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 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <kdebug.h> | 20 | #include <kdebug.h> |
21 | 21 | ||
22 | #include <qfile.h> | 22 | #include <qfile.h> |
23 | #include <qdir.h> | 23 | #include <qdir.h> |
24 | #include <qtextstream.h> | 24 | #include <q3textstream.h> |
25 | 25 | ||
26 | #include <kglobal.h> | 26 | #include <kglobal.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <ktempfile.h> | 28 | #include <ktempfile.h> |
29 | #include <kstandarddirs.h> | 29 | #include <kstandarddirs.h> |
30 | 30 | ||
31 | #include <libkcal/event.h> | 31 | #include <libkcal/event.h> |
32 | #include <libkcal/freebusy.h> | 32 | #include <libkcal/freebusy.h> |
33 | //#include <libkcal/imipscheduler.h> | 33 | //#include <libkcal/imipscheduler.h> |
34 | #include <libkcal/dummyscheduler.h> | 34 | #include <libkcal/dummyscheduler.h> |
35 | #include <libkcal/icalformat.h> | 35 | #include <libkcal/icalformat.h> |
36 | #include <libkcal/calendar.h> | 36 | #include <libkcal/calendar.h> |
37 | 37 | ||
38 | #ifndef KORG_NOMAIL | 38 | #ifndef KORG_NOMAIL |
39 | #include "mailscheduler.h" | 39 | #include "mailscheduler.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #include "koprefs.h" | 42 | #include "koprefs.h" |
43 | #include "outgoingdialog.h" | 43 | #include "outgoingdialog.h" |
44 | #include "koeventviewerdialog.h" | 44 | #include "koeventviewerdialog.h" |
45 | #include "docprefs.h" | 45 | #include "docprefs.h" |
46 | 46 | ||
47 | ScheduleItemOut::ScheduleItemOut(QListView *parent,IncidenceBase *ev, | 47 | ScheduleItemOut::ScheduleItemOut(Q3ListView *parent,IncidenceBase *ev, |
48 | Scheduler::Method method, | 48 | Scheduler::Method method, |
49 | const QString &recipients) | 49 | const QString &recipients) |
50 | : QListViewItem(parent) | 50 | : Q3ListViewItem(parent) |
51 | { | 51 | { |
52 | mIncidence = ev; | 52 | mIncidence = ev; |
53 | mMethod = method; | 53 | mMethod = method; |
54 | mRecipients = recipients; | 54 | mRecipients = recipients; |
55 | 55 | ||
56 | // kdDebug() << "ScheduleItemOut: setting the summary" << endl; | 56 | // kdDebug() << "ScheduleItemOut: setting the summary" << endl; |
57 | //Set the summary | 57 | //Set the summary |
58 | if(ev->typeID() != freebusyID ) { | 58 | if(ev->typeID() != freebusyID ) { |
59 | Incidence *incidence = static_cast<Incidence *>(ev); | 59 | Incidence *incidence = static_cast<Incidence *>(ev); |
60 | setText(0,incidence->summary()); | 60 | setText(0,incidence->summary()); |
61 | } else { | 61 | } else { |
62 | setText(0,i18n("Free Busy Object")); | 62 | setText(0,i18n("Free Busy Object")); |
63 | } | 63 | } |
64 | 64 | ||
65 | // kdDebug() << "ScheduleItemOut: checking if the object is an event" << endl; | 65 | // kdDebug() << "ScheduleItemOut: checking if the object is an event" << endl; |
66 | //If the object is an event | 66 | //If the object is an event |
67 | if(ev->typeID()== eventID ) { | 67 | if(ev->typeID()== eventID ) { |
68 | Event *event = static_cast<Event *>(ev); | 68 | Event *event = static_cast<Event *>(ev); |
69 | 69 | ||
70 | setText(1,event->dtStartDateStr()); | 70 | setText(1,event->dtStartDateStr()); |
71 | if (event->doesFloat()) { //If the event floats set the start and end times to no time | 71 | if (event->doesFloat()) { //If the event floats set the start and end times to no time |
72 | setText(2,i18n("no time")); | 72 | setText(2,i18n("no time")); |
73 | setText(4,i18n("no time")); | 73 | setText(4,i18n("no time")); |
74 | } else { //If it does not float | 74 | } else { //If it does not float |
75 | setText(2,event->dtStartTimeStr()); | 75 | setText(2,event->dtStartTimeStr()); |
76 | if (event->hasDuration()) { | 76 | if (event->hasDuration()) { |
77 | setText(4,event->dtEndTimeStr()); | 77 | setText(4,event->dtEndTimeStr()); |
78 | } else { | 78 | } else { |
79 | setText(4,i18n("no time")); | 79 | setText(4,i18n("no time")); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | if (event->hasEndDate()) { | 82 | if (event->hasEndDate()) { |
@@ -94,86 +94,86 @@ ScheduleItemOut::ScheduleItemOut(QListView *parent,IncidenceBase *ev, | |||
94 | setText(1,event->dtStartDateStr()); | 94 | setText(1,event->dtStartDateStr()); |
95 | if (!event->doesFloat()) { | 95 | if (!event->doesFloat()) { |
96 | setText(2,event->dtStartTimeStr()); | 96 | setText(2,event->dtStartTimeStr()); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | if (event->hasDueDate()) { | 99 | if (event->hasDueDate()) { |
100 | setText(3,event->dtDueDateStr()); | 100 | setText(3,event->dtDueDateStr()); |
101 | if (!event->doesFloat()) { | 101 | if (!event->doesFloat()) { |
102 | setText(4,event->dtDueTimeStr()); | 102 | setText(4,event->dtDueTimeStr()); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | // kdDebug() << "ScheduleItemOut: checking if the object is a FreeBusy object" << endl; | 107 | // kdDebug() << "ScheduleItemOut: checking if the object is a FreeBusy object" << endl; |
108 | //If the object is a freebusy object | 108 | //If the object is a freebusy object |
109 | if(ev->typeID() == freebusyID ) { | 109 | if(ev->typeID() == freebusyID ) { |
110 | FreeBusy *freebusy = static_cast<FreeBusy *>(ev); | 110 | FreeBusy *freebusy = static_cast<FreeBusy *>(ev); |
111 | 111 | ||
112 | setText(1,freebusy->dtStartDateStr()); | 112 | setText(1,freebusy->dtStartDateStr()); |
113 | setText(2,freebusy->dtStartTimeStr()); | 113 | setText(2,freebusy->dtStartTimeStr()); |
114 | //Must try and get this to the users local settings | 114 | //Must try and get this to the users local settings |
115 | setText(3,KGlobal::locale()->formatDate( freebusy->dtEnd().date() ) ); | 115 | setText(3,KGlobal::locale()->formatDate( freebusy->dtEnd().date() ) ); |
116 | setText(4,KGlobal::locale()->formatTime( freebusy->dtEnd().time() ) ); | 116 | setText(4,KGlobal::locale()->formatTime( freebusy->dtEnd().time() ) ); |
117 | } | 117 | } |
118 | 118 | ||
119 | // kdDebug() << "ScheduleItemOut: Setting the method" << endl; | 119 | // kdDebug() << "ScheduleItemOut: Setting the method" << endl; |
120 | //Set the Method | 120 | //Set the Method |
121 | setText(5,Scheduler::translatedMethodName(mMethod)); | 121 | setText(5,Scheduler::translatedMethodName(mMethod)); |
122 | } | 122 | } |
123 | 123 | ||
124 | OutgoingDialog::OutgoingDialog(Calendar *calendar,QWidget* parent, | 124 | OutgoingDialog::OutgoingDialog(Calendar *calendar,QWidget* parent, |
125 | const char* name,bool modal, | 125 | const char* name,bool modal, |
126 | WFlags fl) | 126 | Qt::WFlags fl) |
127 | : OutgoingDialog_base(parent,name,modal,fl) | 127 | : OutgoingDialog_base(parent,name,modal,fl) |
128 | { | 128 | { |
129 | mCalendar = calendar; | 129 | mCalendar = calendar; |
130 | 130 | ||
131 | mFormat = new ICalFormat; | 131 | mFormat = new ICalFormat; |
132 | 132 | ||
133 | if (KOPrefs::instance()->mIMIPScheduler == KOPrefs::IMIPDummy ) { | 133 | if (KOPrefs::instance()->mIMIPScheduler == KOPrefs::IMIPDummy ) { |
134 | mScheduler = new DummyScheduler(mCalendar); | 134 | mScheduler = new DummyScheduler(mCalendar); |
135 | } else { | 135 | } else { |
136 | #ifndef KORG_NOMAIL | 136 | #ifndef KORG_NOMAIL |
137 | mScheduler = new MailScheduler(mCalendar); | 137 | mScheduler = new MailScheduler(mCalendar); |
138 | #else | 138 | #else |
139 | mScheduler = new DummyScheduler(mCalendar); | 139 | mScheduler = new DummyScheduler(mCalendar); |
140 | #endif | 140 | #endif |
141 | } | 141 | } |
142 | mMessageListView->setColumnAlignment(1,AlignHCenter); | 142 | mMessageListView->setColumnAlignment(1,Qt::AlignHCenter); |
143 | mMessageListView->setColumnAlignment(2,AlignHCenter); | 143 | mMessageListView->setColumnAlignment(2,Qt::AlignHCenter); |
144 | mMessageListView->setColumnAlignment(3,AlignHCenter); | 144 | mMessageListView->setColumnAlignment(3,Qt::AlignHCenter); |
145 | mMessageListView->setColumnAlignment(4,AlignHCenter); | 145 | mMessageListView->setColumnAlignment(4,Qt::AlignHCenter); |
146 | QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), | 146 | QObject::connect(mMessageListView,SIGNAL(doubleClicked(Q3ListViewItem *)), |
147 | this,SLOT(showEvent(QListViewItem *))); | 147 | this,SLOT(showEvent(Q3ListViewItem *))); |
148 | mDocPrefs = new DocPrefs("groupschedule"); | 148 | mDocPrefs = new DocPrefs("groupschedule"); |
149 | loadMessages(); | 149 | loadMessages(); |
150 | } | 150 | } |
151 | 151 | ||
152 | OutgoingDialog::~OutgoingDialog() | 152 | OutgoingDialog::~OutgoingDialog() |
153 | { | 153 | { |
154 | delete mDocPrefs; | 154 | delete mDocPrefs; |
155 | delete mFormat; | 155 | delete mFormat; |
156 | } | 156 | } |
157 | 157 | ||
158 | bool OutgoingDialog::addMessage(IncidenceBase *incidence,Scheduler::Method method) | 158 | bool OutgoingDialog::addMessage(IncidenceBase *incidence,Scheduler::Method method) |
159 | { | 159 | { |
160 | kdDebug() << "Outgoing::addMessage" << "Method:" << method << endl; | 160 | kdDebug() << "Outgoing::addMessage" << "Method:" << method << endl; |
161 | if (method == Scheduler::Publish) return false; | 161 | if (method == Scheduler::Publish) return false; |
162 | if( mDocPrefs ) { | 162 | if( mDocPrefs ) { |
163 | if (method != Scheduler::Cancel) { | 163 | if (method != Scheduler::Cancel) { |
164 | mDocPrefs->writeEntry( incidence->uid()+"-scheduled", true ); | 164 | mDocPrefs->writeEntry( incidence->uid()+"-scheduled", true ); |
165 | } else { | 165 | } else { |
166 | if (!mDocPrefs->readBoolEntry(incidence->uid()+"-scheduled") ) | 166 | if (!mDocPrefs->readBoolEntry(incidence->uid()+"-scheduled") ) |
167 | return true; | 167 | return true; |
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | if (KOPrefs::instance()->mIMIPSend == KOPrefs::IMIPOutbox) { | 171 | if (KOPrefs::instance()->mIMIPSend == KOPrefs::IMIPOutbox) { |
172 | new ScheduleItemOut(mMessageListView,incidence,method); | 172 | new ScheduleItemOut(mMessageListView,incidence,method); |
173 | saveMessage(incidence,method); | 173 | saveMessage(incidence,method); |
174 | emit numMessagesChanged(mMessageListView->childCount()); | 174 | emit numMessagesChanged(mMessageListView->childCount()); |
175 | } | 175 | } |
176 | else { | 176 | else { |
177 | mScheduler->performTransaction(incidence,method); | 177 | mScheduler->performTransaction(incidence,method); |
178 | } | 178 | } |
179 | return true; | 179 | return true; |
@@ -207,163 +207,163 @@ void OutgoingDialog::send() | |||
207 | kdDebug() << "OutgoingDialog::send" << endl; | 207 | kdDebug() << "OutgoingDialog::send" << endl; |
208 | ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->firstChild()); | 208 | ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->firstChild()); |
209 | while(item) { | 209 | while(item) { |
210 | bool success; | 210 | bool success; |
211 | if (item->method() == Scheduler::Publish) { | 211 | if (item->method() == Scheduler::Publish) { |
212 | success = mScheduler->publish(item->event(),item->recipients()); | 212 | success = mScheduler->publish(item->event(),item->recipients()); |
213 | } else { | 213 | } else { |
214 | success = mScheduler->performTransaction(item->event(),item->method()); | 214 | success = mScheduler->performTransaction(item->event(),item->method()); |
215 | } | 215 | } |
216 | ScheduleItemOut *oldItem = item; | 216 | ScheduleItemOut *oldItem = item; |
217 | item = (ScheduleItemOut *)(item->nextSibling()); | 217 | item = (ScheduleItemOut *)(item->nextSibling()); |
218 | if (success) { | 218 | if (success) { |
219 | deleteMessage(oldItem->event()); | 219 | deleteMessage(oldItem->event()); |
220 | delete (oldItem->event()); | 220 | delete (oldItem->event()); |
221 | delete oldItem; | 221 | delete oldItem; |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | emit numMessagesChanged(mMessageListView->childCount()); | 225 | emit numMessagesChanged(mMessageListView->childCount()); |
226 | } | 226 | } |
227 | 227 | ||
228 | void OutgoingDialog::deleteItem() | 228 | void OutgoingDialog::deleteItem() |
229 | { | 229 | { |
230 | ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->selectedItem()); | 230 | ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->selectedItem()); |
231 | if(!item) | 231 | if(!item) |
232 | return; | 232 | return; |
233 | deleteMessage(item->event()); | 233 | deleteMessage(item->event()); |
234 | delete(item->event()); | 234 | delete(item->event()); |
235 | mMessageListView->takeItem(item); | 235 | mMessageListView->takeItem(item); |
236 | emit numMessagesChanged(mMessageListView->childCount()); | 236 | emit numMessagesChanged(mMessageListView->childCount()); |
237 | } | 237 | } |
238 | 238 | ||
239 | void OutgoingDialog::showEvent(QListViewItem *qitem) | 239 | void OutgoingDialog::showEvent(Q3ListViewItem *qitem) |
240 | { | 240 | { |
241 | ScheduleItemOut *item = (ScheduleItemOut *)qitem; | 241 | ScheduleItemOut *item = (ScheduleItemOut *)qitem; |
242 | Event *event = 0; | 242 | Event *event = 0; |
243 | Todo *todo = 0; | 243 | Todo *todo = 0; |
244 | if ( item->event()->typeID() == eventID ) { | 244 | if ( item->event()->typeID() == eventID ) { |
245 | event = static_cast<Event *>(item->event()); | 245 | event = static_cast<Event *>(item->event()); |
246 | } | 246 | } |
247 | if ( item->event()->typeID() == todoID ) { | 247 | if ( item->event()->typeID() == todoID ) { |
248 | todo = static_cast<Todo *>(item->event()); | 248 | todo = static_cast<Todo *>(item->event()); |
249 | } | 249 | } |
250 | QString sendText; | 250 | QString sendText; |
251 | if (event || todo) { | 251 | if (event || todo) { |
252 | KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); | 252 | KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); |
253 | if (event) eventViewer->setEvent(event); | 253 | if (event) eventViewer->setEvent(event); |
254 | if (todo) eventViewer->setTodo(todo); | 254 | if (todo) eventViewer->setTodo(todo); |
255 | sendText = "<hr><h4>"+i18n("Event will be sent to:")+"</h4>"; | 255 | sendText = "<hr><h4>"+i18n("Event will be sent to:")+"</h4>"; |
256 | switch (item->method()) { | 256 | switch (item->method()) { |
257 | case Scheduler::Publish: { | 257 | case Scheduler::Publish: { |
258 | sendText += item->recipients(); | 258 | sendText += item->recipients(); |
259 | break; } | 259 | break; } |
260 | case Scheduler::Request: { | 260 | case Scheduler::Request: { |
261 | sendText += i18n("All attendees"); | 261 | sendText += i18n("All attendees"); |
262 | break; } | 262 | break; } |
263 | case Scheduler::Refresh: { | 263 | case Scheduler::Refresh: { |
264 | sendText += i18n("All attendees"); | 264 | sendText += i18n("All attendees"); |
265 | break; } | 265 | break; } |
266 | case Scheduler::Cancel: { | 266 | case Scheduler::Cancel: { |
267 | sendText += i18n("All attendees"); | 267 | sendText += i18n("All attendees"); |
268 | break; } | 268 | break; } |
269 | case Scheduler::Add: { | 269 | case Scheduler::Add: { |
270 | sendText += i18n("All attendees"); | 270 | sendText += i18n("All attendees"); |
271 | break; } | 271 | break; } |
272 | case Scheduler::Reply: { | 272 | case Scheduler::Reply: { |
273 | sendText += i18n("The organizer %1").arg(item->event()->organizer()); | 273 | sendText += i18n("The organizer %1").arg(item->event()->organizer()); |
274 | break; } | 274 | break; } |
275 | case Scheduler::Counter: { | 275 | case Scheduler::Counter: { |
276 | sendText += i18n("The organizer %1").arg(item->event()->organizer()); | 276 | sendText += i18n("The organizer %1").arg(item->event()->organizer()); |
277 | break; } | 277 | break; } |
278 | case Scheduler::Declinecounter: { | 278 | case Scheduler::Declinecounter: { |
279 | sendText += i18n("All attendees"); | 279 | sendText += i18n("All attendees"); |
280 | break; } | 280 | break; } |
281 | case Scheduler::NoMethod: { | 281 | case Scheduler::NoMethod: { |
282 | sendText += ""; | 282 | sendText += ""; |
283 | break; } | 283 | break; } |
284 | default: | 284 | default: |
285 | sendText = ""; | 285 | sendText = ""; |
286 | } | 286 | } |
287 | eventViewer->addText(sendText); | 287 | eventViewer->addText(sendText); |
288 | eventViewer->show(); | 288 | eventViewer->show(); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
292 | bool OutgoingDialog::saveMessage(IncidenceBase *incidence,Scheduler::Method method, | 292 | bool OutgoingDialog::saveMessage(IncidenceBase *incidence,Scheduler::Method method, |
293 | const QString &recipients) | 293 | const QString &recipients) |
294 | { | 294 | { |
295 | KTempFile ktfile(locateLocal("data","korganizer/outgoing/"),"ics"); | 295 | KTempFile ktfile(locateLocal("data","korganizer/outgoing/"),"ics"); |
296 | QString messageText = mFormat->createScheduleMessage(incidence,method); | 296 | QString messageText = mFormat->createScheduleMessage(incidence,method); |
297 | QTextStream *qts = ktfile.textStream(); | 297 | Q3TextStream *qts = ktfile.textStream(); |
298 | *qts << messageText; | 298 | *qts << messageText; |
299 | *qts << "METHOD-BEGIN:" << endl << method << endl << ":METHOD-END" << endl; | 299 | *qts << "METHOD-BEGIN:" << endl << method << endl << ":METHOD-END" << endl; |
300 | *qts << "RECIPIENTS-BEGIN:" << endl << recipients << endl << ":RECIPIENTS-END" << endl; | 300 | *qts << "RECIPIENTS-BEGIN:" << endl << recipients << endl << ":RECIPIENTS-END" << endl; |
301 | mMessageMap[incidence]=ktfile.name(); | 301 | mMessageMap[incidence]=ktfile.name(); |
302 | 302 | ||
303 | return true; | 303 | return true; |
304 | } | 304 | } |
305 | 305 | ||
306 | bool OutgoingDialog::deleteMessage(IncidenceBase *incidence) | 306 | bool OutgoingDialog::deleteMessage(IncidenceBase *incidence) |
307 | { | 307 | { |
308 | QFile f( mMessageMap[incidence] ); | 308 | QFile f( mMessageMap[incidence] ); |
309 | mMessageMap.remove(incidence); | 309 | mMessageMap.remove(incidence); |
310 | if ( !f.exists() ) return false; | 310 | if ( !f.exists() ) return false; |
311 | else | 311 | else |
312 | return f.remove(); | 312 | return f.remove(); |
313 | } | 313 | } |
314 | 314 | ||
315 | void OutgoingDialog::loadMessages() | 315 | void OutgoingDialog::loadMessages() |
316 | { | 316 | { |
317 | Scheduler::Method method; | 317 | Scheduler::Method method; |
318 | QString recipients; | 318 | QString recipients; |
319 | 319 | ||
320 | QString outgoingDirName = locateLocal("data","korganizer/outgoing"); | 320 | QString outgoingDirName = locateLocal("data","korganizer/outgoing"); |
321 | QDir outgoingDir(outgoingDirName); | 321 | QDir outgoingDir(outgoingDirName); |
322 | QStringList outgoing = outgoingDir.entryList(QDir::Files); | 322 | QStringList outgoing = outgoingDir.entryList(QDir::Files); |
323 | QStringList::ConstIterator it; | 323 | QStringList::ConstIterator it; |
324 | for(it = outgoing.begin(); it != outgoing.end(); ++it) { | 324 | for(it = outgoing.begin(); it != outgoing.end(); ++it) { |
325 | kdDebug() << "-- File: " << (*it) << endl; | 325 | kdDebug() << "-- File: " << (*it) << endl; |
326 | QFile f(outgoingDirName + "/" + (*it)); | 326 | QFile f(outgoingDirName + "/" + (*it)); |
327 | bool inserted = false; | 327 | bool inserted = false; |
328 | QMap<IncidenceBase*, QString>::Iterator iter; | 328 | QMap<IncidenceBase*, QString>::Iterator iter; |
329 | for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) { | 329 | for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) { |
330 | if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true; | 330 | if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true; |
331 | } | 331 | } |
332 | if (!inserted) { | 332 | if (!inserted) { |
333 | if (!f.open(IO_ReadOnly)) { | 333 | if (!f.open(QIODevice::ReadOnly)) { |
334 | kdDebug() << "OutgoingDialog::loadMessage(): Can't open file'" | 334 | kdDebug() << "OutgoingDialog::loadMessage(): Can't open file'" |
335 | << (*it) << "'" << endl; | 335 | << (*it) << "'" << endl; |
336 | } else { | 336 | } else { |
337 | QTextStream t(&f); | 337 | Q3TextStream t(&f); |
338 | QString messageString = t.read(); | 338 | QString messageString = t.read(); |
339 | ScheduleMessage *message = mFormat->parseScheduleMessage(mCalendar, | 339 | ScheduleMessage *message = mFormat->parseScheduleMessage(mCalendar, |
340 | messageString); | 340 | messageString); |
341 | int begin_pos = messageString.find("METHOD-BEGIN:"); | 341 | int begin_pos = messageString.find("METHOD-BEGIN:"); |
342 | begin_pos = messageString.find('\n',begin_pos)+1; | 342 | begin_pos = messageString.find('\n',begin_pos)+1; |
343 | QString meth = messageString.mid(begin_pos,1); | 343 | QString meth = messageString.mid(begin_pos,1); |
344 | switch (meth.toInt()) { | 344 | switch (meth.toInt()) { |
345 | case 0:method=Scheduler::Publish; break; | 345 | case 0:method=Scheduler::Publish; break; |
346 | case 1:method=Scheduler::Request; break; | 346 | case 1:method=Scheduler::Request; break; |
347 | case 2:method=Scheduler::Refresh; break; | 347 | case 2:method=Scheduler::Refresh; break; |
348 | case 3:method=Scheduler::Cancel; break; | 348 | case 3:method=Scheduler::Cancel; break; |
349 | case 4:method=Scheduler::Add; break; | 349 | case 4:method=Scheduler::Add; break; |
350 | case 5:method=Scheduler::Reply; break; | 350 | case 5:method=Scheduler::Reply; break; |
351 | case 6:method=Scheduler::Counter; break; | 351 | case 6:method=Scheduler::Counter; break; |
352 | case 7:method=Scheduler::Declinecounter; break; | 352 | case 7:method=Scheduler::Declinecounter; break; |
353 | default :method=Scheduler::NoMethod; break; | 353 | default :method=Scheduler::NoMethod; break; |
354 | } | 354 | } |
355 | begin_pos = messageString.find("RECIPIENTS-BEGIN:"); | 355 | begin_pos = messageString.find("RECIPIENTS-BEGIN:"); |
356 | begin_pos = messageString.find('\n',begin_pos)+1; | 356 | begin_pos = messageString.find('\n',begin_pos)+1; |
357 | int end_pos = messageString.find(":RECIPIENTS-END",begin_pos)-1; | 357 | int end_pos = messageString.find(":RECIPIENTS-END",begin_pos)-1; |
358 | recipients = messageString.mid(begin_pos, end_pos-begin_pos); | 358 | recipients = messageString.mid(begin_pos, end_pos-begin_pos); |
359 | kdDebug() << "Outgoing::loadMessage(): Recipients: " << recipients << endl; | 359 | kdDebug() << "Outgoing::loadMessage(): Recipients: " << recipients << endl; |
360 | 360 | ||
361 | if (message) { | 361 | if (message) { |
362 | bool inserted = false; | 362 | bool inserted = false; |
363 | QMap<IncidenceBase*, QString>::Iterator iter; | 363 | QMap<IncidenceBase*, QString>::Iterator iter; |
364 | for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) { | 364 | for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) { |
365 | if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true; | 365 | if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true; |
366 | } | 366 | } |
367 | if (!inserted) { | 367 | if (!inserted) { |
368 | kdDebug() << "OutgoingDialog::loadMessage(): got message '" | 368 | kdDebug() << "OutgoingDialog::loadMessage(): got message '" |
369 | << (*it) << "'" << endl; | 369 | << (*it) << "'" << endl; |