-rw-r--r-- | korganizer/koagenda.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 7e9fa71..7d9d674 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -16,192 +16,193 @@ | |||
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 | 21 | ||
22 | As a special exception, permission is given to link this program | 22 | As a special exception, permission is given to link this program |
23 | with any edition of Qt, and distribute the resulting executable, | 23 | with any edition of Qt, and distribute the resulting executable, |
24 | without including the source code for Qt in the source distribution. | 24 | without including the source code for Qt in the source distribution. |
25 | */ | 25 | */ |
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 <qintdict.h> |
33 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <qcursor.h> | 36 | #include <qcursor.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | 38 | ||
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
42 | #include <kglobal.h> | 42 | #include <kglobal.h> |
43 | 43 | ||
44 | #include "koagendaitem.h" | 44 | #include "koagendaitem.h" |
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "koglobals.h" | 46 | #include "koglobals.h" |
47 | 47 | ||
48 | #include "koagenda.h" | 48 | #include "koagenda.h" |
49 | 49 | ||
50 | #include <libkcal/event.h> | 50 | #include <libkcal/event.h> |
51 | #include <libkcal/todo.h> | 51 | #include <libkcal/todo.h> |
52 | 52 | ||
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | //extern bool globalFlagBlockPainting; | 57 | //extern bool globalFlagBlockPainting; |
58 | extern int globalFlagBlockAgenda; | 58 | extern int globalFlagBlockAgenda; |
59 | extern int globalFlagBlockAgendaItemPaint; | 59 | extern int globalFlagBlockAgendaItemPaint; |
60 | extern int globalFlagBlockAgendaItemUpdate; | 60 | extern int globalFlagBlockAgendaItemUpdate; |
61 | extern int globalFlagBlockStartup; | 61 | extern int globalFlagBlockStartup; |
62 | 62 | ||
63 | 63 | ||
64 | //////////////////////////////////////////////////////////////////////////// | 64 | //////////////////////////////////////////////////////////////////////////// |
65 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) | 65 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) |
66 | : QFrame(_agenda->viewport(),name), agenda(_agenda) | 66 | : QFrame(_agenda->viewport(),name), agenda(_agenda) |
67 | { | 67 | { |
68 | setLineWidth(0); | 68 | setLineWidth(0); |
69 | setMargin(0); | 69 | setMargin(0); |
70 | setBackgroundColor(Qt::red); | 70 | setBackgroundColor(Qt::red); |
71 | minutes = new QTimer(this); | 71 | minutes = new QTimer(this); |
72 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); | 72 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); |
73 | minutes->start(0, true); | 73 | minutes->start(0, true); |
74 | mTimeBox = new QLabel(this); | 74 | mTimeBox = new QLabel(this); |
75 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); | 75 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); |
76 | QPalette pal = mTimeBox->palette(); | 76 | QPalette pal = mTimeBox->palette(); |
77 | pal.setColor(QColorGroup::Foreground, Qt::red); | 77 | pal.setColor(QColorGroup::Foreground, Qt::red); |
78 | mTimeBox->setPalette(pal); | 78 | mTimeBox->setPalette(pal); |
79 | //mTimeBox->setAutoMask(true); | 79 | //mTimeBox->setAutoMask(true); |
80 | 80 | ||
81 | agenda->addChild(mTimeBox); | 81 | agenda->addChild(mTimeBox); |
82 | 82 | ||
83 | oldToday = -1; | 83 | oldToday = -1; |
84 | } | 84 | } |
85 | 85 | ||
86 | MarcusBains::~MarcusBains() | 86 | MarcusBains::~MarcusBains() |
87 | { | 87 | { |
88 | //delete minutes; | 88 | //delete minutes; |
89 | } | 89 | } |
90 | void MarcusBains::hideMe() | 90 | void MarcusBains::hideMe() |
91 | { | 91 | { |
92 | hide(); mTimeBox->hide(); | 92 | hide(); mTimeBox->hide(); |
93 | } | 93 | } |
94 | int MarcusBains::todayColumn() | 94 | int MarcusBains::todayColumn() |
95 | { | 95 | { |
96 | QDate currentDate = QDate::currentDate(); | 96 | QDate currentDate = QDate::currentDate(); |
97 | 97 | ||
98 | DateList dateList = agenda->dateList(); | 98 | DateList dateList = agenda->dateList(); |
99 | DateList::ConstIterator it; | 99 | DateList::ConstIterator it; |
100 | int col = 0; | 100 | int col = 0; |
101 | for(it = dateList.begin(); it != dateList.end(); ++it) { | 101 | for(it = dateList.begin(); it != dateList.end(); ++it) { |
102 | if((*it) == currentDate) | 102 | if((*it) == currentDate) |
103 | return KOGlobals::self()->reverseLayout() ? | 103 | return KOGlobals::self()->reverseLayout() ? |
104 | agenda->columns() - 1 - col : col; | 104 | agenda->columns() - 1 - col : col; |
105 | ++col; | 105 | ++col; |
106 | } | 106 | } |
107 | 107 | ||
108 | return -1; | 108 | return -1; |
109 | } | 109 | } |
110 | void MarcusBains::updateLoc() | 110 | void MarcusBains::updateLoc() |
111 | { | 111 | { |
112 | if ( !agenda->invalidPixmap() ) | ||
112 | updateLocation(); | 113 | updateLocation(); |
113 | } | 114 | } |
114 | void MarcusBains::updateLocation(bool recalculate) | 115 | void MarcusBains::updateLocation(bool recalculate) |
115 | { | 116 | { |
116 | 117 | ||
117 | QTime tim = QTime::currentTime(); | 118 | QTime tim = QTime::currentTime(); |
118 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); | 119 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); |
119 | if((tim.hour() == 0) && (oldTime.hour()==23)) | 120 | if((tim.hour() == 0) && (oldTime.hour()==23)) |
120 | recalculate = true; | 121 | recalculate = true; |
121 | 122 | ||
122 | int mins = tim.hour()*60 + tim.minute(); | 123 | int mins = tim.hour()*60 + tim.minute(); |
123 | int minutesPerCell = 24 * 60 / agenda->rows(); | 124 | int minutesPerCell = 24 * 60 / agenda->rows(); |
124 | int y = mins*agenda->gridSpacingY()/minutesPerCell; | 125 | int y = mins*agenda->gridSpacingY()/minutesPerCell; |
125 | int today = recalculate ? todayColumn() : oldToday; | 126 | int today = recalculate ? todayColumn() : oldToday; |
126 | int x = agenda->gridSpacingX()*today; | 127 | int x = agenda->gridSpacingX()*today; |
127 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); | 128 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); |
128 | 129 | ||
129 | oldTime = tim; | 130 | oldTime = tim; |
130 | oldToday = today; | 131 | oldToday = today; |
131 | 132 | ||
132 | if(disabled || (today<0)) { | 133 | if(disabled || (today<0)) { |
133 | hide(); mTimeBox->hide(); | 134 | hide(); mTimeBox->hide(); |
134 | return; | 135 | return; |
135 | } else { | 136 | } else { |
136 | show(); mTimeBox->show(); | 137 | show(); mTimeBox->show(); |
137 | } | 138 | } |
138 | 139 | ||
139 | if(recalculate) | 140 | if(recalculate) |
140 | setFixedSize(agenda->gridSpacingX(),1); | 141 | setFixedSize(agenda->gridSpacingX(),1); |
141 | agenda->moveChild(this, x, y); | 142 | agenda->moveChild(this, x, y); |
142 | raise(); | 143 | raise(); |
143 | 144 | ||
144 | if(recalculate) | 145 | if(recalculate) |
145 | //mTimeBox->setFont(QFont("helvetica",10)); | 146 | //mTimeBox->setFont(QFont("helvetica",10)); |
146 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); | 147 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); |
147 | 148 | ||
148 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); | 149 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); |
149 | mTimeBox->adjustSize(); | 150 | mTimeBox->adjustSize(); |
150 | // the -2 below is there because there is a bug in this program | 151 | // the -2 below is there because there is a bug in this program |
151 | // somewhere, where the last column of this widget is a few pixels | 152 | // somewhere, where the last column of this widget is a few pixels |
152 | // narrower than the other columns. | 153 | // narrower than the other columns. |
153 | int offs = (today==agenda->columns()-1) ? -4 : 0; | 154 | int offs = (today==agenda->columns()-1) ? -4 : 0; |
154 | agenda->moveChild(mTimeBox, | 155 | agenda->moveChild(mTimeBox, |
155 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, | 156 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, |
156 | y-mTimeBox->height()); | 157 | y-mTimeBox->height()); |
157 | mTimeBox->raise(); | 158 | mTimeBox->raise(); |
158 | //mTimeBox->setAutoMask(true); | 159 | //mTimeBox->setAutoMask(true); |
159 | int secs = QTime::currentTime().second(); | 160 | int secs = QTime::currentTime().second(); |
160 | minutes->start( (60 - secs +1)*1000 ,true); | 161 | minutes->start( (60 - secs +1)*1000 ,true); |
161 | } | 162 | } |
162 | 163 | ||
163 | 164 | ||
164 | //////////////////////////////////////////////////////////////////////////// | 165 | //////////////////////////////////////////////////////////////////////////// |
165 | 166 | ||
166 | 167 | ||
167 | /* | 168 | /* |
168 | Create an agenda widget with rows rows and columns columns. | 169 | Create an agenda widget with rows rows and columns columns. |
169 | */ | 170 | */ |
170 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | 171 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, |
171 | const char *name,WFlags f) : | 172 | const char *name,WFlags f) : |
172 | QScrollView(parent,name,f) | 173 | QScrollView(parent,name,f) |
173 | { | 174 | { |
174 | 175 | ||
175 | mAllAgendaPopup = 0; | 176 | mAllAgendaPopup = 0; |
176 | mColumns = columns; | 177 | mColumns = columns; |
177 | mRows = rows; | 178 | mRows = rows; |
178 | mGridSpacingY = rowSize; | 179 | mGridSpacingY = rowSize; |
179 | mAllDayMode = false; | 180 | mAllDayMode = false; |
180 | #ifndef DESKTOP_VERSION | 181 | #ifndef DESKTOP_VERSION |
181 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 182 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
182 | #endif | 183 | #endif |
183 | mHolidayMask = 0; | 184 | mHolidayMask = 0; |
184 | init(); | 185 | init(); |
185 | connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) ); | 186 | connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) ); |
186 | } | 187 | } |
187 | 188 | ||
188 | /* | 189 | /* |
189 | Create an agenda widget with columns columns and one row. This is used for | 190 | Create an agenda widget with columns columns and one row. This is used for |
190 | all-day events. | 191 | all-day events. |
191 | */ | 192 | */ |
192 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | 193 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : |
193 | QScrollView(parent,name,f) | 194 | QScrollView(parent,name,f) |
194 | { | 195 | { |
195 | mAllAgendaPopup = 0; | 196 | mAllAgendaPopup = 0; |
196 | blockResize = false; | 197 | blockResize = false; |
197 | mColumns = columns; | 198 | mColumns = columns; |
198 | mRows = 1; | 199 | mRows = 1; |
199 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); | 200 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); |
200 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 201 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
201 | mAllDayMode = true; | 202 | mAllDayMode = true; |
202 | #ifndef DESKTOP_VERSION | 203 | #ifndef DESKTOP_VERSION |
203 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 204 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
204 | #endif | 205 | #endif |
205 | mHolidayMask = 0; | 206 | mHolidayMask = 0; |
206 | init(); | 207 | init(); |
207 | } | 208 | } |
@@ -348,198 +349,202 @@ void KOAgenda::clear() | |||
348 | mUnusedItems.append( item ); | 349 | mUnusedItems.append( item ); |
349 | //item->hide(); | 350 | //item->hide(); |
350 | } | 351 | } |
351 | mItems.clear(); | 352 | mItems.clear(); |
352 | mSelectedItem = 0; | 353 | mSelectedItem = 0; |
353 | clearSelection(); | 354 | clearSelection(); |
354 | } | 355 | } |
355 | 356 | ||
356 | void KOAgenda::clearSelection() | 357 | void KOAgenda::clearSelection() |
357 | { | 358 | { |
358 | mSelectionCellX = 0; | 359 | mSelectionCellX = 0; |
359 | mSelectionYTop = 0; | 360 | mSelectionYTop = 0; |
360 | mSelectionHeight = 0; | 361 | mSelectionHeight = 0; |
361 | } | 362 | } |
362 | 363 | ||
363 | void KOAgenda::marcus_bains() | 364 | void KOAgenda::marcus_bains() |
364 | { | 365 | { |
365 | if(mMarcusBains) mMarcusBains->updateLocation(true); | 366 | if(mMarcusBains) mMarcusBains->updateLocation(true); |
366 | } | 367 | } |
367 | 368 | ||
368 | 369 | ||
369 | void KOAgenda::changeColumns(int columns) | 370 | void KOAgenda::changeColumns(int columns) |
370 | { | 371 | { |
371 | if (columns == 0) { | 372 | if (columns == 0) { |
372 | qDebug("KOAgenda::changeColumns() called with argument 0 "); | 373 | qDebug("KOAgenda::changeColumns() called with argument 0 "); |
373 | return; | 374 | return; |
374 | } | 375 | } |
375 | clear(); | 376 | clear(); |
376 | mColumns = columns; | 377 | mColumns = columns; |
377 | computeSizes(); | 378 | computeSizes(); |
378 | if(mMarcusBains) mMarcusBains->hideMe(); | 379 | if(mMarcusBains) mMarcusBains->hideMe(); |
379 | } | 380 | } |
380 | 381 | ||
381 | /* | 382 | /* |
382 | This is the eventFilter function, which gets all events from the KOAgendaItems | 383 | This is the eventFilter function, which gets all events from the KOAgendaItems |
383 | contained in the agenda. It has to handle moving and resizing for all items. | 384 | contained in the agenda. It has to handle moving and resizing for all items. |
384 | */ | 385 | */ |
385 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | 386 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) |
386 | { | 387 | { |
387 | // kdDebug() << "KOAgenda::eventFilter" << endl; | 388 | // kdDebug() << "KOAgenda::eventFilter" << endl; |
388 | switch(event->type()) { | 389 | switch(event->type()) { |
389 | case QEvent::MouseButtonPress: | 390 | case QEvent::MouseButtonPress: |
390 | case QEvent::MouseButtonDblClick: | 391 | case QEvent::MouseButtonDblClick: |
391 | case QEvent::MouseButtonRelease: | 392 | case QEvent::MouseButtonRelease: |
392 | case QEvent::MouseMove: | 393 | case QEvent::MouseMove: |
393 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); | 394 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); |
394 | 395 | ||
395 | case (QEvent::Leave): | 396 | case (QEvent::Leave): |
396 | if (!mActionItem) | 397 | if (!mActionItem) |
397 | setCursor(arrowCursor); | 398 | setCursor(arrowCursor); |
398 | return true; | 399 | return true; |
399 | 400 | ||
400 | default: | 401 | default: |
401 | return QScrollView::eventFilter(object,event); | 402 | return QScrollView::eventFilter(object,event); |
402 | } | 403 | } |
403 | } | 404 | } |
404 | void KOAgenda::popupMenu() | 405 | void KOAgenda::popupMenu() |
405 | { | 406 | { |
406 | mPopupTimer->stop(); | 407 | mPopupTimer->stop(); |
407 | if ( mPopupKind == 1 || mPopupKind == 3 ) { | 408 | if ( mPopupKind == 1 || mPopupKind == 3 ) { |
408 | if (mActionItem ) { | 409 | if (mActionItem ) { |
409 | endItemAction(); | 410 | endItemAction(); |
410 | } | 411 | } |
411 | mLeftMouseDown = false; // no more leftMouse computation | 412 | mLeftMouseDown = false; // no more leftMouse computation |
412 | if (mPopupItem) { | 413 | if (mPopupItem) { |
413 | //mClickedItem = mPopupItem; | 414 | //mClickedItem = mPopupItem; |
414 | selectItem(mPopupItem); | 415 | selectItem(mPopupItem); |
415 | if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 ) | 416 | if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 ) |
416 | mAllAgendaPopup->installEventFilter( this ); | 417 | mAllAgendaPopup->installEventFilter( this ); |
417 | emit showIncidencePopupSignal(mPopupItem->incidence()); | 418 | emit showIncidencePopupSignal(mPopupItem->incidence()); |
418 | 419 | ||
419 | } | 420 | } |
420 | } else if ( mPopupKind == 2 || mPopupKind == 4 ) { | 421 | } else if ( mPopupKind == 2 || mPopupKind == 4 ) { |
421 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action | 422 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action |
422 | endSelectAction( false ); // do not emit new event signal | 423 | endSelectAction( false ); // do not emit new event signal |
423 | mLeftMouseDown = false; // no more leftMouse computation | 424 | mLeftMouseDown = false; // no more leftMouse computation |
424 | } | 425 | } |
425 | if ( KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 2 ) | 426 | if ( KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 2 ) |
426 | mNewItemPopup->installEventFilter( this ); | 427 | mNewItemPopup->installEventFilter( this ); |
427 | mNewItemPopup->popup( mPopupPos); | 428 | mNewItemPopup->popup( mPopupPos); |
428 | 429 | ||
429 | } | 430 | } |
430 | mLeftMouseDown = false; | 431 | mLeftMouseDown = false; |
431 | mPopupItem = 0; | 432 | mPopupItem = 0; |
432 | mPopupKind = 0; | 433 | mPopupKind = 0; |
433 | } | 434 | } |
434 | void KOAgenda::categoryChanged(Incidence * inc) | 435 | void KOAgenda::categoryChanged(Incidence * inc) |
435 | { | 436 | { |
436 | KOAgendaItem *item; | 437 | KOAgendaItem *item; |
437 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 438 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
438 | if ( item->incidence() == inc ) { | 439 | if ( item->incidence() == inc ) { |
439 | item->initColor (); | 440 | item->initColor (); |
440 | item->updateItem(); | 441 | item->updateItem(); |
441 | } | 442 | } |
442 | } | 443 | } |
443 | } | 444 | } |
445 | bool KOAgenda::invalidPixmap() | ||
446 | { | ||
447 | return mInvalidPixmap; | ||
448 | } | ||
444 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 449 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
445 | { | 450 | { |
446 | 451 | ||
447 | if ( mInvalidPixmap ) { | 452 | if ( mInvalidPixmap ) { |
448 | mInvalidPixmap = false; | 453 | mInvalidPixmap = false; |
449 | qDebug("KO: Upsizing Pixmaps "); | 454 | qDebug("KO: efm Upsizing Pixmaps %s", QDateTime::currentDateTime().toString().latin1()); |
450 | computeSizes(); | 455 | computeSizes(); |
451 | emit updateViewSignal(); | 456 | emit updateViewSignal(); |
452 | return true; | 457 | return true; |
453 | } | 458 | } |
454 | emit sendPing(); | 459 | emit sendPing(); |
455 | static int startX = 0; | 460 | static int startX = 0; |
456 | static int startY = 0; | 461 | static int startY = 0; |
457 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); | 462 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); |
458 | static bool blockMoving = true; | 463 | static bool blockMoving = true; |
459 | 464 | ||
460 | //qDebug("KOAgenda::eventFilter_mous "); | 465 | //qDebug("KOAgenda::eventFilter_mous "); |
461 | if ( object == mNewItemPopup ) { | 466 | if ( object == mNewItemPopup ) { |
462 | //qDebug("mNewItemPopup "); | 467 | //qDebug("mNewItemPopup "); |
463 | if ( me->type() == QEvent::MouseButtonRelease ) { | 468 | if ( me->type() == QEvent::MouseButtonRelease ) { |
464 | mNewItemPopup->removeEventFilter( this ); | 469 | mNewItemPopup->removeEventFilter( this ); |
465 | int dX = me->globalPos().x() - mPopupPos.x();; | 470 | int dX = me->globalPos().x() - mPopupPos.x();; |
466 | if ( dX < 0 ) | 471 | if ( dX < 0 ) |
467 | dX = -dX; | 472 | dX = -dX; |
468 | int dY = me->globalPos().y() - mPopupPos.y(); | 473 | int dY = me->globalPos().y() - mPopupPos.y(); |
469 | if ( dY < 0 ) | 474 | if ( dY < 0 ) |
470 | dY = -dY; | 475 | dY = -dY; |
471 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 476 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
472 | mNewItemPopup->hide(); | 477 | mNewItemPopup->hide(); |
473 | } | 478 | } |
474 | } | 479 | } |
475 | return true; | 480 | return true; |
476 | } | 481 | } |
477 | if ( object == mAllAgendaPopup ) { | 482 | if ( object == mAllAgendaPopup ) { |
478 | //qDebug(" mAllAgendaPopup "); | 483 | //qDebug(" mAllAgendaPopup "); |
479 | if ( me->type() == QEvent::MouseButtonRelease ) { | 484 | if ( me->type() == QEvent::MouseButtonRelease ) { |
480 | mAllAgendaPopup->removeEventFilter( this ); | 485 | mAllAgendaPopup->removeEventFilter( this ); |
481 | int dX = me->globalPos().x() - mPopupPos.x();; | 486 | int dX = me->globalPos().x() - mPopupPos.x();; |
482 | if ( dX < 0 ) | 487 | if ( dX < 0 ) |
483 | dX = -dX; | 488 | dX = -dX; |
484 | int dY = me->globalPos().y() - mPopupPos.y(); | 489 | int dY = me->globalPos().y() - mPopupPos.y(); |
485 | if ( dY < 0 ) | 490 | if ( dY < 0 ) |
486 | dY = -dY; | 491 | dY = -dY; |
487 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 492 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
488 | mAllAgendaPopup->hide(); | 493 | mAllAgendaPopup->hide(); |
489 | } | 494 | } |
490 | } | 495 | } |
491 | return true; | 496 | return true; |
492 | } | 497 | } |
493 | QPoint viewportPos; | 498 | QPoint viewportPos; |
494 | if (object != viewport()) { | 499 | if (object != viewport()) { |
495 | blockmoveDist = blockmoveDist*2; | 500 | blockmoveDist = blockmoveDist*2; |
496 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 501 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
497 | } else { | 502 | } else { |
498 | viewportPos = me->pos(); | 503 | viewportPos = me->pos(); |
499 | } | 504 | } |
500 | bool objIsNotViewport = (object != viewport()); | 505 | bool objIsNotViewport = (object != viewport()); |
501 | bool leftButt = false; | 506 | bool leftButt = false; |
502 | #ifdef DESKTOP_VERSION | 507 | #ifdef DESKTOP_VERSION |
503 | leftButt = (me->button() == LeftButton); | 508 | leftButt = (me->button() == LeftButton); |
504 | #endif | 509 | #endif |
505 | switch (me->type()) { | 510 | switch (me->type()) { |
506 | case QEvent::MouseButtonPress: | 511 | case QEvent::MouseButtonPress: |
507 | if (me->button() == LeftButton) { | 512 | if (me->button() == LeftButton) { |
508 | mPopupTimer->start( 600 ); | 513 | mPopupTimer->start( 600 ); |
509 | mLeftMouseDown = true; | 514 | mLeftMouseDown = true; |
510 | } | 515 | } |
511 | blockMoving = true; | 516 | blockMoving = true; |
512 | startX = viewportPos.x(); | 517 | startX = viewportPos.x(); |
513 | startY = viewportPos.y(); | 518 | startY = viewportPos.y(); |
514 | mPopupPos = me->globalPos(); | 519 | mPopupPos = me->globalPos(); |
515 | if ( objIsNotViewport && !leftButt ) { | 520 | if ( objIsNotViewport && !leftButt ) { |
516 | KOAgendaItem * tempItem = (KOAgendaItem *)object; | 521 | KOAgendaItem * tempItem = (KOAgendaItem *)object; |
517 | if (mAllDayMode) { | 522 | if (mAllDayMode) { |
518 | if ( tempItem->height() > 10 ) { | 523 | if ( tempItem->height() > 10 ) { |
519 | int minV = tempItem->height()/4; | 524 | int minV = tempItem->height()/4; |
520 | if ( minV > (blockmoveDist/2)-2 ) { | 525 | if ( minV > (blockmoveDist/2)-2 ) { |
521 | if ( minV > blockmoveDist ) | 526 | if ( minV > blockmoveDist ) |
522 | minV = blockmoveDist; | 527 | minV = blockmoveDist; |
523 | else | 528 | else |
524 | minV = (blockmoveDist/2); | 529 | minV = (blockmoveDist/2); |
525 | } | 530 | } |
526 | bool border = false; | 531 | bool border = false; |
527 | int diff = tempItem->y() - viewportPos.y(); | 532 | int diff = tempItem->y() - viewportPos.y(); |
528 | if ( diff < 0 ) | 533 | if ( diff < 0 ) |
529 | diff *= -1; | 534 | diff *= -1; |
530 | if ( diff < minV ) { | 535 | if ( diff < minV ) { |
531 | border = true; | 536 | border = true; |
532 | objIsNotViewport = false; | 537 | objIsNotViewport = false; |
533 | } | 538 | } |
534 | if ( ! border ) { | 539 | if ( ! border ) { |
535 | diff = tempItem->y() + tempItem->height()- viewportPos.y(); | 540 | diff = tempItem->y() + tempItem->height()- viewportPos.y(); |
536 | if ( diff < 0 ) | 541 | if ( diff < 0 ) |
537 | diff *= -1; | 542 | diff *= -1; |
538 | if ( diff < minV ) { | 543 | if ( diff < minV ) { |
539 | border = true; | 544 | border = true; |
540 | objIsNotViewport = false; | 545 | objIsNotViewport = false; |
541 | } | 546 | } |
542 | } | 547 | } |
543 | } | 548 | } |
544 | } else { // not allday | 549 | } else { // not allday |
545 | if ( tempItem->width() > 10 ) { | 550 | if ( tempItem->width() > 10 ) { |
@@ -1188,197 +1193,198 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1188 | } | 1193 | } |
1189 | 1194 | ||
1190 | if (conflictItems.count() > 0) { | 1195 | if (conflictItems.count() > 0) { |
1191 | // Look for unused sub cell and insert item | 1196 | // Look for unused sub cell and insert item |
1192 | int i; | 1197 | int i; |
1193 | for(i=0;i<maxSubCells;++i) { | 1198 | for(i=0;i<maxSubCells;++i) { |
1194 | if (!subCellDict.find(i)) { | 1199 | if (!subCellDict.find(i)) { |
1195 | placeItem->setSubCell(i); | 1200 | placeItem->setSubCell(i); |
1196 | break; | 1201 | break; |
1197 | } | 1202 | } |
1198 | } | 1203 | } |
1199 | if (i == maxSubCells) { | 1204 | if (i == maxSubCells) { |
1200 | placeItem->setSubCell(maxSubCells); | 1205 | placeItem->setSubCell(maxSubCells); |
1201 | maxSubCells++; // add new item to number of sub cells | 1206 | maxSubCells++; // add new item to number of sub cells |
1202 | } | 1207 | } |
1203 | 1208 | ||
1204 | // Prepare for sub cell geometry adjustment | 1209 | // Prepare for sub cell geometry adjustment |
1205 | int newSubCellWidth; | 1210 | int newSubCellWidth; |
1206 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; | 1211 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; |
1207 | else newSubCellWidth = mGridSpacingX / maxSubCells; | 1212 | else newSubCellWidth = mGridSpacingX / maxSubCells; |
1208 | conflictItems.append(placeItem); | 1213 | conflictItems.append(placeItem); |
1209 | 1214 | ||
1210 | 1215 | ||
1211 | // Adjust sub cell geometry of all direct conflict items | 1216 | // Adjust sub cell geometry of all direct conflict items |
1212 | for ( item=conflictItems.first(); item != 0; | 1217 | for ( item=conflictItems.first(); item != 0; |
1213 | item=conflictItems.next() ) { | 1218 | item=conflictItems.next() ) { |
1214 | item->setSubCells(maxSubCells); | 1219 | item->setSubCells(maxSubCells); |
1215 | if (mAllDayMode) { | 1220 | if (mAllDayMode) { |
1216 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1221 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1217 | } else { | 1222 | } else { |
1218 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1223 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
1219 | } | 1224 | } |
1220 | int x,y; | 1225 | int x,y; |
1221 | gridToContents(item->cellX(),item->cellYTop(),x,y); | 1226 | gridToContents(item->cellX(),item->cellYTop(),x,y); |
1222 | if (mAllDayMode) { | 1227 | if (mAllDayMode) { |
1223 | y += item->subCell() * newSubCellWidth; | 1228 | y += item->subCell() * newSubCellWidth; |
1224 | } else { | 1229 | } else { |
1225 | x += item->subCell() * newSubCellWidth; | 1230 | x += item->subCell() * newSubCellWidth; |
1226 | } | 1231 | } |
1227 | moveChild(item,x,y); | 1232 | moveChild(item,x,y); |
1228 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); | 1233 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); |
1229 | //item->updateItem(); | 1234 | //item->updateItem(); |
1230 | } | 1235 | } |
1231 | // Adjust sub cell geometry of all conflict items of all conflict items | 1236 | // Adjust sub cell geometry of all conflict items of all conflict items |
1232 | for ( item=conflictItems.first(); item != 0; | 1237 | for ( item=conflictItems.first(); item != 0; |
1233 | item=conflictItems.next() ) { | 1238 | item=conflictItems.next() ) { |
1234 | if ( placeItem != item ) { | 1239 | if ( placeItem != item ) { |
1235 | KOAgendaItem *item2; | 1240 | KOAgendaItem *item2; |
1236 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); | 1241 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); |
1237 | for ( item2=conflictItems2.first(); item2 != 0; | 1242 | for ( item2=conflictItems2.first(); item2 != 0; |
1238 | item2=conflictItems2.next() ) { | 1243 | item2=conflictItems2.next() ) { |
1239 | if ( item2->subCells() != maxSubCells) { | 1244 | if ( item2->subCells() != maxSubCells) { |
1240 | item2->setSubCells(maxSubCells); | 1245 | item2->setSubCells(maxSubCells); |
1241 | if (mAllDayMode) { | 1246 | if (mAllDayMode) { |
1242 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); | 1247 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); |
1243 | } else { | 1248 | } else { |
1244 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); | 1249 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); |
1245 | } | 1250 | } |
1246 | int x,y; | 1251 | int x,y; |
1247 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); | 1252 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); |
1248 | if (mAllDayMode) { | 1253 | if (mAllDayMode) { |
1249 | y += item2->subCell() * newSubCellWidth; | 1254 | y += item2->subCell() * newSubCellWidth; |
1250 | } else { | 1255 | } else { |
1251 | x += item2->subCell() * newSubCellWidth; | 1256 | x += item2->subCell() * newSubCellWidth; |
1252 | } | 1257 | } |
1253 | moveChild(item2,x,y); | 1258 | moveChild(item2,x,y); |
1254 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); | 1259 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); |
1255 | } | 1260 | } |
1256 | } | 1261 | } |
1257 | } | 1262 | } |
1258 | } | 1263 | } |
1259 | } else { | 1264 | } else { |
1260 | placeItem->setSubCell(0); | 1265 | placeItem->setSubCell(0); |
1261 | placeItem->setSubCells(1); | 1266 | placeItem->setSubCells(1); |
1262 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); | 1267 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); |
1263 | else placeItem->resize(mGridSpacingX,placeItem->height()); | 1268 | else placeItem->resize(mGridSpacingX,placeItem->height()); |
1264 | int x,y; | 1269 | int x,y; |
1265 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); | 1270 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); |
1266 | moveChild(placeItem,x,y); | 1271 | moveChild(placeItem,x,y); |
1267 | } | 1272 | } |
1268 | placeItem->setConflictItems(conflictItems); | 1273 | placeItem->setConflictItems(conflictItems); |
1269 | // for ( item=conflictItems.first(); item != 0; | 1274 | // for ( item=conflictItems.first(); item != 0; |
1270 | // item=conflictItems.next() ) { | 1275 | // item=conflictItems.next() ) { |
1271 | // //item->updateItem(); | 1276 | // //item->updateItem(); |
1272 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); | 1277 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); |
1273 | // } | 1278 | // } |
1274 | // placeItem->updateItem(); | 1279 | // placeItem->updateItem(); |
1275 | } | 1280 | } |
1276 | 1281 | ||
1277 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1282 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) |
1278 | { | 1283 | { |
1279 | if ( globalFlagBlockAgenda ) | 1284 | if ( globalFlagBlockAgenda ) |
1280 | return; | 1285 | return; |
1281 | 1286 | ||
1282 | if ( mInvalidPixmap ) { | 1287 | if ( mInvalidPixmap ) { |
1283 | mInvalidPixmap = false; | 1288 | mInvalidPixmap = false; |
1284 | qDebug("KO: Upsizing Pixmaps "); | 1289 | qDebug("KO: dc Upsizing Pixmaps %s", QDateTime::currentDateTime().toString().latin1()); |
1285 | computeSizes(); | 1290 | computeSizes(); |
1286 | emit updateViewSignal(); | 1291 | emit updateViewSignal(); |
1287 | return; | 1292 | return; |
1288 | } | 1293 | } |
1294 | //qDebug("KOAgenda::drawContents %s", QDateTime::currentDateTime().toString().latin1()); | ||
1289 | if ( ! mAllDayMode ) { | 1295 | if ( ! mAllDayMode ) { |
1290 | // currently not working for | 1296 | // currently not working for |
1291 | 1297 | ||
1292 | //qDebug("KOAgenda::drawContents "); | 1298 | //qDebug("KOAgenda::drawContents "); |
1293 | #if 0 | 1299 | #if 0 |
1294 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { | 1300 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { |
1295 | qDebug("WAU "); | 1301 | qDebug("WAU "); |
1296 | drawContentsToPainter(); | 1302 | drawContentsToPainter(); |
1297 | } | 1303 | } |
1298 | #endif | 1304 | #endif |
1299 | QPaintDevice* pd = p->device(); | 1305 | QPaintDevice* pd = p->device(); |
1300 | p->end(); | 1306 | p->end(); |
1301 | int vx, vy; | 1307 | int vx, vy; |
1302 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1308 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1303 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1309 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1304 | mSelectionCellX * mGridSpacingX; | 1310 | mSelectionCellX * mGridSpacingX; |
1305 | contentsToViewport ( cx, cy, vx,vy); | 1311 | contentsToViewport ( cx, cy, vx,vy); |
1306 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; | 1312 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; |
1307 | 1313 | ||
1308 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { | 1314 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { |
1309 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1315 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1310 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { | 1316 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { |
1311 | 1317 | ||
1312 | int vxSel, vySel; | 1318 | int vxSel, vySel; |
1313 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); | 1319 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); |
1314 | int off = mSelectionHeight; | 1320 | int off = mSelectionHeight; |
1315 | if ( vySel < 0 ) | 1321 | if ( vySel < 0 ) |
1316 | off += vySel; | 1322 | off += vySel; |
1317 | //qDebug("OFF %d %d %d", off,vySel, vy ); | 1323 | //qDebug("OFF %d %d %d", off,vySel, vy ); |
1318 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); | 1324 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); |
1319 | } else { | 1325 | } else { |
1320 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1326 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1321 | } | 1327 | } |
1322 | } | 1328 | } |
1323 | if ( mSelectionHeight > 0 ) { | 1329 | if ( mSelectionHeight > 0 ) { |
1324 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1330 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1325 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1331 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1326 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1332 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1327 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1333 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1328 | // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1334 | // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1329 | int hei = mSelectionHeight; | 1335 | int hei = mSelectionHeight; |
1330 | int offset = 0; | 1336 | int offset = 0; |
1331 | while ( hei > 0 ) { | 1337 | while ( hei > 0 ) { |
1332 | int p_hei = 5; | 1338 | int p_hei = 5; |
1333 | if ( hei < 5 ) p_hei = hei; | 1339 | if ( hei < 5 ) p_hei = hei; |
1334 | hei -= 5; | 1340 | hei -= 5; |
1335 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); | 1341 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); |
1336 | offset += 5; | 1342 | offset += 5; |
1337 | } | 1343 | } |
1338 | } | 1344 | } |
1339 | } | 1345 | } |
1340 | p->begin( pd ); | 1346 | p->begin( pd ); |
1341 | } else { | 1347 | } else { |
1342 | #if 0 | 1348 | #if 0 |
1343 | qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() ); | 1349 | qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() ); |
1344 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { | 1350 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { |
1345 | qDebug("WAUWAU "); | 1351 | qDebug("WAUWAU "); |
1346 | drawContentsToPainter(); | 1352 | drawContentsToPainter(); |
1347 | } | 1353 | } |
1348 | #endif | 1354 | #endif |
1349 | QPaintDevice* pd = p->device(); | 1355 | QPaintDevice* pd = p->device(); |
1350 | p->end(); | 1356 | p->end(); |
1351 | int vx, vy; | 1357 | int vx, vy; |
1352 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1358 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1353 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1359 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1354 | mSelectionCellX * mGridSpacingX; | 1360 | mSelectionCellX * mGridSpacingX; |
1355 | contentsToViewport ( cx, cy, vx,vy); | 1361 | contentsToViewport ( cx, cy, vx,vy); |
1356 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; | 1362 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; |
1357 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) | 1363 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) |
1358 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1364 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1359 | 1365 | ||
1360 | if ( mSelectionHeight > 0 ) { | 1366 | if ( mSelectionHeight > 0 ) { |
1361 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1367 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1362 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1368 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1363 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1369 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1364 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1370 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1365 | //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1371 | //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1366 | int hei = mSelectionHeight; | 1372 | int hei = mSelectionHeight; |
1367 | int offset = 0; | 1373 | int offset = 0; |
1368 | while ( hei > 0 ) { | 1374 | while ( hei > 0 ) { |
1369 | int p_hei = 5; | 1375 | int p_hei = 5; |
1370 | if ( hei < 5 ) p_hei = hei; | 1376 | if ( hei < 5 ) p_hei = hei; |
1371 | hei -= 5; | 1377 | hei -= 5; |
1372 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); | 1378 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); |
1373 | offset += 5; | 1379 | offset += 5; |
1374 | } | 1380 | } |
1375 | } | 1381 | } |
1376 | } | 1382 | } |
1377 | p->begin( pd ); | 1383 | p->begin( pd ); |
1378 | } | 1384 | } |
1379 | 1385 | ||
1380 | } | 1386 | } |
1381 | 1387 | ||
1382 | void KOAgenda::finishUpdate() | 1388 | void KOAgenda::finishUpdate() |
1383 | { | 1389 | { |
1384 | 1390 | ||