-rw-r--r-- | korganizer/kotodoview.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 82437d8..99402c4 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -200,25 +200,29 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | |||
200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
201 | itemMargin() || | 201 | itemMargin() || |
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 | QListView::contentsMousePressEvent(e); | 210 | QListView::contentsMousePressEvent(e); |
211 | } | 211 | } |
212 | 212 | void KOTodoListView::paintEvent(QPaintEvent* e) | |
213 | { | ||
214 | emit paintNeeded(); | ||
215 | QListView::paintEvent( e); | ||
216 | } | ||
213 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 217 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
214 | { | 218 | { |
215 | 219 | ||
216 | #ifndef KORG_NODND | 220 | #ifndef KORG_NODND |
217 | QListView::contentsMouseMoveEvent(e); | 221 | QListView::contentsMouseMoveEvent(e); |
218 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 222 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
219 | QApplication::startDragDistance()) { | 223 | QApplication::startDragDistance()) { |
220 | mMousePressed = false; | 224 | mMousePressed = false; |
221 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 225 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
222 | if (item) { | 226 | if (item) { |
223 | DndFactory factory( mCalendar ); | 227 | DndFactory factory( mCalendar ); |
224 | ICalDrag *vd = factory.createDrag( | 228 | ICalDrag *vd = factory.createDrag( |
@@ -492,24 +496,26 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
492 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 496 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
493 | SLOT( itemClicked( QListViewItem * ) ) ); | 497 | SLOT( itemClicked( QListViewItem * ) ) ); |
494 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 498 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
495 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 499 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
496 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 500 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
497 | SLOT( updateView() ) ); | 501 | SLOT( updateView() ) ); |
498 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 502 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
499 | SLOT( todoModified(Todo *, int) ) ); | 503 | SLOT( todoModified(Todo *, int) ) ); |
500 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 504 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
501 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 505 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
502 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 506 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
503 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 507 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
508 | connect( mTodoListView, SIGNAL( paintNeeded() ), | ||
509 | SLOT( paintNeeded()) ); | ||
504 | 510 | ||
505 | #if 0 | 511 | #if 0 |
506 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 512 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
507 | SLOT(selectionChanged(QListViewItem *))); | 513 | SLOT(selectionChanged(QListViewItem *))); |
508 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 514 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
509 | SLOT(selectionChanged(QListViewItem *))); | 515 | SLOT(selectionChanged(QListViewItem *))); |
510 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 516 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
511 | SLOT(selectionChanged(QListViewItem *))); | 517 | SLOT(selectionChanged(QListViewItem *))); |
512 | #endif | 518 | #endif |
513 | 519 | ||
514 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 520 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
515 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 521 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
@@ -525,33 +531,40 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
525 | KOTodoView::~KOTodoView() | 531 | KOTodoView::~KOTodoView() |
526 | { | 532 | { |
527 | delete mDocPrefs; | 533 | delete mDocPrefs; |
528 | } | 534 | } |
529 | 535 | ||
530 | void KOTodoView::jumpToDate () | 536 | void KOTodoView::jumpToDate () |
531 | { | 537 | { |
532 | // if (mActiveItem) { | 538 | // if (mActiveItem) { |
533 | // mActiveItem->todo()); | 539 | // mActiveItem->todo()); |
534 | // if ( mActiveItem->todo()->hasDueDate() ) | 540 | // if ( mActiveItem->todo()->hasDueDate() ) |
535 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 541 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
536 | } | 542 | } |
543 | void KOTodoView::paintNeeded() | ||
544 | { | ||
545 | if ( mPendingUpdateBeforeRepaint ) { | ||
546 | updateView(); | ||
547 | mPendingUpdateBeforeRepaint = false; | ||
548 | } | ||
549 | } | ||
537 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 550 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
538 | { | 551 | { |
539 | if ( mPendingUpdateBeforeRepaint ) { | 552 | if ( mPendingUpdateBeforeRepaint ) { |
540 | updateView(); | 553 | updateView(); |
541 | mPendingUpdateBeforeRepaint = false; | 554 | mPendingUpdateBeforeRepaint = false; |
542 | } | 555 | } |
543 | KOrg::BaseView::paintEvent( pevent); | 556 | KOrg::BaseView::paintEvent( pevent); |
544 | } | 557 | } |
545 | bool mPendingUpdateBeforeRepaint; | 558 | |
546 | void KOTodoView::updateView() | 559 | void KOTodoView::updateView() |
547 | { | 560 | { |
548 | pendingSubtodo = 0; | 561 | pendingSubtodo = 0; |
549 | if ( mBlockUpdate ) { | 562 | if ( mBlockUpdate ) { |
550 | return; | 563 | return; |
551 | } | 564 | } |
552 | if ( !isVisible() ) { | 565 | if ( !isVisible() ) { |
553 | mPendingUpdateBeforeRepaint = true; | 566 | mPendingUpdateBeforeRepaint = true; |
554 | return; | 567 | return; |
555 | } | 568 | } |
556 | //qDebug("KOTodoView::updateView() %x", this); | 569 | //qDebug("KOTodoView::updateView() %x", this); |
557 | if ( isFlatDisplay ) { | 570 | if ( isFlatDisplay ) { |