-rw-r--r-- | korganizer/koagenda.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 662576f..92c1cd6 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -80,17 +80,17 @@ MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) | |||
80 | 80 | ||
81 | agenda->addChild(mTimeBox); | 81 | agenda->addChild(mTimeBox); |
82 | 82 | ||
83 | oldToday = -1; | 83 | oldToday = -1; |
84 | } | 84 | } |
85 | 85 | ||
86 | MarcusBains::~MarcusBains() | 86 | MarcusBains::~MarcusBains() |
87 | { | 87 | { |
88 | delete minutes; | 88 | //delete minutes; |
89 | } | 89 | } |
90 | 90 | ||
91 | int MarcusBains::todayColumn() | 91 | int MarcusBains::todayColumn() |
92 | { | 92 | { |
93 | QDate currentDate = QDate::currentDate(); | 93 | QDate currentDate = QDate::currentDate(); |
94 | 94 | ||
95 | DateList dateList = agenda->dateList(); | 95 | DateList dateList = agenda->dateList(); |
96 | DateList::ConstIterator it; | 96 | DateList::ConstIterator it; |
@@ -146,20 +146,21 @@ void MarcusBains::updateLocation(bool recalculate) | |||
146 | mTimeBox->adjustSize(); | 146 | mTimeBox->adjustSize(); |
147 | // the -2 below is there because there is a bug in this program | 147 | // the -2 below is there because there is a bug in this program |
148 | // somewhere, where the last column of this widget is a few pixels | 148 | // somewhere, where the last column of this widget is a few pixels |
149 | // narrower than the other columns. | 149 | // narrower than the other columns. |
150 | int offs = (today==agenda->columns()-1) ? -4 : 0; | 150 | int offs = (today==agenda->columns()-1) ? -4 : 0; |
151 | agenda->moveChild(mTimeBox, | 151 | agenda->moveChild(mTimeBox, |
152 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, | 152 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, |
153 | y-mTimeBox->height()); | 153 | y-mTimeBox->height()); |
154 | |||
155 | mTimeBox->raise(); | 154 | mTimeBox->raise(); |
156 | //mTimeBox->setAutoMask(true); | 155 | //mTimeBox->setAutoMask(true); |
157 | minutes->start(5000,true); | 156 | int secs = QTime::currentTime().second(); |
157 | qDebug("second %d ", secs ); | ||
158 | minutes->start( (60 - secs +1)*1000 ,true); | ||
158 | } | 159 | } |
159 | 160 | ||
160 | 161 | ||
161 | //////////////////////////////////////////////////////////////////////////// | 162 | //////////////////////////////////////////////////////////////////////////// |
162 | 163 | ||
163 | 164 | ||
164 | /* | 165 | /* |
165 | Create an agenda widget with rows rows and columns columns. | 166 | Create an agenda widget with rows rows and columns columns. |
@@ -437,17 +438,17 @@ void KOAgenda::categoryChanged(Incidence * inc) | |||
437 | } | 438 | } |
438 | } | 439 | } |
439 | } | 440 | } |
440 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 441 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
441 | { | 442 | { |
442 | 443 | ||
443 | if ( mInvalidPixmap ) { | 444 | if ( mInvalidPixmap ) { |
444 | mInvalidPixmap = false; | 445 | mInvalidPixmap = false; |
445 | qDebug("InvalidPixmap "); | 446 | qDebug("KO: Upsizing Pixmaps "); |
446 | computeSizes(); | 447 | computeSizes(); |
447 | emit updateViewSignal(); | 448 | emit updateViewSignal(); |
448 | return true; | 449 | return true; |
449 | } | 450 | } |
450 | emit sendPing(); | 451 | emit sendPing(); |
451 | static int startX = 0; | 452 | static int startX = 0; |
452 | static int startY = 0; | 453 | static int startY = 0; |
453 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); | 454 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); |
@@ -1271,17 +1272,17 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1271 | 1272 | ||
1272 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1273 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) |
1273 | { | 1274 | { |
1274 | if ( globalFlagBlockAgenda ) | 1275 | if ( globalFlagBlockAgenda ) |
1275 | return; | 1276 | return; |
1276 | 1277 | ||
1277 | if ( mInvalidPixmap ) { | 1278 | if ( mInvalidPixmap ) { |
1278 | mInvalidPixmap = false; | 1279 | mInvalidPixmap = false; |
1279 | qDebug("InvalidPixmap "); | 1280 | qDebug("KO: Upsizing Pixmaps "); |
1280 | computeSizes(); | 1281 | computeSizes(); |
1281 | emit updateViewSignal(); | 1282 | emit updateViewSignal(); |
1282 | return; | 1283 | return; |
1283 | } | 1284 | } |
1284 | if ( ! mAllDayMode ) { | 1285 | if ( ! mAllDayMode ) { |
1285 | // currently not working for | 1286 | // currently not working for |
1286 | 1287 | ||
1287 | //qDebug("KOAgenda::drawContents "); | 1288 | //qDebug("KOAgenda::drawContents "); |
@@ -1412,17 +1413,17 @@ void KOAgenda::finishUpdate() | |||
1412 | item->repaintMe( ); | 1413 | item->repaintMe( ); |
1413 | } | 1414 | } |
1414 | globalFlagBlockAgendaItemUpdate = 1; | 1415 | globalFlagBlockAgendaItemUpdate = 1; |
1415 | qApp->processEvents(); | 1416 | qApp->processEvents(); |
1416 | globalFlagBlockAgendaItemPaint = 0; | 1417 | globalFlagBlockAgendaItemPaint = 0; |
1417 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1418 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1418 | item->repaint( false ); | 1419 | item->repaint( false ); |
1419 | } | 1420 | } |
1420 | 1421 | marcus_bains(); | |
1421 | } | 1422 | } |
1422 | 1423 | ||
1423 | /* | 1424 | /* |
1424 | Draw grid in the background of the agenda. | 1425 | Draw grid in the background of the agenda. |
1425 | */ | 1426 | */ |
1426 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) | 1427 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) |
1427 | { | 1428 | { |
1428 | 1429 | ||
@@ -1795,17 +1796,16 @@ KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int | |||
1795 | 1796 | ||
1796 | //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); | 1797 | //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); |
1797 | mItems.append(agendaItem); | 1798 | mItems.append(agendaItem); |
1798 | 1799 | ||
1799 | placeSubCells(agendaItem); | 1800 | placeSubCells(agendaItem); |
1800 | 1801 | ||
1801 | //agendaItem->show(); | 1802 | //agendaItem->show(); |
1802 | 1803 | ||
1803 | marcus_bains(); | ||
1804 | 1804 | ||
1805 | return agendaItem; | 1805 | return agendaItem; |
1806 | } | 1806 | } |
1807 | 1807 | ||
1808 | 1808 | ||
1809 | /* | 1809 | /* |
1810 | Insert all-day KOAgendaItem into agenda. | 1810 | Insert all-day KOAgendaItem into agenda. |
1811 | */ | 1811 | */ |
@@ -1868,18 +1868,16 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, | |||
1868 | if (current == first) setFirst = 0; | 1868 | if (current == first) setFirst = 0; |
1869 | else setFirst = first; | 1869 | else setFirst = first; |
1870 | if (current == last) setLast = 0; | 1870 | if (current == last) setLast = 0; |
1871 | else setLast = last; | 1871 | else setLast = last; |
1872 | 1872 | ||
1873 | current->setMultiItem(setFirst,next,setLast); | 1873 | current->setMultiItem(setFirst,next,setLast); |
1874 | current = next; | 1874 | current = next; |
1875 | } | 1875 | } |
1876 | |||
1877 | marcus_bains(); | ||
1878 | } | 1876 | } |
1879 | 1877 | ||
1880 | 1878 | ||
1881 | //QSizePolicy KOAgenda::sizePolicy() const | 1879 | //QSizePolicy KOAgenda::sizePolicy() const |
1882 | //{ | 1880 | //{ |
1883 | // Thought this would make the all-day event agenda minimum size and the | 1881 | // Thought this would make the all-day event agenda minimum size and the |
1884 | // normal agenda take the remaining space. But it doesnīt work. The QSplitter | 1882 | // normal agenda take the remaining space. But it doesnīt work. The QSplitter |
1885 | // donīt seem to think that an Expanding widget needs more space than a | 1883 | // donīt seem to think that an Expanding widget needs more space than a |
@@ -1954,29 +1952,28 @@ void KOAgenda::computeSizes() | |||
1954 | item->subCell() * subCellWidth,childY(item)); | 1952 | item->subCell() * subCellWidth,childY(item)); |
1955 | } | 1953 | } |
1956 | } | 1954 | } |
1957 | int cw = contentsWidth(); | 1955 | int cw = contentsWidth(); |
1958 | int ch = contentsHeight(); | 1956 | int ch = contentsHeight(); |
1959 | if ( mAllDayMode ) { | 1957 | if ( mAllDayMode ) { |
1960 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); | 1958 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); |
1961 | if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) { | 1959 | if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) { |
1962 | qDebug("paintPixAll->resize "); | 1960 | //qDebug("paintPixAll->resize "); |
1963 | paintPixAll->resize( cw, ch ); | 1961 | paintPixAll->resize( cw, ch ); |
1964 | } | 1962 | } |
1965 | } else { | 1963 | } else { |
1966 | QPixmap* paintPix = KOAgendaItem::paintPix(); | 1964 | QPixmap* paintPix = KOAgendaItem::paintPix(); |
1967 | if ( paintPix->width() < cw || paintPix->height() < ch ) { | 1965 | if ( paintPix->width() < cw || paintPix->height() < ch ) { |
1968 | qDebug("paintPix->resize "); | 1966 | //qDebug("paintPix->resize "); |
1969 | paintPix->resize( cw , ch ); | 1967 | paintPix->resize( cw , ch ); |
1970 | } | 1968 | } |
1971 | } | 1969 | } |
1972 | 1970 | ||
1973 | checkScrollBoundaries(); | 1971 | checkScrollBoundaries(); |
1974 | marcus_bains(); | ||
1975 | drawContentsToPainter(); | 1972 | drawContentsToPainter(); |
1976 | viewport()->repaint(false); | 1973 | viewport()->repaint(false); |
1977 | } | 1974 | } |
1978 | 1975 | ||
1979 | void KOAgenda::scrollUp() | 1976 | void KOAgenda::scrollUp() |
1980 | { | 1977 | { |
1981 | scrollBy(0,-mScrollOffset); | 1978 | scrollBy(0,-mScrollOffset); |
1982 | } | 1979 | } |
@@ -2026,17 +2023,16 @@ void KOAgenda::updateConfig() | |||
2026 | // setMaximumHeight( mGridSpacingY+1 ); | 2023 | // setMaximumHeight( mGridSpacingY+1 ); |
2027 | viewport()->repaint( false ); | 2024 | viewport()->repaint( false ); |
2028 | //setFixedHeight( mGridSpacingY+1 ); | 2025 | //setFixedHeight( mGridSpacingY+1 ); |
2029 | //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); | 2026 | //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); |
2030 | } | 2027 | } |
2031 | else { | 2028 | else { |
2032 | mGridSpacingY = KOPrefs::instance()->mHourSize; | 2029 | mGridSpacingY = KOPrefs::instance()->mHourSize; |
2033 | calculateWorkingHours(); | 2030 | calculateWorkingHours(); |
2034 | marcus_bains(); | ||
2035 | } | 2031 | } |
2036 | } | 2032 | } |
2037 | 2033 | ||
2038 | void KOAgenda::checkScrollBoundaries() | 2034 | void KOAgenda::checkScrollBoundaries() |
2039 | { | 2035 | { |
2040 | // Invalidate old values to force update | 2036 | // Invalidate old values to force update |
2041 | mOldLowerScrollValue = -1; | 2037 | mOldLowerScrollValue = -1; |
2042 | mOldUpperScrollValue = -1; | 2038 | mOldUpperScrollValue = -1; |
@@ -2119,17 +2115,16 @@ void KOAgenda::calculateWorkingHours() | |||
2119 | DateList KOAgenda::dateList() const | 2115 | DateList KOAgenda::dateList() const |
2120 | { | 2116 | { |
2121 | return mSelectedDates; | 2117 | return mSelectedDates; |
2122 | } | 2118 | } |
2123 | 2119 | ||
2124 | void KOAgenda::setDateList(const DateList &selectedDates) | 2120 | void KOAgenda::setDateList(const DateList &selectedDates) |
2125 | { | 2121 | { |
2126 | mSelectedDates = selectedDates; | 2122 | mSelectedDates = selectedDates; |
2127 | marcus_bains(); | ||
2128 | } | 2123 | } |
2129 | 2124 | ||
2130 | void KOAgenda::setHolidayMask(QMemArray<bool> *mask) | 2125 | void KOAgenda::setHolidayMask(QMemArray<bool> *mask) |
2131 | { | 2126 | { |
2132 | mHolidayMask = mask; | 2127 | mHolidayMask = mask; |
2133 | 2128 | ||
2134 | /* | 2129 | /* |
2135 | kdDebug() << "HolidayMask: "; | 2130 | kdDebug() << "HolidayMask: "; |