author | zautrix <zautrix> | 2005-08-17 12:04:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-17 12:04:19 (UTC) |
commit | 31393a99cd2b190e62a7a09a7739a14af83936d1 (patch) (side-by-side diff) | |
tree | 1e000be050be3119f7b7eb8a248401c39cabf597 /korganizer | |
parent | 5f33ec89f5110ea646a32856eb6685c61cf24079 (diff) | |
download | kdepimpi-31393a99cd2b190e62a7a09a7739a14af83936d1.zip kdepimpi-31393a99cd2b190e62a7a09a7739a14af83936d1.tar.gz kdepimpi-31393a99cd2b190e62a7a09a7739a14af83936d1.tar.bz2 |
fixed warnings
-rw-r--r-- | korganizer/koagenda.cpp | 21 | ||||
-rw-r--r-- | korganizer/koagendaitem.h | 1 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 11 |
3 files changed, 18 insertions, 15 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 7d9d674..88f5d99 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1422,111 +1422,111 @@ void KOAgenda::finishUpdate() for ( item=mItems.first(); item != 0; item=mItems.next() ) { item->repaintMe( ); } globalFlagBlockAgendaItemUpdate = 1; qApp->processEvents(); globalFlagBlockAgendaItemPaint = 0; for ( item=mItems.first(); item != 0; item=mItems.next() ) { item->repaint( false ); } marcus_bains(); } /* Draw grid in the background of the agenda. */ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) { if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) return; if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) return; int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); if ( ch < 1 ) ch = 1; if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { mPaintPixmap.resize( contentsWidth()+42, ch ); } mCurPixWid = contentsWidth(); mCurPixHei = ch; if ( mHighlightPixmap.width() < mGridSpacingX-1 ) { mHighlightPixmap.resize( mGridSpacingX-1, 5 ); mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); } mPixPainter.begin( &mPaintPixmap) ; //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); QPainter * p ; if (paint == 0) { mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); p = &mPixPainter; } else p = paint ; // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); //--cx;++cw; int lGridSpacingY = mGridSpacingY*2; - int selDay; + uint selDay; QDate curDate = QDate::currentDate(); if ( !backgroundOnly ) { for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) { if ( mSelectedDates[selDay] == curDate && KOPrefs::instance()->mHighlightCurrentDay) { int x1 = cx; int y1 = 0; if (y1 < cy) y1 = cy; int x2 = cx+cw-1; int y2 = contentsHeight(); if (y2 > cy+ch-1) y2=cy+ch-1; if (x2 >= x1 && y2 >= y1) { int gxStart = selDay; - int gxEnd = gxStart ; + //int gxEnd = gxStart ; int xStart = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gxStart)*mGridSpacingX : gxStart*mGridSpacingX; if (xStart < x1) xStart = x1; int xEnd = KOGlobals::self()->reverseLayout() ? (mColumns - gxStart)*mGridSpacingX-1 : (gxStart+1)*mGridSpacingX-1; if (xEnd > x2) xEnd = x2; if ( KOPrefs::instance()->mUseHighlightLightColor ) p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, KOPrefs::instance()->mAgendaBgColor.light()); else p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, KOPrefs::instance()->mAgendaBgColor.dark()); } } } } // Highlight working hours if ( !backgroundOnly ) if (mWorkingHoursEnable) { int x1 = cx; int y1 = mWorkingHoursYTop; if (y1 < cy) y1 = cy; int x2 = cx+cw-1; // int x2 = mGridSpacingX * 5 - 1; // if (x2 > cx+cw-1) x2 = cx + cw - 1; int y2 = mWorkingHoursYBottom; if (y2 > cy+ch-1) y2=cy+ch-1; if (x2 >= x1 && y2 >= y1) { // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); int gxStart = x1/mGridSpacingX; int gxEnd = x2/mGridSpacingX; while(gxStart <= gxEnd) { if (gxStart < int(mHolidayMask->count()) && !mHolidayMask->at(gxStart)) { int xStart = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gxStart)*mGridSpacingX : gxStart*mGridSpacingX; if (xStart < x1) xStart = x1; int xEnd = KOGlobals::self()->reverseLayout() ? (mColumns - gxStart)*mGridSpacingX-1 : (gxStart+1)*mGridSpacingX-1; if (xEnd > x2) xEnd = x2; if ( mSelectedDates[gxStart] == curDate && KOPrefs::instance()->mHighlightCurrentDay ) { @@ -1877,96 +1877,97 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, KOAgendaItem *next = 0; KOAgendaItem *last = multiItems.last(); KOAgendaItem *first = multiItems.first(); KOAgendaItem *setFirst,*setLast; current = first; while (current) { next = multiItems.next(); if (current == first) setFirst = 0; else setFirst = first; if (current == last) setLast = 0; else setLast = last; current->setMultiItem(setFirst,next,setLast); current = next; } } //QSizePolicy KOAgenda::sizePolicy() const //{ // Thought this would make the all-day event agenda minimum size and the // normal agenda take the remaining space. But it doesnīt work. The QSplitter // donīt seem to think that an Expanding widget needs more space than a // Preferred one. // But it doesnīt hurt, so it stays. // if (mAllDayMode) { // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); // } else { // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); // } //} void KOAgenda::finishResize ( ) { //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); if ( globalFlagBlockAgenda == 0 ) { finishUpdate(); //qDebug("finishUpdate() called "); } } /* Overridden from QScrollView to provide proper resizing of KOAgendaItems. */ void KOAgenda::resizeEvent ( QResizeEvent *ev ) { mSelectionHeight = 0; mResizeTimer.start( 150 , true ); computeSizes(); + QScrollView::resizeEvent( ev ); return; } void KOAgenda::computeSizes() { if ( globalFlagBlockStartup ) return; int frameOffset = frameWidth() * 2 +1; if (mAllDayMode) { mGridSpacingX = (width()-frameOffset) / mColumns; mGridSpacingY = height() - 2 * frameWidth() - 1; resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); // mGridSpacingY = height(); // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); KOAgendaItem *item; int subCellWidth; for ( item=mItems.first(); item != 0; item=mItems.next() ) { subCellWidth = mGridSpacingY / item->subCells(); item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); moveChild(item,KOGlobals::self()->reverseLayout() ? (mColumns - 1 - item->cellX()) * mGridSpacingX : item->cellX() * mGridSpacingX, item->subCell() * subCellWidth); } KOPrefs::instance()->mAllDaySize = mGridSpacingY; } else { mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns; if (height() > mGridSpacingY * mRows + 1 ) { KOPrefs::instance()->mHourSize = ((height())/mRows)+1; mGridSpacingY = KOPrefs::instance()->mHourSize ; resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); emit resizedSignal(); } else resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); KOAgendaItem *item; int subCellWidth; for ( item=mItems.first(); item != 0; item=mItems.next() ) { subCellWidth = mGridSpacingX / item->subCells(); item->resize(subCellWidth,item->height()); moveChild(item,(KOGlobals::self()->reverseLayout() ? (mColumns - 1 - item->cellX()) * mGridSpacingX : item->cellX() * mGridSpacingX) + item->subCell() * subCellWidth,childY(item)); } } int cw = contentsWidth(); @@ -2136,143 +2137,143 @@ DateList KOAgenda::dateList() const void KOAgenda::setDateList(const DateList &selectedDates) { mSelectedDates = selectedDates; } void KOAgenda::setHolidayMask(QMemArray<bool> *mask) { mHolidayMask = mask; /* kdDebug() << "HolidayMask: "; for(uint i=0;i<mask->count();++i) { kdDebug() << (mask->at(i) ? "*" : "o"); } kdDebug() << endl; */ } void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) { QScrollView::contentsMousePressEvent(event); } void KOAgenda::storePosition() { //mContentPosition int max = mGridSpacingY*4*24; if ( contentsY() < 5 && max > viewport()->height()*3/2 ) mContentPosition = 0; else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2) mContentPosition = -1.0; else mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2))); //qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height()); } void KOAgenda::restorePosition() { int posY; int max = mGridSpacingY*4*24; if ( mContentPosition < 0 ) posY = max-viewport()->height(); else if ( mContentPosition == 0 ) posY = 0; else - posY = (max/mContentPosition)-(viewport()->height()/2); + posY = (int) ((max/mContentPosition)-(viewport()->height()/2)); setContentsPos (0, posY ); //qDebug("posY %d hei %d", posY, max); } void KOAgenda::moveChild( QWidget *w, int x , int y ) { ++x; QScrollView::moveChild( w, x , y ); } #include <qmessagebox.h> #ifdef DESKTOP_VERSION #include <qprinter.h> #include <qpainter.h> #include <qpaintdevicemetrics.h> #endif void KOAgenda::printSelection() { #ifdef DESKTOP_VERSION if ( mStartCellY == mCurrentCellY ) { - int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), + QMessageBox::warning( this, i18n("KO/Pi: Warning!"), i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "), i18n("OK"), 0, 0, 0, 1 ); return; } float dx, dy; int x,y,w,h; x= 0; w= contentsWidth()+2; // h= contentsHeight(); y = mGridSpacingY*mStartCellY; h = mGridSpacingY*(mCurrentCellY+1)-y+2; //return; QPrinter* printer = new QPrinter(); if ( !printer->setup()) { delete printer; return; } QPainter p( printer ); QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); //date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); // p.drawText( 0, 0, date ); int offset = m.width()/8; // compute the scale dx = ((float) m.width()-offset) / (float)w; dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; float scale; // scale to fit the width or height of the paper if ( dx < dy ) scale = dx; else scale = dy; // set the scale - p.drawText( offset* scale, offset* scale*3/4, date ); + p.drawText( (int) (offset* scale), (int) (offset* scale*3/4), date ); - int selDay; + uint selDay; float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count())); float startX = 1; for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) { QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true ); - p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) ); - p.drawText( offset* scale+startX, (offset+hei)* scale, text ); + p.setClipRect((int) (offset* scale+startX) , 0, (int) (widOffset-4), (int) (offset* scale+(2*hei* scale)) ); + p.drawText( (int) (offset* scale+startX), (int) ((offset+hei)* scale), text ); startX += widOffset; } - p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale)); + p.translate( (int) (offset* scale),(int) (offset* scale+ (-y * scale)+(2*hei* scale))); p.scale( scale, scale ); - p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale ); + p.setClipRect( (int) (offset* scale), (int) (offset* scale+(2*hei* scale)), (int) (w*scale), (int) (h*scale) ); // now printing with y offset: 2 hei // p.translate( 0, -y*scale); drawContentsToPainter(&p, true ); globalFlagBlockAgendaItemUpdate = false; KOAgendaItem *item; for ( item=mItems.first(); item != 0; item=mItems.next() ) { item->select(false); item->paintMe( false, &p ); } globalFlagBlockAgendaItemUpdate = true; p.end(); delete printer; #else int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), i18n("Not supported \non PDA!\n"), i18n("OK"), 0, 0, 0, 1 ); #endif } diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h index 99c564a..2b26e95 100644 --- a/korganizer/koagendaitem.h +++ b/korganizer/koagendaitem.h @@ -63,96 +63,97 @@ class KOAgendaItem : public QWidget void setCellX(int XLeft, int XRight); void setCellXWidth(int xwidth); void setSubCell(int subCell); void setSubCells(int subCells); /** Start movement */ void startMove(); /** Reset to original values */ void resetMove(); void moveRelative(int dx,int dy); void expandTop(int dy); void expandBottom(int dy); void expandLeft(int dx); void expandRight(int dx); int mLastMoveXPos; void setMultiItem(KOAgendaItem *first,KOAgendaItem *next, KOAgendaItem *last); KOAgendaItem *firstMultiItem() { return mFirstMultiItem; } KOAgendaItem *nextMultiItem() { return mNextMultiItem; } KOAgendaItem *lastMultiItem() { return mLastMultiItem; } Incidence *incidence() const { return mIncidence; } QDate itemDate() { return mDate; } /** Update the date of this item's occurence (not in the event) */ void setItemDate(QDate qd); void setText ( const QString & text ) { mDisplayedText = text; } QString text () { return mDisplayedText; } virtual bool eventFilter ( QObject *, QEvent * ); static QToolTipGroup *toolTipGroup(); QPtrList<KOAgendaItem> conflictItems(); void setConflictItems(QPtrList<KOAgendaItem>); void addConflictItem(KOAgendaItem *ci); void paintMe( bool, QPainter* painter = 0 ); void repaintMe(); static QPixmap * paintPix(); static QPixmap * paintPixAllday(); void updateItem(); void computeText(); void recreateIncidence(); bool checkLayout(); void initColor (); + bool isAllDay() { return mAllDay; } public slots: bool updateIcons( QPainter *, bool ); void select(bool=true); void repaintItem(); protected: void dragEnterEvent(QDragEnterEvent *e); void dropEvent(QDropEvent *e); void paintEvent ( QPaintEvent * ); void resizeEvent ( QResizeEvent *ev ); private: KOAgendaItemWhatsThis* mKOAgendaItemWhatsThis; bool mAllDay; bool mWhiteText; int mCellX; int mCellXWidth; int mCellYTop,mCellYBottom; int mSubCell; // subcell number of this item int mSubCells; // Total number of subcells in cell of this item int xPaintCoord; int yPaintCoord; int wPaintCoord; int hPaintCoord; // Variables to remember start position int mStartCellX; int mStartCellXWidth; int mStartCellYTop,mStartCellYBottom; int mLastMovePos; // Multi item pointers KOAgendaItem *mFirstMultiItem; KOAgendaItem *mNextMultiItem; KOAgendaItem *mLastMultiItem; int mFontPixelSize; Incidence *mIncidence; // corresponding event or todo QDate mDate; //date this events occurs (for recurrence) //void showIcon( QLabel*, int ); //QLabel *mTodoIconLabel; //QLabel *mItemLabel; //QWidget *mIconBox; //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly; //QLabel *mIconReply,*mIconGroup,*mIconOrganizer; //QLabel *mIconMoreInfo; static QToolTipGroup *mToolTipGroup; QColor mBackgroundColor; diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index f5a3a4b..1cf03a0 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -957,101 +957,102 @@ void KOAgendaView::updateView() /* Update configuration settings for the agenda view. This method is not complete. */ void KOAgendaView::updateConfig() { if ( mBlockUpdating ) return; if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { int old = KOPrefs::instance()->mHourSize; KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; //qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); } // update config for children mTimeLabels->updateConfig(); mAgenda->storePosition(); mAgenda->updateConfig(); mAllDayAgenda->updateConfig(); // widget synchronization //TODO: find a better way, maybe signal/slot mTimeLabels->positionChanged(); // for some reason, this needs to be called explicitly mTimeLabels->repaint(); mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); // ToolTips displaying summary of events KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() ->mEnableToolTips); //setHolidayMasks(); //createDayLabels(); called by via updateView(); mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); updateView(); mAgenda->restorePosition(); } void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) { int xxx = item->cellX(); //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() ); - if ( mMinY.at(xxx) > item->cellYTop() ) - mMinY.at(xxx) = item->cellYTop(); - if ( mMaxY.at(xxx) < item->cellYBottom() ) - mMaxY.at(xxx) = item->cellYBottom(); - + if ( xxx >= 0 && xxx < mMinY.count() && !item->isAllDay() ) { + if ( mMinY.at(xxx) > item->cellYTop() ) + mMinY.at(xxx) = item->cellYTop(); + if ( mMaxY.at(xxx) < item->cellYBottom() ) + mMaxY.at(xxx) = item->cellYBottom(); + } QDateTime startDt,endDt; QDate startDate; int lenInSecs; // if ( type == KOAgenda::RESIZETOP ) // qDebug("RESIZETOP "); // if ( type == KOAgenda::RESIZEBOTTOM ) // qDebug("RESIZEBOTTOM "); // if ( type == KOAgenda::MOVE ) // qDebug("MOVE "); if ( item->incidence()->typeID() == eventID ) { startDt =item->incidence()->dtStart(); endDt = item->incidence()->dtEnd(); lenInSecs = startDt.secsTo( endDt ); } // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); if ( item->incidence()->typeID()== todoID && item->mLastMoveXPos > 0 ) { startDate = mSelectedDates[item->mLastMoveXPos]; } else { if (item->cellX() < 0) { startDate = (mSelectedDates.first()).addDays(item->cellX()); } else { startDate = mSelectedDates[item->cellX()]; } } startDt.setDate(startDate); if (item->incidence()->doesFloat()) { endDt.setDate(startDate.addDays(item->cellWidth() - 1)); } else { if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) startDt.setTime(mAgenda->gyToTime(item->cellYTop())); if ( item->incidence()->typeID() == eventID ) { if ( type == KOAgenda::MOVE ) { endDt = startDt.addSecs(lenInSecs); } else if ( type == KOAgenda::RESIZEBOTTOM ) { if (item->lastMultiItem()) { endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); endDt.setDate(startDate. addDays(item->lastMultiItem()->cellX() - item->cellX())); } else { endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); endDt.setDate(startDate); } } } else { |