summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
Unidiff
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
@@ -29,12 +29,23 @@
29#include <qwidget.h> 29#include <qwidget.h>
30#undef protected 30#undef protected
31#endif 31#endif
32#include <qintdict.h> 32#include <q3intdict.h>
33#include <qdatetime.h> 33#include <qdatetime.h>
34#include <qapplication.h> 34#include <qapplication.h>
35#include <qpopupmenu.h> 35#include <q3popupmenu.h>
36#include <qcursor.h> 36#include <qcursor.h>
37#include <qpainter.h> 37#include <qpainter.h>
38#include <QDesktopWidget>
39//Added by qt3to4:
40#include <QResizeEvent>
41#include <QLabel>
42#include <QPixmap>
43#include <QMouseEvent>
44#include <QKeyEvent>
45#include <Q3MemArray>
46#include <QEvent>
47#include <Q3Frame>
48#include <Q3PtrList>
38 49
39#include <kdebug.h> 50#include <kdebug.h>
40#include <klocale.h> 51#include <klocale.h>
@@ -63,7 +74,7 @@ extern int globalFlagBlockStartup;
63 74
64//////////////////////////////////////////////////////////////////////////// 75////////////////////////////////////////////////////////////////////////////
65MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) 76MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name)
66 : QFrame(_agenda->viewport(),name), agenda(_agenda) 77 : Q3Frame(_agenda->viewport(),name), agenda(_agenda)
67{ 78{
68 setLineWidth(0); 79 setLineWidth(0);
69 setMargin(0); 80 setMargin(0);
@@ -169,8 +180,8 @@ void MarcusBains::updateLocation(bool recalculate)
169 Create an agenda widget with rows rows and columns columns. 180 Create an agenda widget with rows rows and columns columns.
170*/ 181*/
171KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, 182KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
172 const char *name,WFlags f) : 183 const char *name,Qt::WFlags f) :
173 QScrollView(parent,name,f) 184 Q3ScrollView(parent,name,f)
174{ 185{
175 186
176 mAllAgendaPopup = 0; 187 mAllAgendaPopup = 0;
@@ -190,8 +201,8 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
190 Create an agenda widget with columns columns and one row. This is used for 201 Create an agenda widget with columns columns and one row. This is used for
191 all-day events. 202 all-day events.
192*/ 203*/
193KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : 204KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,Qt::WFlags f) :
194 QScrollView(parent,name,f) 205 Q3ScrollView(parent,name,f)
195{ 206{
196 mAllAgendaPopup = 0; 207 mAllAgendaPopup = 0;
197 blockResize = false; 208 blockResize = false;
@@ -231,7 +242,7 @@ void KOAgenda::init()
231 mPopupTimer = new QTimer(this); 242 mPopupTimer = new QTimer(this);
232 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 243 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
233 244
234 mNewItemPopup = new QPopupMenu( this ); 245 mNewItemPopup = new Q3PopupMenu( this );
235 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); 246 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
236 QString pathString = ""; 247 QString pathString = "";
237 if ( !KOPrefs::instance()->mToolBarMiniIcons ) { 248 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
@@ -240,18 +251,18 @@ void KOAgenda::init()
240 } else 251 } else
241 pathString += "iconsmini/"; 252 pathString += "iconsmini/";
242 253
243 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); 254 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
244 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); 255 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
245 mNewItemPopup->insertSeparator ( ); 256 mNewItemPopup->insertSeparator ( );
246 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); 257 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"day" ), i18n("Day view"),3 );
247 mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); 258 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"xdays" ), i18n("Next days"),8 );
248 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); 259 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"week" ), i18n("Next week"),4 );
249 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); 260 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 );
250 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); 261 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"month" ), i18n("This month"),6 );
251 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); 262 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
252#ifndef _WIN32_ 263#ifndef _WIN32_
253 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase 264 Qt::WindowFlags wflags = viewport()-> windowFlags() |Qt::WRepaintNoErase;//WResizeNoErase
254 viewport()->setWFlags ( wflags); 265 viewport()->setWindowFlags ( wflags);
255#endif 266#endif
256 mGridSpacingX = 80; 267 mGridSpacingX = 80;
257 mResizeBorderWidth = 8; 268 mResizeBorderWidth = 8;
@@ -263,7 +274,7 @@ void KOAgenda::init()
263 274
264 // Grab key strokes for keyboard navigation of agenda. Seems to have no 275 // Grab key strokes for keyboard navigation of agenda. Seems to have no
265 // effect. Has to be fixed. 276 // effect. Has to be fixed.
266 setFocusPolicy(WheelFocus); 277 setFocusPolicy(Qt::WheelFocus);
267 278
268 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); 279 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp()));
269 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); 280 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown()));
@@ -395,11 +406,11 @@ bool KOAgenda::eventFilter ( QObject *object, QEvent *event )
395 406
396 case (QEvent::Leave): 407 case (QEvent::Leave):
397 if (!mActionItem) 408 if (!mActionItem)
398 setCursor(arrowCursor); 409 setCursor(Qt::arrowCursor);
399 return true; 410 return true;
400 411
401 default: 412 default:
402 return QScrollView::eventFilter(object,event); 413 return Q3ScrollView::eventFilter(object,event);
403 } 414 }
404} 415}
405void KOAgenda::popupMenu() 416void KOAgenda::popupMenu()
@@ -505,11 +516,11 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
505 bool objIsNotViewport = (object != viewport()); 516 bool objIsNotViewport = (object != viewport());
506 bool leftButt = false; 517 bool leftButt = false;
507#ifdef DESKTOP_VERSION 518#ifdef DESKTOP_VERSION
508 leftButt = (me->button() == LeftButton); 519 leftButt = (me->button() == Qt::LeftButton);
509#endif 520#endif
510 switch (me->type()) { 521 switch (me->type()) {
511 case QEvent::MouseButtonPress: 522 case QEvent::MouseButtonPress:
512 if (me->button() == LeftButton) { 523 if (me->button() == Qt::LeftButton) {
513 mPopupTimer->start( 600 ); 524 mPopupTimer->start( 600 );
514 mLeftMouseDown = true; 525 mLeftMouseDown = true;
515 } 526 }
@@ -578,10 +589,10 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
578 if ( objIsNotViewport ) { 589 if ( objIsNotViewport ) {
579 mPopupItem = (KOAgendaItem *)object; 590 mPopupItem = (KOAgendaItem *)object;
580 mPopupKind = 1; 591 mPopupKind = 1;
581 if (me->button() == RightButton) { 592 if (me->button() == Qt::RightButton) {
582 mPopupKind = 3; 593 mPopupKind = 3;
583 popupMenu(); 594 popupMenu();
584 } else if (me->button() == LeftButton) { 595 } else if (me->button() == Qt::LeftButton) {
585 mActionItem = (KOAgendaItem *)object; 596 mActionItem = (KOAgendaItem *)object;
586 if (mActionItem) { 597 if (mActionItem) {
587 emit signalClearSelection(); 598 emit signalClearSelection();
@@ -600,7 +611,7 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
600 mPopupKind = 2; 611 mPopupKind = 2;
601 selectItem(0); 612 selectItem(0);
602 mActionItem = 0; 613 mActionItem = 0;
603 if (me->button() == RightButton) { 614 if (me->button() == Qt::RightButton) {
604 int x,y; 615 int x,y;
605 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 616 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
606 int gx,gy; 617 int gx,gy;
@@ -611,19 +622,19 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
611 mStartCellY = gy; 622 mStartCellY = gy;
612 mPopupKind = 4; 623 mPopupKind = 4;
613 popupMenu(); 624 popupMenu();
614 } else if (me->button() == LeftButton) { 625 } else if (me->button() == Qt::LeftButton) {
615 setCursor(arrowCursor); 626 setCursor(Qt::arrowCursor);
616 startSelectAction(viewportPos); 627 startSelectAction(viewportPos);
617 } 628 }
618 } 629 }
619 break; 630 break;
620 631
621 case QEvent::MouseButtonRelease: 632 case QEvent::MouseButtonRelease:
622 if (me->button() == LeftButton ) { 633 if (me->button() == Qt::LeftButton ) {
623 mPopupTimer->stop(); 634 mPopupTimer->stop();
624 } 635 }
625 if (object != viewport()) { 636 if (object != viewport()) {
626 if (me->button() == LeftButton && mLeftMouseDown) { 637 if (me->button() == Qt::LeftButton && mLeftMouseDown) {
627 if (mActionItem) { 638 if (mActionItem) {
628 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 639 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
629 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); 640 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 );
@@ -633,7 +644,7 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
633 mActionItem->resetMove(); 644 mActionItem->resetMove();
634 placeSubCells( mActionItem ); 645 placeSubCells( mActionItem );
635 // emit startDragSignal( mActionItem->incidence() ); 646 // emit startDragSignal( mActionItem->incidence() );
636 setCursor( arrowCursor ); 647 setCursor( Qt::arrowCursor );
637 mActionItem = 0; 648 mActionItem = 0;
638 mActionType = NOP; 649 mActionType = NOP;
639 mItemMoved = 0; 650 mItemMoved = 0;
@@ -645,11 +656,11 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
645 } 656 }
646 657
647 } else { // ---------- viewport() 658 } else { // ---------- viewport()
648 if (me->button() == LeftButton && mLeftMouseDown ) { //left click 659 if (me->button() == Qt::LeftButton && mLeftMouseDown ) { //left click
649 endSelectAction( true ); // emit new event signal 660 endSelectAction( true ); // emit new event signal
650 } 661 }
651 } 662 }
652 if (me->button() == LeftButton) 663 if (me->button() == Qt::LeftButton)
653 mLeftMouseDown = false; 664 mLeftMouseDown = false;
654 665
655 break; 666 break;
@@ -850,15 +861,15 @@ void KOAgenda::startItemAction(QPoint viewportPos)
850 if ( allowResize && gridDistanceX < mResizeBorderWidth && 861 if ( allowResize && gridDistanceX < mResizeBorderWidth &&
851 mActionItem->cellX() == mCurrentCellX) { 862 mActionItem->cellX() == mCurrentCellX) {
852 mActionType = RESIZELEFT; 863 mActionType = RESIZELEFT;
853 setCursor(sizeHorCursor); 864 setCursor(Qt::sizeHorCursor);
854 } else if ( allowResize && (mGridSpacingX - gridDistanceX) < mResizeBorderWidth && 865 } else if ( allowResize && (mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
855 mActionItem->cellXWidth() == mCurrentCellX) { 866 mActionItem->cellXWidth() == mCurrentCellX) {
856 mActionType = RESIZERIGHT; 867 mActionType = RESIZERIGHT;
857 setCursor(sizeHorCursor); 868 setCursor(Qt::sizeHorCursor);
858 } else { 869 } else {
859 mActionType = MOVE; 870 mActionType = MOVE;
860 mActionItem->startMove(); 871 mActionItem->startMove();
861 setCursor(sizeAllCursor); 872 setCursor(Qt::sizeAllCursor);
862 } 873 }
863 } else { 874 } else {
864 int gridDistanceY = (y - gy * mGridSpacingY); 875 int gridDistanceY = (y - gy * mGridSpacingY);
@@ -866,16 +877,16 @@ void KOAgenda::startItemAction(QPoint viewportPos)
866 mActionItem->cellYTop() == mCurrentCellY && 877 mActionItem->cellYTop() == mCurrentCellY &&
867 !mActionItem->firstMultiItem()) { 878 !mActionItem->firstMultiItem()) {
868 mActionType = RESIZETOP; 879 mActionType = RESIZETOP;
869 setCursor(sizeVerCursor); 880 setCursor(Qt::sizeVerCursor);
870 } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && 881 } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
871 mActionItem->cellYBottom() == mCurrentCellY && 882 mActionItem->cellYBottom() == mCurrentCellY &&
872 !mActionItem->lastMultiItem()) { 883 !mActionItem->lastMultiItem()) {
873 mActionType = RESIZEBOTTOM; 884 mActionType = RESIZEBOTTOM;
874 setCursor(sizeVerCursor); 885 setCursor(Qt::sizeVerCursor);
875 } else { 886 } else {
876 mActionType = MOVE; 887 mActionType = MOVE;
877 mActionItem->startMove(); 888 mActionItem->startMove();
878 setCursor(sizeAllCursor); 889 setCursor(Qt::sizeAllCursor);
879 } 890 }
880 } 891 }
881} 892}
@@ -906,7 +917,7 @@ void KOAgenda::performItemAction(QPoint viewportPos)
906 mActionItem->resetMove(); 917 mActionItem->resetMove();
907 placeSubCells( mActionItem ); 918 placeSubCells( mActionItem );
908 // emit startDragSignal( mActionItem->incidence() ); 919 // emit startDragSignal( mActionItem->incidence() );
909 setCursor( arrowCursor ); 920 setCursor( Qt::arrowCursor );
910 mActionItem = 0; 921 mActionItem = 0;
911 mActionType = NOP; 922 mActionType = NOP;
912 mItemMoved = 0; 923 mItemMoved = 0;
@@ -915,18 +926,18 @@ void KOAgenda::performItemAction(QPoint viewportPos)
915 } else { 926 } else {
916 switch ( mActionType ) { 927 switch ( mActionType ) {
917 case MOVE: 928 case MOVE:
918 setCursor( sizeAllCursor ); 929 setCursor( Qt::sizeAllCursor );
919 break; 930 break;
920 case RESIZETOP: 931 case RESIZETOP:
921 case RESIZEBOTTOM: 932 case RESIZEBOTTOM:
922 setCursor( sizeVerCursor ); 933 setCursor( Qt::sizeVerCursor );
923 break; 934 break;
924 case RESIZELEFT: 935 case RESIZELEFT:
925 case RESIZERIGHT: 936 case RESIZERIGHT:
926 setCursor( sizeHorCursor ); 937 setCursor( Qt::sizeHorCursor );
927 break; 938 break;
928 default: 939 default:
929 setCursor( arrowCursor ); 940 setCursor( Qt::arrowCursor );
930 } 941 }
931 } 942 }
932 943
@@ -971,7 +982,7 @@ void KOAgenda::performItemAction(QPoint viewportPos)
971 int x,y; 982 int x,y;
972 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); 983 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y);
973 //moveChild(mActionItem,childX(mActionItem),y); 984 //moveChild(mActionItem,childX(mActionItem),y);
974 QScrollView::moveChild( mActionItem,childX(mActionItem),y ); 985 Q3ScrollView::moveChild( mActionItem,childX(mActionItem),y );
975 } 986 }
976 } else if (mActionType == RESIZEBOTTOM) { 987 } else if (mActionType == RESIZEBOTTOM) {
977 if (mCurrentCellY >= mActionItem->cellYTop()) { 988 if (mCurrentCellY >= mActionItem->cellYTop()) {
@@ -1019,7 +1030,7 @@ void KOAgenda::endItemAction()
1019 type = -1; 1030 type = -1;
1020 KOAgendaItem *modifiedItem = placeItem; 1031 KOAgendaItem *modifiedItem = placeItem;
1021 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); 1032 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */);
1022 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); 1033 Q3PtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
1023 KOAgendaItem *item; 1034 KOAgendaItem *item;
1024 1035
1025 if ( placeItem->incidence()->typeID() == todoID ) { 1036 if ( placeItem->incidence()->typeID() == todoID ) {
@@ -1110,7 +1121,7 @@ void KOAgenda::endItemAction()
1110 emit incidenceSelected( mActionItem->incidence() ); 1121 emit incidenceSelected( mActionItem->incidence() );
1111 mScrollUpTimer.stop(); 1122 mScrollUpTimer.stop();
1112 mScrollDownTimer.stop(); 1123 mScrollDownTimer.stop();
1113 setCursor( arrowCursor ); 1124 setCursor( Qt::arrowCursor );
1114 mActionItem = 0; 1125 mActionItem = 0;
1115 mActionType = NOP; 1126 mActionType = NOP;
1116 mItemMoved = 0; 1127 mItemMoved = 0;
@@ -1136,25 +1147,25 @@ void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos)
1136 int gridDistanceX = (x - gx * mGridSpacingX); 1147 int gridDistanceX = (x - gx * mGridSpacingX);
1137 if (gridDistanceX < mResizeBorderWidth && 1148 if (gridDistanceX < mResizeBorderWidth &&
1138 moveItem->cellX() == gx) { 1149 moveItem->cellX() == gx) {
1139 setCursor(sizeHorCursor); 1150 setCursor(Qt::sizeHorCursor);
1140 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && 1151 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
1141 moveItem->cellXWidth() == gx) { 1152 moveItem->cellXWidth() == gx) {
1142 setCursor(sizeHorCursor); 1153 setCursor(Qt::sizeHorCursor);
1143 } else { 1154 } else {
1144 setCursor(arrowCursor); 1155 setCursor(Qt::arrowCursor);
1145 } 1156 }
1146 } else { 1157 } else {
1147 int gridDistanceY = (y - gy * mGridSpacingY); 1158 int gridDistanceY = (y - gy * mGridSpacingY);
1148 if (gridDistanceY < mResizeBorderWidth && 1159 if (gridDistanceY < mResizeBorderWidth &&
1149 moveItem->cellYTop() == gy && 1160 moveItem->cellYTop() == gy &&
1150 !moveItem->firstMultiItem()) { 1161 !moveItem->firstMultiItem()) {
1151 setCursor(sizeVerCursor); 1162 setCursor(Qt::sizeVerCursor);
1152 } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && 1163 } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
1153 moveItem->cellYBottom() == gy && 1164 moveItem->cellYBottom() == gy &&
1154 !moveItem->lastMultiItem()) { 1165 !moveItem->lastMultiItem()) {
1155 setCursor(sizeVerCursor); 1166 setCursor(Qt::sizeVerCursor);
1156 } else { 1167 } else {
1157 setCursor(arrowCursor); 1168 setCursor(Qt::arrowCursor);
1158 } 1169 }
1159 } 1170 }
1160} 1171}
@@ -1173,9 +1184,9 @@ void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos)
1173void KOAgenda::placeSubCells(KOAgendaItem *placeItem) 1184void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1174{ 1185{
1175 1186
1176 QPtrList<KOAgendaItem> conflictItems; 1187 Q3PtrList<KOAgendaItem> conflictItems;
1177 int maxSubCells = 0; 1188 int maxSubCells = 0;
1178 QIntDict<KOAgendaItem> subCellDict(7); 1189 Q3IntDict<KOAgendaItem> subCellDict(7);
1179 1190
1180 KOAgendaItem *item; 1191 KOAgendaItem *item;
1181 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1192 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
@@ -1240,7 +1251,7 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1240 item=conflictItems.next() ) { 1251 item=conflictItems.next() ) {
1241 if ( placeItem != item ) { 1252 if ( placeItem != item ) {
1242 KOAgendaItem *item2; 1253 KOAgendaItem *item2;
1243 QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); 1254 Q3PtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
1244 for ( item2=conflictItems2.first(); item2 != 0; 1255 for ( item2=conflictItems2.first(); item2 != 0;
1245 item2=conflictItems2.next() ) { 1256 item2=conflictItems2.next() ) {
1246 if ( item2->subCells() != maxSubCells) { 1257 if ( item2->subCells() != maxSubCells) {
@@ -1325,9 +1336,9 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1325 if ( vySel < 0 ) 1336 if ( vySel < 0 )
1326 off += vySel; 1337 off += vySel;
1327 //qDebug("OFF %d %d %d", off,vySel, vy ); 1338 //qDebug("OFF %d %d %d", off,vySel, vy );
1328 bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); 1339 bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,QPainter::CompositionMode_Source);
1329 } else { 1340 } else {
1330 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1341 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,QPainter::CompositionMode_Source);
1331 } 1342 }
1332 } 1343 }
1333 if ( mSelectionHeight > 0 ) { 1344 if ( mSelectionHeight > 0 ) {
@@ -1342,7 +1353,7 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1342 int p_hei = 5; 1353 int p_hei = 5;
1343 if ( hei < 5 ) p_hei = hei; 1354 if ( hei < 5 ) p_hei = hei;
1344 hei -= 5; 1355 hei -= 5;
1345 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); 1356 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,QPainter::CompositionMode_Source);
1346 offset += 5; 1357 offset += 5;
1347 } 1358 }
1348 } 1359 }
@@ -1365,7 +1376,7 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1365 contentsToViewport ( cx, cy, vx,vy); 1376 contentsToViewport ( cx, cy, vx,vy);
1366 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; 1377 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ;
1367 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) 1378 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) )
1368 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1379 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,QPainter::CompositionMode_Source);
1369 1380
1370 if ( mSelectionHeight > 0 ) { 1381 if ( mSelectionHeight > 0 ) {
1371 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); 1382 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
@@ -1379,7 +1390,7 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1379 int p_hei = 5; 1390 int p_hei = 5;
1380 if ( hei < 5 ) p_hei = hei; 1391 if ( hei < 5 ) p_hei = hei;
1381 hei -= 5; 1392 hei -= 5;
1382 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); 1393 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,QPainter::CompositionMode_Source);
1383 offset += 5; 1394 offset += 5;
1384 } 1395 }
1385 } 1396 }
@@ -1576,14 +1587,14 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
1576 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; 1587 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY;
1577 if ( lGridSpacingY > 0 ) { 1588 if ( lGridSpacingY > 0 ) {
1578 while (y < cy + ch) { 1589 while (y < cy + ch) {
1579 p->setPen( SolidLine ); 1590 p->setPen( Qt::SolidLine );
1580 p->drawLine(cx,y,cx+cw,y); 1591 p->drawLine(cx,y,cx+cw,y);
1581 y+=lGridSpacingY; 1592 y+=lGridSpacingY;
1582 p->setPen( DotLine ); 1593 p->setPen( Qt::DotLine );
1583 p->drawLine(cx,y,cx+cw,y); 1594 p->drawLine(cx,y,cx+cw,y);
1584 y+=lGridSpacingY; 1595 y+=lGridSpacingY;
1585 } 1596 }
1586 p->setPen( SolidLine ); 1597 p->setPen( Qt::SolidLine );
1587 } 1598 }
1588 mPixPainter.end() ; 1599 mPixPainter.end() ;
1589} 1600}
@@ -1717,7 +1728,7 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1717 item->select(false); 1728 item->select(false);
1718 mUnusedItems.append( item ); 1729 mUnusedItems.append( item );
1719 mItems.remove( item ); 1730 mItems.remove( item );
1720 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1731 Q3PtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1721 KOAgendaItem *itemit; 1732 KOAgendaItem *itemit;
1722 //globalFlagBlockAgendaItemPaint = 1; 1733 //globalFlagBlockAgendaItemPaint = 1;
1723 for ( itemit=oldconflictItems.first(); itemit != 0; 1734 for ( itemit=oldconflictItems.first(); itemit != 0;
@@ -1747,7 +1758,7 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1747 return; 1758 return;
1748 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); 1759 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
1749 QDate currentDate = QDate::currentDate(); 1760 QDate currentDate = QDate::currentDate();
1750 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda ); 1761 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < (QDateTime)currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda );
1751 QDateTime dt; 1762 QDateTime dt;
1752 if ( todo->hasCompletedDate() ) 1763 if ( todo->hasCompletedDate() )
1753 dt = todo->completed(); 1764 dt = todo->completed();
@@ -1779,7 +1790,7 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1779 } 1790 }
1780 qApp->processEvents(); 1791 qApp->processEvents();
1781 globalFlagBlockAgendaItemPaint = 0; 1792 globalFlagBlockAgendaItemPaint = 0;
1782 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1793 Q3PtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1783 KOAgendaItem *itemit; 1794 KOAgendaItem *itemit;
1784 for ( itemit=oldconflictItems.first(); itemit != 0; 1795 for ( itemit=oldconflictItems.first(); itemit != 0;
1785 itemit=oldconflictItems.next() ) { 1796 itemit=oldconflictItems.next() ) {
@@ -1867,7 +1878,7 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
1867 int width = XEnd - XBegin + 1; 1878 int width = XEnd - XBegin + 1;
1868 int count = 0; 1879 int count = 0;
1869 KOAgendaItem *current = 0; 1880 KOAgendaItem *current = 0;
1870 QPtrList<KOAgendaItem> multiItems; 1881 Q3PtrList<KOAgendaItem> multiItems;
1871 for (cellX = XBegin;cellX <= XEnd;++cellX) { 1882 for (cellX = XBegin;cellX <= XEnd;++cellX) {
1872 if (cellX == XBegin) cellYTop = YTop; 1883 if (cellX == XBegin) cellYTop = YTop;
1873 else cellYTop = 0; 1884 else cellYTop = 0;
@@ -1927,7 +1938,7 @@ void KOAgenda::resizeEvent ( QResizeEvent *ev )
1927 mSelectionHeight = 0; 1938 mSelectionHeight = 0;
1928 mResizeTimer.start( 150 , true ); 1939 mResizeTimer.start( 150 , true );
1929 computeSizes(); 1940 computeSizes();
1930 QScrollView::resizeEvent( ev ); 1941 Q3ScrollView::resizeEvent( ev );
1931 return; 1942 return;
1932 1943
1933} 1944}
@@ -2016,7 +2027,7 @@ void KOAgenda::popupAlarm()
2016 } 2027 }
2017 // TODO: deal correctly with multiple alarms 2028 // TODO: deal correctly with multiple alarms
2018 Alarm* alarm; 2029 Alarm* alarm;
2019 QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); 2030 Q3PtrList<Alarm> list(mClickedItem->incidence()->alarms());
2020 for(alarm=list.first();alarm;alarm=list.next()) { 2031 for(alarm=list.first();alarm;alarm=list.next()) {
2021 alarm->toggleAlarm(); 2032 alarm->toggleAlarm();
2022 } 2033 }
@@ -2107,16 +2118,16 @@ void KOAgenda::selectItem(KOAgendaItem *item)
2107void KOAgenda::keyPressEvent( QKeyEvent *kev ) 2118void KOAgenda::keyPressEvent( QKeyEvent *kev )
2108{ 2119{
2109 switch(kev->key()) { 2120 switch(kev->key()) {
2110 case Key_PageDown: 2121 case Qt::Key_PageDown:
2111 verticalScrollBar()->addPage(); 2122 verticalScrollBar()->addPage();
2112 break; 2123 break;
2113 case Key_PageUp: 2124 case Qt::Key_PageUp:
2114 verticalScrollBar()->subtractPage(); 2125 verticalScrollBar()->subtractPage();
2115 break; 2126 break;
2116 case Key_Down: 2127 case Qt::Key_Down:
2117 verticalScrollBar()->addLine(); 2128 verticalScrollBar()->addLine();
2118 break; 2129 break;
2119 case Key_Up: 2130 case Qt::Key_Up:
2120 verticalScrollBar()->subtractLine(); 2131 verticalScrollBar()->subtractLine();
2121 break; 2132 break;
2122 default: 2133 default:
@@ -2146,7 +2157,7 @@ void KOAgenda::setDateList(const DateList &selectedDates)
2146 mSelectedDates = selectedDates; 2157 mSelectedDates = selectedDates;
2147} 2158}
2148 2159
2149void KOAgenda::setHolidayMask(QMemArray<bool> *mask) 2160void KOAgenda::setHolidayMask(Q3MemArray<bool> *mask)
2150{ 2161{
2151 mHolidayMask = mask; 2162 mHolidayMask = mask;
2152 2163
@@ -2162,7 +2173,7 @@ void KOAgenda::setHolidayMask(QMemArray<bool> *mask)
2162void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) 2173void KOAgenda::contentsMousePressEvent ( QMouseEvent *event )
2163{ 2174{
2164 2175
2165 QScrollView::contentsMousePressEvent(event); 2176 Q3ScrollView::contentsMousePressEvent(event);
2166} 2177}
2167 2178
2168void KOAgenda::storePosition() 2179void KOAgenda::storePosition()
@@ -2196,13 +2207,13 @@ void KOAgenda::restorePosition()
2196void KOAgenda::moveChild( QWidget *w, int x , int y ) 2207void KOAgenda::moveChild( QWidget *w, int x , int y )
2197{ 2208{
2198 ++x; 2209 ++x;
2199 QScrollView::moveChild( w, x , y ); 2210 Q3ScrollView::moveChild( w, x , y );
2200} 2211}
2201#include <qmessagebox.h> 2212#include <qmessagebox.h>
2202#ifdef DESKTOP_VERSION 2213#ifdef DESKTOP_VERSION
2203#include <qprinter.h> 2214#include <qprinter.h>
2204#include <qpainter.h> 2215#include <qpainter.h>
2205#include <qpaintdevicemetrics.h> 2216#include <q3paintdevicemetrics.h>
2206 2217
2207#endif 2218#endif
2208void KOAgenda::printSelection() 2219void KOAgenda::printSelection()
@@ -2231,7 +2242,7 @@ void KOAgenda::printSelection()
2231 return; 2242 return;
2232 } 2243 }
2233 QPainter p( printer ); 2244 QPainter p( printer );
2234 QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); 2245 Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( printer );
2235 QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); 2246 QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() );
2236 //date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); 2247 //date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true );
2237 int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); 2248 int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height();