author | zautrix <zautrix> | 2005-06-03 11:21:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-03 11:21:25 (UTC) |
commit | dd80f5bb6eee2a924748b7d0acfb4fb892f58b86 (patch) (unidiff) | |
tree | 24f60fbd7cfaf5b4a9f545d4f61a7deebbd7d725 | |
parent | ab0f6af57ebf5b5a6fa2f7e6209fe04aafbfb14f (diff) | |
download | kdepimpi-dd80f5bb6eee2a924748b7d0acfb4fb892f58b86.zip kdepimpi-dd80f5bb6eee2a924748b7d0acfb4fb892f58b86.tar.gz kdepimpi-dd80f5bb6eee2a924748b7d0acfb4fb892f58b86.tar.bz2 |
block move change
-rw-r--r-- | korganizer/koagenda.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 99009a5..cdeeac5 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -288,344 +288,345 @@ void KOAgenda::init() | |||
288 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 288 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
289 | 289 | ||
290 | viewport()->update(); | 290 | viewport()->update(); |
291 | 291 | ||
292 | setMinimumSize(30, 1); | 292 | setMinimumSize(30, 1); |
293 | // setMaximumHeight(mGridSpacingY * mRows + 5); | 293 | // setMaximumHeight(mGridSpacingY * mRows + 5); |
294 | 294 | ||
295 | // Disable horizontal scrollbar. This is a hack. The geometry should be | 295 | // Disable horizontal scrollbar. This is a hack. The geometry should be |
296 | // controlled in a way that the contents horizontally always fits. Then it is | 296 | // controlled in a way that the contents horizontally always fits. Then it is |
297 | // not necessary to turn off the scrollbar. | 297 | // not necessary to turn off the scrollbar. |
298 | setHScrollBarMode(AlwaysOff); | 298 | setHScrollBarMode(AlwaysOff); |
299 | if ( ! mAllDayMode ) | 299 | if ( ! mAllDayMode ) |
300 | setVScrollBarMode(AlwaysOn); | 300 | setVScrollBarMode(AlwaysOn); |
301 | else | 301 | else |
302 | setVScrollBarMode(AlwaysOff); | 302 | setVScrollBarMode(AlwaysOff); |
303 | 303 | ||
304 | setStartHour(KOPrefs::instance()->mDayBegins); | 304 | setStartHour(KOPrefs::instance()->mDayBegins); |
305 | 305 | ||
306 | calculateWorkingHours(); | 306 | calculateWorkingHours(); |
307 | 307 | ||
308 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), | 308 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), |
309 | SLOT(checkScrollBoundaries(int))); | 309 | SLOT(checkScrollBoundaries(int))); |
310 | 310 | ||
311 | // Create the Marcus Bains line. | 311 | // Create the Marcus Bains line. |
312 | if(mAllDayMode) | 312 | if(mAllDayMode) |
313 | mMarcusBains = 0; | 313 | mMarcusBains = 0; |
314 | else { | 314 | else { |
315 | mMarcusBains = new MarcusBains(this); | 315 | mMarcusBains = new MarcusBains(this); |
316 | addChild(mMarcusBains); | 316 | addChild(mMarcusBains); |
317 | } | 317 | } |
318 | mPopupKind = 0; | 318 | mPopupKind = 0; |
319 | mPopupItem = 0; | 319 | mPopupItem = 0; |
320 | } | 320 | } |
321 | 321 | ||
322 | void KOAgenda::clear() | 322 | void KOAgenda::clear() |
323 | { | 323 | { |
324 | KOAgendaItem *item; | 324 | KOAgendaItem *item; |
325 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 325 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
326 | mUnusedItems.append( item ); | 326 | mUnusedItems.append( item ); |
327 | //item->hide(); | 327 | //item->hide(); |
328 | } | 328 | } |
329 | mItems.clear(); | 329 | mItems.clear(); |
330 | mSelectedItem = 0; | 330 | mSelectedItem = 0; |
331 | clearSelection(); | 331 | clearSelection(); |
332 | } | 332 | } |
333 | 333 | ||
334 | void KOAgenda::clearSelection() | 334 | void KOAgenda::clearSelection() |
335 | { | 335 | { |
336 | mSelectionCellX = 0; | 336 | mSelectionCellX = 0; |
337 | mSelectionYTop = 0; | 337 | mSelectionYTop = 0; |
338 | mSelectionHeight = 0; | 338 | mSelectionHeight = 0; |
339 | } | 339 | } |
340 | 340 | ||
341 | void KOAgenda::marcus_bains() | 341 | void KOAgenda::marcus_bains() |
342 | { | 342 | { |
343 | if(mMarcusBains) mMarcusBains->updateLocation(true); | 343 | if(mMarcusBains) mMarcusBains->updateLocation(true); |
344 | } | 344 | } |
345 | 345 | ||
346 | 346 | ||
347 | void KOAgenda::changeColumns(int columns) | 347 | void KOAgenda::changeColumns(int columns) |
348 | { | 348 | { |
349 | if (columns == 0) { | 349 | if (columns == 0) { |
350 | qDebug("KOAgenda::changeColumns() called with argument 0 "); | 350 | qDebug("KOAgenda::changeColumns() called with argument 0 "); |
351 | return; | 351 | return; |
352 | } | 352 | } |
353 | clear(); | 353 | clear(); |
354 | mColumns = columns; | 354 | mColumns = columns; |
355 | computeSizes(); | 355 | computeSizes(); |
356 | } | 356 | } |
357 | 357 | ||
358 | /* | 358 | /* |
359 | This is the eventFilter function, which gets all events from the KOAgendaItems | 359 | This is the eventFilter function, which gets all events from the KOAgendaItems |
360 | contained in the agenda. It has to handle moving and resizing for all items. | 360 | contained in the agenda. It has to handle moving and resizing for all items. |
361 | */ | 361 | */ |
362 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | 362 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) |
363 | { | 363 | { |
364 | // kdDebug() << "KOAgenda::eventFilter" << endl; | 364 | // kdDebug() << "KOAgenda::eventFilter" << endl; |
365 | switch(event->type()) { | 365 | switch(event->type()) { |
366 | case QEvent::MouseButtonPress: | 366 | case QEvent::MouseButtonPress: |
367 | case QEvent::MouseButtonDblClick: | 367 | case QEvent::MouseButtonDblClick: |
368 | case QEvent::MouseButtonRelease: | 368 | case QEvent::MouseButtonRelease: |
369 | case QEvent::MouseMove: | 369 | case QEvent::MouseMove: |
370 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); | 370 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); |
371 | 371 | ||
372 | case (QEvent::Leave): | 372 | case (QEvent::Leave): |
373 | if (!mActionItem) | 373 | if (!mActionItem) |
374 | setCursor(arrowCursor); | 374 | setCursor(arrowCursor); |
375 | return true; | 375 | return true; |
376 | 376 | ||
377 | default: | 377 | default: |
378 | return QScrollView::eventFilter(object,event); | 378 | return QScrollView::eventFilter(object,event); |
379 | } | 379 | } |
380 | } | 380 | } |
381 | void KOAgenda::popupMenu() | 381 | void KOAgenda::popupMenu() |
382 | { | 382 | { |
383 | mPopupTimer->stop(); | 383 | mPopupTimer->stop(); |
384 | if ( mPopupKind == 1 || mPopupKind == 3 ) { | 384 | if ( mPopupKind == 1 || mPopupKind == 3 ) { |
385 | if (mActionItem ) { | 385 | if (mActionItem ) { |
386 | endItemAction(); | 386 | endItemAction(); |
387 | } | 387 | } |
388 | mLeftMouseDown = false; // no more leftMouse computation | 388 | mLeftMouseDown = false; // no more leftMouse computation |
389 | if (mPopupItem) { | 389 | if (mPopupItem) { |
390 | //mClickedItem = mPopupItem; | 390 | //mClickedItem = mPopupItem; |
391 | selectItem(mPopupItem); | 391 | selectItem(mPopupItem); |
392 | if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 ) | 392 | if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 ) |
393 | mAllAgendaPopup->installEventFilter( this ); | 393 | mAllAgendaPopup->installEventFilter( this ); |
394 | emit showIncidencePopupSignal(mPopupItem->incidence()); | 394 | emit showIncidencePopupSignal(mPopupItem->incidence()); |
395 | 395 | ||
396 | } | 396 | } |
397 | } else if ( mPopupKind == 2 || mPopupKind == 4 ) { | 397 | } else if ( mPopupKind == 2 || mPopupKind == 4 ) { |
398 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action | 398 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action |
399 | endSelectAction( false ); // do not emit new event signal | 399 | endSelectAction( false ); // do not emit new event signal |
400 | mLeftMouseDown = false; // no more leftMouse computation | 400 | mLeftMouseDown = false; // no more leftMouse computation |
401 | } | 401 | } |
402 | if ( KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 2 ) | 402 | if ( KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 2 ) |
403 | mNewItemPopup->installEventFilter( this ); | 403 | mNewItemPopup->installEventFilter( this ); |
404 | mNewItemPopup->popup( mPopupPos); | 404 | mNewItemPopup->popup( mPopupPos); |
405 | 405 | ||
406 | } | 406 | } |
407 | mLeftMouseDown = false; | 407 | mLeftMouseDown = false; |
408 | mPopupItem = 0; | 408 | mPopupItem = 0; |
409 | mPopupKind = 0; | 409 | mPopupKind = 0; |
410 | } | 410 | } |
411 | 411 | ||
412 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 412 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
413 | { | 413 | { |
414 | static int startX = 0; | 414 | static int startX = 0; |
415 | static int startY = 0; | 415 | static int startY = 0; |
416 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | 416 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); |
417 | static bool blockMoving = true; | 417 | static bool blockMoving = true; |
418 | 418 | ||
419 | //qDebug("KOAgenda::eventFilter_mous "); | 419 | //qDebug("KOAgenda::eventFilter_mous "); |
420 | if ( object == mNewItemPopup ) { | 420 | if ( object == mNewItemPopup ) { |
421 | //qDebug("mNewItemPopup "); | 421 | //qDebug("mNewItemPopup "); |
422 | if ( me->type() == QEvent::MouseButtonRelease ) { | 422 | if ( me->type() == QEvent::MouseButtonRelease ) { |
423 | mNewItemPopup->removeEventFilter( this ); | 423 | mNewItemPopup->removeEventFilter( this ); |
424 | int dX = me->globalPos().x() - mPopupPos.x();; | 424 | int dX = me->globalPos().x() - mPopupPos.x();; |
425 | if ( dX < 0 ) | 425 | if ( dX < 0 ) |
426 | dX = -dX; | 426 | dX = -dX; |
427 | int dY = me->globalPos().y() - mPopupPos.y(); | 427 | int dY = me->globalPos().y() - mPopupPos.y(); |
428 | if ( dY < 0 ) | 428 | if ( dY < 0 ) |
429 | dY = -dY; | 429 | dY = -dY; |
430 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 430 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
431 | mNewItemPopup->hide(); | 431 | mNewItemPopup->hide(); |
432 | } | 432 | } |
433 | } | 433 | } |
434 | return true; | 434 | return true; |
435 | } | 435 | } |
436 | if ( object == mAllAgendaPopup ) { | 436 | if ( object == mAllAgendaPopup ) { |
437 | //qDebug(" mAllAgendaPopup "); | 437 | //qDebug(" mAllAgendaPopup "); |
438 | if ( me->type() == QEvent::MouseButtonRelease ) { | 438 | if ( me->type() == QEvent::MouseButtonRelease ) { |
439 | mAllAgendaPopup->removeEventFilter( this ); | 439 | mAllAgendaPopup->removeEventFilter( this ); |
440 | int dX = me->globalPos().x() - mPopupPos.x();; | 440 | int dX = me->globalPos().x() - mPopupPos.x();; |
441 | if ( dX < 0 ) | 441 | if ( dX < 0 ) |
442 | dX = -dX; | 442 | dX = -dX; |
443 | int dY = me->globalPos().y() - mPopupPos.y(); | 443 | int dY = me->globalPos().y() - mPopupPos.y(); |
444 | if ( dY < 0 ) | 444 | if ( dY < 0 ) |
445 | dY = -dY; | 445 | dY = -dY; |
446 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 446 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
447 | mAllAgendaPopup->hide(); | 447 | mAllAgendaPopup->hide(); |
448 | } | 448 | } |
449 | } | 449 | } |
450 | return true; | 450 | return true; |
451 | } | 451 | } |
452 | QPoint viewportPos; | 452 | QPoint viewportPos; |
453 | if (object != viewport()) { | 453 | if (object != viewport()) { |
454 | blockmoveDist = blockmoveDist*2; | ||
454 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 455 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
455 | } else { | 456 | } else { |
456 | viewportPos = me->pos(); | 457 | viewportPos = me->pos(); |
457 | } | 458 | } |
458 | 459 | ||
459 | switch (me->type()) { | 460 | switch (me->type()) { |
460 | case QEvent::MouseButtonPress: | 461 | case QEvent::MouseButtonPress: |
461 | if (me->button() == LeftButton) { | 462 | if (me->button() == LeftButton) { |
462 | mPopupTimer->start( 600 ); | 463 | mPopupTimer->start( 600 ); |
463 | mLeftMouseDown = true; | 464 | mLeftMouseDown = true; |
464 | } | 465 | } |
465 | blockMoving = true; | 466 | blockMoving = true; |
466 | startX = viewportPos.x(); | 467 | startX = viewportPos.x(); |
467 | startY = viewportPos.y(); | 468 | startY = viewportPos.y(); |
468 | mPopupPos = me->globalPos(); | 469 | mPopupPos = me->globalPos(); |
469 | if (object != viewport()) { | 470 | if (object != viewport()) { |
470 | mPopupItem = (KOAgendaItem *)object; | 471 | mPopupItem = (KOAgendaItem *)object; |
471 | mPopupKind = 1; | 472 | mPopupKind = 1; |
472 | if (me->button() == RightButton) { | 473 | if (me->button() == RightButton) { |
473 | mPopupKind = 3; | 474 | mPopupKind = 3; |
474 | popupMenu(); | 475 | popupMenu(); |
475 | } else if (me->button() == LeftButton) { | 476 | } else if (me->button() == LeftButton) { |
476 | mActionItem = (KOAgendaItem *)object; | 477 | mActionItem = (KOAgendaItem *)object; |
477 | if (mActionItem) { | 478 | if (mActionItem) { |
478 | emit signalClearSelection(); | 479 | emit signalClearSelection(); |
479 | slotClearSelection(); | 480 | slotClearSelection(); |
480 | selectItem(mActionItem); | 481 | selectItem(mActionItem); |
481 | Incidence *incidence = mActionItem->incidence(); | 482 | Incidence *incidence = mActionItem->incidence(); |
482 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 483 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { |
483 | mActionItem = 0; | 484 | mActionItem = 0; |
484 | } else { | 485 | } else { |
485 | startItemAction(viewportPos); | 486 | startItemAction(viewportPos); |
486 | } | 487 | } |
487 | } | 488 | } |
488 | } | 489 | } |
489 | } else { // ---------- viewport() | 490 | } else { // ---------- viewport() |
490 | mPopupItem = 0; | 491 | mPopupItem = 0; |
491 | mPopupKind = 2; | 492 | mPopupKind = 2; |
492 | selectItem(0); | 493 | selectItem(0); |
493 | mActionItem = 0; | 494 | mActionItem = 0; |
494 | if (me->button() == RightButton) { | 495 | if (me->button() == RightButton) { |
495 | int x,y; | 496 | int x,y; |
496 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 497 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
497 | int gx,gy; | 498 | int gx,gy; |
498 | contentsToGrid(x,y,gx,gy); | 499 | contentsToGrid(x,y,gx,gy); |
499 | mCurrentCellX = gx; | 500 | mCurrentCellX = gx; |
500 | mCurrentCellY = gy; | 501 | mCurrentCellY = gy; |
501 | mStartCellX = gx; | 502 | mStartCellX = gx; |
502 | mStartCellY = gy; | 503 | mStartCellY = gy; |
503 | mPopupKind = 4; | 504 | mPopupKind = 4; |
504 | popupMenu(); | 505 | popupMenu(); |
505 | } else if (me->button() == LeftButton) { | 506 | } else if (me->button() == LeftButton) { |
506 | setCursor(arrowCursor); | 507 | setCursor(arrowCursor); |
507 | startSelectAction(viewportPos); | 508 | startSelectAction(viewportPos); |
508 | } | 509 | } |
509 | } | 510 | } |
510 | break; | 511 | break; |
511 | 512 | ||
512 | case QEvent::MouseButtonRelease: | 513 | case QEvent::MouseButtonRelease: |
513 | if (me->button() == LeftButton ) { | 514 | if (me->button() == LeftButton ) { |
514 | mPopupTimer->stop(); | 515 | mPopupTimer->stop(); |
515 | } | 516 | } |
516 | if (object != viewport()) { | 517 | if (object != viewport()) { |
517 | if (me->button() == LeftButton && mLeftMouseDown) { | 518 | if (me->button() == LeftButton && mLeftMouseDown) { |
518 | if (mActionItem) { | 519 | if (mActionItem) { |
519 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 520 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
520 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | 521 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); |
521 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | 522 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { |
522 | mScrollUpTimer.stop(); | 523 | mScrollUpTimer.stop(); |
523 | mScrollDownTimer.stop(); | 524 | mScrollDownTimer.stop(); |
524 | mActionItem->resetMove(); | 525 | mActionItem->resetMove(); |
525 | placeSubCells( mActionItem ); | 526 | placeSubCells( mActionItem ); |
526 | // emit startDragSignal( mActionItem->incidence() ); | 527 | // emit startDragSignal( mActionItem->incidence() ); |
527 | setCursor( arrowCursor ); | 528 | setCursor( arrowCursor ); |
528 | mActionItem = 0; | 529 | mActionItem = 0; |
529 | mActionType = NOP; | 530 | mActionType = NOP; |
530 | mItemMoved = 0; | 531 | mItemMoved = 0; |
531 | mLeftMouseDown = false; | 532 | mLeftMouseDown = false; |
532 | return true; | 533 | return true; |
533 | } | 534 | } |
534 | endItemAction(); | 535 | endItemAction(); |
535 | } | 536 | } |
536 | } | 537 | } |
537 | 538 | ||
538 | } else { // ---------- viewport() | 539 | } else { // ---------- viewport() |
539 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click | 540 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click |
540 | endSelectAction( true ); // emit new event signal | 541 | endSelectAction( true ); // emit new event signal |
541 | } | 542 | } |
542 | } | 543 | } |
543 | if (me->button() == LeftButton) | 544 | if (me->button() == LeftButton) |
544 | mLeftMouseDown = false; | 545 | mLeftMouseDown = false; |
545 | 546 | ||
546 | break; | 547 | break; |
547 | 548 | ||
548 | case QEvent::MouseMove: | 549 | case QEvent::MouseMove: |
549 | //qDebug("mm "); | 550 | //qDebug("mm "); |
550 | if ( !mLeftMouseDown ) | 551 | if ( !mLeftMouseDown ) |
551 | return false; | 552 | return false; |
552 | if ( blockMoving ) { | 553 | if ( blockMoving ) { |
553 | int dX, dY; | 554 | int dX, dY; |
554 | dX = startX - viewportPos.x(); | 555 | dX = startX - viewportPos.x(); |
555 | if ( dX < 0 ) | 556 | if ( dX < 0 ) |
556 | dX = -dX; | 557 | dX = -dX; |
557 | dY = viewportPos.y() - startY; | 558 | dY = viewportPos.y() - startY; |
558 | if ( dY < 0 ) | 559 | if ( dY < 0 ) |
559 | dY = -dY; | 560 | dY = -dY; |
560 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); | 561 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); |
561 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 562 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
562 | blockMoving = false; | 563 | blockMoving = false; |
563 | } | 564 | } |
564 | } | 565 | } |
565 | if ( ! blockMoving ) | 566 | if ( ! blockMoving ) |
566 | mPopupTimer->stop(); | 567 | mPopupTimer->stop(); |
567 | if (object != viewport()) { | 568 | if (object != viewport()) { |
568 | KOAgendaItem *moveItem = (KOAgendaItem *)object; | 569 | KOAgendaItem *moveItem = (KOAgendaItem *)object; |
569 | if (!moveItem->incidence()->isReadOnly() ) { | 570 | if (!moveItem->incidence()->isReadOnly() ) { |
570 | if (!mActionItem) | 571 | if (!mActionItem) |
571 | setNoActionCursor(moveItem,viewportPos); | 572 | setNoActionCursor(moveItem,viewportPos); |
572 | else { | 573 | else { |
573 | if ( !blockMoving ) | 574 | if ( !blockMoving ) |
574 | performItemAction(viewportPos); | 575 | performItemAction(viewportPos); |
575 | } | 576 | } |
576 | } | 577 | } |
577 | } else { // ---------- viewport() | 578 | } else { // ---------- viewport() |
578 | mPopupPos = viewport()->mapToGlobal( me->pos() ); | 579 | mPopupPos = viewport()->mapToGlobal( me->pos() ); |
579 | if ( mActionType == SELECT ) { | 580 | if ( mActionType == SELECT ) { |
580 | performSelectAction( viewportPos ); | 581 | performSelectAction( viewportPos ); |
581 | } | 582 | } |
582 | } | 583 | } |
583 | break; | 584 | break; |
584 | 585 | ||
585 | case QEvent::MouseButtonDblClick: | 586 | case QEvent::MouseButtonDblClick: |
586 | mPopupTimer->stop(); | 587 | mPopupTimer->stop(); |
587 | if (object == viewport()) { | 588 | if (object == viewport()) { |
588 | selectItem(0); | 589 | selectItem(0); |
589 | int x,y; | 590 | int x,y; |
590 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 591 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
591 | int gx,gy; | 592 | int gx,gy; |
592 | contentsToGrid(x,y,gx,gy); | 593 | contentsToGrid(x,y,gx,gy); |
593 | emit newEventSignal(gx,gy); | 594 | emit newEventSignal(gx,gy); |
594 | } else { | 595 | } else { |
595 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | 596 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; |
596 | selectItem(doubleClickedItem); | 597 | selectItem(doubleClickedItem); |
597 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 598 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
598 | emit editIncidenceSignal(doubleClickedItem->incidence()); | 599 | emit editIncidenceSignal(doubleClickedItem->incidence()); |
599 | else | 600 | else |
600 | emit showIncidenceSignal(doubleClickedItem->incidence()); | 601 | emit showIncidenceSignal(doubleClickedItem->incidence()); |
601 | } | 602 | } |
602 | break; | 603 | break; |
603 | 604 | ||
604 | default: | 605 | default: |
605 | break; | 606 | break; |
606 | } | 607 | } |
607 | return true; | 608 | return true; |
608 | 609 | ||
609 | } | 610 | } |
610 | 611 | ||
611 | void KOAgenda::newItem( int item ) | 612 | void KOAgenda::newItem( int item ) |
612 | { | 613 | { |
613 | if ( item == 1 ) { //new event | 614 | if ( item == 1 ) { //new event |
614 | newEventSignal(mStartCellX ,mStartCellY ); | 615 | newEventSignal(mStartCellX ,mStartCellY ); |
615 | } else | 616 | } else |
616 | if ( item == 2 ) { //new event | 617 | if ( item == 2 ) { //new event |
617 | newTodoSignal(mStartCellX ,mStartCellY ); | 618 | newTodoSignal(mStartCellX ,mStartCellY ); |
618 | } else | 619 | } else |
619 | { | 620 | { |
620 | emit showDateView( item, mStartCellX ); | 621 | emit showDateView( item, mStartCellX ); |
621 | // 3Day view | 622 | // 3Day view |
622 | // 4Week view | 623 | // 4Week view |
623 | // 5Month view | 624 | // 5Month view |
624 | // 6Journal view | 625 | // 6Journal view |
625 | } | 626 | } |
626 | } | 627 | } |
627 | void KOAgenda::slotClearSelection() | 628 | void KOAgenda::slotClearSelection() |
628 | { | 629 | { |
629 | if (mSelectionHeight) { | 630 | if (mSelectionHeight) { |
630 | int selectionX = mSelectionCellX * mGridSpacingX; | 631 | int selectionX = mSelectionCellX * mGridSpacingX; |
631 | int top = mSelectionYTop - 2 *mGridSpacingY; | 632 | int top = mSelectionYTop - 2 *mGridSpacingY; |