summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-29 17:41:47 (UTC)
committer zautrix <zautrix>2005-01-29 17:41:47 (UTC)
commit078f8bb7d4eca69b799d79ac39d098e1752778a8 (patch) (unidiff)
tree1cc29a057b3954149a5c007c2de4ba1eedde9ecc
parent41baa2e15a1ec5e14750297e0a21020c9e53d953 (diff)
downloadkdepimpi-078f8bb7d4eca69b799d79ac39d098e1752778a8.zip
kdepimpi-078f8bb7d4eca69b799d79ac39d098e1752778a8.tar.gz
kdepimpi-078f8bb7d4eca69b799d79ac39d098e1752778a8.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt7
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/koagenda.cpp2
-rw-r--r--korganizer/kotodoeditor.cpp5
-rw-r--r--korganizer/kotodoview.cpp62
-rw-r--r--korganizer/kotodoview.h7
6 files changed, 80 insertions, 5 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 8572bf9..0538511 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1107,99 +1107,106 @@
1107{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" }, 1107{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" },
1108{ "% completed","% komplett" }, 1108{ "% completed","% komplett" },
1109{ "%d item(s) found.","%d Item(s) gefunden." }, 1109{ "%d item(s) found.","%d Item(s) gefunden." },
1110{ "Set complete","Setze auf erledigt" }, 1110{ "Set complete","Setze auf erledigt" },
1111{ "(cancelled)","(gecancelt)" }, 1111{ "(cancelled)","(gecancelt)" },
1112{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" }, 1112{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" },
1113{ " Local time "," Locale Zeit " }, 1113{ " Local time "," Locale Zeit " },
1114{ "Form2","Form2" }, 1114{ "Form2","Form2" },
1115{ "Filter enabled","Filter angeschaltet" }, 1115{ "Filter enabled","Filter angeschaltet" },
1116{ "Edit Filters","Ändere Filter" }, 1116{ "Edit Filters","Ändere Filter" },
1117{ "Print What's Next View...","Drucke What's Next Ansicht..." }, 1117{ "Print What's Next View...","Drucke What's Next Ansicht..." },
1118{ "Agenda","Agenda" }, 1118{ "Agenda","Agenda" },
1119{ " ("," (" }, 1119{ " ("," (" },
1120{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, 1120{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" },
1121{ "Print","Print" }, 1121{ "Print","Print" },
1122{ "&Setup Printer...","Drucker &Setup..." }, 1122{ "&Setup Printer...","Drucker &Setup..." },
1123{ "View Type","Zeige Typ" }, 1123{ "View Type","Zeige Typ" },
1124{ "Page &orientation:","Seiten Ausrichtung:" }, 1124{ "Page &orientation:","Seiten Ausrichtung:" },
1125{ "Use Default of Selected Style","Default des selektierten Stils" }, 1125{ "Use Default of Selected Style","Default des selektierten Stils" },
1126{ "Use Default Setting of Printer","Default Einstellung des Druckers" }, 1126{ "Use Default Setting of Printer","Default Einstellung des Druckers" },
1127{ "Portrait","Portrait" }, 1127{ "Portrait","Portrait" },
1128{ "Landscape","Landschaft" }, 1128{ "Landscape","Landschaft" },
1129{ "Print day","Drucke Tag" }, 1129{ "Print day","Drucke Tag" },
1130{ "CalPrintDay_Base","CalPrintDay_Base" }, 1130{ "CalPrintDay_Base","CalPrintDay_Base" },
1131{ "Date && Time Range","Datum && Zeitspanne" }, 1131{ "Date && Time Range","Datum && Zeitspanne" },
1132{ "&End date:","&Enddatum:" }, 1132{ "&End date:","&Enddatum:" },
1133{ "&Start date:","&Startdatum:" }, 1133{ "&Start date:","&Startdatum:" },
1134{ "Start &time:","Startzeit:" }, 1134{ "Start &time:","Startzeit:" },
1135{ "End ti&me:","Endzeit:" }, 1135{ "End ti&me:","Endzeit:" },
1136{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, 1136{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" },
1137{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, 1137{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" },
1138{ "Alt+D","Alt+D" }, 1138{ "Alt+D","Alt+D" },
1139{ "&Use colors","Nutze Farben" }, 1139{ "&Use colors","Nutze Farben" },
1140{ "Alt+U","Alt+U" }, 1140{ "Alt+U","Alt+U" },
1141{ "Print week","Drucke Woche" }, 1141{ "Print week","Drucke Woche" },
1142{ "CalPrintWeek_Base","CalPrintWeek_Base" }, 1142{ "CalPrintWeek_Base","CalPrintWeek_Base" },
1143{ "Use &colors","Nutze Farben" }, 1143{ "Use &colors","Nutze Farben" },
1144{ "Type of View","Typ der Ansicht" }, 1144{ "Type of View","Typ der Ansicht" },
1145{ "Print as &Filofax page","Drucke als &Filofax Seite" }, 1145{ "Print as &Filofax page","Drucke als &Filofax Seite" },
1146{ "Alt+F","Alt+F" }, 1146{ "Alt+F","Alt+F" },
1147{ "Print as &timetable view:","Drucke als Zeittabelle:" }, 1147{ "Print as &timetable view:","Drucke als Zeittabelle:" },
1148{ "Alt+T","Alt+T" }, 1148{ "Alt+T","Alt+T" },
1149{ "Print as split week view","Drucke als gesplittete Wochenansicht" }, 1149{ "Print as split week view","Drucke als gesplittete Wochenansicht" },
1150{ "Print month","Drucke Monat" }, 1150{ "Print month","Drucke Monat" },
1151{ "CalPrintMonth_Base","CalPrintMonth_Base" }, 1151{ "CalPrintMonth_Base","CalPrintMonth_Base" },
1152{ "&Start month:","&Startmonat:" }, 1152{ "&Start month:","&Startmonat:" },
1153{ "&End month:","&Endmonat:" }, 1153{ "&End month:","&Endmonat:" },
1154{ "Print week &numbers","Drucke Wochen Nummer(n)" }, 1154{ "Print week &numbers","Drucke Wochen Nummer(n)" },
1155{ "Print todos","Drucke Todos" }, 1155{ "Print todos","Drucke Todos" },
1156{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, 1156{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" },
1157{ "Include &description of the item","Inclusive Itembeschreibung" }, 1157{ "Include &description of the item","Inclusive Itembeschreibung" },
1158{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, 1158{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" },
1159{ "Include &priority of the item","Inclusive Priorität des Items" }, 1159{ "Include &priority of the item","Inclusive Priorität des Items" },
1160{ "Items to Print","Zu druckende Items" }, 1160{ "Items to Print","Zu druckende Items" },
1161{ "&From:","Von:" }, 1161{ "&From:","Von:" },
1162{ "&To:","Bis:" }, 1162{ "&To:","Bis:" },
1163{ "Print &all todo items","Drucke alle Todo Items" }, 1163{ "Print &all todo items","Drucke alle Todo Items" },
1164{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, 1164{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" },
1165{ "Only items due in the &range:","Nur Items in dem Zeitraum:" }, 1165{ "Only items due in the &range:","Nur Items in dem Zeitraum:" },
1166{ "Todo List","Todo Liste" }, 1166{ "Todo List","Todo Liste" },
1167{ "&Title:","&Titel:" }, 1167{ "&Title:","&Titel:" },
1168{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" }, 1168{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" },
1169{ "Todo list","Todo Liste" }, 1169{ "Todo list","Todo Liste" },
1170{ "&Print...","Drucke..." }, 1170{ "&Print...","Drucke..." },
1171{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, 1171{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" },
1172{ "[Unconfigured]","[Unkonfiguriert]" }, 1172{ "[Unconfigured]","[Unkonfiguriert]" },
1173{ "OK","OK" }, 1173{ "OK","OK" },
1174{ "FilterEditor","FilterEditor" }, 1174{ "FilterEditor","FilterEditor" },
1175{ "Include","Inclusive" }, 1175{ "Include","Inclusive" },
1176{ "Exclude","Exclusive" }, 1176{ "Exclude","Exclusive" },
1177{ "Edit Selection...","Editiere Auswahl" }, 1177{ "Edit Selection...","Editiere Auswahl" },
1178{ "recurring events","wiederholende Termine" }, 1178{ "recurring events","wiederholende Termine" },
1179{ "recurr. events","wiederh.Termine" }, 1179{ "recurr. events","wiederh.Termine" },
1180{ "completed to-dos","erledigte Todos" }, 1180{ "completed to-dos","erledigte Todos" },
1181{ "events","Termine" }, 1181{ "events","Termine" },
1182{ "todos","Todos" }, 1182{ "todos","Todos" },
1183{ "journals","Journale" }, 1183{ "journals","Journale" },
1184{ "public","öffentl." }, 1184{ "public","öffentl." },
1185{ "private","privat" }, 1185{ "private","privat" },
1186{ "confidential","vertraul." }, 1186{ "confidential","vertraul." },
1187{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" }, 1187{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" },
1188{ "Yesterday","Gestern" }, 1188{ "Yesterday","Gestern" },
1189{ "Day after tomorrow","Übermorgen" }, 1189{ "Day after tomorrow","Übermorgen" },
1190{ "Tomorrow","Morgen" }, 1190{ "Tomorrow","Morgen" },
1191{ "Day before yesterday","Vorgestern" }, 1191{ "Day before yesterday","Vorgestern" },
1192{ "Size %1","Größe %1" }, 1192{ "Size %1","Größe %1" },
1193{ "New Agendasize: %1","Neue Agendagröße: %1" }, 1193{ "New Agendasize: %1","Neue Agendagröße: %1" },
1194{ " (%1 y.)"," (%1 J.)" }, 1194{ " (%1 y.)"," (%1 J.)" },
1195{ "Allday:","Ganztägig:" }, 1195{ "Allday:","Ganztägig:" },
1196{ "compl.todos","erled.Todos" }, 1196{ "compl.todos","erled.Todos" },
1197{ "Day view","Tagesansicht" }, 1197{ "Day view","Tagesansicht" },
1198{ "Next days","Nächste Tage" }, 1198{ "Next days","Nächste Tage" },
1199{ "Next week","Nächste Woche" }, 1199{ "Next week","Nächste Woche" },
1200{ "Next two weeks","Nächste zwei Wochen" }, 1200{ "Next two weeks","Nächste zwei Wochen" },
1201{ "Next month","Nächster Monat" }, 1201{ "Next month","Nächster Monat" },
1202{ "Journal view","Journal" }, 1202{ "Journal view","Journal" },
1203{ "Display all opened","Zeige alle geöffnet" },
1204{ "Display all closed","Zeige alle geschlossen" },
1205{ "Display all flat","Zeige alle flach" },
1206{ "","" },
1207{ "","" },
1208{ "","" },
1209{ "","" },
1203{ "","" }, 1210{ "","" },
1204{ "","" }, 1211{ "","" },
1205{ "","" }, 1212{ "","" },
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index e7b6755..0c39590 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2623,193 +2623,193 @@ void CalendarView::newEvent()
2623 } 2623 }
2624 } 2624 }
2625 2625
2626 QDate date = mNavigator->selectedDates().first(); 2626 QDate date = mNavigator->selectedDates().first();
2627 QDateTime current = QDateTime::currentDateTime(); 2627 QDateTime current = QDateTime::currentDateTime();
2628 if ( date <= current.date() ) { 2628 if ( date <= current.date() ) {
2629 int hour = current.time().hour() +1; 2629 int hour = current.time().hour() +1;
2630 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2630 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2631 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2631 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2632 } else 2632 } else
2633 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2633 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2634 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2634 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2635 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2635 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2636} 2636}
2637 2637
2638void CalendarView::newEvent(QDateTime fh) 2638void CalendarView::newEvent(QDateTime fh)
2639{ 2639{
2640 newEvent(fh, 2640 newEvent(fh,
2641 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2641 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2642} 2642}
2643 2643
2644void CalendarView::newEvent(QDate dt) 2644void CalendarView::newEvent(QDate dt)
2645{ 2645{
2646 newEvent(QDateTime(dt, QTime(0,0,0)), 2646 newEvent(QDateTime(dt, QTime(0,0,0)),
2647 QDateTime(dt, QTime(0,0,0)), true); 2647 QDateTime(dt, QTime(0,0,0)), true);
2648} 2648}
2649void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) 2649void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint)
2650{ 2650{
2651 newEvent(fromHint, toHint, false); 2651 newEvent(fromHint, toHint, false);
2652} 2652}
2653void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2653void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2654{ 2654{
2655 2655
2656 showEventEditor(); 2656 showEventEditor();
2657 mEventEditor->newEvent(fromHint,toHint,allDay); 2657 mEventEditor->newEvent(fromHint,toHint,allDay);
2658 if ( mFilterView->filtersEnabled() ) { 2658 if ( mFilterView->filtersEnabled() ) {
2659 CalFilter *filter = mFilterView->selectedFilter(); 2659 CalFilter *filter = mFilterView->selectedFilter();
2660 if (filter && filter->showCategories()) { 2660 if (filter && filter->showCategories()) {
2661 mEventEditor->setCategories(filter->categoryList().join(",") ); 2661 mEventEditor->setCategories(filter->categoryList().join(",") );
2662 } 2662 }
2663 if ( filter ) 2663 if ( filter )
2664 mEventEditor->setSecrecy( filter->getSecrecy() ); 2664 mEventEditor->setSecrecy( filter->getSecrecy() );
2665 } 2665 }
2666} 2666}
2667void CalendarView::todoAdded(Todo * t) 2667void CalendarView::todoAdded(Todo * t)
2668{ 2668{
2669 2669
2670 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2670 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2671 updateTodoViews(); 2671 updateTodoViews();
2672} 2672}
2673void CalendarView::todoChanged(Todo * t) 2673void CalendarView::todoChanged(Todo * t)
2674{ 2674{
2675 emit todoModified( t, 4 ); 2675 emit todoModified( t, 4 );
2676 // updateTodoViews(); 2676 // updateTodoViews();
2677} 2677}
2678void CalendarView::todoToBeDeleted(Todo *) 2678void CalendarView::todoToBeDeleted(Todo *)
2679{ 2679{
2680 //qDebug("todoToBeDeleted(Todo *) "); 2680 //qDebug("todoToBeDeleted(Todo *) ");
2681 updateTodoViews(); 2681 updateTodoViews();
2682} 2682}
2683void CalendarView::todoDeleted() 2683void CalendarView::todoDeleted()
2684{ 2684{
2685 //qDebug(" todoDeleted()"); 2685 //qDebug(" todoDeleted()");
2686 updateTodoViews(); 2686 updateTodoViews();
2687} 2687}
2688 2688
2689 2689
2690void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) 2690void CalendarView::newTodoDateTime( QDateTime dt, bool allday )
2691{ 2691{
2692 showTodoEditor(); 2692 showTodoEditor();
2693 mTodoEditor->newTodo(dt,0,allday); 2693 mTodoEditor->newTodo(dt,0,allday);
2694 if ( mFilterView->filtersEnabled() ) { 2694 if ( mFilterView->filtersEnabled() ) {
2695 CalFilter *filter = mFilterView->selectedFilter(); 2695 CalFilter *filter = mFilterView->selectedFilter();
2696 if (filter && filter->showCategories()) { 2696 if (filter && filter->showCategories()) {
2697 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2697 mTodoEditor->setCategories(filter->categoryList().join(",") );
2698 } 2698 }
2699 if ( filter ) 2699 if ( filter )
2700 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2700 mTodoEditor->setSecrecy( filter->getSecrecy() );
2701 } 2701 }
2702} 2702}
2703 2703
2704void CalendarView::newTodo() 2704void CalendarView::newTodo()
2705{ 2705{
2706 newTodoDateTime( QDateTime(),true ); 2706 newTodoDateTime( QDateTime(),true );
2707} 2707}
2708 2708
2709void CalendarView::newSubTodo() 2709void CalendarView::newSubTodo()
2710{ 2710{
2711 Todo *todo = selectedTodo(); 2711 Todo *todo = selectedTodo();
2712 if ( todo ) newSubTodo( todo ); 2712 if ( todo ) newSubTodo( todo );
2713} 2713}
2714 2714
2715void CalendarView::newSubTodo(Todo *parentEvent) 2715void CalendarView::newSubTodo(Todo *parentEvent)
2716{ 2716{
2717 2717
2718 showTodoEditor(); 2718 showTodoEditor();
2719 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); 2719 mTodoEditor->newTodo(QDateTime(),parentEvent,true);
2720} 2720}
2721 2721
2722void CalendarView::newFloatingEvent() 2722void CalendarView::newFloatingEvent()
2723{ 2723{
2724 DateList tmpList = mNavigator->selectedDates(); 2724 DateList tmpList = mNavigator->selectedDates();
2725 QDate date = tmpList.first(); 2725 QDate date = tmpList.first();
2726 2726
2727 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2727 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2728 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2728 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2729} 2729}
2730 2730
2731 2731
2732void CalendarView::editEvent( Event *event ) 2732void CalendarView::editEvent( Event *event )
2733{ 2733{
2734 2734
2735 if ( !event ) return; 2735 if ( !event ) return;
2736 if ( event->isReadOnly() ) { 2736 if ( event->isReadOnly() ) {
2737 showEvent( event ); 2737 showEvent( event );
2738 return; 2738 return;
2739 } 2739 }
2740 showEventEditor(); 2740 showEventEditor();
2741 mEventEditor->editEvent( event , mFlagEditDescription); 2741 mEventEditor->editEvent( event , mFlagEditDescription);
2742} 2742}
2743void CalendarView::editJournal( Journal *jour ) 2743void CalendarView::editJournal( Journal *jour )
2744{ 2744{
2745 if ( !jour ) return; 2745 if ( !jour ) return;
2746 mDialogManager->hideSearchDialog(); 2746 mDialogManager->hideSearchDialog();
2747 mViewManager->showJournalView(); 2747 mViewManager->showJournalView();
2748 mNavigator->slotDaySelect( jour->dtStart().date() ); 2748 mNavigator->slotDaySelect( jour->dtStart().date() );
2749} 2749}
2750void CalendarView::editTodo( Todo *todo ) 2750void CalendarView::editTodo( Todo *todo )
2751{ 2751{
2752 if ( !todo ) return; 2752 if ( !todo ) return;
2753 2753
2754 if ( todo->isReadOnly() ) { 2754 if ( todo->isReadOnly() ) {
2755 showTodo( todo ); 2755 showTodo( todo );
2756 return; 2756 return;
2757 } 2757 }
2758 showTodoEditor(); 2758 showTodoEditor();
2759 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2759 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2760 2760
2761} 2761}
2762 2762
2763KOEventViewerDialog* CalendarView::getEventViewerDialog() 2763KOEventViewerDialog* CalendarView::getEventViewerDialog()
2764{ 2764{
2765 if ( !mEventViewerDialog ) { 2765 if ( !mEventViewerDialog ) {
2766 mEventViewerDialog = new KOEventViewerDialog(this); 2766 mEventViewerDialog = new KOEventViewerDialog(this);
2767 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2767 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2768 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2768 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2769 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2769 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2770 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2770 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2771 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2771 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2772 viewManager(), SLOT( showAgendaView( bool ) ) ); 2772 viewManager(), SLOT( showAgendaView( bool ) ) );
2773 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), 2773 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
2774 this, SLOT( todoChanged(Todo *) ) ); 2774 this, SLOT( todoChanged(Todo *) ) );
2775 mEventViewerDialog->resize( 640, 480 ); 2775 mEventViewerDialog->resize( 640, 480 );
2776 2776
2777 } 2777 }
2778 return mEventViewerDialog; 2778 return mEventViewerDialog;
2779} 2779}
2780void CalendarView::showEvent(Event *event) 2780void CalendarView::showEvent(Event *event)
2781{ 2781{
2782 getEventViewerDialog()->setEvent(event); 2782 getEventViewerDialog()->setEvent(event);
2783 getEventViewerDialog()->showMe(); 2783 getEventViewerDialog()->showMe();
2784} 2784}
2785 2785
2786void CalendarView::showTodo(Todo *event) 2786void CalendarView::showTodo(Todo *event)
2787{ 2787{
2788 getEventViewerDialog()->setTodo(event); 2788 getEventViewerDialog()->setTodo(event);
2789 getEventViewerDialog()->showMe(); 2789 getEventViewerDialog()->showMe();
2790} 2790}
2791void CalendarView::showJournal( Journal *jour ) 2791void CalendarView::showJournal( Journal *jour )
2792{ 2792{
2793 getEventViewerDialog()->setJournal(jour); 2793 getEventViewerDialog()->setJournal(jour);
2794 getEventViewerDialog()->showMe(); 2794 getEventViewerDialog()->showMe();
2795 2795
2796} 2796}
2797// void CalendarView::todoModified (Todo *event, int changed) 2797// void CalendarView::todoModified (Todo *event, int changed)
2798// { 2798// {
2799// // if (mDialogList.find (event) != mDialogList.end ()) { 2799// // if (mDialogList.find (event) != mDialogList.end ()) {
2800// // kdDebug() << "Todo modified and open" << endl; 2800// // kdDebug() << "Todo modified and open" << endl;
2801// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 2801// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
2802// // temp->modified (changed); 2802// // temp->modified (changed);
2803 2803
2804// // } 2804// // }
2805 2805
2806// mViewManager->updateView(); 2806// mViewManager->updateView();
2807// } 2807// }
2808 2808
2809void CalendarView::appointment_show() 2809void CalendarView::appointment_show()
2810{ 2810{
2811 Event *anEvent = 0; 2811 Event *anEvent = 0;
2812 2812
2813 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2813 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2814 2814
2815 if (mViewManager->currentView()->isEventView()) { 2815 if (mViewManager->currentView()->isEventView()) {
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 0eeacb3..002234d 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -345,193 +345,193 @@ void KOAgenda::changeColumns(int columns)
345 kdDebug() << "KOAgenda::changeColumns() called with argument 0" << endl; 345 kdDebug() << "KOAgenda::changeColumns() called with argument 0" << endl;
346 return; 346 return;
347 } 347 }
348 348
349 clear(); 349 clear();
350 350
351 mColumns = columns; 351 mColumns = columns;
352// setMinimumSize(mColumns * 10, mGridSpacingY + 1); 352// setMinimumSize(mColumns * 10, mGridSpacingY + 1);
353// init(); 353// init();
354// update(); 354// update();
355 //qDebug("KOAgenda::changeColumns "); 355 //qDebug("KOAgenda::changeColumns ");
356 computeSizes(); 356 computeSizes();
357 // QResizeEvent event( size(), size() ); 357 // QResizeEvent event( size(), size() );
358 358
359 //QApplication::sendEvent( this, &event ); 359 //QApplication::sendEvent( this, &event );
360} 360}
361 361
362/* 362/*
363 This is the eventFilter function, which gets all events from the KOAgendaItems 363 This is the eventFilter function, which gets all events from the KOAgendaItems
364 contained in the agenda. It has to handle moving and resizing for all items. 364 contained in the agenda. It has to handle moving and resizing for all items.
365*/ 365*/
366bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) 366bool KOAgenda::eventFilter ( QObject *object, QEvent *event )
367{ 367{
368// kdDebug() << "KOAgenda::eventFilter" << endl; 368// kdDebug() << "KOAgenda::eventFilter" << endl;
369 switch(event->type()) { 369 switch(event->type()) {
370 case QEvent::MouseButtonPress: 370 case QEvent::MouseButtonPress:
371 case QEvent::MouseButtonDblClick: 371 case QEvent::MouseButtonDblClick:
372 case QEvent::MouseButtonRelease: 372 case QEvent::MouseButtonRelease:
373 case QEvent::MouseMove: 373 case QEvent::MouseMove:
374 return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); 374 return eventFilter_mouse(object, static_cast<QMouseEvent *>(event));
375 375
376 case (QEvent::Leave): 376 case (QEvent::Leave):
377 if (!mActionItem) 377 if (!mActionItem)
378 setCursor(arrowCursor); 378 setCursor(arrowCursor);
379 return true; 379 return true;
380 380
381 default: 381 default:
382 return QScrollView::eventFilter(object,event); 382 return QScrollView::eventFilter(object,event);
383 } 383 }
384} 384}
385 385
386 386
387bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) 387bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
388{ 388{
389 //qDebug("KOAgenda::eventFilter_mous "); 389 //qDebug("KOAgenda::eventFilter_mous ");
390 QPoint viewportPos; 390 QPoint viewportPos;
391 if (object != viewport()) { 391 if (object != viewport()) {
392 viewportPos = ((QWidget *)object)->mapToParent(me->pos()); 392 viewportPos = ((QWidget *)object)->mapToParent(me->pos());
393 } else { 393 } else {
394 viewportPos = me->pos(); 394 viewportPos = me->pos();
395 } 395 }
396 static int startX = 0; 396 static int startX = 0;
397 static int startY = 0; 397 static int startY = 0;
398 static bool block = true; 398 static bool block = true;
399 switch (me->type()) { 399 switch (me->type()) {
400 case QEvent::MouseButtonPress: 400 case QEvent::MouseButtonPress:
401 //qDebug("QEvent::MouseButtonPress: "); 401 //qDebug("QEvent::MouseButtonPress: ");
402 // kdDebug() << "koagenda: filtered button press" << endl; 402 // kdDebug() << "koagenda: filtered button press" << endl;
403 if (object != viewport()) { 403 if (object != viewport()) {
404 if (me->button() == RightButton) { 404 if (me->button() == RightButton) {
405 405
406 mClickedItem = (KOAgendaItem *)object; 406 mClickedItem = (KOAgendaItem *)object;
407 if (mClickedItem) { 407 if (mClickedItem) {
408 selectItem(mClickedItem); 408 selectItem(mClickedItem);
409 // emit showIncidencePopupSignal(mClickedItem->incidence()); 409 // emit showIncidencePopupSignal(mClickedItem->incidence());
410 } 410 }
411 //mItemPopup->popup(QCursor::pos()); 411 //mItemPopup->popup(QCursor::pos());
412 } else { 412 } else {
413 mActionItem = (KOAgendaItem *)object; 413 mActionItem = (KOAgendaItem *)object;
414 if (mActionItem) { 414 if (mActionItem) {
415 if ( mSelectionHeight > 0 ) { 415 if ( mSelectionHeight > 0 ) {
416 int selectionCellX = mSelectionCellX * mGridSpacingX; 416 int selectionCellX = mSelectionCellX * mGridSpacingX;
417 int selectionYTop = mSelectionYTop; 417 int selectionYTop = mSelectionYTop;
418 int gridSpacingX = mGridSpacingX; 418 int gridSpacingX = mGridSpacingX;
419 int selectionHeight = mSelectionHeight; 419 int selectionHeight = mSelectionHeight;
420 clearSelection(); 420 clearSelection();
421 repaintContents( selectionCellX, selectionYTop, 421 repaintContents( selectionCellX, selectionYTop,
422 gridSpacingX, selectionHeight,false ); 422 gridSpacingX, selectionHeight,false );
423 } 423 }
424 selectItem(mActionItem); 424 selectItem(mActionItem);
425 Incidence *incidence = mActionItem->incidence(); 425 Incidence *incidence = mActionItem->incidence();
426 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { 426 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) {
427 mActionItem = 0; 427 mActionItem = 0;
428 } else { 428 } else {
429 startItemAction(viewportPos); 429 startItemAction(viewportPos);
430 startX = viewportPos.x(); 430 startX = viewportPos.x();
431 startY = viewportPos.y(); 431 startY = viewportPos.y();
432 block = true; 432 block = true;
433 } 433 }
434 } 434 }
435 } 435 }
436 } else { 436 } else {
437 selectItem(0); 437 selectItem(0);
438 mActionItem = 0; 438 mActionItem = 0;
439 if (me->button() == RightButton ) { 439 if (me->button() == RightButton ) {
440 blockNewEvent = true; 440 blockNewEvent = true;
441 qDebug("right "); 441 //qDebug("right ");
442 int x,y; 442 int x,y;
443 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 443 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
444 int gx,gy; 444 int gx,gy;
445 contentsToGrid(x,y,gx,gy); 445 contentsToGrid(x,y,gx,gy);
446 mStartCellX = gx; 446 mStartCellX = gx;
447 mStartCellY = gy; 447 mStartCellY = gy;
448 mCurrentCellX = gx; 448 mCurrentCellX = gx;
449 mCurrentCellY = gy; 449 mCurrentCellY = gy;
450 mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); 450 mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
451 451
452 } else { 452 } else {
453 blockNewEvent = false; 453 blockNewEvent = false;
454 setCursor(arrowCursor); 454 setCursor(arrowCursor);
455 startSelectAction(viewportPos); 455 startSelectAction(viewportPos);
456 } 456 }
457 } 457 }
458 break; 458 break;
459 459
460 case QEvent::MouseButtonRelease: 460 case QEvent::MouseButtonRelease:
461 //qDebug("QEvent::MouseButtonRelease: "); 461 //qDebug("QEvent::MouseButtonRelease: ");
462 if (me->button() == RightButton && block ) { 462 if (me->button() == RightButton && block ) {
463 if (object != viewport()) { 463 if (object != viewport()) {
464 mClickedItem = (KOAgendaItem *)object; 464 mClickedItem = (KOAgendaItem *)object;
465 if (mActionItem ) { 465 if (mActionItem ) {
466 endItemAction(); 466 endItemAction();
467 } 467 }
468 if (mClickedItem) { 468 if (mClickedItem) {
469 selectItem(mClickedItem); 469 selectItem(mClickedItem);
470 emit showIncidencePopupSignal(mClickedItem->incidence()); 470 emit showIncidencePopupSignal(mClickedItem->incidence());
471 } 471 }
472 } 472 }
473 break; 473 break;
474 } 474 }
475 block = true; 475 block = true;
476 if (mActionItem) { 476 if (mActionItem) {
477 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 477 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
478 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); 478 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 );
479 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { 479 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) {
480 mScrollUpTimer.stop(); 480 mScrollUpTimer.stop();
481 mScrollDownTimer.stop(); 481 mScrollDownTimer.stop();
482 mActionItem->resetMove(); 482 mActionItem->resetMove();
483 placeSubCells( mActionItem ); 483 placeSubCells( mActionItem );
484 // emit startDragSignal( mActionItem->incidence() ); 484 // emit startDragSignal( mActionItem->incidence() );
485 setCursor( arrowCursor ); 485 setCursor( arrowCursor );
486 mActionItem = 0; 486 mActionItem = 0;
487 mActionType = NOP; 487 mActionType = NOP;
488 mItemMoved = 0; 488 mItemMoved = 0;
489 return true; 489 return true;
490 } 490 }
491 endItemAction(); 491 endItemAction();
492 } else if ( mActionType == SELECT ) { 492 } else if ( mActionType == SELECT ) {
493 if (me->button() == RightButton ) { 493 if (me->button() == RightButton ) {
494 494
495 } else { 495 } else {
496 endSelectAction( !blockNewEvent ); 496 endSelectAction( !blockNewEvent );
497 } 497 }
498 } 498 }
499 break; 499 break;
500 500
501 case QEvent::MouseMove: 501 case QEvent::MouseMove:
502 if (object != viewport()) { 502 if (object != viewport()) {
503 KOAgendaItem *moveItem = (KOAgendaItem *)object; 503 KOAgendaItem *moveItem = (KOAgendaItem *)object;
504 //qDebug("moveItem %d ",moveItem ); 504 //qDebug("moveItem %d ",moveItem );
505 if (!moveItem->incidence()->isReadOnly() /*&& 505 if (!moveItem->incidence()->isReadOnly() /*&&
506 !moveItem->incidence()->recurrence()->doesRecur()*/ ) 506 !moveItem->incidence()->recurrence()->doesRecur()*/ )
507 if (!mActionItem) 507 if (!mActionItem)
508 setNoActionCursor(moveItem,viewportPos); 508 setNoActionCursor(moveItem,viewportPos);
509 else { 509 else {
510 if ( block ) { 510 if ( block ) {
511 int dX, dY; 511 int dX, dY;
512 dX = startX - viewportPos.x(); 512 dX = startX - viewportPos.x();
513 if ( dX < 0 ) 513 if ( dX < 0 )
514 dX = -dX; 514 dX = -dX;
515 dY = viewportPos.y() - startY; 515 dY = viewportPos.y() - startY;
516 if ( dY < 0 ) 516 if ( dY < 0 )
517 dY = -dY; 517 dY = -dY;
518 int diff = 30; 518 int diff = 30;
519 if ( QApplication::desktop()->width() < 480 ) 519 if ( QApplication::desktop()->width() < 480 )
520 diff = 15; 520 diff = 15;
521 // qDebug(" %d %d ",dX, dY ); 521 // qDebug(" %d %d ",dX, dY );
522 if ( dX > diff || dY > diff ) { 522 if ( dX > diff || dY > diff ) {
523 block = false; 523 block = false;
524 } 524 }
525 } 525 }
526 if ( !block ) 526 if ( !block )
527 performItemAction(viewportPos); 527 performItemAction(viewportPos);
528 } 528 }
529 } else { 529 } else {
530 if ( mActionType == SELECT ) { 530 if ( mActionType == SELECT ) {
531 performSelectAction( viewportPos ); 531 performSelectAction( viewportPos );
532 } 532 }
533 } 533 }
534 break; 534 break;
535 535
536 case QEvent::MouseButtonDblClick: 536 case QEvent::MouseButtonDblClick:
537 if (object == viewport()) { 537 if (object == viewport()) {
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index abeb068..16c19a4 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -180,193 +180,196 @@ void KOTodoEditor::setupGeneral()
180 180
181} 181}
182 182
183void KOTodoEditor::editTodo(Todo *todo, bool editDescription) 183void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
184{ 184{
185 //init(); 185 //init();
186 186
187 mTodo = todo; 187 mTodo = todo;
188 readTodo(mTodo); 188 readTodo(mTodo);
189 if ( editDescription ) { 189 if ( editDescription ) {
190 showPage( 1 ); 190 showPage( 1 );
191 mGeneral->setFocusOn( 1 ); 191 mGeneral->setFocusOn( 1 );
192 } else { 192 } else {
193 showPage( 0 ); 193 showPage( 0 );
194 mGeneral->setFocusOn( 2 ); 194 mGeneral->setFocusOn( 2 );
195 } 195 }
196} 196}
197 197
198void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) 198void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay)
199{ 199{
200 //init(); 200 //init();
201 201
202 mTodo = 0; 202 mTodo = 0;
203 setDefaults(due,relatedTodo,allDay); 203 setDefaults(due,relatedTodo,allDay);
204} 204}
205 205
206void KOTodoEditor::loadDefaults() 206void KOTodoEditor::loadDefaults()
207{ 207{
208 setDefaults(QDateTime::currentDateTime().addDays(7),0,false); 208 setDefaults(QDateTime::currentDateTime().addDays(7),0,false);
209} 209}
210 210
211bool KOTodoEditor::processInput( bool emitTime ) 211bool KOTodoEditor::processInput( bool emitTime )
212{ 212{
213 if (!validateInput()) return false; 213 if (!validateInput()) return false;
214 214
215 Todo *todo = 0; 215 Todo *todo = 0;
216 216
217 if (mTodo) todo = mTodo; 217 if (mTodo) todo = mTodo;
218 else { 218 else {
219 todo = new Todo; 219 todo = new Todo;
220 todo->setOrganizer(KOPrefs::instance()->email()); 220 todo->setOrganizer(KOPrefs::instance()->email());
221 } 221 }
222 222
223 writeTodo(todo); 223 writeTodo(todo);
224 if ( emitTime ) { 224 if ( emitTime ) {
225 globalFlagBlockAgenda = 1; 225 globalFlagBlockAgenda = 1;
226 emit showAgendaView( false ); 226 emit showAgendaView( false );
227 if ( todo->hasDueDate() ) 227 if ( todo->hasDueDate() )
228 emit jumpToTime( todo->dtDue().date() ); 228 emit jumpToTime( todo->dtDue().date() );
229 globalFlagBlockAgenda = 2; 229 globalFlagBlockAgenda = 2;
230 } 230 }
231 if (mTodo) { 231 if (mTodo) {
232 todo->setRevision(todo->revision()+1); 232 todo->setRevision(todo->revision()+1);
233 emit todoChanged(todo); 233 emit todoChanged(todo);
234 } else { 234 } else {
235 mCalendar->addTodo(todo); 235 mCalendar->addTodo(todo);
236 mTodo = todo; 236 mTodo = todo;
237 emit todoAdded(todo); 237 emit todoAdded(todo);
238 } 238 }
239 239
240 return true; 240 return true;
241} 241}
242 242
243void KOTodoEditor::deleteTodo() 243void KOTodoEditor::deleteTodo()
244{ 244{
245 if (mTodo) { 245 if (mTodo) {
246 if (KOPrefs::instance()->mConfirm) { 246 if (KOPrefs::instance()->mConfirm) {
247 switch (msgItemDelete()) { 247 switch (msgItemDelete()) {
248 case KMessageBox::Continue: // OK 248 case KMessageBox::Continue: // OK
249 emit todoToBeDeleted(mTodo); 249 emit todoToBeDeleted(mTodo);
250 emit dialogClose(mTodo); 250 emit dialogClose(mTodo);
251 mCalendar->deleteTodo(mTodo); 251 mCalendar->deleteTodo(mTodo);
252 emit todoDeleted(); 252 emit todoDeleted();
253 reject(); 253 reject();
254 break; 254 break;
255 } 255 }
256 } 256 }
257 else { 257 else {
258 emit todoToBeDeleted(mTodo); 258 emit todoToBeDeleted(mTodo);
259 emit dialogClose(mTodo); 259 emit dialogClose(mTodo);
260 mCalendar->deleteTodo(mTodo); 260 mCalendar->deleteTodo(mTodo);
261 emit todoDeleted(); 261 emit todoDeleted();
262 reject(); 262 reject();
263 } 263 }
264 } else { 264 } else {
265 reject(); 265 reject();
266 } 266 }
267} 267}
268 268
269void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) 269void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
270{ 270{
271 mRelatedTodo = relatedEvent; 271 mRelatedTodo = relatedEvent;
272 272
273 mGeneral->setDefaults(due,allDay); 273 mGeneral->setDefaults(due,allDay);
274 mDetails->setDefaults(); 274 mDetails->setDefaults();
275 showPage( 0 ); 275 showPage( 0 );
276 if ( mRelatedTodo ) 276 if ( mRelatedTodo ) {
277 mGeneral->setCategories (mRelatedTodo->categoriesStr ()); 277 mGeneral->setCategories (mRelatedTodo->categoriesStr ());
278 mGeneral->setSecrecy (mRelatedTodo->secrecy ());
279
280 }
278 mGeneral->setFocusOn( 2 ); 281 mGeneral->setFocusOn( 2 );
279} 282}
280 283
281void KOTodoEditor::readTodo(Todo *todo) 284void KOTodoEditor::readTodo(Todo *todo)
282{ 285{
283 mGeneral->readTodo(todo); 286 mGeneral->readTodo(todo);
284 mDetails->readEvent(todo); 287 mDetails->readEvent(todo);
285 mRelatedTodo = 0;//todo->relatedTo(); 288 mRelatedTodo = 0;//todo->relatedTo();
286 // categories 289 // categories
287 // mCategoryDialog->setSelected(todo->categories()); 290 // mCategoryDialog->setSelected(todo->categories());
288 291
289 // We should handle read-only events here. 292 // We should handle read-only events here.
290} 293}
291 294
292void KOTodoEditor::writeTodo(Todo *event) 295void KOTodoEditor::writeTodo(Todo *event)
293{ 296{
294 mGeneral->writeTodo(event); 297 mGeneral->writeTodo(event);
295 mDetails->writeEvent(event); 298 mDetails->writeEvent(event);
296 299
297 // set related event, i.e. parent to-do in this case. 300 // set related event, i.e. parent to-do in this case.
298 if (mRelatedTodo) { 301 if (mRelatedTodo) {
299 event->setRelatedTo(mRelatedTodo); 302 event->setRelatedTo(mRelatedTodo);
300 } 303 }
301} 304}
302 305
303bool KOTodoEditor::validateInput() 306bool KOTodoEditor::validateInput()
304{ 307{
305 if (!mGeneral->validateInput()) return false; 308 if (!mGeneral->validateInput()) return false;
306 if (!mDetails->validateInput()) return false; 309 if (!mDetails->validateInput()) return false;
307 return true; 310 return true;
308} 311}
309 312
310int KOTodoEditor::msgItemDelete() 313int KOTodoEditor::msgItemDelete()
311{ 314{
312 return KMessageBox::warningContinueCancel(this, 315 return KMessageBox::warningContinueCancel(this,
313 i18n("This item will be permanently deleted."), 316 i18n("This item will be permanently deleted."),
314 i18n("KOrganizer Confirmation"),i18n("Delete")); 317 i18n("KOrganizer Confirmation"),i18n("Delete"));
315} 318}
316 319
317void KOTodoEditor::modified (int modification) 320void KOTodoEditor::modified (int modification)
318{ 321{
319 if (modification == KOGlobals::CATEGORY_MODIFIED || 322 if (modification == KOGlobals::CATEGORY_MODIFIED ||
320 KOGlobals::UNKNOWN_MODIFIED == modification ) 323 KOGlobals::UNKNOWN_MODIFIED == modification )
321 // mCategoryDialog->setSelected (mTodo->categories ()); 324 // mCategoryDialog->setSelected (mTodo->categories ());
322 mGeneral->modified (mTodo, modification); 325 mGeneral->modified (mTodo, modification);
323 326
324} 327}
325 328
326void KOTodoEditor::slotLoadTemplate() 329void KOTodoEditor::slotLoadTemplate()
327{ 330{
328 331
329 QString fileName =locateLocal( "templates", "todos" ); 332 QString fileName =locateLocal( "templates", "todos" );
330 QDir t_dir; 333 QDir t_dir;
331 if ( !t_dir.exists(fileName) ) 334 if ( !t_dir.exists(fileName) )
332 t_dir.mkdir ( fileName ); 335 t_dir.mkdir ( fileName );
333 fileName += "/todo"; 336 fileName += "/todo";
334 fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this ); 337 fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this );
335 if ( fileName.length() == 0 ) 338 if ( fileName.length() == 0 )
336 return; 339 return;
337 CalendarLocal cal; 340 CalendarLocal cal;
338 ICalFormat format; 341 ICalFormat format;
339 if ( !format.load( &cal, fileName ) ) { 342 if ( !format.load( &cal, fileName ) ) {
340 KMessageBox::error( this, i18n("Error loading template file\n '%1'.") 343 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
341 .arg( fileName ) ); 344 .arg( fileName ) );
342 return ; 345 return ;
343 } 346 }
344 QPtrList<Todo> todos = cal.todos(); 347 QPtrList<Todo> todos = cal.todos();
345 Todo * todo = todos.first(); 348 Todo * todo = todos.first();
346 if ( !todo ) { 349 if ( !todo ) {
347 KMessageBox::error( this, 350 KMessageBox::error( this,
348 i18n("Template does not\ncontain a valid Todo.")); 351 i18n("Template does not\ncontain a valid Todo."));
349 } else { 352 } else {
350 readTodo( todo ); 353 readTodo( todo );
351 } 354 }
352 355
353} 356}
354 357
355void KOTodoEditor::slotSaveTemplate() 358void KOTodoEditor::slotSaveTemplate()
356{ 359{
357 QString fileName =locateLocal( "templates", "todos" ); 360 QString fileName =locateLocal( "templates", "todos" );
358 QDir t_dir; 361 QDir t_dir;
359 if ( !t_dir.exists(fileName) ) 362 if ( !t_dir.exists(fileName) )
360 t_dir.mkdir ( fileName ); 363 t_dir.mkdir ( fileName );
361 fileName += "/todo"; 364 fileName += "/todo";
362 fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this ); 365 fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this );
363 if ( fileName.length() > 0 ) 366 if ( fileName.length() > 0 )
364 saveTemplate( fileName ); 367 saveTemplate( fileName );
365} 368}
366 369
367void KOTodoEditor::saveTemplate( const QString &templateName ) 370void KOTodoEditor::saveTemplate( const QString &templateName )
368{ 371{
369 Todo *todo = new Todo; 372 Todo *todo = new Todo;
370 writeTodo( todo ); 373 writeTodo( todo );
371 saveAsTemplate( todo, templateName ); 374 saveAsTemplate( todo, templateName );
372} 375}
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 30adb06..22486ba 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -336,285 +336,298 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
336 QBoxLayout *topLayout = new QVBoxLayout(this); 336 QBoxLayout *topLayout = new QVBoxLayout(this);
337 mName = QString ( name ); 337 mName = QString ( name );
338 mBlockUpdate = false; 338 mBlockUpdate = false;
339 mQuickAdd = new KOQuickTodo(this); 339 mQuickAdd = new KOQuickTodo(this);
340 topLayout->addWidget(mQuickAdd); 340 topLayout->addWidget(mQuickAdd);
341 341
342 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 342 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
343 343
344 mTodoListView = new KOTodoListView(calendar,this, name ); 344 mTodoListView = new KOTodoListView(calendar,this, name );
345 topLayout->addWidget(mTodoListView); 345 topLayout->addWidget(mTodoListView);
346 //mTodoListView->header()->setMaximumHeight(30); 346 //mTodoListView->header()->setMaximumHeight(30);
347 mTodoListView->setRootIsDecorated(true); 347 mTodoListView->setRootIsDecorated(true);
348 mTodoListView->setAllColumnsShowFocus(true); 348 mTodoListView->setAllColumnsShowFocus(true);
349 349
350 mTodoListView->setShowSortIndicator(true); 350 mTodoListView->setShowSortIndicator(true);
351 351
352 mTodoListView->addColumn(i18n("Todo")); 352 mTodoListView->addColumn(i18n("Todo"));
353 mTodoListView->addColumn(i18n("Prio")); 353 mTodoListView->addColumn(i18n("Prio"));
354 mTodoListView->setColumnAlignment(1,AlignHCenter); 354 mTodoListView->setColumnAlignment(1,AlignHCenter);
355 mTodoListView->addColumn(i18n("Complete")); 355 mTodoListView->addColumn(i18n("Complete"));
356 mTodoListView->setColumnAlignment(2,AlignCenter); 356 mTodoListView->setColumnAlignment(2,AlignCenter);
357 357
358 mTodoListView->addColumn(i18n("Due Date")); 358 mTodoListView->addColumn(i18n("Due Date"));
359 mTodoListView->setColumnAlignment(3,AlignLeft); 359 mTodoListView->setColumnAlignment(3,AlignLeft);
360 mTodoListView->addColumn(i18n("Due Time")); 360 mTodoListView->addColumn(i18n("Due Time"));
361 mTodoListView->setColumnAlignment(4,AlignHCenter); 361 mTodoListView->setColumnAlignment(4,AlignHCenter);
362 362
363 mTodoListView->addColumn(i18n("Start Date")); 363 mTodoListView->addColumn(i18n("Start Date"));
364 mTodoListView->setColumnAlignment(5,AlignLeft); 364 mTodoListView->setColumnAlignment(5,AlignLeft);
365 mTodoListView->addColumn(i18n("Start Time")); 365 mTodoListView->addColumn(i18n("Start Time"));
366 mTodoListView->setColumnAlignment(6,AlignHCenter); 366 mTodoListView->setColumnAlignment(6,AlignHCenter);
367 367
368 mTodoListView->addColumn(i18n("Cancelled")); 368 mTodoListView->addColumn(i18n("Cancelled"));
369 mTodoListView->addColumn(i18n("Categories")); 369 mTodoListView->addColumn(i18n("Categories"));
370#if 0 370#if 0
371 mTodoListView->addColumn(i18n("Sort Id")); 371 mTodoListView->addColumn(i18n("Sort Id"));
372 mTodoListView->setColumnAlignment(4,AlignHCenter); 372 mTodoListView->setColumnAlignment(4,AlignHCenter);
373#endif 373#endif
374 374
375 mTodoListView->setMinimumHeight( 60 ); 375 mTodoListView->setMinimumHeight( 60 );
376 mTodoListView->setItemsRenameable( true ); 376 mTodoListView->setItemsRenameable( true );
377 mTodoListView->setRenameable( 0 ); 377 mTodoListView->setRenameable( 0 );
378 mTodoListView->setColumnWidth( 0, 120 ); 378 mTodoListView->setColumnWidth( 0, 120 );
379 mTodoListView->setColumnWidthMode(0, QListView::Manual); 379 mTodoListView->setColumnWidthMode(0, QListView::Manual);
380 mTodoListView->setColumnWidthMode(1, QListView::Manual); 380 mTodoListView->setColumnWidthMode(1, QListView::Manual);
381 mTodoListView->setColumnWidthMode(2, QListView::Manual); 381 mTodoListView->setColumnWidthMode(2, QListView::Manual);
382 mTodoListView->setColumnWidthMode(3, QListView::Manual); 382 mTodoListView->setColumnWidthMode(3, QListView::Manual);
383 mTodoListView->setColumnWidthMode(4, QListView::Manual); 383 mTodoListView->setColumnWidthMode(4, QListView::Manual);
384 mTodoListView->setColumnWidthMode(5, QListView::Manual); 384 mTodoListView->setColumnWidthMode(5, QListView::Manual);
385 mTodoListView->setColumnWidthMode(6, QListView::Manual); 385 mTodoListView->setColumnWidthMode(6, QListView::Manual);
386 mTodoListView->setColumnWidthMode(7, QListView::Manual); 386 mTodoListView->setColumnWidthMode(7, QListView::Manual);
387 mTodoListView->setColumnWidthMode(8, QListView::Manual); 387 mTodoListView->setColumnWidthMode(8, QListView::Manual);
388 388
389 389
390 mPriorityPopupMenu = new QPopupMenu(this); 390 mPriorityPopupMenu = new QPopupMenu(this);
391 for (int i = 1; i <= 5; i++) { 391 for (int i = 1; i <= 5; i++) {
392 QString label = QString ("%1").arg (i); 392 QString label = QString ("%1").arg (i);
393 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 393 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
394 } 394 }
395 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 395 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
396 396
397 mPercentageCompletedPopupMenu = new QPopupMenu(this); 397 mPercentageCompletedPopupMenu = new QPopupMenu(this);
398 for (int i = 0; i <= 100; i+=20) { 398 for (int i = 0; i <= 100; i+=20) {
399 QString label = QString ("%1 %").arg (i); 399 QString label = QString ("%1 %").arg (i);
400 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 400 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
401 } 401 }
402 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 402 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
403 403
404 404
405 405
406 mItemPopupMenu = new QPopupMenu(this); 406 mItemPopupMenu = new QPopupMenu(this);
407 mItemPopupMenu->insertItem(i18n("Show..."), this, 407 mItemPopupMenu->insertItem(i18n("Show..."), this,
408 SLOT (showTodo())); 408 SLOT (showTodo()));
409 mItemPopupMenu->insertItem(i18n("Edit..."), this, 409 mItemPopupMenu->insertItem(i18n("Edit..."), this,
410 SLOT (editTodo())); 410 SLOT (editTodo()));
411 mItemPopupMenu->insertItem( i18n("Delete"), this, 411 mItemPopupMenu->insertItem( i18n("Delete"), this,
412 SLOT (deleteTodo())); 412 SLOT (deleteTodo()));
413 mItemPopupMenu->insertItem( i18n("Clone..."), this, 413 mItemPopupMenu->insertItem( i18n("Clone..."), this,
414 SLOT (cloneTodo())); 414 SLOT (cloneTodo()));
415 mItemPopupMenu->insertItem( i18n("Move..."), this, 415 mItemPopupMenu->insertItem( i18n("Move..."), this,
416 SLOT (moveTodo())); 416 SLOT (moveTodo()));
417 mItemPopupMenu->insertItem( i18n("Beam..."), this, 417 mItemPopupMenu->insertItem( i18n("Beam..."), this,
418 SLOT (beamTodo())); 418 SLOT (beamTodo()));
419 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 419 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
420 SLOT (cancelTodo())); 420 SLOT (cancelTodo()));
421 mItemPopupMenu->insertSeparator(); 421 mItemPopupMenu->insertSeparator();
422 422
423 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 423 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
424 SLOT (newTodo())); 424 SLOT (newTodo()));
425 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 425 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
426 SLOT (newSubTodo())); 426 SLOT (newSubTodo()));
427 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 427 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
428 SLOT (unparentTodo()),0,21); 428 SLOT (unparentTodo()),0,21);
429 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 429 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
430 SLOT (reparentTodo()),0,22); 430 SLOT (reparentTodo()),0,22);
431 mItemPopupMenu->insertSeparator(); 431 mItemPopupMenu->insertSeparator();
432#if 0
432 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 433 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
433 this, SLOT( purgeCompleted() ) ); 434 this, SLOT( purgeCompleted() ) );
434 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 435 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
435 this, SLOT( toggleCompleted() ),0, 33 ); 436 this, SLOT( toggleCompleted() ),0, 33 );
436 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 437 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
437 this, SLOT( toggleQuickTodo() ),0, 34 ); 438 this, SLOT( toggleQuickTodo() ),0, 34 );
438 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 439 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
439 this, SLOT( toggleRunning() ),0, 35 ); 440 this, SLOT( toggleRunning() ),0, 35 );
440 441
442#endif
441 mPopupMenu = new QPopupMenu(this); 443 mPopupMenu = new QPopupMenu(this);
442 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 444 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
443 SLOT (newTodo()),0,1); 445 SLOT (newTodo()),0,1);
444 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), 446 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"),
445 this, SLOT(purgeCompleted()),0,2); 447 this, SLOT(purgeCompleted()),0,2);
446 mPopupMenu->insertItem(i18n("Show Completed"), 448 mPopupMenu->insertItem(i18n("Show Completed"),
447 this, SLOT( toggleCompleted() ),0,3 ); 449 this, SLOT( toggleCompleted() ),0,3 );
448 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 450 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
449 this, SLOT( toggleQuickTodo() ),0,4 ); 451 this, SLOT( toggleQuickTodo() ),0,4 );
450 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 452 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
451 this, SLOT( toggleRunning() ),0,5 ); 453 this, SLOT( toggleRunning() ),0,5 );
454 mPopupMenu->insertItem(i18n(" set all open","Display all opened"),
455 this, SLOT( setAllOpen() ),0,6 );
456 mPopupMenu->insertItem(i18n(" set all close","Display all closed"),
457 this, SLOT( setAllClose() ),0,7 );
458 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
459 this, SLOT( setAllFlat() ),0,8 );
452 mDocPrefs = new DocPrefs( name ); 460 mDocPrefs = new DocPrefs( name );
453 461
462 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu );
454 mPopupMenu->setCheckable( true ); 463 mPopupMenu->setCheckable( true );
455 mItemPopupMenu->setCheckable( true ); 464 mItemPopupMenu->setCheckable( true );
456 465
457 466
458 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 467 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
459 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 468 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
460 469
461 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 470 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
462 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 471 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
463 472
464 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 473 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
465 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 474 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
466 475
467 476
468 // Double clicking conflicts with opening/closing the subtree 477 // Double clicking conflicts with opening/closing the subtree
469 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 478 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
470 SLOT( editItem( QListViewItem *) ) ); 479 SLOT( editItem( QListViewItem *) ) );
471 /* 480 /*
472 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 481 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
473 const QPoint &,int ) ), 482 const QPoint &,int ) ),
474 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 483 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
475 */ 484 */
476 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 485 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
477 const QPoint &,int ) ), 486 const QPoint &,int ) ),
478 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 487 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
479 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 488 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
480 SLOT( itemClicked( QListViewItem * ) ) ); 489 SLOT( itemClicked( QListViewItem * ) ) );
481 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 490 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
482 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 491 SLOT( itemDoubleClicked( QListViewItem * ) ) );
483 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), 492 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ),
484 SLOT( updateView() ) ); 493 SLOT( updateView() ) );
485 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 494 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
486 SLOT( itemStateChanged( QListViewItem * ) ) ); 495 SLOT( itemStateChanged( QListViewItem * ) ) );
487 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 496 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
488 SLOT( itemStateChanged( QListViewItem * ) ) ); 497 SLOT( itemStateChanged( QListViewItem * ) ) );
489 498
490#if 0 499#if 0
491 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 500 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
492 SLOT(selectionChanged(QListViewItem *))); 501 SLOT(selectionChanged(QListViewItem *)));
493 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 502 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
494 SLOT(selectionChanged(QListViewItem *))); 503 SLOT(selectionChanged(QListViewItem *)));
495 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 504 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
496 SLOT(selectionChanged(QListViewItem *))); 505 SLOT(selectionChanged(QListViewItem *)));
497#endif 506#endif
498 connect( mTodoListView, SIGNAL(selectionChanged() ), 507 connect( mTodoListView, SIGNAL(selectionChanged() ),
499 SLOT( processSelectionChange() ) ); 508 SLOT( processSelectionChange() ) );
500 connect( mQuickAdd, SIGNAL( returnPressed () ), 509 connect( mQuickAdd, SIGNAL( returnPressed () ),
501 SLOT( addQuickTodo() ) ); 510 SLOT( addQuickTodo() ) );
502 511
503} 512}
504 513
505KOTodoView::~KOTodoView() 514KOTodoView::~KOTodoView()
506{ 515{
507 delete mDocPrefs; 516 delete mDocPrefs;
508} 517}
509 518
510void KOTodoView::jumpToDate () 519void KOTodoView::jumpToDate ()
511{ 520{
512 // if (mActiveItem) { 521 // if (mActiveItem) {
513// mActiveItem->todo()); 522// mActiveItem->todo());
514// if ( mActiveItem->todo()->hasDueDate() ) 523// if ( mActiveItem->todo()->hasDueDate() )
515// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 524// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
516} 525}
517 526
518void KOTodoView::updateView() 527void KOTodoView::updateView()
519{ 528{
520 pendingSubtodo = 0; 529 pendingSubtodo = 0;
521 if ( mBlockUpdate ) { 530 if ( mBlockUpdate ) {
522 //qDebug("blocked "); 531 //qDebug("blocked ");
523 return; 532 return;
524 } 533 }
534 if ( isFlatDisplay ) {
535 setAllFlat();
536 return;
537 }
525 //qDebug("update "); 538 //qDebug("update ");
526// kdDebug() << "KOTodoView::updateView()" << endl; 539// kdDebug() << "KOTodoView::updateView()" << endl;
527 QFont fo = KOPrefs::instance()->mTodoViewFont; 540 QFont fo = KOPrefs::instance()->mTodoViewFont;
528 mTodoListView->clear(); 541 mTodoListView->clear();
529 if ( mName == "todolistsmall" ) { 542 if ( mName == "todolistsmall" ) {
530 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 543 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
531 int ps = fo.pointSize() -2; 544 int ps = fo.pointSize() -2;
532 if ( ps > 12 ) 545 if ( ps > 12 )
533 ps -= 2; 546 ps -= 2;
534 fo.setPointSize( ps ); 547 fo.setPointSize( ps );
535 } 548 }
536 } 549 }
537 550
538 mTodoListView->setFont( fo ); 551 mTodoListView->setFont( fo );
539 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 552 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
540 //mTodoListView->header()->setMaximumHeight(fm.height()); 553 //mTodoListView->header()->setMaximumHeight(fm.height());
541 QPtrList<Todo> todoList = calendar()->todos(); 554 QPtrList<Todo> todoList = calendar()->todos();
542 555
543/* 556/*
544 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 557 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
545 Event *t; 558 Event *t;
546 for(t = todoList.first(); t; t = todoList.next()) { 559 for(t = todoList.first(); t; t = todoList.next()) {
547 kdDebug() << " " << t->getSummary() << endl; 560 kdDebug() << " " << t->getSummary() << endl;
548 561
549 if (t->getRelatedTo()) { 562 if (t->getRelatedTo()) {
550 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 563 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
551 } 564 }
552 565
553 QPtrList<Event> l = t->getRelations(); 566 QPtrList<Event> l = t->getRelations();
554 Event *c; 567 Event *c;
555 for(c=l.first();c;c=l.next()) { 568 for(c=l.first();c;c=l.next()) {
556 kdDebug() << " - relation: " << c->getSummary() << endl; 569 kdDebug() << " - relation: " << c->getSummary() << endl;
557 } 570 }
558 } 571 }
559*/ 572*/
560 573
561 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 574 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
562 // specific order of events. That means that we have to generate parent items 575 // specific order of events. That means that we have to generate parent items
563 // recursively for proper hierarchical display of Todos. 576 // recursively for proper hierarchical display of Todos.
564 mTodoMap.clear(); 577 mTodoMap.clear();
565 Todo *todo; 578 Todo *todo;
566 todo = todoList.first();// todo; todo = todoList.next()) { 579 todo = todoList.first();// todo; todo = todoList.next()) {
567 while ( todo ) { 580 while ( todo ) {
568 bool next = true; 581 bool next = true;
569 // qDebug("todo %s ", todo->summary().latin1()); 582 // qDebug("todo %s ", todo->summary().latin1());
570 Incidence *incidence = todo->relatedTo(); 583 Incidence *incidence = todo->relatedTo();
571 while ( incidence ) { 584 while ( incidence ) {
572 if ( incidence->type() == "Todo") { 585 if ( incidence->type() == "Todo") {
573 //qDebug("related %s ",incidence->summary().latin1() ); 586 //qDebug("related %s ",incidence->summary().latin1() );
574 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 587 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
575 //qDebug("related not found "); 588 //qDebug("related not found ");
576 todoList.remove( ); 589 todoList.remove( );
577 todo = todoList.current(); 590 todo = todoList.current();
578 next = false; 591 next = false;
579 incidence = 0; 592 incidence = 0;
580 593
581 } else { 594 } else {
582 //qDebug("related found "); 595 //qDebug("related found ");
583 incidence = incidence->relatedTo(); 596 incidence = incidence->relatedTo();
584 } 597 }
585 } else 598 } else
586 incidence = 0; 599 incidence = 0;
587 } 600 }
588 if ( next ) 601 if ( next )
589 todo = todoList.next(); 602 todo = todoList.next();
590 } 603 }
591// qDebug("again .... "); 604// qDebug("again .... ");
592// for(todo = todoList.first(); todo; todo = todoList.next()) { 605// for(todo = todoList.first(); todo; todo = todoList.next()) {
593 606
594// qDebug("yytodo %s ", todo->summary().latin1()); 607// qDebug("yytodo %s ", todo->summary().latin1());
595// } 608// }
596 //qDebug("for "); 609 //qDebug("for ");
597 for(todo = todoList.first(); todo; todo = todoList.next()) { 610 for(todo = todoList.first(); todo; todo = todoList.next()) {
598 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 611 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
599 { 612 {
600 insertTodoItem(todo); 613 insertTodoItem(todo);
601 } 614 }
602 } 615 }
603 //qDebug("for end "); 616 //qDebug("for end ");
604 // Restore opened/closed state 617 // Restore opened/closed state
605 mTodoListView->blockSignals( true ); 618 mTodoListView->blockSignals( true );
606 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 619 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
607 mTodoListView->blockSignals( false ); 620 mTodoListView->blockSignals( false );
608 mTodoListView->setFocus(); 621 mTodoListView->setFocus();
609 processSelectionChange(); 622 processSelectionChange();
610} 623}
611 624
612bool KOTodoView::checkTodo( Todo * todo ) 625bool KOTodoView::checkTodo( Todo * todo )
613{ 626{
614 627
615 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) 628 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
616 return false; 629 return false;
617 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { 630 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
618 if ( todo->hasStartDate() ) 631 if ( todo->hasStartDate() )
619 if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) 632 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
620 return false; 633 return false;
@@ -904,192 +917,239 @@ void KOTodoView::itemClicked(QListViewItem *item)
904 if ( pendingSubtodo != 0 ) { 917 if ( pendingSubtodo != 0 ) {
905 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 918 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
906 } 919 }
907 pendingSubtodo = 0; 920 pendingSubtodo = 0;
908 return; 921 return;
909 } 922 }
910 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 923 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
911 if ( pendingSubtodo != 0 ) { 924 if ( pendingSubtodo != 0 ) {
912 bool allowReparent = true; 925 bool allowReparent = true;
913 QListViewItem *par = item; 926 QListViewItem *par = item;
914 while ( par ) { 927 while ( par ) {
915 if ( par == pendingSubtodo ) { 928 if ( par == pendingSubtodo ) {
916 allowReparent = false; 929 allowReparent = false;
917 break; 930 break;
918 } 931 }
919 par = par->parent(); 932 par = par->parent();
920 } 933 }
921 if ( !allowReparent ) { 934 if ( !allowReparent ) {
922 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 935 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
923 qDebug("Recursive reparenting not possible "); 936 qDebug("Recursive reparenting not possible ");
924 pendingSubtodo = 0; 937 pendingSubtodo = 0;
925 } else { 938 } else {
926 Todo* newParent = todoItem->todo(); 939 Todo* newParent = todoItem->todo();
927 Todo* newSub = pendingSubtodo->todo(); 940 Todo* newSub = pendingSubtodo->todo();
928 pendingSubtodo = 0; 941 pendingSubtodo = 0;
929 emit reparentTodoSignal( newParent,newSub ); 942 emit reparentTodoSignal( newParent,newSub );
930 return; 943 return;
931 } 944 }
932 } 945 }
933 int completed = todoItem->todo()->isCompleted(); // Completed or not? 946 int completed = todoItem->todo()->isCompleted(); // Completed or not?
934 947
935 if (todoItem->isOn()) { 948 if (todoItem->isOn()) {
936 if (!completed) { 949 if (!completed) {
937 todoItem->todo()->setCompleted(QDateTime::currentDateTime()); 950 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
938 } 951 }
939 } else { 952 } else {
940 if (completed) { 953 if (completed) {
941 todoItem->todo()->setCompleted(false); 954 todoItem->todo()->setCompleted(false);
942 } 955 }
943 } 956 }
944} 957}
945 958
946void KOTodoView::setDocumentId( const QString &id ) 959void KOTodoView::setDocumentId( const QString &id )
947{ 960{
948 kdDebug() << "KOTodoView::setDocumentId()" << endl; 961 kdDebug() << "KOTodoView::setDocumentId()" << endl;
949 962
950 mDocPrefs->setDoc( id ); 963 mDocPrefs->setDoc( id );
951} 964}
952 965
953void KOTodoView::itemStateChanged( QListViewItem *item ) 966void KOTodoView::itemStateChanged( QListViewItem *item )
954{ 967{
955 if (!item) return; 968 if (!item) return;
956 969
957 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 970 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
958 971
959// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 972// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
960 973
961 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 974 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
962} 975}
963 976
964void KOTodoView::saveLayout(KConfig *config, const QString &group) const 977void KOTodoView::saveLayout(KConfig *config, const QString &group) const
965{ 978{
966 mTodoListView->saveLayout(config,group); 979 mTodoListView->saveLayout(config,group);
967} 980}
968 981
969void KOTodoView::restoreLayout(KConfig *config, const QString &group) 982void KOTodoView::restoreLayout(KConfig *config, const QString &group)
970{ 983{
971 mTodoListView->restoreLayout(config,group); 984 mTodoListView->restoreLayout(config,group);
972} 985}
973 986
974void KOTodoView::processSelectionChange() 987void KOTodoView::processSelectionChange()
975{ 988{
976// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 989// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
977 990
978 KOTodoViewItem *item = 991 KOTodoViewItem *item =
979 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 992 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
980 993
981 if ( !item ) { 994 if ( !item ) {
982 emit incidenceSelected( 0 ); 995 emit incidenceSelected( 0 );
983 } else { 996 } else {
984 emit incidenceSelected( item->todo() ); 997 emit incidenceSelected( item->todo() );
985 } 998 }
986} 999}
987 1000
988void KOTodoView::modified(bool b) 1001void KOTodoView::modified(bool b)
989{ 1002{
990 emit isModified(b); 1003 emit isModified(b);
991} 1004}
992void KOTodoView::setTodoModified( Todo* todo ) 1005void KOTodoView::setTodoModified( Todo* todo )
993{ 1006{
994 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1007 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
995} 1008}
996void KOTodoView::clearSelection() 1009void KOTodoView::clearSelection()
997{ 1010{
998 mTodoListView->selectAll( false ); 1011 mTodoListView->selectAll( false );
999} 1012}
1013void KOTodoView::setAllOpen()
1014{
1015 if ( isFlatDisplay ) {
1016 isFlatDisplay = false;
1017 mPopupMenu->setItemChecked( 8,false );
1018 updateView();
1019 }
1020 setOpen(mTodoListView->firstChild(), true);
1021}
1022void KOTodoView::setAllClose()
1023{
1024 if ( isFlatDisplay ) {
1025 isFlatDisplay = false;
1026 mPopupMenu->setItemChecked( 8,false );
1027 updateView();
1028 }
1029 setOpen(mTodoListView->firstChild(), false);
1030}
1031void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
1032{
1033
1034 while ( item ) {
1035 setOpen( item->firstChild(), setOpenI );
1036 item->setOpen( setOpenI );
1037 item = item->nextSibling();
1038 }
1039}
1040
1041void KOTodoView::setAllFlat()
1042{
1043 pendingSubtodo = 0;
1044 if ( mBlockUpdate ) {
1045 return;
1046 }
1047 mPopupMenu->setItemChecked( 8,true );
1048 isFlatDisplay = true;
1049 QPtrList<Todo> todoList = calendar()->todos();
1050 mTodoMap.clear();
1051 mTodoListView->clear();
1052 Todo *todo;
1053 for(todo = todoList.first(); todo; todo = todoList.next()) {
1054 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1055 mTodoMap.insert(todo,todoItem);
1056 }
1057 mTodoListView->setFocus();
1058 processSelectionChange();
1059}
1000 1060
1001void KOTodoView::purgeCompleted() 1061void KOTodoView::purgeCompleted()
1002{ 1062{
1003 emit purgeCompletedSignal(); 1063 emit purgeCompletedSignal();
1004} 1064}
1005void KOTodoView::toggleQuickTodo() 1065void KOTodoView::toggleQuickTodo()
1006{ 1066{
1007 if ( mQuickAdd->isVisible() ) { 1067 if ( mQuickAdd->isVisible() ) {
1008 mQuickAdd->hide(); 1068 mQuickAdd->hide();
1009 KOPrefs::instance()->mEnableQuickTodo = false; 1069 KOPrefs::instance()->mEnableQuickTodo = false;
1010 } 1070 }
1011 else { 1071 else {
1012 mQuickAdd->show(); 1072 mQuickAdd->show();
1013 KOPrefs::instance()->mEnableQuickTodo = true; 1073 KOPrefs::instance()->mEnableQuickTodo = true;
1014 } 1074 }
1015 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 1075 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
1016 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 1076 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
1017} 1077}
1018 1078
1019void KOTodoView::toggleRunning() 1079void KOTodoView::toggleRunning()
1020{ 1080{
1021 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; 1081 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos;
1022 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 1082 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
1023 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 1083 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
1024 updateView(); 1084 updateView();
1025} 1085}
1026 1086
1027void KOTodoView::toggleCompleted() 1087void KOTodoView::toggleCompleted()
1028{ 1088{
1029 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; 1089 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo;
1030 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 1090 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
1031 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 1091 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
1032 updateView(); 1092 updateView();
1033} 1093}
1034 1094
1035void KOTodoView::addQuickTodo() 1095void KOTodoView::addQuickTodo()
1036{ 1096{
1037 Todo *todo = new Todo(); 1097 Todo *todo = new Todo();
1038 todo->setSummary(mQuickAdd->text()); 1098 todo->setSummary(mQuickAdd->text());
1039 todo->setOrganizer(KOPrefs::instance()->email()); 1099 todo->setOrganizer(KOPrefs::instance()->email());
1040 CalFilter * cf = mCalendar->filter(); 1100 CalFilter * cf = mCalendar->filter();
1041 if ( cf ) { 1101 if ( cf ) {
1042 if ( cf->isEnabled()&& cf->showCategories()) { 1102 if ( cf->isEnabled()&& cf->showCategories()) {
1043 todo->setCategories(cf->categoryList()); 1103 todo->setCategories(cf->categoryList());
1044 } 1104 }
1045 if ( cf->isEnabled() ) 1105 if ( cf->isEnabled() )
1046 todo->setSecrecy( cf->getSecrecy()); 1106 todo->setSecrecy( cf->getSecrecy());
1047 } 1107 }
1048 mCalendar->addTodo(todo); 1108 mCalendar->addTodo(todo);
1049 mQuickAdd->setText(""); 1109 mQuickAdd->setText("");
1050 todoModified (todo, KOGlobals::EVENTADDED ); 1110 todoModified (todo, KOGlobals::EVENTADDED );
1051 updateView(); 1111 updateView();
1052} 1112}
1053void KOTodoView::keyPressEvent ( QKeyEvent * e ) 1113void KOTodoView::keyPressEvent ( QKeyEvent * e )
1054{ 1114{
1055 // e->ignore(); 1115 // e->ignore();
1056 //return; 1116 //return;
1057 //qDebug("KOTodoView::keyPressEvent "); 1117 //qDebug("KOTodoView::keyPressEvent ");
1058 switch ( e->key() ) { 1118 switch ( e->key() ) {
1059 case Qt::Key_Down: 1119 case Qt::Key_Down:
1060 case Qt::Key_Up: 1120 case Qt::Key_Up:
1061 QWidget::keyPressEvent ( e ); 1121 QWidget::keyPressEvent ( e );
1062 break; 1122 break;
1063 1123
1064 case Qt::Key_Q: 1124 case Qt::Key_Q:
1065 toggleQuickTodo(); 1125 toggleQuickTodo();
1066 break; 1126 break;
1067 case Qt::Key_U: 1127 case Qt::Key_U:
1068 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1128 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1069 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1129 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1070 unparentTodo(); 1130 unparentTodo();
1071 e->accept(); 1131 e->accept();
1072 } else 1132 } else
1073 e->ignore(); 1133 e->ignore();
1074 break; 1134 break;
1075 case Qt::Key_S: 1135 case Qt::Key_S:
1076 if ( e->state() == Qt::ControlButton ) { 1136 if ( e->state() == Qt::ControlButton ) {
1077 e->ignore(); 1137 e->ignore();
1078 break; 1138 break;
1079 } 1139 }
1080 if ( e->state() == Qt::ShiftButton ) { 1140 if ( e->state() == Qt::ShiftButton ) {
1081 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1141 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1082 reparentTodo(); 1142 reparentTodo();
1083 e->accept(); 1143 e->accept();
1084 } else 1144 } else
1085 e->ignore(); 1145 e->ignore();
1086 break; 1146 break;
1087 case Qt::Key_P: 1147 case Qt::Key_P:
1088 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1148 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1089 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1149 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1090 if ( pendingSubtodo ) 1150 if ( pendingSubtodo )
1091 itemClicked(mActiveItem); 1151 itemClicked(mActiveItem);
1092 e->accept(); 1152 e->accept();
1093 } else 1153 } else
1094 e->ignore(); 1154 e->ignore();
1095 break; 1155 break;
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 5ca0362..f11518d 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -68,172 +68,177 @@ class KOTodoListView : public KListView
68 void contentsDragMoveEvent(QDragMoveEvent *); 68 void contentsDragMoveEvent(QDragMoveEvent *);
69 void contentsDragLeaveEvent(QDragLeaveEvent *); 69 void contentsDragLeaveEvent(QDragLeaveEvent *);
70 void contentsDropEvent(QDropEvent *); 70 void contentsDropEvent(QDropEvent *);
71 71
72 void contentsMousePressEvent(QMouseEvent *); 72 void contentsMousePressEvent(QMouseEvent *);
73 void contentsMouseMoveEvent(QMouseEvent *); 73 void contentsMouseMoveEvent(QMouseEvent *);
74 void contentsMouseReleaseEvent(QMouseEvent *); 74 void contentsMouseReleaseEvent(QMouseEvent *);
75 void contentsMouseDoubleClickEvent(QMouseEvent *); 75 void contentsMouseDoubleClickEvent(QMouseEvent *);
76 76
77 private: 77 private:
78 QString mName; 78 QString mName;
79 Calendar *mCalendar; 79 Calendar *mCalendar;
80 QPoint mPressPos; 80 QPoint mPressPos;
81 bool mMousePressed; 81 bool mMousePressed;
82 QListViewItem *mOldCurrent; 82 QListViewItem *mOldCurrent;
83 void keyPressEvent ( QKeyEvent * ) ; 83 void keyPressEvent ( QKeyEvent * ) ;
84}; 84};
85 85
86 86
87/** 87/**
88 This is the line-edit on top of the todoview for fast addition of new todos 88 This is the line-edit on top of the todoview for fast addition of new todos
89*/ 89*/
90class KOQuickTodo : public QLineEdit 90class KOQuickTodo : public QLineEdit
91{ 91{
92 public: 92 public:
93 KOQuickTodo(QWidget *parent=0); 93 KOQuickTodo(QWidget *parent=0);
94 protected: 94 protected:
95 void focusInEvent(QFocusEvent *ev); 95 void focusInEvent(QFocusEvent *ev);
96 void focusOutEvent(QFocusEvent *ev); 96 void focusOutEvent(QFocusEvent *ev);
97}; 97};
98 98
99 99
100/** 100/**
101 This class provides a multi-column list view of todo events. 101 This class provides a multi-column list view of todo events.
102 102
103 @short multi-column list view of todo events. 103 @short multi-column list view of todo events.
104 @author Cornelius Schumacher <schumacher@kde.org> 104 @author Cornelius Schumacher <schumacher@kde.org>
105*/ 105*/
106class KOTodoView : public KOrg::BaseView 106class KOTodoView : public KOrg::BaseView
107{ 107{
108 Q_OBJECT 108 Q_OBJECT
109 public: 109 public:
110 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 110 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
111 ~KOTodoView(); 111 ~KOTodoView();
112 112
113 QPtrList<Incidence> selectedIncidences(); 113 QPtrList<Incidence> selectedIncidences();
114 QPtrList<Todo> selectedTodos(); 114 QPtrList<Todo> selectedTodos();
115 115
116 DateList selectedDates() 116 DateList selectedDates()
117 {DateList q; 117 {DateList q;
118 return q;} 118 return q;}
119 119
120 /** Return number of shown dates. TodoView does not show dates, */ 120 /** Return number of shown dates. TodoView does not show dates, */
121 int currentDateCount() { return 0; } 121 int currentDateCount() { return 0; }
122 122
123 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 123 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
124 124
125 void setDocumentId( const QString & ); 125 void setDocumentId( const QString & );
126 126
127 void saveLayout(KConfig *config, const QString &group) const; 127 void saveLayout(KConfig *config, const QString &group) const;
128 void restoreLayout(KConfig *config, const QString &group); 128 void restoreLayout(KConfig *config, const QString &group);
129 /** Create a popup menu to set categories */ 129 /** Create a popup menu to set categories */
130 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); 130 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem);
131 void setNavigator( DateNavigator* nav ) {mNavigator = nav;} 131 void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
132 132
133 public slots: 133 public slots:
134 void updateView(); 134 void updateView();
135 void updateConfig(); 135 void updateConfig();
136 136
137 void changeEventDisplay(Event *, int); 137 void changeEventDisplay(Event *, int);
138 138
139 void showDates(const QDate &start, const QDate &end); 139 void showDates(const QDate &start, const QDate &end);
140 void showEvents(QPtrList<Event> eventList); 140 void showEvents(QPtrList<Event> eventList);
141 141
142 void clearSelection(); 142 void clearSelection();
143 void jumpToDate (); 143 void jumpToDate ();
144 144
145 void editItem(QListViewItem *item); 145 void editItem(QListViewItem *item);
146 void showItem(QListViewItem *item,const QPoint &,int); 146 void showItem(QListViewItem *item,const QPoint &,int);
147 void popupMenu(QListViewItem *item,const QPoint &,int); 147 void popupMenu(QListViewItem *item,const QPoint &,int);
148 void newTodo(); 148 void newTodo();
149 void newSubTodo(); 149 void newSubTodo();
150 void unparentTodo(); 150 void unparentTodo();
151 void reparentTodo(); 151 void reparentTodo();
152 void showTodo(); 152 void showTodo();
153 void editTodo(); 153 void editTodo();
154 void cloneTodo(); 154 void cloneTodo();
155 void cancelTodo(); 155 void cancelTodo();
156 void moveTodo(); 156 void moveTodo();
157 void beamTodo(); 157 void beamTodo();
158 void deleteTodo(); 158 void deleteTodo();
159 159
160 void setNewPriority(int); 160 void setNewPriority(int);
161 void setNewPercentage(int); 161 void setNewPercentage(int);
162 void changedCategories(int); 162 void changedCategories(int);
163 163
164 void setAllOpen();
165 void setAllClose();
166 void setAllFlat();
167
164 void purgeCompleted(); 168 void purgeCompleted();
165 void toggleCompleted(); 169 void toggleCompleted();
166 void toggleRunning(); 170 void toggleRunning();
167 void toggleQuickTodo(); 171 void toggleQuickTodo();
168 void updateTodo( Todo *, int ); 172 void updateTodo( Todo *, int );
169 173
170 void itemClicked(QListViewItem *); 174 void itemClicked(QListViewItem *);
171 void itemStateChanged(QListViewItem *); 175 void itemStateChanged(QListViewItem *);
172 void modified(bool); 176 void modified(bool);
173 void itemDoubleClicked(QListViewItem *item); 177 void itemDoubleClicked(QListViewItem *item);
174 178
175 signals: 179 signals:
176 void newTodoSignal(); 180 void newTodoSignal();
177 void newSubTodoSignal(Todo *); 181 void newSubTodoSignal(Todo *);
178 void unparentTodoSignal(Todo *); 182 void unparentTodoSignal(Todo *);
179 void reparentTodoSignal( Todo *,Todo * ); 183 void reparentTodoSignal( Todo *,Todo * );
180 void showTodoSignal(Todo *); 184 void showTodoSignal(Todo *);
181 185
182 void editTodoSignal(Todo *); 186 void editTodoSignal(Todo *);
183 void deleteTodoSignal(Todo *); 187 void deleteTodoSignal(Todo *);
184 void todoModifiedSignal (Todo *, int); 188 void todoModifiedSignal (Todo *, int);
185 189
186 void isModified(bool); 190 void isModified(bool);
187 void cloneTodoSignal( Incidence * ); 191 void cloneTodoSignal( Incidence * );
188 void cancelTodoSignal( Incidence * ); 192 void cancelTodoSignal( Incidence * );
189 void moveTodoSignal( Incidence * ); 193 void moveTodoSignal( Incidence * );
190 void beamTodoSignal( Incidence * ); 194 void beamTodoSignal( Incidence * );
191 void purgeCompletedSignal(); 195 void purgeCompletedSignal();
192 196
193 protected slots: 197 protected slots:
194 void processSelectionChange(); 198 void processSelectionChange();
195 void addQuickTodo(); 199 void addQuickTodo();
196 200
197 private: 201 private:
198 /* 202 /*
199 * the TodoEditor approach is rather unscaling in the long 203 * the TodoEditor approach is rather unscaling in the long
200 * run. 204 * run.
201 * Korganizer keeps it in memory and we need to update 205 * Korganizer keeps it in memory and we need to update
202 * 1. make KOTodoViewItem a QObject again? 206 * 1. make KOTodoViewItem a QObject again?
203 * 2. add a public method for setting one todo modified? 207 * 2. add a public method for setting one todo modified?
204 * 3. add a private method for setting a todo modified + friend here? 208 * 3. add a private method for setting a todo modified + friend here?
205 * -- zecke 2002-07-08 209 * -- zecke 2002-07-08
206 */ 210 */
207 friend class KOTodoViewItem; 211 friend class KOTodoViewItem;
208 void setTodoModified( Todo* ); 212 void setTodoModified( Todo* );
209 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 213 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
210 void restoreItemState( QListViewItem * ); 214 void restoreItemState( QListViewItem * );
211 215
212 bool checkTodo( Todo * ); 216 bool checkTodo( Todo * );
213 217 bool isFlatDisplay;
218 void setOpen( QListViewItem*, bool setOpen);
214 KOTodoListView *mTodoListView; 219 KOTodoListView *mTodoListView;
215 QPopupMenu *mItemPopupMenu; 220 QPopupMenu *mItemPopupMenu;
216 QPopupMenu *mPopupMenu; 221 QPopupMenu *mPopupMenu;
217 QPopupMenu *mPriorityPopupMenu; 222 QPopupMenu *mPriorityPopupMenu;
218 QPopupMenu *mPercentageCompletedPopupMenu; 223 QPopupMenu *mPercentageCompletedPopupMenu;
219 QPopupMenu *mCategoryPopupMenu; 224 QPopupMenu *mCategoryPopupMenu;
220 225
221 QMap<int, int> mPercentage; 226 QMap<int, int> mPercentage;
222 QMap<int, int> mPriority; 227 QMap<int, int> mPriority;
223 QMap<int, QString> mCategory; 228 QMap<int, QString> mCategory;
224 KOTodoViewItem *mActiveItem; 229 KOTodoViewItem *mActiveItem;
225 230
226 QMap<Todo *,KOTodoViewItem *> mTodoMap; 231 QMap<Todo *,KOTodoViewItem *> mTodoMap;
227 QString mName; 232 QString mName;
228 233
229 DocPrefs *mDocPrefs; 234 DocPrefs *mDocPrefs;
230 QString mCurrentDoc; 235 QString mCurrentDoc;
231 KOQuickTodo *mQuickAdd; 236 KOQuickTodo *mQuickAdd;
232 bool mBlockUpdate; 237 bool mBlockUpdate;
233 void todoModified(Todo *, int ); 238 void todoModified(Todo *, int );
234 void keyPressEvent ( QKeyEvent * ) ; 239 void keyPressEvent ( QKeyEvent * ) ;
235 KOTodoViewItem * pendingSubtodo; 240 KOTodoViewItem * pendingSubtodo;
236 DateNavigator* mNavigator; 241 DateNavigator* mNavigator;
237}; 242};
238 243
239#endif 244#endif