diff -r ea672fcb0ea0 -r 360d55486d7f calendarui/views/src/calenmonthgrid.cpp --- a/calendarui/views/src/calenmonthgrid.cpp Thu May 27 12:51:15 2010 +0300 +++ b/calendarui/views/src/calenmonthgrid.cpp Fri Jun 11 13:37:54 2010 +0300 @@ -945,6 +945,29 @@ Q_UNUSED(newOrientation) // We are overriding this function to avoid the default behavior of // hbgridview on orientation change as it swaps the row and column counts + // Calculate the proper index to be scrolled to + int rowsInPrevMonth; + int itemToBeScrolled; + QModelIndex indexToBeScrolled; + if (newOrientation == Qt::Horizontal) { + rowsInPrevMonth = mView->rowsInPrevMonth(); + itemToBeScrolled = rowsInPrevMonth * KCalenDaysInWeek; + indexToBeScrolled = mModel->index(itemToBeScrolled, 0); + mIsAtomicScroll = true; + scrollTo(indexToBeScrolled); + } else { + rowsInPrevMonth = mView->rowsInPrevMonth(); + itemToBeScrolled = rowsInPrevMonth * KCalenDaysInWeek; + indexToBeScrolled = mModel->index(itemToBeScrolled, 0); + mIsAtomicScroll = true; + scrollTo(indexToBeScrolled); + + itemToBeScrolled = ((rowsInPrevMonth + KNumOfVisibleRows) * + KCalenDaysInWeek) - 1; + indexToBeScrolled = mModel->index(itemToBeScrolled, 0); + mIsAtomicScroll = true; + scrollTo(indexToBeScrolled); + } } /*!