author | zautrix <zautrix> | 2005-02-13 11:55:52 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-13 11:55:52 (UTC) |
commit | 0a33f91e166747406ca2ccb5819881feeecfdb40 (patch) (unidiff) | |
tree | e9130a16aaa6365e106d6733c3e1adeca01f72ac | |
parent | 00ec9899a4727a4c9100d320935dde7da4803801 (diff) | |
download | kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.zip kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.tar.gz kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.tar.bz2 |
todo recurchanges
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.h | 1 | ||||
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 20 | ||||
-rw-r--r-- | korganizer/koeditorrecurrence.h | 4 | ||||
-rw-r--r-- | korganizer/kotodoeditor.cpp | 47 | ||||
-rw-r--r-- | korganizer/kotodoeditor.h | 4 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 10 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 35 | ||||
-rw-r--r-- | libkcal/incidence.h | 9 | ||||
-rw-r--r-- | microkde/kdialogbase.h | 2 |
10 files changed, 121 insertions, 13 deletions
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index 6370b54..a9d1ed3 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp | |||
@@ -244,254 +244,256 @@ void KOEditorGeneralTodo::readTodo(Todo *todo) | |||
244 | 244 | ||
245 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 245 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
246 | mLocationEdit->load(KOLocationBox::LOCATION); | 246 | mLocationEdit->load(KOLocationBox::LOCATION); |
247 | KOEditorGeneral::readIncidence(todo); | 247 | KOEditorGeneral::readIncidence(todo); |
248 | 248 | ||
249 | QDateTime dueDT; | 249 | QDateTime dueDT; |
250 | 250 | ||
251 | if (todo->hasDueDate()) { | 251 | if (todo->hasDueDate()) { |
252 | enableAlarmEdit(true); | 252 | enableAlarmEdit(true); |
253 | dueDT = todo->dtDue(); | 253 | dueDT = todo->dtDue(); |
254 | mDueDateEdit->setDate(todo->dtDue().date()); | 254 | mDueDateEdit->setDate(todo->dtDue().date()); |
255 | mDueTimeEdit->setTime(todo->dtDue().time()); | 255 | mDueTimeEdit->setTime(todo->dtDue().time()); |
256 | mDueCheck->setChecked(true); | 256 | mDueCheck->setChecked(true); |
257 | } else { | 257 | } else { |
258 | alarmDisable(true); | 258 | alarmDisable(true); |
259 | mDueDateEdit->setEnabled(false); | 259 | mDueDateEdit->setEnabled(false); |
260 | mDueTimeEdit->setEnabled(false); | 260 | mDueTimeEdit->setEnabled(false); |
261 | mDueDateEdit->setDate(QDate::currentDate()); | 261 | mDueDateEdit->setDate(QDate::currentDate()); |
262 | mDueTimeEdit->setTime(QTime::currentTime()); | 262 | mDueTimeEdit->setTime(QTime::currentTime()); |
263 | mDueCheck->setChecked(false); | 263 | mDueCheck->setChecked(false); |
264 | } | 264 | } |
265 | 265 | ||
266 | if (todo->hasStartDate()) { | 266 | if (todo->hasStartDate()) { |
267 | mStartDateEdit->setDate(todo->dtStart().date()); | 267 | mStartDateEdit->setDate(todo->dtStart().date()); |
268 | mStartTimeEdit->setTime(todo->dtStart().time()); | 268 | mStartTimeEdit->setTime(todo->dtStart().time()); |
269 | mStartCheck->setChecked(true); | 269 | mStartCheck->setChecked(true); |
270 | } else { | 270 | } else { |
271 | mStartDateEdit->setEnabled(false); | 271 | mStartDateEdit->setEnabled(false); |
272 | mStartTimeEdit->setEnabled(false); | 272 | mStartTimeEdit->setEnabled(false); |
273 | mStartDateEdit->setDate(QDate::currentDate()); | 273 | mStartDateEdit->setDate(QDate::currentDate()); |
274 | mStartTimeEdit->setTime(QTime::currentTime()); | 274 | mStartTimeEdit->setTime(QTime::currentTime()); |
275 | mStartCheck->setChecked(false); | 275 | mStartCheck->setChecked(false); |
276 | } | 276 | } |
277 | 277 | ||
278 | mTimeButton->setChecked( !todo->doesFloat() ); | 278 | mTimeButton->setChecked( !todo->doesFloat() ); |
279 | 279 | ||
280 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); | 280 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); |
281 | if (todo->isCompleted() && todo->hasCompletedDate()) { | 281 | if (todo->isCompleted() && todo->hasCompletedDate()) { |
282 | mCompleted = todo->completed(); | 282 | mCompleted = todo->completed(); |
283 | } | 283 | } |
284 | setCompletedDate(); | 284 | setCompletedDate(); |
285 | 285 | ||
286 | mPriorityCombo->setCurrentItem(todo->priority()-1); | 286 | mPriorityCombo->setCurrentItem(todo->priority()-1); |
287 | } | 287 | } |
288 | 288 | ||
289 | void KOEditorGeneralTodo::writeTodo(Todo *todo) | 289 | void KOEditorGeneralTodo::writeTodo(Todo *todo) |
290 | { | 290 | { |
291 | KOEditorGeneral::writeIncidence(todo); | 291 | KOEditorGeneral::writeIncidence(todo); |
292 | 292 | ||
293 | // temp. until something better happens. | 293 | // temp. until something better happens. |
294 | QString tmpStr; | 294 | QString tmpStr; |
295 | 295 | ||
296 | todo->setHasDueDate(mDueCheck->isChecked()); | 296 | todo->setHasDueDate(mDueCheck->isChecked()); |
297 | todo->setHasStartDate(mStartCheck->isChecked()); | 297 | todo->setHasStartDate(mStartCheck->isChecked()); |
298 | 298 | ||
299 | QDate tmpDate; | 299 | QDate tmpDate; |
300 | QTime tmpTime; | 300 | QTime tmpTime; |
301 | QDateTime tmpDT; | 301 | QDateTime tmpDT; |
302 | if ( mTimeButton->isChecked() ) { | 302 | if ( mTimeButton->isChecked() ) { |
303 | todo->setFloats(false); | 303 | todo->setFloats(false); |
304 | 304 | ||
305 | // set due date/time | 305 | // set due date/time |
306 | tmpDate = mDueDateEdit->date(); | 306 | tmpDate = mDueDateEdit->date(); |
307 | tmpTime = mDueTimeEdit->getTime(); | 307 | tmpTime = mDueTimeEdit->getTime(); |
308 | tmpDT.setDate(tmpDate); | 308 | tmpDT.setDate(tmpDate); |
309 | tmpDT.setTime(tmpTime); | 309 | tmpDT.setTime(tmpTime); |
310 | todo->setDtDue(tmpDT); | 310 | todo->setDtDue(tmpDT); |
311 | 311 | ||
312 | // set start date/time | 312 | // set start date/time |
313 | tmpDate = mStartDateEdit->date(); | 313 | tmpDate = mStartDateEdit->date(); |
314 | tmpTime = mStartTimeEdit->getTime(); | 314 | tmpTime = mStartTimeEdit->getTime(); |
315 | tmpDT.setDate(tmpDate); | 315 | tmpDT.setDate(tmpDate); |
316 | tmpDT.setTime(tmpTime); | 316 | tmpDT.setTime(tmpTime); |
317 | todo->setDtStart(tmpDT); | 317 | todo->setDtStart(tmpDT); |
318 | } else { | 318 | } else { |
319 | todo->setFloats(true); | 319 | todo->setFloats(true); |
320 | 320 | ||
321 | // need to change this. | 321 | // need to change this. |
322 | tmpDate = mDueDateEdit->date(); | 322 | tmpDate = mDueDateEdit->date(); |
323 | tmpTime.setHMS(0,0,0); | 323 | tmpTime.setHMS(0,0,0); |
324 | tmpDT.setDate(tmpDate); | 324 | tmpDT.setDate(tmpDate); |
325 | tmpDT.setTime(tmpTime); | 325 | tmpDT.setTime(tmpTime); |
326 | todo->setDtDue(tmpDT); | 326 | todo->setDtDue(tmpDT); |
327 | 327 | ||
328 | tmpDate = mStartDateEdit->date(); | 328 | tmpDate = mStartDateEdit->date(); |
329 | tmpTime.setHMS(0,0,0); | 329 | tmpTime.setHMS(0,0,0); |
330 | tmpDT.setDate(tmpDate); | 330 | tmpDT.setDate(tmpDate); |
331 | tmpDT.setTime(tmpTime); | 331 | tmpDT.setTime(tmpTime); |
332 | todo->setDtStart(tmpDT); | 332 | todo->setDtStart(tmpDT); |
333 | } | 333 | } |
334 | todo->setPriority(mPriorityCombo->currentItem()+1); | 334 | todo->setPriority(mPriorityCombo->currentItem()+1); |
335 | 335 | ||
336 | // set completion state | 336 | // set completion state |
337 | if ( mCompletedCombo->currentItem() == 5 ) { | 337 | if ( mCompletedCombo->currentItem() == 5 ) { |
338 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); | 338 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); |
339 | if ( comp.isValid () ) { | 339 | if ( comp.isValid () ) { |
340 | todo->setPercentComplete(0); | 340 | todo->setPercentComplete(0); |
341 | todo->setPercentComplete(100); | 341 | todo->setPercentComplete(100); |
342 | todo->setCompleted(comp); | 342 | todo->setCompleted(comp); |
343 | } else { | 343 | } else { |
344 | todo->setPercentComplete( 100 ); | 344 | todo->setPercentComplete( 100 ); |
345 | if ( mCompleted.isValid() ) | 345 | if ( mCompleted.isValid() ) |
346 | todo->setCompleted(mCompleted); | 346 | todo->setCompleted(mCompleted); |
347 | } | 347 | } |
348 | } else { | 348 | } else { |
349 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); | 349 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); |
350 | } | 350 | } |
351 | 351 | ||
352 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); | 352 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); |
353 | } | 353 | } |
354 | 354 | ||
355 | void KOEditorGeneralTodo::enableDueEdit(bool enable) | 355 | void KOEditorGeneralTodo::enableDueEdit(bool enable) |
356 | { | 356 | { |
357 | mDueDateEdit->setEnabled( enable ); | 357 | mDueDateEdit->setEnabled( enable ); |
358 | 358 | ||
359 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 359 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
360 | mTimeButton->setEnabled(true); | 360 | mTimeButton->setEnabled(true); |
361 | } | 361 | } |
362 | else { | 362 | else { |
363 | mTimeButton->setEnabled(false); | 363 | mTimeButton->setEnabled(false); |
364 | mTimeButton->setChecked(false); | 364 | mTimeButton->setChecked(false); |
365 | } | 365 | } |
366 | 366 | ||
367 | if (enable) { | 367 | if (enable) { |
368 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); | 368 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); |
369 | } else { | 369 | } else { |
370 | mDueTimeEdit->setEnabled( false ); | 370 | mDueTimeEdit->setEnabled( false ); |
371 | } | 371 | } |
372 | emit datesChecked(); | ||
372 | } | 373 | } |
373 | 374 | ||
374 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) | 375 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) |
375 | { | 376 | { |
376 | mStartDateEdit->setEnabled( enable ); | 377 | mStartDateEdit->setEnabled( enable ); |
377 | 378 | ||
378 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 379 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
379 | mTimeButton->setEnabled(true); | 380 | mTimeButton->setEnabled(true); |
380 | } | 381 | } |
381 | else { | 382 | else { |
382 | mTimeButton->setEnabled(false); | 383 | mTimeButton->setEnabled(false); |
383 | mTimeButton->setChecked(false); | 384 | mTimeButton->setChecked(false); |
384 | } | 385 | } |
385 | 386 | ||
386 | if (enable) { | 387 | if (enable) { |
387 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); | 388 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); |
388 | } else { | 389 | } else { |
389 | mStartTimeEdit->setEnabled( false ); | 390 | mStartTimeEdit->setEnabled( false ); |
390 | } | 391 | } |
392 | emit datesChecked(); | ||
391 | } | 393 | } |
392 | 394 | ||
393 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) | 395 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) |
394 | { | 396 | { |
395 | if(mStartCheck->isChecked()) { | 397 | if(mStartCheck->isChecked()) { |
396 | mStartTimeEdit->setEnabled( enable ); | 398 | mStartTimeEdit->setEnabled( enable ); |
397 | } | 399 | } |
398 | if(mDueCheck->isChecked()) { | 400 | if(mDueCheck->isChecked()) { |
399 | mDueTimeEdit->setEnabled( enable ); | 401 | mDueTimeEdit->setEnabled( enable ); |
400 | } | 402 | } |
401 | } | 403 | } |
402 | 404 | ||
403 | void KOEditorGeneralTodo::showAlarm() | 405 | void KOEditorGeneralTodo::showAlarm() |
404 | { | 406 | { |
405 | if ( mDueCheck->isChecked() ) { | 407 | if ( mDueCheck->isChecked() ) { |
406 | alarmDisable(false); | 408 | alarmDisable(false); |
407 | } | 409 | } |
408 | else { | 410 | else { |
409 | alarmDisable(true); | 411 | alarmDisable(true); |
410 | } | 412 | } |
411 | } | 413 | } |
412 | 414 | ||
413 | bool KOEditorGeneralTodo::validateInput() | 415 | bool KOEditorGeneralTodo::validateInput() |
414 | { | 416 | { |
415 | if (mDueCheck->isChecked()) { | 417 | if (mDueCheck->isChecked()) { |
416 | if (!mDueDateEdit->inputIsValid()) { | 418 | if (!mDueDateEdit->inputIsValid()) { |
417 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); | 419 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); |
418 | return false; | 420 | return false; |
419 | } | 421 | } |
420 | } | 422 | } |
421 | 423 | ||
422 | if (mStartCheck->isChecked()) { | 424 | if (mStartCheck->isChecked()) { |
423 | if (!mStartDateEdit->inputIsValid()) { | 425 | if (!mStartDateEdit->inputIsValid()) { |
424 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); | 426 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); |
425 | return false; | 427 | return false; |
426 | } | 428 | } |
427 | } | 429 | } |
428 | 430 | ||
429 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { | 431 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { |
430 | QDateTime startDate; | 432 | QDateTime startDate; |
431 | QDateTime dueDate; | 433 | QDateTime dueDate; |
432 | startDate.setDate(mStartDateEdit->date()); | 434 | startDate.setDate(mStartDateEdit->date()); |
433 | dueDate.setDate(mDueDateEdit->date()); | 435 | dueDate.setDate(mDueDateEdit->date()); |
434 | if (mTimeButton->isChecked()) { | 436 | if (mTimeButton->isChecked()) { |
435 | startDate.setTime(mStartTimeEdit->getTime()); | 437 | startDate.setTime(mStartTimeEdit->getTime()); |
436 | dueDate.setTime(mDueTimeEdit->getTime()); | 438 | dueDate.setTime(mDueTimeEdit->getTime()); |
437 | } | 439 | } |
438 | if (startDate > dueDate) { | 440 | if (startDate > dueDate) { |
439 | KMessageBox::sorry(0, | 441 | KMessageBox::sorry(0, |
440 | i18n("The start date cannot be after the due date.")); | 442 | i18n("The start date cannot be after the due date.")); |
441 | return false; | 443 | return false; |
442 | } | 444 | } |
443 | } | 445 | } |
444 | 446 | ||
445 | return KOEditorGeneral::validateInput(); | 447 | return KOEditorGeneral::validateInput(); |
446 | } | 448 | } |
447 | 449 | ||
448 | void KOEditorGeneralTodo::completedChanged(int index) | 450 | void KOEditorGeneralTodo::completedChanged(int index) |
449 | { | 451 | { |
450 | if (index == 5) { | 452 | if (index == 5) { |
451 | //get rid of milli sec | 453 | //get rid of milli sec |
452 | mCompleted = QDateTime::currentDateTime(); | 454 | mCompleted = QDateTime::currentDateTime(); |
453 | } | 455 | } |
454 | setCompletedDate(); | 456 | setCompletedDate(); |
455 | } | 457 | } |
456 | 458 | ||
457 | void KOEditorGeneralTodo::setCompletedDate() | 459 | void KOEditorGeneralTodo::setCompletedDate() |
458 | { | 460 | { |
459 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { | 461 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { |
460 | if ( QApplication::desktop()->width() < 480 ) { | 462 | if ( QApplication::desktop()->width() < 480 ) { |
461 | mCompletedLabel->setText(i18n(" on")); | 463 | mCompletedLabel->setText(i18n(" on")); |
462 | } | 464 | } |
463 | else | 465 | else |
464 | mCompletedLabel->setText(i18n(" completed on ")); | 466 | mCompletedLabel->setText(i18n(" completed on ")); |
465 | mCompleteDateEdit->show(); | 467 | mCompleteDateEdit->show(); |
466 | mCompleteTimeEdit->show(); | 468 | mCompleteTimeEdit->show(); |
467 | mCompleteTimeEdit->setTime( mCompleted.time() ); | 469 | mCompleteTimeEdit->setTime( mCompleted.time() ); |
468 | mCompleteDateEdit->setDate( mCompleted.date() ); | 470 | mCompleteDateEdit->setDate( mCompleted.date() ); |
469 | } else { | 471 | } else { |
470 | mCompletedLabel->setText(i18n(" completed")); | 472 | mCompletedLabel->setText(i18n(" completed")); |
471 | mCompleteDateEdit->hide(); | 473 | mCompleteDateEdit->hide(); |
472 | mCompleteTimeEdit->hide(); | 474 | mCompleteTimeEdit->hide(); |
473 | } | 475 | } |
474 | } | 476 | } |
475 | 477 | ||
476 | void KOEditorGeneralTodo::modified (Todo* todo, int modification) | 478 | void KOEditorGeneralTodo::modified (Todo* todo, int modification) |
477 | { | 479 | { |
478 | switch (modification) { | 480 | switch (modification) { |
479 | case KOGlobals::PRIORITY_MODIFIED: | 481 | case KOGlobals::PRIORITY_MODIFIED: |
480 | mPriorityCombo->setCurrentItem(todo->priority()-1); | 482 | mPriorityCombo->setCurrentItem(todo->priority()-1); |
481 | break; | 483 | break; |
482 | case KOGlobals::COMPLETION_MODIFIED: | 484 | case KOGlobals::COMPLETION_MODIFIED: |
483 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); | 485 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); |
484 | if (todo->isCompleted() && todo->hasCompletedDate()) { | 486 | if (todo->isCompleted() && todo->hasCompletedDate()) { |
485 | mCompleted = todo->completed(); | 487 | mCompleted = todo->completed(); |
486 | } | 488 | } |
487 | setCompletedDate(); | 489 | setCompletedDate(); |
488 | break; | 490 | break; |
489 | case KOGlobals::CATEGORY_MODIFIED: | 491 | case KOGlobals::CATEGORY_MODIFIED: |
490 | setCategories (todo->categoriesStr ()); | 492 | setCategories (todo->categoriesStr ()); |
491 | break; | 493 | break; |
492 | case KOGlobals::UNKNOWN_MODIFIED: // fall through | 494 | case KOGlobals::UNKNOWN_MODIFIED: // fall through |
493 | default: | 495 | default: |
494 | readTodo( todo ); | 496 | readTodo( todo ); |
495 | break; | 497 | break; |
496 | } | 498 | } |
497 | } | 499 | } |
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h index 98f43dd..b198539 100644 --- a/korganizer/koeditorgeneraltodo.h +++ b/korganizer/koeditorgeneraltodo.h | |||
@@ -1,108 +1,109 @@ | |||
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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef _KOEDITORGENERALTODO_H | 23 | #ifndef _KOEDITORGENERALTODO_H |
24 | #define _KOEDITORGENERALTODO_H | 24 | #define _KOEDITORGENERALTODO_H |
25 | 25 | ||
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qgroupbox.h> | 30 | #include <qgroupbox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | #include <qmultilineedit.h> | 33 | #include <qmultilineedit.h> |
34 | #include <qlistview.h> | 34 | #include <qlistview.h> |
35 | #include <qradiobutton.h> | 35 | #include <qradiobutton.h> |
36 | 36 | ||
37 | #include "koeditorgeneral.h" | 37 | #include "koeditorgeneral.h" |
38 | #include "koglobals.h" | 38 | #include "koglobals.h" |
39 | 39 | ||
40 | class KRestrictedLine; | 40 | class KRestrictedLine; |
41 | 41 | ||
42 | class KDateEdit; | 42 | class KDateEdit; |
43 | 43 | ||
44 | using namespace KCal; | 44 | using namespace KCal; |
45 | 45 | ||
46 | class KOEditorGeneralTodo : public KOEditorGeneral | 46 | class KOEditorGeneralTodo : public KOEditorGeneral |
47 | { | 47 | { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | public: | 49 | public: |
50 | KOEditorGeneralTodo (QObject* parent=0,const char* name=0); | 50 | KOEditorGeneralTodo (QObject* parent=0,const char* name=0); |
51 | virtual ~KOEditorGeneralTodo(); | 51 | virtual ~KOEditorGeneralTodo(); |
52 | 52 | ||
53 | void initTime(QWidget *, QBoxLayout *); | 53 | void initTime(QWidget *, QBoxLayout *); |
54 | void initStatus(QWidget *, QBoxLayout *); | 54 | void initStatus(QWidget *, QBoxLayout *); |
55 | void initCompletion(QWidget *, QBoxLayout *); | 55 | void initCompletion(QWidget *, QBoxLayout *); |
56 | void initPriority(QWidget *, QBoxLayout *); | 56 | void initPriority(QWidget *, QBoxLayout *); |
57 | 57 | ||
58 | void finishSetup(); | 58 | void finishSetup(); |
59 | 59 | ||
60 | /** Set widgets to default values */ | 60 | /** Set widgets to default values */ |
61 | void setDefaults(QDateTime due,bool allDay); | 61 | void setDefaults(QDateTime due,bool allDay); |
62 | /** Read todo object and setup widgets accordingly */ | 62 | /** Read todo object and setup widgets accordingly */ |
63 | void readTodo(Todo *); | 63 | void readTodo(Todo *); |
64 | /** Write todo settings to event object */ | 64 | /** Write todo settings to event object */ |
65 | void writeTodo(Todo *); | 65 | void writeTodo(Todo *); |
66 | 66 | ||
67 | /** Check if the input is valid. */ | 67 | /** Check if the input is valid. */ |
68 | bool validateInput(); | 68 | bool validateInput(); |
69 | 69 | ||
70 | /** The todo has been modified externally */ | 70 | /** The todo has been modified externally */ |
71 | void modified (Todo*, int); | 71 | void modified (Todo*, int); |
72 | 72 | ||
73 | signals: | 73 | signals: |
74 | void openCategoryDialog(); | 74 | void openCategoryDialog(); |
75 | void datesChecked(); | ||
75 | 76 | ||
76 | protected slots: | 77 | protected slots: |
77 | void completedChanged(int); | 78 | void completedChanged(int); |
78 | 79 | ||
79 | void enableDueEdit( bool enable ); | 80 | void enableDueEdit( bool enable ); |
80 | void enableStartEdit( bool enable ); | 81 | void enableStartEdit( bool enable ); |
81 | void enableTimeEdits( bool enable ); | 82 | void enableTimeEdits( bool enable ); |
82 | void showAlarm(); | 83 | void showAlarm(); |
83 | 84 | ||
84 | protected: | 85 | protected: |
85 | void setCompletedDate(); | 86 | void setCompletedDate(); |
86 | 87 | ||
87 | private: | 88 | private: |
88 | friend class KOTodoEditor; | 89 | friend class KOTodoEditor; |
89 | KDateEdit *mStartDateEdit; | 90 | KDateEdit *mStartDateEdit; |
90 | KOTimeEdit *mStartTimeEdit; | 91 | KOTimeEdit *mStartTimeEdit; |
91 | KDateEdit *mCompleteDateEdit; | 92 | KDateEdit *mCompleteDateEdit; |
92 | KOTimeEdit *mCompleteTimeEdit; | 93 | KOTimeEdit *mCompleteTimeEdit; |
93 | QCheckBox *mTimeButton; | 94 | QCheckBox *mTimeButton; |
94 | QCheckBox *mDueCheck; | 95 | QCheckBox *mDueCheck; |
95 | KDateEdit *mDueDateEdit; | 96 | KDateEdit *mDueDateEdit; |
96 | KOTimeEdit *mDueTimeEdit; | 97 | KOTimeEdit *mDueTimeEdit; |
97 | QComboBox *mCompletedCombo; | 98 | QComboBox *mCompletedCombo; |
98 | QLabel *mCompletedLabel; | 99 | QLabel *mCompletedLabel; |
99 | QLabel *mPriorityLabel; | 100 | QLabel *mPriorityLabel; |
100 | QComboBox *mPriorityCombo; | 101 | QComboBox *mPriorityCombo; |
101 | 102 | ||
102 | QCheckBox *mStartCheck; | 103 | QCheckBox *mStartCheck; |
103 | 104 | ||
104 | QDateTime mCompleted; | 105 | QDateTime mCompleted; |
105 | }; | 106 | }; |
106 | 107 | ||
107 | 108 | ||
108 | #endif | 109 | #endif |
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index 4209e10..bedc75a 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp | |||
@@ -1,172 +1,173 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000-2003 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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qfiledialog.h> | 25 | #include <qfiledialog.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <qvgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qlistbox.h> | 32 | #include <qlistbox.h> |
33 | #include <qspinbox.h> | 33 | #include <qspinbox.h> |
34 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | 36 | ||
37 | #include <kdialog.h> | 37 | #include <kdialog.h> |
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <knumvalidator.h> | 42 | #include <knumvalidator.h> |
43 | 43 | ||
44 | #include <libkcal/event.h> | 44 | #include <libkcal/event.h> |
45 | #include <libkcal/todo.h> | ||
45 | 46 | ||
46 | #include <libkdepim/kdateedit.h> | 47 | #include <libkdepim/kdateedit.h> |
47 | 48 | ||
48 | #include "koprefs.h" | 49 | #include "koprefs.h" |
49 | 50 | ||
50 | #include "koeditorrecurrence.h" | 51 | #include "koeditorrecurrence.h" |
51 | 52 | ||
52 | /////////////////////////// RecurBase /////////////////////////////// | 53 | /////////////////////////// RecurBase /////////////////////////////// |
53 | 54 | ||
54 | RecurBase::RecurBase( QWidget *parent, const char *name ) : | 55 | RecurBase::RecurBase( QWidget *parent, const char *name ) : |
55 | QWidget( parent, name ) | 56 | QWidget( parent, name ) |
56 | { | 57 | { |
57 | mFrequencyEdit = new QSpinBox( 1, 9999, 1, this ); | 58 | mFrequencyEdit = new QSpinBox( 1, 9999, 1, this ); |
58 | mFrequencyEdit->setValue( 1 ); | 59 | mFrequencyEdit->setValue( 1 ); |
59 | } | 60 | } |
60 | 61 | ||
61 | QWidget *RecurBase::frequencyEdit() | 62 | QWidget *RecurBase::frequencyEdit() |
62 | { | 63 | { |
63 | return mFrequencyEdit; | 64 | return mFrequencyEdit; |
64 | } | 65 | } |
65 | 66 | ||
66 | void RecurBase::setFrequency( int f ) | 67 | void RecurBase::setFrequency( int f ) |
67 | { | 68 | { |
68 | if ( f < 1 ) f = 1; | 69 | if ( f < 1 ) f = 1; |
69 | 70 | ||
70 | mFrequencyEdit->setValue( f ); | 71 | mFrequencyEdit->setValue( f ); |
71 | } | 72 | } |
72 | 73 | ||
73 | int RecurBase::frequency() | 74 | int RecurBase::frequency() |
74 | { | 75 | { |
75 | return mFrequencyEdit->value(); | 76 | return mFrequencyEdit->value(); |
76 | } | 77 | } |
77 | 78 | ||
78 | /////////////////////////// RecurDaily /////////////////////////////// | 79 | /////////////////////////// RecurDaily /////////////////////////////// |
79 | 80 | ||
80 | RecurDaily::RecurDaily( QWidget *parent, const char *name ) : | 81 | RecurDaily::RecurDaily( QWidget *parent, const char *name ) : |
81 | RecurBase( parent, name ) | 82 | RecurBase( parent, name ) |
82 | { | 83 | { |
83 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 84 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
84 | topLayout->setSpacing( KDialog::spacingHint() ); | 85 | topLayout->setSpacing( KDialog::spacingHint() ); |
85 | 86 | ||
86 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); | 87 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); |
87 | topLayout->addWidget( preLabel ); | 88 | topLayout->addWidget( preLabel ); |
88 | 89 | ||
89 | topLayout->addWidget( frequencyEdit() ); | 90 | topLayout->addWidget( frequencyEdit() ); |
90 | 91 | ||
91 | QLabel *postLabel = new QLabel( i18n("day(s)"), this ); | 92 | QLabel *postLabel = new QLabel( i18n("day(s)"), this ); |
92 | topLayout->addWidget( postLabel ); | 93 | topLayout->addWidget( postLabel ); |
93 | } | 94 | } |
94 | 95 | ||
95 | 96 | ||
96 | /////////////////////////// RecurWeekly /////////////////////////////// | 97 | /////////////////////////// RecurWeekly /////////////////////////////// |
97 | 98 | ||
98 | RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : | 99 | RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : |
99 | RecurBase( parent, name ) | 100 | RecurBase( parent, name ) |
100 | { | 101 | { |
101 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 102 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
102 | topLayout->setSpacing( KDialog::spacingHint() ); | 103 | topLayout->setSpacing( KDialog::spacingHint() ); |
103 | 104 | ||
104 | topLayout->addStretch( 1 ); | 105 | topLayout->addStretch( 1 ); |
105 | 106 | ||
106 | QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); | 107 | QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); |
107 | 108 | ||
108 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); | 109 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); |
109 | weeksLayout->addWidget( preLabel ); | 110 | weeksLayout->addWidget( preLabel ); |
110 | 111 | ||
111 | weeksLayout->addWidget( frequencyEdit() ); | 112 | weeksLayout->addWidget( frequencyEdit() ); |
112 | 113 | ||
113 | QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); | 114 | QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); |
114 | weeksLayout->addWidget( postLabel ); | 115 | weeksLayout->addWidget( postLabel ); |
115 | 116 | ||
116 | QHBox *dayBox = new QHBox( this ); | 117 | QHBox *dayBox = new QHBox( this ); |
117 | topLayout->addWidget( dayBox, 1, AlignVCenter ); | 118 | topLayout->addWidget( dayBox, 1, AlignVCenter ); |
118 | // TODO: Respect start of week setting | 119 | // TODO: Respect start of week setting |
119 | for ( int i = 0; i < 7; ++i ) { | 120 | for ( int i = 0; i < 7; ++i ) { |
120 | QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); | 121 | QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); |
121 | if ( KOPrefs::instance()->mCompactDialogs ) { | 122 | if ( KOPrefs::instance()->mCompactDialogs ) { |
122 | weekDayName = weekDayName.left( 1 ); | 123 | weekDayName = weekDayName.left( 1 ); |
123 | } | 124 | } |
124 | mDayBoxes[ i ] = new QCheckBox( weekDayName, dayBox ); | 125 | mDayBoxes[ i ] = new QCheckBox( weekDayName, dayBox ); |
125 | } | 126 | } |
126 | 127 | ||
127 | topLayout->addStretch( 1 ); | 128 | topLayout->addStretch( 1 ); |
128 | } | 129 | } |
129 | 130 | ||
130 | void RecurWeekly::setDays( const QBitArray &days ) | 131 | void RecurWeekly::setDays( const QBitArray &days ) |
131 | { | 132 | { |
132 | for ( int i = 0; i < 7; ++i ) { | 133 | for ( int i = 0; i < 7; ++i ) { |
133 | mDayBoxes[ i ]->setChecked( days.testBit( i ) ); | 134 | mDayBoxes[ i ]->setChecked( days.testBit( i ) ); |
134 | } | 135 | } |
135 | } | 136 | } |
136 | 137 | ||
137 | QBitArray RecurWeekly::days() | 138 | QBitArray RecurWeekly::days() |
138 | { | 139 | { |
139 | QBitArray days( 7 ); | 140 | QBitArray days( 7 ); |
140 | 141 | ||
141 | for ( int i = 0; i < 7; ++i ) { | 142 | for ( int i = 0; i < 7; ++i ) { |
142 | days.setBit( i, mDayBoxes[ i ]->isChecked() ); | 143 | days.setBit( i, mDayBoxes[ i ]->isChecked() ); |
143 | } | 144 | } |
144 | 145 | ||
145 | return days; | 146 | return days; |
146 | } | 147 | } |
147 | 148 | ||
148 | /////////////////////////// RecurMonthly /////////////////////////////// | 149 | /////////////////////////// RecurMonthly /////////////////////////////// |
149 | 150 | ||
150 | RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : | 151 | RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : |
151 | RecurBase( parent, name ) | 152 | RecurBase( parent, name ) |
152 | { | 153 | { |
153 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 154 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
154 | topLayout->setSpacing( KDialog::spacingHint() ); | 155 | topLayout->setSpacing( KDialog::spacingHint() ); |
155 | 156 | ||
156 | 157 | ||
157 | QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); | 158 | QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); |
158 | 159 | ||
159 | QLabel *preLabel = new QLabel( i18n("every"), this ); | 160 | QLabel *preLabel = new QLabel( i18n("every"), this ); |
160 | freqLayout->addWidget( preLabel ); | 161 | freqLayout->addWidget( preLabel ); |
161 | 162 | ||
162 | freqLayout->addWidget( frequencyEdit() ); | 163 | freqLayout->addWidget( frequencyEdit() ); |
163 | 164 | ||
164 | QLabel *postLabel = new QLabel( i18n("month(s)"), this ); | 165 | QLabel *postLabel = new QLabel( i18n("month(s)"), this ); |
165 | freqLayout->addWidget( postLabel ); | 166 | freqLayout->addWidget( postLabel ); |
166 | 167 | ||
167 | 168 | ||
168 | QButtonGroup *buttonGroup = new QButtonGroup( this ); | 169 | QButtonGroup *buttonGroup = new QButtonGroup( this ); |
169 | buttonGroup->setFrameStyle( QFrame::NoFrame ); | 170 | buttonGroup->setFrameStyle( QFrame::NoFrame ); |
170 | topLayout->addWidget( buttonGroup, 1, AlignVCenter ); | 171 | topLayout->addWidget( buttonGroup, 1, AlignVCenter ); |
171 | 172 | ||
172 | QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); | 173 | QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); |
@@ -780,360 +781,367 @@ KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : | |||
780 | mDaily = new RecurDaily( mRuleStack ); | 781 | mDaily = new RecurDaily( mRuleStack ); |
781 | mRuleStack->addWidget( mDaily, 0 ); | 782 | mRuleStack->addWidget( mDaily, 0 ); |
782 | 783 | ||
783 | mWeekly = new RecurWeekly( mRuleStack ); | 784 | mWeekly = new RecurWeekly( mRuleStack ); |
784 | mRuleStack->addWidget( mWeekly, 0 ); | 785 | mRuleStack->addWidget( mWeekly, 0 ); |
785 | 786 | ||
786 | mMonthly = new RecurMonthly( mRuleStack ); | 787 | mMonthly = new RecurMonthly( mRuleStack ); |
787 | mRuleStack->addWidget( mMonthly, 0 ); | 788 | mRuleStack->addWidget( mMonthly, 0 ); |
788 | 789 | ||
789 | mYearly = new RecurYearly( mRuleStack ); | 790 | mYearly = new RecurYearly( mRuleStack ); |
790 | mRuleStack->addWidget( mYearly, 0 ); | 791 | mRuleStack->addWidget( mYearly, 0 ); |
791 | 792 | ||
792 | showCurrentRule( mRecurrenceChooser->type() ); | 793 | showCurrentRule( mRecurrenceChooser->type() ); |
793 | 794 | ||
794 | if ( KOPrefs::instance()->mCompactDialogs ) { | 795 | if ( KOPrefs::instance()->mCompactDialogs ) { |
795 | mRecurrenceRangeWidget = 0; | 796 | mRecurrenceRangeWidget = 0; |
796 | mRecurrenceRangeDialog = new RecurrenceRangeDialog( this ); | 797 | mRecurrenceRangeDialog = new RecurrenceRangeDialog( this ); |
797 | mRecurrenceRange = mRecurrenceRangeDialog; | 798 | mRecurrenceRange = mRecurrenceRangeDialog; |
798 | mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."), | 799 | mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."), |
799 | this ); | 800 | this ); |
800 | 801 | ||
801 | connect( mRecurrenceRangeButton, SIGNAL( clicked() ), | 802 | connect( mRecurrenceRangeButton, SIGNAL( clicked() ), |
802 | SLOT( showRecurrenceRangeDialog() ) ); | 803 | SLOT( showRecurrenceRangeDialog() ) ); |
803 | 804 | ||
804 | mExceptionsWidget = 0; | 805 | mExceptionsWidget = 0; |
805 | mExceptionsDialog = new ExceptionsDialog( this ); | 806 | mExceptionsDialog = new ExceptionsDialog( this ); |
806 | mExceptions = mExceptionsDialog; | 807 | mExceptions = mExceptionsDialog; |
807 | mExceptionsButton = new QPushButton( i18n("Exceptions..."), this ); | 808 | mExceptionsButton = new QPushButton( i18n("Exceptions..."), this ); |
808 | if ( QApplication::desktop()->width() < 320 ) { | 809 | if ( QApplication::desktop()->width() < 320 ) { |
809 | topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 ); | 810 | topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 ); |
810 | topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 ); | 811 | topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 ); |
811 | } else { | 812 | } else { |
812 | topLayout->addWidget( mRecurrenceRangeButton, 3, 0 ); | 813 | topLayout->addWidget( mRecurrenceRangeButton, 3, 0 ); |
813 | topLayout->addWidget( mExceptionsButton, 3, 1 ); | 814 | topLayout->addWidget( mExceptionsButton, 3, 1 ); |
814 | } | 815 | } |
815 | connect( mExceptionsButton, SIGNAL( clicked() ), | 816 | connect( mExceptionsButton, SIGNAL( clicked() ), |
816 | SLOT( showExceptionsDialog() ) ); | 817 | SLOT( showExceptionsDialog() ) ); |
817 | 818 | ||
818 | } else { | 819 | } else { |
819 | mRecurrenceRangeWidget = new RecurrenceRangeWidget( this ); | 820 | mRecurrenceRangeWidget = new RecurrenceRangeWidget( this ); |
820 | mRecurrenceRangeDialog = 0; | 821 | mRecurrenceRangeDialog = 0; |
821 | mRecurrenceRange = mRecurrenceRangeWidget; | 822 | mRecurrenceRange = mRecurrenceRangeWidget; |
822 | mRecurrenceRangeButton = 0; | 823 | mRecurrenceRangeButton = 0; |
823 | topLayout->addWidget( mRecurrenceRangeWidget, 3, 0 ); | 824 | topLayout->addWidget( mRecurrenceRangeWidget, 3, 0 ); |
824 | 825 | ||
825 | mExceptionsWidget = new ExceptionsWidget( this ); | 826 | mExceptionsWidget = new ExceptionsWidget( this ); |
826 | mExceptionsDialog = 0; | 827 | mExceptionsDialog = 0; |
827 | mExceptions = mExceptionsWidget; | 828 | mExceptions = mExceptionsWidget; |
828 | mExceptionsButton = 0; | 829 | mExceptionsButton = 0; |
829 | topLayout->addWidget( mExceptionsWidget, 3, 1 ); | 830 | topLayout->addWidget( mExceptionsWidget, 3, 1 ); |
830 | } | 831 | } |
831 | } | 832 | } |
832 | 833 | ||
833 | KOEditorRecurrence::~KOEditorRecurrence() | 834 | KOEditorRecurrence::~KOEditorRecurrence() |
834 | { | 835 | { |
835 | } | 836 | } |
836 | 837 | ||
837 | void KOEditorRecurrence::setEnabled( bool enabled ) | 838 | void KOEditorRecurrence::setEnabled( bool enabled ) |
838 | { | 839 | { |
839 | // kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl; | 840 | // kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl; |
840 | 841 | ||
841 | mTimeGroupBox->setEnabled( enabled ); | 842 | mTimeGroupBox->setEnabled( enabled ); |
842 | if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled ); | 843 | if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled ); |
843 | if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled ); | 844 | if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled ); |
844 | if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled ); | 845 | if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled ); |
845 | if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled ); | 846 | if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled ); |
846 | mRuleBox->setEnabled( enabled ); | 847 | mRuleBox->setEnabled( enabled ); |
847 | } | 848 | } |
848 | 849 | ||
849 | void KOEditorRecurrence::showCurrentRule( int current ) | 850 | void KOEditorRecurrence::showCurrentRule( int current ) |
850 | { | 851 | { |
851 | switch ( current ) { | 852 | switch ( current ) { |
852 | case Daily: | 853 | case Daily: |
853 | mRuleStack->raiseWidget( mDaily ); | 854 | mRuleStack->raiseWidget( mDaily ); |
854 | break; | 855 | break; |
855 | case Weekly: | 856 | case Weekly: |
856 | mRuleStack->raiseWidget( mWeekly ); | 857 | mRuleStack->raiseWidget( mWeekly ); |
857 | break; | 858 | break; |
858 | case Monthly: | 859 | case Monthly: |
859 | mRuleStack->raiseWidget( mMonthly ); | 860 | mRuleStack->raiseWidget( mMonthly ); |
860 | break; | 861 | break; |
861 | default: | 862 | default: |
862 | case Yearly: | 863 | case Yearly: |
863 | mRuleStack->raiseWidget( mYearly ); | 864 | mRuleStack->raiseWidget( mYearly ); |
864 | break; | 865 | break; |
865 | } | 866 | } |
866 | } | 867 | } |
867 | 868 | ||
868 | void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) | 869 | void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) |
869 | { | 870 | { |
870 | // kdDebug() << "KOEditorRecurrence::setDateTimes" << endl; | 871 | // kdDebug() << "KOEditorRecurrence::setDateTimes" << endl; |
871 | 872 | ||
872 | mRecurrenceRange->setDateTimes( start, end ); | 873 | mRecurrenceRange->setDateTimes( start, end ); |
873 | mExceptions->setDefaults( end ); | 874 | mExceptions->setDefaults( end ); |
874 | 875 | ||
875 | } | 876 | } |
876 | 877 | ||
877 | void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) | 878 | void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) |
878 | { | 879 | { |
879 | 880 | ||
880 | // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); | 881 | // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); |
881 | setDateTimes( from, to ); | 882 | setDateTimes( from, to ); |
882 | 883 | ||
883 | bool enabled = false; | 884 | bool enabled = false; |
884 | mEnabledCheck->setChecked( enabled ); | 885 | mEnabledCheck->setChecked( enabled ); |
885 | setEnabled( enabled ); | 886 | setEnabled( enabled ); |
886 | 887 | ||
887 | mExceptions->setDefaults( to ); | 888 | mExceptions->setDefaults( to ); |
888 | mRecurrenceRange->setDefaults( to ); | 889 | mRecurrenceRange->setDefaults( to ); |
889 | 890 | ||
890 | mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); | 891 | mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); |
891 | showCurrentRule( mRecurrenceChooser->type() ); | 892 | showCurrentRule( mRecurrenceChooser->type() ); |
892 | 893 | ||
893 | mDaily->setFrequency( 1 ); | 894 | mDaily->setFrequency( 1 ); |
894 | 895 | ||
895 | mWeekly->setFrequency( 1 ); | 896 | mWeekly->setFrequency( 1 ); |
896 | QBitArray days( 7 ); | 897 | QBitArray days( 7 ); |
897 | days.fill( 0 ); | 898 | days.fill( 0 ); |
898 | days.setBit( from.date().dayOfWeek()- 1); | 899 | days.setBit( from.date().dayOfWeek()- 1); |
899 | mWeekly->setDays( days ); | 900 | mWeekly->setDays( days ); |
900 | mMonthly->setFrequency( 1 ); | 901 | mMonthly->setFrequency( 1 ); |
901 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); | 902 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); |
902 | mMonthly->setByDay( from.date().day()-1 ); | 903 | mMonthly->setByDay( from.date().day()-1 ); |
903 | mYearly->setFrequency( 1 ); | 904 | mYearly->setFrequency( 1 ); |
904 | mYearly->setByDay( from.date().dayOfYear() ); | 905 | mYearly->setByDay( from.date().dayOfYear() ); |
905 | mYearly->setByMonth( from.date().month(), from.date().day() ); | 906 | mYearly->setByMonth( from.date().month(), from.date().day() ); |
906 | } | 907 | } |
907 | 908 | ||
908 | void KOEditorRecurrence::readEvent(Event *event) | 909 | void KOEditorRecurrence::readEvent(Incidence *event) |
909 | { | 910 | { |
910 | setDefaults( event->dtStart(), event->dtEnd(), true ); | 911 | |
912 | QDateTime dtEnd; | ||
913 | if ( event->type() == "Event" ) | ||
914 | dtEnd = ((Event*)event)->dtEnd(); | ||
915 | else | ||
916 | dtEnd = ((Todo*)event)->dtDue(); | ||
917 | |||
918 | setDefaults( event->dtStart(), dtEnd, true ); | ||
911 | QBitArray rDays( 7 ); | 919 | QBitArray rDays( 7 ); |
912 | QPtrList<Recurrence::rMonthPos> rmp; | 920 | QPtrList<Recurrence::rMonthPos> rmp; |
913 | QPtrList<int> rmd; | 921 | QPtrList<int> rmd; |
914 | int day = 0; | 922 | int day = 0; |
915 | int count = 0; | 923 | int count = 0; |
916 | int month = 0; | 924 | int month = 0; |
917 | setDateTimes( event->dtStart(), event->dtEnd() ); | 925 | setDateTimes( event->dtStart(), dtEnd ); |
918 | 926 | ||
919 | Recurrence *r = event->recurrence(); | 927 | Recurrence *r = event->recurrence(); |
920 | int f = r->frequency(); | 928 | int f = r->frequency(); |
921 | 929 | ||
922 | int recurs = r->doesRecur(); | 930 | int recurs = r->doesRecur(); |
923 | 931 | ||
924 | mEnabledCheck->setChecked( recurs ); | 932 | mEnabledCheck->setChecked( recurs ); |
925 | setEnabled( recurs ); | 933 | setEnabled( recurs ); |
926 | 934 | ||
927 | int recurrenceType = RecurrenceChooser::Weekly; | 935 | int recurrenceType = RecurrenceChooser::Weekly; |
928 | 936 | ||
929 | switch ( recurs ) { | 937 | switch ( recurs ) { |
930 | case Recurrence::rNone: | 938 | case Recurrence::rNone: |
931 | setDefaults( event->dtStart(), event->dtEnd(), true ); | 939 | setDefaults( event->dtStart(), dtEnd, true ); |
932 | break; | 940 | break; |
933 | case Recurrence::rDaily: | 941 | case Recurrence::rDaily: |
934 | recurrenceType = RecurrenceChooser::Daily; | 942 | recurrenceType = RecurrenceChooser::Daily; |
935 | mDaily->setFrequency( f ); | 943 | mDaily->setFrequency( f ); |
936 | break; | 944 | break; |
937 | case Recurrence::rWeekly: | 945 | case Recurrence::rWeekly: |
938 | recurrenceType = RecurrenceChooser::Weekly; | 946 | recurrenceType = RecurrenceChooser::Weekly; |
939 | mWeekly->setFrequency( f ); | 947 | mWeekly->setFrequency( f ); |
940 | mWeekly->setDays( r->days() ); | 948 | mWeekly->setDays( r->days() ); |
941 | break; | 949 | break; |
942 | case Recurrence::rMonthlyPos: | 950 | case Recurrence::rMonthlyPos: |
943 | // we only handle one possibility in the list right now, | 951 | // we only handle one possibility in the list right now, |
944 | // so I have hardcoded calls with first(). If we make the GUI | 952 | // so I have hardcoded calls with first(). If we make the GUI |
945 | // more extended, this can be changed. | 953 | // more extended, this can be changed. |
946 | recurrenceType = RecurrenceChooser::Monthly; | 954 | recurrenceType = RecurrenceChooser::Monthly; |
947 | 955 | ||
948 | rmp = r->monthPositions(); | 956 | rmp = r->monthPositions(); |
949 | if ( rmp.first()->negative ) | 957 | if ( rmp.first()->negative ) |
950 | count = 5 - rmp.first()->rPos - 1; | 958 | count = 5 - rmp.first()->rPos - 1; |
951 | else | 959 | else |
952 | count = rmp.first()->rPos - 1; | 960 | count = rmp.first()->rPos - 1; |
953 | day = 0; | 961 | day = 0; |
954 | while ( !rmp.first()->rDays.testBit( day ) ) ++day; | 962 | while ( !rmp.first()->rDays.testBit( day ) ) ++day; |
955 | mMonthly->setByPos( count, day ); | 963 | mMonthly->setByPos( count, day ); |
956 | 964 | ||
957 | mMonthly->setFrequency( f ); | 965 | mMonthly->setFrequency( f ); |
958 | 966 | ||
959 | break; | 967 | break; |
960 | case Recurrence::rMonthlyDay: | 968 | case Recurrence::rMonthlyDay: |
961 | recurrenceType = RecurrenceChooser::Monthly; | 969 | recurrenceType = RecurrenceChooser::Monthly; |
962 | 970 | ||
963 | rmd = r->monthDays(); | 971 | rmd = r->monthDays(); |
964 | day = *rmd.first() - 1; | 972 | day = *rmd.first() - 1; |
965 | mMonthly->setByDay( day ); | 973 | mMonthly->setByDay( day ); |
966 | 974 | ||
967 | mMonthly->setFrequency( f ); | 975 | mMonthly->setFrequency( f ); |
968 | 976 | ||
969 | break; | 977 | break; |
970 | case Recurrence::rYearlyMonth: | 978 | case Recurrence::rYearlyMonth: |
971 | { | 979 | { |
972 | recurrenceType = RecurrenceChooser::Yearly; | 980 | recurrenceType = RecurrenceChooser::Yearly; |
973 | qDebug("Recurrence::rYearlyMonth: "); | 981 | qDebug("Recurrence::rYearlyMonth: "); |
974 | day = event->dtStart().date().day(); | 982 | day = event->dtStart().date().day(); |
975 | rmd = r->yearNums(); | 983 | rmd = r->yearNums(); |
976 | if ( rmd.count() > 0 ) | 984 | if ( rmd.count() > 0 ) |
977 | month = *rmd.first(); | 985 | month = *rmd.first(); |
978 | else | 986 | else |
979 | month = event->dtStart().date().month() ; | 987 | month = event->dtStart().date().month() ; |
980 | mYearly->setByMonth( month, day ); | 988 | mYearly->setByMonth( month, day ); |
981 | #if 0 | 989 | #if 0 |
982 | qDebug("2day = %d ",day ); | 990 | qDebug("2day = %d ",day ); |
983 | QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); | 991 | QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); |
984 | int month; | 992 | int month; |
985 | if ( !monthlist.isEmpty() ) { | 993 | if ( !monthlist.isEmpty() ) { |
986 | month = monthlist.first()->rPos ; | 994 | month = monthlist.first()->rPos ; |
987 | } else { | 995 | } else { |
988 | month = event->dtStart().date().month() ; | 996 | month = event->dtStart().date().month() ; |
989 | } | 997 | } |
990 | mYearly->setByMonth( day, month ); | 998 | mYearly->setByMonth( day, month ); |
991 | #endif | 999 | #endif |
992 | mYearly->setFrequency( f ); | 1000 | mYearly->setFrequency( f ); |
993 | } | 1001 | } |
994 | 1002 | ||
995 | break; | 1003 | break; |
996 | case Recurrence::rYearlyDay: | 1004 | case Recurrence::rYearlyDay: |
997 | qDebug("Recurrence::rYearlyDay: "); | 1005 | qDebug("Recurrence::rYearlyDay: "); |
998 | recurrenceType = RecurrenceChooser::Yearly; | 1006 | recurrenceType = RecurrenceChooser::Yearly; |
999 | mYearly->setByDay( event->dtStart().date().dayOfYear() ); | 1007 | mYearly->setByDay( event->dtStart().date().dayOfYear() ); |
1000 | mYearly->setFrequency( f ); | 1008 | mYearly->setFrequency( f ); |
1001 | break; | 1009 | break; |
1002 | default: | 1010 | default: |
1003 | setDefaults( event->dtStart(), event->dtEnd(), true ); | 1011 | setDefaults( event->dtStart(), dtEnd, true ); |
1004 | break; | 1012 | break; |
1005 | } | 1013 | } |
1006 | 1014 | ||
1007 | mRecurrenceChooser->setType( recurrenceType ); | 1015 | mRecurrenceChooser->setType( recurrenceType ); |
1008 | showCurrentRule( recurrenceType ); | 1016 | showCurrentRule( recurrenceType ); |
1009 | 1017 | ||
1010 | mRecurrenceRange->setDateTimes( event->dtStart() ); | 1018 | mRecurrenceRange->setDateTimes( event->dtStart() ); |
1011 | 1019 | ||
1012 | if ( r->doesRecur() ) { | 1020 | if ( r->doesRecur() ) { |
1013 | mRecurrenceRange->setDuration( r->duration() ); | 1021 | mRecurrenceRange->setDuration( r->duration() ); |
1014 | if ( r->duration() == 0 ) | 1022 | if ( r->duration() == 0 ) |
1015 | { | 1023 | { |
1016 | if ( r->endDate() < event->dtStart().date() ) | 1024 | if ( r->endDate() < event->dtStart().date() ) |
1017 | mRecurrenceRange->setEndDate( event->dtStart().date() ); | 1025 | mRecurrenceRange->setEndDate( event->dtStart().date() ); |
1018 | else | 1026 | else |
1019 | mRecurrenceRange->setEndDate( r->endDate() ); | 1027 | mRecurrenceRange->setEndDate( r->endDate() ); |
1020 | } else | 1028 | } else |
1021 | mRecurrenceRange->setEndDate( event->dtStart().date() ); | 1029 | mRecurrenceRange->setEndDate( event->dtStart().date() ); |
1022 | } | 1030 | } |
1023 | 1031 | ||
1024 | mExceptions->setDates( event->exDates() ); | 1032 | mExceptions->setDates( event->exDates() ); |
1025 | } | 1033 | } |
1026 | 1034 | ||
1027 | void KOEditorRecurrence::writeEvent( Event *event ) | 1035 | void KOEditorRecurrence::writeEvent( Incidence *event ) |
1028 | { | 1036 | { |
1029 | Recurrence *r = event->recurrence(); | 1037 | Recurrence *r = event->recurrence(); |
1030 | 1038 | ||
1031 | // clear out any old settings; | 1039 | // clear out any old settings; |
1032 | r->unsetRecurs(); | 1040 | r->unsetRecurs(); |
1033 | 1041 | ||
1034 | if ( mEnabledCheck->isChecked() ) { | 1042 | if ( mEnabledCheck->isChecked() ) { |
1035 | int duration = mRecurrenceRange->duration(); | 1043 | int duration = mRecurrenceRange->duration(); |
1036 | QDate endDate; | 1044 | QDate endDate; |
1037 | if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); | 1045 | if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); |
1038 | 1046 | ||
1039 | int recurrenceType = mRecurrenceChooser->type(); | 1047 | int recurrenceType = mRecurrenceChooser->type(); |
1040 | 1048 | ||
1041 | if ( recurrenceType == RecurrenceChooser::Daily ) { | 1049 | if ( recurrenceType == RecurrenceChooser::Daily ) { |
1042 | int freq = mDaily->frequency(); | 1050 | int freq = mDaily->frequency(); |
1043 | if ( duration != 0 ) r->setDaily( freq, duration ); | 1051 | if ( duration != 0 ) r->setDaily( freq, duration ); |
1044 | else r->setDaily( freq, endDate ); | 1052 | else r->setDaily( freq, endDate ); |
1045 | } else if ( recurrenceType == RecurrenceChooser::Weekly ) { | 1053 | } else if ( recurrenceType == RecurrenceChooser::Weekly ) { |
1046 | int freq = mWeekly->frequency(); | 1054 | int freq = mWeekly->frequency(); |
1047 | QBitArray days = mWeekly->days(); | 1055 | QBitArray days = mWeekly->days(); |
1048 | int j; | 1056 | int j; |
1049 | bool found = false; | 1057 | bool found = false; |
1050 | for (j = 0; j < 7 ; ++j ) { | 1058 | for (j = 0; j < 7 ; ++j ) { |
1051 | found |=days.at(j); | 1059 | found |=days.at(j); |
1052 | } | 1060 | } |
1053 | if ( !found ) { | 1061 | if ( !found ) { |
1054 | days.setBit( event->dtStart().date().dayOfWeek()-1); | 1062 | days.setBit( event->dtStart().date().dayOfWeek()-1); |
1055 | qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1); | 1063 | qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1); |
1056 | } | 1064 | } |
1057 | if ( duration != 0 ) r->setWeekly( freq, days, duration ); | 1065 | if ( duration != 0 ) r->setWeekly( freq, days, duration ); |
1058 | else r->setWeekly( freq, days, endDate ); | 1066 | else r->setWeekly( freq, days, endDate ); |
1059 | } else if ( recurrenceType == RecurrenceChooser::Monthly ) { | 1067 | } else if ( recurrenceType == RecurrenceChooser::Monthly ) { |
1060 | int freq = mMonthly->frequency(); | 1068 | int freq = mMonthly->frequency(); |
1061 | if ( mMonthly->byPos() ) { | 1069 | if ( mMonthly->byPos() ) { |
1062 | int pos = mMonthly->count(); | 1070 | int pos = mMonthly->count(); |
1063 | 1071 | ||
1064 | QBitArray days( 7 ); | 1072 | QBitArray days( 7 ); |
1065 | days.fill( false ); | 1073 | days.fill( false ); |
1066 | 1074 | ||
1067 | days.setBit( mMonthly->weekday() ); | 1075 | days.setBit( mMonthly->weekday() ); |
1068 | if ( duration != 0 ) | 1076 | if ( duration != 0 ) |
1069 | r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); | 1077 | r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); |
1070 | else | 1078 | else |
1071 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); | 1079 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); |
1072 | r->addMonthlyPos( pos, days ); | 1080 | r->addMonthlyPos( pos, days ); |
1073 | } else { | 1081 | } else { |
1074 | // it's by day | 1082 | // it's by day |
1075 | int day = mMonthly->day(); | 1083 | int day = mMonthly->day(); |
1076 | 1084 | ||
1077 | if ( duration != 0 ) { | 1085 | if ( duration != 0 ) { |
1078 | r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); | 1086 | r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); |
1079 | } else { | 1087 | } else { |
1080 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); | 1088 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); |
1081 | } | 1089 | } |
1082 | r->addMonthlyDay( day ); | 1090 | r->addMonthlyDay( day ); |
1083 | } | 1091 | } |
1084 | } else if ( recurrenceType == RecurrenceChooser::Yearly ) { | 1092 | } else if ( recurrenceType == RecurrenceChooser::Yearly ) { |
1085 | qDebug("RecurrenceChooser::Yearly "); | 1093 | qDebug("RecurrenceChooser::Yearly "); |
1086 | int freq = mYearly->frequency(); | 1094 | int freq = mYearly->frequency(); |
1087 | if ( mYearly->byDay() ) { | 1095 | if ( mYearly->byDay() ) { |
1088 | if ( duration != 0 ) { | 1096 | if ( duration != 0 ) { |
1089 | r->setYearly( Recurrence::rYearlyDay, freq, duration ); | 1097 | r->setYearly( Recurrence::rYearlyDay, freq, duration ); |
1090 | } else { | 1098 | } else { |
1091 | r->setYearly( Recurrence::rYearlyDay, freq, endDate ); | 1099 | r->setYearly( Recurrence::rYearlyDay, freq, endDate ); |
1092 | } | 1100 | } |
1093 | r->addYearlyNum( event->dtStart().date().dayOfYear() ); | 1101 | r->addYearlyNum( event->dtStart().date().dayOfYear() ); |
1094 | } else { | 1102 | } else { |
1095 | if ( duration != 0 ) { | 1103 | if ( duration != 0 ) { |
1096 | r->setYearly( Recurrence::rYearlyMonth, freq, duration ); | 1104 | r->setYearly( Recurrence::rYearlyMonth, freq, duration ); |
1097 | } else { | 1105 | } else { |
1098 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); | 1106 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); |
1099 | } | 1107 | } |
1100 | r->addYearlyNum( mYearly->month() ); | 1108 | r->addYearlyNum( mYearly->month() ); |
1101 | } | 1109 | } |
1102 | 1110 | ||
1103 | } | 1111 | } |
1104 | 1112 | ||
1105 | event->setExDates( mExceptions->dates() ); | 1113 | event->setExDates( mExceptions->dates() ); |
1106 | } | 1114 | } |
1107 | } | 1115 | } |
1108 | 1116 | ||
1109 | void KOEditorRecurrence::setDateTimeStr( const QString &str ) | 1117 | void KOEditorRecurrence::setDateTimeStr( const QString &str ) |
1110 | { | 1118 | { |
1111 | mDateTimeLabel->setText( str ); | 1119 | mDateTimeLabel->setText( str ); |
1112 | } | 1120 | } |
1113 | 1121 | ||
1114 | bool KOEditorRecurrence::validateInput() | 1122 | bool KOEditorRecurrence::validateInput() |
1115 | { | 1123 | { |
1116 | // Check input here | 1124 | // Check input here |
1117 | 1125 | ||
1118 | return true; | 1126 | return true; |
1119 | } | 1127 | } |
1120 | 1128 | ||
1121 | void KOEditorRecurrence::showExceptionsDialog() | 1129 | void KOEditorRecurrence::showExceptionsDialog() |
1122 | { | 1130 | { |
1123 | DateList dates = mExceptions->dates(); | 1131 | DateList dates = mExceptions->dates(); |
1124 | int result = mExceptionsDialog->exec(); | 1132 | int result = mExceptionsDialog->exec(); |
1125 | if ( result == QDialog::Rejected ) mExceptions->setDates( dates ); | 1133 | if ( result == QDialog::Rejected ) mExceptions->setDates( dates ); |
1126 | } | 1134 | } |
1127 | 1135 | ||
1128 | void KOEditorRecurrence::showRecurrenceRangeDialog() | 1136 | void KOEditorRecurrence::showRecurrenceRangeDialog() |
1129 | { | 1137 | { |
1130 | int duration = mRecurrenceRange->duration(); | 1138 | int duration = mRecurrenceRange->duration(); |
1131 | QDate endDate = mRecurrenceRange->endDate(); | 1139 | QDate endDate = mRecurrenceRange->endDate(); |
1132 | 1140 | ||
1133 | int result = mRecurrenceRangeDialog->exec(); | 1141 | int result = mRecurrenceRangeDialog->exec(); |
1134 | if ( result == QDialog::Rejected ) { | 1142 | if ( result == QDialog::Rejected ) { |
1135 | mRecurrenceRange->setDuration( duration ); | 1143 | mRecurrenceRange->setDuration( duration ); |
1136 | mRecurrenceRange->setEndDate( endDate ); | 1144 | mRecurrenceRange->setEndDate( endDate ); |
1137 | } | 1145 | } |
1138 | 1146 | ||
1139 | } | 1147 | } |
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h index 2b59085..a15afcb 100644 --- a/korganizer/koeditorrecurrence.h +++ b/korganizer/koeditorrecurrence.h | |||
@@ -149,176 +149,176 @@ class RecurrenceChooser : public QWidget | |||
149 | 149 | ||
150 | QRadioButton *mDailyButton; | 150 | QRadioButton *mDailyButton; |
151 | QRadioButton *mWeeklyButton; | 151 | QRadioButton *mWeeklyButton; |
152 | QRadioButton *mMonthlyButton; | 152 | QRadioButton *mMonthlyButton; |
153 | QRadioButton *mYearlyButton; | 153 | QRadioButton *mYearlyButton; |
154 | }; | 154 | }; |
155 | 155 | ||
156 | class ExceptionsBase | 156 | class ExceptionsBase |
157 | { | 157 | { |
158 | public: | 158 | public: |
159 | virtual void setDefaults( const QDateTime &from ) = 0; | 159 | virtual void setDefaults( const QDateTime &from ) = 0; |
160 | virtual void setDates( const DateList & ) = 0; | 160 | virtual void setDates( const DateList & ) = 0; |
161 | virtual DateList dates() = 0; | 161 | virtual DateList dates() = 0; |
162 | }; | 162 | }; |
163 | 163 | ||
164 | class ExceptionsWidget : public QWidget, public ExceptionsBase | 164 | class ExceptionsWidget : public QWidget, public ExceptionsBase |
165 | { | 165 | { |
166 | Q_OBJECT | 166 | Q_OBJECT |
167 | public: | 167 | public: |
168 | ExceptionsWidget( QWidget *parent = 0, const char *name = 0 ); | 168 | ExceptionsWidget( QWidget *parent = 0, const char *name = 0 ); |
169 | 169 | ||
170 | void setDefaults( const QDateTime &from ); | 170 | void setDefaults( const QDateTime &from ); |
171 | 171 | ||
172 | void setDates( const DateList & ); | 172 | void setDates( const DateList & ); |
173 | DateList dates(); | 173 | DateList dates(); |
174 | 174 | ||
175 | protected slots: | 175 | protected slots: |
176 | void addException(); | 176 | void addException(); |
177 | void changeException(); | 177 | void changeException(); |
178 | void deleteException(); | 178 | void deleteException(); |
179 | 179 | ||
180 | private: | 180 | private: |
181 | KDateEdit *mExceptionDateEdit; | 181 | KDateEdit *mExceptionDateEdit; |
182 | QListBox *mExceptionList; | 182 | QListBox *mExceptionList; |
183 | DateList mExceptionDates; | 183 | DateList mExceptionDates; |
184 | }; | 184 | }; |
185 | 185 | ||
186 | class ExceptionsDialog : public KDialogBase, public ExceptionsBase | 186 | class ExceptionsDialog : public KDialogBase, public ExceptionsBase |
187 | { | 187 | { |
188 | public: | 188 | public: |
189 | ExceptionsDialog( QWidget *parent, const char *name = 0 ); | 189 | ExceptionsDialog( QWidget *parent, const char *name = 0 ); |
190 | 190 | ||
191 | void setDefaults( const QDateTime &from ); | 191 | void setDefaults( const QDateTime &from ); |
192 | 192 | ||
193 | void setDates( const DateList & ); | 193 | void setDates( const DateList & ); |
194 | DateList dates(); | 194 | DateList dates(); |
195 | 195 | ||
196 | private: | 196 | private: |
197 | ExceptionsWidget *mExceptions; | 197 | ExceptionsWidget *mExceptions; |
198 | }; | 198 | }; |
199 | 199 | ||
200 | class RecurrenceRangeBase | 200 | class RecurrenceRangeBase |
201 | { | 201 | { |
202 | public: | 202 | public: |
203 | virtual void setDefaults( const QDateTime &from ) = 0; | 203 | virtual void setDefaults( const QDateTime &from ) = 0; |
204 | 204 | ||
205 | virtual void setDuration( int ) = 0; | 205 | virtual void setDuration( int ) = 0; |
206 | virtual int duration() = 0; | 206 | virtual int duration() = 0; |
207 | 207 | ||
208 | virtual void setEndDate( const QDate & ) = 0; | 208 | virtual void setEndDate( const QDate & ) = 0; |
209 | virtual QDate endDate() = 0; | 209 | virtual QDate endDate() = 0; |
210 | 210 | ||
211 | virtual void setDateTimes( const QDateTime &start, | 211 | virtual void setDateTimes( const QDateTime &start, |
212 | const QDateTime &end = QDateTime() ) = 0; | 212 | const QDateTime &end = QDateTime() ) = 0; |
213 | }; | 213 | }; |
214 | 214 | ||
215 | class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase | 215 | class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase |
216 | { | 216 | { |
217 | Q_OBJECT | 217 | Q_OBJECT |
218 | public: | 218 | public: |
219 | RecurrenceRangeWidget( QWidget *parent = 0, const char *name = 0 ); | 219 | RecurrenceRangeWidget( QWidget *parent = 0, const char *name = 0 ); |
220 | 220 | ||
221 | void setDefaults( const QDateTime &from ); | 221 | void setDefaults( const QDateTime &from ); |
222 | 222 | ||
223 | void setDuration( int ); | 223 | void setDuration( int ); |
224 | int duration(); | 224 | int duration(); |
225 | 225 | ||
226 | void setEndDate( const QDate & ); | 226 | void setEndDate( const QDate & ); |
227 | QDate endDate(); | 227 | QDate endDate(); |
228 | 228 | ||
229 | void setDateTimes( const QDateTime &start, | 229 | void setDateTimes( const QDateTime &start, |
230 | const QDateTime &end = QDateTime() ); | 230 | const QDateTime &end = QDateTime() ); |
231 | 231 | ||
232 | protected slots: | 232 | protected slots: |
233 | void showCurrentRange(); | 233 | void showCurrentRange(); |
234 | 234 | ||
235 | private: | 235 | private: |
236 | QGroupBox *mRangeGroupBox; | 236 | QGroupBox *mRangeGroupBox; |
237 | QLabel *mStartDateLabel; | 237 | QLabel *mStartDateLabel; |
238 | QRadioButton *mNoEndDateButton; | 238 | QRadioButton *mNoEndDateButton; |
239 | QRadioButton *mEndDurationButton; | 239 | QRadioButton *mEndDurationButton; |
240 | QSpinBox *mEndDurationEdit; | 240 | QSpinBox *mEndDurationEdit; |
241 | QRadioButton *mEndDateButton; | 241 | QRadioButton *mEndDateButton; |
242 | KDateEdit *mEndDateEdit; | 242 | KDateEdit *mEndDateEdit; |
243 | }; | 243 | }; |
244 | 244 | ||
245 | class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase | 245 | class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase |
246 | { | 246 | { |
247 | public: | 247 | public: |
248 | RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 ); | 248 | RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 ); |
249 | 249 | ||
250 | void setDefaults( const QDateTime &from ); | 250 | void setDefaults( const QDateTime &from ); |
251 | 251 | ||
252 | void setDuration( int ); | 252 | void setDuration( int ); |
253 | int duration(); | 253 | int duration(); |
254 | 254 | ||
255 | void setEndDate( const QDate & ); | 255 | void setEndDate( const QDate & ); |
256 | QDate endDate(); | 256 | QDate endDate(); |
257 | 257 | ||
258 | void setDateTimes( const QDateTime &start, | 258 | void setDateTimes( const QDateTime &start, |
259 | const QDateTime &end = QDateTime() ); | 259 | const QDateTime &end = QDateTime() ); |
260 | 260 | ||
261 | private: | 261 | private: |
262 | RecurrenceRangeWidget *mRecurrenceRangeWidget; | 262 | RecurrenceRangeWidget *mRecurrenceRangeWidget; |
263 | }; | 263 | }; |
264 | 264 | ||
265 | class KOEditorRecurrence : public QWidget | 265 | class KOEditorRecurrence : public QWidget |
266 | { | 266 | { |
267 | Q_OBJECT | 267 | Q_OBJECT |
268 | public: | 268 | public: |
269 | KOEditorRecurrence ( QWidget *parent = 0, const char *name = 0 ); | 269 | KOEditorRecurrence ( QWidget *parent = 0, const char *name = 0 ); |
270 | virtual ~KOEditorRecurrence(); | 270 | virtual ~KOEditorRecurrence(); |
271 | 271 | ||
272 | enum { Daily, Weekly, Monthly, Yearly }; | 272 | enum { Daily, Weekly, Monthly, Yearly }; |
273 | 273 | ||
274 | /** Set widgets to default values */ | 274 | /** Set widgets to default values */ |
275 | void setDefaults( QDateTime from, QDateTime to, bool allday ); | 275 | void setDefaults( QDateTime from, QDateTime to, bool allday ); |
276 | /** Read event object and setup widgets accordingly */ | 276 | /** Read event object and setup widgets accordingly */ |
277 | void readEvent( Event * ); | 277 | void readEvent( Incidence * ); |
278 | /** Write event settings to event object */ | 278 | /** Write event settings to event object */ |
279 | void writeEvent( Event * ); | 279 | void writeEvent( Incidence * ); |
280 | 280 | ||
281 | /** Check if the input is valid. */ | 281 | /** Check if the input is valid. */ |
282 | bool validateInput(); | 282 | bool validateInput(); |
283 | 283 | ||
284 | public slots: | 284 | public slots: |
285 | void setEnabled( bool ); | 285 | void setEnabled( bool ); |
286 | void setDateTimes( QDateTime start, QDateTime end ); | 286 | void setDateTimes( QDateTime start, QDateTime end ); |
287 | void setDateTimeStr( const QString & ); | 287 | void setDateTimeStr( const QString & ); |
288 | 288 | ||
289 | signals: | 289 | signals: |
290 | void dateTimesChanged( QDateTime start, QDateTime end ); | 290 | void dateTimesChanged( QDateTime start, QDateTime end ); |
291 | 291 | ||
292 | protected slots: | 292 | protected slots: |
293 | void showCurrentRule( int ); | 293 | void showCurrentRule( int ); |
294 | void showExceptionsDialog(); | 294 | void showExceptionsDialog(); |
295 | void showRecurrenceRangeDialog(); | 295 | void showRecurrenceRangeDialog(); |
296 | 296 | ||
297 | private: | 297 | private: |
298 | QCheckBox *mEnabledCheck; | 298 | QCheckBox *mEnabledCheck; |
299 | 299 | ||
300 | QGroupBox *mTimeGroupBox; | 300 | QGroupBox *mTimeGroupBox; |
301 | QLabel *mDateTimeLabel; | 301 | QLabel *mDateTimeLabel; |
302 | 302 | ||
303 | QGroupBox *mRuleBox; | 303 | QGroupBox *mRuleBox; |
304 | QWidgetStack *mRuleStack; | 304 | QWidgetStack *mRuleStack; |
305 | RecurrenceChooser *mRecurrenceChooser; | 305 | RecurrenceChooser *mRecurrenceChooser; |
306 | 306 | ||
307 | RecurDaily *mDaily; | 307 | RecurDaily *mDaily; |
308 | RecurWeekly *mWeekly; | 308 | RecurWeekly *mWeekly; |
309 | RecurMonthly *mMonthly; | 309 | RecurMonthly *mMonthly; |
310 | RecurYearly *mYearly; | 310 | RecurYearly *mYearly; |
311 | 311 | ||
312 | RecurrenceRangeBase *mRecurrenceRange; | 312 | RecurrenceRangeBase *mRecurrenceRange; |
313 | RecurrenceRangeWidget *mRecurrenceRangeWidget; | 313 | RecurrenceRangeWidget *mRecurrenceRangeWidget; |
314 | RecurrenceRangeDialog *mRecurrenceRangeDialog; | 314 | RecurrenceRangeDialog *mRecurrenceRangeDialog; |
315 | QPushButton *mRecurrenceRangeButton; | 315 | QPushButton *mRecurrenceRangeButton; |
316 | 316 | ||
317 | ExceptionsBase *mExceptions; | 317 | ExceptionsBase *mExceptions; |
318 | ExceptionsDialog *mExceptionsDialog; | 318 | ExceptionsDialog *mExceptionsDialog; |
319 | ExceptionsWidget *mExceptionsWidget; | 319 | ExceptionsWidget *mExceptionsWidget; |
320 | QPushButton *mExceptionsButton; | 320 | QPushButton *mExceptionsButton; |
321 | 321 | ||
322 | }; | 322 | }; |
323 | 323 | ||
324 | #endif | 324 | #endif |
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 70dfbd1..069dda8 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp | |||
@@ -1,383 +1,426 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1997, 1998 Preston Brown | 3 | Copyright (c) 1997, 1998 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qtooltip.h> | 25 | #include <qtooltip.h> |
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qhbox.h> | 29 | #include <qhbox.h> |
30 | #include <qdir.h> | 30 | #include <qdir.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | #include <qtabwidget.h> | ||
33 | 34 | ||
34 | #include <kiconloader.h> | 35 | #include <kiconloader.h> |
35 | #include <klocale.h> | 36 | #include <klocale.h> |
36 | #include <kfiledialog.h> | 37 | #include <kfiledialog.h> |
37 | #include <kstandarddirs.h> | 38 | #include <kstandarddirs.h> |
38 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
39 | 40 | ||
40 | #include <libkdepim/categoryselectdialog.h> | 41 | #include <libkdepim/categoryselectdialog.h> |
41 | #include <libkcal/calendarlocal.h> | 42 | #include <libkcal/calendarlocal.h> |
42 | #include <libkcal/calendarresources.h> | 43 | #include <libkcal/calendarresources.h> |
43 | #include <libkcal/resourcecalendar.h> | 44 | #include <libkcal/resourcecalendar.h> |
44 | #include <libkcal/icalformat.h> | 45 | #include <libkcal/icalformat.h> |
45 | #include <kresources/resourceselectdialog.h> | 46 | #include <kresources/resourceselectdialog.h> |
47 | #include <libkdepim/kdateedit.h> | ||
46 | 48 | ||
47 | #include "koprefs.h" | 49 | #include "koprefs.h" |
48 | #include "kolocationbox.h" | 50 | #include "kolocationbox.h" |
49 | 51 | ||
50 | #include "kotodoeditor.h" | 52 | #include "kotodoeditor.h" |
51 | extern int globalFlagBlockAgenda; | 53 | extern int globalFlagBlockAgenda; |
52 | 54 | ||
53 | KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : | 55 | KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : |
54 | KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) | 56 | KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) |
55 | { | 57 | { |
56 | mTodo = 0; | 58 | mTodo = 0; |
57 | mRelatedTodo = 0; | 59 | mRelatedTodo = 0; |
58 | findButton(User1)->hide(); | 60 | findButton(User1)->hide(); |
59 | init(); | 61 | init(); |
60 | } | 62 | } |
61 | 63 | ||
62 | KOTodoEditor::~KOTodoEditor() | 64 | KOTodoEditor::~KOTodoEditor() |
63 | { | 65 | { |
64 | emit dialogClose( mTodo ); | 66 | emit dialogClose( mTodo ); |
65 | } | 67 | } |
66 | 68 | ||
67 | void KOTodoEditor::init() | 69 | void KOTodoEditor::init() |
68 | { | 70 | { |
69 | setupGeneral(); | 71 | setupGeneral(); |
70 | setupAttendeesTab(); | 72 | setupAttendeesTab(); |
73 | setupRecurrence(); | ||
74 | connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); | ||
71 | } | 75 | } |
76 | void KOTodoEditor::setupRecurrence() | ||
77 | { | ||
78 | QFrame *topFrame = addPage( i18n("Recurrence") ); | ||
79 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); | ||
80 | |||
81 | mRecurrence = new KOEditorRecurrence( topFrame ); | ||
82 | topLayout->addWidget( mRecurrence ); | ||
83 | } | ||
84 | |||
72 | void KOTodoEditor::setCategories( QString s ) | 85 | void KOTodoEditor::setCategories( QString s ) |
73 | { | 86 | { |
74 | mGeneral->setCategories(s); | 87 | mGeneral->setCategories(s); |
75 | } | 88 | } |
76 | void KOTodoEditor::setSecrecy( int sec ) | 89 | void KOTodoEditor::setSecrecy( int sec ) |
77 | { | 90 | { |
78 | mGeneral->setSecrecy( sec ); | 91 | mGeneral->setSecrecy( sec ); |
79 | } | 92 | } |
80 | void KOTodoEditor::reload() | 93 | void KOTodoEditor::reload() |
81 | { | 94 | { |
82 | if ( mTodo ) readTodo( mTodo ); | 95 | if ( mTodo ) readTodo( mTodo ); |
83 | } | 96 | } |
84 | 97 | ||
85 | void KOTodoEditor::setupGeneral() | 98 | void KOTodoEditor::setupGeneral() |
86 | { | 99 | { |
87 | mGeneral = new KOEditorGeneralTodo(this); | 100 | mGeneral = new KOEditorGeneralTodo(this); |
88 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); | 101 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); |
89 | 102 | ||
90 | // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); | 103 | // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); |
91 | //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), | 104 | //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), |
92 | // mGeneral,SLOT(setCategories(const QString &))); | 105 | // mGeneral,SLOT(setCategories(const QString &))); |
93 | 106 | ||
94 | if (KOPrefs::instance()->mCompactDialogs) { | 107 | if (KOPrefs::instance()->mCompactDialogs) { |
95 | QFrame *topFrame = addPage(i18n("General")); | 108 | QFrame *topFrame = addPage(i18n("General")); |
96 | 109 | ||
97 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 110 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); |
98 | if ( QApplication::desktop()->width() < 480 ) { | 111 | if ( QApplication::desktop()->width() < 480 ) { |
99 | topLayout->setMargin(1); | 112 | topLayout->setMargin(1); |
100 | topLayout->setSpacing(1); | 113 | topLayout->setSpacing(1); |
101 | } else { | 114 | } else { |
102 | topLayout->setMargin(marginHint()-1); | 115 | topLayout->setMargin(marginHint()-1); |
103 | topLayout->setSpacing(spacingHint()-1); | 116 | topLayout->setSpacing(spacingHint()-1); |
104 | } | 117 | } |
105 | mGeneral->initHeader(topFrame,topLayout); | 118 | mGeneral->initHeader(topFrame,topLayout); |
106 | mGeneral->initTime(topFrame,topLayout); | 119 | mGeneral->initTime(topFrame,topLayout); |
107 | mGeneral->initAlarm(topFrame,topLayout); | 120 | mGeneral->initAlarm(topFrame,topLayout); |
108 | mGeneral->enableAlarm( false ); | 121 | mGeneral->enableAlarm( false ); |
109 | 122 | ||
110 | 123 | ||
111 | QBoxLayout *priorityLayout; | 124 | QBoxLayout *priorityLayout; |
112 | if ( QApplication::desktop()->width() < 500 ) | 125 | if ( QApplication::desktop()->width() < 500 ) |
113 | priorityLayout = new QVBoxLayout( topLayout ); | 126 | priorityLayout = new QVBoxLayout( topLayout ); |
114 | else | 127 | else |
115 | priorityLayout = new QHBoxLayout( topLayout ); | 128 | priorityLayout = new QHBoxLayout( topLayout ); |
116 | QWidget* prioWidget = new QWidget (topFrame); | 129 | QWidget* prioWidget = new QWidget (topFrame); |
117 | priorityLayout->addWidget( prioWidget ); | 130 | priorityLayout->addWidget( prioWidget ); |
118 | QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); | 131 | QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); |
119 | 132 | ||
120 | 133 | ||
121 | QIconSet icon; | 134 | QIconSet icon; |
122 | if ( QApplication::desktop()->width() < 321 ) | 135 | if ( QApplication::desktop()->width() < 321 ) |
123 | icon = SmallIcon("fileexport16"); | 136 | icon = SmallIcon("fileexport16"); |
124 | else | 137 | else |
125 | icon = SmallIcon("fileexport"); | 138 | icon = SmallIcon("fileexport"); |
126 | QPushButton * saveTemplate = new QPushButton( prioWidget); | 139 | QPushButton * saveTemplate = new QPushButton( prioWidget); |
127 | saveTemplate->setIconSet (icon ) ; | 140 | saveTemplate->setIconSet (icon ) ; |
128 | int size = saveTemplate->sizeHint().height(); | 141 | int size = saveTemplate->sizeHint().height(); |
129 | saveTemplate->setFixedSize( size, size ); | 142 | saveTemplate->setFixedSize( size, size ); |
130 | if ( QApplication::desktop()->width() < 321 ) | 143 | if ( QApplication::desktop()->width() < 321 ) |
131 | icon = SmallIcon("fileimport16"); | 144 | icon = SmallIcon("fileimport16"); |
132 | else | 145 | else |
133 | icon = SmallIcon("fileimport"); | 146 | icon = SmallIcon("fileimport"); |
134 | QPushButton * loadTemplate = new QPushButton( prioWidget); | 147 | QPushButton * loadTemplate = new QPushButton( prioWidget); |
135 | loadTemplate->setIconSet (icon ) ; | 148 | loadTemplate->setIconSet (icon ) ; |
136 | loadTemplate->setFixedSize( size, size ); | 149 | loadTemplate->setFixedSize( size, size ); |
137 | 150 | ||
138 | priorityLayout2->addWidget(loadTemplate); | 151 | priorityLayout2->addWidget(loadTemplate); |
139 | priorityLayout2->addWidget(saveTemplate); | 152 | priorityLayout2->addWidget(saveTemplate); |
140 | mGeneral->initPriority(prioWidget,priorityLayout2); | 153 | mGeneral->initPriority(prioWidget,priorityLayout2); |
141 | mGeneral->initCategories( topFrame, priorityLayout ); | 154 | mGeneral->initCategories( topFrame, priorityLayout ); |
142 | topLayout->addStretch(1); | 155 | topLayout->addStretch(1); |
143 | 156 | ||
144 | QFrame *topFrame2 = addPage(i18n("Details")); | 157 | QFrame *topFrame2 = addPage(i18n("Details")); |
145 | 158 | ||
146 | QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); | 159 | QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); |
147 | topLayout2->setMargin(marginHint()); | 160 | topLayout2->setMargin(marginHint()); |
148 | topLayout2->setSpacing(spacingHint()); | 161 | topLayout2->setSpacing(spacingHint()); |
149 | 162 | ||
150 | QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); | 163 | QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); |
151 | mGeneral->initCompletion(topFrame2,completionLayout); | 164 | mGeneral->initCompletion(topFrame2,completionLayout); |
152 | 165 | ||
153 | 166 | ||
154 | mGeneral->initSecrecy( topFrame2, topLayout2 ); | 167 | mGeneral->initSecrecy( topFrame2, topLayout2 ); |
155 | mGeneral->initDescription(topFrame2,topLayout2); | 168 | mGeneral->initDescription(topFrame2,topLayout2); |
156 | 169 | ||
157 | // QHBox * hb = new QHBox ( topFrame2 ); | 170 | // QHBox * hb = new QHBox ( topFrame2 ); |
158 | // topLayout2->addWidget(hb); | 171 | // topLayout2->addWidget(hb); |
159 | // hb->setSpacing( 3 ); | 172 | // hb->setSpacing( 3 ); |
160 | 173 | ||
161 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 174 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
162 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 175 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
163 | 176 | ||
164 | } else { | 177 | } else { |
165 | QFrame *topFrame = addPage(i18n("General")); | 178 | QFrame *topFrame = addPage(i18n("General")); |
166 | 179 | ||
167 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 180 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); |
168 | topLayout->setSpacing(spacingHint()); | 181 | topLayout->setSpacing(spacingHint()); |
169 | 182 | ||
170 | mGeneral->initHeader(topFrame,topLayout); | 183 | mGeneral->initHeader(topFrame,topLayout); |
171 | mGeneral->initTime(topFrame,topLayout); | 184 | mGeneral->initTime(topFrame,topLayout); |
172 | mGeneral->initStatus(topFrame,topLayout); | 185 | mGeneral->initStatus(topFrame,topLayout); |
173 | QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); | 186 | QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); |
174 | mGeneral->initAlarm(topFrame,alarmLineLayout); | 187 | mGeneral->initAlarm(topFrame,alarmLineLayout); |
175 | mGeneral->initDescription(topFrame,topLayout); | 188 | mGeneral->initDescription(topFrame,topLayout); |
176 | QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); | 189 | QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); |
177 | mGeneral->initCategories( topFrame, detailsLayout ); | 190 | mGeneral->initCategories( topFrame, detailsLayout ); |
178 | mGeneral->initSecrecy( topFrame, detailsLayout ); | 191 | mGeneral->initSecrecy( topFrame, detailsLayout ); |
179 | } | 192 | } |
180 | mGeneral->finishSetup(); | 193 | mGeneral->finishSetup(); |
181 | 194 | ||
182 | } | 195 | } |
183 | 196 | ||
184 | void KOTodoEditor::editTodo(Todo *todo, bool editDescription) | 197 | void KOTodoEditor::editTodo(Todo *todo, bool editDescription) |
185 | { | 198 | { |
186 | //init(); | 199 | //init(); |
187 | 200 | ||
188 | mTodo = todo; | 201 | mTodo = todo; |
189 | readTodo(mTodo); | 202 | readTodo(mTodo); |
190 | if ( editDescription ) { | 203 | if ( editDescription ) { |
191 | showPage( 1 ); | 204 | showPage( 1 ); |
192 | mGeneral->setFocusOn( 1 ); | 205 | mGeneral->setFocusOn( 1 ); |
193 | } else { | 206 | } else { |
194 | showPage( 0 ); | 207 | showPage( 0 ); |
195 | mGeneral->setFocusOn( 2 ); | 208 | mGeneral->setFocusOn( 2 ); |
196 | } | 209 | } |
210 | checkRecurrence(); | ||
197 | } | 211 | } |
198 | 212 | ||
199 | void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) | 213 | void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) |
200 | { | 214 | { |
201 | //init(); | 215 | //init(); |
202 | 216 | ||
203 | mTodo = 0; | 217 | mTodo = 0; |
204 | setDefaults(due,relatedTodo,allDay); | 218 | setDefaults(due,relatedTodo,allDay); |
205 | } | 219 | } |
206 | 220 | ||
207 | void KOTodoEditor::loadDefaults() | 221 | void KOTodoEditor::loadDefaults() |
208 | { | 222 | { |
209 | setDefaults(QDateTime::currentDateTime().addDays(7),0,false); | 223 | setDefaults(QDateTime::currentDateTime().addDays(7),0,false); |
210 | } | 224 | } |
211 | 225 | ||
212 | bool KOTodoEditor::processInput( bool emitTime ) | 226 | bool KOTodoEditor::processInput( bool emitTime ) |
213 | { | 227 | { |
214 | if (!validateInput()) return false; | 228 | if (!validateInput()) return false; |
215 | 229 | ||
216 | Todo *todo = 0; | 230 | Todo *todo = 0; |
217 | 231 | ||
218 | if (mTodo) todo = mTodo; | 232 | if (mTodo) todo = mTodo; |
219 | else { | 233 | else { |
220 | todo = new Todo; | 234 | todo = new Todo; |
221 | todo->setOrganizer(KOPrefs::instance()->email()); | 235 | todo->setOrganizer(KOPrefs::instance()->email()); |
222 | } | 236 | } |
223 | 237 | ||
224 | writeTodo(todo); | 238 | writeTodo(todo); |
225 | if ( emitTime ) { | 239 | if ( emitTime ) { |
226 | globalFlagBlockAgenda = 1; | 240 | globalFlagBlockAgenda = 1; |
227 | emit showAgendaView( false ); | 241 | emit showAgendaView( false ); |
228 | if ( todo->hasDueDate() ) | 242 | if ( todo->hasDueDate() ) |
229 | emit jumpToTime( todo->dtDue().date() ); | 243 | emit jumpToTime( todo->dtDue().date() ); |
230 | globalFlagBlockAgenda = 2; | 244 | globalFlagBlockAgenda = 2; |
231 | } | 245 | } |
232 | if (mTodo) { | 246 | if (mTodo) { |
233 | todo->setRevision(todo->revision()+1); | 247 | todo->setRevision(todo->revision()+1); |
234 | emit todoChanged(todo); | 248 | emit todoChanged(todo); |
235 | } else { | 249 | } else { |
236 | mCalendar->addTodo(todo); | 250 | mCalendar->addTodo(todo); |
237 | mTodo = todo; | 251 | mTodo = todo; |
238 | emit todoAdded(todo); | 252 | emit todoAdded(todo); |
239 | } | 253 | } |
240 | 254 | ||
241 | return true; | 255 | return true; |
242 | } | 256 | } |
243 | 257 | ||
244 | void KOTodoEditor::deleteTodo() | 258 | void KOTodoEditor::deleteTodo() |
245 | { | 259 | { |
246 | if (mTodo) { | 260 | if (mTodo) { |
247 | if (KOPrefs::instance()->mConfirm) { | 261 | if (KOPrefs::instance()->mConfirm) { |
248 | switch (msgItemDelete()) { | 262 | switch (msgItemDelete()) { |
249 | case KMessageBox::Continue: // OK | 263 | case KMessageBox::Continue: // OK |
250 | emit todoToBeDeleted(mTodo); | 264 | emit todoToBeDeleted(mTodo); |
251 | emit dialogClose(mTodo); | 265 | emit dialogClose(mTodo); |
252 | mCalendar->deleteTodo(mTodo); | 266 | mCalendar->deleteTodo(mTodo); |
253 | emit todoDeleted(); | 267 | emit todoDeleted(); |
254 | reject(); | 268 | reject(); |
255 | break; | 269 | break; |
256 | } | 270 | } |
257 | } | 271 | } |
258 | else { | 272 | else { |
259 | emit todoToBeDeleted(mTodo); | 273 | emit todoToBeDeleted(mTodo); |
260 | emit dialogClose(mTodo); | 274 | emit dialogClose(mTodo); |
261 | mCalendar->deleteTodo(mTodo); | 275 | mCalendar->deleteTodo(mTodo); |
262 | emit todoDeleted(); | 276 | emit todoDeleted(); |
263 | reject(); | 277 | reject(); |
264 | } | 278 | } |
265 | } else { | 279 | } else { |
266 | reject(); | 280 | reject(); |
267 | } | 281 | } |
268 | } | 282 | } |
269 | 283 | ||
270 | void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) | 284 | void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) |
271 | { | 285 | { |
272 | mRelatedTodo = relatedEvent; | 286 | mRelatedTodo = relatedEvent; |
273 | 287 | ||
274 | mGeneral->setDefaults(due,allDay); | 288 | mGeneral->setDefaults(due,allDay); |
275 | mDetails->setDefaults(); | 289 | mDetails->setDefaults(); |
276 | showPage( 0 ); | 290 | showPage( 0 ); |
277 | if ( mRelatedTodo ) { | 291 | if ( mRelatedTodo ) { |
278 | mGeneral->setCategories (mRelatedTodo->categoriesStr ()); | 292 | mGeneral->setCategories (mRelatedTodo->categoriesStr ()); |
279 | mGeneral->setSecrecy (mRelatedTodo->secrecy ()); | 293 | mGeneral->setSecrecy (mRelatedTodo->secrecy ()); |
280 | if ( mRelatedTodo->priority() < 3 ) | 294 | if ( mRelatedTodo->priority() < 3 ) |
281 | mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1); | 295 | mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1); |
282 | mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": "); | 296 | mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": "); |
283 | int len = mRelatedTodo->summary().length(); | 297 | int len = mRelatedTodo->summary().length(); |
284 | mGeneral->mSummaryEdit->lineEdit()->setFocus(); | 298 | mGeneral->mSummaryEdit->lineEdit()->setFocus(); |
285 | mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); | 299 | mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); |
286 | mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); | 300 | mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); |
287 | 301 | ||
288 | } else | 302 | } else |
289 | mGeneral->setFocusOn( 2 ); | 303 | mGeneral->setFocusOn( 2 ); |
304 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); | ||
305 | mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); | ||
306 | } | ||
307 | void KOTodoEditor::checkRecurrence() | ||
308 | { | ||
309 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { | ||
310 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); | ||
311 | |||
312 | if ( mTodo ) | ||
313 | mRecurrence->readEvent( mTodo ); | ||
314 | else { | ||
315 | bool time = mGeneral->mTimeButton->isChecked(); | ||
316 | QDateTime from,to; | ||
317 | if ( time ) { | ||
318 | to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; | ||
319 | from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; | ||
320 | } else { | ||
321 | to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; | ||
322 | from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; | ||
323 | } | ||
324 | mRecurrence->setDefaults(from,to,!time); | ||
325 | } | ||
326 | } else { | ||
327 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); | ||
328 | mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); | ||
329 | } | ||
290 | } | 330 | } |
291 | |||
292 | void KOTodoEditor::readTodo(Todo *todo) | 331 | void KOTodoEditor::readTodo(Todo *todo) |
293 | { | 332 | { |
294 | mGeneral->readTodo(todo); | 333 | mGeneral->readTodo(todo); |
295 | mDetails->readEvent(todo); | 334 | mDetails->readEvent(todo); |
296 | mRelatedTodo = 0;//todo->relatedTo(); | 335 | mRelatedTodo = 0;//todo->relatedTo(); |
297 | // categories | 336 | // categories |
298 | // mCategoryDialog->setSelected(todo->categories()); | 337 | // mCategoryDialog->setSelected(todo->categories()); |
299 | 338 | ||
300 | // We should handle read-only events here. | 339 | // We should handle read-only events here. |
301 | } | 340 | } |
302 | 341 | ||
303 | void KOTodoEditor::writeTodo(Todo *event) | 342 | void KOTodoEditor::writeTodo(Todo *event) |
304 | { | 343 | { |
305 | mGeneral->writeTodo(event); | 344 | mGeneral->writeTodo(event); |
306 | mDetails->writeEvent(event); | 345 | mDetails->writeEvent(event); |
307 | 346 | ||
308 | // set related event, i.e. parent to-do in this case. | 347 | // set related event, i.e. parent to-do in this case. |
309 | if (mRelatedTodo) { | 348 | if (mRelatedTodo) { |
310 | event->setRelatedTo(mRelatedTodo); | 349 | event->setRelatedTo(mRelatedTodo); |
311 | } | 350 | } |
351 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { | ||
352 | mRecurrence->writeEvent(event); | ||
353 | } else | ||
354 | event->recurrence()->unsetRecurs(); | ||
312 | } | 355 | } |
313 | 356 | ||
314 | bool KOTodoEditor::validateInput() | 357 | bool KOTodoEditor::validateInput() |
315 | { | 358 | { |
316 | if (!mGeneral->validateInput()) return false; | 359 | if (!mGeneral->validateInput()) return false; |
317 | if (!mDetails->validateInput()) return false; | 360 | if (!mDetails->validateInput()) return false; |
318 | return true; | 361 | return true; |
319 | } | 362 | } |
320 | 363 | ||
321 | int KOTodoEditor::msgItemDelete() | 364 | int KOTodoEditor::msgItemDelete() |
322 | { | 365 | { |
323 | return KMessageBox::warningContinueCancel(this, | 366 | return KMessageBox::warningContinueCancel(this, |
324 | i18n("This item will be permanently deleted."), | 367 | i18n("This item will be permanently deleted."), |
325 | i18n("KOrganizer Confirmation"),i18n("Delete")); | 368 | i18n("KOrganizer Confirmation"),i18n("Delete")); |
326 | } | 369 | } |
327 | 370 | ||
328 | void KOTodoEditor::modified (int modification) | 371 | void KOTodoEditor::modified (int modification) |
329 | { | 372 | { |
330 | if (modification == KOGlobals::CATEGORY_MODIFIED || | 373 | if (modification == KOGlobals::CATEGORY_MODIFIED || |
331 | KOGlobals::UNKNOWN_MODIFIED == modification ) | 374 | KOGlobals::UNKNOWN_MODIFIED == modification ) |
332 | // mCategoryDialog->setSelected (mTodo->categories ()); | 375 | // mCategoryDialog->setSelected (mTodo->categories ()); |
333 | mGeneral->modified (mTodo, modification); | 376 | mGeneral->modified (mTodo, modification); |
334 | 377 | ||
335 | } | 378 | } |
336 | 379 | ||
337 | void KOTodoEditor::slotLoadTemplate() | 380 | void KOTodoEditor::slotLoadTemplate() |
338 | { | 381 | { |
339 | 382 | ||
340 | QString fileName =locateLocal( "templates", "todos" ); | 383 | QString fileName =locateLocal( "templates", "todos" ); |
341 | QDir t_dir; | 384 | QDir t_dir; |
342 | if ( !t_dir.exists(fileName) ) | 385 | if ( !t_dir.exists(fileName) ) |
343 | t_dir.mkdir ( fileName ); | 386 | t_dir.mkdir ( fileName ); |
344 | fileName += "/todo"; | 387 | fileName += "/todo"; |
345 | fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this ); | 388 | fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this ); |
346 | if ( fileName.length() == 0 ) | 389 | if ( fileName.length() == 0 ) |
347 | return; | 390 | return; |
348 | CalendarLocal cal; | 391 | CalendarLocal cal; |
349 | ICalFormat format; | 392 | ICalFormat format; |
350 | if ( !format.load( &cal, fileName ) ) { | 393 | if ( !format.load( &cal, fileName ) ) { |
351 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 394 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
352 | .arg( fileName ) ); | 395 | .arg( fileName ) ); |
353 | return ; | 396 | return ; |
354 | } | 397 | } |
355 | QPtrList<Todo> todos = cal.todos(); | 398 | QPtrList<Todo> todos = cal.todos(); |
356 | Todo * todo = todos.first(); | 399 | Todo * todo = todos.first(); |
357 | if ( !todo ) { | 400 | if ( !todo ) { |
358 | KMessageBox::error( this, | 401 | KMessageBox::error( this, |
359 | i18n("Template does not\ncontain a valid Todo.")); | 402 | i18n("Template does not\ncontain a valid Todo.")); |
360 | } else { | 403 | } else { |
361 | readTodo( todo ); | 404 | readTodo( todo ); |
362 | } | 405 | } |
363 | 406 | ||
364 | } | 407 | } |
365 | 408 | ||
366 | void KOTodoEditor::slotSaveTemplate() | 409 | void KOTodoEditor::slotSaveTemplate() |
367 | { | 410 | { |
368 | QString fileName =locateLocal( "templates", "todos" ); | 411 | QString fileName =locateLocal( "templates", "todos" ); |
369 | QDir t_dir; | 412 | QDir t_dir; |
370 | if ( !t_dir.exists(fileName) ) | 413 | if ( !t_dir.exists(fileName) ) |
371 | t_dir.mkdir ( fileName ); | 414 | t_dir.mkdir ( fileName ); |
372 | fileName += "/todo"; | 415 | fileName += "/todo"; |
373 | fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this ); | 416 | fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this ); |
374 | if ( fileName.length() > 0 ) | 417 | if ( fileName.length() > 0 ) |
375 | saveTemplate( fileName ); | 418 | saveTemplate( fileName ); |
376 | } | 419 | } |
377 | 420 | ||
378 | void KOTodoEditor::saveTemplate( const QString &templateName ) | 421 | void KOTodoEditor::saveTemplate( const QString &templateName ) |
379 | { | 422 | { |
380 | Todo *todo = new Todo; | 423 | Todo *todo = new Todo; |
381 | writeTodo( todo ); | 424 | writeTodo( todo ); |
382 | saveAsTemplate( todo, templateName ); | 425 | saveAsTemplate( todo, templateName ); |
383 | } | 426 | } |
diff --git a/korganizer/kotodoeditor.h b/korganizer/kotodoeditor.h index 2657bd8..1b5e3b4 100644 --- a/korganizer/kotodoeditor.h +++ b/korganizer/kotodoeditor.h | |||
@@ -1,102 +1,106 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1997, 1998 Preston Brown | 3 | Copyright (c) 1997, 1998 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef _KOTODOEDITOR_H | 24 | #ifndef _KOTODOEDITOR_H |
25 | #define _KOTODOEDITOR_H | 25 | #define _KOTODOEDITOR_H |
26 | 26 | ||
27 | #include <libkcal/calendar.h> | 27 | #include <libkcal/calendar.h> |
28 | 28 | ||
29 | #include "koeditorgeneraltodo.h" | 29 | #include "koeditorgeneraltodo.h" |
30 | #include "koeditordetails.h" | 30 | #include "koeditordetails.h" |
31 | #include "koincidenceeditor.h" | 31 | #include "koincidenceeditor.h" |
32 | #include "koeditorrecurrence.h" | ||
32 | 33 | ||
33 | class QDateTime; | 34 | class QDateTime; |
34 | 35 | ||
35 | /** | 36 | /** |
36 | This class provides a dialog for editing a Todo. | 37 | This class provides a dialog for editing a Todo. |
37 | */ | 38 | */ |
38 | class KOTodoEditor : public KOIncidenceEditor | 39 | class KOTodoEditor : public KOIncidenceEditor |
39 | { | 40 | { |
40 | Q_OBJECT | 41 | Q_OBJECT |
41 | public: | 42 | public: |
42 | /** | 43 | /** |
43 | Constructs a new todo editor. | 44 | Constructs a new todo editor. |
44 | */ | 45 | */ |
45 | KOTodoEditor( Calendar *calendar, QWidget *parent ); | 46 | KOTodoEditor( Calendar *calendar, QWidget *parent ); |
46 | virtual ~KOTodoEditor(); | 47 | virtual ~KOTodoEditor(); |
47 | 48 | ||
48 | void init(); | 49 | void init(); |
49 | 50 | ||
50 | void reload(); | 51 | void reload(); |
51 | void setSecrecy( int sec ); | 52 | void setSecrecy( int sec ); |
52 | /** | 53 | /** |
53 | Clear editor for new todo, and preset the dates and times with hint. | 54 | Clear editor for new todo, and preset the dates and times with hint. |
54 | */ | 55 | */ |
55 | void newTodo(QDateTime due,Todo *relatedTodo=0,bool allDay=false); | 56 | void newTodo(QDateTime due,Todo *relatedTodo=0,bool allDay=false); |
56 | 57 | ||
57 | /** Edit an existing todo. */ | 58 | /** Edit an existing todo. */ |
58 | void editTodo(Todo * ,bool editDescription = false ); | 59 | void editTodo(Todo * ,bool editDescription = false ); |
59 | 60 | ||
60 | /** Set widgets to default values */ | 61 | /** Set widgets to default values */ |
61 | void setDefaults(QDateTime due,Todo *relatedTodo,bool allDay); | 62 | void setDefaults(QDateTime due,Todo *relatedTodo,bool allDay); |
62 | /** Read event object and setup widgets accordingly */ | 63 | /** Read event object and setup widgets accordingly */ |
63 | void readTodo(Todo *); | 64 | void readTodo(Todo *); |
64 | /** Write event settings to event object */ | 65 | /** Write event settings to event object */ |
65 | void writeTodo(Todo *); | 66 | void writeTodo(Todo *); |
66 | 67 | ||
67 | /** Check if the input is valid. */ | 68 | /** Check if the input is valid. */ |
68 | bool validateInput(); | 69 | bool validateInput(); |
69 | /** Process user input and create or update event. Returns false if input | 70 | /** Process user input and create or update event. Returns false if input |
70 | * is not valid */ | 71 | * is not valid */ |
71 | bool processInput( bool ); | 72 | bool processInput( bool ); |
72 | 73 | ||
73 | /** This todo has been modified externally */ | 74 | /** This todo has been modified externally */ |
74 | void modified (int); | 75 | void modified (int); |
75 | void setCategories( QString s ); | 76 | void setCategories( QString s ); |
76 | signals: | 77 | signals: |
77 | void todoChanged(Todo *); | 78 | void todoChanged(Todo *); |
78 | void todoAdded(Todo *); | 79 | void todoAdded(Todo *); |
79 | void todoToBeDeleted(Todo *); | 80 | void todoToBeDeleted(Todo *); |
80 | void todoDeleted(); | 81 | void todoDeleted(); |
81 | 82 | ||
82 | protected slots: | 83 | protected slots: |
83 | void loadDefaults(); | 84 | void loadDefaults(); |
84 | void deleteTodo(); | 85 | void deleteTodo(); |
86 | void checkRecurrence(); | ||
85 | 87 | ||
86 | void slotLoadTemplate(); | 88 | void slotLoadTemplate(); |
87 | void slotSaveTemplate(); | 89 | void slotSaveTemplate(); |
88 | void saveTemplate( const QString & ); | 90 | void saveTemplate( const QString & ); |
89 | 91 | ||
90 | protected: | 92 | protected: |
91 | void setupGeneral(); | 93 | void setupGeneral(); |
92 | int msgItemDelete(); | 94 | int msgItemDelete(); |
95 | void setupRecurrence(); | ||
93 | 96 | ||
94 | private: | 97 | private: |
95 | Todo *mTodo; | 98 | Todo *mTodo; |
96 | 99 | ||
97 | Incidence *mRelatedTodo; | 100 | Incidence *mRelatedTodo; |
98 | 101 | ||
99 | KOEditorGeneralTodo *mGeneral; | 102 | KOEditorGeneralTodo *mGeneral; |
103 | KOEditorRecurrence *mRecurrence; | ||
100 | }; | 104 | }; |
101 | 105 | ||
102 | #endif | 106 | #endif |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index bd13132..bb9cb29 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -275,257 +275,260 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | |||
275 | 275 | ||
276 | // creation date | 276 | // creation date |
277 | icalcomponent_add_property(parent,icalproperty_new_created( | 277 | icalcomponent_add_property(parent,icalproperty_new_created( |
278 | writeICalDateTime(incidence->created()))); | 278 | writeICalDateTime(incidence->created()))); |
279 | 279 | ||
280 | // unique id | 280 | // unique id |
281 | icalcomponent_add_property(parent,icalproperty_new_uid( | 281 | icalcomponent_add_property(parent,icalproperty_new_uid( |
282 | incidence->uid().utf8())); | 282 | incidence->uid().utf8())); |
283 | 283 | ||
284 | // revision | 284 | // revision |
285 | icalcomponent_add_property(parent,icalproperty_new_sequence( | 285 | icalcomponent_add_property(parent,icalproperty_new_sequence( |
286 | incidence->revision())); | 286 | incidence->revision())); |
287 | 287 | ||
288 | // last modification date | 288 | // last modification date |
289 | icalcomponent_add_property(parent,icalproperty_new_lastmodified( | 289 | icalcomponent_add_property(parent,icalproperty_new_lastmodified( |
290 | writeICalDateTime(incidence->lastModified()))); | 290 | writeICalDateTime(incidence->lastModified()))); |
291 | 291 | ||
292 | // description | 292 | // description |
293 | if (!incidence->description().isEmpty()) { | 293 | if (!incidence->description().isEmpty()) { |
294 | icalcomponent_add_property(parent,icalproperty_new_description( | 294 | icalcomponent_add_property(parent,icalproperty_new_description( |
295 | incidence->description().utf8())); | 295 | incidence->description().utf8())); |
296 | } | 296 | } |
297 | 297 | ||
298 | // summary | 298 | // summary |
299 | if (!incidence->summary().isEmpty()) { | 299 | if (!incidence->summary().isEmpty()) { |
300 | icalcomponent_add_property(parent,icalproperty_new_summary( | 300 | icalcomponent_add_property(parent,icalproperty_new_summary( |
301 | incidence->summary().utf8())); | 301 | incidence->summary().utf8())); |
302 | } | 302 | } |
303 | 303 | ||
304 | // location | 304 | // location |
305 | if (!incidence->location().isEmpty()) { | 305 | if (!incidence->location().isEmpty()) { |
306 | icalcomponent_add_property(parent,icalproperty_new_location( | 306 | icalcomponent_add_property(parent,icalproperty_new_location( |
307 | incidence->location().utf8())); | 307 | incidence->location().utf8())); |
308 | } | 308 | } |
309 | 309 | ||
310 | // TODO: | 310 | // TODO: |
311 | // status | 311 | // status |
312 | // addPropValue(parent, VCStatusProp, incidence->getStatusStr().utf8()); | 312 | // addPropValue(parent, VCStatusProp, incidence->getStatusStr().utf8()); |
313 | 313 | ||
314 | // secrecy | 314 | // secrecy |
315 | enum icalproperty_class classInt; | 315 | enum icalproperty_class classInt; |
316 | switch (incidence->secrecy()) { | 316 | switch (incidence->secrecy()) { |
317 | case Incidence::SecrecyPublic: | 317 | case Incidence::SecrecyPublic: |
318 | classInt = ICAL_CLASS_PUBLIC; | 318 | classInt = ICAL_CLASS_PUBLIC; |
319 | break; | 319 | break; |
320 | case Incidence::SecrecyConfidential: | 320 | case Incidence::SecrecyConfidential: |
321 | classInt = ICAL_CLASS_CONFIDENTIAL; | 321 | classInt = ICAL_CLASS_CONFIDENTIAL; |
322 | break; | 322 | break; |
323 | case Incidence::SecrecyPrivate: | 323 | case Incidence::SecrecyPrivate: |
324 | classInt =ICAL_CLASS_PRIVATE ; | 324 | classInt =ICAL_CLASS_PRIVATE ; |
325 | default: | 325 | default: |
326 | classInt =ICAL_CLASS_PRIVATE ; | 326 | classInt =ICAL_CLASS_PRIVATE ; |
327 | break; | 327 | break; |
328 | } | 328 | } |
329 | icalcomponent_add_property(parent,icalproperty_new_class(classInt)); | 329 | icalcomponent_add_property(parent,icalproperty_new_class(classInt)); |
330 | 330 | ||
331 | // priority | 331 | // priority |
332 | icalcomponent_add_property(parent,icalproperty_new_priority( | 332 | icalcomponent_add_property(parent,icalproperty_new_priority( |
333 | incidence->priority())); | 333 | incidence->priority())); |
334 | 334 | ||
335 | // categories | 335 | // categories |
336 | QStringList categories = incidence->categories(); | 336 | QStringList categories = incidence->categories(); |
337 | QStringList::Iterator it; | 337 | QStringList::Iterator it; |
338 | for(it = categories.begin(); it != categories.end(); ++it ) { | 338 | for(it = categories.begin(); it != categories.end(); ++it ) { |
339 | icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); | 339 | icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); |
340 | } | 340 | } |
341 | // TODO: Ensure correct concatenation of categories properties. | 341 | // TODO: Ensure correct concatenation of categories properties. |
342 | 342 | ||
343 | /* | 343 | /* |
344 | // categories | 344 | // categories |
345 | tmpStrList = incidence->getCategories(); | 345 | tmpStrList = incidence->getCategories(); |
346 | tmpStr = ""; | 346 | tmpStr = ""; |
347 | QString catStr; | 347 | QString catStr; |
348 | for ( QStringList::Iterator it = tmpStrList.begin(); | 348 | for ( QStringList::Iterator it = tmpStrList.begin(); |
349 | it != tmpStrList.end(); | 349 | it != tmpStrList.end(); |
350 | ++it ) { | 350 | ++it ) { |
351 | catStr = *it; | 351 | catStr = *it; |
352 | if (catStr[0] == ' ') | 352 | if (catStr[0] == ' ') |
353 | tmpStr += catStr.mid(1); | 353 | tmpStr += catStr.mid(1); |
354 | else | 354 | else |
355 | tmpStr += catStr; | 355 | tmpStr += catStr; |
356 | // this must be a ';' character as the vCalendar specification requires! | 356 | // this must be a ';' character as the vCalendar specification requires! |
357 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is | 357 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is |
358 | // read in. | 358 | // read in. |
359 | tmpStr += ";"; | 359 | tmpStr += ";"; |
360 | } | 360 | } |
361 | if (!tmpStr.isEmpty()) { | 361 | if (!tmpStr.isEmpty()) { |
362 | tmpStr.truncate(tmpStr.length()-1); | 362 | tmpStr.truncate(tmpStr.length()-1); |
363 | icalcomponent_add_property(parent,icalproperty_new_categories( | 363 | icalcomponent_add_property(parent,icalproperty_new_categories( |
364 | writeText(incidence->getCategories().join(";")))); | 364 | writeText(incidence->getCategories().join(";")))); |
365 | } | 365 | } |
366 | */ | 366 | */ |
367 | 367 | ||
368 | // related event | 368 | // related event |
369 | if (incidence->relatedTo()) { | 369 | if (incidence->relatedTo()) { |
370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( | 370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( |
371 | incidence->relatedTo()->uid().utf8())); | 371 | incidence->relatedTo()->uid().utf8())); |
372 | } | 372 | } |
373 | 373 | ||
374 | // recurrence rule stuff | 374 | // recurrence rule stuff |
375 | Recurrence *recur = incidence->recurrence(); | 375 | Recurrence *recur = incidence->recurrence(); |
376 | if (recur->doesRecur()) { | 376 | if (recur->doesRecur()) { |
377 | 377 | ||
378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); | 378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); |
379 | } | 379 | } |
380 | 380 | ||
381 | // recurrence excpetion dates | 381 | // recurrence excpetion dates |
382 | DateList dateList = incidence->exDates(); | 382 | DateList dateList = incidence->exDates(); |
383 | DateList::ConstIterator exIt; | 383 | DateList::ConstIterator exIt; |
384 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { | 384 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { |
385 | icalcomponent_add_property(parent,icalproperty_new_exdate( | 385 | icalcomponent_add_property(parent,icalproperty_new_exdate( |
386 | writeICalDate(*exIt))); | 386 | writeICalDate(*exIt))); |
387 | } | 387 | } |
388 | 388 | ||
389 | // attachments | 389 | // attachments |
390 | QPtrList<Attachment> attachments = incidence->attachments(); | 390 | QPtrList<Attachment> attachments = incidence->attachments(); |
391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) | 391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) |
392 | icalcomponent_add_property(parent,writeAttachment(at)); | 392 | icalcomponent_add_property(parent,writeAttachment(at)); |
393 | 393 | ||
394 | // alarms | 394 | // alarms |
395 | QPtrList<Alarm> alarms = incidence->alarms(); | 395 | QPtrList<Alarm> alarms = incidence->alarms(); |
396 | Alarm* alarm; | 396 | Alarm* alarm; |
397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
398 | if (alarm->enabled()) { | 398 | if (alarm->enabled()) { |
399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; | 399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; |
400 | icalcomponent_add_component(parent,writeAlarm(alarm)); | 400 | icalcomponent_add_component(parent,writeAlarm(alarm)); |
401 | } | 401 | } |
402 | } | 402 | } |
403 | 403 | if( incidence->hasRecurrenceID() ) { | |
404 | icalcomponent_add_property(parent, | ||
405 | icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); | ||
406 | } | ||
404 | // duration | 407 | // duration |
405 | 408 | ||
406 | // turned off as it always is set to PTS0 (and must not occur together with DTEND | 409 | // turned off as it always is set to PTS0 (and must not occur together with DTEND |
407 | 410 | ||
408 | // if (incidence->hasDuration()) { | 411 | // if (incidence->hasDuration()) { |
409 | // icaldurationtype duration; | 412 | // icaldurationtype duration; |
410 | // duration = writeICalDuration(incidence->duration()); | 413 | // duration = writeICalDuration(incidence->duration()); |
411 | // icalcomponent_add_property(parent,icalproperty_new_duration(duration)); | 414 | // icalcomponent_add_property(parent,icalproperty_new_duration(duration)); |
412 | // } | 415 | // } |
413 | } | 416 | } |
414 | 417 | ||
415 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) | 418 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) |
416 | { | 419 | { |
417 | icalcomponent_add_property(parent,icalproperty_new_dtstamp( | 420 | icalcomponent_add_property(parent,icalproperty_new_dtstamp( |
418 | writeICalDateTime(QDateTime::currentDateTime()))); | 421 | writeICalDateTime(QDateTime::currentDateTime()))); |
419 | 422 | ||
420 | // organizer stuff | 423 | // organizer stuff |
421 | icalcomponent_add_property(parent,icalproperty_new_organizer( | 424 | icalcomponent_add_property(parent,icalproperty_new_organizer( |
422 | ("MAILTO:" + incidenceBase->organizer()).utf8())); | 425 | ("MAILTO:" + incidenceBase->organizer()).utf8())); |
423 | 426 | ||
424 | // attendees | 427 | // attendees |
425 | if (incidenceBase->attendeeCount() != 0) { | 428 | if (incidenceBase->attendeeCount() != 0) { |
426 | QPtrList<Attendee> al = incidenceBase->attendees(); | 429 | QPtrList<Attendee> al = incidenceBase->attendees(); |
427 | QPtrListIterator<Attendee> ai(al); | 430 | QPtrListIterator<Attendee> ai(al); |
428 | for (; ai.current(); ++ai) { | 431 | for (; ai.current(); ++ai) { |
429 | icalcomponent_add_property(parent,writeAttendee(ai.current())); | 432 | icalcomponent_add_property(parent,writeAttendee(ai.current())); |
430 | } | 433 | } |
431 | } | 434 | } |
432 | 435 | ||
433 | // custom properties | 436 | // custom properties |
434 | writeCustomProperties(parent, incidenceBase); | 437 | writeCustomProperties(parent, incidenceBase); |
435 | } | 438 | } |
436 | 439 | ||
437 | void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,CustomProperties *properties) | 440 | void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,CustomProperties *properties) |
438 | { | 441 | { |
439 | QMap<QCString, QString> custom = properties->customProperties(); | 442 | QMap<QCString, QString> custom = properties->customProperties(); |
440 | for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { | 443 | for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { |
441 | icalproperty *p = icalproperty_new_x(c.data().utf8()); | 444 | icalproperty *p = icalproperty_new_x(c.data().utf8()); |
442 | icalproperty_set_x_name(p,c.key()); | 445 | icalproperty_set_x_name(p,c.key()); |
443 | icalcomponent_add_property(parent,p); | 446 | icalcomponent_add_property(parent,p); |
444 | } | 447 | } |
445 | } | 448 | } |
446 | 449 | ||
447 | icalproperty *ICalFormatImpl::writeAttendee(Attendee *attendee) | 450 | icalproperty *ICalFormatImpl::writeAttendee(Attendee *attendee) |
448 | { | 451 | { |
449 | icalproperty *p = icalproperty_new_attendee("mailto:" + attendee->email().utf8()); | 452 | icalproperty *p = icalproperty_new_attendee("mailto:" + attendee->email().utf8()); |
450 | 453 | ||
451 | if (!attendee->name().isEmpty()) { | 454 | if (!attendee->name().isEmpty()) { |
452 | icalproperty_add_parameter(p,icalparameter_new_cn(attendee->name().utf8())); | 455 | icalproperty_add_parameter(p,icalparameter_new_cn(attendee->name().utf8())); |
453 | } | 456 | } |
454 | 457 | ||
455 | 458 | ||
456 | icalproperty_add_parameter(p,icalparameter_new_rsvp( | 459 | icalproperty_add_parameter(p,icalparameter_new_rsvp( |
457 | attendee->RSVP() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE )); | 460 | attendee->RSVP() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE )); |
458 | 461 | ||
459 | icalparameter_partstat status = ICAL_PARTSTAT_NEEDSACTION; | 462 | icalparameter_partstat status = ICAL_PARTSTAT_NEEDSACTION; |
460 | switch (attendee->status()) { | 463 | switch (attendee->status()) { |
461 | default: | 464 | default: |
462 | case Attendee::NeedsAction: | 465 | case Attendee::NeedsAction: |
463 | status = ICAL_PARTSTAT_NEEDSACTION; | 466 | status = ICAL_PARTSTAT_NEEDSACTION; |
464 | break; | 467 | break; |
465 | case Attendee::Accepted: | 468 | case Attendee::Accepted: |
466 | status = ICAL_PARTSTAT_ACCEPTED; | 469 | status = ICAL_PARTSTAT_ACCEPTED; |
467 | break; | 470 | break; |
468 | case Attendee::Declined: | 471 | case Attendee::Declined: |
469 | status = ICAL_PARTSTAT_DECLINED; | 472 | status = ICAL_PARTSTAT_DECLINED; |
470 | break; | 473 | break; |
471 | case Attendee::Tentative: | 474 | case Attendee::Tentative: |
472 | status = ICAL_PARTSTAT_TENTATIVE; | 475 | status = ICAL_PARTSTAT_TENTATIVE; |
473 | break; | 476 | break; |
474 | case Attendee::Delegated: | 477 | case Attendee::Delegated: |
475 | status = ICAL_PARTSTAT_DELEGATED; | 478 | status = ICAL_PARTSTAT_DELEGATED; |
476 | break; | 479 | break; |
477 | case Attendee::Completed: | 480 | case Attendee::Completed: |
478 | status = ICAL_PARTSTAT_COMPLETED; | 481 | status = ICAL_PARTSTAT_COMPLETED; |
479 | break; | 482 | break; |
480 | case Attendee::InProcess: | 483 | case Attendee::InProcess: |
481 | status = ICAL_PARTSTAT_INPROCESS; | 484 | status = ICAL_PARTSTAT_INPROCESS; |
482 | break; | 485 | break; |
483 | } | 486 | } |
484 | icalproperty_add_parameter(p,icalparameter_new_partstat(status)); | 487 | icalproperty_add_parameter(p,icalparameter_new_partstat(status)); |
485 | 488 | ||
486 | icalparameter_role role = ICAL_ROLE_REQPARTICIPANT; | 489 | icalparameter_role role = ICAL_ROLE_REQPARTICIPANT; |
487 | switch (attendee->role()) { | 490 | switch (attendee->role()) { |
488 | case Attendee::Chair: | 491 | case Attendee::Chair: |
489 | role = ICAL_ROLE_CHAIR; | 492 | role = ICAL_ROLE_CHAIR; |
490 | break; | 493 | break; |
491 | default: | 494 | default: |
492 | case Attendee::ReqParticipant: | 495 | case Attendee::ReqParticipant: |
493 | role = ICAL_ROLE_REQPARTICIPANT; | 496 | role = ICAL_ROLE_REQPARTICIPANT; |
494 | break; | 497 | break; |
495 | case Attendee::OptParticipant: | 498 | case Attendee::OptParticipant: |
496 | role = ICAL_ROLE_OPTPARTICIPANT; | 499 | role = ICAL_ROLE_OPTPARTICIPANT; |
497 | break; | 500 | break; |
498 | case Attendee::NonParticipant: | 501 | case Attendee::NonParticipant: |
499 | role = ICAL_ROLE_NONPARTICIPANT; | 502 | role = ICAL_ROLE_NONPARTICIPANT; |
500 | break; | 503 | break; |
501 | } | 504 | } |
502 | icalproperty_add_parameter(p,icalparameter_new_role(role)); | 505 | icalproperty_add_parameter(p,icalparameter_new_role(role)); |
503 | 506 | ||
504 | if (!attendee->uid().isEmpty()) { | 507 | if (!attendee->uid().isEmpty()) { |
505 | icalparameter* icalparameter_uid = icalparameter_new_x(attendee->uid().utf8()); | 508 | icalparameter* icalparameter_uid = icalparameter_new_x(attendee->uid().utf8()); |
506 | icalparameter_set_xname(icalparameter_uid,"X-UID"); | 509 | icalparameter_set_xname(icalparameter_uid,"X-UID"); |
507 | icalproperty_add_parameter(p,icalparameter_uid); | 510 | icalproperty_add_parameter(p,icalparameter_uid); |
508 | } | 511 | } |
509 | 512 | ||
510 | return p; | 513 | return p; |
511 | } | 514 | } |
512 | 515 | ||
513 | icalproperty *ICalFormatImpl::writeAttachment(Attachment *att) | 516 | icalproperty *ICalFormatImpl::writeAttachment(Attachment *att) |
514 | { | 517 | { |
515 | #if 0 | 518 | #if 0 |
516 | icalattachtype* attach = icalattachtype_new(); | 519 | icalattachtype* attach = icalattachtype_new(); |
517 | if (att->isURI()) | 520 | if (att->isURI()) |
518 | icalattachtype_set_url(attach, att->uri().utf8().data()); | 521 | icalattachtype_set_url(attach, att->uri().utf8().data()); |
519 | else | 522 | else |
520 | icalattachtype_set_base64(attach, att->data(), 0); | 523 | icalattachtype_set_base64(attach, att->data(), 0); |
521 | #endif | 524 | #endif |
522 | icalattach *attach; | 525 | icalattach *attach; |
523 | if (att->isURI()) | 526 | if (att->isURI()) |
524 | attach = icalattach_new_from_url( att->uri().utf8().data()); | 527 | attach = icalattach_new_from_url( att->uri().utf8().data()); |
525 | else | 528 | else |
526 | attach = icalattach_new_from_data ( (unsigned char *)att->data(), 0, 0); | 529 | attach = icalattach_new_from_data ( (unsigned char *)att->data(), 0, 0); |
527 | icalproperty *p = icalproperty_new_attach(attach); | 530 | icalproperty *p = icalproperty_new_attach(attach); |
528 | if (!att->mimeType().isEmpty()) | 531 | if (!att->mimeType().isEmpty()) |
529 | icalproperty_add_parameter(p,icalparameter_new_fmttype(att->mimeType().utf8().data())); | 532 | icalproperty_add_parameter(p,icalparameter_new_fmttype(att->mimeType().utf8().data())); |
530 | 533 | ||
531 | if (att->isBinary()) { | 534 | if (att->isBinary()) { |
@@ -1079,256 +1082,261 @@ Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee) | |||
1079 | case ICAL_ROLE_CHAIR: | 1082 | case ICAL_ROLE_CHAIR: |
1080 | role = Attendee::Chair; | 1083 | role = Attendee::Chair; |
1081 | break; | 1084 | break; |
1082 | default: | 1085 | default: |
1083 | case ICAL_ROLE_REQPARTICIPANT: | 1086 | case ICAL_ROLE_REQPARTICIPANT: |
1084 | role = Attendee::ReqParticipant; | 1087 | role = Attendee::ReqParticipant; |
1085 | break; | 1088 | break; |
1086 | case ICAL_ROLE_OPTPARTICIPANT: | 1089 | case ICAL_ROLE_OPTPARTICIPANT: |
1087 | role = Attendee::OptParticipant; | 1090 | role = Attendee::OptParticipant; |
1088 | break; | 1091 | break; |
1089 | case ICAL_ROLE_NONPARTICIPANT: | 1092 | case ICAL_ROLE_NONPARTICIPANT: |
1090 | role = Attendee::NonParticipant; | 1093 | role = Attendee::NonParticipant; |
1091 | break; | 1094 | break; |
1092 | } | 1095 | } |
1093 | } | 1096 | } |
1094 | 1097 | ||
1095 | p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER); | 1098 | p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER); |
1096 | uid = icalparameter_get_xvalue(p); | 1099 | uid = icalparameter_get_xvalue(p); |
1097 | // This should be added, but there seems to be a libical bug here. | 1100 | // This should be added, but there seems to be a libical bug here. |
1098 | /*while (p) { | 1101 | /*while (p) { |
1099 | // if (icalparameter_get_xname(p) == "X-UID") { | 1102 | // if (icalparameter_get_xname(p) == "X-UID") { |
1100 | uid = icalparameter_get_xvalue(p); | 1103 | uid = icalparameter_get_xvalue(p); |
1101 | p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER); | 1104 | p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER); |
1102 | } */ | 1105 | } */ |
1103 | 1106 | ||
1104 | return new Attendee( name, email, rsvp, status, role, uid ); | 1107 | return new Attendee( name, email, rsvp, status, role, uid ); |
1105 | } | 1108 | } |
1106 | 1109 | ||
1107 | Attachment *ICalFormatImpl::readAttachment(icalproperty *attach) | 1110 | Attachment *ICalFormatImpl::readAttachment(icalproperty *attach) |
1108 | { | 1111 | { |
1109 | icalattach *a = icalproperty_get_attach(attach); | 1112 | icalattach *a = icalproperty_get_attach(attach); |
1110 | icalparameter_value v = ICAL_VALUE_NONE; | 1113 | icalparameter_value v = ICAL_VALUE_NONE; |
1111 | icalparameter_encoding e = ICAL_ENCODING_NONE; | 1114 | icalparameter_encoding e = ICAL_ENCODING_NONE; |
1112 | 1115 | ||
1113 | Attachment *attachment = 0; | 1116 | Attachment *attachment = 0; |
1114 | /* | 1117 | /* |
1115 | icalparameter *vp = icalproperty_get_first_parameter(attach, ICAL_VALUE_PARAMETER); | 1118 | icalparameter *vp = icalproperty_get_first_parameter(attach, ICAL_VALUE_PARAMETER); |
1116 | if (vp) | 1119 | if (vp) |
1117 | v = icalparameter_get_value(vp); | 1120 | v = icalparameter_get_value(vp); |
1118 | 1121 | ||
1119 | icalparameter *ep = icalproperty_get_first_parameter(attach, ICAL_ENCODING_PARAMETER); | 1122 | icalparameter *ep = icalproperty_get_first_parameter(attach, ICAL_ENCODING_PARAMETER); |
1120 | if (ep) | 1123 | if (ep) |
1121 | e = icalparameter_get_encoding(ep); | 1124 | e = icalparameter_get_encoding(ep); |
1122 | */ | 1125 | */ |
1123 | int isurl = icalattach_get_is_url (a); | 1126 | int isurl = icalattach_get_is_url (a); |
1124 | if (isurl == 0) | 1127 | if (isurl == 0) |
1125 | attachment = new Attachment((const char*)icalattach_get_data(a)); | 1128 | attachment = new Attachment((const char*)icalattach_get_data(a)); |
1126 | else { | 1129 | else { |
1127 | attachment = new Attachment(QString(icalattach_get_url(a))); | 1130 | attachment = new Attachment(QString(icalattach_get_url(a))); |
1128 | } | 1131 | } |
1129 | 1132 | ||
1130 | icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER); | 1133 | icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER); |
1131 | if (p) | 1134 | if (p) |
1132 | attachment->setMimeType(QString(icalparameter_get_fmttype(p))); | 1135 | attachment->setMimeType(QString(icalparameter_get_fmttype(p))); |
1133 | 1136 | ||
1134 | return attachment; | 1137 | return attachment; |
1135 | } | 1138 | } |
1136 | #include <qtextcodec.h> | 1139 | #include <qtextcodec.h> |
1137 | void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | 1140 | void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) |
1138 | { | 1141 | { |
1139 | readIncidenceBase(parent,incidence); | 1142 | readIncidenceBase(parent,incidence); |
1140 | 1143 | ||
1141 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); | 1144 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); |
1142 | bool readrec = false; | 1145 | bool readrec = false; |
1143 | const char *text; | 1146 | const char *text; |
1144 | int intvalue; | 1147 | int intvalue; |
1145 | icaltimetype icaltime; | 1148 | icaltimetype icaltime; |
1146 | icaldurationtype icalduration; | 1149 | icaldurationtype icalduration; |
1147 | struct icalrecurrencetype rectype; | 1150 | struct icalrecurrencetype rectype; |
1148 | QStringList categories; | 1151 | QStringList categories; |
1149 | 1152 | ||
1150 | while (p) { | 1153 | while (p) { |
1151 | icalproperty_kind kind = icalproperty_isa(p); | 1154 | icalproperty_kind kind = icalproperty_isa(p); |
1152 | switch (kind) { | 1155 | switch (kind) { |
1153 | 1156 | ||
1154 | case ICAL_CREATED_PROPERTY: | 1157 | case ICAL_CREATED_PROPERTY: |
1155 | icaltime = icalproperty_get_created(p); | 1158 | icaltime = icalproperty_get_created(p); |
1156 | incidence->setCreated(readICalDateTime(icaltime)); | 1159 | incidence->setCreated(readICalDateTime(icaltime)); |
1157 | break; | 1160 | break; |
1158 | 1161 | ||
1159 | case ICAL_SEQUENCE_PROPERTY: // sequence | 1162 | case ICAL_SEQUENCE_PROPERTY: // sequence |
1160 | intvalue = icalproperty_get_sequence(p); | 1163 | intvalue = icalproperty_get_sequence(p); |
1161 | incidence->setRevision(intvalue); | 1164 | incidence->setRevision(intvalue); |
1162 | break; | 1165 | break; |
1163 | 1166 | ||
1164 | case ICAL_LASTMODIFIED_PROPERTY: // last modification date | 1167 | case ICAL_LASTMODIFIED_PROPERTY: // last modification date |
1165 | icaltime = icalproperty_get_lastmodified(p); | 1168 | icaltime = icalproperty_get_lastmodified(p); |
1166 | incidence->setLastModified(readICalDateTime(icaltime)); | 1169 | incidence->setLastModified(readICalDateTime(icaltime)); |
1167 | break; | 1170 | break; |
1168 | 1171 | ||
1169 | case ICAL_DTSTART_PROPERTY: // start date and time | 1172 | case ICAL_DTSTART_PROPERTY: // start date and time |
1170 | icaltime = icalproperty_get_dtstart(p); | 1173 | icaltime = icalproperty_get_dtstart(p); |
1171 | if (icaltime.is_date) { | 1174 | if (icaltime.is_date) { |
1172 | incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0))); | 1175 | incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0))); |
1173 | incidence->setFloats(true); | 1176 | incidence->setFloats(true); |
1174 | } else { | 1177 | } else { |
1175 | incidence->setDtStart(readICalDateTime(icaltime)); | 1178 | incidence->setDtStart(readICalDateTime(icaltime)); |
1176 | } | 1179 | } |
1177 | break; | 1180 | break; |
1178 | 1181 | ||
1179 | case ICAL_DURATION_PROPERTY: // start date and time | 1182 | case ICAL_DURATION_PROPERTY: // start date and time |
1180 | icalduration = icalproperty_get_duration(p); | 1183 | icalduration = icalproperty_get_duration(p); |
1181 | incidence->setDuration(readICalDuration(icalduration)); | 1184 | incidence->setDuration(readICalDuration(icalduration)); |
1182 | break; | 1185 | break; |
1183 | 1186 | ||
1184 | case ICAL_DESCRIPTION_PROPERTY: // description | 1187 | case ICAL_DESCRIPTION_PROPERTY: // description |
1185 | text = icalproperty_get_description(p); | 1188 | text = icalproperty_get_description(p); |
1186 | incidence->setDescription(QString::fromUtf8(text)); | 1189 | incidence->setDescription(QString::fromUtf8(text)); |
1187 | break; | 1190 | break; |
1188 | 1191 | ||
1189 | case ICAL_SUMMARY_PROPERTY: // summary | 1192 | case ICAL_SUMMARY_PROPERTY: // summary |
1190 | { | 1193 | { |
1191 | text = icalproperty_get_summary(p); | 1194 | text = icalproperty_get_summary(p); |
1192 | incidence->setSummary(QString::fromUtf8(text)); | 1195 | incidence->setSummary(QString::fromUtf8(text)); |
1193 | } | 1196 | } |
1194 | break; | 1197 | break; |
1195 | case ICAL_STATUS_PROPERTY: // summary | 1198 | case ICAL_STATUS_PROPERTY: // summary |
1196 | { | 1199 | { |
1197 | if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) | 1200 | if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) |
1198 | incidence->setCancelled( true ); | 1201 | incidence->setCancelled( true ); |
1199 | } | 1202 | } |
1200 | break; | 1203 | break; |
1201 | 1204 | ||
1202 | case ICAL_LOCATION_PROPERTY: // location | 1205 | case ICAL_LOCATION_PROPERTY: // location |
1203 | text = icalproperty_get_location(p); | 1206 | text = icalproperty_get_location(p); |
1204 | incidence->setLocation(QString::fromUtf8(text)); | 1207 | incidence->setLocation(QString::fromUtf8(text)); |
1205 | break; | 1208 | break; |
1206 | 1209 | ||
1210 | case ICAL_RECURRENCEID_PROPERTY: | ||
1211 | icaltime = icalproperty_get_recurrenceid(p); | ||
1212 | incidence->setRecurrenceID( readICalDateTime(icaltime) ); | ||
1213 | qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() ); | ||
1214 | break; | ||
1207 | #if 0 | 1215 | #if 0 |
1208 | // status | 1216 | // status |
1209 | if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) { | 1217 | if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) { |
1210 | incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo))); | 1218 | incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo))); |
1211 | deleteStr(s); | 1219 | deleteStr(s); |
1212 | } | 1220 | } |
1213 | else | 1221 | else |
1214 | incidence->setStatus("NEEDS ACTION"); | 1222 | incidence->setStatus("NEEDS ACTION"); |
1215 | #endif | 1223 | #endif |
1216 | 1224 | ||
1217 | case ICAL_PRIORITY_PROPERTY: // priority | 1225 | case ICAL_PRIORITY_PROPERTY: // priority |
1218 | intvalue = icalproperty_get_priority(p); | 1226 | intvalue = icalproperty_get_priority(p); |
1219 | incidence->setPriority(intvalue); | 1227 | incidence->setPriority(intvalue); |
1220 | break; | 1228 | break; |
1221 | 1229 | ||
1222 | case ICAL_CATEGORIES_PROPERTY: // categories | 1230 | case ICAL_CATEGORIES_PROPERTY: // categories |
1223 | text = icalproperty_get_categories(p); | 1231 | text = icalproperty_get_categories(p); |
1224 | categories.append(QString::fromUtf8(text)); | 1232 | categories.append(QString::fromUtf8(text)); |
1225 | break; | 1233 | break; |
1226 | //******************************************* | 1234 | //******************************************* |
1227 | case ICAL_RRULE_PROPERTY: | 1235 | case ICAL_RRULE_PROPERTY: |
1228 | // we do need (maybe )start datetime of incidence for recurrence | 1236 | // we do need (maybe )start datetime of incidence for recurrence |
1229 | // such that we can read recurrence only after we read incidence completely | 1237 | // such that we can read recurrence only after we read incidence completely |
1230 | readrec = true; | 1238 | readrec = true; |
1231 | rectype = icalproperty_get_rrule(p); | 1239 | rectype = icalproperty_get_rrule(p); |
1232 | break; | 1240 | break; |
1233 | 1241 | ||
1234 | case ICAL_EXDATE_PROPERTY: | 1242 | case ICAL_EXDATE_PROPERTY: |
1235 | icaltime = icalproperty_get_exdate(p); | 1243 | icaltime = icalproperty_get_exdate(p); |
1236 | incidence->addExDate(readICalDate(icaltime)); | 1244 | incidence->addExDate(readICalDate(icaltime)); |
1237 | break; | 1245 | break; |
1238 | 1246 | ||
1239 | case ICAL_CLASS_PROPERTY: { | 1247 | case ICAL_CLASS_PROPERTY: { |
1240 | int inttext = icalproperty_get_class(p); | 1248 | int inttext = icalproperty_get_class(p); |
1241 | if (inttext == ICAL_CLASS_PUBLIC ) { | 1249 | if (inttext == ICAL_CLASS_PUBLIC ) { |
1242 | incidence->setSecrecy(Incidence::SecrecyPublic); | 1250 | incidence->setSecrecy(Incidence::SecrecyPublic); |
1243 | } else if (inttext == ICAL_CLASS_CONFIDENTIAL ) { | 1251 | } else if (inttext == ICAL_CLASS_CONFIDENTIAL ) { |
1244 | incidence->setSecrecy(Incidence::SecrecyConfidential); | 1252 | incidence->setSecrecy(Incidence::SecrecyConfidential); |
1245 | } else { | 1253 | } else { |
1246 | incidence->setSecrecy(Incidence::SecrecyPrivate); | 1254 | incidence->setSecrecy(Incidence::SecrecyPrivate); |
1247 | } | 1255 | } |
1248 | } | 1256 | } |
1249 | break; | 1257 | break; |
1250 | 1258 | ||
1251 | case ICAL_ATTACH_PROPERTY: // attachments | 1259 | case ICAL_ATTACH_PROPERTY: // attachments |
1252 | incidence->addAttachment(readAttachment(p)); | 1260 | incidence->addAttachment(readAttachment(p)); |
1253 | break; | 1261 | break; |
1254 | 1262 | ||
1255 | default: | 1263 | default: |
1256 | // kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind | 1264 | // kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind |
1257 | // << endl; | 1265 | // << endl; |
1258 | break; | 1266 | break; |
1259 | } | 1267 | } |
1260 | 1268 | ||
1261 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); | 1269 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); |
1262 | } | 1270 | } |
1263 | if ( readrec ) { | 1271 | if ( readrec ) { |
1264 | readRecurrenceRule(rectype,incidence); | 1272 | readRecurrenceRule(rectype,incidence); |
1265 | } | 1273 | } |
1266 | // kpilot stuff | 1274 | // kpilot stuff |
1267 | // TODO: move this application-specific code to kpilot | 1275 | // TODO: move this application-specific code to kpilot |
1268 | QString kp = incidence->nonKDECustomProperty("X-PILOTID"); | 1276 | QString kp = incidence->nonKDECustomProperty("X-PILOTID"); |
1269 | if (!kp.isNull()) { | 1277 | if (!kp.isNull()) { |
1270 | incidence->setPilotId(kp.toInt()); | 1278 | incidence->setPilotId(kp.toInt()); |
1271 | } | 1279 | } |
1272 | kp = incidence->nonKDECustomProperty("X-PILOTSTAT"); | 1280 | kp = incidence->nonKDECustomProperty("X-PILOTSTAT"); |
1273 | if (!kp.isNull()) { | 1281 | if (!kp.isNull()) { |
1274 | incidence->setSyncStatus(kp.toInt()); | 1282 | incidence->setSyncStatus(kp.toInt()); |
1275 | } | 1283 | } |
1276 | 1284 | ||
1277 | 1285 | ||
1278 | kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); | 1286 | kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); |
1279 | if (!kp.isNull()) { | 1287 | if (!kp.isNull()) { |
1280 | incidence->setIDStr(kp); | 1288 | incidence->setIDStr(kp); |
1281 | } | 1289 | } |
1282 | 1290 | ||
1283 | // Cancel backwards compatibility mode for subsequent changes by the application | 1291 | // Cancel backwards compatibility mode for subsequent changes by the application |
1284 | incidence->recurrence()->setCompatVersion(); | 1292 | incidence->recurrence()->setCompatVersion(); |
1285 | 1293 | ||
1286 | // add categories | 1294 | // add categories |
1287 | incidence->setCategories(categories); | 1295 | incidence->setCategories(categories); |
1288 | 1296 | ||
1289 | // iterate through all alarms | 1297 | // iterate through all alarms |
1290 | for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); | 1298 | for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); |
1291 | alarm; | 1299 | alarm; |
1292 | alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { | 1300 | alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { |
1293 | readAlarm(alarm,incidence); | 1301 | readAlarm(alarm,incidence); |
1294 | } | 1302 | } |
1295 | } | 1303 | } |
1296 | 1304 | ||
1297 | void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) | 1305 | void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) |
1298 | { | 1306 | { |
1299 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); | 1307 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); |
1300 | 1308 | ||
1301 | while (p) { | 1309 | while (p) { |
1302 | icalproperty_kind kind = icalproperty_isa(p); | 1310 | icalproperty_kind kind = icalproperty_isa(p); |
1303 | switch (kind) { | 1311 | switch (kind) { |
1304 | 1312 | ||
1305 | case ICAL_UID_PROPERTY: // unique id | 1313 | case ICAL_UID_PROPERTY: // unique id |
1306 | incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p))); | 1314 | incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p))); |
1307 | break; | 1315 | break; |
1308 | 1316 | ||
1309 | case ICAL_ORGANIZER_PROPERTY: // organizer | 1317 | case ICAL_ORGANIZER_PROPERTY: // organizer |
1310 | incidenceBase->setOrganizer(QString::fromUtf8(icalproperty_get_organizer(p))); | 1318 | incidenceBase->setOrganizer(QString::fromUtf8(icalproperty_get_organizer(p))); |
1311 | break; | 1319 | break; |
1312 | 1320 | ||
1313 | case ICAL_ATTENDEE_PROPERTY: // attendee | 1321 | case ICAL_ATTENDEE_PROPERTY: // attendee |
1314 | incidenceBase->addAttendee(readAttendee(p)); | 1322 | incidenceBase->addAttendee(readAttendee(p)); |
1315 | break; | 1323 | break; |
1316 | 1324 | ||
1317 | default: | 1325 | default: |
1318 | break; | 1326 | break; |
1319 | } | 1327 | } |
1320 | 1328 | ||
1321 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); | 1329 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); |
1322 | } | 1330 | } |
1323 | 1331 | ||
1324 | // custom properties | 1332 | // custom properties |
1325 | readCustomProperties(parent, incidenceBase); | 1333 | readCustomProperties(parent, incidenceBase); |
1326 | } | 1334 | } |
1327 | 1335 | ||
1328 | void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties *properties) | 1336 | void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties *properties) |
1329 | { | 1337 | { |
1330 | QMap<QCString, QString> customProperties; | 1338 | QMap<QCString, QString> customProperties; |
1331 | 1339 | ||
1332 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY); | 1340 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY); |
1333 | 1341 | ||
1334 | while (p) { | 1342 | while (p) { |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index f9e1e9e..dbc159c 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -1,300 +1,333 @@ | |||
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 <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | #include <kdebug.h> | 23 | #include <kdebug.h> |
24 | 24 | ||
25 | #include "calformat.h" | 25 | #include "calformat.h" |
26 | 26 | ||
27 | #include "incidence.h" | 27 | #include "incidence.h" |
28 | #include "todo.h" | 28 | #include "todo.h" |
29 | 29 | ||
30 | using namespace KCal; | 30 | using namespace KCal; |
31 | 31 | ||
32 | Incidence::Incidence() : | 32 | Incidence::Incidence() : |
33 | IncidenceBase(), | 33 | IncidenceBase(), |
34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) | 34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) |
35 | { | 35 | { |
36 | mRecurrence = new Recurrence(this); | 36 | mRecurrence = new Recurrence(this); |
37 | mCancelled = false; | 37 | mCancelled = false; |
38 | recreate(); | 38 | recreate(); |
39 | mHasStartDate = true; | 39 | mHasStartDate = true; |
40 | mAlarms.setAutoDelete(true); | 40 | mAlarms.setAutoDelete(true); |
41 | mAttachments.setAutoDelete(true); | 41 | mAttachments.setAutoDelete(true); |
42 | mHasRecurrenceID = false; | ||
42 | } | 43 | } |
43 | 44 | ||
44 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | 45 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) |
45 | { | 46 | { |
46 | // TODO: reenable attributes currently commented out. | 47 | // TODO: reenable attributes currently commented out. |
47 | mRevision = i.mRevision; | 48 | mRevision = i.mRevision; |
48 | mCreated = i.mCreated; | 49 | mCreated = i.mCreated; |
49 | mDescription = i.mDescription; | 50 | mDescription = i.mDescription; |
50 | mSummary = i.mSummary; | 51 | mSummary = i.mSummary; |
51 | mCategories = i.mCategories; | 52 | mCategories = i.mCategories; |
52 | // Incidence *mRelatedTo; Incidence *mRelatedTo; | 53 | // Incidence *mRelatedTo; Incidence *mRelatedTo; |
53 | mRelatedTo = 0; | 54 | mRelatedTo = 0; |
54 | mRelatedToUid = i.mRelatedToUid; | 55 | mRelatedToUid = i.mRelatedToUid; |
55 | // QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; | 56 | // QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; |
56 | mExDates = i.mExDates; | 57 | mExDates = i.mExDates; |
57 | mAttachments = i.mAttachments; | 58 | mAttachments = i.mAttachments; |
58 | mResources = i.mResources; | 59 | mResources = i.mResources; |
59 | mSecrecy = i.mSecrecy; | 60 | mSecrecy = i.mSecrecy; |
60 | mPriority = i.mPriority; | 61 | mPriority = i.mPriority; |
61 | mLocation = i.mLocation; | 62 | mLocation = i.mLocation; |
62 | mCancelled = i.mCancelled; | 63 | mCancelled = i.mCancelled; |
63 | mHasStartDate = i.mHasStartDate; | 64 | mHasStartDate = i.mHasStartDate; |
64 | QPtrListIterator<Alarm> it( i.mAlarms ); | 65 | QPtrListIterator<Alarm> it( i.mAlarms ); |
65 | const Alarm *a; | 66 | const Alarm *a; |
66 | while( (a = it.current()) ) { | 67 | while( (a = it.current()) ) { |
67 | Alarm *b = new Alarm( *a ); | 68 | Alarm *b = new Alarm( *a ); |
68 | b->setParent( this ); | 69 | b->setParent( this ); |
69 | mAlarms.append( b ); | 70 | mAlarms.append( b ); |
70 | 71 | ||
71 | ++it; | 72 | ++it; |
72 | } | 73 | } |
73 | mAlarms.setAutoDelete(true); | 74 | mAlarms.setAutoDelete(true); |
74 | 75 | mHasRecurrenceID = i.mHasRecurrenceID; | |
76 | mRecurrenceID = i.mRecurrenceID; | ||
75 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); | 77 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); |
76 | } | 78 | } |
77 | 79 | ||
78 | Incidence::~Incidence() | 80 | Incidence::~Incidence() |
79 | { | 81 | { |
80 | 82 | ||
81 | Incidence *ev; | 83 | Incidence *ev; |
82 | QPtrList<Incidence> Relations = relations(); | 84 | QPtrList<Incidence> Relations = relations(); |
83 | for (ev=Relations.first();ev;ev=Relations.next()) { | 85 | for (ev=Relations.first();ev;ev=Relations.next()) { |
84 | if (ev->relatedTo() == this) ev->setRelatedTo(0); | 86 | if (ev->relatedTo() == this) ev->setRelatedTo(0); |
85 | } | 87 | } |
86 | if (relatedTo()) relatedTo()->removeRelation(this); | 88 | if (relatedTo()) relatedTo()->removeRelation(this); |
87 | delete mRecurrence; | 89 | delete mRecurrence; |
88 | 90 | ||
89 | } | 91 | } |
92 | bool Incidence::hasRecurrenceID() const | ||
93 | { | ||
94 | return mHasRecurrenceID; | ||
95 | } | ||
96 | |||
97 | void Incidence::setHasRecurrenceID( bool b ) | ||
98 | { | ||
99 | mHasRecurrenceID = b; | ||
100 | } | ||
101 | |||
102 | void Incidence::setRecurrenceID(QDateTime d) | ||
103 | { | ||
104 | mRecurrenceID = d; | ||
105 | mHasRecurrenceID = true; | ||
106 | updated(); | ||
107 | } | ||
108 | QDateTime Incidence::recurrenceID () const | ||
109 | { | ||
110 | return mRecurrenceID; | ||
111 | } | ||
90 | 112 | ||
91 | bool Incidence::cancelled() const | 113 | bool Incidence::cancelled() const |
92 | { | 114 | { |
93 | return mCancelled; | 115 | return mCancelled; |
94 | } | 116 | } |
95 | void Incidence::setCancelled( bool b ) | 117 | void Incidence::setCancelled( bool b ) |
96 | { | 118 | { |
97 | mCancelled = b; | 119 | mCancelled = b; |
98 | updated(); | 120 | updated(); |
99 | } | 121 | } |
100 | bool Incidence::hasStartDate() const | 122 | bool Incidence::hasStartDate() const |
101 | { | 123 | { |
102 | return mHasStartDate; | 124 | return mHasStartDate; |
103 | } | 125 | } |
104 | 126 | ||
105 | void Incidence::setHasStartDate(bool f) | 127 | void Incidence::setHasStartDate(bool f) |
106 | { | 128 | { |
107 | if (mReadOnly) return; | 129 | if (mReadOnly) return; |
108 | mHasStartDate = f; | 130 | mHasStartDate = f; |
109 | updated(); | 131 | updated(); |
110 | } | 132 | } |
111 | 133 | ||
112 | // A string comparison that considers that null and empty are the same | 134 | // A string comparison that considers that null and empty are the same |
113 | static bool stringCompare( const QString& s1, const QString& s2 ) | 135 | static bool stringCompare( const QString& s1, const QString& s2 ) |
114 | { | 136 | { |
115 | if ( s1.isEmpty() && s2.isEmpty() ) | 137 | if ( s1.isEmpty() && s2.isEmpty() ) |
116 | return true; | 138 | return true; |
117 | return s1 == s2; | 139 | return s1 == s2; |
118 | } | 140 | } |
119 | 141 | ||
120 | bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | 142 | bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) |
121 | { | 143 | { |
122 | 144 | ||
123 | if( i1.alarms().count() != i2.alarms().count() ) { | 145 | if( i1.alarms().count() != i2.alarms().count() ) { |
124 | return false; // no need to check further | 146 | return false; // no need to check further |
125 | } | 147 | } |
126 | if ( i1.alarms().count() > 0 ) { | 148 | if ( i1.alarms().count() > 0 ) { |
127 | if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) ) | 149 | if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) ) |
128 | { | 150 | { |
129 | qDebug("alarm not equal "); | 151 | qDebug("alarm not equal "); |
130 | return false; | 152 | return false; |
131 | } | 153 | } |
132 | } | 154 | } |
133 | #if 0 | 155 | #if 0 |
134 | QPtrListIterator<Alarm> a1( i1.alarms() ); | 156 | QPtrListIterator<Alarm> a1( i1.alarms() ); |
135 | QPtrListIterator<Alarm> a2( i2.alarms() ); | 157 | QPtrListIterator<Alarm> a2( i2.alarms() ); |
136 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { | 158 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { |
137 | if( *a1.current() == *a2.current() ) { | 159 | if( *a1.current() == *a2.current() ) { |
138 | continue; | 160 | continue; |
139 | } | 161 | } |
140 | else { | 162 | else { |
141 | return false; | 163 | return false; |
142 | } | 164 | } |
143 | } | 165 | } |
144 | #endif | 166 | #endif |
145 | 167 | ||
168 | if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { | ||
169 | if ( i1.hasRecurrenceID() ) { | ||
170 | if ( i1.recurrenceID() != i2.recurrenceID() ) | ||
171 | return false; | ||
172 | } | ||
173 | |||
174 | } else { | ||
175 | return false; | ||
176 | } | ||
177 | |||
146 | if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) | 178 | if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) |
147 | return false; | 179 | return false; |
148 | if ( i1.hasStartDate() == i2.hasStartDate() ) { | 180 | if ( i1.hasStartDate() == i2.hasStartDate() ) { |
149 | if ( i1.hasStartDate() ) { | 181 | if ( i1.hasStartDate() ) { |
150 | if ( i1.dtStart() != i2.dtStart() ) | 182 | if ( i1.dtStart() != i2.dtStart() ) |
151 | return false; | 183 | return false; |
152 | } | 184 | } |
153 | } else { | 185 | } else { |
154 | return false; | 186 | return false; |
155 | } | 187 | } |
156 | if (!( *i1.recurrence() == *i2.recurrence()) ) { | 188 | if (!( *i1.recurrence() == *i2.recurrence()) ) { |
157 | qDebug("recurrence is NOT equal "); | 189 | qDebug("recurrence is NOT equal "); |
158 | return false; | 190 | return false; |
159 | } | 191 | } |
160 | return | 192 | return |
161 | // i1.created() == i2.created() && | 193 | // i1.created() == i2.created() && |
162 | stringCompare( i1.description(), i2.description() ) && | 194 | stringCompare( i1.description(), i2.description() ) && |
163 | stringCompare( i1.summary(), i2.summary() ) && | 195 | stringCompare( i1.summary(), i2.summary() ) && |
164 | i1.categories() == i2.categories() && | 196 | i1.categories() == i2.categories() && |
165 | // no need to compare mRelatedTo | 197 | // no need to compare mRelatedTo |
166 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && | 198 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && |
167 | // i1.relations() == i2.relations() && | 199 | // i1.relations() == i2.relations() && |
168 | i1.exDates() == i2.exDates() && | 200 | i1.exDates() == i2.exDates() && |
169 | i1.attachments() == i2.attachments() && | 201 | i1.attachments() == i2.attachments() && |
170 | i1.resources() == i2.resources() && | 202 | i1.resources() == i2.resources() && |
171 | i1.secrecy() == i2.secrecy() && | 203 | i1.secrecy() == i2.secrecy() && |
172 | i1.priority() == i2.priority() && | 204 | i1.priority() == i2.priority() && |
205 | i1.cancelled() == i2.cancelled() && | ||
173 | stringCompare( i1.location(), i2.location() ); | 206 | stringCompare( i1.location(), i2.location() ); |
174 | } | 207 | } |
175 | 208 | ||
176 | Incidence* Incidence::recreateCloneException( QDate d ) | 209 | Incidence* Incidence::recreateCloneException( QDate d ) |
177 | { | 210 | { |
178 | Incidence* newInc = clone(); | 211 | Incidence* newInc = clone(); |
179 | newInc->recreate(); | 212 | newInc->recreate(); |
180 | if ( doesRecur() ) { | 213 | if ( doesRecur() ) { |
181 | addExDate( d ); | 214 | addExDate( d ); |
182 | newInc->recurrence()->unsetRecurs(); | 215 | newInc->recurrence()->unsetRecurs(); |
183 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 216 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
184 | QTime tim = dtStart().time(); | 217 | QTime tim = dtStart().time(); |
185 | newInc->setDtStart( QDateTime(d, tim) ); | 218 | newInc->setDtStart( QDateTime(d, tim) ); |
186 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 219 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
187 | } | 220 | } |
188 | return newInc; | 221 | return newInc; |
189 | } | 222 | } |
190 | 223 | ||
191 | void Incidence::recreate() | 224 | void Incidence::recreate() |
192 | { | 225 | { |
193 | setCreated(QDateTime::currentDateTime()); | 226 | setCreated(QDateTime::currentDateTime()); |
194 | 227 | ||
195 | setUid(CalFormat::createUniqueId()); | 228 | setUid(CalFormat::createUniqueId()); |
196 | 229 | ||
197 | setRevision(0); | 230 | setRevision(0); |
198 | setIDStr( ":" ); | 231 | setIDStr( ":" ); |
199 | setLastModified(QDateTime::currentDateTime()); | 232 | setLastModified(QDateTime::currentDateTime()); |
200 | } | 233 | } |
201 | 234 | ||
202 | void Incidence::setReadOnly( bool readOnly ) | 235 | void Incidence::setReadOnly( bool readOnly ) |
203 | { | 236 | { |
204 | IncidenceBase::setReadOnly( readOnly ); | 237 | IncidenceBase::setReadOnly( readOnly ); |
205 | recurrence()->setRecurReadOnly( readOnly); | 238 | recurrence()->setRecurReadOnly( readOnly); |
206 | } | 239 | } |
207 | 240 | ||
208 | void Incidence::setCreated(QDateTime created) | 241 | void Incidence::setCreated(QDateTime created) |
209 | { | 242 | { |
210 | if (mReadOnly) return; | 243 | if (mReadOnly) return; |
211 | mCreated = getEvenTime(created); | 244 | mCreated = getEvenTime(created); |
212 | } | 245 | } |
213 | 246 | ||
214 | QDateTime Incidence::created() const | 247 | QDateTime Incidence::created() const |
215 | { | 248 | { |
216 | return mCreated; | 249 | return mCreated; |
217 | } | 250 | } |
218 | 251 | ||
219 | void Incidence::setRevision(int rev) | 252 | void Incidence::setRevision(int rev) |
220 | { | 253 | { |
221 | if (mReadOnly) return; | 254 | if (mReadOnly) return; |
222 | mRevision = rev; | 255 | mRevision = rev; |
223 | 256 | ||
224 | updated(); | 257 | updated(); |
225 | } | 258 | } |
226 | 259 | ||
227 | int Incidence::revision() const | 260 | int Incidence::revision() const |
228 | { | 261 | { |
229 | return mRevision; | 262 | return mRevision; |
230 | } | 263 | } |
231 | 264 | ||
232 | void Incidence::setDtStart(const QDateTime &dtStart) | 265 | void Incidence::setDtStart(const QDateTime &dtStart) |
233 | { | 266 | { |
234 | 267 | ||
235 | QDateTime dt = getEvenTime(dtStart); | 268 | QDateTime dt = getEvenTime(dtStart); |
236 | recurrence()->setRecurStart( dt); | 269 | recurrence()->setRecurStart( dt); |
237 | IncidenceBase::setDtStart( dt ); | 270 | IncidenceBase::setDtStart( dt ); |
238 | } | 271 | } |
239 | 272 | ||
240 | void Incidence::setDescription(const QString &description) | 273 | void Incidence::setDescription(const QString &description) |
241 | { | 274 | { |
242 | if (mReadOnly) return; | 275 | if (mReadOnly) return; |
243 | mDescription = description; | 276 | mDescription = description; |
244 | updated(); | 277 | updated(); |
245 | } | 278 | } |
246 | 279 | ||
247 | QString Incidence::description() const | 280 | QString Incidence::description() const |
248 | { | 281 | { |
249 | return mDescription; | 282 | return mDescription; |
250 | } | 283 | } |
251 | 284 | ||
252 | 285 | ||
253 | void Incidence::setSummary(const QString &summary) | 286 | void Incidence::setSummary(const QString &summary) |
254 | { | 287 | { |
255 | if (mReadOnly) return; | 288 | if (mReadOnly) return; |
256 | mSummary = summary; | 289 | mSummary = summary; |
257 | updated(); | 290 | updated(); |
258 | } | 291 | } |
259 | 292 | ||
260 | QString Incidence::summary() const | 293 | QString Incidence::summary() const |
261 | { | 294 | { |
262 | return mSummary; | 295 | return mSummary; |
263 | } | 296 | } |
264 | 297 | ||
265 | void Incidence::setCategories(const QStringList &categories) | 298 | void Incidence::setCategories(const QStringList &categories) |
266 | { | 299 | { |
267 | if (mReadOnly) return; | 300 | if (mReadOnly) return; |
268 | mCategories = categories; | 301 | mCategories = categories; |
269 | updated(); | 302 | updated(); |
270 | } | 303 | } |
271 | 304 | ||
272 | // TODO: remove setCategories(QString) function | 305 | // TODO: remove setCategories(QString) function |
273 | void Incidence::setCategories(const QString &catStr) | 306 | void Incidence::setCategories(const QString &catStr) |
274 | { | 307 | { |
275 | if (mReadOnly) return; | 308 | if (mReadOnly) return; |
276 | mCategories.clear(); | 309 | mCategories.clear(); |
277 | 310 | ||
278 | if (catStr.isEmpty()) return; | 311 | if (catStr.isEmpty()) return; |
279 | 312 | ||
280 | mCategories = QStringList::split(",",catStr); | 313 | mCategories = QStringList::split(",",catStr); |
281 | 314 | ||
282 | QStringList::Iterator it; | 315 | QStringList::Iterator it; |
283 | for(it = mCategories.begin();it != mCategories.end(); ++it) { | 316 | for(it = mCategories.begin();it != mCategories.end(); ++it) { |
284 | *it = (*it).stripWhiteSpace(); | 317 | *it = (*it).stripWhiteSpace(); |
285 | } | 318 | } |
286 | 319 | ||
287 | updated(); | 320 | updated(); |
288 | } | 321 | } |
289 | 322 | ||
290 | QStringList Incidence::categories() const | 323 | QStringList Incidence::categories() const |
291 | { | 324 | { |
292 | return mCategories; | 325 | return mCategories; |
293 | } | 326 | } |
294 | 327 | ||
295 | QString Incidence::categoriesStr() | 328 | QString Incidence::categoriesStr() |
296 | { | 329 | { |
297 | return mCategories.join(","); | 330 | return mCategories.join(","); |
298 | } | 331 | } |
299 | 332 | ||
300 | void Incidence::setRelatedToUid(const QString &relatedToUid) | 333 | void Incidence::setRelatedToUid(const QString &relatedToUid) |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index de2a381..38d2aaa 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -138,162 +138,171 @@ class Incidence : public IncidenceBase | |||
138 | virtual void setDtStart(const QDateTime &dtStart); | 138 | virtual void setDtStart(const QDateTime &dtStart); |
139 | /** Return the incidence's ending date/time as a QDateTime. */ | 139 | /** Return the incidence's ending date/time as a QDateTime. */ |
140 | virtual QDateTime dtEnd() const { return QDateTime(); } | 140 | virtual QDateTime dtEnd() const { return QDateTime(); } |
141 | 141 | ||
142 | /** sets the event's lengthy description. */ | 142 | /** sets the event's lengthy description. */ |
143 | void setDescription(const QString &description); | 143 | void setDescription(const QString &description); |
144 | /** returns a reference to the event's description. */ | 144 | /** returns a reference to the event's description. */ |
145 | QString description() const; | 145 | QString description() const; |
146 | 146 | ||
147 | /** sets the event's short summary. */ | 147 | /** sets the event's short summary. */ |
148 | void setSummary(const QString &summary); | 148 | void setSummary(const QString &summary); |
149 | /** returns a reference to the event's summary. */ | 149 | /** returns a reference to the event's summary. */ |
150 | QString summary() const; | 150 | QString summary() const; |
151 | 151 | ||
152 | /** set event's applicable categories */ | 152 | /** set event's applicable categories */ |
153 | void setCategories(const QStringList &categories); | 153 | void setCategories(const QStringList &categories); |
154 | /** set event's categories based on a comma delimited string */ | 154 | /** set event's categories based on a comma delimited string */ |
155 | void setCategories(const QString &catStr); | 155 | void setCategories(const QString &catStr); |
156 | /** return categories in a list */ | 156 | /** return categories in a list */ |
157 | QStringList categories() const; | 157 | QStringList categories() const; |
158 | /** return categories as a comma separated string */ | 158 | /** return categories as a comma separated string */ |
159 | QString categoriesStr(); | 159 | QString categoriesStr(); |
160 | 160 | ||
161 | /** point at some other event to which the event relates. This function should | 161 | /** point at some other event to which the event relates. This function should |
162 | * only be used when constructing a calendar before the related Event | 162 | * only be used when constructing a calendar before the related Event |
163 | * exists. */ | 163 | * exists. */ |
164 | void setRelatedToUid(const QString &); | 164 | void setRelatedToUid(const QString &); |
165 | /** what event does this one relate to? This function should | 165 | /** what event does this one relate to? This function should |
166 | * only be used when constructing a calendar before the related Event | 166 | * only be used when constructing a calendar before the related Event |
167 | * exists. */ | 167 | * exists. */ |
168 | QString relatedToUid() const; | 168 | QString relatedToUid() const; |
169 | /** point at some other event to which the event relates */ | 169 | /** point at some other event to which the event relates */ |
170 | void setRelatedTo(Incidence *relatedTo); | 170 | void setRelatedTo(Incidence *relatedTo); |
171 | /** what event does this one relate to? */ | 171 | /** what event does this one relate to? */ |
172 | Incidence *relatedTo() const; | 172 | Incidence *relatedTo() const; |
173 | /** All events that are related to this event */ | 173 | /** All events that are related to this event */ |
174 | QPtrList<Incidence> relations() const; | 174 | QPtrList<Incidence> relations() const; |
175 | /** Add an event which is related to this event */ | 175 | /** Add an event which is related to this event */ |
176 | void addRelation(Incidence *); | 176 | void addRelation(Incidence *); |
177 | /** Remove event that is related to this event */ | 177 | /** Remove event that is related to this event */ |
178 | void removeRelation(Incidence *); | 178 | void removeRelation(Incidence *); |
179 | 179 | ||
180 | /** returns the list of dates which are exceptions to the recurrence rule */ | 180 | /** returns the list of dates which are exceptions to the recurrence rule */ |
181 | DateList exDates() const; | 181 | DateList exDates() const; |
182 | /** sets the list of dates which are exceptions to the recurrence rule */ | 182 | /** sets the list of dates which are exceptions to the recurrence rule */ |
183 | void setExDates(const DateList &_exDates); | 183 | void setExDates(const DateList &_exDates); |
184 | void setExDates(const char *dates); | 184 | void setExDates(const char *dates); |
185 | /** Add a date to the list of exceptions of the recurrence rule. */ | 185 | /** Add a date to the list of exceptions of the recurrence rule. */ |
186 | void addExDate(const QDate &date); | 186 | void addExDate(const QDate &date); |
187 | 187 | ||
188 | /** returns true if there is an exception for this date in the recurrence | 188 | /** returns true if there is an exception for this date in the recurrence |
189 | rule set, or false otherwise. */ | 189 | rule set, or false otherwise. */ |
190 | bool isException(const QDate &qd) const; | 190 | bool isException(const QDate &qd) const; |
191 | 191 | ||
192 | /** add attachment to this event */ | 192 | /** add attachment to this event */ |
193 | void addAttachment(Attachment *attachment); | 193 | void addAttachment(Attachment *attachment); |
194 | /** remove and delete a specific attachment */ | 194 | /** remove and delete a specific attachment */ |
195 | void deleteAttachment(Attachment *attachment); | 195 | void deleteAttachment(Attachment *attachment); |
196 | /** remove and delete all attachments with this mime type */ | 196 | /** remove and delete all attachments with this mime type */ |
197 | void deleteAttachments(const QString& mime); | 197 | void deleteAttachments(const QString& mime); |
198 | /** return list of all associated attachments */ | 198 | /** return list of all associated attachments */ |
199 | QPtrList<Attachment> attachments() const; | 199 | QPtrList<Attachment> attachments() const; |
200 | /** find a list of attachments with this mime type */ | 200 | /** find a list of attachments with this mime type */ |
201 | QPtrList<Attachment> attachments(const QString& mime) const; | 201 | QPtrList<Attachment> attachments(const QString& mime) const; |
202 | 202 | ||
203 | /** sets the event's status the value specified. See the enumeration | 203 | /** sets the event's status the value specified. See the enumeration |
204 | * above for possible values. */ | 204 | * above for possible values. */ |
205 | void setSecrecy(int); | 205 | void setSecrecy(int); |
206 | /** return the event's secrecy. */ | 206 | /** return the event's secrecy. */ |
207 | int secrecy() const; | 207 | int secrecy() const; |
208 | /** return the event's secrecy in string format. */ | 208 | /** return the event's secrecy in string format. */ |
209 | QString secrecyStr() const; | 209 | QString secrecyStr() const; |
210 | /** return list of all availbale secrecy classes */ | 210 | /** return list of all availbale secrecy classes */ |
211 | static QStringList secrecyList(); | 211 | static QStringList secrecyList(); |
212 | /** return human-readable name of secrecy class */ | 212 | /** return human-readable name of secrecy class */ |
213 | static QString secrecyName(int); | 213 | static QString secrecyName(int); |
214 | 214 | ||
215 | /** returns TRUE if the date specified is one on which the event will | 215 | /** returns TRUE if the date specified is one on which the event will |
216 | * recur. */ | 216 | * recur. */ |
217 | bool recursOn(const QDate &qd) const; | 217 | bool recursOn(const QDate &qd) const; |
218 | 218 | ||
219 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): | 219 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): |
220 | 220 | ||
221 | /** set resources used, such as Office, Car, etc. */ | 221 | /** set resources used, such as Office, Car, etc. */ |
222 | void setResources(const QStringList &resources); | 222 | void setResources(const QStringList &resources); |
223 | /** return list of current resources */ | 223 | /** return list of current resources */ |
224 | QStringList resources() const; | 224 | QStringList resources() const; |
225 | 225 | ||
226 | /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ | 226 | /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ |
227 | void setPriority(int priority); | 227 | void setPriority(int priority); |
228 | /** get the event's priority */ | 228 | /** get the event's priority */ |
229 | int priority() const; | 229 | int priority() const; |
230 | 230 | ||
231 | /** All alarms that are associated with this incidence */ | 231 | /** All alarms that are associated with this incidence */ |
232 | QPtrList<Alarm> alarms() const; | 232 | QPtrList<Alarm> alarms() const; |
233 | /** Create a new alarm which is associated with this incidence */ | 233 | /** Create a new alarm which is associated with this incidence */ |
234 | Alarm* newAlarm(); | 234 | Alarm* newAlarm(); |
235 | /** Add an alarm which is associated with this incidence */ | 235 | /** Add an alarm which is associated with this incidence */ |
236 | void addAlarm(Alarm*); | 236 | void addAlarm(Alarm*); |
237 | /** Remove an alarm that is associated with this incidence */ | 237 | /** Remove an alarm that is associated with this incidence */ |
238 | void removeAlarm(Alarm*); | 238 | void removeAlarm(Alarm*); |
239 | /** Remove all alarms that are associated with this incidence */ | 239 | /** Remove all alarms that are associated with this incidence */ |
240 | void clearAlarms(); | 240 | void clearAlarms(); |
241 | /** return whether any alarm associated with this incidence is enabled */ | 241 | /** return whether any alarm associated with this incidence is enabled */ |
242 | bool isAlarmEnabled() const; | 242 | bool isAlarmEnabled() const; |
243 | 243 | ||
244 | /** | 244 | /** |
245 | Return the recurrence rule associated with this incidence. If there is | 245 | Return the recurrence rule associated with this incidence. If there is |
246 | none, returns an appropriate (non-0) object. | 246 | none, returns an appropriate (non-0) object. |
247 | */ | 247 | */ |
248 | Recurrence *recurrence() const; | 248 | Recurrence *recurrence() const; |
249 | void setRecurrence(Recurrence * r); | 249 | void setRecurrence(Recurrence * r); |
250 | /** | 250 | /** |
251 | Forward to Recurrence::doesRecur(). | 251 | Forward to Recurrence::doesRecur(). |
252 | */ | 252 | */ |
253 | ushort doesRecur() const; | 253 | ushort doesRecur() const; |
254 | 254 | ||
255 | /** set the event's/todo's location. Do _not_ use it with journal */ | 255 | /** set the event's/todo's location. Do _not_ use it with journal */ |
256 | void setLocation(const QString &location); | 256 | void setLocation(const QString &location); |
257 | /** return the event's/todo's location. Do _not_ use it with journal */ | 257 | /** return the event's/todo's location. Do _not_ use it with journal */ |
258 | QString location() const; | 258 | QString location() const; |
259 | /** returns TRUE or FALSE depending on whether the todo has a start date */ | 259 | /** returns TRUE or FALSE depending on whether the todo has a start date */ |
260 | bool hasStartDate() const; | 260 | bool hasStartDate() const; |
261 | /** sets the event's hasStartDate value. */ | 261 | /** sets the event's hasStartDate value. */ |
262 | void setHasStartDate(bool f); | 262 | void setHasStartDate(bool f); |
263 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; | 263 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; |
264 | bool cancelled() const; | 264 | bool cancelled() const; |
265 | void setCancelled( bool b ); | 265 | void setCancelled( bool b ); |
266 | |||
267 | bool hasRecurrenceID() const; | ||
268 | void setHasRecurrenceID( bool b ); | ||
269 | |||
270 | void setRecurrenceID(QDateTime); | ||
271 | QDateTime recurrenceID () const; | ||
272 | |||
266 | 273 | ||
267 | protected: | 274 | protected: |
268 | QPtrList<Alarm> mAlarms; | 275 | QPtrList<Alarm> mAlarms; |
269 | QPtrList<Incidence> mRelations; | 276 | QPtrList<Incidence> mRelations; |
270 | private: | 277 | private: |
271 | int mRevision; | 278 | int mRevision; |
272 | bool mCancelled; | 279 | bool mCancelled; |
273 | 280 | ||
274 | // base components of jounal, event and todo | 281 | // base components of jounal, event and todo |
282 | QDateTime mRecurrenceID; | ||
283 | bool mHasRecurrenceID; | ||
275 | QDateTime mCreated; | 284 | QDateTime mCreated; |
276 | QString mDescription; | 285 | QString mDescription; |
277 | QString mSummary; | 286 | QString mSummary; |
278 | QStringList mCategories; | 287 | QStringList mCategories; |
279 | Incidence *mRelatedTo; | 288 | Incidence *mRelatedTo; |
280 | QString mRelatedToUid; | 289 | QString mRelatedToUid; |
281 | DateList mExDates; | 290 | DateList mExDates; |
282 | QPtrList<Attachment> mAttachments; | 291 | QPtrList<Attachment> mAttachments; |
283 | QStringList mResources; | 292 | QStringList mResources; |
284 | bool mHasStartDate; // if todo has associated start date | 293 | bool mHasStartDate; // if todo has associated start date |
285 | 294 | ||
286 | int mSecrecy; | 295 | int mSecrecy; |
287 | int mPriority; // 1 = highest, 2 = less, etc. | 296 | int mPriority; // 1 = highest, 2 = less, etc. |
288 | 297 | ||
289 | //QPtrList<Alarm> mAlarms; | 298 | //QPtrList<Alarm> mAlarms; |
290 | Recurrence *mRecurrence; | 299 | Recurrence *mRecurrence; |
291 | 300 | ||
292 | QString mLocation; | 301 | QString mLocation; |
293 | }; | 302 | }; |
294 | 303 | ||
295 | bool operator==( const Incidence&, const Incidence& ); | 304 | bool operator==( const Incidence&, const Incidence& ); |
296 | 305 | ||
297 | } | 306 | } |
298 | 307 | ||
299 | #endif | 308 | #endif |
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h index 7b44bfb..a2fc2dc 100644 --- a/microkde/kdialogbase.h +++ b/microkde/kdialogbase.h | |||
@@ -1,141 +1,141 @@ | |||
1 | #ifndef MINIKDE_KDIALOGBASE_H | 1 | #ifndef MINIKDE_KDIALOGBASE_H |
2 | #define MINIKDE_KDIALOGBASE_H | 2 | #define MINIKDE_KDIALOGBASE_H |
3 | 3 | ||
4 | #include <qframe.h> | 4 | #include <qframe.h> |
5 | 5 | ||
6 | #include "kdialog.h" | 6 | #include "kdialog.h" |
7 | 7 | ||
8 | class QPushButton; | 8 | class QPushButton; |
9 | class QLayout; | 9 | class QLayout; |
10 | class QTabWidget; | 10 | class QTabWidget; |
11 | class QBoxLayout; | 11 | class QBoxLayout; |
12 | 12 | ||
13 | class KDialogBase : public KDialog | 13 | class KDialogBase : public KDialog |
14 | { | 14 | { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | public: | 16 | public: |
17 | enum ButtonCode | 17 | enum ButtonCode |
18 | { | 18 | { |
19 | Help = 0x00000001, | 19 | Help = 0x00000001, |
20 | Default = 0x00000002, | 20 | Default = 0x00000002, |
21 | Ok = 0x00000004, | 21 | Ok = 0x00000004, |
22 | Apply = 0x00000008, | 22 | Apply = 0x00000008, |
23 | Try = 0x00000010, | 23 | Try = 0x00000010, |
24 | Cancel = 0x00000020, | 24 | Cancel = 0x00000020, |
25 | Close = 0x00000040, | 25 | Close = 0x00000040, |
26 | User1 = 0x00000080, | 26 | User1 = 0x00000080, |
27 | User2 = 0x00000100, | 27 | User2 = 0x00000100, |
28 | User3 = 0x00000200, | 28 | User3 = 0x00000200, |
29 | No = 0x00000080, | 29 | No = 0x00000080, |
30 | Yes = 0x00000100, | 30 | Yes = 0x00000100, |
31 | Details = 0x00000400, | 31 | Details = 0x00000400, |
32 | Filler = 0x40000000, | 32 | Filler = 0x40000000, |
33 | Stretch = 0x80000000 | 33 | Stretch = 0x80000000 |
34 | }; | 34 | }; |
35 | 35 | ||
36 | enum DialogType | 36 | enum DialogType |
37 | { | 37 | { |
38 | TreeList, | 38 | TreeList, |
39 | Tabbed, | 39 | Tabbed, |
40 | Plain, | 40 | Plain, |
41 | Swallow, | 41 | Swallow, |
42 | IconList | 42 | IconList |
43 | }; | 43 | }; |
44 | 44 | ||
45 | KDialogBase(); | 45 | KDialogBase(); |
46 | KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true, | 46 | KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true, |
47 | const QString &caption=QString::null, | 47 | const QString &caption=QString::null, |
48 | int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, | 48 | int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, |
49 | bool separator=false, | 49 | bool separator=false, |
50 | const QString &user1=QString::null, | 50 | const QString &user1=QString::null, |
51 | const QString &user2=QString::null, | 51 | const QString &user2=QString::null, |
52 | const QString &user3=QString::null); | 52 | const QString &user3=QString::null); |
53 | KDialogBase( int dialogFace, const QString &caption, | 53 | KDialogBase( int dialogFace, const QString &caption, |
54 | int buttonMask, ButtonCode defaultButton, | 54 | int buttonMask, ButtonCode defaultButton, |
55 | QWidget *parent=0, const char *name=0, bool modal=true, | 55 | QWidget *parent=0, const char *name=0, bool modal=true, |
56 | bool separator=false, | 56 | bool separator=false, |
57 | const QString &user1=QString::null, | 57 | const QString &user1=QString::null, |
58 | const QString &user2=QString::null, | 58 | const QString &user2=QString::null, |
59 | const QString &user3=QString::null); | 59 | const QString &user3=QString::null); |
60 | virtual ~KDialogBase(); | 60 | virtual ~KDialogBase(); |
61 | 61 | ||
62 | QFrame *addPage( const QString & ); | 62 | QFrame *addPage( const QString & ); |
63 | QFrame *addPage( const QString &, int, const QPixmap & ); | 63 | QFrame *addPage( const QString &, int, const QPixmap & ); |
64 | 64 | ||
65 | void setMainWidget( QWidget *widget ); | 65 | void setMainWidget( QWidget *widget ); |
66 | 66 | ||
67 | void setButtonText( ButtonCode id, const QString &text ); | 67 | void setButtonText( ButtonCode id, const QString &text ); |
68 | 68 | ||
69 | void enableButton( ButtonCode id, bool state ); | 69 | void enableButton( ButtonCode id, bool state ); |
70 | void enableButtonOK( bool state ); | 70 | void enableButtonOK( bool state ); |
71 | void enableButtonApply( bool state ); | 71 | void enableButtonApply( bool state ); |
72 | 72 | ||
73 | void showButton( ButtonCode, bool show ); | 73 | void showButton( ButtonCode, bool show ); |
74 | 74 | ||
75 | int pageIndex( QWidget *widget ) const; | 75 | int pageIndex( QWidget *widget ) const; |
76 | 76 | ||
77 | bool showPage( int index ); | 77 | bool showPage( int index ); |
78 | void hideButtons(); | 78 | void hideButtons(); |
79 | 79 | ||
80 | QFrame *plainPage(); | 80 | QFrame *plainPage(); |
81 | 81 | ||
82 | signals: | 82 | signals: |
83 | void user1Clicked(); | 83 | void user1Clicked(); |
84 | void user2Clicked(); | 84 | void user2Clicked(); |
85 | /** | 85 | /** |
86 | * The Apply button was pressed. This signal is only emitted if | 86 | * The Apply button was pressed. This signal is only emitted if |
87 | * @ref slotApply() is not replaced. | 87 | * @ref slotApply() is not replaced. |
88 | */ | 88 | */ |
89 | void applyClicked(); | 89 | void applyClicked(); |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * The OK button was pressed. This signal is only emitted if | 92 | * The OK button was pressed. This signal is only emitted if |
93 | * @ref slotOk() is not replaced. | 93 | * @ref slotOk() is not replaced. |
94 | */ | 94 | */ |
95 | void okClicked(); | 95 | void okClicked(); |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * The Cancel button was pressed. This signal is only emitted if | 98 | * The Cancel button was pressed. This signal is only emitted if |
99 | * @ref slotCancel() is not replaced. | 99 | * @ref slotCancel() is not replaced. |
100 | */ | 100 | */ |
101 | void cancelClicked(); | 101 | void cancelClicked(); |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * The Close button was pressed. This signal is only emitted if | 104 | * The Close button was pressed. This signal is only emitted if |
105 | * @ref slotClose() is not replaced. | 105 | * @ref slotClose() is not replaced. |
106 | */ | 106 | */ |
107 | void closeClicked(); | 107 | void closeClicked(); |
108 | void defaultClicked(); | 108 | void defaultClicked(); |
109 | 109 | ||
110 | protected slots: | 110 | protected slots: |
111 | virtual void slotOk(); | 111 | virtual void slotOk(); |
112 | virtual void slotApply(); | 112 | virtual void slotApply(); |
113 | virtual void slotCancel(); | 113 | virtual void slotCancel(); |
114 | virtual void slotClose(); | 114 | virtual void slotClose(); |
115 | virtual void slotUser1(); | 115 | virtual void slotUser1(); |
116 | virtual void slotUser2(); | 116 | virtual void slotUser2(); |
117 | 117 | ||
118 | protected: | 118 | protected: |
119 | QPushButton *findButton( ButtonCode ); | 119 | QPushButton *findButton( ButtonCode ); |
120 | QTabWidget *tabWidget(); | ||
120 | 121 | ||
121 | private: | 122 | private: |
122 | QTabWidget *tabWidget(); | ||
123 | void init( const QString &caption, int buttonMask, | 123 | void init( const QString &caption, int buttonMask, |
124 | const QString &user1=QString::null, const QString &user2=QString::null ); | 124 | const QString &user1=QString::null, const QString &user2=QString::null ); |
125 | void initLayout(); | 125 | void initLayout(); |
126 | 126 | ||
127 | QWidget *mMainWidget; | 127 | QWidget *mMainWidget; |
128 | QTabWidget *mTabWidget; | 128 | QTabWidget *mTabWidget; |
129 | QFrame *mPlainPage; | 129 | QFrame *mPlainPage; |
130 | QBoxLayout *mTopLayout; | 130 | QBoxLayout *mTopLayout; |
131 | 131 | ||
132 | QPushButton *mUser1Button; | 132 | QPushButton *mUser1Button; |
133 | QPushButton *mUser2Button; | 133 | QPushButton *mUser2Button; |
134 | QPushButton *mCloseButton; | 134 | QPushButton *mCloseButton; |
135 | QPushButton *mOkButton; | 135 | QPushButton *mOkButton; |
136 | QPushButton *mApplyButton; | 136 | QPushButton *mApplyButton; |
137 | QPushButton *mCancelButton; | 137 | QPushButton *mCancelButton; |
138 | QPushButton *mDefaultButton; | 138 | QPushButton *mDefaultButton; |
139 | }; | 139 | }; |
140 | 140 | ||
141 | #endif | 141 | #endif |