author | zautrix <zautrix> | 2005-03-26 11:03:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-26 11:03:22 (UTC) |
commit | ef825f1805452ba2cfb30cd7a41c392d3961f01e (patch) (unidiff) | |
tree | 60e896e2867bf3d90f0719f72c50add28bcf1d04 | |
parent | 6427570041c902840fe0f557415a07bb7aa8c031 (diff) | |
download | kdepimpi-ef825f1805452ba2cfb30cd7a41c392d3961f01e.zip kdepimpi-ef825f1805452ba2cfb30cd7a41c392d3961f01e.tar.gz kdepimpi-ef825f1805452ba2cfb30cd7a41c392d3961f01e.tar.bz2 |
next rry
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 191 | ||||
-rw-r--r-- | korganizer/koagenda.h | 6 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 2 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 14 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 53 | ||||
-rw-r--r-- | korganizer/kolistview.h | 7 | ||||
-rw-r--r-- | microkde/kdeui/klistview.cpp | 3 | ||||
-rw-r--r-- | microkde/kdeui/klistview.h | 2 |
10 files changed, 261 insertions, 20 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 6f8b041..d5d1f76 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -6,16 +6,18 @@ Fixed another SMTP problem in OM/Pi. | |||
6 | Some small changed in the new datenavigator in KO/Pi. | 6 | Some small changed in the new datenavigator in KO/Pi. |
7 | Changed default setting for new filter in KA/Pi to "exclude categories". | 7 | Changed default setting for new filter in KA/Pi to "exclude categories". |
8 | Changed the default font size for 640x480 display . | 8 | Changed the default font size for 640x480 display . |
9 | Changed popup menu behaviour in agenda and list view. | 9 | Changed popup menu behaviour in agenda and list view. |
10 | Fixed some layout problems of the date label size in the month view. | 10 | Fixed some layout problems of the date label size in the month view. |
11 | Made month view update faster. | 11 | Made month view update faster. |
12 | Made first datenavigator repainting faster. | 12 | Made first datenavigator repainting faster. |
13 | Changed the title of the event/todo edit dialogs. | 13 | Changed the title of the event/todo edit dialogs. |
14 | Timelabels in agenga changed from 22:00 to 22 oo. ( the oo higher, of course). | ||
15 | Please report, if there are layout problems with the new timelabels. | ||
14 | 16 | ||
15 | 17 | ||
16 | ********** VERSION 2.0.20 ************ | 18 | ********** VERSION 2.0.20 ************ |
17 | 19 | ||
18 | Two small fixes in OM/Pi. | 20 | Two small fixes in OM/Pi. |
19 | 21 | ||
20 | Better resizing of the new datenavigator in KO/Pi. | 22 | Better resizing of the new datenavigator in KO/Pi. |
21 | 23 | ||
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 66ad4ec..14f52b8 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -65,17 +65,16 @@ MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) | |||
65 | : QFrame(_agenda->viewport(),name), agenda(_agenda) | 65 | : QFrame(_agenda->viewport(),name), agenda(_agenda) |
66 | { | 66 | { |
67 | setLineWidth(0); | 67 | setLineWidth(0); |
68 | setMargin(0); | 68 | setMargin(0); |
69 | setBackgroundColor(Qt::red); | 69 | setBackgroundColor(Qt::red); |
70 | minutes = new QTimer(this); | 70 | minutes = new QTimer(this); |
71 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); | 71 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); |
72 | minutes->start(0, true); | 72 | minutes->start(0, true); |
73 | |||
74 | mTimeBox = new QLabel(this); | 73 | mTimeBox = new QLabel(this); |
75 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); | 74 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); |
76 | QPalette pal = mTimeBox->palette(); | 75 | QPalette pal = mTimeBox->palette(); |
77 | pal.setColor(QColorGroup::Foreground, Qt::red); | 76 | pal.setColor(QColorGroup::Foreground, Qt::red); |
78 | mTimeBox->setPalette(pal); | 77 | mTimeBox->setPalette(pal); |
79 | //mTimeBox->setAutoMask(true); | 78 | //mTimeBox->setAutoMask(true); |
80 | 79 | ||
81 | agenda->addChild(mTimeBox); | 80 | agenda->addChild(mTimeBox); |
@@ -170,17 +169,17 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | |||
170 | { | 169 | { |
171 | 170 | ||
172 | 171 | ||
173 | mColumns = columns; | 172 | mColumns = columns; |
174 | mRows = rows; | 173 | mRows = rows; |
175 | mGridSpacingY = rowSize; | 174 | mGridSpacingY = rowSize; |
176 | mAllDayMode = false; | 175 | mAllDayMode = false; |
177 | #ifndef DESKTOP_VERSION | 176 | #ifndef DESKTOP_VERSION |
178 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 177 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
179 | #endif | 178 | #endif |
180 | mHolidayMask = 0; | 179 | mHolidayMask = 0; |
181 | init(); | 180 | init(); |
182 | } | 181 | } |
183 | 182 | ||
184 | /* | 183 | /* |
185 | Create an agenda widget with columns columns and one row. This is used for | 184 | Create an agenda widget with columns columns and one row. This is used for |
186 | all-day events. | 185 | all-day events. |
@@ -190,17 +189,17 @@ KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | |||
190 | { | 189 | { |
191 | blockResize = false; | 190 | blockResize = false; |
192 | mColumns = columns; | 191 | mColumns = columns; |
193 | mRows = 1; | 192 | mRows = 1; |
194 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); | 193 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); |
195 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 194 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
196 | mAllDayMode = true; | 195 | mAllDayMode = true; |
197 | #ifndef DESKTOP_VERSION | 196 | #ifndef DESKTOP_VERSION |
198 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 197 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
199 | #endif | 198 | #endif |
200 | mHolidayMask = 0; | 199 | mHolidayMask = 0; |
201 | init(); | 200 | init(); |
202 | } | 201 | } |
203 | 202 | ||
204 | 203 | ||
205 | KOAgenda::~KOAgenda() | 204 | KOAgenda::~KOAgenda() |
206 | { | 205 | { |
@@ -217,16 +216,19 @@ Incidence *KOAgenda::selectedIncidence() const | |||
217 | QDate KOAgenda::selectedIncidenceDate() const | 216 | QDate KOAgenda::selectedIncidenceDate() const |
218 | { | 217 | { |
219 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); | 218 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); |
220 | } | 219 | } |
221 | 220 | ||
222 | 221 | ||
223 | void KOAgenda::init() | 222 | void KOAgenda::init() |
224 | { | 223 | { |
224 | mPopupTimer = new QTimer(this); | ||
225 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | ||
226 | |||
225 | mNewItemPopup = new QPopupMenu( this ); | 227 | mNewItemPopup = new QPopupMenu( this ); |
226 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); | 228 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); |
227 | QString pathString = ""; | 229 | QString pathString = ""; |
228 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 230 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
229 | if ( QApplication::desktop()->width() < 480 ) | 231 | if ( QApplication::desktop()->width() < 480 ) |
230 | pathString += "icons16/"; | 232 | pathString += "icons16/"; |
231 | } else | 233 | } else |
232 | pathString += "iconsmini/"; | 234 | pathString += "iconsmini/"; |
@@ -307,16 +309,18 @@ void KOAgenda::init() | |||
307 | 309 | ||
308 | // Create the Marcus Bains line. | 310 | // Create the Marcus Bains line. |
309 | if(mAllDayMode) | 311 | if(mAllDayMode) |
310 | mMarcusBains = 0; | 312 | mMarcusBains = 0; |
311 | else { | 313 | else { |
312 | mMarcusBains = new MarcusBains(this); | 314 | mMarcusBains = new MarcusBains(this); |
313 | addChild(mMarcusBains); | 315 | addChild(mMarcusBains); |
314 | } | 316 | } |
317 | mPopupKind = 0; | ||
318 | mPopupItem = 0; | ||
315 | } | 319 | } |
316 | 320 | ||
317 | void KOAgenda::clear() | 321 | void KOAgenda::clear() |
318 | { | 322 | { |
319 | KOAgendaItem *item; | 323 | KOAgendaItem *item; |
320 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 324 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
321 | mUnusedItems.append( item ); | 325 | mUnusedItems.append( item ); |
322 | //item->hide(); | 326 | //item->hide(); |
@@ -377,31 +381,211 @@ bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | |||
377 | if (!mActionItem) | 381 | if (!mActionItem) |
378 | setCursor(arrowCursor); | 382 | setCursor(arrowCursor); |
379 | return true; | 383 | return true; |
380 | 384 | ||
381 | default: | 385 | default: |
382 | return QScrollView::eventFilter(object,event); | 386 | return QScrollView::eventFilter(object,event); |
383 | } | 387 | } |
384 | } | 388 | } |
389 | void KOAgenda::popupMenu() | ||
390 | { | ||
391 | mPopupTimer->stop(); | ||
392 | if ( mPopupKind == 1 ) { | ||
393 | if (mActionItem ) { | ||
394 | endItemAction(); | ||
395 | } | ||
396 | mLeftMouseDown = false; // no more leftMouse computation | ||
397 | if (mPopupItem) { | ||
398 | selectItem(mPopupItem); | ||
399 | emit showIncidencePopupSignal(mPopupItem->incidence()); | ||
385 | 400 | ||
401 | } | ||
402 | } else if ( mPopupKind == 2 ) { | ||
403 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action | ||
404 | endSelectAction( false ); // do not emit new event signal | ||
405 | mLeftMouseDown = false; // no more leftMouse computation | ||
406 | } | ||
407 | mNewItemPopup->popup( mPopupPos); | ||
408 | } | ||
409 | mLeftMouseDown = false; | ||
410 | mPopupItem = 0; | ||
411 | mPopupKind = 0; | ||
412 | } | ||
386 | 413 | ||
387 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 414 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
388 | { | 415 | { |
389 | //qDebug("KOAgenda::eventFilter_mous "); | 416 | //qDebug("KOAgenda::eventFilter_mous "); |
390 | QPoint viewportPos; | 417 | QPoint viewportPos; |
391 | if (object != viewport()) { | 418 | if (object != viewport()) { |
392 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 419 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
393 | } else { | 420 | } else { |
394 | viewportPos = me->pos(); | 421 | viewportPos = me->pos(); |
395 | } | 422 | } |
396 | static int startX = 0; | 423 | static int startX = 0; |
397 | static int startY = 0; | 424 | static int startY = 0; |
398 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | 425 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); |
399 | static bool blockMoving = true; | 426 | static bool blockMoving = true; |
427 | switch (me->type()) { | ||
428 | case QEvent::MouseButtonPress: | ||
429 | if (me->button() == LeftButton) { | ||
430 | mPopupTimer->start( 600 ); | ||
431 | mLeftMouseDown = true; | ||
432 | } | ||
433 | blockMoving = true; | ||
434 | startX = viewportPos.x(); | ||
435 | startY = viewportPos.y(); | ||
436 | if (object != viewport()) { | ||
437 | mPopupItem = (KOAgendaItem *)object; | ||
438 | mPopupKind = 1; | ||
439 | if (me->button() == RightButton) { | ||
440 | popupMenu(); | ||
441 | } else if (me->button() == LeftButton) { | ||
442 | mActionItem = (KOAgendaItem *)object; | ||
443 | if (mActionItem) { | ||
444 | if ( mSelectionHeight > 0 ) { | ||
445 | int selectionCellX = mSelectionCellX * mGridSpacingX; | ||
446 | int selectionYTop = mSelectionYTop; | ||
447 | int gridSpacingX = mGridSpacingX; | ||
448 | int selectionHeight = mSelectionHeight; | ||
449 | clearSelection(); | ||
450 | repaintContents( selectionCellX, selectionYTop, | ||
451 | gridSpacingX, selectionHeight,false ); | ||
452 | } | ||
453 | selectItem(mActionItem); | ||
454 | Incidence *incidence = mActionItem->incidence(); | ||
455 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | ||
456 | mActionItem = 0; | ||
457 | } else { | ||
458 | startItemAction(viewportPos); | ||
459 | } | ||
460 | } | ||
461 | } | ||
462 | } else { // ---------- viewport() | ||
463 | mPopupItem = 0; | ||
464 | mPopupKind = 2; | ||
465 | selectItem(0); | ||
466 | mActionItem = 0; | ||
467 | mPopupPos = viewport()->mapToGlobal( me->pos() ); | ||
468 | if (me->button() == RightButton) { | ||
469 | popupMenu(); | ||
470 | } else if (me->button() == LeftButton) { | ||
471 | setCursor(arrowCursor); | ||
472 | startSelectAction(viewportPos); | ||
473 | } | ||
474 | } | ||
475 | break; | ||
476 | |||
477 | case QEvent::MouseButtonRelease: | ||
478 | if (me->button() == LeftButton ) { | ||
479 | mPopupTimer->stop(); | ||
480 | } | ||
481 | if (object != viewport()) { | ||
482 | if (me->button() == LeftButton && mLeftMouseDown) { | ||
483 | if (mActionItem) { | ||
484 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | ||
485 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | ||
486 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | ||
487 | mScrollUpTimer.stop(); | ||
488 | mScrollDownTimer.stop(); | ||
489 | mActionItem->resetMove(); | ||
490 | placeSubCells( mActionItem ); | ||
491 | // emit startDragSignal( mActionItem->incidence() ); | ||
492 | setCursor( arrowCursor ); | ||
493 | mActionItem = 0; | ||
494 | mActionType = NOP; | ||
495 | mItemMoved = 0; | ||
496 | mLeftMouseDown = false; | ||
497 | return true; | ||
498 | } | ||
499 | endItemAction(); | ||
500 | } | ||
501 | } | ||
502 | |||
503 | } else { // ---------- viewport() | ||
504 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click | ||
505 | endSelectAction( true ); // emit new event signal | ||
506 | } | ||
507 | } | ||
508 | if (me->button() == LeftButton) | ||
509 | mLeftMouseDown = false; | ||
510 | |||
511 | break; | ||
512 | |||
513 | case QEvent::MouseMove: | ||
514 | if ( !mLeftMouseDown ) | ||
515 | return true; | ||
516 | if ( blockMoving ) { | ||
517 | int dX, dY; | ||
518 | dX = startX - viewportPos.x(); | ||
519 | if ( dX < 0 ) | ||
520 | dX = -dX; | ||
521 | dY = viewportPos.y() - startY; | ||
522 | if ( dY < 0 ) | ||
523 | dY = -dY; | ||
524 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); | ||
525 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | ||
526 | blockMoving = false; | ||
527 | } | ||
528 | } | ||
529 | if ( ! blockMoving ) | ||
530 | mPopupTimer->stop(); | ||
531 | if (object != viewport()) { | ||
532 | KOAgendaItem *moveItem = (KOAgendaItem *)object; | ||
533 | if (!moveItem->incidence()->isReadOnly() ) { | ||
534 | if (!mActionItem) | ||
535 | setNoActionCursor(moveItem,viewportPos); | ||
536 | else { | ||
537 | if ( !blockMoving ) | ||
538 | performItemAction(viewportPos); | ||
539 | } | ||
540 | } | ||
541 | } else { // ---------- viewport() | ||
542 | mPopupPos = viewport()->mapToGlobal( me->pos() ); | ||
543 | if ( mActionType == SELECT ) { | ||
544 | performSelectAction( viewportPos ); | ||
545 | } | ||
546 | } | ||
547 | break; | ||
548 | |||
549 | case QEvent::MouseButtonDblClick: | ||
550 | mPopupTimer->stop(); | ||
551 | if (object == viewport()) { | ||
552 | selectItem(0); | ||
553 | int x,y; | ||
554 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | ||
555 | int gx,gy; | ||
556 | contentsToGrid(x,y,gx,gy); | ||
557 | emit newEventSignal(gx,gy); | ||
558 | } else { | ||
559 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | ||
560 | selectItem(doubleClickedItem); | ||
561 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | ||
562 | emit editIncidenceSignal(doubleClickedItem->incidence()); | ||
563 | else | ||
564 | emit showIncidenceSignal(doubleClickedItem->incidence()); | ||
565 | } | ||
566 | break; | ||
567 | |||
568 | default: | ||
569 | break; | ||
570 | } | ||
571 | return true; | ||
572 | #if 0 | ||
573 | //qDebug("KOAgenda::eventFilter_mous "); | ||
574 | QPoint viewportPos; | ||
575 | if (object != viewport()) { | ||
576 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | ||
577 | } else { | ||
578 | viewportPos = me->pos(); | ||
579 | } | ||
580 | static int startX = 0; | ||
581 | static int startY = 0; | ||
582 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | ||
583 | static bool blockMoving = true; | ||
400 | static bool leftMouseDown = false; | 584 | static bool leftMouseDown = false; |
401 | bool rightButtonPressed = false; | 585 | bool rightButtonPressed = false; |
402 | switch (me->type()) { | 586 | switch (me->type()) { |
403 | case QEvent::MouseButtonPress: | 587 | case QEvent::MouseButtonPress: |
404 | if (me->button() == LeftButton) { | 588 | if (me->button() == LeftButton) { |
405 | leftMouseDown = true; | 589 | leftMouseDown = true; |
406 | } | 590 | } |
407 | else if (me->button() == RightButton) { | 591 | else if (me->button() == RightButton) { |
@@ -554,16 +738,17 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
554 | emit showIncidenceSignal(doubleClickedItem->incidence()); | 738 | emit showIncidenceSignal(doubleClickedItem->incidence()); |
555 | } | 739 | } |
556 | break; | 740 | break; |
557 | 741 | ||
558 | default: | 742 | default: |
559 | break; | 743 | break; |
560 | } | 744 | } |
561 | return true; | 745 | return true; |
746 | #endif | ||
562 | } | 747 | } |
563 | 748 | ||
564 | void KOAgenda::newItem( int item ) | 749 | void KOAgenda::newItem( int item ) |
565 | { | 750 | { |
566 | if ( item == 1 ) { //new event | 751 | if ( item == 1 ) { //new event |
567 | newEventSignal(mStartCellX ,mStartCellY ); | 752 | newEventSignal(mStartCellX ,mStartCellY ); |
568 | } else | 753 | } else |
569 | if ( item == 2 ) { //new event | 754 | if ( item == 2 ) { //new event |
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index f3f1772..3d33ae5 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h | |||
@@ -121,16 +121,17 @@ class KOAgenda : public QScrollView | |||
121 | void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); | 121 | void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); |
122 | void finishUpdate(); | 122 | void finishUpdate(); |
123 | void printSelection(); | 123 | void printSelection(); |
124 | void storePosition(); | 124 | void storePosition(); |
125 | void restorePosition(); | 125 | void restorePosition(); |
126 | 126 | ||
127 | 127 | ||
128 | public slots: | 128 | public slots: |
129 | void popupMenu(); | ||
129 | void newItem( int ); | 130 | void newItem( int ); |
130 | void moveChild( QWidget *, int, int ); | 131 | void moveChild( QWidget *, int, int ); |
131 | void scrollUp(); | 132 | void scrollUp(); |
132 | void scrollDown(); | 133 | void scrollDown(); |
133 | void updateTodo( Todo * t, int , bool ); | 134 | void updateTodo( Todo * t, int , bool ); |
134 | void popupAlarm(); | 135 | void popupAlarm(); |
135 | 136 | ||
136 | void checkScrollBoundaries(int); | 137 | void checkScrollBoundaries(int); |
@@ -209,16 +210,21 @@ class KOAgenda : public QScrollView | |||
209 | 210 | ||
210 | virtual void contentsMousePressEvent ( QMouseEvent * ); | 211 | virtual void contentsMousePressEvent ( QMouseEvent * ); |
211 | 212 | ||
212 | private: | 213 | private: |
213 | void init(); | 214 | void init(); |
214 | void marcus_bains(); | 215 | void marcus_bains(); |
215 | bool mAllDayMode; | 216 | bool mAllDayMode; |
216 | bool blockResize; | 217 | bool blockResize; |
218 | bool mLeftMouseDown; | ||
219 | KOAgendaItem *mPopupItem; | ||
220 | QTimer* mPopupTimer; | ||
221 | int mPopupKind; | ||
222 | QPoint mPopupPos; | ||
217 | QTimer mResizeTimer; | 223 | QTimer mResizeTimer; |
218 | double mContentPosition; | 224 | double mContentPosition; |
219 | 225 | ||
220 | // Width and height of agenda cells | 226 | // Width and height of agenda cells |
221 | int mGridSpacingX; | 227 | int mGridSpacingX; |
222 | int mGridSpacingY; | 228 | int mGridSpacingY; |
223 | 229 | ||
224 | // size of border, where mouse action will resize the KOAgendaItem | 230 | // size of border, where mouse action will resize the KOAgendaItem |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 905c1bf..b30ad75 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -70,17 +70,17 @@ private: | |||
70 | KOAgendaItem * _view; | 70 | KOAgendaItem * _view; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
74 | const char *name,WFlags) : | 74 | const char *name,WFlags) : |
75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
76 | { | 76 | { |
77 | #ifndef DESKTOP_VERSION | 77 | #ifndef DESKTOP_VERSION |
78 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 78 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
79 | #endif | 79 | #endif |
80 | mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); | 80 | mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); |
81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
82 | setWFlags ( wflags); | 82 | setWFlags ( wflags); |
83 | mAllDay = allday; | 83 | mAllDay = allday; |
84 | init ( incidence, qd ); | 84 | init ( incidence, qd ); |
85 | //setMouseTracking(true); | 85 | //setMouseTracking(true); |
86 | //setAcceptDrops(true); | 86 | //setAcceptDrops(true); |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 957ac52..b9c7dec 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -124,17 +124,17 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | |||
124 | int y = cell * mCellHeight; | 124 | int y = cell * mCellHeight; |
125 | QFontMetrics fm = fontMetrics(); | 125 | QFontMetrics fm = fontMetrics(); |
126 | QString hour; | 126 | QString hour; |
127 | QString suffix; | 127 | QString suffix; |
128 | QString fullTime; | 128 | QString fullTime; |
129 | int tW = fm.width("24:00i"); | 129 | int tW = fm.width("24:00i"); |
130 | int timeHeight = fm.height(); | 130 | int timeHeight = fm.height(); |
131 | timeHeight -= (timeHeight/4-2); | 131 | timeHeight -= (timeHeight/4-2); |
132 | int borderWidth = 5; | 132 | int borderWidth = 2; |
133 | QFont nFont = p->font(); | 133 | QFont nFont = p->font(); |
134 | QFont sFont = nFont; | 134 | QFont sFont = nFont; |
135 | sFont.setPointSize( sFont.pointSize()/2+2 ); | 135 | sFont.setPointSize( sFont.pointSize()/2+2 ); |
136 | if (!KGlobal::locale()->use12Clock()) | 136 | if (!KGlobal::locale()->use12Clock()) |
137 | suffix = "00"; | 137 | suffix = "00"; |
138 | QFontMetrics fmS( sFont ); | 138 | QFontMetrics fmS( sFont ); |
139 | int sHei = fmS.height(); | 139 | int sHei = fmS.height(); |
140 | if ( timeHeight > mCellHeight ) { | 140 | if ( timeHeight > mCellHeight ) { |
@@ -174,35 +174,27 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | |||
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | /** | 177 | /** |
178 | Calculates the minimum width. | 178 | Calculates the minimum width. |
179 | */ | 179 | */ |
180 | int TimeLabels::minimumWidth() const | 180 | int TimeLabels::minimumWidth() const |
181 | { | 181 | { |
182 | QFontMetrics fm = fontMetrics(); | 182 | return mMiniWidth; |
183 | |||
184 | //TODO: calculate this value | ||
185 | int borderWidth = 4; | ||
186 | |||
187 | // the maximum width possible | ||
188 | int width = fm.width("88:88x") + borderWidth; | ||
189 | |||
190 | return width; | ||
191 | } | 183 | } |
192 | 184 | ||
193 | /** updates widget's internal state */ | 185 | /** updates widget's internal state */ |
194 | void TimeLabels::updateConfig() | 186 | void TimeLabels::updateConfig() |
195 | { | 187 | { |
196 | // set the font | 188 | // set the font |
197 | // config->setGroup("Fonts"); | 189 | // config->setGroup("Fonts"); |
198 | // QFont font = config->readFontEntry("TimeBar Font"); | 190 | // QFont font = config->readFontEntry("TimeBar Font"); |
199 | setFont(KOPrefs::instance()->mTimeBarFont); | 191 | setFont(KOPrefs::instance()->mTimeBarFont); |
200 | 192 | mMiniWidth = fontMetrics().width("88:88") + 2 ; | |
201 | // update geometry restrictions based on new settings | 193 | // update geometry restrictions based on new settings |
202 | setFixedWidth(minimumWidth()); | 194 | setFixedWidth(minimumWidth()); |
203 | 195 | ||
204 | // update HourSize | 196 | // update HourSize |
205 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 197 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
206 | resizeContents(50,mRows * mCellHeight); | 198 | resizeContents(50,mRows * mCellHeight); |
207 | } | 199 | } |
208 | 200 | ||
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 8b8bac0..0cb9310 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -96,16 +96,17 @@ class TimeLabels : public QScrollView { | |||
96 | /** update time label positions */ | 96 | /** update time label positions */ |
97 | void positionChanged(); | 97 | void positionChanged(); |
98 | signals: | 98 | signals: |
99 | void scaleChanged(); | 99 | void scaleChanged(); |
100 | protected: | 100 | protected: |
101 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); | 101 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); |
102 | 102 | ||
103 | private: | 103 | private: |
104 | int mMiniWidth; | ||
104 | int mMouseDownY; | 105 | int mMouseDownY; |
105 | QString mOrgCap; | 106 | QString mOrgCap; |
106 | int mRows; | 107 | int mRows; |
107 | int mCellHeight; | 108 | int mCellHeight; |
108 | 109 | ||
109 | /** */ | 110 | /** */ |
110 | KOAgenda* mAgenda; | 111 | KOAgenda* mAgenda; |
111 | }; | 112 | }; |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 6b63d7f..09d70f1 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1149,47 +1149,94 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) | |||
1149 | e->accept(); | 1149 | e->accept(); |
1150 | } | 1150 | } |
1151 | break; | 1151 | break; |
1152 | default: | 1152 | default: |
1153 | e->ignore(); | 1153 | e->ignore(); |
1154 | } | 1154 | } |
1155 | } | 1155 | } |
1156 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1156 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1157 | : KListView( lv ) | 1157 | : KListView( lv, "kolistlistview", false ) |
1158 | { | 1158 | { |
1159 | mPopupTimer = new QTimer(this); | ||
1160 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | ||
1159 | #ifndef DESKTOP_VERSION | 1161 | #ifndef DESKTOP_VERSION |
1160 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1162 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1161 | #endif | 1163 | #endif |
1162 | setSelectionMode( QListView::Multi ); | 1164 | setSelectionMode( QListView::Multi ); |
1163 | setMultiSelection( true); | 1165 | setMultiSelection( true); |
1164 | } | 1166 | } |
1165 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1167 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1166 | { | 1168 | { |
1167 | if (!e) return; | 1169 | if (!e) return; |
1168 | QPoint vp = contentsToViewport(e->pos()); | 1170 | QPoint vp = contentsToViewport(e->pos()); |
1169 | QListViewItem *item = itemAt(vp); | 1171 | QListViewItem *item = itemAt(vp); |
1170 | if (!item) { | 1172 | if (!item) { |
1171 | emit newEvent(); | 1173 | emit newEvent(); |
1172 | return; | 1174 | return; |
1173 | } | 1175 | } |
1174 | KListView::contentsMouseDoubleClickEvent(e); | 1176 | KListView::contentsMouseDoubleClickEvent(e); |
1175 | } | 1177 | } |
1176 | 1178 | #if 0 | |
1179 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | ||
1180 | { | ||
1181 | //qDebug("contentsMousePressEvent++++ "); | ||
1182 | KListView::contentsMousePressEvent( e ); | ||
1183 | if ( e->button() == RightButton ) { | ||
1184 | QListViewItem* ci = currentItem(); | ||
1185 | clearSelection () ; | ||
1186 | if ( ci ) | ||
1187 | ci->setSelected( true ); | ||
1188 | } | ||
1189 | } | ||
1190 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | ||
1191 | { | ||
1192 | KListView::contentsMouseReleaseEvent(e); | ||
1193 | } | ||
1194 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | ||
1195 | { | ||
1196 | KListView::contentsMouseMoveEvent(e); | ||
1197 | } | ||
1198 | #endif | ||
1199 | void KOListViewListView::popupMenu() | ||
1200 | { | ||
1201 | mPopupTimer->stop(); | ||
1202 | //qDebug("HUUUUUUUUUUUUUUUUUUUU "); | ||
1203 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); | ||
1204 | QApplication::postEvent( this->viewport(), e ); | ||
1205 | } | ||
1177 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1206 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1178 | { | 1207 | { |
1179 | //qDebug("contentsMousePressEvent++++ "); | 1208 | //qDebug("contentsMousePressEvent++++ "); |
1209 | mYMousePos = mapToGlobal( (e->pos())).y(); | ||
1210 | if ( e->button() == LeftButton ) { | ||
1211 | mPopupTimer->start( 600 ); | ||
1212 | mEventPos = e->pos(); | ||
1213 | mEventGlobalPos = e->globalPos(); | ||
1214 | } | ||
1180 | KListView::contentsMousePressEvent( e ); | 1215 | KListView::contentsMousePressEvent( e ); |
1181 | if ( e->button() == RightButton ) { | 1216 | if ( e->button() == RightButton ) { |
1182 | QListViewItem* ci = currentItem(); | 1217 | QListViewItem* ci = currentItem(); |
1183 | clearSelection () ; | 1218 | clearSelection () ; |
1184 | if ( ci ) | 1219 | if ( ci ) |
1185 | ci->setSelected( true ); | 1220 | ci->setSelected( true ); |
1186 | } | 1221 | } |
1187 | } | 1222 | } |
1188 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1223 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1189 | { | 1224 | { |
1225 | mPopupTimer->stop(); | ||
1190 | KListView::contentsMouseReleaseEvent(e); | 1226 | KListView::contentsMouseReleaseEvent(e); |
1191 | } | 1227 | } |
1192 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1228 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1193 | { | 1229 | { |
1230 | // qDebug("contentsMouseMoveEv....... "); | ||
1231 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | ||
1232 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | ||
1233 | if ( diff < 0 ) diff = -diff; | ||
1234 | if ( diff > 15 ) | ||
1235 | mPopupTimer->stop(); | ||
1236 | else { | ||
1237 | mEventPos = e->pos(); | ||
1238 | mEventGlobalPos = e->globalPos(); | ||
1239 | } | ||
1194 | KListView::contentsMouseMoveEvent(e); | 1240 | KListView::contentsMouseMoveEvent(e); |
1195 | } | 1241 | } |
1242 | |||
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index eca71e2..bb0e23e 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h | |||
@@ -42,16 +42,17 @@ | |||
42 | 42 | ||
43 | using namespace KCal; | 43 | using namespace KCal; |
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | #include <qpushbutton.h> | 47 | #include <qpushbutton.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qdialog.h> | 49 | #include <qdialog.h> |
50 | #include <qtimer.h> | ||
50 | #include <qcombobox.h> | 51 | #include <qcombobox.h> |
51 | #include <qspinbox.h> | 52 | #include <qspinbox.h> |
52 | #include <qtooltip.h> | 53 | #include <qtooltip.h> |
53 | #include <qcheckbox.h> | 54 | #include <qcheckbox.h> |
54 | #include <qhbox.h> | 55 | #include <qhbox.h> |
55 | #include <qlabel.h> | 56 | #include <qlabel.h> |
56 | #include <kiconloader.h> | 57 | #include <kiconloader.h> |
57 | #include "kfiledialog.h" | 58 | #include "kfiledialog.h" |
@@ -212,17 +213,23 @@ class KOListView; | |||
212 | class KOListViewListView : public KListView | 213 | class KOListViewListView : public KListView |
213 | { | 214 | { |
214 | Q_OBJECT | 215 | Q_OBJECT |
215 | public: | 216 | public: |
216 | KOListViewListView(KOListView * lv ); | 217 | KOListViewListView(KOListView * lv ); |
217 | signals: | 218 | signals: |
218 | void newEvent(); | 219 | void newEvent(); |
219 | void showIncidence( Incidence* ); | 220 | void showIncidence( Incidence* ); |
221 | public slots: | ||
222 | void popupMenu(); | ||
220 | private: | 223 | private: |
224 | QPoint mEventPos; | ||
225 | QPoint mEventGlobalPos; | ||
226 | QTimer* mPopupTimer; | ||
227 | int mYMousePos; | ||
221 | void keyPressEvent ( QKeyEvent * ) ; | 228 | void keyPressEvent ( QKeyEvent * ) ; |
222 | void contentsMouseDoubleClickEvent(QMouseEvent *e); | 229 | void contentsMouseDoubleClickEvent(QMouseEvent *e); |
223 | void contentsMousePressEvent(QMouseEvent *e); | 230 | void contentsMousePressEvent(QMouseEvent *e); |
224 | void contentsMouseReleaseEvent(QMouseEvent *e); | 231 | void contentsMouseReleaseEvent(QMouseEvent *e); |
225 | void contentsMouseMoveEvent(QMouseEvent *e); | 232 | void contentsMouseMoveEvent(QMouseEvent *e); |
226 | bool mMouseDown; | 233 | bool mMouseDown; |
227 | }; | 234 | }; |
228 | 235 | ||
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 154cd02..31e2053 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -400,21 +400,22 @@ void KListViewLineEdit::paintEvent( QPaintEvent *e ) | |||
400 | void KListViewLineEdit::slotSelectionChanged() | 400 | void KListViewLineEdit::slotSelectionChanged() |
401 | { | 401 | { |
402 | item = 0; | 402 | item = 0; |
403 | col = 0; | 403 | col = 0; |
404 | hide(); | 404 | hide(); |
405 | } | 405 | } |
406 | */ | 406 | */ |
407 | 407 | ||
408 | KListView::KListView( QWidget *parent, const char *name ) | 408 | KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) |
409 | : QListView( parent, name ), | 409 | : QListView( parent, name ), |
410 | d (new KListViewPrivate (this)) | 410 | d (new KListViewPrivate (this)) |
411 | { | 411 | { |
412 | #ifndef DESKTOP_VERSION | 412 | #ifndef DESKTOP_VERSION |
413 | if ( emulateRightMouse ) | ||
413 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 414 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
414 | #endif | 415 | #endif |
415 | //US setDragAutoScroll(true); | 416 | //US setDragAutoScroll(true); |
416 | 417 | ||
417 | connect( this, SIGNAL( onViewport() ), | 418 | connect( this, SIGNAL( onViewport() ), |
418 | this, SLOT( slotOnViewport() ) ); | 419 | this, SLOT( slotOnViewport() ) ); |
419 | connect( this, SIGNAL( onItem( QListViewItem * ) ), | 420 | connect( this, SIGNAL( onItem( QListViewItem * ) ), |
420 | this, SLOT( slotOnItem( QListViewItem * ) ) ); | 421 | this, SLOT( slotOnItem( QListViewItem * ) ) ); |
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h index d559ce7..0058416 100644 --- a/microkde/kdeui/klistview.h +++ b/microkde/kdeui/klistview.h | |||
@@ -118,17 +118,17 @@ public: | |||
118 | visibleWidth(), visibleHeight(), erase ); | 118 | visibleWidth(), visibleHeight(), erase ); |
119 | }; | 119 | }; |
120 | /** | 120 | /** |
121 | * Constructor. | 121 | * Constructor. |
122 | * | 122 | * |
123 | * The parameters @p parent and @p name are handled by | 123 | * The parameters @p parent and @p name are handled by |
124 | * @ref QListView, as usual. | 124 | * @ref QListView, as usual. |
125 | */ | 125 | */ |
126 | KListView (QWidget *parent = 0, const char *name = 0); | 126 | KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true ); |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * Destructor. | 129 | * Destructor. |
130 | */ | 130 | */ |
131 | virtual ~KListView(); | 131 | virtual ~KListView(); |
132 | 132 | ||
133 | /** | 133 | /** |
134 | * Reimplemented for internal reasons. | 134 | * Reimplemented for internal reasons. |