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 | |||
@@ -12,51 +12,51 @@ | |||
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")); |
@@ -114,46 +114,46 @@ ScheduleItemOut::ScheduleItemOut(QListView *parent,IncidenceBase *ev, | |||
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 | { |
@@ -227,25 +227,25 @@ void OutgoingDialog::send() | |||
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) { |
@@ -285,25 +285,25 @@ void OutgoingDialog::showEvent(QListViewItem *qitem) | |||
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); |
@@ -321,29 +321,29 @@ void OutgoingDialog::loadMessages() | |||
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; |