summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt2
-rw-r--r--korganizer/koeditorgeneraltodo.cpp20
-rw-r--r--korganizer/kolistview.cpp41
-rw-r--r--korganizer/kotodoeditor.cpp17
-rw-r--r--korganizer/kotodoview.cpp11
-rw-r--r--libkcal/incidence.cpp28
-rw-r--r--libkcal/incidence.h3
7 files changed, 79 insertions, 43 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
@@ -1352,7 +1352,7 @@
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{ "","" },
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 4a1576a..e86b4d0 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -39,6 +39,7 @@
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
@@ -88,36 +89,36 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
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);
@@ -341,7 +342,6 @@ void KOEditorGeneralTodo::writeTodo(Todo *todo)
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 {
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index bbf83d9..fd86095 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -371,8 +371,6 @@ void KOListView::setAlarm()
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 ();
@@ -428,11 +426,9 @@ void KOListView::setAlarm()
428 alarm->setType(Alarm::Invalid); 426 alarm->setType(Alarm::Invalid);
429 } 427 }
430 } 428 }
431 temp = item; 429 ListItemVisitor v(item, mStartDate );
430 inc->accept(v);
432 item = sel.next(); 431 item = sel.next();
433 mUidDict.remove( inc->uid() );
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);
@@ -443,6 +439,7 @@ 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;
@@ -451,7 +448,7 @@ void KOListView::setCategories( bool removeOld )
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;
@@ -465,25 +462,29 @@ void KOListView::setCategories( bool removeOld )
465 } 462 }
466 KOListViewItem * item, *temp; 463 KOListViewItem * item, *temp;
467 item = sel.first(); 464 item = sel.first();
468 Incidence* inc; 465 if( item ) {
466 Incidence* inc = item->data() ;
467 bool setSub = false;
468 if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) {
469 int result = KMessageBox::warningYesNoCancel(this,
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 ) ),
471 i18n("Todo has subtodos"),
472 i18n("Yes"),
473 i18n("No"));
474 if (result == KMessageBox::Cancel) item = 0;
475 if (result == KMessageBox::Yes) setSub = true;
476 }
469 while ( item ) { 477 while ( item ) {
470 inc = item->data(); 478 inc = item->data();
471 if ( removeOld ) { 479 if ( removeOld ) {
472 inc->setCategories( categoriesStr ); 480 inc->setCategories( catList, setSub );
473 } else { 481 } else {
474 itemList = QStringList::split (",", inc->categoriesStr() ); 482 inc->addCategories( catList, setSub );
475 for( i = 0; i< catList.count(); ++i ) {
476 if ( !itemList.contains (catList[i]))
477 itemList.append( catList[i] );
478 }
479 itemList.sort();
480 inc->setCategories( itemList.join(",") );
481 } 483 }
482 temp = item; 484 ListItemVisitor v(item, mStartDate );
485 inc->accept(v);
483 item = sel.next(); 486 item = sel.next();
484 mUidDict.remove( inc->uid() ); 487 }
485 delete temp;;
486 addIncidence( inc );
487 } 488 }
488 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 489 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
489} 490}
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 6a05cc8..5513e8b 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -110,11 +110,11 @@ void KOTodoEditor::setupGeneral()
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);
@@ -344,6 +344,10 @@ void KOTodoEditor::readTodo(Todo *todo)
344 344
345void KOTodoEditor::writeTodo(Todo *event) 345void KOTodoEditor::writeTodo(Todo *event)
346{ 346{
347 bool maybeComputeRecurrenceTime = false;
348 if( event->hasRecurrenceID() && event->percentComplete() < 100)
349 maybeComputeRecurrenceTime = true;
350 event->setHasRecurrenceID( false );
347 mGeneral->writeTodo(event); 351 mGeneral->writeTodo(event);
348 mDetails->writeEvent(event); 352 mDetails->writeEvent(event);
349 353
@@ -354,7 +358,10 @@ void KOTodoEditor::writeTodo(Todo *event)
354 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 358 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
355 mRecurrence->writeEvent(event); 359 mRecurrence->writeEvent(event);
356 if ( event->doesRecur() ) { 360 if ( event->doesRecur() ) {
357 event->setRecurrenceID( event->dtStart().addSecs(-1) ); 361 int addSec = -1 ;
362 if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 )
363 addSec = 1;
364 event->setRecurrenceID( event->dtStart().addSecs( addSec ) );
358 event->setRecurDates(); 365 event->setRecurDates();
359 } else { 366 } else {
360 event->setHasRecurrenceID( false ); 367 event->setHasRecurrenceID( false );
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 25be63a..f26d16d 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -465,9 +465,6 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
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,
@@ -483,6 +480,9 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
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()));
@@ -512,8 +512,6 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
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"),
@@ -522,6 +520,9 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
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 );
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 9c35b1d..762103f 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -345,12 +345,38 @@ void Incidence::checkCategories()
345 mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); 345 mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary"));
346} 346}
347 347
348void Incidence::setCategories(const QStringList &categories) 348void 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
367void 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
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index 327e7dd..ebd50d0 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -151,7 +151,8 @@ class Incidence : public IncidenceBase
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 */