summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp35
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
@@ -202,35 +202,46 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
202 e->ignore(); 202 e->ignore();
203 } 203 }
204 } 204 }
205#endif 205#endif
206} 206}
207 207
208void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 208void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
209{ 209{
210#ifndef KORG_NODND 210
211 QPoint p(contentsToViewport(e->pos())); 211 QPoint p(contentsToViewport(e->pos()));
212 QListViewItem *i = itemAt(p); 212 QListViewItem *i = itemAt(p);
213 mMousePressed = false; 213 bool rootClicked = true;
214 if (i) { 214 if (i) {
215 // if the user clicked into the root decoration of the item, don't 215 // if the user clicked into the root decoration of the item, don't
216 // try to start a drag! 216 // try to start a drag!
217 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + 217 int X = p.x();
218 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
219 if (X > header()->sectionPos(0) +
218 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 220 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
219 itemMargin() || 221 itemMargin() ||
220 p.x() < header()->sectionPos(header()->mapToIndex(0))) { 222 X < header()->sectionPos(0)) {
221 if (e->button()==Qt::LeftButton) { 223 rootClicked = false;
222 mPressPos = e->pos();
223 mMousePressed = true;
224 } 224 }
225 } 225 }
226#ifndef KORG_NODND
227 mMousePressed = false;
228 if (! rootClicked ) {
229 mPressPos = e->pos();
230 mMousePressed = true;
226 } 231 }
227#endif 232#endif
233 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
234#ifndef DESKTOP_VERSION
235 if (!( e->button() == RightButton && rootClicked) )
236 QListView::contentsMousePressEvent(e);
237#else
228 QListView::contentsMousePressEvent(e); 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();
233 QListView::paintEvent( e); 244 QListView::paintEvent( e);
234} 245}
235void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 246void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
236{ 247{
@@ -1058,28 +1069,36 @@ void KOTodoView::changedCategories(int index)
1058 } 1069 }
1059} 1070}
1060void KOTodoView::itemDoubleClicked(QListViewItem *item) 1071void KOTodoView::itemDoubleClicked(QListViewItem *item)
1061{ 1072{
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 }
1082 pendingSubtodo = 0; 1101 pendingSubtodo = 0;
1083 return; 1102 return;
1084 } 1103 }
1085 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1104 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;