author | zautrix <zautrix> | 2004-09-20 13:55:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-20 13:55:25 (UTC) |
commit | f222bd1339ac8323e3c99af84a6f83c21cacb8f8 (patch) (unidiff) | |
tree | bb56c3ff65506007eb48cea896d5893f70893261 | |
parent | b01b669d88fa195261d29ecf73b1c69e608a5ebc (diff) | |
download | kdepimpi-f222bd1339ac8323e3c99af84a6f83c21cacb8f8.zip kdepimpi-f222bd1339ac8323e3c99af84a6f83c21cacb8f8.tar.gz kdepimpi-f222bd1339ac8323e3c99af84a6f83c21cacb8f8.tar.bz2 |
Fix todo crash
-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 6 |
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 | |||
@@ -1839,197 +1839,197 @@ void CalendarView::writeFilterSettings(KConfig *config) | |||
1839 | 1839 | ||
1840 | QStringList filterList; | 1840 | QStringList filterList; |
1841 | 1841 | ||
1842 | CalFilter *filter = mFilters.first(); | 1842 | CalFilter *filter = mFilters.first(); |
1843 | while(filter) { | 1843 | while(filter) { |
1844 | // kdDebug() << " fn: " << filter->name() << endl; | 1844 | // kdDebug() << " fn: " << filter->name() << endl; |
1845 | filterList << filter->name(); | 1845 | filterList << filter->name(); |
1846 | config->setGroup("Filter_" + filter->name()); | 1846 | config->setGroup("Filter_" + filter->name()); |
1847 | config->writeEntry("Criteria",filter->criteria()); | 1847 | config->writeEntry("Criteria",filter->criteria()); |
1848 | config->writeEntry("CategoryList",filter->categoryList()); | 1848 | config->writeEntry("CategoryList",filter->categoryList()); |
1849 | filter = mFilters.next(); | 1849 | filter = mFilters.next(); |
1850 | } | 1850 | } |
1851 | config->setGroup("General"); | 1851 | config->setGroup("General"); |
1852 | config->writeEntry("CalendarFilters",filterList); | 1852 | config->writeEntry("CalendarFilters",filterList); |
1853 | 1853 | ||
1854 | config->setGroup("FilterView"); | 1854 | config->setGroup("FilterView"); |
1855 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 1855 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
1856 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 1856 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
1857 | } | 1857 | } |
1858 | 1858 | ||
1859 | 1859 | ||
1860 | void CalendarView::goToday() | 1860 | void CalendarView::goToday() |
1861 | { | 1861 | { |
1862 | mNavigator->selectToday(); | 1862 | mNavigator->selectToday(); |
1863 | } | 1863 | } |
1864 | 1864 | ||
1865 | void CalendarView::goNext() | 1865 | void CalendarView::goNext() |
1866 | { | 1866 | { |
1867 | mNavigator->selectNext(); | 1867 | mNavigator->selectNext(); |
1868 | } | 1868 | } |
1869 | 1869 | ||
1870 | void CalendarView::goPrevious() | 1870 | void CalendarView::goPrevious() |
1871 | { | 1871 | { |
1872 | mNavigator->selectPrevious(); | 1872 | mNavigator->selectPrevious(); |
1873 | } | 1873 | } |
1874 | void CalendarView::goNextMonth() | 1874 | void CalendarView::goNextMonth() |
1875 | { | 1875 | { |
1876 | mNavigator->selectNextMonth(); | 1876 | mNavigator->selectNextMonth(); |
1877 | } | 1877 | } |
1878 | 1878 | ||
1879 | void CalendarView::goPreviousMonth() | 1879 | void CalendarView::goPreviousMonth() |
1880 | { | 1880 | { |
1881 | mNavigator->selectPreviousMonth(); | 1881 | mNavigator->selectPreviousMonth(); |
1882 | } | 1882 | } |
1883 | void CalendarView::writeLocale() | 1883 | void 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 | } |
1898 | void CalendarView::updateConfig() | 1898 | void 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 | ||
1912 | void CalendarView::eventChanged(Event *event) | 1912 | void CalendarView::eventChanged(Event *event) |
1913 | { | 1913 | { |
1914 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 1914 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
1915 | //updateUnmanagedViews(); | 1915 | //updateUnmanagedViews(); |
1916 | } | 1916 | } |
1917 | 1917 | ||
1918 | void CalendarView::eventAdded(Event *event) | 1918 | void CalendarView::eventAdded(Event *event) |
1919 | { | 1919 | { |
1920 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 1920 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
1921 | } | 1921 | } |
1922 | 1922 | ||
1923 | void CalendarView::eventToBeDeleted(Event *) | 1923 | void 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 | ||
1928 | void CalendarView::eventDeleted() | 1928 | void CalendarView::eventDeleted() |
1929 | { | 1929 | { |
1930 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 1930 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
1931 | } | 1931 | } |
1932 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 1932 | void 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 | ||
1945 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 1945 | void 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. |
1960 | void CalendarView::changeEventDisplay(Event *which, int action) | 1960 | void 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 | ||
1980 | void CalendarView::updateTodoViews() | 1980 | void 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 | ||
1989 | void CalendarView::updateView(const QDate &start, const QDate &end) | 1989 | void 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 | ||
1996 | void CalendarView::updateView() | 1996 | void 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 | ||
2004 | void CalendarView::updateUnmanagedViews() | 2004 | void CalendarView::updateUnmanagedViews() |
2005 | { | 2005 | { |
2006 | mDateNavigator->updateDayMatrix(); | 2006 | mDateNavigator->updateDayMatrix(); |
2007 | } | 2007 | } |
2008 | 2008 | ||
2009 | int CalendarView::msgItemDelete() | 2009 | int CalendarView::msgItemDelete() |
2010 | { | 2010 | { |
2011 | return KMessageBox::warningContinueCancel(this, | 2011 | return KMessageBox::warningContinueCancel(this, |
2012 | i18n("This item will be\npermanently deleted."), | 2012 | i18n("This item will be\npermanently deleted."), |
2013 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2013 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2014 | } | 2014 | } |
2015 | 2015 | ||
2016 | 2016 | ||
2017 | void CalendarView::edit_cut() | 2017 | void CalendarView::edit_cut() |
2018 | { | 2018 | { |
2019 | Event *anEvent=0; | 2019 | Event *anEvent=0; |
2020 | 2020 | ||
2021 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2021 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2022 | 2022 | ||
2023 | if (mViewManager->currentView()->isEventView()) { | 2023 | if (mViewManager->currentView()->isEventView()) { |
2024 | if ( incidence && incidence->type() == "Event" ) { | 2024 | if ( incidence && incidence->type() == "Event" ) { |
2025 | anEvent = static_cast<Event *>(incidence); | 2025 | anEvent = static_cast<Event *>(incidence); |
2026 | } | 2026 | } |
2027 | } | 2027 | } |
2028 | 2028 | ||
2029 | if (!anEvent) { | 2029 | if (!anEvent) { |
2030 | KNotifyClient::beep(); | 2030 | KNotifyClient::beep(); |
2031 | return; | 2031 | return; |
2032 | } | 2032 | } |
2033 | DndFactory factory( mCalendar ); | 2033 | DndFactory factory( mCalendar ); |
2034 | factory.cutEvent(anEvent); | 2034 | factory.cutEvent(anEvent); |
2035 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2035 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index d9e0a03..da46eca 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -400,192 +400,198 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
400 | SLOT (moveTodo())); | 400 | SLOT (moveTodo())); |
401 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 401 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
402 | SLOT (beamTodo())); | 402 | SLOT (beamTodo())); |
403 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 403 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
404 | SLOT (cancelTodo())); | 404 | SLOT (cancelTodo())); |
405 | mItemPopupMenu->insertSeparator(); | 405 | mItemPopupMenu->insertSeparator(); |
406 | 406 | ||
407 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 407 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
408 | SLOT (newTodo())); | 408 | SLOT (newTodo())); |
409 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 409 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
410 | SLOT (newSubTodo())); | 410 | SLOT (newSubTodo())); |
411 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 411 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
412 | SLOT (unparentTodo())); | 412 | SLOT (unparentTodo())); |
413 | mItemPopupMenu->insertSeparator(); | 413 | mItemPopupMenu->insertSeparator(); |
414 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 414 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
415 | this, SLOT( purgeCompleted() ) ); | 415 | this, SLOT( purgeCompleted() ) ); |
416 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 416 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
417 | this, SLOT( toggleCompleted() ),0, 33 ); | 417 | this, SLOT( toggleCompleted() ),0, 33 ); |
418 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 418 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
419 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 419 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
420 | 420 | ||
421 | mPopupMenu = new QPopupMenu(this); | 421 | mPopupMenu = new QPopupMenu(this); |
422 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 422 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
423 | SLOT (newTodo()),0,1); | 423 | SLOT (newTodo()),0,1); |
424 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 424 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
425 | this, SLOT(purgeCompleted()),0,2); | 425 | this, SLOT(purgeCompleted()),0,2); |
426 | mPopupMenu->insertItem(i18n("Show Completed"), | 426 | mPopupMenu->insertItem(i18n("Show Completed"), |
427 | this, SLOT( toggleCompleted() ),0,3 ); | 427 | this, SLOT( toggleCompleted() ),0,3 ); |
428 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 428 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
429 | this, SLOT( toggleQuickTodo() ),0,4 ); | 429 | this, SLOT( toggleQuickTodo() ),0,4 ); |
430 | mDocPrefs = new DocPrefs( name ); | 430 | mDocPrefs = new DocPrefs( name ); |
431 | 431 | ||
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 | ||
471 | KOTodoView::~KOTodoView() | 471 | KOTodoView::~KOTodoView() |
472 | { | 472 | { |
473 | delete mDocPrefs; | 473 | delete mDocPrefs; |
474 | } | 474 | } |
475 | 475 | ||
476 | void KOTodoView::jumpToDate () | 476 | void 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 | ||
484 | void KOTodoView::setNarrow() | 484 | void 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 | } |
494 | void KOTodoView::updateView() | 494 | void 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(); |
560 | } | 566 | } |
561 | // qDebug("again .... "); | 567 | // qDebug("again .... "); |
562 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 568 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
563 | 569 | ||
564 | // qDebug("yytodo %s ", todo->summary().latin1()); | 570 | // qDebug("yytodo %s ", todo->summary().latin1()); |
565 | // } | 571 | // } |
566 | //qDebug("for "); | 572 | //qDebug("for "); |
567 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 573 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
568 | if (!mTodoMap.contains(todo) && ( KOPrefs::instance()->mShowCompletedTodo || !todo->isCompleted() ) ) | 574 | if (!mTodoMap.contains(todo) && ( KOPrefs::instance()->mShowCompletedTodo || !todo->isCompleted() ) ) |
569 | { | 575 | { |
570 | insertTodoItem(todo); | 576 | insertTodoItem(todo); |
571 | } | 577 | } |
572 | } | 578 | } |
573 | //qDebug("for end "); | 579 | //qDebug("for end "); |
574 | // Restore opened/closed state | 580 | // Restore opened/closed state |
575 | mTodoListView->blockSignals( true ); | 581 | mTodoListView->blockSignals( true ); |
576 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 582 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
577 | mTodoListView->blockSignals( false ); | 583 | mTodoListView->blockSignals( false ); |
578 | mTodoListView->setFocus(); | 584 | mTodoListView->setFocus(); |
579 | processSelectionChange(); | 585 | processSelectionChange(); |
580 | } | 586 | } |
581 | 587 | ||
582 | void KOTodoView::restoreItemState( QListViewItem *item ) | 588 | void KOTodoView::restoreItemState( QListViewItem *item ) |
583 | { | 589 | { |
584 | while( item ) { | 590 | while( item ) { |
585 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 591 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
586 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 592 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
587 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 593 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
588 | item = item->nextSibling(); | 594 | item = item->nextSibling(); |
589 | } | 595 | } |
590 | } | 596 | } |
591 | 597 | ||