[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim/KDE/4.11] calendarviews/agenda: Fix dragging to all day area.
From:       Sergio Martins <iamsergio () gmail ! com>
Date:       2013-09-30 18:47:56
Message-ID: E1VQiVg-00045k-AA () scm ! kde ! org
[Download RAW message or body]

Git commit 5c48802939da3cd623b7e0db0af291b9593b26c7 by Sergio Martins.
Committed on 30/09/2013 at 18:45.
Pushed by smartins into branch 'KDE/4.11'.

Fix dragging to all day area.

"From" already worked.

M  +4    -4    calendarviews/agenda/agenda.cpp

http://commits.kde.org/kdepim/5c48802939da3cd623b7e0db0af291b9593b26c7

diff --git a/calendarviews/agenda/agenda.cpp b/calendarviews/agenda/agenda.cpp
index aa18eef..20970df 100644
--- a/calendarviews/agenda/agenda.cpp
+++ b/calendarviews/agenda/agenda.cpp
@@ -842,8 +842,7 @@ void Agenda::performSelectAction( const QPoint &pos )
   const QPoint gpos = contentsToGrid( pos );
 
   // Scroll if cursor was moved to upper or lower end of agenda.
-  if ( pos.y() - contentsY() < d->mScrollBorderWidth &&
-       contentsY() > 0 ) {
+  if ( pos.y() - contentsY() < d->mScrollBorderWidth && contentsY() > 0 ) {
     d->mScrollUpTimer.start( d->mScrollDelay );
   } else if ( contentsY() + d->mScrollArea->viewport()->height() -
               d->mScrollBorderWidth < pos.y() ) {
@@ -984,7 +983,8 @@ void Agenda::performItemAction( const QPoint &pos )
   }
 
   // Scroll if item was moved to upper or lower end of agenda.
-  if ( pos.y() - contentsY() < d->mScrollBorderWidth ) {
+  const int distanceToTop = pos.y() - contentsY();
+  if ( distanceToTop < d->mScrollBorderWidth && distanceToTop > -d->mScrollBorderWidth ) {
     d->mScrollUpTimer.start( d->mScrollDelay );
   } else if ( contentsY() + d->mScrollArea->viewport()->height() -
               d->mScrollBorderWidth < pos.y() ) {
@@ -1039,7 +1039,7 @@ void Agenda::performItemAction( const QPoint &pos )
         if ( moveItem == firstItem && !d->mAllDayMode ) { // is the first item
           int newY = deltapos.y() + moveItem->cellYTop();
           // If event start moved earlier than 0:00, it starts the previous day
-          if ( newY < 0 ) {
+          if ( newY < 0 && newY > d->mScrollBorderWidth ) {
             moveItem->expandTop( -moveItem->cellYTop() );
             // prepend a new item at ( x-1, rows()+newY to rows() )
             AgendaItem::QPtr newFirst = firstItem->prevMoveItem();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic