summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp77
-rw-r--r--korganizer/koagendaitem.cpp2
-rw-r--r--korganizer/kolistview.cpp46
-rw-r--r--korganizer/kolistview.h2
-rw-r--r--korganizer/komonthview.cpp11
5 files changed, 48 insertions, 90 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 2820ca2..66ad4ec 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -176,5 +176,5 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
mAllDayMode = false;
#ifndef DESKTOP_VERSION
- //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
+ QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
mHolidayMask = 0;
@@ -399,24 +399,28 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
static bool blockMoving = true;
static bool leftMouseDown = false;
- static bool rightMouseDown = false;
- static QTime rightClickTime;
bool rightButtonPressed = false;
switch (me->type()) {
case QEvent::MouseButtonPress:
- rightClickTime.restart();
if (me->button() == LeftButton) {
leftMouseDown = true;
}
- else if (me->button() == RightButton)
- rightMouseDown = true;
+ else if (me->button() == RightButton) {
+ leftMouseDown = false;
+ }
blockMoving = true;
startX = viewportPos.x();
startY = viewportPos.y();
- if (object != viewport()) {
+ if (object != viewport()) { // item clicked **************
if (me->button() == RightButton) {
+ leftMouseDown = false;
mClickedItem = (KOAgendaItem *)object;
+ if (mActionItem ) {
+ endItemAction();
+ }
if (mClickedItem) {
selectItem(mClickedItem);
- }
+ emit showIncidencePopupSignal(mClickedItem->incidence());
+ }
+ return true;
} else if (me->button() == LeftButton) {
mActionItem = (KOAgendaItem *)object;
@@ -446,4 +450,19 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
setCursor(arrowCursor);
startSelectAction(viewportPos);
+ } else if (me->button() == RightButton ) {
+ setCursor(arrowCursor);
+ if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action
+ endSelectAction( false ); // do not emit new event signal
+ leftMouseDown = false; // no more leftMouse computation
+ }
+ int x,y;
+ viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
+ int gx,gy;
+ contentsToGrid(x,y,gx,gy);
+ mCurrentCellX = gx;
+ mCurrentCellY = gy;
+ mStartCellX = gx;
+ mStartCellY = gy;
+ mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
}
}
@@ -451,20 +470,7 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
case QEvent::MouseButtonRelease:
- if ( rightClickTime.elapsed() > 500 && blockMoving )
- rightButtonPressed = true;
+
if (object != viewport()) {
- if (me->button() == RightButton || rightButtonPressed ) {
- if ( blockMoving ) {
- mClickedItem = (KOAgendaItem *)object;
- if (mActionItem ) {
- endItemAction();
- }
- leftMouseDown = false; // no more leftMouse computation
- if (mClickedItem) {
- selectItem(mClickedItem);
- emit showIncidencePopupSignal(mClickedItem->incidence());
- }
- }
- } else if (me->button() == LeftButton && leftMouseDown) {
+ if (me->button() == LeftButton && leftMouseDown) {
if (mActionItem) {
QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
@@ -488,22 +494,5 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
} else { // ---------- viewport()
- if (me->button() == RightButton || rightButtonPressed ) { //right click
- if ( blockMoving ) { // we did mot moved the mouse much - popup menu
- if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action
- endSelectAction( false ); // do not emit new event signal
- leftMouseDown = false; // no more leftMouse computation
- }
- int x,y;
- viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
- int gx,gy;
- contentsToGrid(x,y,gx,gy);
- mCurrentCellX = gx;
- mCurrentCellY = gy;
- mStartCellX = gx;
- mStartCellY = gy;
- mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
- }
- }
- else if (me->button() == LeftButton && leftMouseDown ) { //left click
+ if (me->button() == LeftButton && leftMouseDown ) { //left click
endSelectAction( true ); // emit new event signal
}
@@ -511,10 +500,9 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
if (me->button() == LeftButton)
leftMouseDown = false;
- else if (me->button() == RightButton)
- rightMouseDown = false;
+
break;
case QEvent::MouseMove:
- if ( !rightMouseDown && !leftMouseDown )
+ if ( !leftMouseDown )
return true;
if ( blockMoving ) {
@@ -551,5 +539,4 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
blockMoving = false;
leftMouseDown = false;
- rightMouseDown = false;
if (object == viewport()) {
selectItem(0);
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index b30ad75..905c1bf 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -76,5 +76,5 @@ KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool
{
#ifndef DESKTOP_VERSION
- //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
+ QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
#endif
mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 3519985..6b63d7f 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -309,5 +309,5 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
this,SLOT(defaultItemAction(QListViewItem *)));
- QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *,
+ QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
const QPoint &, int )),
this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
@@ -1160,10 +1160,6 @@ KOListViewListView::KOListViewListView(KOListView * lv )
QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
#endif
- mYMousePos = -1000;
setSelectionMode( QListView::Multi );
setMultiSelection( true);
- mAllowPopupMenu = true;
- mMouseDown = false;
-
}
void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
@@ -1179,49 +1175,21 @@ void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
}
-
void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
{
//qDebug("contentsMousePressEvent++++ ");
- if (! mMouseDown ) {
- mAllowPopupMenu = true;
- mYMousePos = mapToGlobal( (e->pos())).y();
- }
- if ( e->button() == RightButton && mMouseDown )
- return;
- if ( e->button() == LeftButton )
- mMouseDown = true;
KListView::contentsMousePressEvent( e );
+ if ( e->button() == RightButton ) {
+ QListViewItem* ci = currentItem();
+ clearSelection () ;
+ if ( ci )
+ ci->setSelected( true );
+ }
}
void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
{
- //qDebug("contentsMouseReleaseEv---- ");
- if ( ! mMouseDown ) {
- if ( e->button() == RightButton && ! mAllowPopupMenu )
- return;
- QListViewItem* ci = currentItem();
- if ( ci )
- ci->setSelected( true );
- KListView::contentsMouseReleaseEvent(e);
- return;
- }
- if ( e->button() == LeftButton )
- mMouseDown = false;
- if ( e->button() == RightButton && ! mAllowPopupMenu )
- return;
- if ( e->button() == RightButton ) {
- QListViewItem* ci = currentItem();
- if ( ci )
- ci->setSelected( true );
- }
KListView::contentsMouseReleaseEvent(e);
}
void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
{
- // qDebug("contentsMouseMoveEv....... ");
- // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
- int diff = mYMousePos - mapToGlobal( (e->pos())).y();
- if ( diff < 0 ) diff = -diff;
- if ( diff > 20 )
- mAllowPopupMenu = false;
KListView::contentsMouseMoveEvent(e);
}
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index 0d9c525..eca71e2 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -224,7 +224,5 @@ class KOListViewListView : public KListView
void contentsMouseReleaseEvent(QMouseEvent *e);
void contentsMouseMoveEvent(QMouseEvent *e);
- bool mAllowPopupMenu;
bool mMouseDown;
- int mYMousePos;
};
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 12233ee..9085775 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -515,4 +515,9 @@ void MonthViewCell::startUpdateCell()
mitem = (MonthViewItem *)mitem->next();
}
+ if ( mAvailItemList.count() > 20 ) {
+ mAvailItemList.setAutoDelete( true );
+ mAvailItemList.clear();
+ mAvailItemList.setAutoDelete( false );
+ }
/*
if ( !isVisible() ){
@@ -818,12 +823,12 @@ void MonthViewCell::enableScrollBars( bool enabled )
{
if ( enabled ) {
-
QListBoxItem *fi = firstItem ();
if (fi ) {
int ihei = fi->height( this );
int hei = numRows () * ihei;
- if ( hei < height() - horizontalScrollBar()->height () )
+ if ( hei < height() - horizontalScrollBar()->height () ) {
setVScrollBarMode(QScrollView::AlwaysOff);
- else
+ }
+ else
setVScrollBarMode(QScrollView::Auto);
if ( ihei *3 > height() )