author | zautrix <zautrix> | 2005-04-02 12:16:34 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-02 12:16:34 (UTC) |
commit | 997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe (patch) (side-by-side diff) | |
tree | f788b37459574b5cea0d2ab874882c6a396c240d /korganizer/kotodoview.cpp | |
parent | e0d51120d2f0c178115746e0c1357af40f95bc77 (diff) | |
download | kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.zip kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.gz kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.bz2 |
more fixes
-rw-r--r-- | korganizer/kotodoview.cpp | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index ccc4b01..0a315cb 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -206,27 +206,38 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e) } void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) { + + QPoint p(contentsToViewport(e->pos())); + QListViewItem *i = itemAt(p); + bool rootClicked = true; + if (i) { + // if the user clicked into the root decoration of the item, don't + // try to start a drag! + 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() || + X < header()->sectionPos(0)) { + rootClicked = false; + } + } #ifndef KORG_NODND - QPoint p(contentsToViewport(e->pos())); - QListViewItem *i = itemAt(p); - mMousePressed = false; - if (i) { - // if the user clicked into the root decoration of the item, don't - // try to start a drag! - if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + - treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + - itemMargin() || - p.x() < header()->sectionPos(header()->mapToIndex(0))) { - if (e->button()==Qt::LeftButton) { + mMousePressed = false; + if (! rootClicked ) { mPressPos = e->pos(); mMousePressed = true; - } } - } #endif - QListView::contentsMousePressEvent(e); + //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); +#ifndef DESKTOP_VERSION + if (!( e->button() == RightButton && rootClicked) ) + QListView::contentsMousePressEvent(e); +#else + QListView::contentsMousePressEvent(e); +#endif } void KOTodoListView::paintEvent(QPaintEvent* e) { emit paintNeeded(); @@ -1062,20 +1073,28 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) if ( pendingSubtodo != 0 ) { topLevelWidget()->setCaption(i18n("Reparenting aborted!")); } pendingSubtodo = 0; + int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); + //qDebug("ROW %d ", row); if (!item) { newTodo(); return; + } else { + if ( row == 1 ) { + mActiveItem = (KOTodoViewItem *) item; + newSubTodo(); + return; + } } if ( KOPrefs::instance()->mEditOnDoubleClick ) editItem( item ); else showItem( item , QPoint(), 0 ); } void KOTodoView::itemClicked(QListViewItem *item) { - + //qDebug("KOTodoView::itemClicked %d", item); if (!item) { if ( pendingSubtodo != 0 ) { topLevelWidget()->setCaption(i18n("Reparenting aborted!")); } |