author | zautrix <zautrix> | 2005-07-05 08:37:52 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-05 08:37:52 (UTC) |
commit | 7e49703511de87f624cc8813b18ebbfcc01752cd (patch) (unidiff) | |
tree | 896918396dbf518f6358a066f93a04bd4185f535 /korganizer/koagenda.cpp | |
parent | 28ca4c37fb0e131b2978584992840b3fdca21d3e (diff) | |
download | kdepimpi-7e49703511de87f624cc8813b18ebbfcc01752cd.zip kdepimpi-7e49703511de87f624cc8813b18ebbfcc01752cd.tar.gz kdepimpi-7e49703511de87f624cc8813b18ebbfcc01752cd.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/koagenda.cpp | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index c339b57..662576f 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -51,25 +51,25 @@ | |||
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 | bool KOAgenda::mInvalidPixmap = false; | 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); |
@@ -321,24 +321,25 @@ void KOAgenda::init() | |||
321 | mPopupItem = 0; | 321 | mPopupItem = 0; |
322 | mInvalidPixmap = false; | 322 | mInvalidPixmap = false; |
323 | 323 | ||
324 | } | 324 | } |
325 | 325 | ||
326 | void KOAgenda::shrinkPixmap() | 326 | void KOAgenda::shrinkPixmap() |
327 | { | 327 | { |
328 | mPaintPixmap.resize( 20,20); | 328 | mPaintPixmap.resize( 20,20); |
329 | mInvalidPixmap = true; | 329 | mInvalidPixmap = true; |
330 | } | 330 | } |
331 | void KOAgenda::slotContentMove(int,int) | 331 | void KOAgenda::slotContentMove(int,int) |
332 | { | 332 | { |
333 | emit sendPing(); | ||
333 | if ( mActionType == NOP ) | 334 | if ( mActionType == NOP ) |
334 | slotClearSelection(); | 335 | slotClearSelection(); |
335 | if ( mSelectedItem && !mActionItem ) { | 336 | if ( mSelectedItem && !mActionItem ) { |
336 | deselectItem(); | 337 | deselectItem(); |
337 | emit incidenceSelected( 0 ); | 338 | emit incidenceSelected( 0 ); |
338 | } | 339 | } |
339 | } | 340 | } |
340 | void KOAgenda::clear() | 341 | void KOAgenda::clear() |
341 | { | 342 | { |
342 | KOAgendaItem *item; | 343 | KOAgendaItem *item; |
343 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 344 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
344 | mUnusedItems.append( item ); | 345 | mUnusedItems.append( item ); |
@@ -429,24 +430,33 @@ void KOAgenda::popupMenu() | |||
429 | void KOAgenda::categoryChanged(Incidence * inc) | 430 | void KOAgenda::categoryChanged(Incidence * inc) |
430 | { | 431 | { |
431 | KOAgendaItem *item; | 432 | KOAgendaItem *item; |
432 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 433 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
433 | if ( item->incidence() == inc ) { | 434 | if ( item->incidence() == inc ) { |
434 | item->initColor (); | 435 | item->initColor (); |
435 | item->updateItem(); | 436 | item->updateItem(); |
436 | } | 437 | } |
437 | } | 438 | } |
438 | } | 439 | } |
439 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 440 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
440 | { | 441 | { |
442 | |||
443 | if ( mInvalidPixmap ) { | ||
444 | mInvalidPixmap = false; | ||
445 | qDebug("InvalidPixmap "); | ||
446 | computeSizes(); | ||
447 | emit updateViewSignal(); | ||
448 | return true; | ||
449 | } | ||
450 | emit sendPing(); | ||
441 | static int startX = 0; | 451 | static int startX = 0; |
442 | static int startY = 0; | 452 | static int startY = 0; |
443 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); | 453 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); |
444 | static bool blockMoving = true; | 454 | static bool blockMoving = true; |
445 | 455 | ||
446 | //qDebug("KOAgenda::eventFilter_mous "); | 456 | //qDebug("KOAgenda::eventFilter_mous "); |
447 | if ( object == mNewItemPopup ) { | 457 | if ( object == mNewItemPopup ) { |
448 | //qDebug("mNewItemPopup "); | 458 | //qDebug("mNewItemPopup "); |
449 | if ( me->type() == QEvent::MouseButtonRelease ) { | 459 | if ( me->type() == QEvent::MouseButtonRelease ) { |
450 | mNewItemPopup->removeEventFilter( this ); | 460 | mNewItemPopup->removeEventFilter( this ); |
451 | int dX = me->globalPos().x() - mPopupPos.x();; | 461 | int dX = me->globalPos().x() - mPopupPos.x();; |
452 | if ( dX < 0 ) | 462 | if ( dX < 0 ) |
@@ -1258,34 +1268,38 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1258 | // } | 1268 | // } |
1259 | // placeItem->updateItem(); | 1269 | // placeItem->updateItem(); |
1260 | } | 1270 | } |
1261 | 1271 | ||
1262 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1272 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) |
1263 | { | 1273 | { |
1264 | if ( globalFlagBlockAgenda ) | 1274 | if ( globalFlagBlockAgenda ) |
1265 | return; | 1275 | return; |
1266 | 1276 | ||
1267 | if ( mInvalidPixmap ) { | 1277 | if ( mInvalidPixmap ) { |
1268 | mInvalidPixmap = false; | 1278 | mInvalidPixmap = false; |
1269 | qDebug("InvalidPixmap "); | 1279 | qDebug("InvalidPixmap "); |
1270 | QTimer::singleShot( 0, this, SIGNAL( updateViewSignal() )); | 1280 | computeSizes(); |
1281 | emit updateViewSignal(); | ||
1271 | return; | 1282 | return; |
1272 | } | 1283 | } |
1273 | if ( ! mAllDayMode ) { | 1284 | if ( ! mAllDayMode ) { |
1274 | // currently not working for | 1285 | // currently not working for |
1275 | 1286 | ||
1276 | //qDebug("KOAgenda::drawContents "); | 1287 | //qDebug("KOAgenda::drawContents "); |
1277 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1288 | #if 0 |
1278 | ;//drawContentsToPainter(); | 1289 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { |
1279 | 1290 | qDebug("WAU "); | |
1291 | drawContentsToPainter(); | ||
1292 | } | ||
1293 | #endif | ||
1280 | QPaintDevice* pd = p->device(); | 1294 | QPaintDevice* pd = p->device(); |
1281 | p->end(); | 1295 | p->end(); |
1282 | int vx, vy; | 1296 | int vx, vy; |
1283 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1297 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1284 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1298 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1285 | mSelectionCellX * mGridSpacingX; | 1299 | mSelectionCellX * mGridSpacingX; |
1286 | contentsToViewport ( cx, cy, vx,vy); | 1300 | contentsToViewport ( cx, cy, vx,vy); |
1287 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; | 1301 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; |
1288 | 1302 | ||
1289 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { | 1303 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { |
1290 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1304 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1291 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { | 1305 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { |
@@ -1311,28 +1325,31 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | |||
1311 | int offset = 0; | 1325 | int offset = 0; |
1312 | while ( hei > 0 ) { | 1326 | while ( hei > 0 ) { |
1313 | int p_hei = 5; | 1327 | int p_hei = 5; |
1314 | if ( hei < 5 ) p_hei = hei; | 1328 | if ( hei < 5 ) p_hei = hei; |
1315 | hei -= 5; | 1329 | hei -= 5; |
1316 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); | 1330 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); |
1317 | offset += 5; | 1331 | offset += 5; |
1318 | } | 1332 | } |
1319 | } | 1333 | } |
1320 | } | 1334 | } |
1321 | p->begin( pd ); | 1335 | p->begin( pd ); |
1322 | } else { | 1336 | } else { |
1323 | 1337 | #if 0 | |
1324 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1338 | qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() ); |
1325 | ;//drawContentsToPainter(); | 1339 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { |
1326 | 1340 | qDebug("WAUWAU "); | |
1341 | drawContentsToPainter(); | ||
1342 | } | ||
1343 | #endif | ||
1327 | QPaintDevice* pd = p->device(); | 1344 | QPaintDevice* pd = p->device(); |
1328 | p->end(); | 1345 | p->end(); |
1329 | int vx, vy; | 1346 | int vx, vy; |
1330 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1347 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1331 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1348 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1332 | mSelectionCellX * mGridSpacingX; | 1349 | mSelectionCellX * mGridSpacingX; |
1333 | contentsToViewport ( cx, cy, vx,vy); | 1350 | contentsToViewport ( cx, cy, vx,vy); |
1334 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; | 1351 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; |
1335 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) | 1352 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) |
1336 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1353 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1337 | 1354 | ||
1338 | if ( mSelectionHeight > 0 ) { | 1355 | if ( mSelectionHeight > 0 ) { |