summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-07-06 21:11:20 (UTC)
committer zautrix <zautrix>2005-07-06 21:11:20 (UTC)
commite1731d8790403a079613f291b4ac172d8f04c960 (patch) (unidiff)
tree75b13b2235fb6045b5c4b29f3d65d761c46ff746 /korganizer
parent984e2132871c79990f6d9eac5702f7f32186f235 (diff)
downloadkdepimpi-e1731d8790403a079613f291b4ac172d8f04c960.zip
kdepimpi-e1731d8790403a079613f291b4ac172d8f04c960.tar.gz
kdepimpi-e1731d8790403a079613f291b4ac172d8f04c960.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoeditor.cpp1
-rw-r--r--korganizer/kotodoview.cpp108
-rw-r--r--korganizer/kotodoview.h3
3 files changed, 89 insertions, 23 deletions
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 555c1b1..100a81b 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -205,192 +205,193 @@ void KOTodoEditor::setupGeneral()
205 205
206void KOTodoEditor::editTodo(Todo *todo, bool editDescription) 206void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
207{ 207{
208 //init(); 208 //init();
209 209
210 mTodo = todo; 210 mTodo = todo;
211 readTodo(mTodo); 211 readTodo(mTodo);
212 if ( editDescription ) { 212 if ( editDescription ) {
213 showPage( 1 ); 213 showPage( 1 );
214 mGeneral->setFocusOn( 1 ); 214 mGeneral->setFocusOn( 1 );
215 } else { 215 } else {
216 showPage( 0 ); 216 showPage( 0 );
217 mGeneral->setFocusOn( 2 ); 217 mGeneral->setFocusOn( 2 );
218 } 218 }
219 checkRecurrence(); 219 checkRecurrence();
220} 220}
221 221
222void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) 222void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay)
223{ 223{
224 //init(); 224 //init();
225 225
226 mTodo = 0; 226 mTodo = 0;
227 setDefaults(due,relatedTodo,allDay); 227 setDefaults(due,relatedTodo,allDay);
228} 228}
229 229
230void KOTodoEditor::loadDefaults() 230void KOTodoEditor::loadDefaults()
231{ 231{
232 setDefaults(QDateTime::currentDateTime().addDays(7),0,false); 232 setDefaults(QDateTime::currentDateTime().addDays(7),0,false);
233} 233}
234 234
235bool KOTodoEditor::processInput( bool emitTime ) 235bool KOTodoEditor::processInput( bool emitTime )
236{ 236{
237 if (!validateInput()) return false; 237 if (!validateInput()) return false;
238 238
239 Todo *todo = 0; 239 Todo *todo = 0;
240 240
241 if (mTodo) todo = mTodo; 241 if (mTodo) todo = mTodo;
242 else { 242 else {
243 todo = new Todo; 243 todo = new Todo;
244 todo->setOrganizer(KOPrefs::instance()->email()); 244 todo->setOrganizer(KOPrefs::instance()->email());
245 } 245 }
246 246
247 writeTodo(todo); 247 writeTodo(todo);
248 if ( emitTime ) { 248 if ( emitTime ) {
249 globalFlagBlockAgenda = 1; 249 globalFlagBlockAgenda = 1;
250 emit showAgendaView( false ); 250 emit showAgendaView( false );
251 if ( todo->hasDueDate() ) 251 if ( todo->hasDueDate() )
252 emit jumpToTime( todo->dtDue().date() ); 252 emit jumpToTime( todo->dtDue().date() );
253 globalFlagBlockAgenda = 2; 253 globalFlagBlockAgenda = 2;
254 } 254 }
255 if (mTodo) { 255 if (mTodo) {
256 todo->setRevision(todo->revision()+1); 256 todo->setRevision(todo->revision()+1);
257 emit todoChanged(todo); 257 emit todoChanged(todo);
258 } else { 258 } else {
259 mCalendar->addTodo(todo); 259 mCalendar->addTodo(todo);
260 mTodo = todo; 260 mTodo = todo;
261 emit todoAdded(todo); 261 emit todoAdded(todo);
262 } 262 }
263 263
264 return true; 264 return true;
265} 265}
266 266
267void KOTodoEditor::deleteTodo() 267void KOTodoEditor::deleteTodo()
268{ 268{
269 if (mTodo) { 269 if (mTodo) {
270 if (KOPrefs::instance()->mConfirm) { 270 if (KOPrefs::instance()->mConfirm) {
271 switch (msgItemDelete()) { 271 switch (msgItemDelete()) {
272 case KMessageBox::Continue: // OK 272 case KMessageBox::Continue: // OK
273 emit todoToBeDeleted(mTodo); 273 emit todoToBeDeleted(mTodo);
274 emit dialogClose(mTodo); 274 emit dialogClose(mTodo);
275 mCalendar->deleteTodo(mTodo); 275 mCalendar->deleteTodo(mTodo);
276 emit todoDeleted(); 276 emit todoDeleted();
277 reject(); 277 reject();
278 break; 278 break;
279 } 279 }
280 } 280 }
281 else { 281 else {
282 emit todoToBeDeleted(mTodo); 282 emit todoToBeDeleted(mTodo);
283 emit dialogClose(mTodo); 283 emit dialogClose(mTodo);
284 mCalendar->deleteTodo(mTodo); 284 mCalendar->deleteTodo(mTodo);
285 emit todoDeleted(); 285 emit todoDeleted();
286 reject(); 286 reject();
287 } 287 }
288 } else { 288 } else {
289 reject(); 289 reject();
290 } 290 }
291} 291}
292 292
293void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) 293void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
294{ 294{
295 mRelatedTodo = relatedEvent; 295 mRelatedTodo = relatedEvent;
296 296
297 mGeneral->setDefaults(due,allDay); 297 mGeneral->setDefaults(due,allDay);
298 mDetails->setDefaults(); 298 mDetails->setDefaults();
299 showPage( 0 ); 299 showPage( 0 );
300 if ( mRelatedTodo ) { 300 if ( mRelatedTodo ) {
301 mGeneral->fillCalCombo(mRelatedTodo->calID() );
301 mGeneral->setCategories (mRelatedTodo->categoriesStr ()); 302 mGeneral->setCategories (mRelatedTodo->categoriesStr ());
302 mGeneral->setSecrecy (mRelatedTodo->secrecy ()); 303 mGeneral->setSecrecy (mRelatedTodo->secrecy ());
303 if ( mRelatedTodo->priority() < 3 ) 304 if ( mRelatedTodo->priority() < 3 )
304 mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1); 305 mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1);
305 mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": "); 306 mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": ");
306 int len = mRelatedTodo->summary().length(); 307 int len = mRelatedTodo->summary().length();
307 mGeneral->mSummaryEdit->lineEdit()->setFocus(); 308 mGeneral->mSummaryEdit->lineEdit()->setFocus();
308 mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); 309 mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 );
309 mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); 310 mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 );
310 311
311 } else 312 } else
312 mGeneral->setFocusOn( 2 ); 313 mGeneral->setFocusOn( 2 );
313 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 314 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
314 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); 315 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
315} 316}
316void KOTodoEditor::checkRecurrence() 317void KOTodoEditor::checkRecurrence()
317{ 318{
318 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 319 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
319 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); 320 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true );
320 321
321 if ( mTodo ) 322 if ( mTodo )
322 mRecurrence->readEvent( mTodo ); 323 mRecurrence->readEvent( mTodo );
323 else { 324 else {
324 bool time = mGeneral->mTimeButton->isChecked(); 325 bool time = mGeneral->mTimeButton->isChecked();
325 QDateTime from,to; 326 QDateTime from,to;
326 if ( time ) { 327 if ( time ) {
327 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; 328 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ;
328 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; 329 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ;
329 } else { 330 } else {
330 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; 331 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
331 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; 332 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
332 } 333 }
333 if ( to < from ) 334 if ( to < from )
334 to = from; 335 to = from;
335 mRecurrence->setDefaults(from,to); 336 mRecurrence->setDefaults(from,to);
336 } 337 }
337 } else { 338 } else {
338 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 339 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
339 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); 340 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
340 } 341 }
341} 342}
342void KOTodoEditor::readTodo(Todo *todo) 343void KOTodoEditor::readTodo(Todo *todo)
343{ 344{
344 mGeneral->readTodo(todo); 345 mGeneral->readTodo(todo);
345 mDetails->readEvent(todo); 346 mDetails->readEvent(todo);
346 mRelatedTodo = 0;//todo->relatedTo(); 347 mRelatedTodo = 0;//todo->relatedTo();
347 // categories 348 // categories
348 // mCategoryDialog->setSelected(todo->categories()); 349 // mCategoryDialog->setSelected(todo->categories());
349 350
350 // We should handle read-only events here. 351 // We should handle read-only events here.
351} 352}
352 353
353void KOTodoEditor::writeTodo(Todo *event) 354void KOTodoEditor::writeTodo(Todo *event)
354{ 355{
355 bool maybeComputeRecurrenceTime = false; 356 bool maybeComputeRecurrenceTime = false;
356 if( event->hasRecurrenceID() && event->percentComplete() < 100) 357 if( event->hasRecurrenceID() && event->percentComplete() < 100)
357 maybeComputeRecurrenceTime = true; 358 maybeComputeRecurrenceTime = true;
358 event->setHasRecurrenceID( false ); 359 event->setHasRecurrenceID( false );
359 mGeneral->writeTodo(event); 360 mGeneral->writeTodo(event);
360 mDetails->writeEvent(event); 361 mDetails->writeEvent(event);
361 362
362 // set related event, i.e. parent to-do in this case. 363 // set related event, i.e. parent to-do in this case.
363 if (mRelatedTodo) { 364 if (mRelatedTodo) {
364 event->setRelatedTo(mRelatedTodo); 365 event->setRelatedTo(mRelatedTodo);
365 } 366 }
366 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 367 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
367 mRecurrence->writeEvent(event); 368 mRecurrence->writeEvent(event);
368 if ( event->doesRecur() ) { 369 if ( event->doesRecur() ) {
369 int addSec = -1 ; 370 int addSec = -1 ;
370 if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 ) 371 if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 )
371 addSec = 1; 372 addSec = 1;
372 event->setRecurrenceID( event->dtStart().addSecs( addSec ) ); 373 event->setRecurrenceID( event->dtStart().addSecs( addSec ) );
373 event->setRecurDates(); 374 event->setRecurDates();
374 } else { 375 } else {
375 event->setHasRecurrenceID( false ); 376 event->setHasRecurrenceID( false );
376 } 377 }
377 } else { 378 } else {
378 event->setHasRecurrenceID( false ); 379 event->setHasRecurrenceID( false );
379 event->recurrence()->unsetRecurs(); 380 event->recurrence()->unsetRecurs();
380 } 381 }
381} 382}
382 383
383bool KOTodoEditor::validateInput() 384bool KOTodoEditor::validateInput()
384{ 385{
385 if (!mGeneral->validateInput()) return false; 386 if (!mGeneral->validateInput()) return false;
386 if (!mDetails->validateInput()) return false; 387 if (!mDetails->validateInput()) return false;
387 return true; 388 return true;
388} 389}
389 390
390int KOTodoEditor::msgItemDelete() 391int KOTodoEditor::msgItemDelete()
391{ 392{
392 return KMessageBox::warningContinueCancel(this, 393 return KMessageBox::warningContinueCancel(this,
393 i18n("This item will be permanently deleted."), 394 i18n("This item will be permanently deleted."),
394 i18n("KOrganizer Confirmation"),i18n("Delete")); 395 i18n("KOrganizer Confirmation"),i18n("Delete"));
395} 396}
396 397
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index a87e6fc..c23a8ee 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -411,196 +411,230 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e )
411 mFlagKeyPressed = true; 411 mFlagKeyPressed = true;
412 QListViewItem* cn; 412 QListViewItem* cn;
413 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 413 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
414 cn = currentItem(); 414 cn = currentItem();
415 if ( cn ) { 415 if ( cn ) {
416 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 416 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
417 if ( ci ){ 417 if ( ci ){
418 if ( e->state() == ShiftButton ) 418 if ( e->state() == ShiftButton )
419 ci->setOn( false ); 419 ci->setOn( false );
420 else 420 else
421 ci->setOn( true ); 421 ci->setOn( true );
422 cn = cn->itemBelow(); 422 cn = cn->itemBelow();
423 if ( cn ) { 423 if ( cn ) {
424 setCurrentItem ( cn ); 424 setCurrentItem ( cn );
425 ensureItemVisible ( cn ); 425 ensureItemVisible ( cn );
426 } 426 }
427 427
428 } 428 }
429 } 429 }
430 430
431 return; 431 return;
432 } 432 }
433 433
434 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 434 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
435 switch ( e->key() ) { 435 switch ( e->key() ) {
436 case Qt::Key_Down: 436 case Qt::Key_Down:
437 case Qt::Key_Up: 437 case Qt::Key_Up:
438 QListView::keyPressEvent ( e ); 438 QListView::keyPressEvent ( e );
439 break; 439 break;
440 case Qt::Key_Left: 440 case Qt::Key_Left:
441 case Qt::Key_Right: 441 case Qt::Key_Right:
442 QListView::keyPressEvent ( e ); 442 QListView::keyPressEvent ( e );
443 e->accept(); 443 e->accept();
444 return; 444 return;
445 break; 445 break;
446 default: 446 default:
447 e->ignore(); 447 e->ignore();
448 break; 448 break;
449 } 449 }
450 return; 450 return;
451 } 451 }
452 e->ignore(); 452 e->ignore();
453} 453}
454void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 454void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
455{ 455{
456 QListView::contentsMouseReleaseEvent(e); 456 QListView::contentsMouseReleaseEvent(e);
457 mMousePressed = false; 457 mMousePressed = false;
458} 458}
459 459
460void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 460void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
461{ 461{
462 if (!e) return; 462 if (!e) return;
463 463
464 QPoint vp = contentsToViewport(e->pos()); 464 QPoint vp = contentsToViewport(e->pos());
465 465
466 QListViewItem *item = itemAt(vp); 466 QListViewItem *item = itemAt(vp);
467 467
468 emit double_Clicked(item); 468 emit double_Clicked(item);
469 if (!item) return; 469 if (!item) return;
470 470
471 emit doubleClicked(item,vp,0); 471 emit doubleClicked(item,vp,0);
472} 472}
473 473
474///////////////////////////////////////////////////////////////////////////// 474/////////////////////////////////////////////////////////////////////////////
475 475
476KOQuickTodo::KOQuickTodo(QWidget *parent) : 476KOQuickTodo::KOQuickTodo(QWidget *parent) :
477 QLineEdit(parent) 477 QLineEdit(parent)
478{ 478{
479 setText(i18n("Click to add a new Todo")); 479 setText(i18n("Click to add a new Todo"));
480} 480}
481 481
482void KOQuickTodo::focusInEvent(QFocusEvent *ev) 482void KOQuickTodo::focusInEvent(QFocusEvent *ev)
483{ 483{
484 if ( text()==i18n("Click to add a new Todo") ) 484 if ( text()==i18n("Click to add a new Todo") )
485 setText(""); 485 setText("");
486 QLineEdit::focusInEvent(ev); 486 QLineEdit::focusInEvent(ev);
487} 487}
488 488
489void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 489void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
490{ 490{
491 setText(i18n("Click to add a new Todo")); 491 setText(i18n("Click to add a new Todo"));
492 QLineEdit::focusOutEvent(ev); 492 QLineEdit::focusOutEvent(ev);
493} 493}
494 494
495///////////////////////////////////////////////////////////////////////////// 495/////////////////////////////////////////////////////////////////////////////
496 496
497KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 497KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
498 KOrg::BaseView(calendar,parent,name) 498 KOrg::BaseView(calendar,parent,name)
499{ 499{
500 mCategoryPopupMenu = 0; 500 mCategoryPopupMenu = 0;
501 mPendingUpdateBeforeRepaint = false; 501 mPendingUpdateBeforeRepaint = false;
502 isFlatDisplay = false; 502 isFlatDisplay = false;
503 mNavigator = 0; 503 mNavigator = 0;
504 QBoxLayout *topLayout = new QVBoxLayout(this); 504 QBoxLayout *topLayout = new QVBoxLayout(this);
505 mName = QString ( name ); 505 mName = QString ( name );
506 mBlockUpdate = false; 506 mBlockUpdate = false;
507 mQuickAdd = new KOQuickTodo(this); 507 mQuickBar = new QWidget( this );
508 topLayout->addWidget(mQuickAdd); 508 topLayout->addWidget(mQuickBar);
509 509
510 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 510 mQuickAdd = new KOQuickTodo(mQuickBar);
511 QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar);
512 quickLayout->addWidget( mQuickAdd );
513 QPushButton * flat = new QPushButton( "F",mQuickBar );
514 int fixwid = flat->sizeHint().height();
515 if ( QApplication::desktop()->width() > 320 )
516 fixwid *= 2;
517 flat->setFixedWidth( fixwid );
518 connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat()));
519 QPushButton * allopen = new QPushButton( "O",mQuickBar );
520 allopen->setFixedWidth( fixwid );
521 connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen()));
522 QPushButton * allclose = new QPushButton( "C",mQuickBar );
523 allclose->setFixedWidth( fixwid );
524 connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose()));
525 QPushButton * s_done = new QPushButton( "D",mQuickBar );
526 s_done->setFixedWidth( fixwid );
527 connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted()));
528 QPushButton * s_run = new QPushButton( "R",mQuickBar );
529 s_run->setFixedWidth( fixwid );
530 connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning()));
531
532 mNewSubBut = new QPushButton( "sub",mQuickBar );
533 mNewSubBut->setFixedWidth( fixwid*3/2 );
534 connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo()));
535 mNewSubBut->setEnabled( false );
536 quickLayout->addWidget( mNewSubBut );
537 quickLayout->addWidget( s_done );
538 quickLayout->addWidget( s_run );
539
540 quickLayout->addWidget( allopen );
541 quickLayout->addWidget( allclose );
542 quickLayout->addWidget( flat );
543
544 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide();
511 545
512 mTodoListView = new KOTodoListView(calendar,this, name ); 546 mTodoListView = new KOTodoListView(calendar,this, name );
513 topLayout->addWidget(mTodoListView); 547 topLayout->addWidget(mTodoListView);
514 //mTodoListView->header()->setMaximumHeight(30); 548 //mTodoListView->header()->setMaximumHeight(30);
515 mTodoListView->setRootIsDecorated(true); 549 mTodoListView->setRootIsDecorated(true);
516 mTodoListView->setAllColumnsShowFocus(true); 550 mTodoListView->setAllColumnsShowFocus(true);
517 551
518 mTodoListView->setShowSortIndicator(true); 552 mTodoListView->setShowSortIndicator(true);
519 553
520 mTodoListView->addColumn(i18n("Todo")); 554 mTodoListView->addColumn(i18n("Todo"));
521 mTodoListView->addColumn(i18n("Prio")); 555 mTodoListView->addColumn(i18n("Prio"));
522 mTodoListView->setColumnAlignment(1,AlignHCenter); 556 mTodoListView->setColumnAlignment(1,AlignHCenter);
523 mTodoListView->addColumn(i18n("Complete")); 557 mTodoListView->addColumn(i18n("Complete"));
524 mTodoListView->setColumnAlignment(2,AlignCenter); 558 mTodoListView->setColumnAlignment(2,AlignCenter);
525 559
526 mTodoListView->addColumn(i18n("Due Date")); 560 mTodoListView->addColumn(i18n("Due Date"));
527 mTodoListView->setColumnAlignment(3,AlignLeft); 561 mTodoListView->setColumnAlignment(3,AlignLeft);
528 mTodoListView->addColumn(i18n("Due Time")); 562 mTodoListView->addColumn(i18n("Due Time"));
529 mTodoListView->setColumnAlignment(4,AlignHCenter); 563 mTodoListView->setColumnAlignment(4,AlignHCenter);
530 564
531 mTodoListView->addColumn(i18n("Start Date")); 565 mTodoListView->addColumn(i18n("Start Date"));
532 mTodoListView->setColumnAlignment(5,AlignLeft); 566 mTodoListView->setColumnAlignment(5,AlignLeft);
533 mTodoListView->addColumn(i18n("Start Time")); 567 mTodoListView->addColumn(i18n("Start Time"));
534 mTodoListView->setColumnAlignment(6,AlignHCenter); 568 mTodoListView->setColumnAlignment(6,AlignHCenter);
535 569
536 mTodoListView->addColumn(i18n("Cancelled")); 570 mTodoListView->addColumn(i18n("Cancelled"));
537 mTodoListView->addColumn(i18n("Categories")); 571 mTodoListView->addColumn(i18n("Categories"));
538 mTodoListView->addColumn(i18n("Calendar")); 572 mTodoListView->addColumn(i18n("Calendar"));
539#if 0 573#if 0
540 mTodoListView->addColumn(i18n("Sort Id")); 574 mTodoListView->addColumn(i18n("Sort Id"));
541 mTodoListView->setColumnAlignment(4,AlignHCenter); 575 mTodoListView->setColumnAlignment(4,AlignHCenter);
542#endif 576#endif
543 577
544 mTodoListView->setMinimumHeight( 60 ); 578 mTodoListView->setMinimumHeight( 60 );
545 mTodoListView->setItemsRenameable( true ); 579 mTodoListView->setItemsRenameable( true );
546 mTodoListView->setRenameable( 0 ); 580 mTodoListView->setRenameable( 0 );
547 mTodoListView->setColumnWidth( 0, 120 ); 581 mTodoListView->setColumnWidth( 0, 120 );
548 int iii = 0; 582 int iii = 0;
549 for ( iii = 0; iii< 10 ; ++iii ) 583 for ( iii = 0; iii< 10 ; ++iii )
550 mTodoListView->setColumnWidthMode( iii, QListView::Manual ); 584 mTodoListView->setColumnWidthMode( iii, QListView::Manual );
551 585
552 586
553 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); 587 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
554 588
555 mPriorityPopupMenu = new QPopupMenu(this); 589 mPriorityPopupMenu = new QPopupMenu(this);
556 for (int i = 1; i <= 5; i++) { 590 for (int i = 1; i <= 5; i++) {
557 QString label = QString ("%1").arg (i); 591 QString label = QString ("%1").arg (i);
558 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 592 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
559 } 593 }
560 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 594 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
561 595
562 mPercentageCompletedPopupMenu = new QPopupMenu(this); 596 mPercentageCompletedPopupMenu = new QPopupMenu(this);
563 for (int i = 0; i <= 100; i+=20) { 597 for (int i = 0; i <= 100; i+=20) {
564 QString label = QString ("%1 %").arg (i); 598 QString label = QString ("%1 %").arg (i);
565 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 599 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
566 } 600 }
567 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 601 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
568 602
569 603
570 mCategoryPopupMenu = new QPopupMenu (this); 604 mCategoryPopupMenu = new QPopupMenu (this);
571 mCategoryPopupMenu->setCheckable (true); 605 mCategoryPopupMenu->setCheckable (true);
572 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 606 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
573 connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); 607 connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ()));
574 608
575 mCalPopupMenu = new QPopupMenu (this); 609 mCalPopupMenu = new QPopupMenu (this);
576 mCalPopupMenu->setCheckable (true); 610 mCalPopupMenu->setCheckable (true);
577 connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); 611 connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int)));
578 connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); 612 connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ()));
579 613
580 614
581 615
582 616
583 mItemPopupMenu = new QPopupMenu(this); 617 mItemPopupMenu = new QPopupMenu(this);
584 mItemPopupMenu->insertItem(i18n("Show"), this, 618 mItemPopupMenu->insertItem(i18n("Show"), this,
585 SLOT (showTodo())); 619 SLOT (showTodo()));
586 mItemPopupMenu->insertItem(i18n("Edit..."), this, 620 mItemPopupMenu->insertItem(i18n("Edit..."), this,
587 SLOT (editTodo())); 621 SLOT (editTodo()));
588 mItemPopupMenu->insertItem( i18n("Delete..."), this, 622 mItemPopupMenu->insertItem( i18n("Delete..."), this,
589 SLOT (deleteTodo())); 623 SLOT (deleteTodo()));
590 mItemPopupMenu->insertItem( i18n("Clone..."), this, 624 mItemPopupMenu->insertItem( i18n("Clone..."), this,
591 SLOT (cloneTodo())); 625 SLOT (cloneTodo()));
592 mItemPopupMenu->insertItem( i18n("Move..."), this, 626 mItemPopupMenu->insertItem( i18n("Move..."), this,
593 SLOT (moveTodo())); 627 SLOT (moveTodo()));
594#ifndef DESKTOP_VERSION 628#ifndef DESKTOP_VERSION
595 mItemPopupMenu->insertItem( i18n("Beam..."), this, 629 mItemPopupMenu->insertItem( i18n("Beam..."), this,
596 SLOT (beamTodo())); 630 SLOT (beamTodo()));
597#endif 631#endif
598 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 632 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
599 SLOT (cancelTodo())); 633 SLOT (cancelTodo()));
600 mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu); 634 mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu);
601 mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu); 635 mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu);
602 mItemPopupMenu->insertSeparator(); 636 mItemPopupMenu->insertSeparator();
603 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, 637 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
604 SLOT (toggleRunningItem())); 638 SLOT (toggleRunningItem()));
605 mItemPopupMenu->insertSeparator(); 639 mItemPopupMenu->insertSeparator();
606 /* 640 /*
@@ -989,194 +1023,198 @@ KOTodoView::insertTodoItem(Todo *todo)
989 // see above -zecke 1023 // see above -zecke
990 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1024 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
991 return mTodoMap.insert(todo,todoItem); 1025 return mTodoMap.insert(todo,todoItem);
992 } 1026 }
993} 1027}
994 1028
995 1029
996void KOTodoView::updateConfig() 1030void KOTodoView::updateConfig()
997{ 1031{
998 updateView(); 1032 updateView();
999 mTodoListView->repaintContents(); 1033 mTodoListView->repaintContents();
1000} 1034}
1001 1035
1002QPtrList<Incidence> KOTodoView::selectedIncidences() 1036QPtrList<Incidence> KOTodoView::selectedIncidences()
1003{ 1037{
1004 QPtrList<Incidence> selected; 1038 QPtrList<Incidence> selected;
1005 1039
1006 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 1040 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
1007// if (!item) item = mActiveItem; 1041// if (!item) item = mActiveItem;
1008 if (item) selected.append(item->todo()); 1042 if (item) selected.append(item->todo());
1009 1043
1010 return selected; 1044 return selected;
1011} 1045}
1012 1046
1013QPtrList<Todo> KOTodoView::selectedTodos() 1047QPtrList<Todo> KOTodoView::selectedTodos()
1014{ 1048{
1015 QPtrList<Todo> selected; 1049 QPtrList<Todo> selected;
1016 1050
1017 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 1051 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
1018// if (!item) item = mActiveItem; 1052// if (!item) item = mActiveItem;
1019 if (item) selected.append(item->todo()); 1053 if (item) selected.append(item->todo());
1020 1054
1021 return selected; 1055 return selected;
1022} 1056}
1023 1057
1024void KOTodoView::changeEventDisplay(Event *, int) 1058void KOTodoView::changeEventDisplay(Event *, int)
1025{ 1059{
1026 updateView(); 1060 updateView();
1027} 1061}
1028 1062
1029void KOTodoView::showDates(const QDate &, const QDate &) 1063void KOTodoView::showDates(const QDate &, const QDate &)
1030{ 1064{
1031} 1065}
1032 1066
1033void KOTodoView::showEvents(QPtrList<Event>) 1067void KOTodoView::showEvents(QPtrList<Event>)
1034{ 1068{
1035 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; 1069 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
1036} 1070}
1037 1071
1038void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1072void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1039 const QDate &td) 1073 const QDate &td)
1040{ 1074{
1041#ifndef KORG_NOPRINTER 1075#ifndef KORG_NOPRINTER
1042 calPrinter->preview(CalPrinter::Todolist, fd, td); 1076 calPrinter->preview(CalPrinter::Todolist, fd, td);
1043#endif 1077#endif
1044} 1078}
1045 1079
1046void KOTodoView::editItem(QListViewItem *item ) 1080void KOTodoView::editItem(QListViewItem *item )
1047{ 1081{
1048 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 1082 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
1049} 1083}
1050 1084
1051void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 1085void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
1052{ 1086{
1053 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 1087 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
1054} 1088}
1055 1089
1056void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) 1090void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
1057{ 1091{
1058 pendingSubtodo = 0; 1092 pendingSubtodo = 0;
1059 mActiveItem = (KOTodoViewItem *)item; 1093 mActiveItem = (KOTodoViewItem *)item;
1060 if (item) { 1094 if (item) {
1061 switch (column){ 1095 switch (column){
1062 case 1: 1096 case 1:
1063 mPriorityPopupMenu->popup(QCursor::pos ()); break; 1097 mPriorityPopupMenu->popup(QCursor::pos ()); break;
1064 case 2: 1098 case 2:
1065 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 1099 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
1066 case 3: 1100 case 3:
1067 moveTodo(); 1101 moveTodo();
1068 break; 1102 break;
1069 case 8: 1103 case 8:
1070 mCategoryPopupMenu->popup(QCursor::pos ()); break; 1104 mCategoryPopupMenu->popup(QCursor::pos ()); break;
1071 case 9: 1105 case 9:
1072 mCalPopupMenu->popup(QCursor::pos ()); break; 1106 mCalPopupMenu->popup(QCursor::pos ()); break;
1073 default: 1107 default:
1074 mItemPopupMenu->popup(QCursor::pos()); 1108 mItemPopupMenu->popup(QCursor::pos());
1075 } 1109 }
1076 } else mPopupMenu->popup(QCursor::pos()); 1110 } else mPopupMenu->popup(QCursor::pos());
1077} 1111}
1078void KOTodoView::newTodo() 1112void KOTodoView::newTodo()
1079{ 1113{
1080 emit newTodoSignal(); 1114 emit newTodoSignal();
1081} 1115}
1082 1116
1083void KOTodoView::newSubTodo() 1117void KOTodoView::newSubTodo()
1084{ 1118{
1119 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1085 if (mActiveItem) { 1120 if (mActiveItem) {
1086 emit newSubTodoSignal(mActiveItem->todo()); 1121 if ( mQuickAdd->isVisible() && !mQuickAdd->text().isEmpty() && mQuickAdd->text() != i18n("Click to add a new Todo") ) {
1122 addQuickTodoPar( mActiveItem->todo());
1123 } else
1124 emit newSubTodoSignal(mActiveItem->todo());
1087 } 1125 }
1088} 1126}
1089void KOTodoView::unparentTodo() 1127void KOTodoView::unparentTodo()
1090{ 1128{
1091 if (mActiveItem) { 1129 if (mActiveItem) {
1092 emit unparentTodoSignal(mActiveItem->todo()); 1130 emit unparentTodoSignal(mActiveItem->todo());
1093 } 1131 }
1094} 1132}
1095 1133
1096void KOTodoView::reparentTodo() 1134void KOTodoView::reparentTodo()
1097{ 1135{
1098 if (mActiveItem) { 1136 if (mActiveItem) {
1099 topLevelWidget()->setCaption(i18n("Click on new parent item")); 1137 topLevelWidget()->setCaption(i18n("Click on new parent item"));
1100 pendingSubtodo = mActiveItem; 1138 pendingSubtodo = mActiveItem;
1101 } 1139 }
1102} 1140}
1103void KOTodoView::editTodo() 1141void KOTodoView::editTodo()
1104{ 1142{
1105 if (mActiveItem) { 1143 if (mActiveItem) {
1106 emit editTodoSignal(mActiveItem->todo()); 1144 emit editTodoSignal(mActiveItem->todo());
1107 } 1145 }
1108} 1146}
1109void KOTodoView::cloneTodo() 1147void KOTodoView::cloneTodo()
1110{ 1148{
1111 if (mActiveItem) { 1149 if (mActiveItem) {
1112 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 1150 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
1113 } 1151 }
1114} 1152}
1115void KOTodoView::cancelTodo() 1153void KOTodoView::cancelTodo()
1116{ 1154{
1117 if (mActiveItem) { 1155 if (mActiveItem) {
1118 emit cancelTodoSignal((Incidence*)mActiveItem->todo()); 1156 emit cancelTodoSignal((Incidence*)mActiveItem->todo());
1119 } 1157 }
1120} 1158}
1121void KOTodoView::moveTodo() 1159void KOTodoView::moveTodo()
1122{ 1160{
1123 if (mActiveItem) { 1161 if (mActiveItem) {
1124 emit moveTodoSignal((Incidence*)mActiveItem->todo()); 1162 emit moveTodoSignal((Incidence*)mActiveItem->todo());
1125 } 1163 }
1126} 1164}
1127void KOTodoView::beamTodo() 1165void KOTodoView::beamTodo()
1128{ 1166{
1129 if (mActiveItem) { 1167 if (mActiveItem) {
1130 emit beamTodoSignal((Incidence*)mActiveItem->todo()); 1168 emit beamTodoSignal((Incidence*)mActiveItem->todo());
1131 } 1169 }
1132} 1170}
1133 1171
1134 1172
1135void KOTodoView::showTodo() 1173void KOTodoView::showTodo()
1136{ 1174{
1137 if (mActiveItem) { 1175 if (mActiveItem) {
1138 emit showTodoSignal(mActiveItem->todo()); 1176 emit showTodoSignal(mActiveItem->todo());
1139 } 1177 }
1140} 1178}
1141 1179
1142void KOTodoView::deleteTodo() 1180void KOTodoView::deleteTodo()
1143{ 1181{
1144 if (mActiveItem) { 1182 if (mActiveItem) {
1145 emit deleteTodoSignal(mActiveItem->todo()); 1183 emit deleteTodoSignal(mActiveItem->todo());
1146 } 1184 }
1147} 1185}
1148 1186
1149void KOTodoView::setNewPriority(int index) 1187void KOTodoView::setNewPriority(int index)
1150{ 1188{
1151 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1189 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1152 mActiveItem->todo()->setPriority(mPriority[index]); 1190 mActiveItem->todo()->setPriority(mPriority[index]);
1153 mActiveItem->construct(); 1191 mActiveItem->construct();
1154 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 1192 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
1155 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1193 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1156 } 1194 }
1157 processSelectionChange(); 1195 processSelectionChange();
1158} 1196}
1159 1197
1160void KOTodoView::setNewPercentage(int index) 1198void KOTodoView::setNewPercentage(int index)
1161{ 1199{
1162 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1200 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1163 1201
1164 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { 1202 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
1165 mActiveItem->setOn( true ); 1203 mActiveItem->setOn( true );
1166 processSelectionChange(); 1204 processSelectionChange();
1167 return; 1205 return;
1168 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { 1206 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
1169 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); 1207 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
1170 if ( par && par->isOn() ) 1208 if ( par && par->isOn() )
1171 par->setOn( false ); 1209 par->setOn( false );
1172 } 1210 }
1173 if (mPercentage[index] == 100) { 1211 if (mPercentage[index] == 100) {
1174 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 1212 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
1175 } else { 1213 } else {
1176 mActiveItem->todo()->setCompleted(false); 1214 mActiveItem->todo()->setCompleted(false);
1177 } 1215 }
1178 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 1216 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
1179 mActiveItem->construct(); 1217 mActiveItem->construct();
1180 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 1218 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
1181 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1219 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1182 } 1220 }
@@ -1298,328 +1336,352 @@ void KOTodoView::toggleRunningItem()
1298 tp.setGeometry( xx,yy,wid,hei ); 1336 tp.setGeometry( xx,yy,wid,hei );
1299 } 1337 }
1300 tp.exec(); 1338 tp.exec();
1301 mActiveItem->construct(); 1339 mActiveItem->construct();
1302 } else { 1340 } else {
1303 KOStartTodoPrefs tp ( t->summary(), this ); 1341 KOStartTodoPrefs tp ( t->summary(), this );
1304 if (QApplication::desktop()->width() <= 800 ){ 1342 if (QApplication::desktop()->width() <= 800 ){
1305 int wid = tp.width(); 1343 int wid = tp.width();
1306 int hei = tp.height(); 1344 int hei = tp.height();
1307 int xx = (QApplication::desktop()->width()-wid)/2; 1345 int xx = (QApplication::desktop()->width()-wid)/2;
1308 int yy = (QApplication::desktop()->height()-hei)/2; 1346 int yy = (QApplication::desktop()->height()-hei)/2;
1309 tp.setGeometry( xx,yy,wid,hei ); 1347 tp.setGeometry( xx,yy,wid,hei );
1310 } 1348 }
1311 if ( !tp.exec() ) return; 1349 if ( !tp.exec() ) return;
1312 if ( tp.stopAll() ) { 1350 if ( tp.stopAll() ) {
1313 mCalendar->stopAllTodos(); 1351 mCalendar->stopAllTodos();
1314 t->setRunning( true ); 1352 t->setRunning( true );
1315 updateView(); 1353 updateView();
1316 } else { 1354 } else {
1317 t->setRunning( true ); 1355 t->setRunning( true );
1318 mActiveItem->construct(); 1356 mActiveItem->construct();
1319 } 1357 }
1320 } 1358 }
1321} 1359}
1322 1360
1323void KOTodoView::itemClicked(QListViewItem *item) 1361void KOTodoView::itemClicked(QListViewItem *item)
1324{ 1362{
1325 //qDebug("KOTodoView::itemClicked %d", item); 1363 //qDebug("KOTodoView::itemClicked %d", item);
1326 if (!item) { 1364 if (!item) {
1327 if ( pendingSubtodo != 0 ) { 1365 if ( pendingSubtodo != 0 ) {
1328 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1366 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1329 } 1367 }
1330 pendingSubtodo = 0; 1368 pendingSubtodo = 0;
1331 return; 1369 return;
1332 } 1370 }
1333 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1371 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1334 if ( pendingSubtodo != 0 ) { 1372 if ( pendingSubtodo != 0 ) {
1335 bool allowReparent = true; 1373 bool allowReparent = true;
1336 QListViewItem *par = item; 1374 QListViewItem *par = item;
1337 while ( par ) { 1375 while ( par ) {
1338 if ( par == pendingSubtodo ) { 1376 if ( par == pendingSubtodo ) {
1339 allowReparent = false; 1377 allowReparent = false;
1340 break; 1378 break;
1341 } 1379 }
1342 par = par->parent(); 1380 par = par->parent();
1343 } 1381 }
1344 if ( !allowReparent ) { 1382 if ( !allowReparent ) {
1345 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1383 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1346 pendingSubtodo = 0; 1384 pendingSubtodo = 0;
1347 } else { 1385 } else {
1348 Todo* newParent = todoItem->todo(); 1386 Todo* newParent = todoItem->todo();
1349 Todo* newSub = pendingSubtodo->todo(); 1387 Todo* newSub = pendingSubtodo->todo();
1350 pendingSubtodo = 0; 1388 pendingSubtodo = 0;
1351 emit reparentTodoSignal( newParent,newSub ); 1389 emit reparentTodoSignal( newParent,newSub );
1352 return; 1390 return;
1353 } 1391 }
1354 } 1392 }
1355 1393
1356} 1394}
1357 1395
1358void KOTodoView::setDocumentId( const QString &id ) 1396void KOTodoView::setDocumentId( const QString &id )
1359{ 1397{
1360 1398
1361 mDocPrefs->setDoc( id ); 1399 mDocPrefs->setDoc( id );
1362} 1400}
1363 1401
1364void KOTodoView::itemStateChanged( QListViewItem *item ) 1402void KOTodoView::itemStateChanged( QListViewItem *item )
1365{ 1403{
1366 if (!item) return; 1404 if (!item) return;
1367 1405
1368 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1406 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1369 1407
1370// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1408// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1371 1409
1372 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1410 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1373} 1411}
1374 1412
1375void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1413void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1376{ 1414{
1377 mTodoListView->saveLayout(config,group); 1415 mTodoListView->saveLayout(config,group);
1378} 1416}
1379 1417
1380void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1418void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1381{ 1419{
1382 mTodoListView->restoreLayout(config,group); 1420 mTodoListView->restoreLayout(config,group);
1383} 1421}
1384 1422
1385void KOTodoView::processSelectionChange() 1423void KOTodoView::processSelectionChange()
1386{ 1424{
1387// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1425// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1388 1426
1389 KOTodoViewItem *item = 1427 KOTodoViewItem *item =
1390 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1428 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1391 1429
1392 if ( !item ) { 1430 if ( !item ) {
1393 emit incidenceSelected( 0 ); 1431 emit incidenceSelected( 0 );
1432 mNewSubBut->setEnabled( false );
1394 } else { 1433 } else {
1395 emit incidenceSelected( item->todo() ); 1434 emit incidenceSelected( item->todo() );
1435 mNewSubBut->setEnabled( true );
1396 } 1436 }
1397} 1437}
1398 1438
1399void KOTodoView::modified(bool b) 1439void KOTodoView::modified(bool b)
1400{ 1440{
1401 emit isModified(b); 1441 emit isModified(b);
1402} 1442}
1403void KOTodoView::setTodoModified( Todo* todo ) 1443void KOTodoView::setTodoModified( Todo* todo )
1404{ 1444{
1405 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1445 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1406} 1446}
1407void KOTodoView::clearSelection() 1447void KOTodoView::clearSelection()
1408{ 1448{
1409 mTodoListView->selectAll( false ); 1449 mTodoListView->selectAll( false );
1410} 1450}
1411void KOTodoView::setAllOpen() 1451void KOTodoView::setAllOpen()
1412{ 1452{
1413 if ( isFlatDisplay ) { 1453 if ( isFlatDisplay ) {
1414 isFlatDisplay = false; 1454 isFlatDisplay = false;
1415 mPopupMenu->setItemChecked( 8,false ); 1455 mPopupMenu->setItemChecked( 8,false );
1416 updateView(); 1456 updateView();
1417 } else { 1457 } else {
1418 storeCurrentItem(); 1458 storeCurrentItem();
1419 } 1459 }
1420 setOpen(mTodoListView->firstChild(), true); 1460 setOpen(mTodoListView->firstChild(), true);
1421 resetCurrentItem(); 1461 resetCurrentItem();
1422} 1462}
1423void KOTodoView::setAllClose() 1463void KOTodoView::setAllClose()
1424{ 1464{
1425 if ( isFlatDisplay ) { 1465 if ( isFlatDisplay ) {
1426 isFlatDisplay = false; 1466 isFlatDisplay = false;
1427 mPopupMenu->setItemChecked( 8,false ); 1467 mPopupMenu->setItemChecked( 8,false );
1428 updateView(); 1468 updateView();
1429 } else { 1469 } else {
1430 storeCurrentItem(); 1470 storeCurrentItem();
1431 } 1471 }
1432 setOpen(mTodoListView->firstChild(), false); 1472 setOpen(mTodoListView->firstChild(), false);
1433 resetCurrentItem(); 1473 resetCurrentItem();
1434} 1474}
1435void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) 1475void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
1436{ 1476{
1437 1477
1438 while ( item ) { 1478 while ( item ) {
1439 setOpen( item->firstChild(), setOpenI ); 1479 setOpen( item->firstChild(), setOpenI );
1440 item->setOpen( setOpenI ); 1480 item->setOpen( setOpenI );
1441 item = item->nextSibling(); 1481 item = item->nextSibling();
1442 } 1482 }
1443} 1483}
1444 1484
1445void KOTodoView::displayAllFlat() 1485void KOTodoView::displayAllFlat()
1446{ 1486{
1447 storeCurrentItem(); 1487 storeCurrentItem();
1448 pendingSubtodo = 0; 1488 pendingSubtodo = 0;
1449 if ( mBlockUpdate ) { 1489 if ( mBlockUpdate ) {
1450 return; 1490 return;
1451 } 1491 }
1452 mPopupMenu->setItemChecked( 8,true ); 1492 mPopupMenu->setItemChecked( 8,true );
1453 isFlatDisplay = true; 1493 isFlatDisplay = true;
1454 QPtrList<Todo> todoList = calendar()->todos(); 1494 QPtrList<Todo> todoList = calendar()->todos();
1455 mTodoMap.clear(); 1495 mTodoMap.clear();
1456 mTodoListView->clear(); 1496 mTodoListView->clear();
1457 Todo *todo; 1497 Todo *todo;
1458 for(todo = todoList.first(); todo; todo = todoList.next()) { 1498 for(todo = todoList.first(); todo; todo = todoList.next()) {
1459 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1499 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1460 mTodoMap.insert(todo,todoItem); 1500 mTodoMap.insert(todo,todoItem);
1461 } 1501 }
1462 resetCurrentItem(); 1502 resetCurrentItem();
1463} 1503}
1464 1504
1465void KOTodoView::setAllFlat() 1505void KOTodoView::setAllFlat()
1466{ 1506{
1467 if ( isFlatDisplay ) { 1507 if ( isFlatDisplay ) {
1468 isFlatDisplay = false; 1508 isFlatDisplay = false;
1469 mPopupMenu->setItemChecked( 8,false ); 1509 mPopupMenu->setItemChecked( 8,false );
1470 updateView(); 1510 updateView();
1471 return; 1511 return;
1472 } 1512 }
1473 displayAllFlat(); 1513 displayAllFlat();
1474} 1514}
1475 1515
1476void KOTodoView::purgeCompleted() 1516void KOTodoView::purgeCompleted()
1477{ 1517{
1478 emit purgeCompletedSignal(); 1518 emit purgeCompletedSignal();
1479 1519
1480} 1520}
1481void KOTodoView::toggleQuickTodo() 1521void KOTodoView::toggleQuickTodo()
1482{ 1522{
1483 if ( mQuickAdd->isVisible() ) { 1523 if ( mQuickBar->isVisible() ) {
1484 mQuickAdd->hide(); 1524 mQuickBar->hide();
1485 KOPrefs::instance()->mEnableQuickTodo = false; 1525 KOPrefs::instance()->mEnableQuickTodo = false;
1486 } 1526 }
1487 else { 1527 else {
1488 mQuickAdd->show(); 1528 mQuickBar->show();
1489 KOPrefs::instance()->mEnableQuickTodo = true; 1529 KOPrefs::instance()->mEnableQuickTodo = true;
1490 } 1530 }
1491 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 1531 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
1492 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 1532 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
1493} 1533}
1494 1534
1495void KOTodoView::toggleRunning() 1535void KOTodoView::toggleRunning()
1496{ 1536{
1497 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; 1537 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos;
1498 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 1538 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
1499 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 1539 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
1500 updateView(); 1540 updateView();
1541 if ( KOPrefs::instance()->mHideNonStartedTodos )
1542 topLevelWidget()->setCaption(i18n("Hide not Running"));
1543 else
1544 topLevelWidget()->setCaption(i18n("Show not Running"));
1501} 1545}
1502 1546
1503void KOTodoView::toggleCompleted() 1547void KOTodoView::toggleCompleted()
1504{ 1548{
1505 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; 1549 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo;
1506 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 1550 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
1507 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 1551 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
1508 updateView(); 1552 updateView();
1553 if ( KOPrefs::instance()->mShowCompletedTodo )
1554 topLevelWidget()->setCaption(i18n("Show Completed"));
1555 else
1556 topLevelWidget()->setCaption(i18n("Hide Completed"));
1509} 1557}
1510 1558
1511void KOTodoView::addQuickTodo() 1559void KOTodoView::addQuickTodo()
1512{ 1560{
1513 Todo *todo = new Todo(); 1561 addQuickTodoPar( 0 );
1514 todo->setSummary(mQuickAdd->text());
1515 todo->setOrganizer(KOPrefs::instance()->email());
1516 CalFilter * cf = mCalendar->filter();
1517 if ( cf ) {
1518 if ( cf->isEnabled()&& cf->showCategories()) {
1519 todo->setCategories(cf->categoryList());
1520 }
1521 if ( cf->isEnabled() )
1522 todo->setSecrecy( cf->getSecrecy());
1523 }
1524 mCalendar->addTodo(todo);
1525 mQuickAdd->setText("");
1526 todoModified (todo, KOGlobals::EVENTADDED );
1527 updateView();
1528} 1562}
1563void KOTodoView::addQuickTodoPar( Todo * parentTodo)
1564{
1565 Todo *todo = new Todo();
1566 todo->setSummary(mQuickAdd->text());
1567 todo->setOrganizer(KOPrefs::instance()->email());
1568 if ( parentTodo ) {
1569 todo->setRelatedTo(parentTodo);
1570
1571 todo->setCategories (parentTodo->categoriesStr ());
1572 todo->setSecrecy (parentTodo->secrecy ());
1573 if ( parentTodo->priority() < 3 )
1574 todo->setPriority( parentTodo->priority() );
1575 todo->setCalID( parentTodo->calID() );
1576 } else {
1577 CalFilter * cf = mCalendar->filter();
1578 if ( cf ) {
1579 if ( cf->isEnabled()&& cf->showCategories()) {
1580 todo->setCategories(cf->categoryList());
1581 }
1582 if ( cf->isEnabled() )
1583 todo->setSecrecy( cf->getSecrecy());
1584 }
1585 }
1586 mCalendar->addTodo(todo);
1587 mQuickAdd->setText("");
1588 todoModified (todo, KOGlobals::EVENTADDED );
1589 updateView();
1529 1590
1591}
1530void KOTodoView::keyPressEvent ( QKeyEvent * e ) 1592void KOTodoView::keyPressEvent ( QKeyEvent * e )
1531{ 1593{
1532 // e->ignore(); 1594 // e->ignore();
1533 //return; 1595 //return;
1534 //qDebug("KOTodoView::keyPressEvent "); 1596 //qDebug("KOTodoView::keyPressEvent ");
1535 switch ( e->key() ) { 1597 switch ( e->key() ) {
1536 case Qt::Key_Down: 1598 case Qt::Key_Down:
1537 case Qt::Key_Up: 1599 case Qt::Key_Up:
1538 QWidget::keyPressEvent ( e ); 1600 QWidget::keyPressEvent ( e );
1539 break; 1601 break;
1540 1602
1541 case Qt::Key_Q: 1603 case Qt::Key_Q:
1542 toggleQuickTodo(); 1604 toggleQuickTodo();
1543 break; 1605 break;
1544 case Qt::Key_U: 1606 case Qt::Key_U:
1545 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1607 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1546 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1608 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1547 unparentTodo(); 1609 unparentTodo();
1548 e->accept(); 1610 e->accept();
1549 } else 1611 } else
1550 e->ignore(); 1612 e->ignore();
1551 break; 1613 break;
1552 case Qt::Key_S: 1614 case Qt::Key_S:
1553 if ( e->state() == Qt::ControlButton ) { 1615 if ( e->state() == Qt::ControlButton ) {
1554 e->ignore(); 1616 e->ignore();
1555 break; 1617 break;
1556 } 1618 }
1557 if ( e->state() == Qt::ShiftButton ) { 1619 if ( e->state() == Qt::ShiftButton ) {
1558 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1620 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1559 reparentTodo(); 1621 reparentTodo();
1560 e->accept(); 1622 e->accept();
1561 } else 1623 } else
1562 e->ignore(); 1624 e->ignore();
1563 break; 1625 break;
1564 case Qt::Key_P: 1626 case Qt::Key_P:
1565 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1627 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1566 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1628 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1567 if ( pendingSubtodo ) 1629 if ( pendingSubtodo )
1568 itemClicked(mActiveItem); 1630 itemClicked(mActiveItem);
1569 e->accept(); 1631 e->accept();
1570 } else 1632 } else
1571 e->ignore(); 1633 e->ignore();
1572 break; 1634 break;
1573 case Qt::Key_Escape: 1635 case Qt::Key_Escape:
1574 if ( pendingSubtodo ) { 1636 if ( pendingSubtodo ) {
1575 itemClicked(0); 1637 itemClicked(0);
1576 e->accept(); 1638 e->accept();
1577 } else 1639 } else
1578 e->ignore(); 1640 e->ignore();
1579 break; 1641 break;
1580 default: 1642 default:
1581 e->ignore(); 1643 e->ignore();
1582 } 1644 }
1583 1645
1584 if ( true ) { 1646 if ( true ) {
1585 if ( e->key() == Qt::Key_I ) { 1647 if ( e->key() == Qt::Key_I ) {
1586 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); 1648 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem();
1587 if ( cn ) { 1649 if ( cn ) {
1588 mActiveItem = cn; 1650 mActiveItem = cn;
1589 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 1651 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
1590 if ( ci ){ 1652 if ( ci ){
1591 showTodo(); 1653 showTodo();
1592 cn = (KOTodoViewItem*)cn->itemBelow(); 1654 cn = (KOTodoViewItem*)cn->itemBelow();
1593 if ( cn ) { 1655 if ( cn ) {
1594 mTodoListView->setCurrentItem ( cn ); 1656 mTodoListView->setCurrentItem ( cn );
1595 mTodoListView->ensureItemVisible ( cn ); 1657 mTodoListView->ensureItemVisible ( cn );
1596 } 1658 }
1597 1659
1598 } 1660 }
1599 } 1661 }
1600 e->accept(); 1662 e->accept();
1601 1663
1602 } 1664 }
1603 1665
1604 } 1666 }
1605 1667
1606} 1668}
1607void KOTodoView::updateTodo( Todo * t, int type ) 1669void KOTodoView::updateTodo( Todo * t, int type )
1608{ 1670{
1609 if ( mBlockUpdate) 1671 if ( mBlockUpdate)
1610 return; 1672 return;
1611 1673
1612 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 1674 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
1613 itemIterator = mTodoMap.find(t); 1675 itemIterator = mTodoMap.find(t);
1614 if (itemIterator != mTodoMap.end()) { 1676 if (itemIterator != mTodoMap.end()) {
1615 (*itemIterator)->construct(); 1677 (*itemIterator)->construct();
1616 } else { 1678 } else {
1617 if ( type == KOGlobals::EVENTADDED ) { 1679 if ( type == KOGlobals::EVENTADDED ) {
1618 insertTodoItem( t ); 1680 insertTodoItem( t );
1619 } 1681 }
1620 } 1682 }
1621 1683
1622} 1684}
1623 1685
1624void KOTodoView::todoModified(Todo * t , int p ) 1686void KOTodoView::todoModified(Todo * t , int p )
1625{ 1687{
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 79cc756..a8e90e2 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -161,145 +161,148 @@ class KOTodoView : public KOrg::BaseView
161 161
162 DateList selectedDates() 162 DateList selectedDates()
163 {DateList q; 163 {DateList q;
164 return q;} 164 return q;}
165 165
166 /** Return number of shown dates. TodoView does not show dates, */ 166 /** Return number of shown dates. TodoView does not show dates, */
167 int currentDateCount() { return 0; } 167 int currentDateCount() { return 0; }
168 168
169 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 169 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
170 170
171 void setDocumentId( const QString & ); 171 void setDocumentId( const QString & );
172 172
173 void saveLayout(KConfig *config, const QString &group) const; 173 void saveLayout(KConfig *config, const QString &group) const;
174 void restoreLayout(KConfig *config, const QString &group); 174 void restoreLayout(KConfig *config, const QString &group);
175 void setNavigator( DateNavigator* nav ) {mNavigator = nav;} 175 void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
176 QString getWhatsThisText(QPoint p); 176 QString getWhatsThisText(QPoint p);
177 void clearList() {mTodoListView->clear(); } 177 void clearList() {mTodoListView->clear(); }
178 178
179 public slots: 179 public slots:
180 void updateView(); 180 void updateView();
181 void updateConfig(); 181 void updateConfig();
182 182
183 void changeEventDisplay(Event *, int); 183 void changeEventDisplay(Event *, int);
184 184
185 void showDates(const QDate &start, const QDate &end); 185 void showDates(const QDate &start, const QDate &end);
186 void showEvents(QPtrList<Event> eventList); 186 void showEvents(QPtrList<Event> eventList);
187 187
188 void clearSelection(); 188 void clearSelection();
189 void jumpToDate (); 189 void jumpToDate ();
190 190
191 void editItem(QListViewItem *item); 191 void editItem(QListViewItem *item);
192 void showItem(QListViewItem *item,const QPoint &,int); 192 void showItem(QListViewItem *item,const QPoint &,int);
193 void popupMenu(QListViewItem *item,const QPoint &,int); 193 void popupMenu(QListViewItem *item,const QPoint &,int);
194 void newTodo(); 194 void newTodo();
195 void newSubTodo(); 195 void newSubTodo();
196 void unparentTodo(); 196 void unparentTodo();
197 void reparentTodo(); 197 void reparentTodo();
198 void showTodo(); 198 void showTodo();
199 void editTodo(); 199 void editTodo();
200 void cloneTodo(); 200 void cloneTodo();
201 void cancelTodo(); 201 void cancelTodo();
202 void moveTodo(); 202 void moveTodo();
203 void beamTodo(); 203 void beamTodo();
204 void deleteTodo(); 204 void deleteTodo();
205 205
206 void setNewPriority(int); 206 void setNewPriority(int);
207 void setNewPercentage(int); 207 void setNewPercentage(int);
208 void changedCategories(int); 208 void changedCategories(int);
209 209
210 void setAllOpen(); 210 void setAllOpen();
211 void setAllClose(); 211 void setAllClose();
212 void setAllFlat(); 212 void setAllFlat();
213 void displayAllFlat(); 213 void displayAllFlat();
214 214
215 void purgeCompleted(); 215 void purgeCompleted();
216 void toggleCompleted(); 216 void toggleCompleted();
217 void toggleRunning(); 217 void toggleRunning();
218 void toggleQuickTodo(); 218 void toggleQuickTodo();
219 void updateTodo( Todo *, int ); 219 void updateTodo( Todo *, int );
220 220
221 void itemClicked(QListViewItem *); 221 void itemClicked(QListViewItem *);
222 void itemStateChanged(QListViewItem *); 222 void itemStateChanged(QListViewItem *);
223 void modified(bool); 223 void modified(bool);
224 void itemDoubleClicked(QListViewItem *item); 224 void itemDoubleClicked(QListViewItem *item);
225 void resetFocusToList(); 225 void resetFocusToList();
226 void fillCategories (); 226 void fillCategories ();
227 void fillCal (); 227 void fillCal ();
228 void changedCal (int); 228 void changedCal (int);
229 229
230 signals: 230 signals:
231 void newTodoSignal(); 231 void newTodoSignal();
232 void newSubTodoSignal(Todo *); 232 void newSubTodoSignal(Todo *);
233 void unparentTodoSignal(Todo *); 233 void unparentTodoSignal(Todo *);
234 void reparentTodoSignal( Todo *,Todo * ); 234 void reparentTodoSignal( Todo *,Todo * );
235 void showTodoSignal(Todo *); 235 void showTodoSignal(Todo *);
236 236
237 void editTodoSignal(Todo *); 237 void editTodoSignal(Todo *);
238 void deleteTodoSignal(Todo *); 238 void deleteTodoSignal(Todo *);
239 void todoModifiedSignal (Todo *, int); 239 void todoModifiedSignal (Todo *, int);
240 240
241 void isModified(bool); 241 void isModified(bool);
242 void cloneTodoSignal( Incidence * ); 242 void cloneTodoSignal( Incidence * );
243 void cancelTodoSignal( Incidence * ); 243 void cancelTodoSignal( Incidence * );
244 void moveTodoSignal( Incidence * ); 244 void moveTodoSignal( Incidence * );
245 void beamTodoSignal( Incidence * ); 245 void beamTodoSignal( Incidence * );
246 void purgeCompletedSignal(); 246 void purgeCompletedSignal();
247 247
248 protected slots: 248 protected slots:
249 void toggleRunningItem(); 249 void toggleRunningItem();
250 void paintNeeded(); 250 void paintNeeded();
251 void processSelectionChange(); 251 void processSelectionChange();
252 void addQuickTodo(); 252 void addQuickTodo();
253 void setTodoModified( Todo* ); 253 void setTodoModified( Todo* );
254 void todoModified(Todo *, int ); 254 void todoModified(Todo *, int );
255 255
256 private: 256 private:
257 void addQuickTodoPar( Todo * parentTodo);
257 /* 258 /*
258 * the TodoEditor approach is rather unscaling in the long 259 * the TodoEditor approach is rather unscaling in the long
259 * run. 260 * run.
260 * Korganizer keeps it in memory and we need to update 261 * Korganizer keeps it in memory and we need to update
261 * 1. make KOTodoViewItem a QObject again? 262 * 1. make KOTodoViewItem a QObject again?
262 * 2. add a public method for setting one todo modified? 263 * 2. add a public method for setting one todo modified?
263 * 3. add a private method for setting a todo modified + friend here? 264 * 3. add a private method for setting a todo modified + friend here?
264 * -- zecke 2002-07-08 265 * -- zecke 2002-07-08
265 */ 266 */
266 KOTodoViewWhatsThis* mKOTodoViewWhatsThis; 267 KOTodoViewWhatsThis* mKOTodoViewWhatsThis;
267 friend class KOTodoListView; 268 friend class KOTodoListView;
268 void paintEvent(QPaintEvent * pevent); 269 void paintEvent(QPaintEvent * pevent);
269 bool mPendingUpdateBeforeRepaint; 270 bool mPendingUpdateBeforeRepaint;
270 friend class KOTodoViewItem; 271 friend class KOTodoViewItem;
271 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 272 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
272 void restoreItemState( QListViewItem * ); 273 void restoreItemState( QListViewItem * );
273 274
274 bool checkTodo( Todo * ); 275 bool checkTodo( Todo * );
275 bool isFlatDisplay; 276 bool isFlatDisplay;
276 void setOpen( QListViewItem*, bool setOpen); 277 void setOpen( QListViewItem*, bool setOpen);
277 KOTodoListView *mTodoListView; 278 KOTodoListView *mTodoListView;
278 QPopupMenu *mItemPopupMenu; 279 QPopupMenu *mItemPopupMenu;
279 QPopupMenu *mPopupMenu; 280 QPopupMenu *mPopupMenu;
280 QPopupMenu *mPriorityPopupMenu; 281 QPopupMenu *mPriorityPopupMenu;
281 QPopupMenu *mPercentageCompletedPopupMenu; 282 QPopupMenu *mPercentageCompletedPopupMenu;
282 QPopupMenu *mCategoryPopupMenu; 283 QPopupMenu *mCategoryPopupMenu;
283 QPopupMenu *mCalPopupMenu; 284 QPopupMenu *mCalPopupMenu;
284 285
285 QMap<int, int> mPercentage; 286 QMap<int, int> mPercentage;
286 QMap<int, int> mPriority; 287 QMap<int, int> mPriority;
287 QMap<int, QString> mCategory; 288 QMap<int, QString> mCategory;
288 KOTodoViewItem *mActiveItem; 289 KOTodoViewItem *mActiveItem;
289 290
290 QMap<Todo *,KOTodoViewItem *> mTodoMap; 291 QMap<Todo *,KOTodoViewItem *> mTodoMap;
291 QString mName; 292 QString mName;
293 QWidget* mQuickBar;
292 294
293 DocPrefs *mDocPrefs; 295 DocPrefs *mDocPrefs;
294 QString mCurrentDoc; 296 QString mCurrentDoc;
295 KOQuickTodo *mQuickAdd; 297 KOQuickTodo *mQuickAdd;
296 bool mBlockUpdate; 298 bool mBlockUpdate;
297 void keyPressEvent ( QKeyEvent * ) ; 299 void keyPressEvent ( QKeyEvent * ) ;
298 KOTodoViewItem * pendingSubtodo; 300 KOTodoViewItem * pendingSubtodo;
299 DateNavigator* mNavigator; 301 DateNavigator* mNavigator;
300 void storeCurrentItem(); 302 void storeCurrentItem();
301 void resetCurrentItem(); 303 void resetCurrentItem();
302 Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove; 304 Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove;
305 QPushButton * mNewSubBut;
303}; 306};
304 307
305#endif 308#endif