Diffstat (limited to 'core/pim/todo/taskeditoroverviewimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/taskeditoroverviewimpl.cpp | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/core/pim/todo/taskeditoroverviewimpl.cpp b/core/pim/todo/taskeditoroverviewimpl.cpp index 24b3386..aef3b1d 100644 --- a/core/pim/todo/taskeditoroverviewimpl.cpp +++ b/core/pim/todo/taskeditoroverviewimpl.cpp @@ -1,75 +1,112 @@ #include <qapplication.h> #include <qcheckbox.h> #include <qcombobox.h> #include <qpopupmenu.h> #include <qpe/datebookmonth.h> #include <qpe/categoryselect.h> #include <qpe/timestring.h> +#include <opie/orecur.h> + #include "taskeditoroverviewimpl.h" /* * we need to hack */ TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* name ) : TaskEditorOverView( parent, name ) { init(); } TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { } void TaskEditorOverViewImpl::load( const OTodo& todo) { - /* + /* * now that we're 'preloaded' we * need to disable the buttons * holding the dat */ btnDue-> setEnabled( FALSE ); btnComp-> setEnabled( FALSE ); btnStart->setEnabled( FALSE ); - + /* + * get some basic dateinfos for now + */ QDate date = QDate::currentDate(); QString str = TimeString::longDateString( date ); - emit recurranceEnabled( FALSE ); - ckbStart->setChecked( FALSE ); - btnStart->setText( str ); + CheckBox7->setChecked( todo.recurrence().doesRecur() ); + emit recurranceEnabled( todo.recurrence().doesRecur() ); + - ckbComp->setChecked( FALSE ); - btnComp->setText( str ); + ckbStart->setChecked( todo.hasStartDate() ); + btnStart->setEnabled( todo.hasStartDate() ); + if ( todo.hasStartDate() ) { + m_start = todo.startDate(); + btnStart->setText( TimeString::longDateString( m_start ) ); + } else + btnStart->setText( str ); + + ckbComp->setChecked( todo.hasCompletedDate() ); + btnComp->setEnabled( todo.hasCompletedDate() ); + if ( todo.hasCompletedDate() ) { + m_comp = todo.completedDate(); + btnComp->setText( TimeString::longDateString( m_comp ) ); + }else + btnComp->setText( str ); cmbProgress->setCurrentItem( todo.progress()/20 ); cmbSum->insertItem( todo.summary(), 0 ); cmbSum->setCurrentItem( 0 ); ckbDue->setChecked( todo.hasDueDate() ); btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); btnDue->setEnabled( todo.hasDueDate() ); + m_due = todo.dueDate(); cmbPrio->setCurrentItem( todo.priority() -1 ); ckbCompleted->setChecked( todo.isCompleted() ); comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); } void TaskEditorOverViewImpl::save( OTodo& to) { - qWarning("save it now"); + /* a invalid date */ + QDate inval; + /* save our info back */ + + /* due date */ if ( ckbDue->isChecked() ) { to.setDueDate( m_due ); to.setHasDueDate( true ); }else to.setHasDueDate( false ); + + /* start date */ + if ( ckbStart->isChecked() ) { + to.setStartDate( m_start ); + }else + to.setStartDate( inval ); + + /* comp date */ + if ( ckbComp->isChecked() ) { + qWarning("completed checked"); + to.setCompletedDate( m_comp ); + }else + to.setCompletedDate( inval ); + + if ( comboCategory->currentCategory() != -1 ) { QArray<int> arr = comboCategory->currentCategories(); to.setCategories( arr ); } to.setPriority( cmbPrio->currentItem() + 1 ); to.setCompleted( ckbCompleted->isChecked() ); to.setSummary( cmbSum->currentText() ); to.setProgress( cmbProgress->currentItem() * 20 ); } /* * here we will init the basic view * one Popup for each Date Button @@ -127,29 +164,31 @@ void TaskEditorOverViewImpl::init() { } void TaskEditorOverViewImpl::slotStartChecked() { qWarning("slotStartChecked"); btnStart->setEnabled( ckbStart->isChecked() ); } void TaskEditorOverViewImpl::slotStartChanged(int y, int m, int d) { m_start.setYMD( y, m, d ); btnStart->setText( TimeString::longDateString( m_start ) ); } void TaskEditorOverViewImpl::slotDueChecked() { btnDue->setEnabled( ckbDue->isChecked() ); + emit dueDateChanged( m_due ); qWarning("slotDueChecked"); } void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) { m_due.setYMD(y, m, d ); btnDue->setText( TimeString::longDateString( m_due ) ); + emit dueDateChanged( m_due ); } void TaskEditorOverViewImpl::slotCompletedChecked() { btnComp->setEnabled( ckbComp->isChecked() ); qWarning("slotCompletedChecked"); } void TaskEditorOverViewImpl::slotCompletedChanged(int y, int m, int d) { m_comp.setYMD( y, m, d ); btnComp->setText( TimeString::longDateString( m_comp ) ); } /* * called by a button pressed event... * three slots to avoid ugly name() tests |