summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-08-06 09:54:42 (UTC)
committer zautrix <zautrix>2005-08-06 09:54:42 (UTC)
commitb841f4f2d54ac531c1f9ec88852d31307b9145f2 (patch) (unidiff)
treec334106e75e73bbc3fc33cd3c0d6480314a42774
parentcd215c243d0636cabbc73006652b9b6783319de1 (diff)
downloadkdepimpi-b841f4f2d54ac531c1f9ec88852d31307b9145f2.zip
kdepimpi-b841f4f2d54ac531c1f9ec88852d31307b9145f2.tar.gz
kdepimpi-b841f4f2d54ac531c1f9ec88852d31307b9145f2.tar.bz2
fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--korganizer/kotodoview.cpp30
-rw-r--r--korganizer/kotodoview.h2
3 files changed, 26 insertions, 10 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index f4b3ddb..201f863 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,102 +1,104 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.1.19 ************ 3********** VERSION 2.1.19 ************
4 4
5Fixed a crash in journal view and a crash in setting a todo to stopped when KO/Pi saved the file when "stop todo" dialog was shown. 5Fixed a crash in journal view.
6Fixed a crash at setting a todo to stopped if KO/Pi saved the file while "stop todo" dialog was shown.
6Fixed a minor problem with the marcus bains line (whatever that is). 7Fixed a minor problem with the marcus bains line (whatever that is).
8Fixed a crash when setting a todo to complete from the show dialog which was called from the What's Next View.
7 9
8********** VERSION 2.1.18 ************ 10********** VERSION 2.1.18 ************
9 11
10Pi-Sync mode: 12Pi-Sync mode:
11The "Write back file" status dialog was updated too often such that writing back the file on the Z was very slow. Fixed. 13The "Write back file" status dialog was updated too often such that writing back the file on the Z was very slow. Fixed.
12 14
13KO/Pi: 15KO/Pi:
14Fixed a layout problem on the Z 5500 with the calender box right of the location box in the event/todo editor. Thanks to Andrew, who found, reported and fixed this problem ( I did not get that problem - it was working on my 5500 ). 16Fixed a layout problem on the Z 5500 with the calender box right of the location box in the event/todo editor. Thanks to Andrew, who found, reported and fixed this problem ( I did not get that problem - it was working on my 5500 ).
15 17
16Fixed a problem when (imported or added from other applications) events or todos did have attachments. 18Fixed a problem when (imported or added from other applications) events or todos did have attachments.
17Fixed a really ugly and hidden problem in the management of the parent/child relationchip of todos. 19Fixed a really ugly and hidden problem in the management of the parent/child relationchip of todos.
18 20
19 21
20********** VERSION 2.1.17 ************ 22********** VERSION 2.1.17 ************
21 23
22KO/Pi: 24KO/Pi:
23Added option to display times in What's Next View on two lines. 25Added option to display times in What's Next View on two lines.
24(Useful for display on the Zaurus with 240x320 screen) 26(Useful for display on the Zaurus with 240x320 screen)
25Removed "Allday" for allday events of one day duration in What's Next View. 27Removed "Allday" for allday events of one day duration in What's Next View.
26Added date range for allday events of more than one day duration in What's Next View. 28Added date range for allday events of more than one day duration in What's Next View.
27Fixed two problems in the data importing from Outlook: 29Fixed two problems in the data importing from Outlook:
28 Fixed the duplicated import if the summary, location or description had whitespaces at the end. 30 Fixed the duplicated import if the summary, location or description had whitespaces at the end.
29 Fixed a problem importing certain recurrence rules. 31 Fixed a problem importing certain recurrence rules.
30 32
31A journal in an ics file may have no dtStart value (as files from KNotes, which stores its notes in an ics journal file). 33A journal in an ics file may have no dtStart value (as files from KNotes, which stores its notes in an ics journal file).
32If now a journal has no dtStart value the dtStart value is set to the created value of the journal when loading the file. That makes it possible to view and edit "notes" from KNotes. Simply add another Resource in KO/Pi which is a copy of the ics file from KNotes. You will find the "notes" in KO/Pi as a journal entry on the date you created it. 34If now a journal has no dtStart value the dtStart value is set to the created value of the journal when loading the file. That makes it possible to view and edit "notes" from KNotes. Simply add another Resource in KO/Pi which is a copy of the ics file from KNotes. You will find the "notes" in KO/Pi as a journal entry on the date you created it.
33 35
34And some minor fixes in KO/Pi. 36And some minor fixes in KO/Pi.
35 37
36Fixed a crash on the desktop when closing KO/Pi after accessing adressbook data (Linux + Windows ). 38Fixed a crash on the desktop when closing KO/Pi after accessing adressbook data (Linux + Windows ).
37 39
38 40
39********** VERSION 2.1.16 ************ 41********** VERSION 2.1.16 ************
40 42
41Fixed a problem with the menu bar in KO/Pi and using the "Menu" hardware key on the Zaurus. 43Fixed a problem with the menu bar in KO/Pi and using the "Menu" hardware key on the Zaurus.
42Added columns for datetime in todo view: Last modified, created and last modified subtodo 44Added columns for datetime in todo view: Last modified, created and last modified subtodo
43Fixed a bug in agenda view displaying recurring multiday events which are longer than two days. 45Fixed a bug in agenda view displaying recurring multiday events which are longer than two days.
44Made conflict detection up to 4 times faster. 46Made conflict detection up to 4 times faster.
45 47
46********** VERSION 2.1.15 ************ 48********** VERSION 2.1.15 ************
47 49
48Fixed two layout problems on the Z: 50Fixed two layout problems on the Z:
49Made the with of the newly added buttons on the Quick-Todo smaller. 51Made the with of the newly added buttons on the Quick-Todo smaller.
50Made listweek layout in 2 columns on the Z760 in portait screen and full menubar visible. 52Made listweek layout in 2 columns on the Z760 in portait screen and full menubar visible.
51 53
52 54
53********** VERSION 2.1.14 ************ 55********** VERSION 2.1.14 ************
54 56
55Added some buttons to the KO/Pi Quick-todo line to make it possible to quickly access some todo view layout settings like display all flat/open/close and hide/show running/done. 57Added some buttons to the KO/Pi Quick-todo line to make it possible to quickly access some todo view layout settings like display all flat/open/close and hide/show running/done.
56Added a button to add a subtodo quickly. 58Added a button to add a subtodo quickly.
57 59
58Added a possibility to search for conflicting events. (In the Action menu. Keyboard shortcut "q", shift+q or ctrl +q ). 60Added a possibility to search for conflicting events. (In the Action menu. Keyboard shortcut "q", shift+q or ctrl +q ).
59Added an option to change the layout of the list week to column mode. 61Added an option to change the layout of the list week to column mode.
60 62
61Fixed some usability problems in pi-sync mode by adding some progress information about file transfer. 63Fixed some usability problems in pi-sync mode by adding some progress information about file transfer.
62 64
63Fixed pi-sync problems with the new multi calendar feature. 65Fixed pi-sync problems with the new multi calendar feature.
64Now pi-sync behaviour should be: 66Now pi-sync behaviour should be:
651) Local sends file request ( as usual ) 671) Local sends file request ( as usual )
662) Remote sends file which contains data of all enabled ( the calendar where the "eye" column is checked ) calendars. 682) Remote sends file which contains data of all enabled ( the calendar where the "eye" column is checked ) calendars.
673) Local syncs with data, adds new entries to default calendar and sends file back ( as usual ). 693) Local syncs with data, adds new entries to default calendar and sends file back ( as usual ).
68 If the data which local receives contains entries which are on disabled calendars on local this entries are updated and not added as duplicates to the default calendar. 70 If the data which local receives contains entries which are on disabled calendars on local this entries are updated and not added as duplicates to the default calendar.
694) Remote updates the data and adds new entries to default calendar. Readonly entries are not changed on remote. 714) Remote updates the data and adds new entries to default calendar. Readonly entries are not changed on remote.
70 If the data which remote receives contains entries which are on disabled calendars on remote this entries are updated and not added as duplicates to the default calendar. 72 If the data which remote receives contains entries which are on disabled calendars on remote this entries are updated and not added as duplicates to the default calendar.
71 73
72Summary: 74Summary:
73No new item ( new created after the last sync ) in a disabled calendar is propagated to the sync partner. Readonly items are synced and added/changed on the sync partner if it is not readonly on the sync partner. 75No new item ( new created after the last sync ) in a disabled calendar is propagated to the sync partner. Readonly items are synced and added/changed on the sync partner if it is not readonly on the sync partner.
74If you have different calendars on remote and local and some of them disabled you may get some "strange" bahaviour. 76If you have different calendars on remote and local and some of them disabled you may get some "strange" bahaviour.
75Well, the syncing has become quite complicated ... you should have no problems if you enable all calendars. 77Well, the syncing has become quite complicated ... you should have no problems if you enable all calendars.
76 78
77********** VERSION 2.1.13 ************ 79********** VERSION 2.1.13 ************
78 80
79Fixed a problem in KA/Pi search. 81Fixed a problem in KA/Pi search.
80Fixed some minor problems in KO/Pi. 82Fixed some minor problems in KO/Pi.
81Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. 83Added calendar selection possibility to the todo view popup and to the event/todo/journal editor.
82 84
83Fixed memory usage problems in KA/Pi: 85Fixed memory usage problems in KA/Pi:
84When loading data KA/Pi did load the file data twice. 86When loading data KA/Pi did load the file data twice.
85Example: 87Example:
86 A 600k file did consume 1200k memory during loading process. 88 A 600k file did consume 1200k memory during loading process.
87 This is fixed, it does now consume only 600k during loading process. 89 This is fixed, it does now consume only 600k during loading process.
88When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. 90When saving data KA/Pi did consume a lot of memory for the data parsing during the save process.
89This is fixed. 91This is fixed.
90Example: 92Example:
91 Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. 93 Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram.
92 When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system. 94 When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system.
93 Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. 95 Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process.
94Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. 96Note: The memory usage of KA/Pi after the data is loaded/saved has not changed.
95The saving of data may be a bit slower now. 97The saving of data may be a bit slower now.
96 98
97Fixed memory usage problems in KO/Pi: 99Fixed memory usage problems in KO/Pi:
98When KO/Pi did save the data to file, it did not release the used buffers after saving. 100When KO/Pi did save the data to file, it did not release the used buffers after saving.
99The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. 101The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation.
100This is fixed. 102This is fixed.
101Example: 103Example:
102 When saving a 400k file KO/Pi do now use 400k less memory now. 104 When saving a 400k file KO/Pi do now use 400k less memory now.
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 00c2d97..27d755e 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -410,192 +410,193 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e )
410 e->ignore(); 410 e->ignore();
411 // qDebug(" ignore %d",e->isAutoRepeat() ); 411 // qDebug(" ignore %d",e->isAutoRepeat() );
412 return; 412 return;
413 } 413 }
414 if (! e->isAutoRepeat() ) 414 if (! e->isAutoRepeat() )
415 mFlagKeyPressed = true; 415 mFlagKeyPressed = true;
416 QListViewItem* cn; 416 QListViewItem* cn;
417 if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") { 417 if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") {
418 cn = currentItem(); 418 cn = currentItem();
419 if ( cn ) { 419 if ( cn ) {
420 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 420 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
421 if ( ci ){ 421 if ( ci ){
422 if ( e->state() == ShiftButton ) 422 if ( e->state() == ShiftButton )
423 ci->setOn( false ); 423 ci->setOn( false );
424 else 424 else
425 ci->setOn( true ); 425 ci->setOn( true );
426 cn = cn->itemBelow(); 426 cn = cn->itemBelow();
427 if ( cn ) { 427 if ( cn ) {
428 setCurrentItem ( cn ); 428 setCurrentItem ( cn );
429 ensureItemVisible ( cn ); 429 ensureItemVisible ( cn );
430 } 430 }
431 431
432 } 432 }
433 } 433 }
434 434
435 e->accept(); 435 e->accept();
436 return; 436 return;
437 } 437 }
438 438
439 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 439 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
440 switch ( e->key() ) { 440 switch ( e->key() ) {
441 case Qt::Key_Down: 441 case Qt::Key_Down:
442 case Qt::Key_Up: 442 case Qt::Key_Up:
443 QListView::keyPressEvent ( e ); 443 QListView::keyPressEvent ( e );
444 e->accept(); 444 e->accept();
445 break; 445 break;
446 case Qt::Key_Left: 446 case Qt::Key_Left:
447 case Qt::Key_Right: 447 case Qt::Key_Right:
448 QListView::keyPressEvent ( e ); 448 QListView::keyPressEvent ( e );
449 e->accept(); 449 e->accept();
450 return; 450 return;
451 break; 451 break;
452 default: 452 default:
453 e->ignore(); 453 e->ignore();
454 break; 454 break;
455 } 455 }
456 return; 456 return;
457 } 457 }
458 e->ignore(); 458 e->ignore();
459} 459}
460void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 460void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
461{ 461{
462 QListView::contentsMouseReleaseEvent(e); 462 QListView::contentsMouseReleaseEvent(e);
463 mMousePressed = false; 463 mMousePressed = false;
464} 464}
465 465
466void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 466void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
467{ 467{
468 if (!e) return; 468 if (!e) return;
469 469
470 QPoint vp = contentsToViewport(e->pos()); 470 QPoint vp = contentsToViewport(e->pos());
471 471
472 QListViewItem *item = itemAt(vp); 472 QListViewItem *item = itemAt(vp);
473 473
474 emit double_Clicked(item); 474 emit double_Clicked(item);
475 if (!item) return; 475 if (!item) return;
476 476
477 emit doubleClicked(item,vp,0); 477 emit doubleClicked(item,vp,0);
478} 478}
479 479
480///////////////////////////////////////////////////////////////////////////// 480/////////////////////////////////////////////////////////////////////////////
481 481
482KOQuickTodo::KOQuickTodo(QWidget *parent) : 482KOQuickTodo::KOQuickTodo(QWidget *parent) :
483 QLineEdit(parent) 483 QLineEdit(parent)
484{ 484{
485 setText(i18n("Click to add new Todo")); 485 setText(i18n("Click to add new Todo"));
486} 486}
487 487
488void KOQuickTodo::focusInEvent(QFocusEvent *ev) 488void KOQuickTodo::focusInEvent(QFocusEvent *ev)
489{ 489{
490 if ( text()==i18n("Click to add new Todo") ) 490 if ( text()==i18n("Click to add new Todo") )
491 setText(""); 491 setText("");
492 QLineEdit::focusInEvent(ev); 492 QLineEdit::focusInEvent(ev);
493} 493}
494 494
495void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 495void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
496{ 496{
497 setText(i18n("Click to add new Todo")); 497 setText(i18n("Click to add new Todo"));
498 QLineEdit::focusOutEvent(ev); 498 QLineEdit::focusOutEvent(ev);
499} 499}
500 500
501///////////////////////////////////////////////////////////////////////////// 501/////////////////////////////////////////////////////////////////////////////
502 502
503KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 503KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
504 KOrg::BaseView(calendar,parent,name) 504 KOrg::BaseView(calendar,parent,name)
505{ 505{
506 mActiveItem = 0;
506 mCategoryPopupMenu = 0; 507 mCategoryPopupMenu = 0;
507 mPendingUpdateBeforeRepaint = false; 508 mPendingUpdateBeforeRepaint = false;
508 isFlatDisplay = false; 509 isFlatDisplay = false;
509 mNavigator = 0; 510 mNavigator = 0;
510 QBoxLayout *topLayout = new QVBoxLayout(this); 511 QBoxLayout *topLayout = new QVBoxLayout(this);
511 mName = QString ( name ); 512 mName = QString ( name );
512 mBlockUpdate = false; 513 mBlockUpdate = false;
513 mQuickBar = new QWidget( this ); 514 mQuickBar = new QWidget( this );
514 topLayout->addWidget(mQuickBar); 515 topLayout->addWidget(mQuickBar);
515 516
516 mQuickAdd = new KOQuickTodo(mQuickBar); 517 mQuickAdd = new KOQuickTodo(mQuickBar);
517 QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); 518 QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar);
518 quickLayout->addWidget( mQuickAdd ); 519 quickLayout->addWidget( mQuickAdd );
519 mNewSubBut = new QPushButton( "sub",mQuickBar ); 520 mNewSubBut = new QPushButton( "sub",mQuickBar );
520 QPushButton * s_done = new QPushButton( "D",mQuickBar ); 521 QPushButton * s_done = new QPushButton( "D",mQuickBar );
521 QPushButton * s_run = new QPushButton( "R",mQuickBar ); 522 QPushButton * s_run = new QPushButton( "R",mQuickBar );
522 QPushButton * allopen = new QPushButton( "O",mQuickBar ); 523 QPushButton * allopen = new QPushButton( "O",mQuickBar );
523 QPushButton * allclose = new QPushButton( "C",mQuickBar ); 524 QPushButton * allclose = new QPushButton( "C",mQuickBar );
524 QPushButton * flat = new QPushButton( "F",mQuickBar ); 525 QPushButton * flat = new QPushButton( "F",mQuickBar );
525 526
526 int fixwid = mQuickAdd->sizeHint().height(); 527 int fixwid = mQuickAdd->sizeHint().height();
527 int fixhei = fixwid; 528 int fixhei = fixwid;
528 if ( QApplication::desktop()->width() > 800 ) 529 if ( QApplication::desktop()->width() > 800 )
529 fixwid = (fixwid*3)/2; 530 fixwid = (fixwid*3)/2;
530 connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); 531 connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat()));
531 connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); 532 connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen()));
532 connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); 533 connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose()));
533 s_done->setPixmap( SmallIcon("greenhook16")); 534 s_done->setPixmap( SmallIcon("greenhook16"));
534 connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); 535 connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted()));
535 s_run->setPixmap( SmallIcon("ko16old")); 536 s_run->setPixmap( SmallIcon("ko16old"));
536 connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); 537 connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning()));
537 538
538 connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); 539 connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo()));
539 540
540 mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() ); 541 mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() );
541 mNewSubBut->setEnabled( false ); 542 mNewSubBut->setEnabled( false );
542 flat->setFixedWidth( fixwid ); 543 flat->setFixedWidth( fixwid );
543 s_done->setFixedWidth( fixwid ); 544 s_done->setFixedWidth( fixwid );
544 allopen->setFixedWidth( fixwid ); 545 allopen->setFixedWidth( fixwid );
545 allclose->setFixedWidth( fixwid ); 546 allclose->setFixedWidth( fixwid );
546 s_run->setFixedWidth( fixwid ); 547 s_run->setFixedWidth( fixwid );
547 548
548 flat->setFixedHeight(fixhei ); 549 flat->setFixedHeight(fixhei );
549 s_done->setFixedHeight(fixhei ); 550 s_done->setFixedHeight(fixhei );
550 allopen->setFixedHeight(fixhei ); 551 allopen->setFixedHeight(fixhei );
551 allclose->setFixedHeight(fixhei ); 552 allclose->setFixedHeight(fixhei );
552 s_run->setFixedHeight(fixhei ); 553 s_run->setFixedHeight(fixhei );
553 mNewSubBut->setFixedHeight(fixhei ); 554 mNewSubBut->setFixedHeight(fixhei );
554 555
555 quickLayout->addWidget( mNewSubBut ); 556 quickLayout->addWidget( mNewSubBut );
556 quickLayout->addWidget( s_done ); 557 quickLayout->addWidget( s_done );
557 quickLayout->addWidget( s_run ); 558 quickLayout->addWidget( s_run );
558 quickLayout->addWidget( allopen ); 559 quickLayout->addWidget( allopen );
559 quickLayout->addWidget( allclose ); 560 quickLayout->addWidget( allclose );
560 quickLayout->addWidget( flat ); 561 quickLayout->addWidget( flat );
561 562
562 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); 563 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide();
563 564
564 mTodoListView = new KOTodoListView(calendar,this, name ); 565 mTodoListView = new KOTodoListView(calendar,this, name );
565 topLayout->addWidget(mTodoListView); 566 topLayout->addWidget(mTodoListView);
566 //mTodoListView->header()->setMaximumHeight(30); 567 //mTodoListView->header()->setMaximumHeight(30);
567 mTodoListView->setRootIsDecorated(true); 568 mTodoListView->setRootIsDecorated(true);
568 mTodoListView->setAllColumnsShowFocus(true); 569 mTodoListView->setAllColumnsShowFocus(true);
569 570
570 mTodoListView->setShowSortIndicator(true); 571 mTodoListView->setShowSortIndicator(true);
571 572
572 mTodoListView->addColumn(i18n("Todo")); 573 mTodoListView->addColumn(i18n("Todo"));
573 mTodoListView->addColumn(i18n("Prio")); 574 mTodoListView->addColumn(i18n("Prio"));
574 mTodoListView->setColumnAlignment(1,AlignHCenter); 575 mTodoListView->setColumnAlignment(1,AlignHCenter);
575 mTodoListView->addColumn(i18n("Complete")); 576 mTodoListView->addColumn(i18n("Complete"));
576 mTodoListView->setColumnAlignment(2,AlignCenter); 577 mTodoListView->setColumnAlignment(2,AlignCenter);
577 578
578 mTodoListView->addColumn(i18n("Due Date")); 579 mTodoListView->addColumn(i18n("Due Date"));
579 mTodoListView->setColumnAlignment(3,AlignLeft); 580 mTodoListView->setColumnAlignment(3,AlignLeft);
580 mTodoListView->addColumn(i18n("Due Time")); 581 mTodoListView->addColumn(i18n("Due Time"));
581 mTodoListView->setColumnAlignment(4,AlignHCenter); 582 mTodoListView->setColumnAlignment(4,AlignHCenter);
582 583
583 mTodoListView->addColumn(i18n("Start Date")); 584 mTodoListView->addColumn(i18n("Start Date"));
584 mTodoListView->setColumnAlignment(5,AlignLeft); 585 mTodoListView->setColumnAlignment(5,AlignLeft);
585 mTodoListView->addColumn(i18n("Start Time")); 586 mTodoListView->addColumn(i18n("Start Time"));
586 mTodoListView->setColumnAlignment(6,AlignHCenter); 587 mTodoListView->setColumnAlignment(6,AlignHCenter);
587 588
588 //mTodoListView->addColumn(i18n("Cancelled")); 589 //mTodoListView->addColumn(i18n("Cancelled"));
589 mTodoListView->addColumn(i18n("Categories")); 590 mTodoListView->addColumn(i18n("Categories"));
590 mTodoListView->addColumn(i18n("Calendar")); 591 mTodoListView->addColumn(i18n("Calendar"));
591 mTodoListView->addColumn(i18n("Last Modified")); 592 mTodoListView->addColumn(i18n("Last Modified"));
592 mTodoListView->addColumn(i18n("Created")); 593 mTodoListView->addColumn(i18n("Created"));
593 mTodoListView->addColumn(i18n("Last Modified Sub")); 594 mTodoListView->addColumn(i18n("Last Modified Sub"));
594#if 0 595#if 0
595 mTodoListView->addColumn(i18n("Sort Id")); 596 mTodoListView->addColumn(i18n("Sort Id"));
596 mTodoListView->setColumnAlignment(4,AlignHCenter); 597 mTodoListView->setColumnAlignment(4,AlignHCenter);
597#endif 598#endif
598 599
599 mTodoListView->setMinimumHeight( 60 ); 600 mTodoListView->setMinimumHeight( 60 );
600 mTodoListView->setItemsRenameable( true ); 601 mTodoListView->setItemsRenameable( true );
601 mTodoListView->setRenameable( 0 ); 602 mTodoListView->setRenameable( 0 );
@@ -714,490 +715,502 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
714 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 715 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
715 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 716 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
716 717
717 718
718 // Double clicking conflicts with opening/closing the subtree 719 // Double clicking conflicts with opening/closing the subtree
719 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 720 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
720 SLOT( editItem( QListViewItem *) ) ); 721 SLOT( editItem( QListViewItem *) ) );
721 /* 722 /*
722 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 723 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
723 const QPoint &,int ) ), 724 const QPoint &,int ) ),
724 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 725 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
725 */ 726 */
726 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 727 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
727 const QPoint &,int ) ), 728 const QPoint &,int ) ),
728 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 729 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
729 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 730 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
730 SLOT( itemClicked( QListViewItem * ) ) ); 731 SLOT( itemClicked( QListViewItem * ) ) );
731 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 732 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
732 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 733 SLOT( itemDoubleClicked( QListViewItem * ) ) );
733 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 734 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
734 SLOT( updateView() ) ); 735 SLOT( updateView() ) );
735 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 736 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
736 SLOT( todoModified(Todo *, int) ) ); 737 SLOT( todoModified(Todo *, int) ) );
737 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 738 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
738 SLOT( itemStateChanged( QListViewItem * ) ) ); 739 SLOT( itemStateChanged( QListViewItem * ) ) );
739 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 740 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
740 SLOT( itemStateChanged( QListViewItem * ) ) ); 741 SLOT( itemStateChanged( QListViewItem * ) ) );
741 connect( mTodoListView, SIGNAL( paintNeeded() ), 742 connect( mTodoListView, SIGNAL( paintNeeded() ),
742 SLOT( paintNeeded()) ); 743 SLOT( paintNeeded()) );
743 744
744#if 0 745#if 0
745 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 746 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
746 SLOT(selectionChanged(QListViewItem *))); 747 SLOT(selectionChanged(QListViewItem *)));
747 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 748 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
748 SLOT(selectionChanged(QListViewItem *))); 749 SLOT(selectionChanged(QListViewItem *)));
749 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 750 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
750 SLOT(selectionChanged(QListViewItem *))); 751 SLOT(selectionChanged(QListViewItem *)));
751#endif 752#endif
752 753
753 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 754 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
754 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 755 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
755 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 756 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
756 757
757 connect( mTodoListView, SIGNAL(selectionChanged() ), 758 connect( mTodoListView, SIGNAL(selectionChanged() ),
758 SLOT( processSelectionChange() ) ); 759 SLOT( processSelectionChange() ) );
759 connect( mQuickAdd, SIGNAL( returnPressed () ), 760 connect( mQuickAdd, SIGNAL( returnPressed () ),
760 SLOT( addQuickTodo() ) ); 761 SLOT( addQuickTodo() ) );
761 762
762} 763}
763 764
764KOTodoView::~KOTodoView() 765KOTodoView::~KOTodoView()
765{ 766{
766 767
767#if QT_VERSION >= 0x030000 768#if QT_VERSION >= 0x030000
768 769
769#else 770#else
770 delete mKOTodoViewWhatsThis; 771 delete mKOTodoViewWhatsThis;
771#endif 772#endif
772 773
773 delete mDocPrefs; 774 delete mDocPrefs;
774} 775}
775QString KOTodoView::getWhatsThisText(QPoint p) 776QString KOTodoView::getWhatsThisText(QPoint p)
776{ 777{
777 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); 778 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
778 if ( item ) 779 if ( item )
779 return KIncidenceFormatter::instance()->getFormattedText( item->todo(), 780 return KIncidenceFormatter::instance()->getFormattedText( item->todo(),
780 KOPrefs::instance()->mWTshowDetails, 781 KOPrefs::instance()->mWTshowDetails,
781 KOPrefs::instance()->mWTshowCreated, 782 KOPrefs::instance()->mWTshowCreated,
782 KOPrefs::instance()->mWTshowChanged); 783 KOPrefs::instance()->mWTshowChanged);
783 return i18n("That is the todo view" ); 784 return i18n("That is the todo view" );
784 785
785} 786}
786 787
787void KOTodoView::jumpToDate () 788void KOTodoView::jumpToDate ()
788{ 789{
789 // if (mActiveItem) { 790 // if (mActiveItem) {
790// mActiveItem->todo()); 791// mActiveItem->todo());
791// if ( mActiveItem->todo()->hasDueDate() ) 792// if ( mActiveItem->todo()->hasDueDate() )
792// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 793// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
793} 794}
794void KOTodoView::paintNeeded() 795void KOTodoView::paintNeeded()
795{ 796{
796 if ( mPendingUpdateBeforeRepaint ) { 797 if ( mPendingUpdateBeforeRepaint ) {
797 updateView(); 798 updateView();
798 mPendingUpdateBeforeRepaint = false; 799 mPendingUpdateBeforeRepaint = false;
799 } 800 }
800} 801}
801void KOTodoView::paintEvent(QPaintEvent * pevent) 802void KOTodoView::paintEvent(QPaintEvent * pevent)
802{ 803{
803 if ( mPendingUpdateBeforeRepaint ) { 804 if ( mPendingUpdateBeforeRepaint ) {
804 updateView(); 805 updateView();
805 mPendingUpdateBeforeRepaint = false; 806 mPendingUpdateBeforeRepaint = false;
806 } 807 }
807 KOrg::BaseView::paintEvent( pevent); 808 KOrg::BaseView::paintEvent( pevent);
808} 809}
809 810
811void KOTodoView::clearList( bool saveCurrentItem ) // default true
812{
813 if ( mTodoListView->childCount() ) {
814 if ( saveCurrentItem )
815 storeCurrentItem();
816 mTodoListView->clear();
817 mTodoMap.clear();
818 }
819}
810void KOTodoView::updateView() 820void KOTodoView::updateView()
811{ 821{
822 mActiveItem = 0;
812 pendingSubtodo = 0; 823 pendingSubtodo = 0;
813 if ( mBlockUpdate ) { 824 if ( mBlockUpdate ) {
814 return; 825 return;
815 } 826 }
816 if ( !isVisible() ) { 827 if ( !isVisible() ) {
828 clearList ();
817 mPendingUpdateBeforeRepaint = true; 829 mPendingUpdateBeforeRepaint = true;
818 return; 830 return;
819 } 831 }
820 //qDebug("KOTodoView::updateView() %x", this); 832 //qDebug("KOTodoView::updateView() %x", this);
821 if ( isFlatDisplay ) { 833 if ( isFlatDisplay ) {
822 displayAllFlat(); 834 displayAllFlat();
823 return; 835 return;
824 } 836 }
825 storeCurrentItem();
826 //qDebug("update "); 837 //qDebug("update ");
827// kdDebug() << "KOTodoView::updateView()" << endl; 838// kdDebug() << "KOTodoView::updateView()" << endl;
828 QFont fo = KOPrefs::instance()->mTodoViewFont; 839 QFont fo = KOPrefs::instance()->mTodoViewFont;
829 840
841 clearList ();
830 842
831 mTodoListView->clear();
832 if ( mName == "todolistsmall" ) { 843 if ( mName == "todolistsmall" ) {
833 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 844 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
834 int ps = fo.pointSize() -2; 845 int ps = fo.pointSize() -2;
835 if ( ps > 12 ) 846 if ( ps > 12 )
836 ps -= 2; 847 ps -= 2;
837 fo.setPointSize( ps ); 848 fo.setPointSize( ps );
838 } 849 }
839 } 850 }
840 851
841 mTodoListView->setFont( fo ); 852 mTodoListView->setFont( fo );
842 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 853 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
843 //mTodoListView->header()->setMaximumHeight(fm.height()); 854 //mTodoListView->header()->setMaximumHeight(fm.height());
844 QPtrList<Todo> todoList = calendar()->todos(); 855 QPtrList<Todo> todoList = calendar()->todos();
845 856
846/* 857/*
847 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 858 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
848 Event *t; 859 Event *t;
849 for(t = todoList.first(); t; t = todoList.next()) { 860 for(t = todoList.first(); t; t = todoList.next()) {
850 kdDebug() << " " << t->getSummary() << endl; 861 kdDebug() << " " << t->getSummary() << endl;
851 862
852 if (t->getRelatedTo()) { 863 if (t->getRelatedTo()) {
853 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 864 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
854 } 865 }
855 866
856 QPtrList<Event> l = t->getRelations(); 867 QPtrList<Event> l = t->getRelations();
857 Event *c; 868 Event *c;
858 for(c=l.first();c;c=l.next()) { 869 for(c=l.first();c;c=l.next()) {
859 kdDebug() << " - relation: " << c->getSummary() << endl; 870 kdDebug() << " - relation: " << c->getSummary() << endl;
860 } 871 }
861 } 872 }
862*/ 873*/
863 874
864 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 875 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
865 // specific order of events. That means that we have to generate parent items 876 // specific order of events. That means that we have to generate parent items
866 // recursively for proper hierarchical display of Todos. 877 // recursively for proper hierarchical display of Todos.
867 mTodoMap.clear();
868 Todo *todo; 878 Todo *todo;
869 todo = todoList.first();// todo; todo = todoList.next()) { 879 todo = todoList.first();// todo; todo = todoList.next()) {
870 while ( todo ) { 880 while ( todo ) {
871 bool next = true; 881 bool next = true;
872 // qDebug("todo %s ", todo->summary().latin1()); 882 // qDebug("todo %s ", todo->summary().latin1());
873 Incidence *incidence = todo->relatedTo(); 883 Incidence *incidence = todo->relatedTo();
874 while ( incidence ) { 884 while ( incidence ) {
875 if ( incidence->typeID() == todoID ) { 885 if ( incidence->typeID() == todoID ) {
876 //qDebug("related %s ",incidence->summary().latin1() ); 886 //qDebug("related %s ",incidence->summary().latin1() );
877 if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) { 887 if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) {
878 //qDebug("related not found "); 888 //qDebug("related not found ");
879 todoList.remove( ); 889 todoList.remove( );
880 todo = todoList.current(); 890 todo = todoList.current();
881 next = false; 891 next = false;
882 incidence = 0; 892 incidence = 0;
883 893
884 } else { 894 } else {
885 //qDebug("related found "); 895 //qDebug("related found ");
886 incidence = incidence->relatedTo(); 896 incidence = incidence->relatedTo();
887 } 897 }
888 } else 898 } else
889 incidence = 0; 899 incidence = 0;
890 } 900 }
891 if ( next ) 901 if ( next )
892 todo = todoList.next(); 902 todo = todoList.next();
893 } 903 }
894 904
895 for(todo = todoList.first(); todo; todo = todoList.next()) { 905 for(todo = todoList.first(); todo; todo = todoList.next()) {
896 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 906 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
897 { 907 {
898 insertTodoItem(todo); 908 insertTodoItem(todo);
899 } 909 }
900 } 910 }
901 // Restore opened/closed state 911 // Restore opened/closed state
902 mTodoListView->blockSignals( true ); 912 mTodoListView->blockSignals( true );
903 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 913 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
904 mTodoListView->blockSignals( false ); 914 mTodoListView->blockSignals( false );
905 resetCurrentItem(); 915 resetCurrentItem();
906} 916}
907 917
908void KOTodoView::storeCurrentItem() 918void KOTodoView::storeCurrentItem()
909{ 919{
910 mCurItem = 0; 920 mCurItem = 0;
911 mCurItemRootParent = 0; 921 mCurItemRootParent = 0;
912 mCurItemParent = 0; 922 mCurItemParent = 0;
913 mCurItemAbove = 0; 923 mCurItemAbove = 0;
914 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 924 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
915 if (mActiveItem) { 925 if (mActiveItem) {
916 mCurItem = mActiveItem->todo(); 926 mCurItem = mActiveItem->todo();
917 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 927 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
918 if ( activeItemAbove ) 928 if ( activeItemAbove )
919 mCurItemAbove = activeItemAbove->todo(); 929 mCurItemAbove = activeItemAbove->todo();
920 mCurItemRootParent = mCurItem; 930 mCurItemRootParent = mCurItem;
921 mCurItemParent = mCurItemRootParent->relatedTo(); 931 mCurItemParent = mCurItemRootParent->relatedTo();
922 while ( mCurItemRootParent->relatedTo() != 0 ) 932 while ( mCurItemRootParent->relatedTo() != 0 )
923 mCurItemRootParent = mCurItemRootParent->relatedTo(); 933 mCurItemRootParent = mCurItemRootParent->relatedTo();
924 } 934 }
925 mActiveItem = 0; 935 mActiveItem = 0;
926} 936}
927 937
928void KOTodoView::resetCurrentItem() 938void KOTodoView::resetCurrentItem()
929{ 939{
930 //mTodoListView->setFocus(); 940 //mTodoListView->setFocus();
931 KOTodoViewItem* foundItem = 0; 941 KOTodoViewItem* foundItem = 0;
932 KOTodoViewItem* foundItemRoot = 0; 942 KOTodoViewItem* foundItemRoot = 0;
933 KOTodoViewItem* foundItemParent = 0; 943 KOTodoViewItem* foundItemParent = 0;
934 KOTodoViewItem* foundItemAbove = 0; 944 KOTodoViewItem* foundItemAbove = 0;
935 if ( mTodoListView->firstChild () ) { 945 if ( mTodoListView->firstChild () ) {
936 if ( mCurItem ) { 946 if ( mCurItem ) {
937 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); 947 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
938 while ( item ) { 948 while ( item ) {
939 if ( item->todo() == mCurItem ) { 949 if ( item->todo() == mCurItem ) {
940 foundItem = item; 950 foundItem = item;
941 break; 951 break;
942 } else if ( item->todo() == mCurItemAbove ) { 952 } else if ( item->todo() == mCurItemAbove ) {
943 foundItemAbove = item; 953 foundItemAbove = item;
944 954
945 } 955 }
946 if ( item->todo() == mCurItemRootParent ) { 956 if ( item->todo() == mCurItemRootParent ) {
947 foundItemRoot = item; 957 foundItemRoot = item;
948 } 958 }
949 if ( item->todo() == mCurItemParent ) { 959 if ( item->todo() == mCurItemParent ) {
950 foundItemParent = item; 960 foundItemParent = item;
951 } 961 }
952 item = (KOTodoViewItem*)item->itemBelow(); 962 item = (KOTodoViewItem*)item->itemBelow();
953 } 963 }
954 if ( ! foundItem ) { 964 if ( ! foundItem ) {
955 if ( foundItemParent ) { 965 if ( foundItemParent ) {
956 foundItem = foundItemParent; 966 foundItem = foundItemParent;
957 } else { 967 } else {
958 if ( foundItemRoot ) 968 if ( foundItemRoot )
959 foundItem = foundItemRoot; 969 foundItem = foundItemRoot;
960 else 970 else
961 foundItem = foundItemAbove; 971 foundItem = foundItemAbove;
962 } 972 }
963 } 973 }
964 } 974 }
965 if ( foundItem ) { 975 if ( foundItem ) {
966 mTodoListView->setSelected ( foundItem, true ); 976 mTodoListView->setSelected ( foundItem, true );
967 mTodoListView->setCurrentItem( foundItem ); 977 mTodoListView->setCurrentItem( foundItem );
968 mTodoListView->ensureItemVisible( foundItem ); 978 mTodoListView->ensureItemVisible( foundItem );
969 } else { 979 } else {
970 if ( mTodoListView->firstChild () ) { 980 if ( mTodoListView->firstChild () ) {
971 mTodoListView->setSelected ( mTodoListView->firstChild (), true ); 981 mTodoListView->setSelected ( mTodoListView->firstChild (), true );
972 mTodoListView->setCurrentItem( mTodoListView->firstChild () ); 982 mTodoListView->setCurrentItem( mTodoListView->firstChild () );
973 } 983 }
974 } 984 }
975 } 985 }
976 processSelectionChange(); 986 processSelectionChange();
987 if ( mName != "todolistsmall" )
977 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); 988 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() ));
978} 989}
979void KOTodoView::resetFocusToList() 990void KOTodoView::resetFocusToList()
980{ 991{
981 topLevelWidget()->setActiveWindow(); 992 topLevelWidget()->setActiveWindow();
982 mTodoListView->setFocus(); 993 mTodoListView->setFocus();
983} 994}
984//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; 995//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
985bool KOTodoView::checkTodo( Todo * todo ) 996bool KOTodoView::checkTodo( Todo * todo )
986{ 997{
987 998
988 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) 999 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
989 return false; 1000 return false;
990 if ( !todo->isCompleted() ) { 1001 if ( !todo->isCompleted() ) {
991 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) 1002 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
992 return true; 1003 return true;
993 } 1004 }
994 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { 1005 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
995 if ( todo->hasStartDate() ) 1006 if ( todo->hasStartDate() )
996 if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) 1007 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
997 return false; 1008 return false;
998 if ( todo->hasDueDate() ) 1009 if ( todo->hasDueDate() )
999 if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) 1010 if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
1000 return false; 1011 return false;
1001 } 1012 }
1002 return true; 1013 return true;
1003} 1014}
1004 1015
1005void KOTodoView::restoreItemState( QListViewItem *item ) 1016void KOTodoView::restoreItemState( QListViewItem *item )
1006{ 1017{
1007 pendingSubtodo = 0; 1018 pendingSubtodo = 0;
1008 while( item ) { 1019 while( item ) {
1009 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1020 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1010 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); 1021 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
1011 if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); 1022 if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
1012 item = item->nextSibling(); 1023 item = item->nextSibling();
1013 } 1024 }
1014} 1025}
1015 1026
1016 1027
1017QMap<Todo *,KOTodoViewItem *>::ConstIterator 1028QMap<Todo *,KOTodoViewItem *>::ConstIterator
1018KOTodoView::insertTodoItem(Todo *todo) 1029KOTodoView::insertTodoItem(Todo *todo)
1019{ 1030{
1020 1031
1021 // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; 1032 // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
1022 // TODO: Check, if dynmaic cast is necessary 1033 // TODO: Check, if dynmaic cast is necessary
1023 1034
1024 pendingSubtodo = 0; 1035 pendingSubtodo = 0;
1025 Incidence *incidence = todo->relatedTo(); 1036 Incidence *incidence = todo->relatedTo();
1026 while ( incidence && !incidence->calEnabled() ) 1037 while ( incidence && !incidence->calEnabled() )
1027 incidence = incidence->relatedTo(); 1038 incidence = incidence->relatedTo();
1028 if (incidence && incidence->typeID() == todoID ) { 1039 if (incidence && incidence->typeID() == todoID ) {
1029 Todo *relatedTodo = static_cast<Todo *>(incidence); 1040 Todo *relatedTodo = static_cast<Todo *>(incidence);
1030 1041
1031 // kdDebug() << " has Related" << endl; 1042 // kdDebug() << " has Related" << endl;
1032 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 1043 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
1033 itemIterator = mTodoMap.find(relatedTodo); 1044 itemIterator = mTodoMap.find(relatedTodo);
1034 if (itemIterator == mTodoMap.end()) { 1045 if (itemIterator == mTodoMap.end()) {
1035 // kdDebug() << " related not yet in list" << endl; 1046 // kdDebug() << " related not yet in list" << endl;
1036 itemIterator = insertTodoItem (relatedTodo); 1047 itemIterator = insertTodoItem (relatedTodo);
1037 } 1048 }
1038 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem 1049 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem
1039 // and one into the map. Sure finding is more easy but why? -zecke 1050 // and one into the map. Sure finding is more easy but why? -zecke
1040 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); 1051 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
1041 return mTodoMap.insert(todo,todoItem); 1052 return mTodoMap.insert(todo,todoItem);
1042 } else { 1053 } else {
1043 // kdDebug() << " no Related" << endl; 1054 // kdDebug() << " no Related" << endl;
1044 // see above -zecke 1055 // see above -zecke
1045 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1056 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1046 return mTodoMap.insert(todo,todoItem); 1057 return mTodoMap.insert(todo,todoItem);
1047 } 1058 }
1048} 1059}
1049 1060
1050 1061
1051void KOTodoView::updateConfig() 1062void KOTodoView::updateConfig()
1052{ 1063{
1053 updateView(); 1064 updateView();
1054 mTodoListView->repaintContents(); 1065 mTodoListView->repaintContents();
1055} 1066}
1056 1067
1057QPtrList<Incidence> KOTodoView::selectedIncidences() 1068QPtrList<Incidence> KOTodoView::selectedIncidences()
1058{ 1069{
1059 QPtrList<Incidence> selected; 1070 QPtrList<Incidence> selected;
1060 1071
1061 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 1072 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
1062// if (!item) item = mActiveItem; 1073// if (!item) item = mActiveItem;
1063 if (item) selected.append(item->todo()); 1074 if (item) selected.append(item->todo());
1064 1075
1065 return selected; 1076 return selected;
1066} 1077}
1067 1078
1068QPtrList<Todo> KOTodoView::selectedTodos() 1079QPtrList<Todo> KOTodoView::selectedTodos()
1069{ 1080{
1070 QPtrList<Todo> selected; 1081 QPtrList<Todo> selected;
1071 1082
1072 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 1083 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
1073// if (!item) item = mActiveItem; 1084// if (!item) item = mActiveItem;
1074 if (item) selected.append(item->todo()); 1085 if (item) selected.append(item->todo());
1075 1086
1076 return selected; 1087 return selected;
1077} 1088}
1078 1089
1079void KOTodoView::changeEventDisplay(Event *, int) 1090void KOTodoView::changeEventDisplay(Event *, int)
1080{ 1091{
1081 updateView(); 1092 updateView();
1082} 1093}
1083 1094
1084void KOTodoView::showDates(const QDate &, const QDate &) 1095void KOTodoView::showDates(const QDate &, const QDate &)
1085{ 1096{
1086} 1097}
1087 1098
1088void KOTodoView::showEvents(QPtrList<Event>) 1099void KOTodoView::showEvents(QPtrList<Event>)
1089{ 1100{
1090 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; 1101 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
1091} 1102}
1092 1103
1093void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1104void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1094 const QDate &td) 1105 const QDate &td)
1095{ 1106{
1096#ifndef KORG_NOPRINTER 1107#ifndef KORG_NOPRINTER
1097 calPrinter->preview(CalPrinter::Todolist, fd, td); 1108 calPrinter->preview(CalPrinter::Todolist, fd, td);
1098#endif 1109#endif
1099} 1110}
1100 1111
1101void KOTodoView::editItem(QListViewItem *item ) 1112void KOTodoView::editItem(QListViewItem *item )
1102{ 1113{
1114 if ( item )
1103 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 1115 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
1104} 1116}
1105 1117
1106void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 1118void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
1107{ 1119{
1120 if ( item )
1108 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 1121 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
1109} 1122}
1110 1123
1111void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) 1124void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
1112{ 1125{
1113 pendingSubtodo = 0; 1126 pendingSubtodo = 0;
1114 mActiveItem = (KOTodoViewItem *)item; 1127 mActiveItem = (KOTodoViewItem *)item;
1115 if (item) { 1128 if (item) {
1116 switch (column){ 1129 switch (column){
1117 case 1: 1130 case 1:
1118 mPriorityPopupMenu->popup(QCursor::pos ()); break; 1131 mPriorityPopupMenu->popup(QCursor::pos ()); break;
1119 case 2: 1132 case 2:
1120 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 1133 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
1121 case 3: 1134 case 3:
1122 moveTodo(); 1135 moveTodo();
1123 break; 1136 break;
1124 case 7: 1137 case 7:
1125 mCategoryPopupMenu->popup(QCursor::pos ()); break; 1138 mCategoryPopupMenu->popup(QCursor::pos ()); break;
1126 case 8: 1139 case 8:
1127 mCalPopupMenu->popup(QCursor::pos ()); break; 1140 mCalPopupMenu->popup(QCursor::pos ()); break;
1128 default: 1141 default:
1129 mItemPopupMenu->popup(QCursor::pos()); 1142 mItemPopupMenu->popup(QCursor::pos());
1130 } 1143 }
1131 } else mPopupMenu->popup(QCursor::pos()); 1144 } else mPopupMenu->popup(QCursor::pos());
1132} 1145}
1133void KOTodoView::newTodo() 1146void KOTodoView::newTodo()
1134{ 1147{
1135 emit newTodoSignal(); 1148 emit newTodoSignal();
1136} 1149}
1137 1150
1138void KOTodoView::newSubTodo() 1151void KOTodoView::newSubTodo()
1139{ 1152{
1140 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1153 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1141 if (mActiveItem) { 1154 if (mActiveItem) {
1142 if ( mQuickAdd->isVisible() && !mQuickAdd->text().isEmpty() && mQuickAdd->text() != i18n("Click to add new Todo") ) { 1155 if ( mQuickAdd->isVisible() && !mQuickAdd->text().isEmpty() && mQuickAdd->text() != i18n("Click to add new Todo") ) {
1143 addQuickTodoPar( mActiveItem->todo()); 1156 addQuickTodoPar( mActiveItem->todo());
1144 } else 1157 } else
1145 emit newSubTodoSignal(mActiveItem->todo()); 1158 emit newSubTodoSignal(mActiveItem->todo());
1146 } 1159 }
1147} 1160}
1148void KOTodoView::unparentTodo() 1161void KOTodoView::unparentTodo()
1149{ 1162{
1150 if (mActiveItem) { 1163 if (mActiveItem) {
1151 emit unparentTodoSignal(mActiveItem->todo()); 1164 emit unparentTodoSignal(mActiveItem->todo());
1152 } 1165 }
1153} 1166}
1154 1167
1155void KOTodoView::reparentTodo() 1168void KOTodoView::reparentTodo()
1156{ 1169{
1157 if (mActiveItem) { 1170 if (mActiveItem) {
1158 topLevelWidget()->setCaption(i18n("Click on new parent item")); 1171 topLevelWidget()->setCaption(i18n("Click on new parent item"));
1159 pendingSubtodo = mActiveItem; 1172 pendingSubtodo = mActiveItem;
1160 } 1173 }
1161} 1174}
1162void KOTodoView::editTodo() 1175void KOTodoView::editTodo()
1163{ 1176{
1164 if (mActiveItem) { 1177 if (mActiveItem) {
1165 emit editTodoSignal(mActiveItem->todo()); 1178 emit editTodoSignal(mActiveItem->todo());
1166 } 1179 }
1167} 1180}
1168void KOTodoView::cloneTodo() 1181void KOTodoView::cloneTodo()
1169{ 1182{
1170 if (mActiveItem) { 1183 if (mActiveItem) {
1171 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 1184 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
1172 } 1185 }
1173} 1186}
1174void KOTodoView::cancelTodo() 1187void KOTodoView::cancelTodo()
1175{ 1188{
1176 if (mActiveItem) { 1189 if (mActiveItem) {
1177 emit cancelTodoSignal((Incidence*)mActiveItem->todo()); 1190 emit cancelTodoSignal((Incidence*)mActiveItem->todo());
1178 } 1191 }
1179} 1192}
1180void KOTodoView::moveTodo() 1193void KOTodoView::moveTodo()
1181{ 1194{
1182 if (mActiveItem) { 1195 if (mActiveItem) {
1183 emit moveTodoSignal((Incidence*)mActiveItem->todo()); 1196 emit moveTodoSignal((Incidence*)mActiveItem->todo());
1184 } 1197 }
1185} 1198}
1186void KOTodoView::beamTodo() 1199void KOTodoView::beamTodo()
1187{ 1200{
1188 if (mActiveItem) { 1201 if (mActiveItem) {
1189 emit beamTodoSignal((Incidence*)mActiveItem->todo()); 1202 emit beamTodoSignal((Incidence*)mActiveItem->todo());
1190 } 1203 }
1191} 1204}
1192 1205
1193 1206
1194void KOTodoView::showTodo() 1207void KOTodoView::showTodo()
1195{ 1208{
1196 if (mActiveItem) { 1209 if (mActiveItem) {
1197 emit showTodoSignal(mActiveItem->todo()); 1210 emit showTodoSignal(mActiveItem->todo());
1198 } 1211 }
1199} 1212}
1200 1213
1201void KOTodoView::deleteTodo() 1214void KOTodoView::deleteTodo()
1202{ 1215{
1203 if (mActiveItem) { 1216 if (mActiveItem) {
@@ -1264,458 +1277,459 @@ void KOTodoView::fillCal ()
1264 while ( kkf ) { 1277 while ( kkf ) {
1265 int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); 1278 int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber);
1266 if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) 1279 if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO )
1267 mCalPopupMenu->setItemEnabled( index, false ); 1280 mCalPopupMenu->setItemEnabled( index, false );
1268 mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); 1281 mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID());
1269 kkf = KOPrefs::instance()->mCalendars.next(); 1282 kkf = KOPrefs::instance()->mCalendars.next();
1270 } 1283 }
1271} 1284}
1272void KOTodoView::changedCal (int index ) 1285void KOTodoView::changedCal (int index )
1273{ 1286{
1274 if (!mActiveItem) return; 1287 if (!mActiveItem) return;
1275 mActiveItem->todo()->setCalID( index ); 1288 mActiveItem->todo()->setCalID( index );
1276 mActiveItem->construct(); 1289 mActiveItem->construct();
1277} 1290}
1278void KOTodoView::changedCategories(int index) 1291void KOTodoView::changedCategories(int index)
1279{ 1292{
1280 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1293 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1281 QStringList categories = mActiveItem->todo()->categories (); 1294 QStringList categories = mActiveItem->todo()->categories ();
1282 QString colcat = categories.first(); 1295 QString colcat = categories.first();
1283 if (categories.find (mCategory[index]) != categories.end ()) 1296 if (categories.find (mCategory[index]) != categories.end ())
1284 categories.remove (mCategory[index]); 1297 categories.remove (mCategory[index]);
1285 else 1298 else
1286 categories.insert (categories.end(), mCategory[index]); 1299 categories.insert (categories.end(), mCategory[index]);
1287 categories.sort (); 1300 categories.sort ();
1288 if ( !colcat.isEmpty() ) { 1301 if ( !colcat.isEmpty() ) {
1289 if ( categories.find ( colcat ) != categories.end () ) { 1302 if ( categories.find ( colcat ) != categories.end () ) {
1290 categories.remove( colcat ); 1303 categories.remove( colcat );
1291 categories.prepend( colcat ); 1304 categories.prepend( colcat );
1292 } 1305 }
1293 } 1306 }
1294 mActiveItem->todo()->setCategories (categories); 1307 mActiveItem->todo()->setCategories (categories);
1295 mActiveItem->construct(); 1308 mActiveItem->construct();
1296 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1309 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1297 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1310 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1298 } 1311 }
1299} 1312}
1300void KOTodoView::itemDoubleClicked(QListViewItem *item) 1313void KOTodoView::itemDoubleClicked(QListViewItem *item)
1301{ 1314{
1302 if ( pendingSubtodo != 0 ) { 1315 if ( pendingSubtodo != 0 ) {
1303 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1316 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1304 } 1317 }
1305 pendingSubtodo = 0; 1318 pendingSubtodo = 0;
1306 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1319 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1307 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1320 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1308 //qDebug("ROW %d ", row); 1321 //qDebug("ROW %d ", row);
1309 if (!item) { 1322 if (!item) {
1310 newTodo(); 1323 newTodo();
1311 return; 1324 return;
1312 } else { 1325 } else {
1313 if ( row == 1 ) { 1326 if ( row == 1 ) {
1314 mActiveItem = (KOTodoViewItem *) item; 1327 mActiveItem = (KOTodoViewItem *) item;
1315 newSubTodo(); 1328 newSubTodo();
1316 return; 1329 return;
1317 } 1330 }
1318 if ( row == 5 || row == 6 || row == 2) { 1331 if ( row == 5 || row == 6 || row == 2) {
1319 mActiveItem = (KOTodoViewItem *) item; 1332 mActiveItem = (KOTodoViewItem *) item;
1320 Todo * t = mActiveItem->todo(); 1333 Todo * t = mActiveItem->todo();
1321 if ( t->isRunning() ) { 1334 if ( t->isRunning() ) {
1322 if ( t->runTime() < 15) { 1335 if ( t->runTime() < 15) {
1323 t->stopRunning(); 1336 t->stopRunning();
1324 mActiveItem->construct(); 1337 mActiveItem->construct();
1325 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); 1338 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!"));
1326 return; 1339 return;
1327 } 1340 }
1328 else 1341 else
1329 toggleRunningItem(); 1342 toggleRunningItem();
1330 return; 1343 return;
1331 } else { 1344 } else {
1332 t->setRunning( true ); 1345 t->setRunning( true );
1333 mActiveItem->construct(); 1346 mActiveItem->construct();
1334 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); 1347 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!"));
1335 return; 1348 return;
1336 } 1349 }
1337 } 1350 }
1338 } 1351 }
1339 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1352 if ( KOPrefs::instance()->mEditOnDoubleClick )
1340 editItem( item ); 1353 editItem( item );
1341 else 1354 else
1342 showItem( item , QPoint(), 0 ); 1355 showItem( item , QPoint(), 0 );
1343} 1356}
1344void KOTodoView::toggleRunningItem() 1357void KOTodoView::toggleRunningItem()
1345{ 1358{
1346 // qDebug("KOTodoView::toggleRunning() "); 1359 // qDebug("KOTodoView::toggleRunning() ");
1347 if ( ! mActiveItem ) 1360 if ( ! mActiveItem )
1348 return; 1361 return;
1349 Todo * t = mActiveItem->todo(); 1362 Todo * t = mActiveItem->todo();
1350 if ( t->isRunning() ) { 1363 if ( t->isRunning() ) {
1351 KOStopTodoPrefs tp ( t, this ); 1364 KOStopTodoPrefs tp ( t, this );
1352 if (QApplication::desktop()->width() <= 800 ){ 1365 if (QApplication::desktop()->width() <= 800 ){
1353 int wid = tp.width(); 1366 int wid = tp.width();
1354 int hei = tp.height(); 1367 int hei = tp.height();
1355 int xx = (QApplication::desktop()->width()-wid)/2; 1368 int xx = (QApplication::desktop()->width()-wid)/2;
1356 int yy = (QApplication::desktop()->height()-hei)/2; 1369 int yy = (QApplication::desktop()->height()-hei)/2;
1357 tp.setGeometry( xx,yy,wid,hei ); 1370 tp.setGeometry( xx,yy,wid,hei );
1358 } 1371 }
1359 tp.exec(); 1372 tp.exec();
1360 updateTodo ( t, 0 ); 1373 updateTodo ( t, KOGlobals::EVENTEDITED );
1361 } else { 1374 } else {
1362 KOStartTodoPrefs tp ( t->summary(), this ); 1375 KOStartTodoPrefs tp ( t->summary(), this );
1363 if (QApplication::desktop()->width() <= 800 ){ 1376 if (QApplication::desktop()->width() <= 800 ){
1364 int wid = tp.width(); 1377 int wid = tp.width();
1365 int hei = tp.height(); 1378 int hei = tp.height();
1366 int xx = (QApplication::desktop()->width()-wid)/2; 1379 int xx = (QApplication::desktop()->width()-wid)/2;
1367 int yy = (QApplication::desktop()->height()-hei)/2; 1380 int yy = (QApplication::desktop()->height()-hei)/2;
1368 tp.setGeometry( xx,yy,wid,hei ); 1381 tp.setGeometry( xx,yy,wid,hei );
1369 } 1382 }
1370 if ( !tp.exec() ) return; 1383 if ( !tp.exec() ) return;
1371 if ( tp.stopAll() ) { 1384 if ( tp.stopAll() ) {
1372 mCalendar->stopAllTodos(); 1385 mCalendar->stopAllTodos();
1373 t->setRunning( true ); 1386 t->setRunning( true );
1374 updateView(); 1387 updateView();
1375 } else { 1388 } else {
1376 t->setRunning( true ); 1389 t->setRunning( true );
1377 updateTodo ( t, 0 ); 1390 updateTodo ( t, KOGlobals::EVENTEDITED );
1378 } 1391 }
1379 } 1392 }
1380} 1393}
1381 1394
1382void KOTodoView::itemClicked(QListViewItem *item) 1395void KOTodoView::itemClicked(QListViewItem *item)
1383{ 1396{
1384 //qDebug("KOTodoView::itemClicked %d", item); 1397 //qDebug("KOTodoView::itemClicked %d", item);
1385 if (!item) { 1398 if (!item) {
1386 if ( pendingSubtodo != 0 ) { 1399 if ( pendingSubtodo != 0 ) {
1387 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1400 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1388 } 1401 }
1389 pendingSubtodo = 0; 1402 pendingSubtodo = 0;
1390 return; 1403 return;
1391 } 1404 }
1392 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1405 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1393 if ( pendingSubtodo != 0 ) { 1406 if ( pendingSubtodo != 0 ) {
1394 bool allowReparent = true; 1407 bool allowReparent = true;
1395 QListViewItem *par = item; 1408 QListViewItem *par = item;
1396 while ( par ) { 1409 while ( par ) {
1397 if ( par == pendingSubtodo ) { 1410 if ( par == pendingSubtodo ) {
1398 allowReparent = false; 1411 allowReparent = false;
1399 break; 1412 break;
1400 } 1413 }
1401 par = par->parent(); 1414 par = par->parent();
1402 } 1415 }
1403 if ( !allowReparent ) { 1416 if ( !allowReparent ) {
1404 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1417 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1405 pendingSubtodo = 0; 1418 pendingSubtodo = 0;
1406 } else { 1419 } else {
1407 Todo* newParent = todoItem->todo(); 1420 Todo* newParent = todoItem->todo();
1408 Todo* newSub = pendingSubtodo->todo(); 1421 Todo* newSub = pendingSubtodo->todo();
1409 pendingSubtodo = 0; 1422 pendingSubtodo = 0;
1410 emit reparentTodoSignal( newParent,newSub ); 1423 emit reparentTodoSignal( newParent,newSub );
1411 return; 1424 return;
1412 } 1425 }
1413 } 1426 }
1414 1427
1415} 1428}
1416 1429
1417void KOTodoView::setDocumentId( const QString &id ) 1430void KOTodoView::setDocumentId( const QString &id )
1418{ 1431{
1419 1432
1420 mDocPrefs->setDoc( id ); 1433 mDocPrefs->setDoc( id );
1421} 1434}
1422 1435
1423void KOTodoView::itemStateChanged( QListViewItem *item ) 1436void KOTodoView::itemStateChanged( QListViewItem *item )
1424{ 1437{
1425 if (!item) return; 1438 if (!item) return;
1426 1439
1427 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1440 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1428 1441
1429// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1442// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1430 1443
1431 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1444 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1432} 1445}
1433 1446
1434void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1447void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1435{ 1448{
1436 mTodoListView->saveLayout(config,group); 1449 mTodoListView->saveLayout(config,group);
1437} 1450}
1438 1451
1439void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1452void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1440{ 1453{
1441 mTodoListView->restoreLayout(config,group); 1454 mTodoListView->restoreLayout(config,group);
1442} 1455}
1443 1456
1444void KOTodoView::processSelectionChange() 1457void KOTodoView::processSelectionChange()
1445{ 1458{
1446// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1459// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1447 1460
1448 KOTodoViewItem *item = 1461 KOTodoViewItem *item =
1449 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1462 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1450 1463
1451 if ( !item ) { 1464 if ( !item ) {
1452 emit incidenceSelected( 0 ); 1465 emit incidenceSelected( 0 );
1453 mNewSubBut->setEnabled( false ); 1466 mNewSubBut->setEnabled( false );
1454 } else { 1467 } else {
1455 emit incidenceSelected( item->todo() ); 1468 emit incidenceSelected( item->todo() );
1456 mNewSubBut->setEnabled( true ); 1469 mNewSubBut->setEnabled( true );
1457 } 1470 }
1458} 1471}
1459 1472
1460void KOTodoView::modified(bool b) 1473void KOTodoView::modified(bool b)
1461{ 1474{
1462 emit isModified(b); 1475 emit isModified(b);
1463} 1476}
1464void KOTodoView::setTodoModified( Todo* todo ) 1477void KOTodoView::setTodoModified( Todo* todo )
1465{ 1478{
1466 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1479 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1467} 1480}
1468void KOTodoView::clearSelection() 1481void KOTodoView::clearSelection()
1469{ 1482{
1470 mTodoListView->selectAll( false ); 1483 mTodoListView->selectAll( false );
1471} 1484}
1472void KOTodoView::setAllOpen() 1485void KOTodoView::setAllOpen()
1473{ 1486{
1474 if ( isFlatDisplay ) { 1487 if ( isFlatDisplay ) {
1475 isFlatDisplay = false; 1488 isFlatDisplay = false;
1476 mPopupMenu->setItemChecked( 8,false ); 1489 mPopupMenu->setItemChecked( 8,false );
1477 updateView(); 1490 updateView();
1478 } else { 1491 } else {
1479 storeCurrentItem(); 1492 storeCurrentItem();
1480 } 1493 }
1481 setOpen(mTodoListView->firstChild(), true); 1494 setOpen(mTodoListView->firstChild(), true);
1482 resetCurrentItem(); 1495 resetCurrentItem();
1483} 1496}
1484void KOTodoView::setAllClose() 1497void KOTodoView::setAllClose()
1485{ 1498{
1486 if ( isFlatDisplay ) { 1499 if ( isFlatDisplay ) {
1487 isFlatDisplay = false; 1500 isFlatDisplay = false;
1488 mPopupMenu->setItemChecked( 8,false ); 1501 mPopupMenu->setItemChecked( 8,false );
1489 updateView(); 1502 updateView();
1490 } else { 1503 } else {
1491 storeCurrentItem(); 1504 storeCurrentItem();
1492 } 1505 }
1493 setOpen(mTodoListView->firstChild(), false); 1506 setOpen(mTodoListView->firstChild(), false);
1494 resetCurrentItem(); 1507 resetCurrentItem();
1495} 1508}
1496void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) 1509void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
1497{ 1510{
1498 1511
1499 while ( item ) { 1512 while ( item ) {
1500 setOpen( item->firstChild(), setOpenI ); 1513 setOpen( item->firstChild(), setOpenI );
1501 item->setOpen( setOpenI ); 1514 item->setOpen( setOpenI );
1502 item = item->nextSibling(); 1515 item = item->nextSibling();
1503 } 1516 }
1504} 1517}
1505 1518
1506void KOTodoView::displayAllFlat() 1519void KOTodoView::displayAllFlat()
1507{ 1520{
1508 storeCurrentItem(); 1521
1522 mActiveItem = 0;
1509 pendingSubtodo = 0; 1523 pendingSubtodo = 0;
1510 if ( mBlockUpdate ) { 1524 if ( mBlockUpdate ) {
1511 return; 1525 return;
1512 } 1526 }
1527 clearList ();
1513 mPopupMenu->setItemChecked( 8,true ); 1528 mPopupMenu->setItemChecked( 8,true );
1514 isFlatDisplay = true; 1529 isFlatDisplay = true;
1515 QPtrList<Todo> todoList = calendar()->todos(); 1530 QPtrList<Todo> todoList = calendar()->todos();
1516 mTodoMap.clear();
1517 mTodoListView->clear();
1518 Todo *todo; 1531 Todo *todo;
1519 for(todo = todoList.first(); todo; todo = todoList.next()) { 1532 for(todo = todoList.first(); todo; todo = todoList.next()) {
1520 if ( checkTodo( todo ) ) { 1533 if ( checkTodo( todo ) ) {
1521 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1534 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1522 mTodoMap.insert(todo,todoItem); 1535 mTodoMap.insert(todo,todoItem);
1523 } 1536 }
1524 } 1537 }
1525 resetCurrentItem(); 1538 resetCurrentItem();
1526} 1539}
1527 1540
1528void KOTodoView::setAllFlat() 1541void KOTodoView::setAllFlat()
1529{ 1542{
1530 if ( isFlatDisplay ) { 1543 if ( isFlatDisplay ) {
1531 isFlatDisplay = false; 1544 isFlatDisplay = false;
1532 mPopupMenu->setItemChecked( 8,false ); 1545 mPopupMenu->setItemChecked( 8,false );
1533 updateView(); 1546 updateView();
1534 return; 1547 return;
1535 } 1548 }
1536 displayAllFlat(); 1549 displayAllFlat();
1537} 1550}
1538 1551
1539void KOTodoView::purgeCompleted() 1552void KOTodoView::purgeCompleted()
1540{ 1553{
1541 emit purgeCompletedSignal(); 1554 emit purgeCompletedSignal();
1542 1555
1543} 1556}
1544void KOTodoView::toggleQuickTodo() 1557void KOTodoView::toggleQuickTodo()
1545{ 1558{
1546 if ( mQuickBar->isVisible() ) { 1559 if ( mQuickBar->isVisible() ) {
1547 mQuickBar->hide(); 1560 mQuickBar->hide();
1548 KOPrefs::instance()->mEnableQuickTodo = false; 1561 KOPrefs::instance()->mEnableQuickTodo = false;
1549 } 1562 }
1550 else { 1563 else {
1551 mQuickBar->show(); 1564 mQuickBar->show();
1552 KOPrefs::instance()->mEnableQuickTodo = true; 1565 KOPrefs::instance()->mEnableQuickTodo = true;
1553 } 1566 }
1554 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 1567 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
1555 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 1568 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
1556} 1569}
1557 1570
1558void KOTodoView::toggleRunning() 1571void KOTodoView::toggleRunning()
1559{ 1572{
1560 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; 1573 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos;
1561 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 1574 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
1562 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 1575 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
1563 updateView(); 1576 updateView();
1564 if ( KOPrefs::instance()->mHideNonStartedTodos ) 1577 if ( KOPrefs::instance()->mHideNonStartedTodos )
1565 topLevelWidget()->setCaption(i18n("Hide not Running")); 1578 topLevelWidget()->setCaption(i18n("Hide not Running"));
1566 else 1579 else
1567 topLevelWidget()->setCaption(i18n("Show not Running")); 1580 topLevelWidget()->setCaption(i18n("Show not Running"));
1568} 1581}
1569 1582
1570void KOTodoView::toggleCompleted() 1583void KOTodoView::toggleCompleted()
1571{ 1584{
1572 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; 1585 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo;
1573 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 1586 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
1574 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 1587 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
1575 updateView(); 1588 updateView();
1576 if ( KOPrefs::instance()->mShowCompletedTodo ) 1589 if ( KOPrefs::instance()->mShowCompletedTodo )
1577 topLevelWidget()->setCaption(i18n("Show Completed")); 1590 topLevelWidget()->setCaption(i18n("Show Completed"));
1578 else 1591 else
1579 topLevelWidget()->setCaption(i18n("Hide Completed")); 1592 topLevelWidget()->setCaption(i18n("Hide Completed"));
1580} 1593}
1581 1594
1582void KOTodoView::addQuickTodo() 1595void KOTodoView::addQuickTodo()
1583{ 1596{
1584 addQuickTodoPar( 0 ); 1597 addQuickTodoPar( 0 );
1585} 1598}
1586void KOTodoView::addQuickTodoPar( Todo * parentTodo) 1599void KOTodoView::addQuickTodoPar( Todo * parentTodo)
1587{ 1600{
1588 Todo *todo = new Todo(); 1601 Todo *todo = new Todo();
1589 todo->setSummary(mQuickAdd->text()); 1602 todo->setSummary(mQuickAdd->text());
1590 todo->setOrganizer(KOPrefs::instance()->email()); 1603 todo->setOrganizer(KOPrefs::instance()->email());
1591 if ( parentTodo ) { 1604 if ( parentTodo ) {
1592 todo->setRelatedTo(parentTodo); 1605 todo->setRelatedTo(parentTodo);
1593 1606
1594 todo->setCategories (parentTodo->categoriesStr ()); 1607 todo->setCategories (parentTodo->categoriesStr ());
1595 todo->setSecrecy (parentTodo->secrecy ()); 1608 todo->setSecrecy (parentTodo->secrecy ());
1596 if ( parentTodo->priority() < 3 ) 1609 if ( parentTodo->priority() < 3 )
1597 todo->setPriority( parentTodo->priority() ); 1610 todo->setPriority( parentTodo->priority() );
1598 todo->setCalID( parentTodo->calID() ); 1611 todo->setCalID( parentTodo->calID() );
1599 } else { 1612 } else {
1600 CalFilter * cf = mCalendar->filter(); 1613 CalFilter * cf = mCalendar->filter();
1601 if ( cf ) { 1614 if ( cf ) {
1602 if ( cf->isEnabled()&& cf->showCategories()) { 1615 if ( cf->isEnabled()&& cf->showCategories()) {
1603 todo->setCategories(cf->categoryList()); 1616 todo->setCategories(cf->categoryList());
1604 } 1617 }
1605 if ( cf->isEnabled() ) 1618 if ( cf->isEnabled() )
1606 todo->setSecrecy( cf->getSecrecy()); 1619 todo->setSecrecy( cf->getSecrecy());
1607 } 1620 }
1608 } 1621 }
1609 mCalendar->addTodo(todo); 1622 mCalendar->addTodo(todo);
1610 mQuickAdd->setText(""); 1623 mQuickAdd->setText("");
1611 todoModified (todo, KOGlobals::EVENTADDED ); 1624 todoModified (todo, KOGlobals::EVENTADDED );
1612 updateView(); 1625 updateView();
1613 1626
1614} 1627}
1615void KOTodoView::keyPressEvent ( QKeyEvent * e ) 1628void KOTodoView::keyPressEvent ( QKeyEvent * e )
1616{ 1629{
1617 // e->ignore(); 1630 // e->ignore();
1618 //return; 1631 //return;
1619 if ( !isVisible() ) { 1632 if ( !isVisible() ) {
1620 e->ignore(); 1633 e->ignore();
1621 return; 1634 return;
1622 } 1635 }
1623 switch ( e->key() ) { 1636 switch ( e->key() ) {
1624 case Qt::Key_Down: 1637 case Qt::Key_Down:
1625 case Qt::Key_Up: 1638 case Qt::Key_Up:
1626 // KOrg::BaseView::keyPressEvent ( e ); 1639 // KOrg::BaseView::keyPressEvent ( e );
1627 e->ignore(); 1640 e->ignore();
1628 break; 1641 break;
1629 1642
1630 case Qt::Key_Q: 1643 case Qt::Key_Q:
1631 1644
1632 1645
1633 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) { 1646 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) {
1634 e->ignore(); 1647 e->ignore();
1635 break; 1648 break;
1636 } 1649 }
1637 toggleQuickTodo(); 1650 toggleQuickTodo();
1638 break; 1651 break;
1639 case Qt::Key_U: 1652 case Qt::Key_U:
1640 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1653 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1641 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1654 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1642 unparentTodo(); 1655 unparentTodo();
1643 e->accept(); 1656 e->accept();
1644 } else 1657 } else
1645 e->ignore(); 1658 e->ignore();
1646 break; 1659 break;
1647 case Qt::Key_S: 1660 case Qt::Key_S:
1648 if ( e->state() == Qt::ControlButton ) { 1661 if ( e->state() == Qt::ControlButton ) {
1649 e->ignore(); 1662 e->ignore();
1650 break; 1663 break;
1651 } 1664 }
1652 if ( e->state() == Qt::ShiftButton ) { 1665 if ( e->state() == Qt::ShiftButton ) {
1653 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1666 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1654 reparentTodo(); 1667 reparentTodo();
1655 e->accept(); 1668 e->accept();
1656 } else 1669 } else
1657 e->ignore(); 1670 e->ignore();
1658 break; 1671 break;
1659 case Qt::Key_P: 1672 case Qt::Key_P:
1660 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1673 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1661 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1674 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1662 if ( pendingSubtodo ) 1675 if ( pendingSubtodo )
1663 itemClicked(mActiveItem); 1676 itemClicked(mActiveItem);
1664 e->accept(); 1677 e->accept();
1665 } else 1678 } else
1666 e->ignore(); 1679 e->ignore();
1667 break; 1680 break;
1668 case Qt::Key_Escape: 1681 case Qt::Key_Escape:
1669 if ( pendingSubtodo ) { 1682 if ( pendingSubtodo ) {
1670 itemClicked(0); 1683 itemClicked(0);
1671 e->accept(); 1684 e->accept();
1672 } else 1685 } else
1673 e->ignore(); 1686 e->ignore();
1674 break; 1687 break;
1675 default: 1688 default:
1676 e->ignore(); 1689 e->ignore();
1677 } 1690 }
1678 1691
1679 if ( true ) { 1692 if ( true ) {
1680 if ( e->key() == Qt::Key_I ) { 1693 if ( e->key() == Qt::Key_I ) {
1681 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); 1694 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem();
1682 if ( cn ) { 1695 if ( cn ) {
1683 mActiveItem = cn; 1696 mActiveItem = cn;
1684 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 1697 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
1685 if ( ci ){ 1698 if ( ci ){
1686 showTodo(); 1699 showTodo();
1687 cn = (KOTodoViewItem*)cn->itemBelow(); 1700 cn = (KOTodoViewItem*)cn->itemBelow();
1688 if ( cn ) { 1701 if ( cn ) {
1689 mTodoListView->setCurrentItem ( cn ); 1702 mTodoListView->setCurrentItem ( cn );
1690 mTodoListView->ensureItemVisible ( cn ); 1703 mTodoListView->ensureItemVisible ( cn );
1691 } 1704 }
1692 1705
1693 } 1706 }
1694 } 1707 }
1695 e->accept(); 1708 e->accept();
1696 } 1709 }
1697 } 1710 }
1698} 1711}
1712
1699void KOTodoView::updateTodo( Todo * t, int type ) 1713void KOTodoView::updateTodo( Todo * t, int type )
1700{ 1714{
1701 if ( mBlockUpdate) 1715 if ( mBlockUpdate)
1702 return; 1716 return;
1703 1717
1704 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 1718 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
1705 itemIterator = mTodoMap.find(t); 1719 itemIterator = mTodoMap.find(t);
1706 if (itemIterator != mTodoMap.end()) { 1720 if (itemIterator != mTodoMap.end()) {
1707 (*itemIterator)->construct(); 1721 (*itemIterator)->construct();
1708 } else { 1722 } else {
1709 if ( type == KOGlobals::EVENTADDED ) { 1723 if ( type == KOGlobals::EVENTADDED ) {
1710 insertTodoItem( t ); 1724 insertTodoItem( t );
1711 } 1725 }
1712 } 1726 }
1713 1727
1714} 1728}
1715 1729
1716void KOTodoView::todoModified(Todo * t , int p ) 1730void KOTodoView::todoModified(Todo * t , int p )
1717{ 1731{
1718 mBlockUpdate = true; 1732 mBlockUpdate = true;
1719 emit todoModifiedSignal ( t, p ); 1733 emit todoModifiedSignal ( t, p );
1720 mBlockUpdate = false; 1734 mBlockUpdate = false;
1721} 1735}
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index a8e90e2..9180015 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -81,193 +81,193 @@ class KOStartTodoPrefs : public QDialog
81 Q_OBJECT 81 Q_OBJECT
82 public: 82 public:
83 KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ; 83 KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ;
84 84
85 bool stopAll() { return mStopAll; } 85 bool stopAll() { return mStopAll; }
86private slots: 86private slots:
87 void doStop(); 87 void doStop();
88private: 88private:
89 bool mStopAll; 89 bool mStopAll;
90 90
91}; 91};
92 92
93class KOTodoListView : public KListView 93class KOTodoListView : public KListView
94{ 94{
95 Q_OBJECT 95 Q_OBJECT
96 public: 96 public:
97 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 97 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
98 virtual ~KOTodoListView() {} 98 virtual ~KOTodoListView() {}
99 99
100 signals: 100 signals:
101 void paintNeeded(); 101 void paintNeeded();
102 void todoDropped(Todo *, int); 102 void todoDropped(Todo *, int);
103 void double_Clicked(QListViewItem *item); 103 void double_Clicked(QListViewItem *item);
104 void reparentTodoSignal( Todo *,Todo * ); 104 void reparentTodoSignal( Todo *,Todo * );
105 void unparentTodoSignal(Todo *); 105 void unparentTodoSignal(Todo *);
106 void deleteTodo( Todo * ); 106 void deleteTodo( Todo * );
107 protected: 107 protected:
108 void wheelEvent (QWheelEvent *e); 108 void wheelEvent (QWheelEvent *e);
109 void contentsDragEnterEvent(QDragEnterEvent *); 109 void contentsDragEnterEvent(QDragEnterEvent *);
110 void contentsDragMoveEvent(QDragMoveEvent *); 110 void contentsDragMoveEvent(QDragMoveEvent *);
111 void contentsDragLeaveEvent(QDragLeaveEvent *); 111 void contentsDragLeaveEvent(QDragLeaveEvent *);
112 void contentsDropEvent(QDropEvent *); 112 void contentsDropEvent(QDropEvent *);
113 113
114 void contentsMousePressEvent(QMouseEvent *); 114 void contentsMousePressEvent(QMouseEvent *);
115 void contentsMouseMoveEvent(QMouseEvent *); 115 void contentsMouseMoveEvent(QMouseEvent *);
116 void contentsMouseReleaseEvent(QMouseEvent *); 116 void contentsMouseReleaseEvent(QMouseEvent *);
117 void contentsMouseDoubleClickEvent(QMouseEvent *); 117 void contentsMouseDoubleClickEvent(QMouseEvent *);
118 118
119 private: 119 private:
120 void paintEvent(QPaintEvent * pevent); 120 void paintEvent(QPaintEvent * pevent);
121 bool internalDrop; 121 bool internalDrop;
122 QString mName; 122 QString mName;
123 Calendar *mCalendar; 123 Calendar *mCalendar;
124 QPoint mPressPos; 124 QPoint mPressPos;
125 bool mMousePressed; 125 bool mMousePressed;
126 QListViewItem *mOldCurrent; 126 QListViewItem *mOldCurrent;
127 bool mFlagKeyPressed; 127 bool mFlagKeyPressed;
128 void keyPressEvent ( QKeyEvent * ) ; 128 void keyPressEvent ( QKeyEvent * ) ;
129 void keyReleaseEvent ( QKeyEvent * ) ; 129 void keyReleaseEvent ( QKeyEvent * ) ;
130}; 130};
131 131
132 132
133/** 133/**
134 This is the line-edit on top of the todoview for fast addition of new todos 134 This is the line-edit on top of the todoview for fast addition of new todos
135*/ 135*/
136class KOQuickTodo : public QLineEdit 136class KOQuickTodo : public QLineEdit
137{ 137{
138 public: 138 public:
139 KOQuickTodo(QWidget *parent=0); 139 KOQuickTodo(QWidget *parent=0);
140 protected: 140 protected:
141 void focusInEvent(QFocusEvent *ev); 141 void focusInEvent(QFocusEvent *ev);
142 void focusOutEvent(QFocusEvent *ev); 142 void focusOutEvent(QFocusEvent *ev);
143}; 143};
144 144
145 145
146/** 146/**
147 This class provides a multi-column list view of todo events. 147 This class provides a multi-column list view of todo events.
148 148
149 @short multi-column list view of todo events. 149 @short multi-column list view of todo events.
150 @author Cornelius Schumacher <schumacher@kde.org> 150 @author Cornelius Schumacher <schumacher@kde.org>
151*/ 151*/
152class KOTodoView : public KOrg::BaseView 152class KOTodoView : public KOrg::BaseView
153{ 153{
154 Q_OBJECT 154 Q_OBJECT
155 public: 155 public:
156 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 156 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
157 ~KOTodoView(); 157 ~KOTodoView();
158 158
159 QPtrList<Incidence> selectedIncidences(); 159 QPtrList<Incidence> selectedIncidences();
160 QPtrList<Todo> selectedTodos(); 160 QPtrList<Todo> selectedTodos();
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( bool saveCurrentItem = true );
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 void addQuickTodoPar( Todo * parentTodo);
258 /* 258 /*
259 * the TodoEditor approach is rather unscaling in the long 259 * the TodoEditor approach is rather unscaling in the long
260 * run. 260 * run.
261 * Korganizer keeps it in memory and we need to update 261 * Korganizer keeps it in memory and we need to update
262 * 1. make KOTodoViewItem a QObject again? 262 * 1. make KOTodoViewItem a QObject again?
263 * 2. add a public method for setting one todo modified? 263 * 2. add a public method for setting one todo modified?
264 * 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?
265 * -- zecke 2002-07-08 265 * -- zecke 2002-07-08
266 */ 266 */
267 KOTodoViewWhatsThis* mKOTodoViewWhatsThis; 267 KOTodoViewWhatsThis* mKOTodoViewWhatsThis;
268 friend class KOTodoListView; 268 friend class KOTodoListView;
269 void paintEvent(QPaintEvent * pevent); 269 void paintEvent(QPaintEvent * pevent);
270 bool mPendingUpdateBeforeRepaint; 270 bool mPendingUpdateBeforeRepaint;
271 friend class KOTodoViewItem; 271 friend class KOTodoViewItem;
272 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 272 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
273 void restoreItemState( QListViewItem * ); 273 void restoreItemState( QListViewItem * );