summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt2
-rw-r--r--korganizer/koeditorgeneraltodo.cpp20
-rw-r--r--korganizer/kolistview.cpp53
-rw-r--r--korganizer/kotodoeditor.cpp53
-rw-r--r--korganizer/kotodoview.cpp11
-rw-r--r--libkcal/incidence.cpp28
-rw-r--r--libkcal/incidence.h3
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
@@ -1354,3 +1354,3 @@
{ "times","Zeiten" },
-{ "","" },
+{ "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?" },
{ "","" },
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 4a1576a..e86b4d0 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -41,2 +41,3 @@
#include <kfiledialog.h>
+#include <kdialog.h>
@@ -90,4 +91,4 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
timeLayout->addWidget(timeGroupBox);
- timeGroupBox->layout()->setSpacing( 0 );
- timeGroupBox->layout()->setMargin( 5 );
+ timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() );
+ timeGroupBox->layout()->setMargin( KDialog::marginHint() );
QFrame *timeBoxFrame = new QFrame(timeGroupBox);
@@ -95,3 +96,3 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3);
- layoutTimeBox->setSpacing(topLayout->spacing());
+ layoutTimeBox->setSpacing(KDialog::spacingHintSmall());
layoutTimeBox->setColStretch( 1, 1 );
@@ -99,3 +100,3 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame);
- layoutTimeBox->addWidget(mDueCheck,0,0);
+ layoutTimeBox->addWidget(mDueCheck,1,0);
connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool)));
@@ -105,6 +106,6 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
mDueDateEdit = new KDateEdit(timeBoxFrame);
- layoutTimeBox->addWidget(mDueDateEdit,0,1);
+ layoutTimeBox->addWidget(mDueDateEdit,1,1);
mDueTimeEdit = new KOTimeEdit(timeBoxFrame);
- layoutTimeBox->addWidget(mDueTimeEdit,0,2);
+ layoutTimeBox->addWidget(mDueTimeEdit,1,2);
@@ -112,3 +113,3 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame);
- layoutTimeBox->addWidget(mStartCheck,1,0);
+ layoutTimeBox->addWidget(mStartCheck,0,0);
connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool)));
@@ -116,6 +117,6 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
mStartDateEdit = new KDateEdit(timeBoxFrame);
- layoutTimeBox->addWidget(mStartDateEdit,1,1);
+ layoutTimeBox->addWidget(mStartDateEdit,0,1);
mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
- layoutTimeBox->addWidget(mStartTimeEdit,1,2);
+ layoutTimeBox->addWidget(mStartTimeEdit,0,2);
@@ -343,3 +344,2 @@ void KOEditorGeneralTodo::writeTodo(Todo *todo)
if ( comp.isValid () ) {
- todo->setPercentComplete(0);
todo->setPercentComplete(100);
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index bbf83d9..fd86095 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -373,4 +373,2 @@ void KOListView::setAlarm()
return;
-
-
QStringList itemList;
@@ -430,7 +428,5 @@ void KOListView::setAlarm()
}
- temp = item;
- item = sel.next();
- mUidDict.remove( inc->uid() );
- delete temp;;
- addIncidence( inc );
+ ListItemVisitor v(item, mStartDate );
+ inc->accept(v);
+ item = sel.next();
}
@@ -445,2 +441,3 @@ void KOListView::setCategories( bool removeOld )
KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
+ csd->setColorEnabled();
if (! csd->exec()) {
@@ -453,3 +450,3 @@ void KOListView::setCategories( bool removeOld )
// return;
- catList.sort();
+ //catList.sort();
QString categoriesStr = catList.join(",");
@@ -467,21 +464,25 @@ void KOListView::setCategories( bool removeOld )
item = sel.first();
- Incidence* inc;
- while ( item ) {
- inc = item->data();
- if ( removeOld ) {
- inc->setCategories( categoriesStr );
- } else {
- itemList = QStringList::split (",", inc->categoriesStr() );
- for( i = 0; i< catList.count(); ++i ) {
- if ( !itemList.contains (catList[i]))
- itemList.append( catList[i] );
- }
- itemList.sort();
- inc->setCategories( itemList.join(",") );
+ if( item ) {
+ Incidence* inc = item->data() ;
+ bool setSub = false;
+ if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) {
+ int result = KMessageBox::warningYesNoCancel(this,
+ i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ),
+ i18n("Todo has subtodos"),
+ i18n("Yes"),
+ i18n("No"));
+ if (result == KMessageBox::Cancel) item = 0;
+ if (result == KMessageBox::Yes) setSub = true;
+ }
+ while ( item ) {
+ inc = item->data();
+ if ( removeOld ) {
+ inc->setCategories( catList, setSub );
+ } else {
+ inc->addCategories( catList, setSub );
+ }
+ ListItemVisitor v(item, mStartDate );
+ inc->accept(v);
+ item = sel.next();
}
- temp = item;
- item = sel.next();
- mUidDict.remove( inc->uid() );
- delete temp;;
- addIncidence( inc );
}
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 6a05cc8..5513e8b 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -112,7 +112,7 @@ void KOTodoEditor::setupGeneral()
if ( QApplication::desktop()->width() < 480 ) {
- topLayout->setMargin(1);
- topLayout->setSpacing(1);
+ topLayout->setMargin(marginHintSmall());
+ topLayout->setSpacing(spacingHintSmall());
} else {
- topLayout->setMargin(marginHint()-1);
- topLayout->setSpacing(spacingHint()-1);
+ topLayout->setMargin(marginHint());
+ topLayout->setSpacing(spacingHint());
}
@@ -346,21 +346,28 @@ void KOTodoEditor::writeTodo(Todo *event)
{
- mGeneral->writeTodo(event);
- mDetails->writeEvent(event);
-
- // set related event, i.e. parent to-do in this case.
- if (mRelatedTodo) {
- event->setRelatedTo(mRelatedTodo);
- }
- if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
- mRecurrence->writeEvent(event);
- if ( event->doesRecur() ) {
- event->setRecurrenceID( event->dtStart().addSecs(-1) );
- event->setRecurDates();
- } else {
- event->setHasRecurrenceID( false );
- }
- } else {
- event->setHasRecurrenceID( false );
- event->recurrence()->unsetRecurs();
- }
+ bool maybeComputeRecurrenceTime = false;
+ if( event->hasRecurrenceID() && event->percentComplete() < 100)
+ maybeComputeRecurrenceTime = true;
+ event->setHasRecurrenceID( false );
+ mGeneral->writeTodo(event);
+ mDetails->writeEvent(event);
+
+ // set related event, i.e. parent to-do in this case.
+ if (mRelatedTodo) {
+ event->setRelatedTo(mRelatedTodo);
+ }
+ if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
+ mRecurrence->writeEvent(event);
+ if ( event->doesRecur() ) {
+ int addSec = -1 ;
+ if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 )
+ addSec = 1;
+ event->setRecurrenceID( event->dtStart().addSecs( addSec ) );
+ event->setRecurDates();
+ } else {
+ event->setHasRecurrenceID( false );
+ }
+ } else {
+ event->setHasRecurrenceID( false );
+ event->recurrence()->unsetRecurs();
+ }
}
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 25be63a..f26d16d 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -467,5 +467,2 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mItemPopupMenu = new QPopupMenu(this);
- mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
- SLOT (toggleRunningItem()));
- mItemPopupMenu->insertSeparator();
mItemPopupMenu->insertItem(i18n("Show..."), this,
@@ -485,2 +482,5 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mItemPopupMenu->insertSeparator();
+ mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
+ SLOT (toggleRunningItem()));
+ mItemPopupMenu->insertSeparator();
/*
@@ -514,4 +514,2 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
this, SLOT( toggleCompleted() ),0,3 );
- mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
- this, SLOT( toggleQuickTodo() ),0,4 );
mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
@@ -524,2 +522,5 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
this, SLOT( setAllFlat() ),0,8 );
+ mPopupMenu->insertSeparator();
+ mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
+ this, SLOT( toggleQuickTodo() ),0,4 );
mDocPrefs = new DocPrefs( name );
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 9c35b1d..762103f 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -347,3 +347,22 @@ void Incidence::checkCategories()
-void Incidence::setCategories(const QStringList &categories)
+void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false
+{
+ if (mReadOnly) return;
+ int i;
+ for( i = 0; i < categories.count(); ++i ) {
+ if ( !mCategories.contains (categories[i]))
+ mCategories.append( categories[i] );
+ }
+ checkCategories();
+ updated();
+ if ( addToRelations ) {
+ Incidence * inc;
+ QPtrList<Incidence> Relations = relations();
+ for (inc=Relations.first();inc;inc=Relations.next()) {
+ inc->addCategories( categories, true );
+ }
+ }
+}
+
+void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false
{
@@ -353,2 +372,9 @@ void Incidence::setCategories(const QStringList &categories)
updated();
+ if ( setForRelations ) {
+ Incidence * inc;
+ QPtrList<Incidence> Relations = relations();
+ for (inc=Relations.first();inc;inc=Relations.next()) {
+ inc->setCategories( categories, true );
+ }
+ }
}
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index 327e7dd..ebd50d0 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -153,3 +153,4 @@ class Incidence : public IncidenceBase
/** set event's applicable categories */
- void setCategories(const QStringList &categories);
+ void setCategories(const QStringList &categories, bool setForRelations = false);
+ void addCategories(const QStringList &categories, bool addToRelations = false);
/** set event's categories based on a comma delimited string */