summaryrefslogtreecommitdiff
path: root/core/pim/todo/taskeditorstatus.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/todo/taskeditorstatus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/taskeditorstatus.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/core/pim/todo/taskeditorstatus.cpp b/core/pim/todo/taskeditorstatus.cpp
index b11fdab..4331877 100644
--- a/core/pim/todo/taskeditorstatus.cpp
+++ b/core/pim/todo/taskeditorstatus.cpp
@@ -55,25 +55,25 @@ TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags f
QString curDateStr = TimeString::longDateString( curDate );
QVBoxLayout *vb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
vb->addWidget( sv );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
- QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 );
+ QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 );
// Status
QLabel *label = new QLabel( tr( "Status:" ), container );
layout->addWidget( label, 0, 0 );
QWhatsThis::add( label, tr( "Click here to set the current status of this task." ) );
cmbStatus = new QComboBox( FALSE, container );
cmbStatus->insertItem( tr( "Started" ) );
cmbStatus->insertItem( tr( "Postponed" ) );
cmbStatus->insertItem( tr( "Finished" ) );
cmbStatus->insertItem( tr( "Not started" ) );
layout->addMultiCellWidget( cmbStatus, 0, 0, 1, 2 );
QWhatsThis::add( cmbStatus, tr( "Click here to set the current status of this task." ) );
@@ -82,57 +82,57 @@ TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags f
label = new QLabel( tr( "Progress:" ), container );
layout->addWidget( label, 1, 0 );
QWhatsThis::add( label, tr( "Select progress made on this task here." ) );
cmbProgress = new QComboBox( FALSE, container );
cmbProgress->insertItem( tr( "0 %" ) );
cmbProgress->insertItem( tr( "20 %" ) );
cmbProgress->insertItem( tr( "40 %" ) );
cmbProgress->insertItem( tr( "60 %" ) );
cmbProgress->insertItem( tr( "80 %" ) );
cmbProgress->insertItem( tr( "100 %" ) );
layout->addMultiCellWidget( cmbProgress, 1, 1, 1, 2 );
QWhatsThis::add( cmbProgress, tr( "Select progress made on this task here." ) );
-
+
// Start date
ckbStart = new QCheckBox( tr( "Start Date:" ), container );
layout->addWidget( ckbStart, 2, 0 );
QWhatsThis::add( ckbStart, tr( "Click here to set the date this task was started." ) );
connect( ckbStart, SIGNAL( clicked() ), this, SLOT( slotStartChecked() ) );
btnStart = new QPushButton( curDateStr, container );
btnStart->setEnabled( FALSE );
layout->addMultiCellWidget( btnStart, 2, 2, 1, 2 );
QWhatsThis::add( btnStart, tr( "Click here to set the date this task was started." ) );
QPopupMenu *popup = new QPopupMenu( this );
m_startBook = new DateBookMonth( popup, 0, TRUE );
popup->insertItem( m_startBook );
btnStart->setPopup( popup );
connect( m_startBook, SIGNAL( dateClicked( int, int, int ) ),
this, SLOT( slotStartChanged( int, int, int ) ) );
-
+
// Due date
ckbDue = new QCheckBox( tr( "Due Date:" ), container );
layout->addWidget( ckbDue, 3, 0 );
QWhatsThis::add( ckbDue, tr( "Click here to set the date this task needs to be completed by." ) );
connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) );
btnDue = new QPushButton( curDateStr, container );
btnDue->setEnabled( FALSE );
layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 );
QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) );
popup = new QPopupMenu( this );
m_dueBook = new DateBookMonth( popup, 0, TRUE );
popup->insertItem( m_dueBook );
btnDue->setPopup( popup );
connect( m_dueBook, SIGNAL( dateClicked( int, int, int ) ),
this, SLOT( slotDueChanged( int, int, int ) ) );
-
+
// Completed
ckbComp = new QCheckBox( tr( "Completed:" ), container );
layout->addWidget( ckbComp, 4, 0 );
QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) );
connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) );
btnComp = new QPushButton( curDateStr, container );
btnComp->setEnabled( FALSE );
layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 );
QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) );
popup = new QPopupMenu( this );
m_compBook = new DateBookMonth( popup, 0, TRUE );
popup->insertItem( m_compBook );
@@ -170,32 +170,32 @@ TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags f
}
TaskEditorStatus::~TaskEditorStatus()
{
}
void TaskEditorStatus::load( const OTodo &todo )
{
QDate date = QDate::currentDate();
QString str = TimeString::longDateString( date );
// Status
- int state = todo.state().state();
+ int state = todo.hasState()? todo.state().state() : OPimState::NotStarted;
if ( state == OPimState::Undefined )
state = OPimState::NotStarted;
cmbStatus->setCurrentItem( state );
// Progress
cmbProgress->setCurrentItem( todo.progress() / 20 );
-
+
// Start date
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 );
// Due date
@@ -207,39 +207,39 @@ void TaskEditorStatus::load( const OTodo &todo )
// Completed
ckbComp->setChecked( todo.isCompleted() );
btnComp->setEnabled( todo.hasCompletedDate() );
if ( todo.hasCompletedDate() )
{
m_comp = todo.completedDate();
btnComp->setText( TimeString::longDateString( m_comp ) );
}
else
btnComp->setText( str );
// Maintainer Mode
- state = todo.maintainer().mode();
+ state = todo.hasMaintainer() ? todo.maintainer().mode() : OPimMaintainer::Nothing;
if ( state == OPimMaintainer::Undefined )
state = OPimMaintainer::Nothing;
cmbMaintMode->setCurrentItem( state );
// Maintainer - not implemented yet
}
void TaskEditorStatus::save( OTodo &todo )
{
QDate inval;
// Status
todo.setState( OPimState( cmbStatus->currentItem() ) );
-
+
// Progress
todo.setProgress( cmbProgress->currentItem() * 20 );
// Start date
if ( ckbStart->isChecked() )
{
todo.setStartDate( m_start );
}
else
todo.setStartDate( inval );
// Due date
@@ -250,25 +250,25 @@ void TaskEditorStatus::save( OTodo &todo )
}
else
todo.setHasDueDate( false );
// Completed
todo.setCompleted( ckbComp->isChecked() );
if ( ckbComp->isChecked() )
{
todo.setCompletedDate( m_comp );
}
else
todo.setCompletedDate( inval );
-
+
// Maintainer mode - not implemented yet
// Maintainer
/* TODO - resolve name to uid.....*/
todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) );
}
void TaskEditorStatus::slotStartChecked()
{
btnStart->setEnabled( ckbStart->isChecked() );
}