-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 2 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 20 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 53 | ||||
-rw-r--r-- | korganizer/kotodoeditor.cpp | 53 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 11 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 28 | ||||
-rw-r--r-- | libkcal/incidence.h | 3 |
7 files changed, 103 insertions, 67 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 2981762..7fa92bf 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt | |||
@@ -1343,18 +1343,18 @@ | |||
1343 | { "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, | 1343 | { "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, |
1344 | { "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, | 1344 | { "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, |
1345 | { "Todo has subtodos","Todo hat Untertodos" }, | 1345 | { "Todo has subtodos","Todo hat Untertodos" }, |
1346 | { "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, | 1346 | { "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, |
1347 | { "Colors","Farben" }, | 1347 | { "Colors","Farben" }, |
1348 | { "Click on new parent item","Klicke auf neues Übertodo" }, | 1348 | { "Click on new parent item","Klicke auf neues Übertodo" }, |
1349 | { "Reparenting aborted!","Übertodo setzen abgebrochen" }, | 1349 | { "Reparenting aborted!","Übertodo setzen abgebrochen" }, |
1350 | { "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, | 1350 | { "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, |
1351 | { "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, | 1351 | { "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, |
1352 | { "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, | 1352 | { "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, |
1353 | { "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, | 1353 | { "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, |
1354 | { "times","Zeiten" }, | 1354 | { "times","Zeiten" }, |
1355 | { "","" }, | 1355 | { "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, |
1356 | { "","" }, | 1356 | { "","" }, |
1357 | { "","" }, | 1357 | { "","" }, |
1358 | { "","" }, | 1358 | { "","" }, |
1359 | { "","" }, | 1359 | { "","" }, |
1360 | { "","" }, | 1360 | { "","" }, |
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index 4a1576a..e86b4d0 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp | |||
@@ -30,24 +30,25 @@ | |||
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | 33 | ||
34 | #include <kglobal.h> | 34 | #include <kglobal.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
37 | #include <kmessagebox.h> | 37 | #include <kmessagebox.h> |
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <krestrictedline.h> | 39 | #include <krestrictedline.h> |
40 | #include <kstandarddirs.h> | 40 | #include <kstandarddirs.h> |
41 | #include <kfiledialog.h> | 41 | #include <kfiledialog.h> |
42 | #include <kdialog.h> | ||
42 | 43 | ||
43 | #include <libkcal/todo.h> | 44 | #include <libkcal/todo.h> |
44 | 45 | ||
45 | #include <libkdepim/kdateedit.h> | 46 | #include <libkdepim/kdateedit.h> |
46 | 47 | ||
47 | #include "koprefs.h" | 48 | #include "koprefs.h" |
48 | #include "ktimeedit.h" | 49 | #include "ktimeedit.h" |
49 | 50 | ||
50 | #include "koeditorgeneraltodo.h" | 51 | #include "koeditorgeneraltodo.h" |
51 | #include "kolocationbox.h" | 52 | #include "kolocationbox.h" |
52 | 53 | ||
53 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, | 54 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, |
@@ -79,54 +80,54 @@ void KOEditorGeneralTodo::finishSetup() | |||
79 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); | 80 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); |
80 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 81 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
81 | mSummaryEdit->setFocus(); | 82 | mSummaryEdit->setFocus(); |
82 | } | 83 | } |
83 | 84 | ||
84 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) | 85 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) |
85 | { | 86 | { |
86 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); | 87 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); |
87 | 88 | ||
88 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, | 89 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, |
89 | i18n("Date && Time"),parent); | 90 | i18n("Date && Time"),parent); |
90 | timeLayout->addWidget(timeGroupBox); | 91 | timeLayout->addWidget(timeGroupBox); |
91 | timeGroupBox->layout()->setSpacing( 0 ); | 92 | timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() ); |
92 | timeGroupBox->layout()->setMargin( 5 ); | 93 | timeGroupBox->layout()->setMargin( KDialog::marginHint() ); |
93 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); | 94 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); |
94 | 95 | ||
95 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); | 96 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); |
96 | layoutTimeBox->setSpacing(topLayout->spacing()); | 97 | layoutTimeBox->setSpacing(KDialog::spacingHintSmall()); |
97 | layoutTimeBox->setColStretch( 1, 1 ); | 98 | layoutTimeBox->setColStretch( 1, 1 ); |
98 | 99 | ||
99 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); | 100 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); |
100 | layoutTimeBox->addWidget(mDueCheck,0,0); | 101 | layoutTimeBox->addWidget(mDueCheck,1,0); |
101 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); | 102 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); |
102 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); | 103 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); |
103 | 104 | ||
104 | 105 | ||
105 | mDueDateEdit = new KDateEdit(timeBoxFrame); | 106 | mDueDateEdit = new KDateEdit(timeBoxFrame); |
106 | layoutTimeBox->addWidget(mDueDateEdit,0,1); | 107 | layoutTimeBox->addWidget(mDueDateEdit,1,1); |
107 | 108 | ||
108 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); | 109 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); |
109 | layoutTimeBox->addWidget(mDueTimeEdit,0,2); | 110 | layoutTimeBox->addWidget(mDueTimeEdit,1,2); |
110 | 111 | ||
111 | 112 | ||
112 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); | 113 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); |
113 | layoutTimeBox->addWidget(mStartCheck,1,0); | 114 | layoutTimeBox->addWidget(mStartCheck,0,0); |
114 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); | 115 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); |
115 | 116 | ||
116 | mStartDateEdit = new KDateEdit(timeBoxFrame); | 117 | mStartDateEdit = new KDateEdit(timeBoxFrame); |
117 | layoutTimeBox->addWidget(mStartDateEdit,1,1); | 118 | layoutTimeBox->addWidget(mStartDateEdit,0,1); |
118 | 119 | ||
119 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); | 120 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); |
120 | layoutTimeBox->addWidget(mStartTimeEdit,1,2); | 121 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); |
121 | 122 | ||
122 | 123 | ||
123 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); | 124 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); |
124 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); | 125 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); |
125 | 126 | ||
126 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); | 127 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); |
127 | connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); | 128 | connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); |
128 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); | 129 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); |
129 | 130 | ||
130 | // some more layouting | 131 | // some more layouting |
131 | //layoutTimeBox->setColStretch(3,1); | 132 | //layoutTimeBox->setColStretch(3,1); |
132 | } | 133 | } |
@@ -332,25 +333,24 @@ void KOEditorGeneralTodo::writeTodo(Todo *todo) | |||
332 | tmpDate = mStartDateEdit->date(); | 333 | tmpDate = mStartDateEdit->date(); |
333 | tmpTime.setHMS(0,0,0); | 334 | tmpTime.setHMS(0,0,0); |
334 | tmpDT.setDate(tmpDate); | 335 | tmpDT.setDate(tmpDate); |
335 | tmpDT.setTime(tmpTime); | 336 | tmpDT.setTime(tmpTime); |
336 | todo->setDtStart(tmpDT); | 337 | todo->setDtStart(tmpDT); |
337 | } | 338 | } |
338 | todo->setPriority(mPriorityCombo->currentItem()+1); | 339 | todo->setPriority(mPriorityCombo->currentItem()+1); |
339 | 340 | ||
340 | // set completion state | 341 | // set completion state |
341 | if ( mCompletedCombo->currentItem() == 5 ) { | 342 | if ( mCompletedCombo->currentItem() == 5 ) { |
342 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); | 343 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); |
343 | if ( comp.isValid () ) { | 344 | if ( comp.isValid () ) { |
344 | todo->setPercentComplete(0); | ||
345 | todo->setPercentComplete(100); | 345 | todo->setPercentComplete(100); |
346 | todo->setCompleted(comp); | 346 | todo->setCompleted(comp); |
347 | } else { | 347 | } else { |
348 | todo->setPercentComplete( 100 ); | 348 | todo->setPercentComplete( 100 ); |
349 | if ( mCompleted.isValid() ) | 349 | if ( mCompleted.isValid() ) |
350 | todo->setCompleted(mCompleted); | 350 | todo->setCompleted(mCompleted); |
351 | } | 351 | } |
352 | } else { | 352 | } else { |
353 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); | 353 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); |
354 | } | 354 | } |
355 | 355 | ||
356 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); | 356 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index bbf83d9..fd86095 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -362,26 +362,24 @@ void KOListView::addCat( ) | |||
362 | { | 362 | { |
363 | setCategories( false ); | 363 | setCategories( false ); |
364 | } | 364 | } |
365 | void KOListView::setCat() | 365 | void KOListView::setCat() |
366 | { | 366 | { |
367 | setCategories( true ); | 367 | setCategories( true ); |
368 | } | 368 | } |
369 | void KOListView::setAlarm() | 369 | void KOListView::setAlarm() |
370 | { | 370 | { |
371 | KOAlarmPrefs kap( this); | 371 | KOAlarmPrefs kap( this); |
372 | if ( !kap.exec() ) | 372 | if ( !kap.exec() ) |
373 | return; | 373 | return; |
374 | |||
375 | |||
376 | QStringList itemList; | 374 | QStringList itemList; |
377 | QPtrList<KOListViewItem> sel ; | 375 | QPtrList<KOListViewItem> sel ; |
378 | QListViewItem *qitem = mListView->firstChild (); | 376 | QListViewItem *qitem = mListView->firstChild (); |
379 | while ( qitem ) { | 377 | while ( qitem ) { |
380 | if ( qitem->isSelected() ) { | 378 | if ( qitem->isSelected() ) { |
381 | Incidence* inc = ((KOListViewItem *) qitem)->data(); | 379 | Incidence* inc = ((KOListViewItem *) qitem)->data(); |
382 | if ( inc->type() != "Journal" ) { | 380 | if ( inc->type() != "Journal" ) { |
383 | if ( inc->type() == "Todo" ) { | 381 | if ( inc->type() == "Todo" ) { |
384 | if ( ((Todo*)inc)->hasDueDate() ) | 382 | if ( ((Todo*)inc)->hasDueDate() ) |
385 | sel.append(((KOListViewItem *)qitem)); | 383 | sel.append(((KOListViewItem *)qitem)); |
386 | } else | 384 | } else |
387 | sel.append(((KOListViewItem *)qitem)); | 385 | sel.append(((KOListViewItem *)qitem)); |
@@ -419,80 +417,83 @@ void KOListView::setAlarm() | |||
419 | alarm->setType(Alarm::Invalid); | 417 | alarm->setType(Alarm::Invalid); |
420 | //alarm->setAudioAlarm("default"); | 418 | //alarm->setAudioAlarm("default"); |
421 | // TODO: Deal with multiple alarms | 419 | // TODO: Deal with multiple alarms |
422 | break; // For now, stop after the first alarm | 420 | break; // For now, stop after the first alarm |
423 | } | 421 | } |
424 | } else { | 422 | } else { |
425 | Alarm* alarm = inc->alarms().first(); | 423 | Alarm* alarm = inc->alarms().first(); |
426 | if ( alarm ) { | 424 | if ( alarm ) { |
427 | alarm->setEnabled(false); | 425 | alarm->setEnabled(false); |
428 | alarm->setType(Alarm::Invalid); | 426 | alarm->setType(Alarm::Invalid); |
429 | } | 427 | } |
430 | } | 428 | } |
431 | temp = item; | 429 | ListItemVisitor v(item, mStartDate ); |
432 | item = sel.next(); | 430 | inc->accept(v); |
433 | mUidDict.remove( inc->uid() ); | 431 | item = sel.next(); |
434 | delete temp;; | ||
435 | addIncidence( inc ); | ||
436 | } | 432 | } |
437 | topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); | 433 | topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); |
438 | qDebug("KO: Set alarm for %d items", count); | 434 | qDebug("KO: Set alarm for %d items", count); |
439 | calendar()->reInitAlarmSettings(); | 435 | calendar()->reInitAlarmSettings(); |
440 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 436 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
441 | } | 437 | } |
442 | void KOListView::setCategories( bool removeOld ) | 438 | void KOListView::setCategories( bool removeOld ) |
443 | { | 439 | { |
444 | 440 | ||
445 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 441 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
442 | csd->setColorEnabled(); | ||
446 | if (! csd->exec()) { | 443 | if (! csd->exec()) { |
447 | delete csd; | 444 | delete csd; |
448 | return; | 445 | return; |
449 | } | 446 | } |
450 | QStringList catList = csd->selectedCategories(); | 447 | QStringList catList = csd->selectedCategories(); |
451 | delete csd; | 448 | delete csd; |
452 | // if ( catList.count() == 0 ) | 449 | // if ( catList.count() == 0 ) |
453 | // return; | 450 | // return; |
454 | catList.sort(); | 451 | //catList.sort(); |
455 | QString categoriesStr = catList.join(","); | 452 | QString categoriesStr = catList.join(","); |
456 | int i; | 453 | int i; |
457 | QStringList itemList; | 454 | QStringList itemList; |
458 | QPtrList<KOListViewItem> sel ; | 455 | QPtrList<KOListViewItem> sel ; |
459 | QListViewItem *qitem = mListView->firstChild (); | 456 | QListViewItem *qitem = mListView->firstChild (); |
460 | while ( qitem ) { | 457 | while ( qitem ) { |
461 | if ( qitem->isSelected() ) { | 458 | if ( qitem->isSelected() ) { |
462 | sel.append(((KOListViewItem *)qitem)); | 459 | sel.append(((KOListViewItem *)qitem)); |
463 | } | 460 | } |
464 | qitem = qitem->nextSibling(); | 461 | qitem = qitem->nextSibling(); |
465 | } | 462 | } |
466 | KOListViewItem * item, *temp; | 463 | KOListViewItem * item, *temp; |
467 | item = sel.first(); | 464 | item = sel.first(); |
468 | Incidence* inc; | 465 | if( item ) { |
469 | while ( item ) { | 466 | Incidence* inc = item->data() ; |
470 | inc = item->data(); | 467 | bool setSub = false; |
471 | if ( removeOld ) { | 468 | if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) { |
472 | inc->setCategories( categoriesStr ); | 469 | int result = KMessageBox::warningYesNoCancel(this, |
473 | } else { | 470 | i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), |
474 | itemList = QStringList::split (",", inc->categoriesStr() ); | 471 | i18n("Todo has subtodos"), |
475 | for( i = 0; i< catList.count(); ++i ) { | 472 | i18n("Yes"), |
476 | if ( !itemList.contains (catList[i])) | 473 | i18n("No")); |
477 | itemList.append( catList[i] ); | 474 | if (result == KMessageBox::Cancel) item = 0; |
478 | } | 475 | if (result == KMessageBox::Yes) setSub = true; |
479 | itemList.sort(); | 476 | } |
480 | inc->setCategories( itemList.join(",") ); | 477 | while ( item ) { |
478 | inc = item->data(); | ||
479 | if ( removeOld ) { | ||
480 | inc->setCategories( catList, setSub ); | ||
481 | } else { | ||
482 | inc->addCategories( catList, setSub ); | ||
483 | } | ||
484 | ListItemVisitor v(item, mStartDate ); | ||
485 | inc->accept(v); | ||
486 | item = sel.next(); | ||
481 | } | 487 | } |
482 | temp = item; | ||
483 | item = sel.next(); | ||
484 | mUidDict.remove( inc->uid() ); | ||
485 | delete temp;; | ||
486 | addIncidence( inc ); | ||
487 | } | 488 | } |
488 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 489 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
489 | } | 490 | } |
490 | 491 | ||
491 | void KOListView::beamSelected() | 492 | void KOListView::beamSelected() |
492 | { | 493 | { |
493 | int icount = 0; | 494 | int icount = 0; |
494 | QPtrList<Incidence> delSel ; | 495 | QPtrList<Incidence> delSel ; |
495 | QListViewItem *item = mListView->firstChild (); | 496 | QListViewItem *item = mListView->firstChild (); |
496 | while ( item ) { | 497 | while ( item ) { |
497 | if ( item->isSelected() ) { | 498 | if ( item->isSelected() ) { |
498 | delSel.append(((KOListViewItem *)item)->data()); | 499 | delSel.append(((KOListViewItem *)item)->data()); |
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 6a05cc8..5513e8b 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp | |||
@@ -101,29 +101,29 @@ void KOTodoEditor::setupGeneral() | |||
101 | mGeneral = new KOEditorGeneralTodo(this); | 101 | mGeneral = new KOEditorGeneralTodo(this); |
102 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); | 102 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); |
103 | 103 | ||
104 | // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); | 104 | // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); |
105 | //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), | 105 | //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), |
106 | // mGeneral,SLOT(setCategories(const QString &))); | 106 | // mGeneral,SLOT(setCategories(const QString &))); |
107 | 107 | ||
108 | if (KOPrefs::instance()->mCompactDialogs) { | 108 | if (KOPrefs::instance()->mCompactDialogs) { |
109 | QFrame *topFrame = addPage(i18n("General")); | 109 | QFrame *topFrame = addPage(i18n("General")); |
110 | 110 | ||
111 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 111 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); |
112 | if ( QApplication::desktop()->width() < 480 ) { | 112 | if ( QApplication::desktop()->width() < 480 ) { |
113 | topLayout->setMargin(1); | 113 | topLayout->setMargin(marginHintSmall()); |
114 | topLayout->setSpacing(1); | 114 | topLayout->setSpacing(spacingHintSmall()); |
115 | } else { | 115 | } else { |
116 | topLayout->setMargin(marginHint()-1); | 116 | topLayout->setMargin(marginHint()); |
117 | topLayout->setSpacing(spacingHint()-1); | 117 | topLayout->setSpacing(spacingHint()); |
118 | } | 118 | } |
119 | mGeneral->initHeader(topFrame,topLayout); | 119 | mGeneral->initHeader(topFrame,topLayout); |
120 | mGeneral->initTime(topFrame,topLayout); | 120 | mGeneral->initTime(topFrame,topLayout); |
121 | mGeneral->initAlarm(topFrame,topLayout); | 121 | mGeneral->initAlarm(topFrame,topLayout); |
122 | mGeneral->enableAlarm( false ); | 122 | mGeneral->enableAlarm( false ); |
123 | 123 | ||
124 | 124 | ||
125 | QBoxLayout *priorityLayout; | 125 | QBoxLayout *priorityLayout; |
126 | if ( QApplication::desktop()->width() < 500 ) | 126 | if ( QApplication::desktop()->width() < 500 ) |
127 | priorityLayout = new QVBoxLayout( topLayout ); | 127 | priorityLayout = new QVBoxLayout( topLayout ); |
128 | else | 128 | else |
129 | priorityLayout = new QHBoxLayout( topLayout ); | 129 | priorityLayout = new QHBoxLayout( topLayout ); |
@@ -335,43 +335,50 @@ void KOTodoEditor::readTodo(Todo *todo) | |||
335 | { | 335 | { |
336 | mGeneral->readTodo(todo); | 336 | mGeneral->readTodo(todo); |
337 | mDetails->readEvent(todo); | 337 | mDetails->readEvent(todo); |
338 | mRelatedTodo = 0;//todo->relatedTo(); | 338 | mRelatedTodo = 0;//todo->relatedTo(); |
339 | // categories | 339 | // categories |
340 | // mCategoryDialog->setSelected(todo->categories()); | 340 | // mCategoryDialog->setSelected(todo->categories()); |
341 | 341 | ||
342 | // We should handle read-only events here. | 342 | // We should handle read-only events here. |
343 | } | 343 | } |
344 | 344 | ||
345 | void KOTodoEditor::writeTodo(Todo *event) | 345 | void KOTodoEditor::writeTodo(Todo *event) |
346 | { | 346 | { |
347 | mGeneral->writeTodo(event); | 347 | bool maybeComputeRecurrenceTime = false; |
348 | mDetails->writeEvent(event); | 348 | if( event->hasRecurrenceID() && event->percentComplete() < 100) |
349 | 349 | maybeComputeRecurrenceTime = true; | |
350 | // set related event, i.e. parent to-do in this case. | 350 | event->setHasRecurrenceID( false ); |
351 | if (mRelatedTodo) { | 351 | mGeneral->writeTodo(event); |
352 | event->setRelatedTo(mRelatedTodo); | 352 | mDetails->writeEvent(event); |
353 | } | 353 | |
354 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { | 354 | // set related event, i.e. parent to-do in this case. |
355 | mRecurrence->writeEvent(event); | 355 | if (mRelatedTodo) { |
356 | if ( event->doesRecur() ) { | 356 | event->setRelatedTo(mRelatedTodo); |
357 | event->setRecurrenceID( event->dtStart().addSecs(-1) ); | 357 | } |
358 | event->setRecurDates(); | 358 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { |
359 | } else { | 359 | mRecurrence->writeEvent(event); |
360 | event->setHasRecurrenceID( false ); | 360 | if ( event->doesRecur() ) { |
361 | } | 361 | int addSec = -1 ; |
362 | } else { | 362 | if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 ) |
363 | event->setHasRecurrenceID( false ); | 363 | addSec = 1; |
364 | event->recurrence()->unsetRecurs(); | 364 | event->setRecurrenceID( event->dtStart().addSecs( addSec ) ); |
365 | } | 365 | event->setRecurDates(); |
366 | } else { | ||
367 | event->setHasRecurrenceID( false ); | ||
368 | } | ||
369 | } else { | ||
370 | event->setHasRecurrenceID( false ); | ||
371 | event->recurrence()->unsetRecurs(); | ||
372 | } | ||
366 | } | 373 | } |
367 | 374 | ||
368 | bool KOTodoEditor::validateInput() | 375 | bool KOTodoEditor::validateInput() |
369 | { | 376 | { |
370 | if (!mGeneral->validateInput()) return false; | 377 | if (!mGeneral->validateInput()) return false; |
371 | if (!mDetails->validateInput()) return false; | 378 | if (!mDetails->validateInput()) return false; |
372 | return true; | 379 | return true; |
373 | } | 380 | } |
374 | 381 | ||
375 | int KOTodoEditor::msgItemDelete() | 382 | int KOTodoEditor::msgItemDelete() |
376 | { | 383 | { |
377 | return KMessageBox::warningContinueCancel(this, | 384 | return KMessageBox::warningContinueCancel(this, |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 25be63a..f26d16d 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -456,42 +456,42 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
456 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 456 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
457 | 457 | ||
458 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 458 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
459 | for (int i = 0; i <= 100; i+=20) { | 459 | for (int i = 0; i <= 100; i+=20) { |
460 | QString label = QString ("%1 %").arg (i); | 460 | QString label = QString ("%1 %").arg (i); |
461 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 461 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
462 | } | 462 | } |
463 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 463 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
464 | 464 | ||
465 | 465 | ||
466 | 466 | ||
467 | mItemPopupMenu = new QPopupMenu(this); | 467 | mItemPopupMenu = new QPopupMenu(this); |
468 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, | ||
469 | SLOT (toggleRunningItem())); | ||
470 | mItemPopupMenu->insertSeparator(); | ||
471 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 468 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
472 | SLOT (showTodo())); | 469 | SLOT (showTodo())); |
473 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 470 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
474 | SLOT (editTodo())); | 471 | SLOT (editTodo())); |
475 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 472 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
476 | SLOT (deleteTodo())); | 473 | SLOT (deleteTodo())); |
477 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 474 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
478 | SLOT (cloneTodo())); | 475 | SLOT (cloneTodo())); |
479 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 476 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
480 | SLOT (moveTodo())); | 477 | SLOT (moveTodo())); |
481 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 478 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
482 | SLOT (beamTodo())); | 479 | SLOT (beamTodo())); |
483 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 480 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
484 | SLOT (cancelTodo())); | 481 | SLOT (cancelTodo())); |
485 | mItemPopupMenu->insertSeparator(); | 482 | mItemPopupMenu->insertSeparator(); |
483 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, | ||
484 | SLOT (toggleRunningItem())); | ||
485 | mItemPopupMenu->insertSeparator(); | ||
486 | /* | 486 | /* |
487 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 487 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
488 | SLOT (newTodo())); | 488 | SLOT (newTodo())); |
489 | */ | 489 | */ |
490 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 490 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
491 | SLOT (newSubTodo())); | 491 | SLOT (newSubTodo())); |
492 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 492 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
493 | SLOT (unparentTodo()),0,21); | 493 | SLOT (unparentTodo()),0,21); |
494 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 494 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
495 | SLOT (reparentTodo()),0,22); | 495 | SLOT (reparentTodo()),0,22); |
496 | mItemPopupMenu->insertSeparator(); | 496 | mItemPopupMenu->insertSeparator(); |
497 | #if 0 | 497 | #if 0 |
@@ -503,34 +503,35 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
503 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 503 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
504 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 504 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
505 | this, SLOT( toggleRunning() ),0, 35 ); | 505 | this, SLOT( toggleRunning() ),0, 35 ); |
506 | 506 | ||
507 | #endif | 507 | #endif |
508 | mPopupMenu = new QPopupMenu(this); | 508 | mPopupMenu = new QPopupMenu(this); |
509 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 509 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
510 | SLOT (newTodo()),0,1); | 510 | SLOT (newTodo()),0,1); |
511 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 511 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
512 | this, SLOT(purgeCompleted()),0,2); | 512 | this, SLOT(purgeCompleted()),0,2); |
513 | mPopupMenu->insertItem(i18n("Show Completed"), | 513 | mPopupMenu->insertItem(i18n("Show Completed"), |
514 | this, SLOT( toggleCompleted() ),0,3 ); | 514 | this, SLOT( toggleCompleted() ),0,3 ); |
515 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | ||
516 | this, SLOT( toggleQuickTodo() ),0,4 ); | ||
517 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 515 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
518 | this, SLOT( toggleRunning() ),0,5 ); | 516 | this, SLOT( toggleRunning() ),0,5 ); |
519 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 517 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
520 | this, SLOT( setAllOpen() ),0,6 ); | 518 | this, SLOT( setAllOpen() ),0,6 ); |
521 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 519 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
522 | this, SLOT( setAllClose() ),0,7 ); | 520 | this, SLOT( setAllClose() ),0,7 ); |
523 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 521 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
524 | this, SLOT( setAllFlat() ),0,8 ); | 522 | this, SLOT( setAllFlat() ),0,8 ); |
523 | mPopupMenu->insertSeparator(); | ||
524 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | ||
525 | this, SLOT( toggleQuickTodo() ),0,4 ); | ||
525 | mDocPrefs = new DocPrefs( name ); | 526 | mDocPrefs = new DocPrefs( name ); |
526 | 527 | ||
527 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 528 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
528 | mPopupMenu->setCheckable( true ); | 529 | mPopupMenu->setCheckable( true ); |
529 | mItemPopupMenu->setCheckable( true ); | 530 | mItemPopupMenu->setCheckable( true ); |
530 | 531 | ||
531 | 532 | ||
532 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 533 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
533 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 534 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
534 | 535 | ||
535 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 536 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
536 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 537 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 9c35b1d..762103f 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -336,30 +336,56 @@ void Incidence::setSummary(const QString &summary) | |||
336 | 336 | ||
337 | QString Incidence::summary() const | 337 | QString Incidence::summary() const |
338 | { | 338 | { |
339 | return mSummary; | 339 | return mSummary; |
340 | } | 340 | } |
341 | void Incidence::checkCategories() | 341 | void Incidence::checkCategories() |
342 | { | 342 | { |
343 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); | 343 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); |
344 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); | 344 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); |
345 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); | 345 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); |
346 | } | 346 | } |
347 | 347 | ||
348 | void Incidence::setCategories(const QStringList &categories) | 348 | void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false |
349 | { | ||
350 | if (mReadOnly) return; | ||
351 | int i; | ||
352 | for( i = 0; i < categories.count(); ++i ) { | ||
353 | if ( !mCategories.contains (categories[i])) | ||
354 | mCategories.append( categories[i] ); | ||
355 | } | ||
356 | checkCategories(); | ||
357 | updated(); | ||
358 | if ( addToRelations ) { | ||
359 | Incidence * inc; | ||
360 | QPtrList<Incidence> Relations = relations(); | ||
361 | for (inc=Relations.first();inc;inc=Relations.next()) { | ||
362 | inc->addCategories( categories, true ); | ||
363 | } | ||
364 | } | ||
365 | } | ||
366 | |||
367 | void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false | ||
349 | { | 368 | { |
350 | if (mReadOnly) return; | 369 | if (mReadOnly) return; |
351 | mCategories = categories; | 370 | mCategories = categories; |
352 | checkCategories(); | 371 | checkCategories(); |
353 | updated(); | 372 | updated(); |
373 | if ( setForRelations ) { | ||
374 | Incidence * inc; | ||
375 | QPtrList<Incidence> Relations = relations(); | ||
376 | for (inc=Relations.first();inc;inc=Relations.next()) { | ||
377 | inc->setCategories( categories, true ); | ||
378 | } | ||
379 | } | ||
354 | } | 380 | } |
355 | 381 | ||
356 | // TODO: remove setCategories(QString) function | 382 | // TODO: remove setCategories(QString) function |
357 | void Incidence::setCategories(const QString &catStr) | 383 | void Incidence::setCategories(const QString &catStr) |
358 | { | 384 | { |
359 | if (mReadOnly) return; | 385 | if (mReadOnly) return; |
360 | mCategories.clear(); | 386 | mCategories.clear(); |
361 | 387 | ||
362 | if (catStr.isEmpty()) return; | 388 | if (catStr.isEmpty()) return; |
363 | 389 | ||
364 | mCategories = QStringList::split(",",catStr); | 390 | mCategories = QStringList::split(",",catStr); |
365 | 391 | ||
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 327e7dd..ebd50d0 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -142,25 +142,26 @@ class Incidence : public IncidenceBase | |||
142 | 142 | ||
143 | /** sets the event's lengthy description. */ | 143 | /** sets the event's lengthy description. */ |
144 | void setDescription(const QString &description); | 144 | void setDescription(const QString &description); |
145 | /** returns a reference to the event's description. */ | 145 | /** returns a reference to the event's description. */ |
146 | QString description() const; | 146 | QString description() const; |
147 | 147 | ||
148 | /** sets the event's short summary. */ | 148 | /** sets the event's short summary. */ |
149 | void setSummary(const QString &summary); | 149 | void setSummary(const QString &summary); |
150 | /** returns a reference to the event's summary. */ | 150 | /** returns a reference to the event's summary. */ |
151 | QString summary() const; | 151 | QString summary() const; |
152 | 152 | ||
153 | /** set event's applicable categories */ | 153 | /** set event's applicable categories */ |
154 | void setCategories(const QStringList &categories); | 154 | void setCategories(const QStringList &categories, bool setForRelations = false); |
155 | void addCategories(const QStringList &categories, bool addToRelations = false); | ||
155 | /** set event's categories based on a comma delimited string */ | 156 | /** set event's categories based on a comma delimited string */ |
156 | void setCategories(const QString &catStr); | 157 | void setCategories(const QString &catStr); |
157 | /** return categories in a list */ | 158 | /** return categories in a list */ |
158 | QStringList categories() const; | 159 | QStringList categories() const; |
159 | /** return categories as a comma separated string */ | 160 | /** return categories as a comma separated string */ |
160 | QString categoriesStr(); | 161 | QString categoriesStr(); |
161 | QString categoriesStrWithSpace(); | 162 | QString categoriesStrWithSpace(); |
162 | 163 | ||
163 | /** point at some other event to which the event relates. This function should | 164 | /** point at some other event to which the event relates. This function should |
164 | * only be used when constructing a calendar before the related Event | 165 | * only be used when constructing a calendar before the related Event |
165 | * exists. */ | 166 | * exists. */ |
166 | void setRelatedToUid(const QString &); | 167 | void setRelatedToUid(const QString &); |