summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 2c017e1..c2ad886 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -373,64 +373,68 @@ void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
373 ICalDrag *vd = factory.createDrag( 373 ICalDrag *vd = factory.createDrag(
374 ((KOTodoViewItem *)item)->todo(),viewport()); 374 ((KOTodoViewItem *)item)->todo(),viewport());
375 internalDrop = false; 375 internalDrop = false;
376 // we cannot do any senseful here, because the DnD is still broken in Qt 376 // we cannot do any senseful here, because the DnD is still broken in Qt
377 if (vd->drag()) { 377 if (vd->drag()) {
378 if ( !internalDrop ) { 378 if ( !internalDrop ) {
379 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); 379 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() );
380 qDebug("Dnd: External move: Delete drag source "); 380 qDebug("Dnd: External move: Delete drag source ");
381 } else 381 } else
382 qDebug("Dnd: Internal move "); 382 qDebug("Dnd: Internal move ");
383 383
384 } else { 384 } else {
385 if ( !internalDrop ) { 385 if ( !internalDrop ) {
386 qDebug("Dnd: External Copy"); 386 qDebug("Dnd: External Copy");
387 } else 387 } else
388 qDebug("DnD: Internal copy: Copy pending"); 388 qDebug("DnD: Internal copy: Copy pending");
389 } 389 }
390 } 390 }
391 } 391 }
392#endif 392#endif
393} 393}
394void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) 394void KOTodoListView::keyReleaseEvent ( QKeyEvent *e )
395{ 395{
396 if ( !e->isAutoRepeat() ) { 396 if ( !e->isAutoRepeat() ) {
397 mFlagKeyPressed = false; 397 mFlagKeyPressed = false;
398 } 398 }
399} 399}
400 400
401 401
402void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 402void KOTodoListView::keyPressEvent ( QKeyEvent * e )
403{ 403{
404 qApp->processEvents(); 404 qApp->processEvents();
405 if ( !isVisible() ) {
406 e->ignore();
407 return;
408 }
405 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 409 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
406 e->ignore(); 410 e->ignore();
407 // qDebug(" ignore %d",e->isAutoRepeat() ); 411 // qDebug(" ignore %d",e->isAutoRepeat() );
408 return; 412 return;
409 } 413 }
410 if (! e->isAutoRepeat() ) 414 if (! e->isAutoRepeat() )
411 mFlagKeyPressed = true; 415 mFlagKeyPressed = true;
412 QListViewItem* cn; 416 QListViewItem* cn;
413 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 417 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
414 cn = currentItem(); 418 cn = currentItem();
415 if ( cn ) { 419 if ( cn ) {
416 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 420 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
417 if ( ci ){ 421 if ( ci ){
418 if ( e->state() == ShiftButton ) 422 if ( e->state() == ShiftButton )
419 ci->setOn( false ); 423 ci->setOn( false );
420 else 424 else
421 ci->setOn( true ); 425 ci->setOn( true );
422 cn = cn->itemBelow(); 426 cn = cn->itemBelow();
423 if ( cn ) { 427 if ( cn ) {
424 setCurrentItem ( cn ); 428 setCurrentItem ( cn );
425 ensureItemVisible ( cn ); 429 ensureItemVisible ( cn );
426 } 430 }
427 431
428 } 432 }
429 } 433 }
430 434
431 return; 435 return;
432 } 436 }
433 437
434 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 438 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
435 switch ( e->key() ) { 439 switch ( e->key() ) {
436 case Qt::Key_Down: 440 case Qt::Key_Down:
@@ -1570,72 +1574,82 @@ void KOTodoView::addQuickTodoPar( Todo * parentTodo)
1570{ 1574{
1571 Todo *todo = new Todo(); 1575 Todo *todo = new Todo();
1572 todo->setSummary(mQuickAdd->text()); 1576 todo->setSummary(mQuickAdd->text());
1573 todo->setOrganizer(KOPrefs::instance()->email()); 1577 todo->setOrganizer(KOPrefs::instance()->email());
1574 if ( parentTodo ) { 1578 if ( parentTodo ) {
1575 todo->setRelatedTo(parentTodo); 1579 todo->setRelatedTo(parentTodo);
1576 1580
1577 todo->setCategories (parentTodo->categoriesStr ()); 1581 todo->setCategories (parentTodo->categoriesStr ());
1578 todo->setSecrecy (parentTodo->secrecy ()); 1582 todo->setSecrecy (parentTodo->secrecy ());
1579 if ( parentTodo->priority() < 3 ) 1583 if ( parentTodo->priority() < 3 )
1580 todo->setPriority( parentTodo->priority() ); 1584 todo->setPriority( parentTodo->priority() );
1581 todo->setCalID( parentTodo->calID() ); 1585 todo->setCalID( parentTodo->calID() );
1582 } else { 1586 } else {
1583 CalFilter * cf = mCalendar->filter(); 1587 CalFilter * cf = mCalendar->filter();
1584 if ( cf ) { 1588 if ( cf ) {
1585 if ( cf->isEnabled()&& cf->showCategories()) { 1589 if ( cf->isEnabled()&& cf->showCategories()) {
1586 todo->setCategories(cf->categoryList()); 1590 todo->setCategories(cf->categoryList());
1587 } 1591 }
1588 if ( cf->isEnabled() ) 1592 if ( cf->isEnabled() )
1589 todo->setSecrecy( cf->getSecrecy()); 1593 todo->setSecrecy( cf->getSecrecy());
1590 } 1594 }
1591 } 1595 }
1592 mCalendar->addTodo(todo); 1596 mCalendar->addTodo(todo);
1593 mQuickAdd->setText(""); 1597 mQuickAdd->setText("");
1594 todoModified (todo, KOGlobals::EVENTADDED ); 1598 todoModified (todo, KOGlobals::EVENTADDED );
1595 updateView(); 1599 updateView();
1596 1600
1597} 1601}
1598void KOTodoView::keyPressEvent ( QKeyEvent * e ) 1602void KOTodoView::keyPressEvent ( QKeyEvent * e )
1599{ 1603{
1600 // e->ignore(); 1604 // e->ignore();
1601 //return; 1605 //return;
1602 //qDebug("KOTodoView::keyPressEvent "); 1606 //qDebug("KOTodoView::keyPressEvent ");
1607 if ( !isVisible() ) {
1608 e->ignore();
1609 return;
1610 }
1603 switch ( e->key() ) { 1611 switch ( e->key() ) {
1604 case Qt::Key_Down: 1612 case Qt::Key_Down:
1605 case Qt::Key_Up: 1613 case Qt::Key_Up:
1606 QWidget::keyPressEvent ( e ); 1614 QWidget::keyPressEvent ( e );
1607 break; 1615 break;
1608 1616
1609 case Qt::Key_Q: 1617 case Qt::Key_Q:
1618
1619
1620 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) {
1621 e->ignore();
1622 break;
1623 }
1610 toggleQuickTodo(); 1624 toggleQuickTodo();
1611 break; 1625 break;
1612 case Qt::Key_U: 1626 case Qt::Key_U:
1613 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1627 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1614 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1628 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1615 unparentTodo(); 1629 unparentTodo();
1616 e->accept(); 1630 e->accept();
1617 } else 1631 } else
1618 e->ignore(); 1632 e->ignore();
1619 break; 1633 break;
1620 case Qt::Key_S: 1634 case Qt::Key_S:
1621 if ( e->state() == Qt::ControlButton ) { 1635 if ( e->state() == Qt::ControlButton ) {
1622 e->ignore(); 1636 e->ignore();
1623 break; 1637 break;
1624 } 1638 }
1625 if ( e->state() == Qt::ShiftButton ) { 1639 if ( e->state() == Qt::ShiftButton ) {
1626 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1640 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1627 reparentTodo(); 1641 reparentTodo();
1628 e->accept(); 1642 e->accept();
1629 } else 1643 } else
1630 e->ignore(); 1644 e->ignore();
1631 break; 1645 break;
1632 case Qt::Key_P: 1646 case Qt::Key_P:
1633 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1647 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1634 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1648 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1635 if ( pendingSubtodo ) 1649 if ( pendingSubtodo )
1636 itemClicked(mActiveItem); 1650 itemClicked(mActiveItem);
1637 e->accept(); 1651 e->accept();
1638 } else 1652 } else
1639 e->ignore(); 1653 e->ignore();
1640 break; 1654 break;
1641 case Qt::Key_Escape: 1655 case Qt::Key_Escape: