-rw-r--r-- | korganizer/koagenda.cpp | 14 | ||||
-rw-r--r-- | korganizer/koagenda.h | 1 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 7e9fa71..7d9d674 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -88,49 +88,50 @@ MarcusBains::~MarcusBains() | |||
88 | //delete minutes; | 88 | //delete minutes; |
89 | } | 89 | } |
90 | void MarcusBains::hideMe() | 90 | void MarcusBains::hideMe() |
91 | { | 91 | { |
92 | hide(); mTimeBox->hide(); | 92 | hide(); mTimeBox->hide(); |
93 | } | 93 | } |
94 | int MarcusBains::todayColumn() | 94 | int MarcusBains::todayColumn() |
95 | { | 95 | { |
96 | QDate currentDate = QDate::currentDate(); | 96 | QDate currentDate = QDate::currentDate(); |
97 | 97 | ||
98 | DateList dateList = agenda->dateList(); | 98 | DateList dateList = agenda->dateList(); |
99 | DateList::ConstIterator it; | 99 | DateList::ConstIterator it; |
100 | int col = 0; | 100 | int col = 0; |
101 | for(it = dateList.begin(); it != dateList.end(); ++it) { | 101 | for(it = dateList.begin(); it != dateList.end(); ++it) { |
102 | if((*it) == currentDate) | 102 | if((*it) == currentDate) |
103 | return KOGlobals::self()->reverseLayout() ? | 103 | return KOGlobals::self()->reverseLayout() ? |
104 | agenda->columns() - 1 - col : col; | 104 | agenda->columns() - 1 - col : col; |
105 | ++col; | 105 | ++col; |
106 | } | 106 | } |
107 | 107 | ||
108 | return -1; | 108 | return -1; |
109 | } | 109 | } |
110 | void MarcusBains::updateLoc() | 110 | void MarcusBains::updateLoc() |
111 | { | 111 | { |
112 | updateLocation(); | 112 | if ( !agenda->invalidPixmap() ) |
113 | updateLocation(); | ||
113 | } | 114 | } |
114 | void MarcusBains::updateLocation(bool recalculate) | 115 | void MarcusBains::updateLocation(bool recalculate) |
115 | { | 116 | { |
116 | 117 | ||
117 | QTime tim = QTime::currentTime(); | 118 | QTime tim = QTime::currentTime(); |
118 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); | 119 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); |
119 | if((tim.hour() == 0) && (oldTime.hour()==23)) | 120 | if((tim.hour() == 0) && (oldTime.hour()==23)) |
120 | recalculate = true; | 121 | recalculate = true; |
121 | 122 | ||
122 | int mins = tim.hour()*60 + tim.minute(); | 123 | int mins = tim.hour()*60 + tim.minute(); |
123 | int minutesPerCell = 24 * 60 / agenda->rows(); | 124 | int minutesPerCell = 24 * 60 / agenda->rows(); |
124 | int y = mins*agenda->gridSpacingY()/minutesPerCell; | 125 | int y = mins*agenda->gridSpacingY()/minutesPerCell; |
125 | int today = recalculate ? todayColumn() : oldToday; | 126 | int today = recalculate ? todayColumn() : oldToday; |
126 | int x = agenda->gridSpacingX()*today; | 127 | int x = agenda->gridSpacingX()*today; |
127 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); | 128 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); |
128 | 129 | ||
129 | oldTime = tim; | 130 | oldTime = tim; |
130 | oldToday = today; | 131 | oldToday = today; |
131 | 132 | ||
132 | if(disabled || (today<0)) { | 133 | if(disabled || (today<0)) { |
133 | hide(); mTimeBox->hide(); | 134 | hide(); mTimeBox->hide(); |
134 | return; | 135 | return; |
135 | } else { | 136 | } else { |
136 | show(); mTimeBox->show(); | 137 | show(); mTimeBox->show(); |
@@ -420,54 +421,58 @@ void KOAgenda::popupMenu() | |||
420 | } else if ( mPopupKind == 2 || mPopupKind == 4 ) { | 421 | } else if ( mPopupKind == 2 || mPopupKind == 4 ) { |
421 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action | 422 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action |
422 | endSelectAction( false ); // do not emit new event signal | 423 | endSelectAction( false ); // do not emit new event signal |
423 | mLeftMouseDown = false; // no more leftMouse computation | 424 | mLeftMouseDown = false; // no more leftMouse computation |
424 | } | 425 | } |
425 | if ( KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 2 ) | 426 | if ( KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 2 ) |
426 | mNewItemPopup->installEventFilter( this ); | 427 | mNewItemPopup->installEventFilter( this ); |
427 | mNewItemPopup->popup( mPopupPos); | 428 | mNewItemPopup->popup( mPopupPos); |
428 | 429 | ||
429 | } | 430 | } |
430 | mLeftMouseDown = false; | 431 | mLeftMouseDown = false; |
431 | mPopupItem = 0; | 432 | mPopupItem = 0; |
432 | mPopupKind = 0; | 433 | mPopupKind = 0; |
433 | } | 434 | } |
434 | void KOAgenda::categoryChanged(Incidence * inc) | 435 | void KOAgenda::categoryChanged(Incidence * inc) |
435 | { | 436 | { |
436 | KOAgendaItem *item; | 437 | KOAgendaItem *item; |
437 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 438 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
438 | if ( item->incidence() == inc ) { | 439 | if ( item->incidence() == inc ) { |
439 | item->initColor (); | 440 | item->initColor (); |
440 | item->updateItem(); | 441 | item->updateItem(); |
441 | } | 442 | } |
442 | } | 443 | } |
443 | } | 444 | } |
445 | bool KOAgenda::invalidPixmap() | ||
446 | { | ||
447 | return mInvalidPixmap; | ||
448 | } | ||
444 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 449 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
445 | { | 450 | { |
446 | 451 | ||
447 | if ( mInvalidPixmap ) { | 452 | if ( mInvalidPixmap ) { |
448 | mInvalidPixmap = false; | 453 | mInvalidPixmap = false; |
449 | qDebug("KO: Upsizing Pixmaps "); | 454 | qDebug("KO: efm Upsizing Pixmaps %s", QDateTime::currentDateTime().toString().latin1()); |
450 | computeSizes(); | 455 | computeSizes(); |
451 | emit updateViewSignal(); | 456 | emit updateViewSignal(); |
452 | return true; | 457 | return true; |
453 | } | 458 | } |
454 | emit sendPing(); | 459 | emit sendPing(); |
455 | static int startX = 0; | 460 | static int startX = 0; |
456 | static int startY = 0; | 461 | static int startY = 0; |
457 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); | 462 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); |
458 | static bool blockMoving = true; | 463 | static bool blockMoving = true; |
459 | 464 | ||
460 | //qDebug("KOAgenda::eventFilter_mous "); | 465 | //qDebug("KOAgenda::eventFilter_mous "); |
461 | if ( object == mNewItemPopup ) { | 466 | if ( object == mNewItemPopup ) { |
462 | //qDebug("mNewItemPopup "); | 467 | //qDebug("mNewItemPopup "); |
463 | if ( me->type() == QEvent::MouseButtonRelease ) { | 468 | if ( me->type() == QEvent::MouseButtonRelease ) { |
464 | mNewItemPopup->removeEventFilter( this ); | 469 | mNewItemPopup->removeEventFilter( this ); |
465 | int dX = me->globalPos().x() - mPopupPos.x();; | 470 | int dX = me->globalPos().x() - mPopupPos.x();; |
466 | if ( dX < 0 ) | 471 | if ( dX < 0 ) |
467 | dX = -dX; | 472 | dX = -dX; |
468 | int dY = me->globalPos().y() - mPopupPos.y(); | 473 | int dY = me->globalPos().y() - mPopupPos.y(); |
469 | if ( dY < 0 ) | 474 | if ( dY < 0 ) |
470 | dY = -dY; | 475 | dY = -dY; |
471 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 476 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
472 | mNewItemPopup->hide(); | 477 | mNewItemPopup->hide(); |
473 | } | 478 | } |
@@ -1260,53 +1265,54 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1260 | placeItem->setSubCell(0); | 1265 | placeItem->setSubCell(0); |
1261 | placeItem->setSubCells(1); | 1266 | placeItem->setSubCells(1); |
1262 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); | 1267 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); |
1263 | else placeItem->resize(mGridSpacingX,placeItem->height()); | 1268 | else placeItem->resize(mGridSpacingX,placeItem->height()); |
1264 | int x,y; | 1269 | int x,y; |
1265 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); | 1270 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); |
1266 | moveChild(placeItem,x,y); | 1271 | moveChild(placeItem,x,y); |
1267 | } | 1272 | } |
1268 | placeItem->setConflictItems(conflictItems); | 1273 | placeItem->setConflictItems(conflictItems); |
1269 | // for ( item=conflictItems.first(); item != 0; | 1274 | // for ( item=conflictItems.first(); item != 0; |
1270 | // item=conflictItems.next() ) { | 1275 | // item=conflictItems.next() ) { |
1271 | // //item->updateItem(); | 1276 | // //item->updateItem(); |
1272 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); | 1277 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); |
1273 | // } | 1278 | // } |
1274 | // placeItem->updateItem(); | 1279 | // placeItem->updateItem(); |
1275 | } | 1280 | } |
1276 | 1281 | ||
1277 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1282 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) |
1278 | { | 1283 | { |
1279 | if ( globalFlagBlockAgenda ) | 1284 | if ( globalFlagBlockAgenda ) |
1280 | return; | 1285 | return; |
1281 | 1286 | ||
1282 | if ( mInvalidPixmap ) { | 1287 | if ( mInvalidPixmap ) { |
1283 | mInvalidPixmap = false; | 1288 | mInvalidPixmap = false; |
1284 | qDebug("KO: Upsizing Pixmaps "); | 1289 | qDebug("KO: dc Upsizing Pixmaps %s", QDateTime::currentDateTime().toString().latin1()); |
1285 | computeSizes(); | 1290 | computeSizes(); |
1286 | emit updateViewSignal(); | 1291 | emit updateViewSignal(); |
1287 | return; | 1292 | return; |
1288 | } | 1293 | } |
1294 | //qDebug("KOAgenda::drawContents %s", QDateTime::currentDateTime().toString().latin1()); | ||
1289 | if ( ! mAllDayMode ) { | 1295 | if ( ! mAllDayMode ) { |
1290 | // currently not working for | 1296 | // currently not working for |
1291 | 1297 | ||
1292 | //qDebug("KOAgenda::drawContents "); | 1298 | //qDebug("KOAgenda::drawContents "); |
1293 | #if 0 | 1299 | #if 0 |
1294 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { | 1300 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { |
1295 | qDebug("WAU "); | 1301 | qDebug("WAU "); |
1296 | drawContentsToPainter(); | 1302 | drawContentsToPainter(); |
1297 | } | 1303 | } |
1298 | #endif | 1304 | #endif |
1299 | QPaintDevice* pd = p->device(); | 1305 | QPaintDevice* pd = p->device(); |
1300 | p->end(); | 1306 | p->end(); |
1301 | int vx, vy; | 1307 | int vx, vy; |
1302 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1308 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1303 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1309 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1304 | mSelectionCellX * mGridSpacingX; | 1310 | mSelectionCellX * mGridSpacingX; |
1305 | contentsToViewport ( cx, cy, vx,vy); | 1311 | contentsToViewport ( cx, cy, vx,vy); |
1306 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; | 1312 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; |
1307 | 1313 | ||
1308 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { | 1314 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { |
1309 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1315 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1310 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { | 1316 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { |
1311 | 1317 | ||
1312 | int vxSel, vySel; | 1318 | int vxSel, vySel; |
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index 59e7472..380ce62 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h | |||
@@ -107,48 +107,49 @@ class KOAgenda : public QScrollView | |||
107 | 107 | ||
108 | void clear(); | 108 | void clear(); |
109 | 109 | ||
110 | void clearSelection(); | 110 | void clearSelection(); |
111 | void hideUnused(); | 111 | void hideUnused(); |
112 | 112 | ||
113 | /** Calculates the minimum width */ | 113 | /** Calculates the minimum width */ |
114 | virtual int minimumWidth() const; | 114 | virtual int minimumWidth() const; |
115 | /** Update configuration from preference settings */ | 115 | /** Update configuration from preference settings */ |
116 | void updateConfig(); | 116 | void updateConfig(); |
117 | 117 | ||
118 | void checkScrollBoundaries(); | 118 | void checkScrollBoundaries(); |
119 | 119 | ||
120 | void setHolidayMask(QMemArray<bool> *); | 120 | void setHolidayMask(QMemArray<bool> *); |
121 | void setDateList(const DateList &selectedDates); | 121 | void setDateList(const DateList &selectedDates); |
122 | DateList dateList() const; | 122 | DateList dateList() const; |
123 | void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); | 123 | void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); |
124 | void finishUpdate(); | 124 | void finishUpdate(); |
125 | void printSelection(); | 125 | void printSelection(); |
126 | void storePosition(); | 126 | void storePosition(); |
127 | void restorePosition(); | 127 | void restorePosition(); |
128 | void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; } | 128 | void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; } |
129 | void shrinkPixmap(); | 129 | void shrinkPixmap(); |
130 | QTime getEndTime(); | 130 | QTime getEndTime(); |
131 | bool invalidPixmap(); | ||
131 | 132 | ||
132 | public slots: | 133 | public slots: |
133 | void slotContentMove(int,int); | 134 | void slotContentMove(int,int); |
134 | void categoryChanged(Incidence * inc); | 135 | void categoryChanged(Incidence * inc); |
135 | void slotClearSelection(); | 136 | void slotClearSelection(); |
136 | void popupMenu(); | 137 | void popupMenu(); |
137 | void newItem( int ); | 138 | void newItem( int ); |
138 | void moveChild( QWidget *, int, int ); | 139 | void moveChild( QWidget *, int, int ); |
139 | void scrollUp(); | 140 | void scrollUp(); |
140 | void scrollDown(); | 141 | void scrollDown(); |
141 | void updateTodo( Todo * t, int , bool ); | 142 | void updateTodo( Todo * t, int , bool ); |
142 | void popupAlarm(); | 143 | void popupAlarm(); |
143 | 144 | ||
144 | void checkScrollBoundaries(int); | 145 | void checkScrollBoundaries(int); |
145 | 146 | ||
146 | /** Deselect selected items. This function does not emit any signals. */ | 147 | /** Deselect selected items. This function does not emit any signals. */ |
147 | void deselectItem(); | 148 | void deselectItem(); |
148 | /** Select item. If the argument is 0, the currently selected item gets | 149 | /** Select item. If the argument is 0, the currently selected item gets |
149 | deselected. This function emits the itemSelected(bool) signal to inform | 150 | deselected. This function emits the itemSelected(bool) signal to inform |
150 | about selection/deseelction of events. */ | 151 | about selection/deseelction of events. */ |
151 | void selectItem(KOAgendaItem *); | 152 | void selectItem(KOAgendaItem *); |
152 | void finishResize(); | 153 | void finishResize(); |
153 | 154 | ||
154 | signals: | 155 | signals: |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 04f30bb..f5a3a4b 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -582,49 +582,49 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
582 | connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout())); | 582 | connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout())); |
583 | #endif | 583 | #endif |
584 | } | 584 | } |
585 | void KOAgendaView::startIdleTimeout() | 585 | void KOAgendaView::startIdleTimeout() |
586 | { | 586 | { |
587 | #ifndef DESKTOP_VERSION | 587 | #ifndef DESKTOP_VERSION |
588 | mIdleStart = QDateTime::currentDateTime(); | 588 | mIdleStart = QDateTime::currentDateTime(); |
589 | mIdleTimer->start( IDLETIMEOUT * 1000 ); | 589 | mIdleTimer->start( IDLETIMEOUT * 1000 ); |
590 | #endif | 590 | #endif |
591 | } | 591 | } |
592 | void KOAgendaView::slotIdleTimeout() | 592 | void KOAgendaView::slotIdleTimeout() |
593 | { | 593 | { |
594 | #ifndef DESKTOP_VERSION | 594 | #ifndef DESKTOP_VERSION |
595 | //qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) ); | 595 | //qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) ); |
596 | int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() ); | 596 | int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() ); |
597 | mIdleTimer->stop(); | 597 | mIdleTimer->stop(); |
598 | bool isActice = topLevelWidget()->isActiveWindow(); | 598 | bool isActice = topLevelWidget()->isActiveWindow(); |
599 | //qDebug("KO: Active Window %d %d", isActice, isVisible()); | 599 | //qDebug("KO: Active Window %d %d", isActice, isVisible()); |
600 | // we do nothing if we wake up from a suspend | 600 | // we do nothing if we wake up from a suspend |
601 | if ( secsfromstart > IDLETIMEOUT + 30 && isActice ) { | 601 | if ( secsfromstart > IDLETIMEOUT + 30 && isActice ) { |
602 | qDebug("KO: Wakeup from suspend "); | 602 | qDebug("KO: Wakeup from suspend "); |
603 | startIdleTimeout(); | 603 | startIdleTimeout(); |
604 | return; | 604 | return; |
605 | } | 605 | } |
606 | qDebug("KO: Downsizing Pixmaps "); | 606 | qDebug("KO: Downsizing Pixmaps %s",QDateTime::currentDateTime().toString().latin1()); |
607 | mAgenda->shrinkPixmap(); | 607 | mAgenda->shrinkPixmap(); |
608 | mAllDayAgenda->shrinkPixmap(); | 608 | mAllDayAgenda->shrinkPixmap(); |
609 | KOAgendaItem::paintPix()->resize( 20,20); | 609 | KOAgendaItem::paintPix()->resize( 20,20); |
610 | KOAgendaItem::paintPixAllday()->resize( 20,20); | 610 | KOAgendaItem::paintPixAllday()->resize( 20,20); |
611 | #endif | 611 | #endif |
612 | 612 | ||
613 | } | 613 | } |
614 | void KOAgendaView::toggleAllDay() | 614 | void KOAgendaView::toggleAllDay() |
615 | { | 615 | { |
616 | if ( mSplitterAgenda->firstHandle() ) | 616 | if ( mSplitterAgenda->firstHandle() ) |
617 | mSplitterAgenda->firstHandle()->toggle(); | 617 | mSplitterAgenda->firstHandle()->toggle(); |
618 | } | 618 | } |
619 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 619 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
620 | { | 620 | { |
621 | calendar()->addIncidence( inc ); | 621 | calendar()->addIncidence( inc ); |
622 | 622 | ||
623 | if ( incOld ) { | 623 | if ( incOld ) { |
624 | if ( incOld->typeID() == todoID ) | 624 | if ( incOld->typeID() == todoID ) |
625 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 625 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
626 | else | 626 | else |
627 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 627 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
628 | } | 628 | } |
629 | 629 | ||
630 | } | 630 | } |