author | zautrix <zautrix> | 2004-10-16 13:36:11 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-16 13:36:11 (UTC) |
commit | c3325ebbb92a2814fcb622caaf71316cfa0c2908 (patch) (side-by-side diff) | |
tree | b53545c39f84fc6ce694f371509b4a9fe2ddd743 | |
parent | 023b3c542a6dd4d1c4b53dba6bb2c68f605a7917 (diff) | |
download | kdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.zip kdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.tar.gz kdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.tar.bz2 |
made todos reparentable
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 8 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 16 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 88 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 3 | ||||
-rw-r--r-- | microkde/kdeui/klistview.cpp | 7 | ||||
-rw-r--r-- | microkde/kdeui/klistview.h | 1 |
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,5 +1,13 @@ Info about the changes in new versions of KDE-Pim/Pi +********** VERSION 1.9.8 ************ + +Fixed character decoding in OM/Pi. +(e.g. German "Umlaute" were not displayed properly.) + +Made is possible to reparent todos in KO/Pi. +Use contextmenu or keys (look at Help-Keys + Colors) for that. + ********** VERSION 1.9.7 ************ KO/Pi - KA/Pi on Windows: diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index e4a11f5..1f8ad5b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -419,6 +419,8 @@ void CalendarView::init() connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), this, SLOT ( todo_unsub( Todo * ) ) ); + connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), + this, SLOT ( todo_resub( Todo *,Todo * ) ) ); connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, SLOT( updateTodo( Todo *, int ) ) ); connect( this, SIGNAL( todoModified( Todo *, int )), this, @@ -2746,6 +2748,20 @@ void CalendarView::appointment_delete() deleteEvent(anEvent); } +void CalendarView::todo_resub( Todo * parent, Todo * sub ) +{ + if (!sub) return; + if (!parent) return; + if ( sub->relatedTo() ) + sub->relatedTo()->removeRelation(sub); + sub->setRelatedTo(parent); + sub->setRelatedToUid(parent->uid()); + parent->addRelation(sub); + sub->updated(); + parent->updated(); + setModified(true); + updateView(); +} void CalendarView::todo_unsub(Todo *anTodo ) { // Todo *anTodo = selectedTodo(); diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 660cce7..9f56cc8 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -354,6 +354,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser /* frees a subtodo from it's relation */ void todo_unsub( Todo * ); + void todo_resub( Todo * parent, Todo * sub ); /** Take ownership of selected event. */ void takeOverEvent(); diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index ca5eadd..a8143a0 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -211,6 +211,7 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) { + #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl; QListView::contentsMouseMoveEvent(e); @@ -274,6 +275,8 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e ) case Qt::Key_Left: case Qt::Key_Right: QListView::keyPressEvent ( e ); + e->accept(); + return; break; default: e->ignore(); @@ -414,7 +417,9 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, SLOT (newSubTodo())); mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, - SLOT (unparentTodo())); + SLOT (unparentTodo()),0,21); + mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, + SLOT (reparentTodo()),0,22); mItemPopupMenu->insertSeparator(); mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), this, SLOT( purgeCompleted() ) ); @@ -439,9 +444,14 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : // Double clicking conflicts with opening/closing the subtree connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), SLOT( editItem( QListViewItem *) ) ); + /* connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, const QPoint &,int ) ), SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); + */ + connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, + const QPoint &,int ) ), + SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), SLOT( itemClicked( QListViewItem * ) ) ); connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), @@ -695,7 +705,6 @@ void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column) { - mActiveItem = (KOTodoViewItem *)item; if (item) { switch (column){ @@ -730,6 +739,15 @@ void KOTodoView::unparentTodo() emit unparentTodoSignal(mActiveItem->todo()); } } + +void KOTodoView::reparentTodo() +{ + if (mActiveItem) { + qDebug("KOTodoView::reparentTodo() "); + topLevelWidget()->setCaption(i18n("Click on new parent item")); + pendingSubtodo = mActiveItem; + } +} void KOTodoView::editTodo() { if (mActiveItem) { @@ -843,6 +861,10 @@ void KOTodoView::changedCategories(int index) } void KOTodoView::itemDoubleClicked(QListViewItem *item) { + if ( pendingSubtodo != 0 ) { + topLevelWidget()->setCaption(i18n("Reparenting aborted!")); + } + pendingSubtodo = 0; if (!item) { newTodo(); return; @@ -854,11 +876,37 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) } void KOTodoView::itemClicked(QListViewItem *item) { + if (!item) { + if ( pendingSubtodo != 0 ) { + topLevelWidget()->setCaption(i18n("Reparenting aborted!")); + } + pendingSubtodo = 0; return; } - KOTodoViewItem *todoItem = (KOTodoViewItem *)item; + if ( pendingSubtodo != 0 ) { + bool allowReparent = true; + QListViewItem *par = item; + while ( par ) { + if ( par == pendingSubtodo ) { + allowReparent = false; + break; + } + par = par->parent(); + } + if ( !allowReparent ) { + topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); + qDebug("Recursive reparenting not possible "); + pendingSubtodo = 0; + } else { + Todo* newParent = todoItem->todo(); + Todo* newSub = pendingSubtodo->todo(); + pendingSubtodo = 0; + emit reparentTodoSignal( newParent,newSub ); + return; + } + } int completed = todoItem->todo()->isCompleted(); // Completed or not? if (todoItem->isOn()) { @@ -974,6 +1022,7 @@ void KOTodoView::keyPressEvent ( QKeyEvent * e ) { // e->ignore(); //return; + //qDebug("KOTodoView::keyPressEvent "); switch ( e->key() ) { case Qt::Key_Down: case Qt::Key_Up: @@ -983,7 +1032,38 @@ void KOTodoView::keyPressEvent ( QKeyEvent * e ) case Qt::Key_Q: toggleQuickTodo(); break; - + case Qt::Key_U: + if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { + mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); + unparentTodo(); + e->accept(); + } else + e->ignore(); + break; + case Qt::Key_S: + if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { + mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); + reparentTodo(); + e->accept(); + } else + e->ignore(); + break; + case Qt::Key_P: + if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { + mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); + if ( pendingSubtodo ) + itemClicked(mActiveItem); + e->accept(); + } else + e->ignore(); + break; + case Qt::Key_Escape: + if ( pendingSubtodo ) { + itemClicked(0); + e->accept(); + } else + e->ignore(); + break; default: e->ignore(); } diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 6bf0203..0c08677 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -147,6 +147,7 @@ class KOTodoView : public KOrg::BaseView void newTodo(); void newSubTodo(); void unparentTodo(); + void reparentTodo(); void showTodo(); void editTodo(); void cloneTodo(); @@ -173,6 +174,7 @@ class KOTodoView : public KOrg::BaseView void newTodoSignal(); void newSubTodoSignal(Todo *); void unparentTodoSignal(Todo *); + void reparentTodoSignal( Todo *,Todo * ); void showTodoSignal(Todo *); void editTodoSignal(Todo *); @@ -226,6 +228,7 @@ class KOTodoView : public KOrg::BaseView bool mBlockUpdate; void todoModified(Todo *, int ); void keyPressEvent ( QKeyEvent * ) ; + KOTodoViewItem * pendingSubtodo; }; #endif diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 8e6cc53..391f98c 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -498,6 +498,8 @@ void KOViewManager::showTodoView() mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), mMainView, SLOT ( todo_unsub( Todo * ) ) ); + connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), + mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 8daacc7..06470b8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1147,6 +1147,9 @@ void MainWindow::keyBindings() i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ i18n("<p><h3>In todo view:</h3></p>\n") + + i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ + i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ + i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ i18n("<p><b>return</b>: Mark item as completed+one step down.</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 @@ -1887,10 +1887,11 @@ void KListView::emitContextMenu (KListView*, QListViewItem* i) emit contextMenu (this, i, p); } -void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int) +void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) { - qDebug("KListView::emitContextMenu "); - emit contextMenu (this, i, p); + qDebug("KListView::emitContextMenu col"); + emit contextRequest( i, p, col ); + emit contextMenu (this, i, p); } void KListView::setAcceptDrops (bool val) 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 @@ -413,6 +413,7 @@ signals: * to use @ref #executed() instead. */ void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); + void contextRequest( QListViewItem *item, const QPoint &pos, int c ); /** * This signal gets emitted whenever something acceptable is |