summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp169
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
@@ -30,10 +30,21 @@
#undef protected
#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>
#include <kdebug.h>
@@ -64,5 +75,5 @@ extern int globalFlagBlockStartup;
////////////////////////////////////////////////////////////////////////////
MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name)
- : QFrame(_agenda->viewport(),name), agenda(_agenda)
+ : Q3Frame(_agenda->viewport(),name), agenda(_agenda)
{
setLineWidth(0);
@@ -170,6 +181,6 @@ 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)
{
@@ -191,6 +202,6 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
all-day events.
*/
-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)
{
mAllAgendaPopup = 0;
@@ -232,5 +243,5 @@ void KOAgenda::init()
connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
- mNewItemPopup = new QPopupMenu( this );
+ mNewItemPopup = new Q3PopupMenu( this );
connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
QString pathString = "";
@@ -241,16 +252,16 @@ void KOAgenda::init()
pathString += "iconsmini/";
- 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
mGridSpacingX = 80;
@@ -264,5 +275,5 @@ void KOAgenda::init()
// Grab key strokes for keyboard navigation of agenda. Seems to have no
// effect. Has to be fixed.
- setFocusPolicy(WheelFocus);
+ setFocusPolicy(Qt::WheelFocus);
connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp()));
@@ -396,9 +407,9 @@ bool KOAgenda::eventFilter ( QObject *object, QEvent *event )
case (QEvent::Leave):
if (!mActionItem)
- setCursor(arrowCursor);
+ setCursor(Qt::arrowCursor);
return true;
default:
- return QScrollView::eventFilter(object,event);
+ return Q3ScrollView::eventFilter(object,event);
}
}
@@ -506,9 +517,9 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
bool leftButt = false;
#ifdef DESKTOP_VERSION
- leftButt = (me->button() == LeftButton);
+ leftButt = (me->button() == Qt::LeftButton);
#endif
switch (me->type()) {
case QEvent::MouseButtonPress:
- if (me->button() == LeftButton) {
+ if (me->button() == Qt::LeftButton) {
mPopupTimer->start( 600 );
mLeftMouseDown = true;
@@ -579,8 +590,8 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
mPopupItem = (KOAgendaItem *)object;
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;
if (mActionItem) {
@@ -601,5 +612,5 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
selectItem(0);
mActionItem = 0;
- if (me->button() == RightButton) {
+ if (me->button() == Qt::RightButton) {
int x,y;
viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
@@ -612,6 +623,6 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
mPopupKind = 4;
popupMenu();
- } else if (me->button() == LeftButton) {
- setCursor(arrowCursor);
+ } else if (me->button() == Qt::LeftButton) {
+ setCursor(Qt::arrowCursor);
startSelectAction(viewportPos);
}
@@ -620,9 +631,9 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
case QEvent::MouseButtonRelease:
- if (me->button() == LeftButton ) {
+ if (me->button() == Qt::LeftButton ) {
mPopupTimer->stop();
}
if (object != viewport()) {
- if (me->button() == LeftButton && mLeftMouseDown) {
+ if (me->button() == Qt::LeftButton && mLeftMouseDown) {
if (mActionItem) {
QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
@@ -634,5 +645,5 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
placeSubCells( mActionItem );
// emit startDragSignal( mActionItem->incidence() );
- setCursor( arrowCursor );
+ setCursor( Qt::arrowCursor );
mActionItem = 0;
mActionType = NOP;
@@ -646,9 +657,9 @@ 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
}
}
- if (me->button() == LeftButton)
+ if (me->button() == Qt::LeftButton)
mLeftMouseDown = false;
@@ -851,13 +862,13 @@ void KOAgenda::startItemAction(QPoint viewportPos)
mActionItem->cellX() == mCurrentCellX) {
mActionType = RESIZELEFT;
- setCursor(sizeHorCursor);
+ setCursor(Qt::sizeHorCursor);
} else if ( allowResize && (mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
mActionItem->cellXWidth() == mCurrentCellX) {
mActionType = RESIZERIGHT;
- setCursor(sizeHorCursor);
+ setCursor(Qt::sizeHorCursor);
} else {
mActionType = MOVE;
mActionItem->startMove();
- setCursor(sizeAllCursor);
+ setCursor(Qt::sizeAllCursor);
}
} else {
@@ -867,14 +878,14 @@ void KOAgenda::startItemAction(QPoint viewportPos)
!mActionItem->firstMultiItem()) {
mActionType = RESIZETOP;
- setCursor(sizeVerCursor);
+ setCursor(Qt::sizeVerCursor);
} else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
mActionItem->cellYBottom() == mCurrentCellY &&
!mActionItem->lastMultiItem()) {
mActionType = RESIZEBOTTOM;
- setCursor(sizeVerCursor);
+ setCursor(Qt::sizeVerCursor);
} else {
mActionType = MOVE;
mActionItem->startMove();
- setCursor(sizeAllCursor);
+ setCursor(Qt::sizeAllCursor);
}
}
@@ -907,5 +918,5 @@ void KOAgenda::performItemAction(QPoint viewportPos)
placeSubCells( mActionItem );
// emit startDragSignal( mActionItem->incidence() );
- setCursor( arrowCursor );
+ setCursor( Qt::arrowCursor );
mActionItem = 0;
mActionType = NOP;
@@ -916,16 +927,16 @@ void KOAgenda::performItemAction(QPoint viewportPos)
switch ( mActionType ) {
case MOVE:
- setCursor( sizeAllCursor );
+ setCursor( Qt::sizeAllCursor );
break;
case RESIZETOP:
case RESIZEBOTTOM:
- setCursor( sizeVerCursor );
+ setCursor( Qt::sizeVerCursor );
break;
case RESIZELEFT:
case RESIZERIGHT:
- setCursor( sizeHorCursor );
+ setCursor( Qt::sizeHorCursor );
break;
default:
- setCursor( arrowCursor );
+ setCursor( Qt::arrowCursor );
}
}
@@ -972,5 +983,5 @@ void KOAgenda::performItemAction(QPoint viewportPos)
gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y);
//moveChild(mActionItem,childX(mActionItem),y);
- QScrollView::moveChild( mActionItem,childX(mActionItem),y );
+ Q3ScrollView::moveChild( mActionItem,childX(mActionItem),y );
}
} else if (mActionType == RESIZEBOTTOM) {
@@ -1020,5 +1031,5 @@ void KOAgenda::endItemAction()
KOAgendaItem *modifiedItem = placeItem;
//emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */);
- QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
+ Q3PtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
KOAgendaItem *item;
@@ -1111,5 +1122,5 @@ void KOAgenda::endItemAction()
mScrollUpTimer.stop();
mScrollDownTimer.stop();
- setCursor( arrowCursor );
+ setCursor( Qt::arrowCursor );
mActionItem = 0;
mActionType = NOP;
@@ -1137,10 +1148,10 @@ void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos)
if (gridDistanceX < mResizeBorderWidth &&
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);
}
} else {
@@ -1149,11 +1160,11 @@ void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos)
moveItem->cellYTop() == gy &&
!moveItem->firstMultiItem()) {
- setCursor(sizeVerCursor);
+ setCursor(Qt::sizeVerCursor);
} else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
moveItem->cellYBottom() == gy &&
!moveItem->lastMultiItem()) {
- setCursor(sizeVerCursor);
+ setCursor(Qt::sizeVerCursor);
} else {
- setCursor(arrowCursor);
+ setCursor(Qt::arrowCursor);
}
}
@@ -1174,7 +1185,7 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
{
- QPtrList<KOAgendaItem> conflictItems;
+ Q3PtrList<KOAgendaItem> conflictItems;
int maxSubCells = 0;
- QIntDict<KOAgendaItem> subCellDict(7);
+ Q3IntDict<KOAgendaItem> subCellDict(7);
KOAgendaItem *item;
@@ -1241,5 +1252,5 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
if ( placeItem != item ) {
KOAgendaItem *item2;
- QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
+ Q3PtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
for ( item2=conflictItems2.first(); item2 != 0;
item2=conflictItems2.next() ) {
@@ -1326,7 +1337,7 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
off += vySel;
//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);
}
}
@@ -1343,5 +1354,5 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
if ( hei < 5 ) p_hei = hei;
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;
}
@@ -1366,5 +1377,5 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
// qDebug(" %d %d %d %d ", cx, cy, cw,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);
if ( mSelectionHeight > 0 ) {
@@ -1380,5 +1391,5 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
if ( hei < 5 ) p_hei = hei;
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;
}
@@ -1577,12 +1588,12 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
if ( lGridSpacingY > 0 ) {
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);
y+=lGridSpacingY;
}
- p->setPen( SolidLine );
+ p->setPen( Qt::SolidLine );
}
mPixPainter.end() ;
@@ -1718,5 +1729,5 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
mUnusedItems.append( item );
mItems.remove( item );
- QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
+ Q3PtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
KOAgendaItem *itemit;
//globalFlagBlockAgendaItemPaint = 1;
@@ -1748,5 +1759,5 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
//qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
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;
if ( todo->hasCompletedDate() )
@@ -1780,5 +1791,5 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
qApp->processEvents();
globalFlagBlockAgendaItemPaint = 0;
- QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
+ Q3PtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
KOAgendaItem *itemit;
for ( itemit=oldconflictItems.first(); itemit != 0;
@@ -1868,5 +1879,5 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
int count = 0;
KOAgendaItem *current = 0;
- QPtrList<KOAgendaItem> multiItems;
+ Q3PtrList<KOAgendaItem> multiItems;
for (cellX = XBegin;cellX <= XEnd;++cellX) {
if (cellX == XBegin) cellYTop = YTop;
@@ -1928,5 +1939,5 @@ void KOAgenda::resizeEvent ( QResizeEvent *ev )
mResizeTimer.start( 150 , true );
computeSizes();
- QScrollView::resizeEvent( ev );
+ Q3ScrollView::resizeEvent( ev );
return;
@@ -2017,5 +2028,5 @@ void KOAgenda::popupAlarm()
// TODO: deal correctly with multiple alarms
Alarm* alarm;
- QPtrList<Alarm> list(mClickedItem->incidence()->alarms());
+ Q3PtrList<Alarm> list(mClickedItem->incidence()->alarms());
for(alarm=list.first();alarm;alarm=list.next()) {
alarm->toggleAlarm();
@@ -2108,14 +2119,14 @@ 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();
break;
@@ -2147,5 +2158,5 @@ void KOAgenda::setDateList(const DateList &selectedDates)
}
-void KOAgenda::setHolidayMask(QMemArray<bool> *mask)
+void KOAgenda::setHolidayMask(Q3MemArray<bool> *mask)
{
mHolidayMask = mask;
@@ -2163,5 +2174,5 @@ void KOAgenda::contentsMousePressEvent ( QMouseEvent *event )
{
- QScrollView::contentsMousePressEvent(event);
+ Q3ScrollView::contentsMousePressEvent(event);
}
@@ -2197,5 +2208,5 @@ void KOAgenda::moveChild( QWidget *w, int x , int y )
{
++x;
- QScrollView::moveChild( w, x , y );
+ Q3ScrollView::moveChild( w, x , y );
}
#include <qmessagebox.h>
@@ -2203,5 +2214,5 @@ void KOAgenda::moveChild( QWidget *w, int x , int y )
#include <qprinter.h>
#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
+#include <q3paintdevicemetrics.h>
#endif
@@ -2232,5 +2243,5 @@ 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() );
//date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true );