summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoeditor.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/kotodoeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoeditor.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 9073bca..8b90ae5 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -54,48 +54,50 @@ extern int globalFlagBlockAgenda;
KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) :
KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent )
{
mTodo = 0;
mRelatedTodo = 0;
findButton(User1)->hide();
init();
if ( QApplication::desktop()->height() <= 240 )
hideButtons();
}
KOTodoEditor::~KOTodoEditor()
{
emit dialogClose( mTodo );
}
void KOTodoEditor::init()
{
setupGeneral();
setupAttendeesTab();
setupRecurrence();
connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
+ connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
+ mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
}
void KOTodoEditor::setupRecurrence()
{
QFrame *topFrame = addPage( i18n("Recurrence") );
QBoxLayout *topLayout = new QVBoxLayout( topFrame );
mRecurrence = new KOEditorRecurrence( topFrame );
topLayout->addWidget( mRecurrence );
}
void KOTodoEditor::setCategories( QString s )
{
mGeneral->setCategories(s);
}
void KOTodoEditor::setSecrecy( int sec )
{
mGeneral->setSecrecy( sec );
}
void KOTodoEditor::reload()
{
if ( mTodo ) readTodo( mTodo );
}
void KOTodoEditor::setupGeneral()
@@ -284,74 +286,74 @@ void KOTodoEditor::deleteTodo()
}
}
void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
{
mRelatedTodo = relatedEvent;
mGeneral->setDefaults(due,allDay);
mDetails->setDefaults();
showPage( 0 );
if ( mRelatedTodo ) {
mGeneral->setCategories (mRelatedTodo->categoriesStr ());
mGeneral->setSecrecy (mRelatedTodo->secrecy ());
if ( mRelatedTodo->priority() < 3 )
mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1);
mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": ");
int len = mRelatedTodo->summary().length();
mGeneral->mSummaryEdit->lineEdit()->setFocus();
mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 );
mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 );
} else
mGeneral->setFocusOn( 2 );
tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
- mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
+ mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
}
void KOTodoEditor::checkRecurrence()
{
if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true );
if ( mTodo )
mRecurrence->readEvent( mTodo );
else {
bool time = mGeneral->mTimeButton->isChecked();
QDateTime from,to;
if ( time ) {
to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ;
from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ;
} else {
to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
}
if ( to < from )
to = from;
- mRecurrence->setDefaults(from,to,!time);
+ mRecurrence->setDefaults(from,to);
}
} else {
tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
- mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
+ mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
}
}
void KOTodoEditor::readTodo(Todo *todo)
{
mGeneral->readTodo(todo);
mDetails->readEvent(todo);
mRelatedTodo = 0;//todo->relatedTo();
// categories
// mCategoryDialog->setSelected(todo->categories());
// We should handle read-only events here.
}
void KOTodoEditor::writeTodo(Todo *event)
{
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) {