summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index ffa2678..a72e470 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -389,33 +389,32 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
//qDebug("KOAgenda::eventFilter_mous ");
QPoint viewportPos;
if (object != viewport()) {
viewportPos = ((QWidget *)object)->mapToParent(me->pos());
} else {
viewportPos = me->pos();
}
static int startX = 0;
static int startY = 0;
static bool block = true;
switch (me->type()) {
case QEvent::MouseButtonPress:
//qDebug("QEvent::MouseButtonPress: ");
// kdDebug() << "koagenda: filtered button press" << endl;
if (object != viewport()) {
if (me->button() == RightButton) {
-
mClickedItem = (KOAgendaItem *)object;
if (mClickedItem) {
selectItem(mClickedItem);
// emit showIncidencePopupSignal(mClickedItem->incidence());
}
//mItemPopup->popup(QCursor::pos());
} else {
mActionItem = (KOAgendaItem *)object;
if (mActionItem) {
if ( mSelectionHeight > 0 ) {
int selectionCellX = mSelectionCellX * mGridSpacingX;
int selectionYTop = mSelectionYTop;
int gridSpacingX = mGridSpacingX;
int selectionHeight = mSelectionHeight;
clearSelection();
repaintContents( selectionCellX, selectionYTop,
@@ -441,42 +440,53 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
block = false;
} else {
blockNewEvent = false;
setCursor(arrowCursor);
startSelectAction(viewportPos);
}
}
break;
case QEvent::MouseButtonRelease:
//qDebug("QEvent::MouseButtonRelease: %d",blockNewEvent );
if (me->button() == RightButton && blockNewEvent && !block) {
int x,y;
viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
int gx,gy;
contentsToGrid(x,y,gx,gy);
- if ( mCurrentCellY < mStartCellY +1 ) {
- //qDebug("mCurrentCellY %d mStartCellY %d ", mCurrentCellY,mStartCellY);
- mCurrentCellX = gx;
- mCurrentCellY = gy;
- mStartCellX = gx;
- mStartCellY = gy;
- mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
- break;
+ if ( object == viewport() ) {
+ if ( mCurrentCellY < mStartCellY +1 ) {
+ //qDebug("mCurrentCellY %d mStartCellY %d ", mCurrentCellY,mStartCellY);
+ mCurrentCellX = gx;
+ mCurrentCellY = gy;
+ mStartCellX = gx;
+ mStartCellY = gy;
+ mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
+ break;
+ } else {
+ blockNewEvent = false;
+ }
} else {
- blockNewEvent = false;
+ mClickedItem = (KOAgendaItem *)object;
+ if (mActionItem ) {
+ endItemAction();
+ }
+ if (mClickedItem) {
+ selectItem(mClickedItem);
+ emit showIncidencePopupSignal(mClickedItem->incidence());
+ }
}
} else if (me->button() == RightButton && block ) {
if (object != viewport()) {
mClickedItem = (KOAgendaItem *)object;
if (mActionItem ) {
endItemAction();
}
if (mClickedItem) {
selectItem(mClickedItem);
emit showIncidencePopupSignal(mClickedItem->incidence());
}
}
break;
}
block = true;
if (mActionItem) {