author | zecke <zecke> | 2003-05-07 16:16:44 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-05-07 16:16:44 (UTC) |
commit | 1cee00987d34729393fb9383d90babd39517cc68 (patch) (unidiff) | |
tree | 03a51eaf8bfcfd242b4bb98d29e941b0b9dcb38a /core/pim/todo/taskeditorstatus.cpp | |
parent | 1e9e3371d61cfc404329a8bad51f8b061c1ad73d (diff) | |
download | opie-1cee00987d34729393fb9383d90babd39517cc68.zip opie-1cee00987d34729393fb9383d90babd39517cc68.tar.gz opie-1cee00987d34729393fb9383d90babd39517cc68.tar.bz2 |
try to use the has* functions
Diffstat (limited to 'core/pim/todo/taskeditorstatus.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/taskeditorstatus.cpp | 18 |
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 | |||
55 | QString curDateStr = TimeString::longDateString( curDate ); | 55 | QString curDateStr = TimeString::longDateString( curDate ); |
56 | 56 | ||
57 | QVBoxLayout *vb = new QVBoxLayout( this ); | 57 | QVBoxLayout *vb = new QVBoxLayout( this ); |
58 | 58 | ||
59 | QScrollView *sv = new QScrollView( this ); | 59 | QScrollView *sv = new QScrollView( this ); |
60 | vb->addWidget( sv ); | 60 | vb->addWidget( sv ); |
61 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 61 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
62 | sv->setFrameStyle( QFrame::NoFrame ); | 62 | sv->setFrameStyle( QFrame::NoFrame ); |
63 | 63 | ||
64 | QWidget *container = new QWidget( sv->viewport() ); | 64 | QWidget *container = new QWidget( sv->viewport() ); |
65 | sv->addChild( container ); | 65 | sv->addChild( container ); |
66 | 66 | ||
67 | QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 ); | 67 | QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 ); |
68 | 68 | ||
69 | // Status | 69 | // Status |
70 | QLabel *label = new QLabel( tr( "Status:" ), container ); | 70 | QLabel *label = new QLabel( tr( "Status:" ), container ); |
71 | layout->addWidget( label, 0, 0 ); | 71 | layout->addWidget( label, 0, 0 ); |
72 | QWhatsThis::add( label, tr( "Click here to set the current status of this task." ) ); | 72 | QWhatsThis::add( label, tr( "Click here to set the current status of this task." ) ); |
73 | cmbStatus = new QComboBox( FALSE, container ); | 73 | cmbStatus = new QComboBox( FALSE, container ); |
74 | cmbStatus->insertItem( tr( "Started" ) ); | 74 | cmbStatus->insertItem( tr( "Started" ) ); |
75 | cmbStatus->insertItem( tr( "Postponed" ) ); | 75 | cmbStatus->insertItem( tr( "Postponed" ) ); |
76 | cmbStatus->insertItem( tr( "Finished" ) ); | 76 | cmbStatus->insertItem( tr( "Finished" ) ); |
77 | cmbStatus->insertItem( tr( "Not started" ) ); | 77 | cmbStatus->insertItem( tr( "Not started" ) ); |
78 | layout->addMultiCellWidget( cmbStatus, 0, 0, 1, 2 ); | 78 | layout->addMultiCellWidget( cmbStatus, 0, 0, 1, 2 ); |
79 | QWhatsThis::add( cmbStatus, tr( "Click here to set the current status of this task." ) ); | 79 | 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 | |||
82 | label = new QLabel( tr( "Progress:" ), container ); | 82 | label = new QLabel( tr( "Progress:" ), container ); |
83 | layout->addWidget( label, 1, 0 ); | 83 | layout->addWidget( label, 1, 0 ); |
84 | QWhatsThis::add( label, tr( "Select progress made on this task here." ) ); | 84 | QWhatsThis::add( label, tr( "Select progress made on this task here." ) ); |
85 | cmbProgress = new QComboBox( FALSE, container ); | 85 | cmbProgress = new QComboBox( FALSE, container ); |
86 | cmbProgress->insertItem( tr( "0 %" ) ); | 86 | cmbProgress->insertItem( tr( "0 %" ) ); |
87 | cmbProgress->insertItem( tr( "20 %" ) ); | 87 | cmbProgress->insertItem( tr( "20 %" ) ); |
88 | cmbProgress->insertItem( tr( "40 %" ) ); | 88 | cmbProgress->insertItem( tr( "40 %" ) ); |
89 | cmbProgress->insertItem( tr( "60 %" ) ); | 89 | cmbProgress->insertItem( tr( "60 %" ) ); |
90 | cmbProgress->insertItem( tr( "80 %" ) ); | 90 | cmbProgress->insertItem( tr( "80 %" ) ); |
91 | cmbProgress->insertItem( tr( "100 %" ) ); | 91 | cmbProgress->insertItem( tr( "100 %" ) ); |
92 | layout->addMultiCellWidget( cmbProgress, 1, 1, 1, 2 ); | 92 | layout->addMultiCellWidget( cmbProgress, 1, 1, 1, 2 ); |
93 | QWhatsThis::add( cmbProgress, tr( "Select progress made on this task here." ) ); | 93 | QWhatsThis::add( cmbProgress, tr( "Select progress made on this task here." ) ); |
94 | 94 | ||
95 | // Start date | 95 | // Start date |
96 | ckbStart = new QCheckBox( tr( "Start Date:" ), container ); | 96 | ckbStart = new QCheckBox( tr( "Start Date:" ), container ); |
97 | layout->addWidget( ckbStart, 2, 0 ); | 97 | layout->addWidget( ckbStart, 2, 0 ); |
98 | QWhatsThis::add( ckbStart, tr( "Click here to set the date this task was started." ) ); | 98 | QWhatsThis::add( ckbStart, tr( "Click here to set the date this task was started." ) ); |
99 | connect( ckbStart, SIGNAL( clicked() ), this, SLOT( slotStartChecked() ) ); | 99 | connect( ckbStart, SIGNAL( clicked() ), this, SLOT( slotStartChecked() ) ); |
100 | btnStart = new QPushButton( curDateStr, container ); | 100 | btnStart = new QPushButton( curDateStr, container ); |
101 | btnStart->setEnabled( FALSE ); | 101 | btnStart->setEnabled( FALSE ); |
102 | layout->addMultiCellWidget( btnStart, 2, 2, 1, 2 ); | 102 | layout->addMultiCellWidget( btnStart, 2, 2, 1, 2 ); |
103 | QWhatsThis::add( btnStart, tr( "Click here to set the date this task was started." ) ); | 103 | QWhatsThis::add( btnStart, tr( "Click here to set the date this task was started." ) ); |
104 | QPopupMenu *popup = new QPopupMenu( this ); | 104 | QPopupMenu *popup = new QPopupMenu( this ); |
105 | m_startBook = new DateBookMonth( popup, 0, TRUE ); | 105 | m_startBook = new DateBookMonth( popup, 0, TRUE ); |
106 | popup->insertItem( m_startBook ); | 106 | popup->insertItem( m_startBook ); |
107 | btnStart->setPopup( popup ); | 107 | btnStart->setPopup( popup ); |
108 | connect( m_startBook, SIGNAL( dateClicked( int, int, int ) ), | 108 | connect( m_startBook, SIGNAL( dateClicked( int, int, int ) ), |
109 | this, SLOT( slotStartChanged( int, int, int ) ) ); | 109 | this, SLOT( slotStartChanged( int, int, int ) ) ); |
110 | 110 | ||
111 | // Due date | 111 | // Due date |
112 | ckbDue = new QCheckBox( tr( "Due Date:" ), container ); | 112 | ckbDue = new QCheckBox( tr( "Due Date:" ), container ); |
113 | layout->addWidget( ckbDue, 3, 0 ); | 113 | layout->addWidget( ckbDue, 3, 0 ); |
114 | QWhatsThis::add( ckbDue, tr( "Click here to set the date this task needs to be completed by." ) ); | 114 | QWhatsThis::add( ckbDue, tr( "Click here to set the date this task needs to be completed by." ) ); |
115 | connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) ); | 115 | connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) ); |
116 | btnDue = new QPushButton( curDateStr, container ); | 116 | btnDue = new QPushButton( curDateStr, container ); |
117 | btnDue->setEnabled( FALSE ); | 117 | btnDue->setEnabled( FALSE ); |
118 | layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 ); | 118 | layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 ); |
119 | QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) ); | 119 | QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) ); |
120 | popup = new QPopupMenu( this ); | 120 | popup = new QPopupMenu( this ); |
121 | m_dueBook = new DateBookMonth( popup, 0, TRUE ); | 121 | m_dueBook = new DateBookMonth( popup, 0, TRUE ); |
122 | popup->insertItem( m_dueBook ); | 122 | popup->insertItem( m_dueBook ); |
123 | btnDue->setPopup( popup ); | 123 | btnDue->setPopup( popup ); |
124 | connect( m_dueBook, SIGNAL( dateClicked( int, int, int ) ), | 124 | connect( m_dueBook, SIGNAL( dateClicked( int, int, int ) ), |
125 | this, SLOT( slotDueChanged( int, int, int ) ) ); | 125 | this, SLOT( slotDueChanged( int, int, int ) ) ); |
126 | 126 | ||
127 | // Completed | 127 | // Completed |
128 | ckbComp = new QCheckBox( tr( "Completed:" ), container ); | 128 | ckbComp = new QCheckBox( tr( "Completed:" ), container ); |
129 | layout->addWidget( ckbComp, 4, 0 ); | 129 | layout->addWidget( ckbComp, 4, 0 ); |
130 | QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) ); | 130 | QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) ); |
131 | connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) ); | 131 | connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) ); |
132 | btnComp = new QPushButton( curDateStr, container ); | 132 | btnComp = new QPushButton( curDateStr, container ); |
133 | btnComp->setEnabled( FALSE ); | 133 | btnComp->setEnabled( FALSE ); |
134 | layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 ); | 134 | layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 ); |
135 | QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) ); | 135 | QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) ); |
136 | popup = new QPopupMenu( this ); | 136 | popup = new QPopupMenu( this ); |
137 | m_compBook = new DateBookMonth( popup, 0, TRUE ); | 137 | m_compBook = new DateBookMonth( popup, 0, TRUE ); |
138 | popup->insertItem( m_compBook ); | 138 | popup->insertItem( m_compBook ); |
@@ -170,32 +170,32 @@ TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags f | |||
170 | } | 170 | } |
171 | 171 | ||
172 | TaskEditorStatus::~TaskEditorStatus() | 172 | TaskEditorStatus::~TaskEditorStatus() |
173 | { | 173 | { |
174 | } | 174 | } |
175 | 175 | ||
176 | void TaskEditorStatus::load( const OTodo &todo ) | 176 | void TaskEditorStatus::load( const OTodo &todo ) |
177 | { | 177 | { |
178 | QDate date = QDate::currentDate(); | 178 | QDate date = QDate::currentDate(); |
179 | QString str = TimeString::longDateString( date ); | 179 | QString str = TimeString::longDateString( date ); |
180 | 180 | ||
181 | // Status | 181 | // Status |
182 | int state = todo.state().state(); | 182 | int state = todo.hasState()? todo.state().state() : OPimState::NotStarted; |
183 | if ( state == OPimState::Undefined ) | 183 | if ( state == OPimState::Undefined ) |
184 | state = OPimState::NotStarted; | 184 | state = OPimState::NotStarted; |
185 | cmbStatus->setCurrentItem( state ); | 185 | cmbStatus->setCurrentItem( state ); |
186 | 186 | ||
187 | // Progress | 187 | // Progress |
188 | cmbProgress->setCurrentItem( todo.progress() / 20 ); | 188 | cmbProgress->setCurrentItem( todo.progress() / 20 ); |
189 | 189 | ||
190 | // Start date | 190 | // Start date |
191 | ckbStart->setChecked( todo.hasStartDate() ); | 191 | ckbStart->setChecked( todo.hasStartDate() ); |
192 | btnStart->setEnabled( todo.hasStartDate() ); | 192 | btnStart->setEnabled( todo.hasStartDate() ); |
193 | if ( todo.hasStartDate() ) | 193 | if ( todo.hasStartDate() ) |
194 | { | 194 | { |
195 | m_start = todo.startDate(); | 195 | m_start = todo.startDate(); |
196 | btnStart->setText( TimeString::longDateString( m_start ) ); | 196 | btnStart->setText( TimeString::longDateString( m_start ) ); |
197 | } | 197 | } |
198 | else | 198 | else |
199 | btnStart->setText( str ); | 199 | btnStart->setText( str ); |
200 | 200 | ||
201 | // Due date | 201 | // Due date |
@@ -207,39 +207,39 @@ void TaskEditorStatus::load( const OTodo &todo ) | |||
207 | // Completed | 207 | // Completed |
208 | ckbComp->setChecked( todo.isCompleted() ); | 208 | ckbComp->setChecked( todo.isCompleted() ); |
209 | btnComp->setEnabled( todo.hasCompletedDate() ); | 209 | btnComp->setEnabled( todo.hasCompletedDate() ); |
210 | if ( todo.hasCompletedDate() ) | 210 | if ( todo.hasCompletedDate() ) |
211 | { | 211 | { |
212 | m_comp = todo.completedDate(); | 212 | m_comp = todo.completedDate(); |
213 | btnComp->setText( TimeString::longDateString( m_comp ) ); | 213 | btnComp->setText( TimeString::longDateString( m_comp ) ); |
214 | } | 214 | } |
215 | else | 215 | else |
216 | btnComp->setText( str ); | 216 | btnComp->setText( str ); |
217 | 217 | ||
218 | // Maintainer Mode | 218 | // Maintainer Mode |
219 | state = todo.maintainer().mode(); | 219 | state = todo.hasMaintainer() ? todo.maintainer().mode() : OPimMaintainer::Nothing; |
220 | if ( state == OPimMaintainer::Undefined ) | 220 | if ( state == OPimMaintainer::Undefined ) |
221 | state = OPimMaintainer::Nothing; | 221 | state = OPimMaintainer::Nothing; |
222 | cmbMaintMode->setCurrentItem( state ); | 222 | cmbMaintMode->setCurrentItem( state ); |
223 | 223 | ||
224 | // Maintainer - not implemented yet | 224 | // Maintainer - not implemented yet |
225 | } | 225 | } |
226 | 226 | ||
227 | void TaskEditorStatus::save( OTodo &todo ) | 227 | void TaskEditorStatus::save( OTodo &todo ) |
228 | { | 228 | { |
229 | QDate inval; | 229 | QDate inval; |
230 | 230 | ||
231 | // Status | 231 | // Status |
232 | todo.setState( OPimState( cmbStatus->currentItem() ) ); | 232 | todo.setState( OPimState( cmbStatus->currentItem() ) ); |
233 | 233 | ||
234 | // Progress | 234 | // Progress |
235 | todo.setProgress( cmbProgress->currentItem() * 20 ); | 235 | todo.setProgress( cmbProgress->currentItem() * 20 ); |
236 | 236 | ||
237 | // Start date | 237 | // Start date |
238 | if ( ckbStart->isChecked() ) | 238 | if ( ckbStart->isChecked() ) |
239 | { | 239 | { |
240 | todo.setStartDate( m_start ); | 240 | todo.setStartDate( m_start ); |
241 | } | 241 | } |
242 | else | 242 | else |
243 | todo.setStartDate( inval ); | 243 | todo.setStartDate( inval ); |
244 | 244 | ||
245 | // Due date | 245 | // Due date |
@@ -250,25 +250,25 @@ void TaskEditorStatus::save( OTodo &todo ) | |||
250 | } | 250 | } |
251 | else | 251 | else |
252 | todo.setHasDueDate( false ); | 252 | todo.setHasDueDate( false ); |
253 | 253 | ||
254 | // Completed | 254 | // Completed |
255 | todo.setCompleted( ckbComp->isChecked() ); | 255 | todo.setCompleted( ckbComp->isChecked() ); |
256 | if ( ckbComp->isChecked() ) | 256 | if ( ckbComp->isChecked() ) |
257 | { | 257 | { |
258 | todo.setCompletedDate( m_comp ); | 258 | todo.setCompletedDate( m_comp ); |
259 | } | 259 | } |
260 | else | 260 | else |
261 | todo.setCompletedDate( inval ); | 261 | todo.setCompletedDate( inval ); |
262 | 262 | ||
263 | // Maintainer mode - not implemented yet | 263 | // Maintainer mode - not implemented yet |
264 | 264 | ||
265 | // Maintainer | 265 | // Maintainer |
266 | /* TODO - resolve name to uid.....*/ | 266 | /* TODO - resolve name to uid.....*/ |
267 | todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) ); | 267 | todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) ); |
268 | } | 268 | } |
269 | 269 | ||
270 | void TaskEditorStatus::slotStartChecked() | 270 | void TaskEditorStatus::slotStartChecked() |
271 | { | 271 | { |
272 | btnStart->setEnabled( ckbStart->isChecked() ); | 272 | btnStart->setEnabled( ckbStart->isChecked() ); |
273 | } | 273 | } |
274 | 274 | ||