-rw-r--r-- | korganizer/kotodoview.cpp | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index ccc4b01..0a315cb 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -209,6 +209,6 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) { -#ifndef KORG_NODND + QPoint p(contentsToViewport(e->pos())); QListViewItem *i = itemAt(p); - mMousePressed = false; + bool rootClicked = true; if (i) { @@ -216,14 +216,25 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) // try to start a drag! - if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + + int X = p.x(); + //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); + if (X > header()->sectionPos(0) + treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + itemMargin() || - p.x() < header()->sectionPos(header()->mapToIndex(0))) { - if (e->button()==Qt::LeftButton) { - mPressPos = e->pos(); - mMousePressed = true; + X < header()->sectionPos(0)) { + rootClicked = false; } } +#ifndef KORG_NODND + mMousePressed = false; + if (! rootClicked ) { + mPressPos = e->pos(); + mMousePressed = true; } #endif + //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); +#ifndef DESKTOP_VERSION + if (!( e->button() == RightButton && rootClicked) ) + QListView::contentsMousePressEvent(e); +#else QListView::contentsMousePressEvent(e); +#endif } @@ -1065,2 +1076,4 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) pendingSubtodo = 0; + int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); + //qDebug("ROW %d ", row); if (!item) { @@ -1068,2 +1081,8 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) return; + } else { + if ( row == 1 ) { + mActiveItem = (KOTodoViewItem *) item; + newSubTodo(); + return; + } } @@ -1076,3 +1095,3 @@ void KOTodoView::itemClicked(QListViewItem *item) { - + //qDebug("KOTodoView::itemClicked %d", item); if (!item) { |