summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp57
1 files changed, 48 insertions, 9 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index deadfc9..de964da 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -170,3 +170,3 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
-
+ mAllAgendaPopup = 0;
mColumns = columns;
@@ -189,2 +189,3 @@ KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
{
+ mAllAgendaPopup = 0;
blockResize = false;
@@ -234,3 +235,3 @@ void KOAgenda::init()
pathString += "iconsmini/";
-
+
mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
@@ -389,2 +390,4 @@ void KOAgenda::popupMenu()
selectItem(mPopupItem);
+ if ( mAllAgendaPopup )
+ mAllAgendaPopup->installEventFilter( this );
emit showIncidencePopupSignal(mPopupItem->incidence());
@@ -397,3 +400,5 @@ void KOAgenda::popupMenu()
}
+ mNewItemPopup->installEventFilter( this );
mNewItemPopup->popup( mPopupPos);
+
}
@@ -406,3 +411,40 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
{
- //qDebug("KOAgenda::eventFilter_mous ");
+ static int startX = 0;
+ static int startY = 0;
+ static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 );
+ static bool blockMoving = true;
+
+ //qDebug("KOAgenda::eventFilter_mous ");
+ if ( object == mNewItemPopup ) {
+ //qDebug("mNewItemPopup ");
+ if ( me->type() == QEvent::MouseButtonRelease ) {
+ mNewItemPopup->removeEventFilter( this );
+ int dX = me->globalPos().x() - mPopupPos.x();;
+ if ( dX < 0 )
+ dX = -dX;
+ int dY = me->globalPos().y() - mPopupPos.y();
+ if ( dY < 0 )
+ dY = -dY;
+ if ( dX > blockmoveDist || dY > blockmoveDist ) {
+ mNewItemPopup->hide();
+ }
+ }
+ return true;
+ }
+ if ( object == mAllAgendaPopup ) {
+ //qDebug(" mAllAgendaPopup ");
+ if ( me->type() == QEvent::MouseButtonRelease ) {
+ mAllAgendaPopup->removeEventFilter( this );
+ int dX = me->globalPos().x() - mPopupPos.x();;
+ if ( dX < 0 )
+ dX = -dX;
+ int dY = me->globalPos().y() - mPopupPos.y();
+ if ( dY < 0 )
+ dY = -dY;
+ if ( dX > blockmoveDist || dY > blockmoveDist ) {
+ mAllAgendaPopup->hide();
+ }
+ }
+ return true;
+ }
QPoint viewportPos;
@@ -413,6 +455,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
}
- static int startX = 0;
- static int startY = 0;
- static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 );
- static bool blockMoving = true;
+
switch (me->type()) {
@@ -425,3 +464,4 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
startX = viewportPos.x();
- startY = viewportPos.y();
+ startY = viewportPos.y();
+ mPopupPos = me->globalPos();
if (object != viewport()) {
@@ -457,3 +497,2 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
mActionItem = 0;
- mPopupPos = viewport()->mapToGlobal( me->pos() );
if (me->button() == RightButton) {