summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-20 13:55:25 (UTC)
committer zautrix <zautrix>2004-09-20 13:55:25 (UTC)
commitf222bd1339ac8323e3c99af84a6f83c21cacb8f8 (patch) (unidiff)
treebb56c3ff65506007eb48cea896d5893f70893261
parentb01b669d88fa195261d29ecf73b1c69e608a5ebc (diff)
downloadkdepimpi-f222bd1339ac8323e3c99af84a6f83c21cacb8f8.zip
kdepimpi-f222bd1339ac8323e3c99af84a6f83c21cacb8f8.tar.gz
kdepimpi-f222bd1339ac8323e3c99af84a6f83c21cacb8f8.tar.bz2
Fix todo crash
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp4
-rw-r--r--korganizer/kotodoview.cpp6
2 files changed, 8 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8e83723..ba0e6c6 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1871,133 +1871,133 @@ void CalendarView::goPrevious()
1871{ 1871{
1872 mNavigator->selectPrevious(); 1872 mNavigator->selectPrevious();
1873} 1873}
1874void CalendarView::goNextMonth() 1874void CalendarView::goNextMonth()
1875{ 1875{
1876 mNavigator->selectNextMonth(); 1876 mNavigator->selectNextMonth();
1877} 1877}
1878 1878
1879void CalendarView::goPreviousMonth() 1879void CalendarView::goPreviousMonth()
1880{ 1880{
1881 mNavigator->selectPreviousMonth(); 1881 mNavigator->selectPreviousMonth();
1882} 1882}
1883void CalendarView::writeLocale() 1883void CalendarView::writeLocale()
1884{ 1884{
1885 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 1885 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
1886 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 1886 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
1887 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 1887 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
1888 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 1888 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
1889 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1889 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1890 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 1890 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
1891 dummy = KOPrefs::instance()->mUserDateFormatShort; 1891 dummy = KOPrefs::instance()->mUserDateFormatShort;
1892 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 1892 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
1893 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 1893 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
1894 KOPrefs::instance()->mDaylightsavingStart, 1894 KOPrefs::instance()->mDaylightsavingStart,
1895 KOPrefs::instance()->mDaylightsavingEnd ); 1895 KOPrefs::instance()->mDaylightsavingEnd );
1896 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); 1896 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId );
1897} 1897}
1898void CalendarView::updateConfig() 1898void CalendarView::updateConfig()
1899{ 1899{
1900 writeLocale(); 1900 writeLocale();
1901 if ( KOPrefs::instance()->mUseAppColors ) 1901 if ( KOPrefs::instance()->mUseAppColors )
1902 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 1902 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
1903 emit configChanged(); 1903 emit configChanged();
1904 mTodoList->updateConfig(); 1904 mTodoList->updateConfig();
1905 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 1905 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
1906 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1906 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1907 // To make the "fill window" configurations work 1907 // To make the "fill window" configurations work
1908 //mViewManager->raiseCurrentView(); 1908 //mViewManager->raiseCurrentView();
1909} 1909}
1910 1910
1911 1911
1912void CalendarView::eventChanged(Event *event) 1912void CalendarView::eventChanged(Event *event)
1913{ 1913{
1914 changeEventDisplay(event,KOGlobals::EVENTEDITED); 1914 changeEventDisplay(event,KOGlobals::EVENTEDITED);
1915 //updateUnmanagedViews(); 1915 //updateUnmanagedViews();
1916} 1916}
1917 1917
1918void CalendarView::eventAdded(Event *event) 1918void CalendarView::eventAdded(Event *event)
1919{ 1919{
1920 changeEventDisplay(event,KOGlobals::EVENTADDED); 1920 changeEventDisplay(event,KOGlobals::EVENTADDED);
1921} 1921}
1922 1922
1923void CalendarView::eventToBeDeleted(Event *) 1923void CalendarView::eventToBeDeleted(Event *)
1924{ 1924{
1925 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 1925 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
1926} 1926}
1927 1927
1928void CalendarView::eventDeleted() 1928void CalendarView::eventDeleted()
1929{ 1929{
1930 changeEventDisplay(0,KOGlobals::EVENTDELETED); 1930 changeEventDisplay(0,KOGlobals::EVENTDELETED);
1931} 1931}
1932void CalendarView::changeTodoDisplay(Todo *which, int action) 1932void CalendarView::changeTodoDisplay(Todo *which, int action)
1933{ 1933{
1934 changeIncidenceDisplay((Incidence *)which, action); 1934 changeIncidenceDisplay((Incidence *)which, action);
1935 mDateNavigator->updateView(); 1935 mDateNavigator->updateView(); //LR
1936 //mDialogManager->updateSearchDialog(); 1936 //mDialogManager->updateSearchDialog();
1937 1937
1938 if (which) { 1938 if (which) {
1939 mViewManager->currentView()->updateView(); 1939 //mViewManager->currentView()->updateView();//LR
1940 //mTodoList->updateView(); 1940 //mTodoList->updateView();
1941 } 1941 }
1942 1942
1943} 1943}
1944 1944
1945void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 1945void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
1946{ 1946{
1947 updateUnmanagedViews(); 1947 updateUnmanagedViews();
1948 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 1948 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
1949 if ( action == KOGlobals::EVENTDELETED ) { //delete 1949 if ( action == KOGlobals::EVENTDELETED ) { //delete
1950 mCalendar->checkAlarmForIncidence( 0, true ); 1950 mCalendar->checkAlarmForIncidence( 0, true );
1951 if ( mEventViewerDialog ) 1951 if ( mEventViewerDialog )
1952 mEventViewerDialog->hide(); 1952 mEventViewerDialog->hide();
1953 } 1953 }
1954 else 1954 else
1955 mCalendar->checkAlarmForIncidence( which , false ); 1955 mCalendar->checkAlarmForIncidence( which , false );
1956} 1956}
1957 1957
1958// most of the changeEventDisplays() right now just call the view's 1958// most of the changeEventDisplays() right now just call the view's
1959// total update mode, but they SHOULD be recoded to be more refresh-efficient. 1959// total update mode, but they SHOULD be recoded to be more refresh-efficient.
1960void CalendarView::changeEventDisplay(Event *which, int action) 1960void CalendarView::changeEventDisplay(Event *which, int action)
1961{ 1961{
1962 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 1962 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
1963 changeIncidenceDisplay((Incidence *)which, action); 1963 changeIncidenceDisplay((Incidence *)which, action);
1964 mDateNavigator->updateView(); 1964 mDateNavigator->updateView();
1965 //mDialogManager->updateSearchDialog(); 1965 //mDialogManager->updateSearchDialog();
1966 1966
1967 if (which) { 1967 if (which) {
1968 // If there is an event view visible update the display 1968 // If there is an event view visible update the display
1969 mViewManager->currentView()->changeEventDisplay(which,action); 1969 mViewManager->currentView()->changeEventDisplay(which,action);
1970 // TODO: check, if update needed 1970 // TODO: check, if update needed
1971 // if (which->getTodoStatus()) { 1971 // if (which->getTodoStatus()) {
1972 mTodoList->updateView(); 1972 mTodoList->updateView();
1973 // } 1973 // }
1974 } else { 1974 } else {
1975 mViewManager->currentView()->updateView(); 1975 mViewManager->currentView()->updateView();
1976 } 1976 }
1977} 1977}
1978 1978
1979 1979
1980void CalendarView::updateTodoViews() 1980void CalendarView::updateTodoViews()
1981{ 1981{
1982 1982
1983 mTodoList->updateView(); 1983 mTodoList->updateView();
1984 mViewManager->currentView()->updateView(); 1984 mViewManager->currentView()->updateView();
1985 1985
1986} 1986}
1987 1987
1988 1988
1989void CalendarView::updateView(const QDate &start, const QDate &end) 1989void CalendarView::updateView(const QDate &start, const QDate &end)
1990{ 1990{
1991 mTodoList->updateView(); 1991 mTodoList->updateView();
1992 mViewManager->updateView(start, end); 1992 mViewManager->updateView(start, end);
1993 //mDateNavigator->updateView(); 1993 //mDateNavigator->updateView();
1994} 1994}
1995 1995
1996void CalendarView::updateView() 1996void CalendarView::updateView()
1997{ 1997{
1998 DateList tmpList = mNavigator->selectedDates(); 1998 DateList tmpList = mNavigator->selectedDates();
1999 1999
2000 // We assume that the navigator only selects consecutive days. 2000 // We assume that the navigator only selects consecutive days.
2001 updateView( tmpList.first(), tmpList.last() ); 2001 updateView( tmpList.first(), tmpList.last() );
2002} 2002}
2003 2003
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index d9e0a03..da46eca 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -432,128 +432,134 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
432 mPopupMenu->setCheckable( true ); 432 mPopupMenu->setCheckable( true );
433 mItemPopupMenu->setCheckable( true ); 433 mItemPopupMenu->setCheckable( true );
434 // Double clicking conflicts with opening/closing the subtree 434 // Double clicking conflicts with opening/closing the subtree
435 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 435 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
436 SLOT( editItem( QListViewItem *) ) ); 436 SLOT( editItem( QListViewItem *) ) );
437 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 437 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
438 const QPoint &,int ) ), 438 const QPoint &,int ) ),
439 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 439 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
440 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 440 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
441 SLOT( itemClicked( QListViewItem * ) ) ); 441 SLOT( itemClicked( QListViewItem * ) ) );
442 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 442 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
443 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 443 SLOT( itemDoubleClicked( QListViewItem * ) ) );
444 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), 444 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ),
445 SLOT( updateView() ) ); 445 SLOT( updateView() ) );
446 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 446 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
447 SLOT( itemStateChanged( QListViewItem * ) ) ); 447 SLOT( itemStateChanged( QListViewItem * ) ) );
448 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 448 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
449 SLOT( itemStateChanged( QListViewItem * ) ) ); 449 SLOT( itemStateChanged( QListViewItem * ) ) );
450 450
451#if 0 451#if 0
452 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 452 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
453 SLOT(selectionChanged(QListViewItem *))); 453 SLOT(selectionChanged(QListViewItem *)));
454 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 454 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
455 SLOT(selectionChanged(QListViewItem *))); 455 SLOT(selectionChanged(QListViewItem *)));
456 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 456 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
457 SLOT(selectionChanged(QListViewItem *))); 457 SLOT(selectionChanged(QListViewItem *)));
458#endif 458#endif
459 connect( mTodoListView, SIGNAL(selectionChanged() ), 459 connect( mTodoListView, SIGNAL(selectionChanged() ),
460 SLOT( processSelectionChange() ) ); 460 SLOT( processSelectionChange() ) );
461 connect( mQuickAdd, SIGNAL( returnPressed () ), 461 connect( mQuickAdd, SIGNAL( returnPressed () ),
462 SLOT( addQuickTodo() ) ); 462 SLOT( addQuickTodo() ) );
463// if ( QApplication::desktop()->width() < 480 ) { 463// if ( QApplication::desktop()->width() < 480 ) {
464// setNarrow(); 464// setNarrow();
465 // mTodoListView->setColumnWidth( 0, 100 ); 465 // mTodoListView->setColumnWidth( 0, 100 );
466 466
467 // } 467 // }
468 468
469} 469}
470 470
471KOTodoView::~KOTodoView() 471KOTodoView::~KOTodoView()
472{ 472{
473 delete mDocPrefs; 473 delete mDocPrefs;
474} 474}
475 475
476void KOTodoView::jumpToDate () 476void KOTodoView::jumpToDate ()
477{ 477{
478 // if (mActiveItem) { 478 // if (mActiveItem) {
479// mActiveItem->todo()); 479// mActiveItem->todo());
480// if ( mActiveItem->todo()->hasDueDate() ) 480// if ( mActiveItem->todo()->hasDueDate() )
481// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 481// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
482} 482}
483 483
484void KOTodoView::setNarrow() 484void KOTodoView::setNarrow()
485{ 485{
486 //mTodoListView->setColumnWidth( 0, 120 ); 486 //mTodoListView->setColumnWidth( 0, 120 );
487 mTodoListView->setColumnWidth( 1, 35 ); 487 mTodoListView->setColumnWidth( 1, 35 );
488 mTodoListView->setColumnWidth( 2, 40 ); 488 mTodoListView->setColumnWidth( 2, 40 );
489 mTodoListView->setColumnWidth( 3, 80 ); 489 mTodoListView->setColumnWidth( 3, 80 );
490 mTodoListView->setColumnWidth( 4, 40 ); 490 mTodoListView->setColumnWidth( 4, 40 );
491 mTodoListView->setColumnWidth( 5, 90 ); 491 mTodoListView->setColumnWidth( 5, 90 );
492 492
493} 493}
494void KOTodoView::updateView() 494void KOTodoView::updateView()
495{ 495{
496
497 if ( mBlockUpdate ) {
498 //qDebug("blocked ");
499 return;
500 }
501 //qDebug("update ");
496// kdDebug() << "KOTodoView::updateView()" << endl; 502// kdDebug() << "KOTodoView::updateView()" << endl;
497 QFont fo = KOPrefs::instance()->mTodoViewFont; 503 QFont fo = KOPrefs::instance()->mTodoViewFont;
498 mTodoListView->clear(); 504 mTodoListView->clear();
499 if ( mName == "todolistsmall" ) { 505 if ( mName == "todolistsmall" ) {
500 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 506 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
501 int ps = fo.pointSize() -2; 507 int ps = fo.pointSize() -2;
502 if ( ps > 12 ) 508 if ( ps > 12 )
503 ps -= 2; 509 ps -= 2;
504 fo.setPointSize( ps ); 510 fo.setPointSize( ps );
505 } 511 }
506 } 512 }
507 513
508 mTodoListView->setFont( fo ); 514 mTodoListView->setFont( fo );
509 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 515 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
510 //mTodoListView->header()->setMaximumHeight(fm.height()); 516 //mTodoListView->header()->setMaximumHeight(fm.height());
511 QPtrList<Todo> todoList = calendar()->todos(); 517 QPtrList<Todo> todoList = calendar()->todos();
512 518
513/* 519/*
514 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 520 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
515 Event *t; 521 Event *t;
516 for(t = todoList.first(); t; t = todoList.next()) { 522 for(t = todoList.first(); t; t = todoList.next()) {
517 kdDebug() << " " << t->getSummary() << endl; 523 kdDebug() << " " << t->getSummary() << endl;
518 524
519 if (t->getRelatedTo()) { 525 if (t->getRelatedTo()) {
520 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 526 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
521 } 527 }
522 528
523 QPtrList<Event> l = t->getRelations(); 529 QPtrList<Event> l = t->getRelations();
524 Event *c; 530 Event *c;
525 for(c=l.first();c;c=l.next()) { 531 for(c=l.first();c;c=l.next()) {
526 kdDebug() << " - relation: " << c->getSummary() << endl; 532 kdDebug() << " - relation: " << c->getSummary() << endl;
527 } 533 }
528 } 534 }
529*/ 535*/
530 536
531 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 537 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
532 // specific order of events. That means that we have to generate parent items 538 // specific order of events. That means that we have to generate parent items
533 // recursively for proper hierarchical display of Todos. 539 // recursively for proper hierarchical display of Todos.
534 mTodoMap.clear(); 540 mTodoMap.clear();
535 Todo *todo; 541 Todo *todo;
536 todo = todoList.first();// todo; todo = todoList.next()) { 542 todo = todoList.first();// todo; todo = todoList.next()) {
537 while ( todo ) { 543 while ( todo ) {
538 bool next = true; 544 bool next = true;
539 // qDebug("todo %s ", todo->summary().latin1()); 545 // qDebug("todo %s ", todo->summary().latin1());
540 Incidence *incidence = todo->relatedTo(); 546 Incidence *incidence = todo->relatedTo();
541 while ( incidence ) { 547 while ( incidence ) {
542 if ( incidence->type() == "Todo") { 548 if ( incidence->type() == "Todo") {
543 //qDebug("related %s ",incidence->summary().latin1() ); 549 //qDebug("related %s ",incidence->summary().latin1() );
544 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 550 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
545 //qDebug("related not found "); 551 //qDebug("related not found ");
546 todoList.remove( ); 552 todoList.remove( );
547 todo = todoList.current(); 553 todo = todoList.current();
548 next = false; 554 next = false;
549 incidence = 0; 555 incidence = 0;
550 556
551 } else { 557 } else {
552 //qDebug("related found "); 558 //qDebug("related found ");
553 incidence = incidence->relatedTo(); 559 incidence = incidence->relatedTo();
554 } 560 }
555 } else 561 } else
556 incidence = 0; 562 incidence = 0;
557 } 563 }
558 if ( next ) 564 if ( next )
559 todo = todoList.next(); 565 todo = todoList.next();