summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp49
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)
206} 206}
207 207
208void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 208void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
209{ 209{
210
211 QPoint p(contentsToViewport(e->pos()));
212 QListViewItem *i = itemAt(p);
213 bool rootClicked = true;
214 if (i) {
215 // if the user clicked into the root decoration of the item, don't
216 // try to start a drag!
217 int X = p.x();
218 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
219 if (X > header()->sectionPos(0) +
220 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
221 itemMargin() ||
222 X < header()->sectionPos(0)) {
223 rootClicked = false;
224 }
225 }
210#ifndef KORG_NODND 226#ifndef KORG_NODND
211 QPoint p(contentsToViewport(e->pos())); 227 mMousePressed = false;
212 QListViewItem *i = itemAt(p); 228 if (! rootClicked ) {
213 mMousePressed = false;
214 if (i) {
215 // if the user clicked into the root decoration of the item, don't
216 // try to start a drag!
217 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) +
218 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
219 itemMargin() ||
220 p.x() < header()->sectionPos(header()->mapToIndex(0))) {
221 if (e->button()==Qt::LeftButton) {
222 mPressPos = e->pos(); 229 mPressPos = e->pos();
223 mMousePressed = true; 230 mMousePressed = true;
224 }
225 } 231 }
226 }
227#endif 232#endif
228 QListView::contentsMousePressEvent(e); 233 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
234#ifndef DESKTOP_VERSION
235 if (!( e->button() == RightButton && rootClicked) )
236 QListView::contentsMousePressEvent(e);
237#else
238 QListView::contentsMousePressEvent(e);
239#endif
229} 240}
230void KOTodoListView::paintEvent(QPaintEvent* e) 241void KOTodoListView::paintEvent(QPaintEvent* e)
231{ 242{
232 emit paintNeeded(); 243 emit paintNeeded();
@@ -1062,20 +1073,28 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
1062 if ( pendingSubtodo != 0 ) { 1073 if ( pendingSubtodo != 0 ) {
1063 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1074 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1064 } 1075 }
1065 pendingSubtodo = 0; 1076 pendingSubtodo = 0;
1077 int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1078 //qDebug("ROW %d ", row);
1066 if (!item) { 1079 if (!item) {
1067 newTodo(); 1080 newTodo();
1068 return; 1081 return;
1082 } else {
1083 if ( row == 1 ) {
1084 mActiveItem = (KOTodoViewItem *) item;
1085 newSubTodo();
1086 return;
1087 }
1069 } 1088 }
1070 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1089 if ( KOPrefs::instance()->mEditOnDoubleClick )
1071 editItem( item ); 1090 editItem( item );
1072 else 1091 else
1073 showItem( item , QPoint(), 0 ); 1092 showItem( item , QPoint(), 0 );
1074} 1093}
1075void KOTodoView::itemClicked(QListViewItem *item) 1094void KOTodoView::itemClicked(QListViewItem *item)
1076{ 1095{
1077 1096 //qDebug("KOTodoView::itemClicked %d", item);
1078 if (!item) { 1097 if (!item) {
1079 if ( pendingSubtodo != 0 ) { 1098 if ( pendingSubtodo != 0 ) {
1080 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1099 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1081 } 1100 }