summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-16 13:36:11 (UTC)
committer zautrix <zautrix>2004-10-16 13:36:11 (UTC)
commitc3325ebbb92a2814fcb622caaf71316cfa0c2908 (patch) (unidiff)
treeb53545c39f84fc6ce694f371509b4a9fe2ddd743
parent023b3c542a6dd4d1c4b53dba6bb2c68f605a7917 (diff)
downloadkdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.zip
kdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.tar.gz
kdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.tar.bz2
made todos reparentable
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt8
-rw-r--r--korganizer/calendarview.cpp16
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/kotodoview.cpp88
-rw-r--r--korganizer/kotodoview.h3
-rw-r--r--korganizer/koviewmanager.cpp2
-rw-r--r--korganizer/mainwindow.cpp3
-rw-r--r--microkde/kdeui/klistview.cpp7
-rw-r--r--microkde/kdeui/klistview.h1
9 files changed, 122 insertions, 7 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index eb232fa..e17297a 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,14 +1,22 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 1.9.8 ************
4
5Fixed character decoding in OM/Pi.
6(e.g. German "Umlaute" were not displayed properly.)
7
8Made is possible to reparent todos in KO/Pi.
9Use contextmenu or keys (look at Help-Keys + Colors) for that.
10
3********** VERSION 1.9.7 ************ 11********** VERSION 1.9.7 ************
4 12
5KO/Pi - KA/Pi on Windows: 13KO/Pi - KA/Pi on Windows:
6Now a directory can be defined by the user, where the 14Now a directory can be defined by the user, where the
7application/config data should be saved. 15application/config data should be saved.
8 Define your desired path in the evironment variable 16 Define your desired path in the evironment variable
9 MICROKDEHOME 17 MICROKDEHOME
10 before starting KO/Pi or KA/Pi. 18 before starting KO/Pi or KA/Pi.
11 19
12An easy Kx/Pi to Kx/Pi syncing is now possible 20An easy Kx/Pi to Kx/Pi syncing is now possible
13(it is called Pi-Sync) via network. 21(it is called Pi-Sync) via network.
14Please look at the Sync Howto. 22Please look at the Sync Howto.
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index e4a11f5..1f8ad5b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -410,24 +410,26 @@ void CalendarView::init()
410 this, SLOT ( cloneIncidence( Incidence * ) ) ); 410 this, SLOT ( cloneIncidence( Incidence * ) ) );
411 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 411 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
412 this, SLOT (cancelIncidence( Incidence * ) ) ); 412 this, SLOT (cancelIncidence( Incidence * ) ) );
413 413
414 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 414 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
415 this, SLOT ( moveIncidence( Incidence * ) ) ); 415 this, SLOT ( moveIncidence( Incidence * ) ) );
416 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 416 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
417 this, SLOT ( beamIncidence( Incidence * ) ) ); 417 this, SLOT ( beamIncidence( Incidence * ) ) );
418 418
419 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 419 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
420 this, SLOT ( todo_unsub( Todo * ) ) ); 420 this, SLOT ( todo_unsub( Todo * ) ) );
421 421
422 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
423 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
422 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 424 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
423 SLOT( updateTodo( Todo *, int ) ) ); 425 SLOT( updateTodo( Todo *, int ) ) );
424 connect( this, SIGNAL( todoModified( Todo *, int )), this, 426 connect( this, SIGNAL( todoModified( Todo *, int )), this,
425 SLOT( changeTodoDisplay( Todo *, int ) ) ); 427 SLOT( changeTodoDisplay( Todo *, int ) ) );
426 428
427 429
428 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 430 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
429 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 431 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
430 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 432 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
431 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 433 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
432 434
433 435
@@ -2737,24 +2739,38 @@ void CalendarView::appointment_delete()
2737 anEvent = static_cast<Event *>(incidence); 2739 anEvent = static_cast<Event *>(incidence);
2738 } 2740 }
2739 } 2741 }
2740 2742
2741 if (!anEvent) { 2743 if (!anEvent) {
2742 KNotifyClient::beep(); 2744 KNotifyClient::beep();
2743 return; 2745 return;
2744 } 2746 }
2745 2747
2746 deleteEvent(anEvent); 2748 deleteEvent(anEvent);
2747} 2749}
2748 2750
2751void CalendarView::todo_resub( Todo * parent, Todo * sub )
2752{
2753 if (!sub) return;
2754 if (!parent) return;
2755 if ( sub->relatedTo() )
2756 sub->relatedTo()->removeRelation(sub);
2757 sub->setRelatedTo(parent);
2758 sub->setRelatedToUid(parent->uid());
2759 parent->addRelation(sub);
2760 sub->updated();
2761 parent->updated();
2762 setModified(true);
2763 updateView();
2764}
2749void CalendarView::todo_unsub(Todo *anTodo ) 2765void CalendarView::todo_unsub(Todo *anTodo )
2750{ 2766{
2751 // Todo *anTodo = selectedTodo(); 2767 // Todo *anTodo = selectedTodo();
2752 if (!anTodo) return; 2768 if (!anTodo) return;
2753 if (!anTodo->relatedTo()) return; 2769 if (!anTodo->relatedTo()) return;
2754 anTodo->relatedTo()->removeRelation(anTodo); 2770 anTodo->relatedTo()->removeRelation(anTodo);
2755 anTodo->setRelatedTo(0); 2771 anTodo->setRelatedTo(0);
2756 anTodo->updated(); 2772 anTodo->updated();
2757 anTodo->setRelatedToUid(""); 2773 anTodo->setRelatedToUid("");
2758 setModified(true); 2774 setModified(true);
2759 updateView(); 2775 updateView();
2760} 2776}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 660cce7..9f56cc8 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -345,24 +345,25 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
345 /** 345 /**
346 * pop up dialog confirming deletion of currently selected event in the 346 * pop up dialog confirming deletion of currently selected event in the
347 * View. 347 * View.
348 */ 348 */
349 void appointment_delete(); 349 void appointment_delete();
350 350
351 /** mails the currently selected event to a particular user as a vCalendar 351 /** mails the currently selected event to a particular user as a vCalendar
352 attachment. */ 352 attachment. */
353 void action_mail(); 353 void action_mail();
354 354
355 /* frees a subtodo from it's relation */ 355 /* frees a subtodo from it's relation */
356 void todo_unsub( Todo * ); 356 void todo_unsub( Todo * );
357 void todo_resub( Todo * parent, Todo * sub );
357 358
358 /** Take ownership of selected event. */ 359 /** Take ownership of selected event. */
359 void takeOverEvent(); 360 void takeOverEvent();
360 361
361 /** Take ownership of all events in calendar. */ 362 /** Take ownership of all events in calendar. */
362 void takeOverCalendar(); 363 void takeOverCalendar();
363 364
364 /** query whether or not the calendar is "dirty". */ 365 /** query whether or not the calendar is "dirty". */
365 bool isModified(); 366 bool isModified();
366 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 367 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
367 void setModified(bool modified=true); 368 void setModified(bool modified=true);
368 369
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index ca5eadd..a8143a0 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -202,24 +202,25 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
202 p.x() < header()->sectionPos(header()->mapToIndex(0))) { 202 p.x() < header()->sectionPos(header()->mapToIndex(0))) {
203 if (e->button()==Qt::LeftButton) { 203 if (e->button()==Qt::LeftButton) {
204 mPressPos = e->pos(); 204 mPressPos = e->pos();
205 mMousePressed = true; 205 mMousePressed = true;
206 } 206 }
207 } 207 }
208 } 208 }
209#endif 209#endif
210} 210}
211 211
212void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 212void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
213{ 213{
214
214#ifndef KORG_NODND 215#ifndef KORG_NODND
215// kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl; 216// kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl;
216 QListView::contentsMouseMoveEvent(e); 217 QListView::contentsMouseMoveEvent(e);
217 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 218 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
218 QApplication::startDragDistance()) { 219 QApplication::startDragDistance()) {
219 mMousePressed = false; 220 mMousePressed = false;
220 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 221 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
221 if (item) { 222 if (item) {
222// kdDebug() << "Start Drag for item " << item->text(0) << endl; 223// kdDebug() << "Start Drag for item " << item->text(0) << endl;
223 DndFactory factory( mCalendar ); 224 DndFactory factory( mCalendar );
224 ICalDrag *vd = factory.createDragTodo( 225 ICalDrag *vd = factory.createDragTodo(
225 ((KOTodoViewItem *)item)->todo(),viewport()); 226 ((KOTodoViewItem *)item)->todo(),viewport());
@@ -265,24 +266,26 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e )
265 } 266 }
266 267
267 // qDebug("KOTodoListView::keyPressEvent "); 268 // qDebug("KOTodoListView::keyPressEvent ");
268 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 269 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
269 switch ( e->key() ) { 270 switch ( e->key() ) {
270 case Qt::Key_Down: 271 case Qt::Key_Down:
271 case Qt::Key_Up: 272 case Qt::Key_Up:
272 QListView::keyPressEvent ( e ); 273 QListView::keyPressEvent ( e );
273 break; 274 break;
274 case Qt::Key_Left: 275 case Qt::Key_Left:
275 case Qt::Key_Right: 276 case Qt::Key_Right:
276 QListView::keyPressEvent ( e ); 277 QListView::keyPressEvent ( e );
278 e->accept();
279 return;
277 break; 280 break;
278 default: 281 default:
279 e->ignore(); 282 e->ignore();
280 break; 283 break;
281 } 284 }
282 return; 285 return;
283 } 286 }
284 e->ignore(); 287 e->ignore();
285} 288}
286void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 289void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
287{ 290{
288 QListView::contentsMouseReleaseEvent(e); 291 QListView::contentsMouseReleaseEvent(e);
@@ -405,52 +408,59 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
405 SLOT (moveTodo())); 408 SLOT (moveTodo()));
406 mItemPopupMenu->insertItem( i18n("Beam..."), this, 409 mItemPopupMenu->insertItem( i18n("Beam..."), this,
407 SLOT (beamTodo())); 410 SLOT (beamTodo()));
408 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 411 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
409 SLOT (cancelTodo())); 412 SLOT (cancelTodo()));
410 mItemPopupMenu->insertSeparator(); 413 mItemPopupMenu->insertSeparator();
411 414
412 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 415 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
413 SLOT (newTodo())); 416 SLOT (newTodo()));
414 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 417 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
415 SLOT (newSubTodo())); 418 SLOT (newSubTodo()));
416 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 419 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
417 SLOT (unparentTodo())); 420 SLOT (unparentTodo()),0,21);
421 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
422 SLOT (reparentTodo()),0,22);
418 mItemPopupMenu->insertSeparator(); 423 mItemPopupMenu->insertSeparator();
419 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 424 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
420 this, SLOT( purgeCompleted() ) ); 425 this, SLOT( purgeCompleted() ) );
421 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 426 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
422 this, SLOT( toggleCompleted() ),0, 33 ); 427 this, SLOT( toggleCompleted() ),0, 33 );
423 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 428 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
424 this, SLOT( toggleQuickTodo() ),0, 34 ); 429 this, SLOT( toggleQuickTodo() ),0, 34 );
425 430
426 mPopupMenu = new QPopupMenu(this); 431 mPopupMenu = new QPopupMenu(this);
427 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 432 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
428 SLOT (newTodo()),0,1); 433 SLOT (newTodo()),0,1);
429 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), 434 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"),
430 this, SLOT(purgeCompleted()),0,2); 435 this, SLOT(purgeCompleted()),0,2);
431 mPopupMenu->insertItem(i18n("Show Completed"), 436 mPopupMenu->insertItem(i18n("Show Completed"),
432 this, SLOT( toggleCompleted() ),0,3 ); 437 this, SLOT( toggleCompleted() ),0,3 );
433 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 438 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
434 this, SLOT( toggleQuickTodo() ),0,4 ); 439 this, SLOT( toggleQuickTodo() ),0,4 );
435 mDocPrefs = new DocPrefs( name ); 440 mDocPrefs = new DocPrefs( name );
436 441
437 mPopupMenu->setCheckable( true ); 442 mPopupMenu->setCheckable( true );
438 mItemPopupMenu->setCheckable( true ); 443 mItemPopupMenu->setCheckable( true );
439 // Double clicking conflicts with opening/closing the subtree 444 // Double clicking conflicts with opening/closing the subtree
440 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 445 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
441 SLOT( editItem( QListViewItem *) ) ); 446 SLOT( editItem( QListViewItem *) ) );
447 /*
442 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 448 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
443 const QPoint &,int ) ), 449 const QPoint &,int ) ),
444 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 450 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
451 */
452 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
453 const QPoint &,int ) ),
454 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
445 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 455 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
446 SLOT( itemClicked( QListViewItem * ) ) ); 456 SLOT( itemClicked( QListViewItem * ) ) );
447 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 457 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
448 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 458 SLOT( itemDoubleClicked( QListViewItem * ) ) );
449 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), 459 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ),
450 SLOT( updateView() ) ); 460 SLOT( updateView() ) );
451 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 461 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
452 SLOT( itemStateChanged( QListViewItem * ) ) ); 462 SLOT( itemStateChanged( QListViewItem * ) ) );
453 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 463 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
454 SLOT( itemStateChanged( QListViewItem * ) ) ); 464 SLOT( itemStateChanged( QListViewItem * ) ) );
455 465
456#if 0 466#if 0
@@ -686,25 +696,24 @@ void KOTodoView::editItem(QListViewItem *item )
686{ 696{
687 // qDebug("editItem(QListViewItem *item ) "); 697 // qDebug("editItem(QListViewItem *item ) ");
688 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 698 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
689} 699}
690 700
691void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 701void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
692{ 702{
693 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 703 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
694} 704}
695 705
696void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column) 706void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column)
697{ 707{
698
699 mActiveItem = (KOTodoViewItem *)item; 708 mActiveItem = (KOTodoViewItem *)item;
700 if (item) { 709 if (item) {
701 switch (column){ 710 switch (column){
702 case 1: 711 case 1:
703 mPriorityPopupMenu->popup(QCursor::pos ()); break; 712 mPriorityPopupMenu->popup(QCursor::pos ()); break;
704 case 2: 713 case 2:
705 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 714 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
706 case 3: 715 case 3:
707 moveTodo(); 716 moveTodo();
708 break; 717 break;
709 case 6: 718 case 6:
710 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; 719 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break;
@@ -721,24 +730,33 @@ void KOTodoView::newTodo()
721void KOTodoView::newSubTodo() 730void KOTodoView::newSubTodo()
722{ 731{
723 if (mActiveItem) { 732 if (mActiveItem) {
724 emit newSubTodoSignal(mActiveItem->todo()); 733 emit newSubTodoSignal(mActiveItem->todo());
725 } 734 }
726} 735}
727void KOTodoView::unparentTodo() 736void KOTodoView::unparentTodo()
728{ 737{
729 if (mActiveItem) { 738 if (mActiveItem) {
730 emit unparentTodoSignal(mActiveItem->todo()); 739 emit unparentTodoSignal(mActiveItem->todo());
731 } 740 }
732} 741}
742
743void KOTodoView::reparentTodo()
744{
745 if (mActiveItem) {
746 qDebug("KOTodoView::reparentTodo() ");
747 topLevelWidget()->setCaption(i18n("Click on new parent item"));
748 pendingSubtodo = mActiveItem;
749 }
750}
733void KOTodoView::editTodo() 751void KOTodoView::editTodo()
734{ 752{
735 if (mActiveItem) { 753 if (mActiveItem) {
736 emit editTodoSignal(mActiveItem->todo()); 754 emit editTodoSignal(mActiveItem->todo());
737 } 755 }
738} 756}
739void KOTodoView::cloneTodo() 757void KOTodoView::cloneTodo()
740{ 758{
741 if (mActiveItem) { 759 if (mActiveItem) {
742 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 760 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
743 } 761 }
744} 762}
@@ -834,40 +852,70 @@ void KOTodoView::changedCategories(int index)
834 categories.remove (mCategory[index]); 852 categories.remove (mCategory[index]);
835 else 853 else
836 categories.insert (categories.end(), mCategory[index]); 854 categories.insert (categories.end(), mCategory[index]);
837 categories.sort (); 855 categories.sort ();
838 mActiveItem->todo()->setCategories (categories); 856 mActiveItem->todo()->setCategories (categories);
839 mActiveItem->construct(); 857 mActiveItem->construct();
840 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 858 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
841 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 859 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
842 } 860 }
843} 861}
844void KOTodoView::itemDoubleClicked(QListViewItem *item) 862void KOTodoView::itemDoubleClicked(QListViewItem *item)
845{ 863{
864 if ( pendingSubtodo != 0 ) {
865 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
866 }
867 pendingSubtodo = 0;
846 if (!item) { 868 if (!item) {
847 newTodo(); 869 newTodo();
848 return; 870 return;
849 } 871 }
850 if ( KOPrefs::instance()->mEditOnDoubleClick ) 872 if ( KOPrefs::instance()->mEditOnDoubleClick )
851 editItem( item ); 873 editItem( item );
852 else 874 else
853 showItem( item , QPoint(), 0 ); 875 showItem( item , QPoint(), 0 );
854} 876}
855void KOTodoView::itemClicked(QListViewItem *item) 877void KOTodoView::itemClicked(QListViewItem *item)
856{ 878{
879
857 if (!item) { 880 if (!item) {
881 if ( pendingSubtodo != 0 ) {
882 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
883 }
884 pendingSubtodo = 0;
858 return; 885 return;
859 } 886 }
860
861 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 887 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
888 if ( pendingSubtodo != 0 ) {
889 bool allowReparent = true;
890 QListViewItem *par = item;
891 while ( par ) {
892 if ( par == pendingSubtodo ) {
893 allowReparent = false;
894 break;
895 }
896 par = par->parent();
897 }
898 if ( !allowReparent ) {
899 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
900 qDebug("Recursive reparenting not possible ");
901 pendingSubtodo = 0;
902 } else {
903 Todo* newParent = todoItem->todo();
904 Todo* newSub = pendingSubtodo->todo();
905 pendingSubtodo = 0;
906 emit reparentTodoSignal( newParent,newSub );
907 return;
908 }
909 }
862 int completed = todoItem->todo()->isCompleted(); // Completed or not? 910 int completed = todoItem->todo()->isCompleted(); // Completed or not?
863 911
864 if (todoItem->isOn()) { 912 if (todoItem->isOn()) {
865 if (!completed) { 913 if (!completed) {
866 todoItem->todo()->setCompleted(QDateTime::currentDateTime()); 914 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
867 } 915 }
868 } else { 916 } else {
869 if (completed) { 917 if (completed) {
870 todoItem->todo()->setCompleted(false); 918 todoItem->todo()->setCompleted(false);
871 } 919 }
872 } 920 }
873} 921}
@@ -965,34 +1013,66 @@ void KOTodoView::addQuickTodo()
965 if ( cf->isEnabled() ) 1013 if ( cf->isEnabled() )
966 todo->setSecrecy( cf->getSecrecy()); 1014 todo->setSecrecy( cf->getSecrecy());
967 } 1015 }
968 mCalendar->addTodo(todo); 1016 mCalendar->addTodo(todo);
969 mQuickAdd->setText(""); 1017 mQuickAdd->setText("");
970 todoModified (todo, KOGlobals::EVENTADDED ); 1018 todoModified (todo, KOGlobals::EVENTADDED );
971 updateView(); 1019 updateView();
972} 1020}
973void KOTodoView::keyPressEvent ( QKeyEvent * e ) 1021void KOTodoView::keyPressEvent ( QKeyEvent * e )
974{ 1022{
975 // e->ignore(); 1023 // e->ignore();
976 //return; 1024 //return;
1025 //qDebug("KOTodoView::keyPressEvent ");
977 switch ( e->key() ) { 1026 switch ( e->key() ) {
978 case Qt::Key_Down: 1027 case Qt::Key_Down:
979 case Qt::Key_Up: 1028 case Qt::Key_Up:
980 QWidget::keyPressEvent ( e ); 1029 QWidget::keyPressEvent ( e );
981 break; 1030 break;
982 1031
983 case Qt::Key_Q: 1032 case Qt::Key_Q:
984 toggleQuickTodo(); 1033 toggleQuickTodo();
985 break; 1034 break;
986 1035 case Qt::Key_U:
1036 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1037 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1038 unparentTodo();
1039 e->accept();
1040 } else
1041 e->ignore();
1042 break;
1043 case Qt::Key_S:
1044 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1045 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1046 reparentTodo();
1047 e->accept();
1048 } else
1049 e->ignore();
1050 break;
1051 case Qt::Key_P:
1052 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1053 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1054 if ( pendingSubtodo )
1055 itemClicked(mActiveItem);
1056 e->accept();
1057 } else
1058 e->ignore();
1059 break;
1060 case Qt::Key_Escape:
1061 if ( pendingSubtodo ) {
1062 itemClicked(0);
1063 e->accept();
1064 } else
1065 e->ignore();
1066 break;
987 default: 1067 default:
988 e->ignore(); 1068 e->ignore();
989 } 1069 }
990 1070
991 if ( true ) { 1071 if ( true ) {
992 if ( e->key() == Qt::Key_I ) { 1072 if ( e->key() == Qt::Key_I ) {
993 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); 1073 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem();
994 if ( cn ) { 1074 if ( cn ) {
995 mActiveItem = cn; 1075 mActiveItem = cn;
996 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 1076 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
997 if ( ci ){ 1077 if ( ci ){
998 showTodo(); 1078 showTodo();
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 6bf0203..0c08677 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -138,24 +138,25 @@ class KOTodoView : public KOrg::BaseView
138 void showDates(const QDate &start, const QDate &end); 138 void showDates(const QDate &start, const QDate &end);
139 void showEvents(QPtrList<Event> eventList); 139 void showEvents(QPtrList<Event> eventList);
140 140
141 void clearSelection(); 141 void clearSelection();
142 void jumpToDate (); 142 void jumpToDate ();
143 143
144 void editItem(QListViewItem *item); 144 void editItem(QListViewItem *item);
145 void showItem(QListViewItem *item,const QPoint &,int); 145 void showItem(QListViewItem *item,const QPoint &,int);
146 void popupMenu(QListViewItem *item,const QPoint &,int); 146 void popupMenu(QListViewItem *item,const QPoint &,int);
147 void newTodo(); 147 void newTodo();
148 void newSubTodo(); 148 void newSubTodo();
149 void unparentTodo(); 149 void unparentTodo();
150 void reparentTodo();
150 void showTodo(); 151 void showTodo();
151 void editTodo(); 152 void editTodo();
152 void cloneTodo(); 153 void cloneTodo();
153 void cancelTodo(); 154 void cancelTodo();
154 void moveTodo(); 155 void moveTodo();
155 void beamTodo(); 156 void beamTodo();
156 void deleteTodo(); 157 void deleteTodo();
157 158
158 void setNewPriority(int); 159 void setNewPriority(int);
159 void setNewPercentage(int); 160 void setNewPercentage(int);
160 void changedCategories(int); 161 void changedCategories(int);
161 162
@@ -164,24 +165,25 @@ class KOTodoView : public KOrg::BaseView
164 void toggleQuickTodo(); 165 void toggleQuickTodo();
165 void updateTodo( Todo *, int ); 166 void updateTodo( Todo *, int );
166 167
167 void itemClicked(QListViewItem *); 168 void itemClicked(QListViewItem *);
168 void itemStateChanged(QListViewItem *); 169 void itemStateChanged(QListViewItem *);
169 void modified(bool); 170 void modified(bool);
170 void itemDoubleClicked(QListViewItem *item); 171 void itemDoubleClicked(QListViewItem *item);
171 172
172 signals: 173 signals:
173 void newTodoSignal(); 174 void newTodoSignal();
174 void newSubTodoSignal(Todo *); 175 void newSubTodoSignal(Todo *);
175 void unparentTodoSignal(Todo *); 176 void unparentTodoSignal(Todo *);
177 void reparentTodoSignal( Todo *,Todo * );
176 void showTodoSignal(Todo *); 178 void showTodoSignal(Todo *);
177 179
178 void editTodoSignal(Todo *); 180 void editTodoSignal(Todo *);
179 void deleteTodoSignal(Todo *); 181 void deleteTodoSignal(Todo *);
180 void todoModifiedSignal (Todo *, int); 182 void todoModifiedSignal (Todo *, int);
181 183
182 void isModified(bool); 184 void isModified(bool);
183 void cloneTodoSignal( Incidence * ); 185 void cloneTodoSignal( Incidence * );
184 void cancelTodoSignal( Incidence * ); 186 void cancelTodoSignal( Incidence * );
185 void moveTodoSignal( Incidence * ); 187 void moveTodoSignal( Incidence * );
186 void beamTodoSignal( Incidence * ); 188 void beamTodoSignal( Incidence * );
187 void purgeCompletedSignal(); 189 void purgeCompletedSignal();
@@ -217,15 +219,16 @@ class KOTodoView : public KOrg::BaseView
217 QMap<int, QString> mCategory; 219 QMap<int, QString> mCategory;
218 KOTodoViewItem *mActiveItem; 220 KOTodoViewItem *mActiveItem;
219 221
220 QMap<Todo *,KOTodoViewItem *> mTodoMap; 222 QMap<Todo *,KOTodoViewItem *> mTodoMap;
221 QString mName; 223 QString mName;
222 224
223 DocPrefs *mDocPrefs; 225 DocPrefs *mDocPrefs;
224 QString mCurrentDoc; 226 QString mCurrentDoc;
225 KOQuickTodo *mQuickAdd; 227 KOQuickTodo *mQuickAdd;
226 bool mBlockUpdate; 228 bool mBlockUpdate;
227 void todoModified(Todo *, int ); 229 void todoModified(Todo *, int );
228 void keyPressEvent ( QKeyEvent * ) ; 230 void keyPressEvent ( QKeyEvent * ) ;
231 KOTodoViewItem * pendingSubtodo;
229}; 232};
230 233
231#endif 234#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 8e6cc53..391f98c 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -489,24 +489,26 @@ void KOViewManager::showTodoView()
489 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 489 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
490 SLOT( updateConfig() ) ); 490 SLOT( updateConfig() ) );
491 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 491 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
492 SLOT( updateTodo( Todo *, int ) ) ); 492 SLOT( updateTodo( Todo *, int ) ) );
493 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 493 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
494 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 494 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
495 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 495 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
496 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 496 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
497 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 497 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
498 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 498 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
499 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 499 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
500 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 500 mMainView, SLOT ( todo_unsub( Todo * ) ) );
501 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
502 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
501 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 503 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
502 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 504 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
503 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 505 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
504 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 506 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
505 KConfig *config = KOGlobals::config(); 507 KConfig *config = KOGlobals::config();
506 mTodoView->restoreLayout(config,"Todo View"); 508 mTodoView->restoreLayout(config,"Todo View");
507 } 509 }
508 510
509 globalFlagBlockAgenda = 1; 511 globalFlagBlockAgenda = 1;
510 showView( mTodoView, true ); 512 showView( mTodoView, true );
511 513
512} 514}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 8daacc7..06470b8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1138,24 +1138,27 @@ void MainWindow::keyBindings()
1138 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1138 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1139 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1139 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1140 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1140 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1141 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1141 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1142 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1142 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1143 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1143 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1144 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1144 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1145 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1145 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1146 i18n("<p><h3>In agenda view:</h3></p>\n") + 1146 i18n("<p><h3>In agenda view:</h3></p>\n") +
1147 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1147 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1148 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1148 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1149 i18n("<p><h3>In todo view:</h3></p>\n") + 1149 i18n("<p><h3>In todo view:</h3></p>\n") +
1150 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1151 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1152 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1150 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1153 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1151 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1154 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1152 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1155 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1153 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1156 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1154 i18n("<p><h3>In list view:</h3></p>\n") + 1157 i18n("<p><h3>In list view:</h3></p>\n") +
1155 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1158 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1156 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1159 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1157 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1160 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1158 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1161 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1159 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1162 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1160 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1163 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1161 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1164 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp
index 2856f2d..6477d11 100644
--- a/microkde/kdeui/klistview.cpp
+++ b/microkde/kdeui/klistview.cpp
@@ -1878,28 +1878,29 @@ void KListView::emitContextMenu (KListView*, QListViewItem* i)
1878{ 1878{
1879 QPoint p; 1879 QPoint p;
1880 qDebug("KListView::emitContextMenu "); 1880 qDebug("KListView::emitContextMenu ");
1881 1881
1882 if (i) 1882 if (i)
1883 p = viewport()->mapToGlobal(itemRect(i).center()); 1883 p = viewport()->mapToGlobal(itemRect(i).center());
1884 else 1884 else
1885 p = mapToGlobal(rect().center()); 1885 p = mapToGlobal(rect().center());
1886 1886
1887 emit contextMenu (this, i, p); 1887 emit contextMenu (this, i, p);
1888} 1888}
1889 1889
1890void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int) 1890void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col)
1891{ 1891{
1892 qDebug("KListView::emitContextMenu "); 1892 qDebug("KListView::emitContextMenu col");
1893 emit contextMenu (this, i, p); 1893 emit contextRequest( i, p, col );
1894 emit contextMenu (this, i, p);
1894} 1895}
1895 1896
1896void KListView::setAcceptDrops (bool val) 1897void KListView::setAcceptDrops (bool val)
1897{ 1898{
1898 QListView::setAcceptDrops (val); 1899 QListView::setAcceptDrops (val);
1899 viewport()->setAcceptDrops (val); 1900 viewport()->setAcceptDrops (val);
1900} 1901}
1901 1902
1902int KListView::dropVisualizerWidth () const 1903int KListView::dropVisualizerWidth () const
1903{ 1904{
1904 return d->mDropVisualizerWidth; 1905 return d->mDropVisualizerWidth;
1905} 1906}
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h
index f7d9f85..8d933f6 100644
--- a/microkde/kdeui/klistview.h
+++ b/microkde/kdeui/klistview.h
@@ -404,24 +404,25 @@ signals:
404 * @param item is the pointer to the clicked listview item. 404 * @param item is the pointer to the clicked listview item.
405 * @param pos is the position where the user has clicked, and 405 * @param pos is the position where the user has clicked, and
406 * @param c is the column into which the user clicked. 406 * @param c is the column into which the user clicked.
407 * 407 *
408 * Note that you may not delete any @ref QListViewItem objects in slots 408 * Note that you may not delete any @ref QListViewItem objects in slots
409 * connected to this signal. 409 * connected to this signal.
410 * 410 *
411 * This signal is more or less here for the sake of completeness. 411 * This signal is more or less here for the sake of completeness.
412 * You should normally not need to use this. In most cases its better 412 * You should normally not need to use this. In most cases its better
413 * to use @ref #executed() instead. 413 * to use @ref #executed() instead.
414 */ 414 */
415 void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); 415 void doubleClicked( QListViewItem *item, const QPoint &pos, int c );
416 void contextRequest( QListViewItem *item, const QPoint &pos, int c );
416 417
417 /** 418 /**
418 * This signal gets emitted whenever something acceptable is 419 * This signal gets emitted whenever something acceptable is
419 * dropped onto the listview. 420 * dropped onto the listview.
420 * 421 *
421 * @param e is the drop event itself (it has already been accepted) 422 * @param e is the drop event itself (it has already been accepted)
422 * @param after is the item after which the drop occured (or 0L, if 423 * @param after is the item after which the drop occured (or 0L, if
423 * the drop was above all items) 424 * the drop was above all items)
424 * 425 *
425 * @see #acceptDrop() 426 * @see #acceptDrop()
426 */ 427 */
427 void dropped (QDropEvent * e, QListViewItem *after); 428 void dropped (QDropEvent * e, QListViewItem *after);