-rw-r--r-- | korganizer/koagenda.cpp | 169 |
1 files changed, 90 insertions, 79 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 1d4d6de..fe59787 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -31,8 +31,19 @@ #endif -#include <qintdict.h> +#include <q3intdict.h> #include <qdatetime.h> #include <qapplication.h> -#include <qpopupmenu.h> +#include <q3popupmenu.h> #include <qcursor.h> #include <qpainter.h> +#include <QDesktopWidget> +//Added by qt3to4: +#include <QResizeEvent> +#include <QLabel> +#include <QPixmap> +#include <QMouseEvent> +#include <QKeyEvent> +#include <Q3MemArray> +#include <QEvent> +#include <Q3Frame> +#include <Q3PtrList> @@ -65,3 +76,3 @@ extern int globalFlagBlockStartup; MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) - : QFrame(_agenda->viewport(),name), agenda(_agenda) + : Q3Frame(_agenda->viewport(),name), agenda(_agenda) { @@ -171,4 +182,4 @@ void MarcusBains::updateLocation(bool recalculate) KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, - const char *name,WFlags f) : - QScrollView(parent,name,f) + const char *name,Qt::WFlags f) : + Q3ScrollView(parent,name,f) { @@ -192,4 +203,4 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, */ -KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : - QScrollView(parent,name,f) +KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,Qt::WFlags f) : + Q3ScrollView(parent,name,f) { @@ -233,3 +244,3 @@ void KOAgenda::init() - mNewItemPopup = new QPopupMenu( this ); + mNewItemPopup = new Q3PopupMenu( this ); connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); @@ -242,14 +253,14 @@ void KOAgenda::init() - mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); - mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); + mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); + mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); mNewItemPopup->insertSeparator ( ); - mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); - mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); - mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); - mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); - mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); - mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); + mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"day" ), i18n("Day view"),3 ); + mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); + mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"week" ), i18n("Next week"),4 ); + mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); + mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"month" ), i18n("This month"),6 ); + mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); #ifndef _WIN32_ - int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase - viewport()->setWFlags ( wflags); + Qt::WindowFlags wflags = viewport()-> windowFlags() |Qt::WRepaintNoErase;//WResizeNoErase + viewport()->setWindowFlags ( wflags); #endif @@ -265,3 +276,3 @@ void KOAgenda::init() // effect. Has to be fixed. - setFocusPolicy(WheelFocus); + setFocusPolicy(Qt::WheelFocus); @@ -397,3 +408,3 @@ bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) if (!mActionItem) - setCursor(arrowCursor); + setCursor(Qt::arrowCursor); return true; @@ -401,3 +412,3 @@ bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) default: - return QScrollView::eventFilter(object,event); + return Q3ScrollView::eventFilter(object,event); } @@ -507,3 +518,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) #ifdef DESKTOP_VERSION - leftButt = (me->button() == LeftButton); + leftButt = (me->button() == Qt::LeftButton); #endif @@ -511,3 +522,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) case QEvent::MouseButtonPress: - if (me->button() == LeftButton) { + if (me->button() == Qt::LeftButton) { mPopupTimer->start( 600 ); @@ -580,6 +591,6 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) mPopupKind = 1; - if (me->button() == RightButton) { + if (me->button() == Qt::RightButton) { mPopupKind = 3; popupMenu(); - } else if (me->button() == LeftButton) { + } else if (me->button() == Qt::LeftButton) { mActionItem = (KOAgendaItem *)object; @@ -602,3 +613,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) mActionItem = 0; - if (me->button() == RightButton) { + if (me->button() == Qt::RightButton) { int x,y; @@ -613,4 +624,4 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) popupMenu(); - } else if (me->button() == LeftButton) { - setCursor(arrowCursor); + } else if (me->button() == Qt::LeftButton) { + setCursor(Qt::arrowCursor); startSelectAction(viewportPos); @@ -621,3 +632,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) case QEvent::MouseButtonRelease: - if (me->button() == LeftButton ) { + if (me->button() == Qt::LeftButton ) { mPopupTimer->stop(); @@ -625,3 +636,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) if (object != viewport()) { - if (me->button() == LeftButton && mLeftMouseDown) { + if (me->button() == Qt::LeftButton && mLeftMouseDown) { if (mActionItem) { @@ -635,3 +646,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) // emit startDragSignal( mActionItem->incidence() ); - setCursor( arrowCursor ); + setCursor( Qt::arrowCursor ); mActionItem = 0; @@ -647,3 +658,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) } else { // ---------- viewport() - if (me->button() == LeftButton && mLeftMouseDown ) { //left click + if (me->button() == Qt::LeftButton && mLeftMouseDown ) { //left click endSelectAction( true ); // emit new event signal @@ -651,3 +662,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) } - if (me->button() == LeftButton) + if (me->button() == Qt::LeftButton) mLeftMouseDown = false; @@ -852,3 +863,3 @@ void KOAgenda::startItemAction(QPoint viewportPos) mActionType = RESIZELEFT; - setCursor(sizeHorCursor); + setCursor(Qt::sizeHorCursor); } else if ( allowResize && (mGridSpacingX - gridDistanceX) < mResizeBorderWidth && @@ -856,3 +867,3 @@ void KOAgenda::startItemAction(QPoint viewportPos) mActionType = RESIZERIGHT; - setCursor(sizeHorCursor); + setCursor(Qt::sizeHorCursor); } else { @@ -860,3 +871,3 @@ void KOAgenda::startItemAction(QPoint viewportPos) mActionItem->startMove(); - setCursor(sizeAllCursor); + setCursor(Qt::sizeAllCursor); } @@ -868,3 +879,3 @@ void KOAgenda::startItemAction(QPoint viewportPos) mActionType = RESIZETOP; - setCursor(sizeVerCursor); + setCursor(Qt::sizeVerCursor); } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && @@ -873,3 +884,3 @@ void KOAgenda::startItemAction(QPoint viewportPos) mActionType = RESIZEBOTTOM; - setCursor(sizeVerCursor); + setCursor(Qt::sizeVerCursor); } else { @@ -877,3 +888,3 @@ void KOAgenda::startItemAction(QPoint viewportPos) mActionItem->startMove(); - setCursor(sizeAllCursor); + setCursor(Qt::sizeAllCursor); } @@ -908,3 +919,3 @@ void KOAgenda::performItemAction(QPoint viewportPos) // emit startDragSignal( mActionItem->incidence() ); - setCursor( arrowCursor ); + setCursor( Qt::arrowCursor ); mActionItem = 0; @@ -917,3 +928,3 @@ void KOAgenda::performItemAction(QPoint viewportPos) case MOVE: - setCursor( sizeAllCursor ); + setCursor( Qt::sizeAllCursor ); break; @@ -921,3 +932,3 @@ void KOAgenda::performItemAction(QPoint viewportPos) case RESIZEBOTTOM: - setCursor( sizeVerCursor ); + setCursor( Qt::sizeVerCursor ); break; @@ -925,6 +936,6 @@ void KOAgenda::performItemAction(QPoint viewportPos) case RESIZERIGHT: - setCursor( sizeHorCursor ); + setCursor( Qt::sizeHorCursor ); break; default: - setCursor( arrowCursor ); + setCursor( Qt::arrowCursor ); } @@ -973,3 +984,3 @@ void KOAgenda::performItemAction(QPoint viewportPos) //moveChild(mActionItem,childX(mActionItem),y); - QScrollView::moveChild( mActionItem,childX(mActionItem),y ); + Q3ScrollView::moveChild( mActionItem,childX(mActionItem),y ); } @@ -1021,3 +1032,3 @@ void KOAgenda::endItemAction() //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); - QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); + Q3PtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); KOAgendaItem *item; @@ -1112,3 +1123,3 @@ void KOAgenda::endItemAction() mScrollDownTimer.stop(); - setCursor( arrowCursor ); + setCursor( Qt::arrowCursor ); mActionItem = 0; @@ -1138,8 +1149,8 @@ void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) moveItem->cellX() == gx) { - setCursor(sizeHorCursor); + setCursor(Qt::sizeHorCursor); } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && moveItem->cellXWidth() == gx) { - setCursor(sizeHorCursor); + setCursor(Qt::sizeHorCursor); } else { - setCursor(arrowCursor); + setCursor(Qt::arrowCursor); } @@ -1150,3 +1161,3 @@ void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) !moveItem->firstMultiItem()) { - setCursor(sizeVerCursor); + setCursor(Qt::sizeVerCursor); } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && @@ -1154,5 +1165,5 @@ void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) !moveItem->lastMultiItem()) { - setCursor(sizeVerCursor); + setCursor(Qt::sizeVerCursor); } else { - setCursor(arrowCursor); + setCursor(Qt::arrowCursor); } @@ -1175,5 +1186,5 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) - QPtrList<KOAgendaItem> conflictItems; + Q3PtrList<KOAgendaItem> conflictItems; int maxSubCells = 0; - QIntDict<KOAgendaItem> subCellDict(7); + Q3IntDict<KOAgendaItem> subCellDict(7); @@ -1242,3 +1253,3 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) KOAgendaItem *item2; - QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); + Q3PtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); for ( item2=conflictItems2.first(); item2 != 0; @@ -1327,5 +1338,5 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) //qDebug("OFF %d %d %d", off,vySel, vy ); - bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); + bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,QPainter::CompositionMode_Source); } else { - bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); + bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,QPainter::CompositionMode_Source); } @@ -1344,3 +1355,3 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) hei -= 5; - bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); + bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,QPainter::CompositionMode_Source); offset += 5; @@ -1367,3 +1378,3 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) - bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); + bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,QPainter::CompositionMode_Source); @@ -1381,3 +1392,3 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) hei -= 5; - bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); + bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,QPainter::CompositionMode_Source); offset += 5; @@ -1578,6 +1589,6 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i while (y < cy + ch) { - p->setPen( SolidLine ); + p->setPen( Qt::SolidLine ); p->drawLine(cx,y,cx+cw,y); y+=lGridSpacingY; - p->setPen( DotLine ); + p->setPen( Qt::DotLine ); p->drawLine(cx,y,cx+cw,y); @@ -1585,3 +1596,3 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i } - p->setPen( SolidLine ); + p->setPen( Qt::SolidLine ); } @@ -1719,3 +1730,3 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) mItems.remove( item ); - QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); + Q3PtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); KOAgendaItem *itemit; @@ -1749,3 +1760,3 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) QDate currentDate = QDate::currentDate(); - bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda ); + bool overdue = (!todo->isCompleted()) && (todo->dtDue() < (QDateTime)currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda ); QDateTime dt; @@ -1781,3 +1792,3 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) globalFlagBlockAgendaItemPaint = 0; - QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); + Q3PtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); KOAgendaItem *itemit; @@ -1869,3 +1880,3 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, KOAgendaItem *current = 0; - QPtrList<KOAgendaItem> multiItems; + Q3PtrList<KOAgendaItem> multiItems; for (cellX = XBegin;cellX <= XEnd;++cellX) { @@ -1929,3 +1940,3 @@ void KOAgenda::resizeEvent ( QResizeEvent *ev ) computeSizes(); - QScrollView::resizeEvent( ev ); + Q3ScrollView::resizeEvent( ev ); return; @@ -2018,3 +2029,3 @@ void KOAgenda::popupAlarm() Alarm* alarm; - QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); + Q3PtrList<Alarm> list(mClickedItem->incidence()->alarms()); for(alarm=list.first();alarm;alarm=list.next()) { @@ -2109,12 +2120,12 @@ void KOAgenda::keyPressEvent( QKeyEvent *kev ) switch(kev->key()) { - case Key_PageDown: + case Qt::Key_PageDown: verticalScrollBar()->addPage(); break; - case Key_PageUp: + case Qt::Key_PageUp: verticalScrollBar()->subtractPage(); break; - case Key_Down: + case Qt::Key_Down: verticalScrollBar()->addLine(); break; - case Key_Up: + case Qt::Key_Up: verticalScrollBar()->subtractLine(); @@ -2148,3 +2159,3 @@ void KOAgenda::setDateList(const DateList &selectedDates) -void KOAgenda::setHolidayMask(QMemArray<bool> *mask) +void KOAgenda::setHolidayMask(Q3MemArray<bool> *mask) { @@ -2164,3 +2175,3 @@ void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) - QScrollView::contentsMousePressEvent(event); + Q3ScrollView::contentsMousePressEvent(event); } @@ -2198,3 +2209,3 @@ void KOAgenda::moveChild( QWidget *w, int x , int y ) ++x; - QScrollView::moveChild( w, x , y ); + Q3ScrollView::moveChild( w, x , y ); } @@ -2204,3 +2215,3 @@ void KOAgenda::moveChild( QWidget *w, int x , int y ) #include <qpainter.h> -#include <qpaintdevicemetrics.h> +#include <q3paintdevicemetrics.h> @@ -2233,3 +2244,3 @@ void KOAgenda::printSelection() QPainter p( printer ); - QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); + Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( printer ); QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); |