summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
Unidiff
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagenda.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 1a24887..9720f43 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -147,193 +147,193 @@ void MarcusBains::updateLocation(bool recalculate)
147 // somewhere, where the last column of this widget is a few pixels 147 // somewhere, where the last column of this widget is a few pixels
148 // narrower than the other columns. 148 // narrower than the other columns.
149 int offs = (today==agenda->columns()-1) ? -4 : 0; 149 int offs = (today==agenda->columns()-1) ? -4 : 0;
150 agenda->moveChild(mTimeBox, 150 agenda->moveChild(mTimeBox,
151 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, 151 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1,
152 y-mTimeBox->height()); 152 y-mTimeBox->height());
153 153
154 mTimeBox->raise(); 154 mTimeBox->raise();
155 //mTimeBox->setAutoMask(true); 155 //mTimeBox->setAutoMask(true);
156 minutes->start(5000,true); 156 minutes->start(5000,true);
157} 157}
158 158
159 159
160//////////////////////////////////////////////////////////////////////////// 160////////////////////////////////////////////////////////////////////////////
161 161
162 162
163/* 163/*
164 Create an agenda widget with rows rows and columns columns. 164 Create an agenda widget with rows rows and columns columns.
165*/ 165*/
166KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, 166KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
167 const char *name,WFlags f) : 167 const char *name,WFlags f) :
168 QScrollView(parent,name,f) 168 QScrollView(parent,name,f)
169{ 169{
170 170
171 171
172 mColumns = columns; 172 mColumns = columns;
173 mRows = rows; 173 mRows = rows;
174 mGridSpacingY = rowSize; 174 mGridSpacingY = rowSize;
175 mAllDayMode = false; 175 mAllDayMode = false;
176#ifndef DESKTOP_VERSION 176#ifndef DESKTOP_VERSION
177 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 177 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
178#endif 178#endif
179 mHolidayMask = 0; 179 mHolidayMask = 0;
180 init(); 180 init();
181} 181}
182 182
183/* 183/*
184 Create an agenda widget with columns columns and one row. This is used for 184 Create an agenda widget with columns columns and one row. This is used for
185 all-day events. 185 all-day events.
186*/ 186*/
187KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : 187KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
188 QScrollView(parent,name,f) 188 QScrollView(parent,name,f)
189{ 189{
190 blockResize = false; 190 blockResize = false;
191 mColumns = columns; 191 mColumns = columns;
192 mRows = 1; 192 mRows = 1;
193 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); 193 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize);
194 mGridSpacingY = KOPrefs::instance()->mAllDaySize; 194 mGridSpacingY = KOPrefs::instance()->mAllDaySize;
195 mAllDayMode = true; 195 mAllDayMode = true;
196#ifndef DESKTOP_VERSION 196#ifndef DESKTOP_VERSION
197 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 197 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
198#endif 198#endif
199 mHolidayMask = 0; 199 mHolidayMask = 0;
200 init(); 200 init();
201} 201}
202 202
203 203
204KOAgenda::~KOAgenda() 204KOAgenda::~KOAgenda()
205{ 205{
206 if(mMarcusBains) delete mMarcusBains; 206 if(mMarcusBains) delete mMarcusBains;
207 207
208} 208}
209 209
210Incidence *KOAgenda::selectedIncidence() const 210Incidence *KOAgenda::selectedIncidence() const
211{ 211{
212 return (mSelectedItem ? mSelectedItem->incidence() : 0); 212 return (mSelectedItem ? mSelectedItem->incidence() : 0);
213} 213}
214 214
215 215
216QDate KOAgenda::selectedIncidenceDate() const 216QDate KOAgenda::selectedIncidenceDate() const
217{ 217{
218 return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); 218 return (mSelectedItem ? mSelectedItem->itemDate() : QDate());
219} 219}
220 220
221 221
222void KOAgenda::init() 222void KOAgenda::init()
223{ 223{
224 mPopupTimer = new QTimer(this); 224 mPopupTimer = new QTimer(this);
225 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 225 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
226 226
227 mNewItemPopup = new QPopupMenu( this ); 227 mNewItemPopup = new QPopupMenu( this );
228 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); 228 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
229 QString pathString = ""; 229 QString pathString = "";
230 if ( !KOPrefs::instance()->mToolBarMiniIcons ) { 230 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
231 if ( QApplication::desktop()->width() < 480 ) 231 if ( QApplication::desktop()->width() < 480 )
232 pathString += "icons16/"; 232 pathString += "icons16/";
233 } else 233 } else
234 pathString += "iconsmini/"; 234 pathString += "iconsmini/";
235 235
236 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); 236 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
237 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); 237 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
238 mNewItemPopup->insertSeparator ( ); 238 mNewItemPopup->insertSeparator ( );
239 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); 239 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 );
240 mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); 240 mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 );
241 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); 241 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 );
242 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); 242 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 );
243 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next month"),6 ); 243 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 );
244 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); 244 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
245#ifndef _WIN32_ 245#ifndef _WIN32_
246 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase 246 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase
247 viewport()->setWFlags ( wflags); 247 viewport()->setWFlags ( wflags);
248#endif 248#endif
249 mGridSpacingX = 80; 249 mGridSpacingX = 80;
250 mResizeBorderWidth = 8; 250 mResizeBorderWidth = 8;
251 mScrollBorderWidth = 8; 251 mScrollBorderWidth = 8;
252 mScrollDelay = 30; 252 mScrollDelay = 30;
253 mScrollOffset = 10; 253 mScrollOffset = 10;
254 mPaintPixmap.resize( 20,20); 254 mPaintPixmap.resize( 20,20);
255 //enableClipper(true); 255 //enableClipper(true);
256 256
257 // Grab key strokes for keyboard navigation of agenda. Seems to have no 257 // Grab key strokes for keyboard navigation of agenda. Seems to have no
258 // effect. Has to be fixed. 258 // effect. Has to be fixed.
259 setFocusPolicy(WheelFocus); 259 setFocusPolicy(WheelFocus);
260 260
261 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); 261 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp()));
262 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); 262 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown()));
263 connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); 263 connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize()));
264 264
265 mStartCellX = 0; 265 mStartCellX = 0;
266 mStartCellY = 0; 266 mStartCellY = 0;
267 mCurrentCellX = 0; 267 mCurrentCellX = 0;
268 mCurrentCellY = 0; 268 mCurrentCellY = 0;
269 269
270 mSelectionCellX = 0; 270 mSelectionCellX = 0;
271 mSelectionYTop = 0; 271 mSelectionYTop = 0;
272 mSelectionHeight = 0; 272 mSelectionHeight = 0;
273 273
274 mOldLowerScrollValue = -1; 274 mOldLowerScrollValue = -1;
275 mOldUpperScrollValue = -1; 275 mOldUpperScrollValue = -1;
276 276
277 mClickedItem = 0; 277 mClickedItem = 0;
278 278
279 mActionItem = 0; 279 mActionItem = 0;
280 mActionType = NOP; 280 mActionType = NOP;
281 mItemMoved = false; 281 mItemMoved = false;
282 282
283 mSelectedItem = 0; 283 mSelectedItem = 0;
284 284
285 // mItems.setAutoDelete(true); 285 // mItems.setAutoDelete(true);
286 286
287 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 287 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
288 288
289 viewport()->update(); 289 viewport()->update();
290 290
291 setMinimumSize(30, 1); 291 setMinimumSize(30, 1);
292// setMaximumHeight(mGridSpacingY * mRows + 5); 292// setMaximumHeight(mGridSpacingY * mRows + 5);
293 293
294 // Disable horizontal scrollbar. This is a hack. The geometry should be 294 // Disable horizontal scrollbar. This is a hack. The geometry should be
295 // controlled in a way that the contents horizontally always fits. Then it is 295 // controlled in a way that the contents horizontally always fits. Then it is
296 // not necessary to turn off the scrollbar. 296 // not necessary to turn off the scrollbar.
297 setHScrollBarMode(AlwaysOff); 297 setHScrollBarMode(AlwaysOff);
298 if ( ! mAllDayMode ) 298 if ( ! mAllDayMode )
299 setVScrollBarMode(AlwaysOn); 299 setVScrollBarMode(AlwaysOn);
300 else 300 else
301 setVScrollBarMode(AlwaysOff); 301 setVScrollBarMode(AlwaysOff);
302 302
303 setStartHour(KOPrefs::instance()->mDayBegins); 303 setStartHour(KOPrefs::instance()->mDayBegins);
304 304
305 calculateWorkingHours(); 305 calculateWorkingHours();
306 306
307 connect(verticalScrollBar(),SIGNAL(valueChanged(int)), 307 connect(verticalScrollBar(),SIGNAL(valueChanged(int)),
308 SLOT(checkScrollBoundaries(int))); 308 SLOT(checkScrollBoundaries(int)));
309 309
310 // Create the Marcus Bains line. 310 // Create the Marcus Bains line.
311 if(mAllDayMode) 311 if(mAllDayMode)
312 mMarcusBains = 0; 312 mMarcusBains = 0;
313 else { 313 else {
314 mMarcusBains = new MarcusBains(this); 314 mMarcusBains = new MarcusBains(this);
315 addChild(mMarcusBains); 315 addChild(mMarcusBains);
316 } 316 }
317 mPopupKind = 0; 317 mPopupKind = 0;
318 mPopupItem = 0; 318 mPopupItem = 0;
319} 319}
320 320
321void KOAgenda::clear() 321void KOAgenda::clear()
322{ 322{
323 KOAgendaItem *item; 323 KOAgendaItem *item;
324 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 324 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
325 mUnusedItems.append( item ); 325 mUnusedItems.append( item );
326 //item->hide(); 326 //item->hide();
327 } 327 }
328 mItems.clear(); 328 mItems.clear();
329 mSelectedItem = 0; 329 mSelectedItem = 0;
330 clearSelection(); 330 clearSelection();
331} 331}
332 332
333void KOAgenda::clearSelection() 333void KOAgenda::clearSelection()
334{ 334{
335 mSelectionCellX = 0; 335 mSelectionCellX = 0;
336 mSelectionYTop = 0; 336 mSelectionYTop = 0;
337 mSelectionHeight = 0; 337 mSelectionHeight = 0;
338} 338}
339 339
@@ -661,194 +661,193 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
661 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { 661 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) {
662 mScrollUpTimer.stop(); 662 mScrollUpTimer.stop();
663 mScrollDownTimer.stop(); 663 mScrollDownTimer.stop();
664 mActionItem->resetMove(); 664 mActionItem->resetMove();
665 placeSubCells( mActionItem ); 665 placeSubCells( mActionItem );
666 // emit startDragSignal( mActionItem->incidence() ); 666 // emit startDragSignal( mActionItem->incidence() );
667 setCursor( arrowCursor ); 667 setCursor( arrowCursor );
668 mActionItem = 0; 668 mActionItem = 0;
669 mActionType = NOP; 669 mActionType = NOP;
670 mItemMoved = 0; 670 mItemMoved = 0;
671 leftMouseDown = false; 671 leftMouseDown = false;
672 return true; 672 return true;
673 } 673 }
674 endItemAction(); 674 endItemAction();
675 } 675 }
676 } 676 }
677 677
678 } else { // ---------- viewport() 678 } else { // ---------- viewport()
679 if (me->button() == LeftButton && leftMouseDown ) { //left click 679 if (me->button() == LeftButton && leftMouseDown ) { //left click
680 endSelectAction( true ); // emit new event signal 680 endSelectAction( true ); // emit new event signal
681 } 681 }
682 } 682 }
683 if (me->button() == LeftButton) 683 if (me->button() == LeftButton)
684 leftMouseDown = false; 684 leftMouseDown = false;
685 685
686 break; 686 break;
687 687
688 case QEvent::MouseMove: 688 case QEvent::MouseMove:
689 if ( !leftMouseDown ) 689 if ( !leftMouseDown )
690 return true; 690 return true;
691 if ( blockMoving ) { 691 if ( blockMoving ) {
692 int dX, dY; 692 int dX, dY;
693 dX = startX - viewportPos.x(); 693 dX = startX - viewportPos.x();
694 if ( dX < 0 ) 694 if ( dX < 0 )
695 dX = -dX; 695 dX = -dX;
696 dY = viewportPos.y() - startY; 696 dY = viewportPos.y() - startY;
697 if ( dY < 0 ) 697 if ( dY < 0 )
698 dY = -dY; 698 dY = -dY;
699 //qDebug("%d %d %d ", dX, dY , blockmoveDist ); 699 //qDebug("%d %d %d ", dX, dY , blockmoveDist );
700 if ( dX > blockmoveDist || dY > blockmoveDist ) { 700 if ( dX > blockmoveDist || dY > blockmoveDist ) {
701 blockMoving = false; 701 blockMoving = false;
702 } 702 }
703 } 703 }
704 if (object != viewport()) { 704 if (object != viewport()) {
705 KOAgendaItem *moveItem = (KOAgendaItem *)object; 705 KOAgendaItem *moveItem = (KOAgendaItem *)object;
706 if (!moveItem->incidence()->isReadOnly() ) { 706 if (!moveItem->incidence()->isReadOnly() ) {
707 if (!mActionItem) 707 if (!mActionItem)
708 setNoActionCursor(moveItem,viewportPos); 708 setNoActionCursor(moveItem,viewportPos);
709 else { 709 else {
710 if ( !blockMoving ) 710 if ( !blockMoving )
711 performItemAction(viewportPos); 711 performItemAction(viewportPos);
712 } 712 }
713 } 713 }
714 } else { // ---------- viewport() 714 } else { // ---------- viewport()
715 if ( mActionType == SELECT ) { 715 if ( mActionType == SELECT ) {
716 performSelectAction( viewportPos ); 716 performSelectAction( viewportPos );
717 } 717 }
718 } 718 }
719 break; 719 break;
720 720
721 case QEvent::MouseButtonDblClick: 721 case QEvent::MouseButtonDblClick:
722 blockMoving = false; 722 blockMoving = false;
723 leftMouseDown = false; 723 leftMouseDown = false;
724 if (object == viewport()) { 724 if (object == viewport()) {
725 selectItem(0); 725 selectItem(0);
726 int x,y; 726 int x,y;
727 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 727 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
728 int gx,gy; 728 int gx,gy;
729 contentsToGrid(x,y,gx,gy); 729 contentsToGrid(x,y,gx,gy);
730 emit newEventSignal(gx,gy); 730 emit newEventSignal(gx,gy);
731 } else { 731 } else {
732 KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; 732 KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object;
733 selectItem(doubleClickedItem); 733 selectItem(doubleClickedItem);
734 if ( KOPrefs::instance()->mEditOnDoubleClick ) 734 if ( KOPrefs::instance()->mEditOnDoubleClick )
735 emit editIncidenceSignal(doubleClickedItem->incidence()); 735 emit editIncidenceSignal(doubleClickedItem->incidence());
736 else 736 else
737 emit showIncidenceSignal(doubleClickedItem->incidence()); 737 emit showIncidenceSignal(doubleClickedItem->incidence());
738 } 738 }
739 break; 739 break;
740 740
741 default: 741 default:
742 break; 742 break;
743 } 743 }
744 return true; 744 return true;
745#endif 745#endif
746} 746}
747 747
748void KOAgenda::newItem( int item ) 748void KOAgenda::newItem( int item )
749{ 749{
750 if ( item == 1 ) { //new event 750 if ( item == 1 ) { //new event
751 newEventSignal(mStartCellX ,mStartCellY ); 751 newEventSignal(mStartCellX ,mStartCellY );
752 } else 752 } else
753 if ( item == 2 ) { //new event 753 if ( item == 2 ) { //new event
754 newTodoSignal(mStartCellX ,mStartCellY ); 754 newTodoSignal(mStartCellX ,mStartCellY );
755 } else 755 } else
756 { 756 {
757 QDate day = mSelectedDates[mStartCellX]; 757 emit showDateView( item, mStartCellX );
758 emit showDateView( item, day );
759 // 3Day view 758 // 3Day view
760 // 4Week view 759 // 4Week view
761 // 5Month view 760 // 5Month view
762 // 6Journal view 761 // 6Journal view
763 } 762 }
764} 763}
765void KOAgenda::startSelectAction(QPoint viewportPos) 764void KOAgenda::startSelectAction(QPoint viewportPos)
766{ 765{
767 //emit newStartSelectSignal(); 766 //emit newStartSelectSignal();
768 767
769 mActionType = SELECT; 768 mActionType = SELECT;
770 769
771 int x,y; 770 int x,y;
772 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 771 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
773 int gx,gy; 772 int gx,gy;
774 contentsToGrid(x,y,gx,gy); 773 contentsToGrid(x,y,gx,gy);
775 774
776 mStartCellX = gx; 775 mStartCellX = gx;
777 mStartCellY = gy; 776 mStartCellY = gy;
778 mCurrentCellX = gx; 777 mCurrentCellX = gx;
779 mCurrentCellY = gy; 778 mCurrentCellY = gy;
780 779
781 // Store coordinates of old selection 780 // Store coordinates of old selection
782 int selectionX = mSelectionCellX * mGridSpacingX; 781 int selectionX = mSelectionCellX * mGridSpacingX;
783 int selectionYTop = mSelectionYTop; 782 int selectionYTop = mSelectionYTop;
784 int selectionHeight = mSelectionHeight; 783 int selectionHeight = mSelectionHeight;
785 784
786 // Store new selection 785 // Store new selection
787 mSelectionCellX = gx; 786 mSelectionCellX = gx;
788 mSelectionYTop = gy * mGridSpacingY; 787 mSelectionYTop = gy * mGridSpacingY;
789 mSelectionHeight = mGridSpacingY; 788 mSelectionHeight = mGridSpacingY;
790 789
791 // Clear old selection 790 // Clear old selection
792 repaintContents( selectionX, selectionYTop, 791 repaintContents( selectionX, selectionYTop,
793 mGridSpacingX, selectionHeight,false ); 792 mGridSpacingX, selectionHeight,false );
794 793
795 // Paint new selection 794 // Paint new selection
796 // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop, 795 // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop,
797 // mGridSpacingX, mSelectionHeight ); 796 // mGridSpacingX, mSelectionHeight );
798} 797}
799 798
800void KOAgenda::performSelectAction(QPoint viewportPos) 799void KOAgenda::performSelectAction(QPoint viewportPos)
801{ 800{
802 int x,y; 801 int x,y;
803 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 802 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
804 int gx,gy; 803 int gx,gy;
805 contentsToGrid(x,y,gx,gy); 804 contentsToGrid(x,y,gx,gy);
806 805
807 QPoint clipperPos = clipper()-> 806 QPoint clipperPos = clipper()->
808 mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 807 mapFromGlobal(viewport()->mapToGlobal(viewportPos));
809 808
810 // Scroll if cursor was moved to upper or lower end of agenda. 809 // Scroll if cursor was moved to upper or lower end of agenda.
811 if (clipperPos.y() < mScrollBorderWidth) { 810 if (clipperPos.y() < mScrollBorderWidth) {
812 mScrollUpTimer.start(mScrollDelay); 811 mScrollUpTimer.start(mScrollDelay);
813 } else if (visibleHeight() - clipperPos.y() < 812 } else if (visibleHeight() - clipperPos.y() <
814 mScrollBorderWidth) { 813 mScrollBorderWidth) {
815 mScrollDownTimer.start(mScrollDelay); 814 mScrollDownTimer.start(mScrollDelay);
816 } else { 815 } else {
817 mScrollUpTimer.stop(); 816 mScrollUpTimer.stop();
818 mScrollDownTimer.stop(); 817 mScrollDownTimer.stop();
819 } 818 }
820 819
821 if ( gy > mCurrentCellY ) { 820 if ( gy > mCurrentCellY ) {
822 mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; 821 mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop;
823 822
824#if 0 823#if 0
825 // FIXME: Repaint only the newly selected region 824 // FIXME: Repaint only the newly selected region
826 repaintContents( mSelectionCellX * mGridSpacingX, 825 repaintContents( mSelectionCellX * mGridSpacingX,
827 mCurrentCellY + mGridSpacingY, 826 mCurrentCellY + mGridSpacingY,
828 mGridSpacingX, 827 mGridSpacingX,
829 mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY ); 828 mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY );
830#else 829#else
831 repaintContents( (KOGlobals::self()->reverseLayout() ? 830 repaintContents( (KOGlobals::self()->reverseLayout() ?
832 mColumns - 1 - mSelectionCellX : mSelectionCellX) * 831 mColumns - 1 - mSelectionCellX : mSelectionCellX) *
833 mGridSpacingX, mSelectionYTop, 832 mGridSpacingX, mSelectionYTop,
834 mGridSpacingX, mSelectionHeight , false); 833 mGridSpacingX, mSelectionHeight , false);
835#endif 834#endif
836 835
837 mCurrentCellY = gy; 836 mCurrentCellY = gy;
838 } else if ( gy < mCurrentCellY ) { 837 } else if ( gy < mCurrentCellY ) {
839 if ( gy >= mStartCellY ) { 838 if ( gy >= mStartCellY ) {
840 int selectionHeight = mSelectionHeight; 839 int selectionHeight = mSelectionHeight;
841 mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; 840 mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop;
842 841
843 repaintContents( (KOGlobals::self()->reverseLayout() ? 842 repaintContents( (KOGlobals::self()->reverseLayout() ?
844 mColumns - 1 - mSelectionCellX : mSelectionCellX) * 843 mColumns - 1 - mSelectionCellX : mSelectionCellX) *
845 mGridSpacingX, mSelectionYTop, 844 mGridSpacingX, mSelectionYTop,
846 mGridSpacingX, selectionHeight,false ); 845 mGridSpacingX, selectionHeight,false );
847 846
848 mCurrentCellY = gy; 847 mCurrentCellY = gy;
849 } else { 848 } else {
850 } 849 }
851 } 850 }
852} 851}
853 852
854void KOAgenda::endSelectAction( bool emitNewEvent ) 853void KOAgenda::endSelectAction( bool emitNewEvent )