author | zautrix <zautrix> | 2005-07-07 20:46:00 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-07 20:46:00 (UTC) |
commit | de5621f2fd3924f27c05459ae555b3bd06c5e584 (patch) (side-by-side diff) | |
tree | 589d19415e3c0ff6c08cec375db145242581c143 /korganizer/kotodoview.cpp | |
parent | 766b53919de14b8faec22db32b6a750acde0b760 (diff) | |
download | kdepimpi-de5621f2fd3924f27c05459ae555b3bd06c5e584.zip kdepimpi-de5621f2fd3924f27c05459ae555b3bd06c5e584.tar.gz kdepimpi-de5621f2fd3924f27c05459ae555b3bd06c5e584.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/kotodoview.cpp | 16 |
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 @@ -357,96 +357,100 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) void KOTodoListView::paintEvent(QPaintEvent* e) { emit paintNeeded(); QListView::paintEvent( e); } void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) { #ifndef KORG_NODND //QListView::contentsMouseMoveEvent(e); if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > QApplication::startDragDistance()*3) { mMousePressed = false; QListViewItem *item = itemAt(contentsToViewport(mPressPos)); if (item) { DndFactory factory( mCalendar ); ICalDrag *vd = factory.createDrag( ((KOTodoViewItem *)item)->todo(),viewport()); internalDrop = false; // we cannot do any senseful here, because the DnD is still broken in Qt if (vd->drag()) { if ( !internalDrop ) { //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); qDebug("Dnd: External move: Delete drag source "); } else qDebug("Dnd: Internal move "); } else { if ( !internalDrop ) { qDebug("Dnd: External Copy"); } else qDebug("DnD: Internal copy: Copy pending"); } } } #endif } void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) { if ( !e->isAutoRepeat() ) { mFlagKeyPressed = false; } } void KOTodoListView::keyPressEvent ( QKeyEvent * e ) { qApp->processEvents(); + if ( !isVisible() ) { + e->ignore(); + return; + } if ( e->isAutoRepeat() && !mFlagKeyPressed ) { e->ignore(); // qDebug(" ignore %d",e->isAutoRepeat() ); return; } if (! e->isAutoRepeat() ) mFlagKeyPressed = true; QListViewItem* cn; if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { cn = currentItem(); if ( cn ) { KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); if ( ci ){ if ( e->state() == ShiftButton ) ci->setOn( false ); else ci->setOn( true ); cn = cn->itemBelow(); if ( cn ) { setCurrentItem ( cn ); ensureItemVisible ( cn ); } } } return; } if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { switch ( e->key() ) { case Qt::Key_Down: case Qt::Key_Up: QListView::keyPressEvent ( e ); break; case Qt::Key_Left: case Qt::Key_Right: QListView::keyPressEvent ( e ); e->accept(); return; break; default: e->ignore(); break; } return; } e->ignore(); @@ -1554,104 +1558,114 @@ void KOTodoView::toggleCompleted() { KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); updateView(); if ( KOPrefs::instance()->mShowCompletedTodo ) topLevelWidget()->setCaption(i18n("Show Completed")); else topLevelWidget()->setCaption(i18n("Hide Completed")); } void KOTodoView::addQuickTodo() { addQuickTodoPar( 0 ); } void KOTodoView::addQuickTodoPar( Todo * parentTodo) { Todo *todo = new Todo(); todo->setSummary(mQuickAdd->text()); todo->setOrganizer(KOPrefs::instance()->email()); if ( parentTodo ) { todo->setRelatedTo(parentTodo); todo->setCategories (parentTodo->categoriesStr ()); todo->setSecrecy (parentTodo->secrecy ()); if ( parentTodo->priority() < 3 ) todo->setPriority( parentTodo->priority() ); todo->setCalID( parentTodo->calID() ); } else { CalFilter * cf = mCalendar->filter(); if ( cf ) { if ( cf->isEnabled()&& cf->showCategories()) { todo->setCategories(cf->categoryList()); } if ( cf->isEnabled() ) todo->setSecrecy( cf->getSecrecy()); } } mCalendar->addTodo(todo); mQuickAdd->setText(""); todoModified (todo, KOGlobals::EVENTADDED ); updateView(); } void KOTodoView::keyPressEvent ( QKeyEvent * e ) { // e->ignore(); //return; - //qDebug("KOTodoView::keyPressEvent "); + //qDebug("KOTodoView::keyPressEvent "); + if ( !isVisible() ) { + e->ignore(); + return; + } switch ( e->key() ) { case Qt::Key_Down: case Qt::Key_Up: QWidget::keyPressEvent ( e ); break; case Qt::Key_Q: + + + if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) { + e->ignore(); + break; + } 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->ignore(); break; } if ( 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(); } if ( true ) { if ( e->key() == Qt::Key_I ) { KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); if ( cn ) { mActiveItem = cn; KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |