summaryrefslogtreecommitdiffabout
path: root/korganizer/koeditorgeneraltodo.cpp
Unidiff
Diffstat (limited to 'korganizer/koeditorgeneraltodo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneraltodo.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 158a7d3..b9a028b 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -150,110 +150,115 @@ void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout)
150 mCompletedLabel = new QLabel(i18n("completed"),parent); 150 mCompletedLabel = new QLabel(i18n("completed"),parent);
151 topLayout->addWidget(mCompletedLabel); 151 topLayout->addWidget(mCompletedLabel);
152} 152}
153 153
154void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) 154void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout)
155{ 155{
156 156
157 QHBox* h = new QHBox ( parent ); 157 QHBox* h = new QHBox ( parent );
158 topLayout->addWidget( h ); 158 topLayout->addWidget( h );
159 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); 159 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h);
160 // topLayout->addWidget(priorityLabel); 160 // topLayout->addWidget(priorityLabel);
161 161
162 mPriorityCombo = new QComboBox( h ); 162 mPriorityCombo = new QComboBox( h );
163 mPriorityCombo->insertItem(i18n("1 (high)")); 163 mPriorityCombo->insertItem(i18n("1 (high)"));
164 mPriorityCombo->insertItem(i18n("2")); 164 mPriorityCombo->insertItem(i18n("2"));
165 mPriorityCombo->insertItem(i18n("3")); 165 mPriorityCombo->insertItem(i18n("3"));
166 mPriorityCombo->insertItem(i18n("4")); 166 mPriorityCombo->insertItem(i18n("4"));
167 mPriorityCombo->insertItem(i18n("5 (low)")); 167 mPriorityCombo->insertItem(i18n("5 (low)"));
168 //topLayout->addWidget(mPriorityCombo); 168 //topLayout->addWidget(mPriorityCombo);
169} 169}
170 170
171void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) 171void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout)
172{ 172{
173 QBoxLayout *statusLayout = new QHBoxLayout(topLayout); 173 QBoxLayout *statusLayout = new QHBoxLayout(topLayout);
174 174
175 initCompletion( parent, statusLayout ); 175 initCompletion( parent, statusLayout );
176 176
177 statusLayout->addStretch( 1 ); 177 statusLayout->addStretch( 1 );
178 178
179 initPriority( parent, statusLayout ); 179 initPriority( parent, statusLayout );
180} 180}
181 181
182void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) 182void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay)
183{ 183{
184 184
185 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 185 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
186 mLocationEdit->load(KOLocationBox::LOCATION); 186 mLocationEdit->load(KOLocationBox::LOCATION);
187 KOEditorGeneral::setDefaults(allDay); 187 KOEditorGeneral::setDefaults(allDay);
188 188
189 mTimeButton->setChecked( !allDay ); 189 mTimeButton->setChecked( !allDay );
190 if(mTimeButton->isChecked()) { 190 if(mTimeButton->isChecked()) {
191 mTimeButton->setEnabled(true); 191 mTimeButton->setEnabled(true);
192 } 192 }
193 else { 193 else {
194 mTimeButton->setEnabled(false); 194 mTimeButton->setEnabled(false);
195 } 195 }
196 196
197 enableTimeEdits( !allDay ); 197 enableTimeEdits( !allDay );
198 198 if ( due.isValid() ) {
199 mDueCheck->setChecked(false); 199 mDueCheck->setChecked(true);
200 enableDueEdit(false); 200 enableDueEdit(true);
201 } else {
202 mDueCheck->setChecked(false);
203 enableDueEdit(false);
204 due = QDateTime::currentDateTime().addDays(7);
205 }
201 206
202 alarmDisable(true); 207 alarmDisable(true);
203 208
204 mStartCheck->setChecked(false); 209 mStartCheck->setChecked(false);
205 enableStartEdit(false); 210 enableStartEdit(false);
206 211
207 mDueDateEdit->setDate(due.date()); 212 mDueDateEdit->setDate(due.date());
208 mDueTimeEdit->setTime(due.time()); 213 mDueTimeEdit->setTime(due.time());
209 214 due = due.addDays(-7);
210 mStartDateEdit->setDate(QDate::currentDate()); 215 mStartDateEdit->setDate(due.date());
211 mStartTimeEdit->setTime(QTime::currentTime()); 216 mStartTimeEdit->setTime(due.time());
212 217
213 mPriorityCombo->setCurrentItem(2); 218 mPriorityCombo->setCurrentItem(2);
214 mCompletedLabel->setText(i18n("completed"));; 219 mCompletedLabel->setText(i18n("completed"));;
215 mCompletedCombo->setCurrentItem(0); 220 mCompletedCombo->setCurrentItem(0);
216} 221}
217 222
218void KOEditorGeneralTodo::readTodo(Todo *todo) 223void KOEditorGeneralTodo::readTodo(Todo *todo)
219{ 224{
220 225
221 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 226 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
222 mLocationEdit->load(KOLocationBox::LOCATION); 227 mLocationEdit->load(KOLocationBox::LOCATION);
223 KOEditorGeneral::readIncidence(todo); 228 KOEditorGeneral::readIncidence(todo);
224 229
225 QDateTime dueDT; 230 QDateTime dueDT;
226 231
227 if (todo->hasDueDate()) { 232 if (todo->hasDueDate()) {
228 enableAlarmEdit(true); 233 enableAlarmEdit(true);
229 dueDT = todo->dtDue(); 234 dueDT = todo->dtDue();
230 mDueDateEdit->setDate(todo->dtDue().date()); 235 mDueDateEdit->setDate(todo->dtDue().date());
231 mDueTimeEdit->setTime(todo->dtDue().time()); 236 mDueTimeEdit->setTime(todo->dtDue().time());
232 mDueCheck->setChecked(true); 237 mDueCheck->setChecked(true);
233 } else { 238 } else {
234 alarmDisable(true); 239 alarmDisable(true);
235 mDueDateEdit->setEnabled(false); 240 mDueDateEdit->setEnabled(false);
236 mDueTimeEdit->setEnabled(false); 241 mDueTimeEdit->setEnabled(false);
237 mDueDateEdit->setDate(QDate::currentDate()); 242 mDueDateEdit->setDate(QDate::currentDate());
238 mDueTimeEdit->setTime(QTime::currentTime()); 243 mDueTimeEdit->setTime(QTime::currentTime());
239 mDueCheck->setChecked(false); 244 mDueCheck->setChecked(false);
240 } 245 }
241 246
242 if (todo->hasStartDate()) { 247 if (todo->hasStartDate()) {
243 mStartDateEdit->setDate(todo->dtStart().date()); 248 mStartDateEdit->setDate(todo->dtStart().date());
244 mStartTimeEdit->setTime(todo->dtStart().time()); 249 mStartTimeEdit->setTime(todo->dtStart().time());
245 mStartCheck->setChecked(true); 250 mStartCheck->setChecked(true);
246 } else { 251 } else {
247 mStartDateEdit->setEnabled(false); 252 mStartDateEdit->setEnabled(false);
248 mStartTimeEdit->setEnabled(false); 253 mStartTimeEdit->setEnabled(false);
249 mStartDateEdit->setDate(QDate::currentDate()); 254 mStartDateEdit->setDate(QDate::currentDate());
250 mStartTimeEdit->setTime(QTime::currentTime()); 255 mStartTimeEdit->setTime(QTime::currentTime());
251 mStartCheck->setChecked(false); 256 mStartCheck->setChecked(false);
252 } 257 }
253 258
254 mTimeButton->setChecked( !todo->doesFloat() ); 259 mTimeButton->setChecked( !todo->doesFloat() );
255 260
256 mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); 261 mCompletedCombo->setCurrentItem(todo->percentComplete() / 20);
257 if (todo->isCompleted() && todo->hasCompletedDate()) { 262 if (todo->isCompleted() && todo->hasCompletedDate()) {
258 mCompleted = todo->completed(); 263 mCompleted = todo->completed();
259 } 264 }