author | zautrix <zautrix> | 2005-04-02 12:16:34 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-02 12:16:34 (UTC) |
commit | 997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe (patch) (unidiff) | |
tree | f788b37459574b5cea0d2ab874882c6a396c240d /korganizer | |
parent | e0d51120d2f0c178115746e0c1357af40f95bc77 (diff) | |
download | kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.zip kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.gz kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.bz2 |
more fixes
-rw-r--r-- | korganizer/koagenda.cpp | 57 | ||||
-rw-r--r-- | korganizer/koagenda.h | 4 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 18 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 4 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 49 |
5 files changed, 97 insertions, 35 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, | |||
170 | 170 | ||
171 | 171 | mAllAgendaPopup = 0; | |
172 | mColumns = columns; | 172 | mColumns = columns; |
@@ -189,2 +189,3 @@ KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | |||
189 | { | 189 | { |
190 | mAllAgendaPopup = 0; | ||
190 | blockResize = false; | 191 | blockResize = false; |
@@ -234,3 +235,3 @@ void KOAgenda::init() | |||
234 | pathString += "iconsmini/"; | 235 | pathString += "iconsmini/"; |
235 | 236 | ||
236 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); | 237 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); |
@@ -389,2 +390,4 @@ void KOAgenda::popupMenu() | |||
389 | selectItem(mPopupItem); | 390 | selectItem(mPopupItem); |
391 | if ( mAllAgendaPopup ) | ||
392 | mAllAgendaPopup->installEventFilter( this ); | ||
390 | emit showIncidencePopupSignal(mPopupItem->incidence()); | 393 | emit showIncidencePopupSignal(mPopupItem->incidence()); |
@@ -397,3 +400,5 @@ void KOAgenda::popupMenu() | |||
397 | } | 400 | } |
401 | mNewItemPopup->installEventFilter( this ); | ||
398 | mNewItemPopup->popup( mPopupPos); | 402 | mNewItemPopup->popup( mPopupPos); |
403 | |||
399 | } | 404 | } |
@@ -406,3 +411,40 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
406 | { | 411 | { |
407 | //qDebug("KOAgenda::eventFilter_mous "); | 412 | static int startX = 0; |
413 | static int startY = 0; | ||
414 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | ||
415 | static bool blockMoving = true; | ||
416 | |||
417 | //qDebug("KOAgenda::eventFilter_mous "); | ||
418 | if ( object == mNewItemPopup ) { | ||
419 | //qDebug("mNewItemPopup "); | ||
420 | if ( me->type() == QEvent::MouseButtonRelease ) { | ||
421 | mNewItemPopup->removeEventFilter( this ); | ||
422 | int dX = me->globalPos().x() - mPopupPos.x();; | ||
423 | if ( dX < 0 ) | ||
424 | dX = -dX; | ||
425 | int dY = me->globalPos().y() - mPopupPos.y(); | ||
426 | if ( dY < 0 ) | ||
427 | dY = -dY; | ||
428 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | ||
429 | mNewItemPopup->hide(); | ||
430 | } | ||
431 | } | ||
432 | return true; | ||
433 | } | ||
434 | if ( object == mAllAgendaPopup ) { | ||
435 | //qDebug(" mAllAgendaPopup "); | ||
436 | if ( me->type() == QEvent::MouseButtonRelease ) { | ||
437 | mAllAgendaPopup->removeEventFilter( this ); | ||
438 | int dX = me->globalPos().x() - mPopupPos.x();; | ||
439 | if ( dX < 0 ) | ||
440 | dX = -dX; | ||
441 | int dY = me->globalPos().y() - mPopupPos.y(); | ||
442 | if ( dY < 0 ) | ||
443 | dY = -dY; | ||
444 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | ||
445 | mAllAgendaPopup->hide(); | ||
446 | } | ||
447 | } | ||
448 | return true; | ||
449 | } | ||
408 | QPoint viewportPos; | 450 | QPoint viewportPos; |
@@ -413,6 +455,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
413 | } | 455 | } |
414 | static int startX = 0; | 456 | |
415 | static int startY = 0; | ||
416 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | ||
417 | static bool blockMoving = true; | ||
418 | switch (me->type()) { | 457 | switch (me->type()) { |
@@ -425,3 +464,4 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
425 | startX = viewportPos.x(); | 464 | startX = viewportPos.x(); |
426 | startY = viewportPos.y(); | 465 | startY = viewportPos.y(); |
466 | mPopupPos = me->globalPos(); | ||
427 | if (object != viewport()) { | 467 | if (object != viewport()) { |
@@ -457,3 +497,2 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
457 | mActionItem = 0; | 497 | mActionItem = 0; |
458 | mPopupPos = viewport()->mapToGlobal( me->pos() ); | ||
459 | if (me->button() == RightButton) { | 498 | if (me->button() == RightButton) { |
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index 35c08b6..4f1fdb9 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h | |||
@@ -33,2 +33,3 @@ | |||
33 | #include "koagendaitem.h" | 33 | #include "koagendaitem.h" |
34 | #include "koeventview.h" | ||
34 | 35 | ||
@@ -125,3 +126,3 @@ class KOAgenda : public QScrollView | |||
125 | void restorePosition(); | 126 | void restorePosition(); |
126 | 127 | void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; } | |
127 | 128 | ||
@@ -170,2 +171,3 @@ class KOAgenda : public QScrollView | |||
170 | protected: | 171 | protected: |
172 | KOEventPopupMenu * mAllAgendaPopup; | ||
171 | QPainter mPixPainter; | 173 | QPainter mPixPainter; |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 8d32152..95388ef 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -507,5 +507,3 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
507 | // Create event context menu for all day agenda | 507 | // Create event context menu for all day agenda |
508 | mAllDayAgendaPopup = eventPopup(); | 508 | //mAllDayAgendaPopup = eventPopup(); |
509 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | ||
510 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | ||
511 | 509 | ||
@@ -546,5 +544,5 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
546 | // Create event context menu for agenda | 544 | // Create event context menu for agenda |
547 | mAgendaPopup = eventPopup(); | 545 | mAllAgendaPopup = eventPopup(); |
548 | 546 | ||
549 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 547 | mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
550 | i18n("Toggle Alarm"),mAgenda, | 548 | i18n("Toggle Alarm"),mAgenda, |
@@ -554,4 +552,8 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
554 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 552 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
555 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 553 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
556 | 554 | ||
555 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | ||
556 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | ||
557 | mAgenda->setPopup( mAllAgendaPopup ); | ||
558 | mAllDayAgenda->setPopup( mAllAgendaPopup ); | ||
557 | // make connections between dependent widgets | 559 | // make connections between dependent widgets |
@@ -669,4 +671,4 @@ KOAgendaView::~KOAgendaView() | |||
669 | { | 671 | { |
670 | delete mAgendaPopup; | 672 | delete mAllAgendaPopup; |
671 | delete mAllDayAgendaPopup; | 673 | //delete mAllDayAgendaPopup; |
672 | delete KOAgendaItem::paintPix(); | 674 | delete KOAgendaItem::paintPix(); |
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 30c9b05..c6e6602 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -273,4 +273,4 @@ class KOAgendaView : public KOEventView { | |||
273 | 273 | ||
274 | KOEventPopupMenu *mAgendaPopup; | 274 | KOEventPopupMenu *mAllAgendaPopup; |
275 | KOEventPopupMenu *mAllDayAgendaPopup; | 275 | //KOEventPopupMenu *mAllDayAgendaPopup; |
276 | 276 | ||
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index ccc4b01..0a315cb 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -209,21 +209,32 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | |||
209 | { | 209 | { |
210 | |||
211 | QPoint p(contentsToViewport(e->pos())); | ||
212 | QListViewItem *i = itemAt(p); | ||
213 | bool rootClicked = true; | ||
214 | if (i) { | ||
215 | // if the user clicked into the root decoration of the item, don't | ||
216 | // try to start a drag! | ||
217 | int X = p.x(); | ||
218 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); | ||
219 | if (X > header()->sectionPos(0) + | ||
220 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | ||
221 | itemMargin() || | ||
222 | X < header()->sectionPos(0)) { | ||
223 | rootClicked = false; | ||
224 | } | ||
225 | } | ||
210 | #ifndef KORG_NODND | 226 | #ifndef KORG_NODND |
211 | QPoint p(contentsToViewport(e->pos())); | 227 | mMousePressed = false; |
212 | QListViewItem *i = itemAt(p); | 228 | if (! rootClicked ) { |
213 | mMousePressed = false; | ||
214 | if (i) { | ||
215 | // if the user clicked into the root decoration of the item, don't | ||
216 | // try to start a drag! | ||
217 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + | ||
218 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | ||
219 | itemMargin() || | ||
220 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { | ||
221 | if (e->button()==Qt::LeftButton) { | ||
222 | mPressPos = e->pos(); | 229 | mPressPos = e->pos(); |
223 | mMousePressed = true; | 230 | mMousePressed = true; |
224 | } | ||
225 | } | 231 | } |
226 | } | ||
227 | #endif | 232 | #endif |
228 | QListView::contentsMousePressEvent(e); | 233 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); |
234 | #ifndef DESKTOP_VERSION | ||
235 | if (!( e->button() == RightButton && rootClicked) ) | ||
236 | QListView::contentsMousePressEvent(e); | ||
237 | #else | ||
238 | QListView::contentsMousePressEvent(e); | ||
239 | #endif | ||
229 | } | 240 | } |
@@ -1065,2 +1076,4 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) | |||
1065 | pendingSubtodo = 0; | 1076 | pendingSubtodo = 0; |
1077 | int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | ||
1078 | //qDebug("ROW %d ", row); | ||
1066 | if (!item) { | 1079 | if (!item) { |
@@ -1068,2 +1081,8 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) | |||
1068 | return; | 1081 | return; |
1082 | } else { | ||
1083 | if ( row == 1 ) { | ||
1084 | mActiveItem = (KOTodoViewItem *) item; | ||
1085 | newSubTodo(); | ||
1086 | return; | ||
1087 | } | ||
1069 | } | 1088 | } |
@@ -1076,3 +1095,3 @@ void KOTodoView::itemClicked(QListViewItem *item) | |||
1076 | { | 1095 | { |
1077 | 1096 | //qDebug("KOTodoView::itemClicked %d", item); | |
1078 | if (!item) { | 1097 | if (!item) { |