author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/koagenda.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-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 | |||
@@ -26,18 +26,29 @@ | |||
26 | 26 | ||
27 | #ifndef _WIN32_ | 27 | #ifndef _WIN32_ |
28 | #define protected public | 28 | #define protected public |
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> |
41 | #include <kiconloader.h> | 52 | #include <kiconloader.h> |
42 | #include <kglobal.h> | 53 | #include <kglobal.h> |
43 | 54 | ||
@@ -60,13 +71,13 @@ extern int globalFlagBlockAgendaItemPaint; | |||
60 | extern int globalFlagBlockAgendaItemUpdate; | 71 | extern int globalFlagBlockAgendaItemUpdate; |
61 | extern int globalFlagBlockStartup; | 72 | extern int globalFlagBlockStartup; |
62 | 73 | ||
63 | 74 | ||
64 | //////////////////////////////////////////////////////////////////////////// | 75 | //////////////////////////////////////////////////////////////////////////// |
65 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) | 76 | MarcusBains::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); |
70 | setBackgroundColor(Qt::red); | 81 | setBackgroundColor(Qt::red); |
71 | minutes = new QTimer(this); | 82 | minutes = new QTimer(this); |
72 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); | 83 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); |
@@ -166,14 +177,14 @@ void MarcusBains::updateLocation(bool recalculate) | |||
166 | 177 | ||
167 | 178 | ||
168 | /* | 179 | /* |
169 | Create an agenda widget with rows rows and columns columns. | 180 | Create an agenda widget with rows rows and columns columns. |
170 | */ | 181 | */ |
171 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | 182 | KOAgenda::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; |
177 | mColumns = columns; | 188 | mColumns = columns; |
178 | mRows = rows; | 189 | mRows = rows; |
179 | mGridSpacingY = rowSize; | 190 | mGridSpacingY = rowSize; |
@@ -187,14 +198,14 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | |||
187 | } | 198 | } |
188 | 199 | ||
189 | /* | 200 | /* |
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 | */ |
193 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | 204 | KOAgenda::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; |
198 | mColumns = columns; | 209 | mColumns = columns; |
199 | mRows = 1; | 210 | mRows = 1; |
200 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); | 211 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); |
@@ -228,45 +239,45 @@ QDate KOAgenda::selectedIncidenceDate() const | |||
228 | 239 | ||
229 | void KOAgenda::init() | 240 | void KOAgenda::init() |
230 | { | 241 | { |
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 ) { |
238 | if ( QApplication::desktop()->width() < 480 ) | 249 | if ( QApplication::desktop()->width() < 480 ) |
239 | pathString += "icons16/"; | 250 | pathString += "icons16/"; |
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; |
258 | mScrollBorderWidth = 8; | 269 | mScrollBorderWidth = 8; |
259 | mScrollDelay = 30; | 270 | mScrollDelay = 30; |
260 | mScrollOffset = 10; | 271 | mScrollOffset = 10; |
261 | mPaintPixmap.resize( 20,20); | 272 | mPaintPixmap.resize( 20,20); |
262 | //enableClipper(true); | 273 | //enableClipper(true); |
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())); |
270 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); | 281 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); |
271 | 282 | ||
272 | mStartCellX = 0; | 283 | mStartCellX = 0; |
@@ -392,17 +403,17 @@ bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | |||
392 | case QEvent::MouseButtonRelease: | 403 | case QEvent::MouseButtonRelease: |
393 | case QEvent::MouseMove: | 404 | case QEvent::MouseMove: |
394 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); | 405 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(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 | } |
405 | void KOAgenda::popupMenu() | 416 | void KOAgenda::popupMenu() |
406 | { | 417 | { |
407 | mPopupTimer->stop(); | 418 | mPopupTimer->stop(); |
408 | if ( mPopupKind == 1 || mPopupKind == 3 ) { | 419 | if ( mPopupKind == 1 || mPopupKind == 3 ) { |
@@ -502,17 +513,17 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
502 | } else { | 513 | } else { |
503 | viewportPos = me->pos(); | 514 | viewportPos = me->pos(); |
504 | } | 515 | } |
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 | } |
516 | blockMoving = true; | 527 | blockMoving = true; |
517 | startX = viewportPos.x(); | 528 | startX = viewportPos.x(); |
518 | startY = viewportPos.y(); | 529 | startY = viewportPos.y(); |
@@ -575,16 +586,16 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
575 | } | 586 | } |
576 | } | 587 | } |
577 | } | 588 | } |
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(); |
588 | slotClearSelection(); | 599 | slotClearSelection(); |
589 | selectItem(mActionItem); | 600 | selectItem(mActionItem); |
590 | Incidence *incidence = mActionItem->incidence(); | 601 | Incidence *incidence = mActionItem->incidence(); |
@@ -597,62 +608,62 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
597 | } | 608 | } |
598 | } else { // ---------- viewport() | 609 | } else { // ---------- viewport() |
599 | mPopupItem = 0; | 610 | mPopupItem = 0; |
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; |
607 | contentsToGrid(x,y,gx,gy); | 618 | contentsToGrid(x,y,gx,gy); |
608 | mCurrentCellX = gx; | 619 | mCurrentCellX = gx; |
609 | mCurrentCellY = gy; | 620 | mCurrentCellY = gy; |
610 | mStartCellX = gx; | 621 | mStartCellX = gx; |
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 ); |
630 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | 641 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { |
631 | mScrollUpTimer.stop(); | 642 | mScrollUpTimer.stop(); |
632 | mScrollDownTimer.stop(); | 643 | mScrollDownTimer.stop(); |
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; |
640 | mLeftMouseDown = false; | 651 | mLeftMouseDown = false; |
641 | return true; | 652 | return true; |
642 | } | 653 | } |
643 | endItemAction(); | 654 | endItemAction(); |
644 | } | 655 | } |
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; |
656 | 667 | ||
657 | case QEvent::MouseMove: | 668 | case QEvent::MouseMove: |
658 | //qDebug("mm "); | 669 | //qDebug("mm "); |
@@ -847,38 +858,38 @@ void KOAgenda::startItemAction(QPoint viewportPos) | |||
847 | 858 | ||
848 | if (mAllDayMode) { | 859 | if (mAllDayMode) { |
849 | int gridDistanceX = (x - gx * mGridSpacingX); | 860 | int gridDistanceX = (x - gx * mGridSpacingX); |
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); |
865 | if (allowResize && gridDistanceY < mResizeBorderWidth && | 876 | if (allowResize && gridDistanceY < mResizeBorderWidth && |
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 | } |
882 | 893 | ||
883 | void KOAgenda::performItemAction(QPoint viewportPos) | 894 | void KOAgenda::performItemAction(QPoint viewportPos) |
884 | { | 895 | { |
@@ -903,33 +914,33 @@ void KOAgenda::performItemAction(QPoint viewportPos) | |||
903 | if ( mActionType == MOVE ) { | 914 | if ( mActionType == MOVE ) { |
904 | mScrollUpTimer.stop(); | 915 | mScrollUpTimer.stop(); |
905 | mScrollDownTimer.stop(); | 916 | mScrollDownTimer.stop(); |
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; |
913 | return; | 924 | return; |
914 | } | 925 | } |
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 | ||
933 | // Scroll if item was moved to upper or lower end of agenda. | 944 | // Scroll if item was moved to upper or lower end of agenda. |
934 | if (clipperPos.y() < mScrollBorderWidth) { | 945 | if (clipperPos.y() < mScrollBorderWidth) { |
935 | mScrollUpTimer.start(mScrollDelay); | 946 | mScrollUpTimer.start(mScrollDelay); |
@@ -968,13 +979,13 @@ void KOAgenda::performItemAction(QPoint viewportPos) | |||
968 | mActionItem->expandTop(gy - mCurrentCellY); | 979 | mActionItem->expandTop(gy - mCurrentCellY); |
969 | mActionItem->resize(mActionItem->width(), | 980 | mActionItem->resize(mActionItem->width(), |
970 | mGridSpacingY * mActionItem->cellHeight()); | 981 | mGridSpacingY * mActionItem->cellHeight()); |
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()) { |
978 | mActionItem->expandBottom(gy - mCurrentCellY); | 989 | mActionItem->expandBottom(gy - mCurrentCellY); |
979 | mActionItem->resize(mActionItem->width(), | 990 | mActionItem->resize(mActionItem->width(), |
980 | mGridSpacingY * mActionItem->cellHeight()); | 991 | mGridSpacingY * mActionItem->cellHeight()); |
@@ -1016,13 +1027,13 @@ void KOAgenda::endItemAction() | |||
1016 | } | 1027 | } |
1017 | int type = mActionType; | 1028 | int type = mActionType; |
1018 | if ( mAllDayMode ) | 1029 | if ( mAllDayMode ) |
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 ) { |
1026 | mSelectedItem = 0; | 1037 | mSelectedItem = 0; |
1027 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); | 1038 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); |
1028 | modifiedItem->mLastMoveXPos = mCurrentCellX; | 1039 | modifiedItem->mLastMoveXPos = mCurrentCellX; |
@@ -1107,13 +1118,13 @@ void KOAgenda::endItemAction() | |||
1107 | 1118 | ||
1108 | } | 1119 | } |
1109 | if ( mActionItem ) | 1120 | if ( mActionItem ) |
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; |
1117 | 1128 | ||
1118 | } | 1129 | } |
1119 | 1130 | ||
@@ -1133,31 +1144,31 @@ void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) | |||
1133 | 1144 | ||
1134 | // Change cursor to resize cursor if appropriate | 1145 | // Change cursor to resize cursor if appropriate |
1135 | if (mAllDayMode) { | 1146 | if (mAllDayMode) { |
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 | } |
1161 | 1172 | ||
1162 | 1173 | ||
1163 | /* | 1174 | /* |
@@ -1170,15 +1181,15 @@ void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) | |||
1170 | cell, where other items are, which do not overlap in Y with the item to place, | 1181 | cell, where other items are, which do not overlap in Y with the item to place, |
1171 | the display gets corrupted, although the corruption looks quite nice. | 1182 | the display gets corrupted, although the corruption looks quite nice. |
1172 | */ | 1183 | */ |
1173 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | 1184 | void 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() ) { |
1182 | if (item != placeItem) { | 1193 | if (item != placeItem) { |
1183 | if (placeItem->cellX() <= item->cellXWidth() && | 1194 | if (placeItem->cellX() <= item->cellXWidth() && |
1184 | placeItem->cellXWidth() >= item->cellX()) { | 1195 | placeItem->cellXWidth() >= item->cellX()) { |
@@ -1237,13 +1248,13 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1237 | } | 1248 | } |
1238 | // Adjust sub cell geometry of all conflict items of all conflict items | 1249 | // Adjust sub cell geometry of all conflict items of all conflict items |
1239 | for ( item=conflictItems.first(); item != 0; | 1250 | for ( item=conflictItems.first(); item != 0; |
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) { |
1247 | item2->setSubCells(maxSubCells); | 1258 | item2->setSubCells(maxSubCells); |
1248 | int diff = 0; | 1259 | int diff = 0; |
1249 | if (mAllDayMode) { | 1260 | if (mAllDayMode) { |
@@ -1322,15 +1333,15 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | |||
1322 | int vxSel, vySel; | 1333 | int vxSel, vySel; |
1323 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); | 1334 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); |
1324 | int off = mSelectionHeight; | 1335 | int off = mSelectionHeight; |
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 ) { |
1334 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1345 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1335 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1346 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1336 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1347 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
@@ -1339,13 +1350,13 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | |||
1339 | int hei = mSelectionHeight; | 1350 | int hei = mSelectionHeight; |
1340 | int offset = 0; | 1351 | int offset = 0; |
1341 | while ( hei > 0 ) { | 1352 | while ( hei > 0 ) { |
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 | } |
1349 | } | 1360 | } |
1350 | p->begin( pd ); | 1361 | p->begin( pd ); |
1351 | } else { | 1362 | } else { |
@@ -1362,13 +1373,13 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | |||
1362 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1373 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1363 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1374 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1364 | mSelectionCellX * mGridSpacingX; | 1375 | mSelectionCellX * mGridSpacingX; |
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 ); |
1372 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1383 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1373 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1384 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1374 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1385 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
@@ -1376,13 +1387,13 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | |||
1376 | int hei = mSelectionHeight; | 1387 | int hei = mSelectionHeight; |
1377 | int offset = 0; | 1388 | int offset = 0; |
1378 | while ( hei > 0 ) { | 1389 | while ( hei > 0 ) { |
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 | } |
1386 | } | 1397 | } |
1387 | p->begin( pd ); | 1398 | p->begin( pd ); |
1388 | } | 1399 | } |
@@ -1573,20 +1584,20 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i | |||
1573 | } | 1584 | } |
1574 | } | 1585 | } |
1575 | // Draw horizontal lines of grid | 1586 | // Draw horizontal lines of grid |
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 | } |
1590 | 1601 | ||
1591 | /* | 1602 | /* |
1592 | Convert srcollview contents coordinates to agenda grid coordinates. | 1603 | Convert srcollview contents coordinates to agenda grid coordinates. |
@@ -1714,13 +1725,13 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | |||
1714 | //qDebug("item found "); | 1725 | //qDebug("item found "); |
1715 | item->hide(); | 1726 | item->hide(); |
1716 | item->setCellX(-2, -1 ); | 1727 | item->setCellX(-2, -1 ); |
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; |
1724 | itemit=oldconflictItems.next() ) { | 1735 | itemit=oldconflictItems.next() ) { |
1725 | if ( itemit != item ) | 1736 | if ( itemit != item ) |
1726 | placeSubCells(itemit); | 1737 | placeSubCells(itemit); |
@@ -1744,13 +1755,13 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | |||
1744 | return; | 1755 | return; |
1745 | } | 1756 | } |
1746 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) | 1757 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) |
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(); |
1754 | else | 1765 | else |
1755 | dt = todo->dtDue(); | 1766 | dt = todo->dtDue(); |
1756 | if ( overdue ) { | 1767 | if ( overdue ) { |
@@ -1776,13 +1787,13 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | |||
1776 | int startY = endY - 1-hi; | 1787 | int startY = endY - 1-hi; |
1777 | item = insertItem(todo,currentDate,days,startY,endY); | 1788 | item = insertItem(todo,currentDate,days,startY,endY); |
1778 | item->show(); | 1789 | item->show(); |
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() ) { |
1786 | globalFlagBlockAgendaItemUpdate = 0; | 1797 | globalFlagBlockAgendaItemUpdate = 0; |
1787 | itemit->repaintMe(); | 1798 | itemit->repaintMe(); |
1788 | globalFlagBlockAgendaItemUpdate = 1; | 1799 | globalFlagBlockAgendaItemUpdate = 1; |
@@ -1864,13 +1875,13 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, | |||
1864 | 1875 | ||
1865 | int cellX,cellYTop,cellYBottom; | 1876 | int cellX,cellYTop,cellYBottom; |
1866 | QString newtext; | 1877 | QString newtext; |
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; |
1874 | if (cellX == XEnd) cellYBottom = YBottom; | 1885 | if (cellX == XEnd) cellYBottom = YBottom; |
1875 | else cellYBottom = rows() - 1; | 1886 | else cellYBottom = rows() - 1; |
1876 | newtext = QString("(%1/%2): ").arg(++count).arg(width); | 1887 | newtext = QString("(%1/%2): ").arg(++count).arg(width); |
@@ -1924,13 +1935,13 @@ void KOAgenda::finishResize ( ) | |||
1924 | */ | 1935 | */ |
1925 | void KOAgenda::resizeEvent ( QResizeEvent *ev ) | 1936 | void KOAgenda::resizeEvent ( QResizeEvent *ev ) |
1926 | { | 1937 | { |
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 | } |
1934 | void KOAgenda::computeSizes() | 1945 | void KOAgenda::computeSizes() |
1935 | { | 1946 | { |
1936 | if ( globalFlagBlockStartup ) | 1947 | if ( globalFlagBlockStartup ) |
@@ -2013,13 +2024,13 @@ void KOAgenda::popupAlarm() | |||
2013 | if (!mClickedItem) { | 2024 | if (!mClickedItem) { |
2014 | qDebug("KOAgenda::popupAlarm() called without having a clicked item "); | 2025 | qDebug("KOAgenda::popupAlarm() called without having a clicked item "); |
2015 | return; | 2026 | return; |
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 | } |
2023 | emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); | 2034 | emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); |
2024 | mClickedItem->paintMe( true ); | 2035 | mClickedItem->paintMe( true ); |
2025 | mClickedItem->repaint( false ); | 2036 | mClickedItem->repaint( false ); |
@@ -2104,22 +2115,22 @@ void KOAgenda::selectItem(KOAgendaItem *item) | |||
2104 | } | 2115 | } |
2105 | 2116 | ||
2106 | // This function seems never be called. | 2117 | // This function seems never be called. |
2107 | void KOAgenda::keyPressEvent( QKeyEvent *kev ) | 2118 | void 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: |
2123 | ; | 2134 | ; |
2124 | } | 2135 | } |
2125 | } | 2136 | } |
@@ -2143,13 +2154,13 @@ DateList KOAgenda::dateList() const | |||
2143 | 2154 | ||
2144 | void KOAgenda::setDateList(const DateList &selectedDates) | 2155 | void KOAgenda::setDateList(const DateList &selectedDates) |
2145 | { | 2156 | { |
2146 | mSelectedDates = selectedDates; | 2157 | mSelectedDates = selectedDates; |
2147 | } | 2158 | } |
2148 | 2159 | ||
2149 | void KOAgenda::setHolidayMask(QMemArray<bool> *mask) | 2160 | void KOAgenda::setHolidayMask(Q3MemArray<bool> *mask) |
2150 | { | 2161 | { |
2151 | mHolidayMask = mask; | 2162 | mHolidayMask = mask; |
2152 | 2163 | ||
2153 | /* | 2164 | /* |
2154 | kdDebug() << "HolidayMask: "; | 2165 | kdDebug() << "HolidayMask: "; |
2155 | for(uint i=0;i<mask->count();++i) { | 2166 | for(uint i=0;i<mask->count();++i) { |
@@ -2159,13 +2170,13 @@ void KOAgenda::setHolidayMask(QMemArray<bool> *mask) | |||
2159 | */ | 2170 | */ |
2160 | } | 2171 | } |
2161 | 2172 | ||
2162 | void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) | 2173 | void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) |
2163 | { | 2174 | { |
2164 | 2175 | ||
2165 | QScrollView::contentsMousePressEvent(event); | 2176 | Q3ScrollView::contentsMousePressEvent(event); |
2166 | } | 2177 | } |
2167 | 2178 | ||
2168 | void KOAgenda::storePosition() | 2179 | void KOAgenda::storePosition() |
2169 | { | 2180 | { |
2170 | //mContentPosition | 2181 | //mContentPosition |
2171 | int max = mGridSpacingY*4*24; | 2182 | int max = mGridSpacingY*4*24; |
@@ -2193,19 +2204,19 @@ void KOAgenda::restorePosition() | |||
2193 | //qDebug("posY %d hei %d", posY, max); | 2204 | //qDebug("posY %d hei %d", posY, max); |
2194 | 2205 | ||
2195 | } | 2206 | } |
2196 | void KOAgenda::moveChild( QWidget *w, int x , int y ) | 2207 | void 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 |
2208 | void KOAgenda::printSelection() | 2219 | void KOAgenda::printSelection() |
2209 | { | 2220 | { |
2210 | #ifdef DESKTOP_VERSION | 2221 | #ifdef DESKTOP_VERSION |
2211 | if ( mStartCellY == mCurrentCellY ) { | 2222 | if ( mStartCellY == mCurrentCellY ) { |
@@ -2228,13 +2239,13 @@ void KOAgenda::printSelection() | |||
2228 | QPrinter* printer = new QPrinter(); | 2239 | QPrinter* printer = new QPrinter(); |
2229 | if ( !printer->setup()) { | 2240 | if ( !printer->setup()) { |
2230 | delete printer; | 2241 | delete printer; |
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(); |
2238 | // p.drawText( 0, 0, date ); | 2249 | // p.drawText( 0, 0, date ); |
2239 | int offset = m.width()/8; | 2250 | int offset = m.width()/8; |
2240 | // compute the scale | 2251 | // compute the scale |