author | zautrix <zautrix> | 2005-07-05 10:58:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-05 10:58:25 (UTC) |
commit | ea75d46072630883fae6ededd4af1d3c427ff59f (patch) (unidiff) | |
tree | 60c96620f59441cf0ff998e7e4edd5b2bc8007d9 /korganizer/koagenda.cpp | |
parent | 7e49703511de87f624cc8813b18ebbfcc01752cd (diff) | |
download | kdepimpi-ea75d46072630883fae6ededd4af1d3c427ff59f.zip kdepimpi-ea75d46072630883fae6ededd4af1d3c427ff59f.tar.gz kdepimpi-ea75d46072630883fae6ededd4af1d3c427ff59f.tar.bz2 |
fixx
-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 | |||
@@ -76,25 +76,25 @@ MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) | |||
76 | QPalette pal = mTimeBox->palette(); | 76 | QPalette pal = mTimeBox->palette(); |
77 | pal.setColor(QColorGroup::Foreground, Qt::red); | 77 | pal.setColor(QColorGroup::Foreground, Qt::red); |
78 | mTimeBox->setPalette(pal); | 78 | mTimeBox->setPalette(pal); |
79 | //mTimeBox->setAutoMask(true); | 79 | //mTimeBox->setAutoMask(true); |
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; |
97 | int col = 0; | 97 | int col = 0; |
98 | for(it = dateList.begin(); it != dateList.end(); ++it) { | 98 | for(it = dateList.begin(); it != dateList.end(); ++it) { |
99 | if((*it) == currentDate) | 99 | if((*it) == currentDate) |
100 | return KOGlobals::self()->reverseLayout() ? | 100 | return KOGlobals::self()->reverseLayout() ? |
@@ -142,28 +142,29 @@ void MarcusBains::updateLocation(bool recalculate) | |||
142 | //mTimeBox->setFont(QFont("helvetica",10)); | 142 | //mTimeBox->setFont(QFont("helvetica",10)); |
143 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); | 143 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); |
144 | 144 | ||
145 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); | 145 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); |
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. |
166 | */ | 167 | */ |
167 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | 168 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, |
168 | const char *name,WFlags f) : | 169 | const char *name,WFlags f) : |
169 | QScrollView(parent,name,f) | 170 | QScrollView(parent,name,f) |
@@ -433,25 +434,25 @@ void KOAgenda::categoryChanged(Incidence * inc) | |||
433 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 434 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
434 | if ( item->incidence() == inc ) { | 435 | if ( item->incidence() == inc ) { |
435 | item->initColor (); | 436 | item->initColor (); |
436 | item->updateItem(); | 437 | item->updateItem(); |
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 ); |
454 | static bool blockMoving = true; | 455 | static bool blockMoving = true; |
455 | 456 | ||
456 | //qDebug("KOAgenda::eventFilter_mous "); | 457 | //qDebug("KOAgenda::eventFilter_mous "); |
457 | if ( object == mNewItemPopup ) { | 458 | if ( object == mNewItemPopup ) { |
@@ -1267,25 +1268,25 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1267 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); | 1268 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); |
1268 | // } | 1269 | // } |
1269 | // placeItem->updateItem(); | 1270 | // placeItem->updateItem(); |
1270 | } | 1271 | } |
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 "); |
1288 | #if 0 | 1289 | #if 0 |
1289 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { | 1290 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { |
1290 | qDebug("WAU "); | 1291 | qDebug("WAU "); |
1291 | drawContentsToPainter(); | 1292 | drawContentsToPainter(); |
@@ -1408,25 +1409,25 @@ void KOAgenda::finishUpdate() | |||
1408 | 1409 | ||
1409 | } | 1410 | } |
1410 | globalFlagBlockAgendaItemUpdate = 0; | 1411 | globalFlagBlockAgendaItemUpdate = 0; |
1411 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1412 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
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 | ||
1429 | 1430 | ||
1430 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) | 1431 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) |
1431 | return; | 1432 | return; |
1432 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) | 1433 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) |
@@ -1791,25 +1792,24 @@ KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int | |||
1791 | 1792 | ||
1792 | agendaItem->resize(mGridSpacingX,iheight ); | 1793 | agendaItem->resize(mGridSpacingX,iheight ); |
1793 | agendaItem->setCellXY(X,YTop,YBottom); | 1794 | agendaItem->setCellXY(X,YTop,YBottom); |
1794 | agendaItem->setCellXWidth(X); | 1795 | agendaItem->setCellXWidth(X); |
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 | */ |
1812 | KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) | 1812 | KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) |
1813 | { | 1813 | { |
1814 | if (!mAllDayMode) { | 1814 | if (!mAllDayMode) { |
1815 | return 0; | 1815 | return 0; |
@@ -1864,26 +1864,24 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, | |||
1864 | KOAgendaItem *setFirst,*setLast; | 1864 | KOAgendaItem *setFirst,*setLast; |
1865 | current = first; | 1865 | current = first; |
1866 | while (current) { | 1866 | while (current) { |
1867 | next = multiItems.next(); | 1867 | next = multiItems.next(); |
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 |
1886 | // Preferred one. | 1884 | // Preferred one. |
1887 | // But it doesnīt hurt, so it stays. | 1885 | // But it doesnīt hurt, so it stays. |
1888 | // if (mAllDayMode) { | 1886 | // if (mAllDayMode) { |
1889 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); | 1887 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); |
@@ -1950,37 +1948,36 @@ void KOAgenda::computeSizes() | |||
1950 | item->resize(subCellWidth,item->height()); | 1948 | item->resize(subCellWidth,item->height()); |
1951 | moveChild(item,(KOGlobals::self()->reverseLayout() ? | 1949 | moveChild(item,(KOGlobals::self()->reverseLayout() ? |
1952 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1950 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1953 | item->cellX() * mGridSpacingX) + | 1951 | item->cellX() * mGridSpacingX) + |
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 | } |
1983 | 1980 | ||
1984 | 1981 | ||
1985 | void KOAgenda::scrollDown() | 1982 | void KOAgenda::scrollDown() |
1986 | { | 1983 | { |
@@ -2022,25 +2019,24 @@ void KOAgenda::updateConfig() | |||
2022 | if ( mAllDayMode ) { | 2019 | if ( mAllDayMode ) { |
2023 | mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; | 2020 | mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; |
2024 | //mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 2021 | //mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
2025 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); | 2022 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); |
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; |
2043 | 2039 | ||
2044 | checkScrollBoundaries(verticalScrollBar()->value()); | 2040 | checkScrollBoundaries(verticalScrollBar()->value()); |
2045 | } | 2041 | } |
2046 | 2042 | ||
@@ -2115,25 +2111,24 @@ void KOAgenda::calculateWorkingHours() | |||
2115 | KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; | 2111 | KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; |
2116 | } | 2112 | } |
2117 | 2113 | ||
2118 | 2114 | ||
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: "; |
2136 | for(uint i=0;i<mask->count();++i) { | 2131 | for(uint i=0;i<mask->count();++i) { |
2137 | kdDebug() << (mask->at(i) ? "*" : "o"); | 2132 | kdDebug() << (mask->at(i) ? "*" : "o"); |
2138 | } | 2133 | } |
2139 | kdDebug() << endl; | 2134 | kdDebug() << endl; |