summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-25 18:26:36 (UTC)
committer zautrix <zautrix>2005-03-25 18:26:36 (UTC)
commit89a72c007045dcfa5dbf57012b4cf0c2aebd1495 (patch) (unidiff)
tree6accbe5706b724e307d1590152fa2d2c78cdef70 /korganizer
parent3326831dbf6f962e97a978781361db5198f6a035 (diff)
downloadkdepimpi-89a72c007045dcfa5dbf57012b4cf0c2aebd1495.zip
kdepimpi-89a72c007045dcfa5dbf57012b4cf0c2aebd1495.tar.gz
kdepimpi-89a72c007045dcfa5dbf57012b4cf0c2aebd1495.tar.bz2
layout fixes
Diffstat (limited to 'korganizer') (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
@@ -154,49 +154,49 @@ void MarcusBains::updateLocation(bool recalculate)
154 154
155 mTimeBox->raise(); 155 mTimeBox->raise();
156 //mTimeBox->setAutoMask(true); 156 //mTimeBox->setAutoMask(true);
157 minutes->start(5000,true); 157 minutes->start(5000,true);
158} 158}
159 159
160 160
161//////////////////////////////////////////////////////////////////////////// 161////////////////////////////////////////////////////////////////////////////
162 162
163 163
164/* 164/*
165 Create an agenda widget with rows rows and columns columns. 165 Create an agenda widget with rows rows and columns columns.
166*/ 166*/
167KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, 167KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
168 const char *name,WFlags f) : 168 const char *name,WFlags f) :
169 QScrollView(parent,name,f) 169 QScrollView(parent,name,f)
170{ 170{
171 171
172 172
173 mColumns = columns; 173 mColumns = columns;
174 mRows = rows; 174 mRows = rows;
175 mGridSpacingY = rowSize; 175 mGridSpacingY = rowSize;
176 mAllDayMode = false; 176 mAllDayMode = false;
177#ifndef DESKTOP_VERSION 177#ifndef DESKTOP_VERSION
178 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 178 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
179#endif 179#endif
180 mHolidayMask = 0; 180 mHolidayMask = 0;
181 init(); 181 init();
182} 182}
183 183
184/* 184/*
185 Create an agenda widget with columns columns and one row. This is used for 185 Create an agenda widget with columns columns and one row. This is used for
186 all-day events. 186 all-day events.
187*/ 187*/
188KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : 188KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
189 QScrollView(parent,name,f) 189 QScrollView(parent,name,f)
190{ 190{
191 blockResize = false; 191 blockResize = false;
192 mColumns = columns; 192 mColumns = columns;
193 mRows = 1; 193 mRows = 1;
194 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); 194 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize);
195 mGridSpacingY = KOPrefs::instance()->mAllDaySize; 195 mGridSpacingY = KOPrefs::instance()->mAllDaySize;
196 mAllDayMode = true; 196 mAllDayMode = true;
197#ifndef DESKTOP_VERSION 197#ifndef DESKTOP_VERSION
198 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 198 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
199#endif 199#endif
200 mHolidayMask = 0; 200 mHolidayMask = 0;
201 init(); 201 init();
202} 202}
@@ -377,201 +377,188 @@ bool KOAgenda::eventFilter ( QObject *object, QEvent *event )
377 if (!mActionItem) 377 if (!mActionItem)
378 setCursor(arrowCursor); 378 setCursor(arrowCursor);
379 return true; 379 return true;
380 380
381 default: 381 default:
382 return QScrollView::eventFilter(object,event); 382 return QScrollView::eventFilter(object,event);
383 } 383 }
384} 384}
385 385
386 386
387bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) 387bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
388{ 388{
389 //qDebug("KOAgenda::eventFilter_mous "); 389 //qDebug("KOAgenda::eventFilter_mous ");
390 QPoint viewportPos; 390 QPoint viewportPos;
391 if (object != viewport()) { 391 if (object != viewport()) {
392 viewportPos = ((QWidget *)object)->mapToParent(me->pos()); 392 viewportPos = ((QWidget *)object)->mapToParent(me->pos());
393 } else { 393 } else {
394 viewportPos = me->pos(); 394 viewportPos = me->pos();
395 } 395 }
396 static int startX = 0; 396 static int startX = 0;
397 static int startY = 0; 397 static int startY = 0;
398 static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); 398 static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 );
399 static bool blockMoving = true; 399 static bool blockMoving = true;
400 static bool leftMouseDown = false; 400 static bool leftMouseDown = false;
401 static bool rightMouseDown = false;
402 static QTime rightClickTime;
403 bool rightButtonPressed = false; 401 bool rightButtonPressed = false;
404 switch (me->type()) { 402 switch (me->type()) {
405 case QEvent::MouseButtonPress: 403 case QEvent::MouseButtonPress:
406 rightClickTime.restart();
407 if (me->button() == LeftButton) { 404 if (me->button() == LeftButton) {
408 leftMouseDown = true; 405 leftMouseDown = true;
409 } 406 }
410 else if (me->button() == RightButton) 407 else if (me->button() == RightButton) {
411 rightMouseDown = true; 408 leftMouseDown = false;
409 }
412 blockMoving = true; 410 blockMoving = true;
413 startX = viewportPos.x(); 411 startX = viewportPos.x();
414 startY = viewportPos.y(); 412 startY = viewportPos.y();
415 if (object != viewport()) { 413 if (object != viewport()) { // item clicked **************
416 if (me->button() == RightButton) { 414 if (me->button() == RightButton) {
415 leftMouseDown = false;
417 mClickedItem = (KOAgendaItem *)object; 416 mClickedItem = (KOAgendaItem *)object;
417 if (mActionItem ) {
418 endItemAction();
419 }
418 if (mClickedItem) { 420 if (mClickedItem) {
419 selectItem(mClickedItem); 421 selectItem(mClickedItem);
420 } 422 emit showIncidencePopupSignal(mClickedItem->incidence());
423 }
424 return true;
421 } else if (me->button() == LeftButton) { 425 } else if (me->button() == LeftButton) {
422 mActionItem = (KOAgendaItem *)object; 426 mActionItem = (KOAgendaItem *)object;
423 if (mActionItem) { 427 if (mActionItem) {
424 if ( mSelectionHeight > 0 ) { 428 if ( mSelectionHeight > 0 ) {
425 int selectionCellX = mSelectionCellX * mGridSpacingX; 429 int selectionCellX = mSelectionCellX * mGridSpacingX;
426 int selectionYTop = mSelectionYTop; 430 int selectionYTop = mSelectionYTop;
427 int gridSpacingX = mGridSpacingX; 431 int gridSpacingX = mGridSpacingX;
428 int selectionHeight = mSelectionHeight; 432 int selectionHeight = mSelectionHeight;
429 clearSelection(); 433 clearSelection();
430 repaintContents( selectionCellX, selectionYTop, 434 repaintContents( selectionCellX, selectionYTop,
431 gridSpacingX, selectionHeight,false ); 435 gridSpacingX, selectionHeight,false );
432 } 436 }
433 selectItem(mActionItem); 437 selectItem(mActionItem);
434 Incidence *incidence = mActionItem->incidence(); 438 Incidence *incidence = mActionItem->incidence();
435 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { 439 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) {
436 mActionItem = 0; 440 mActionItem = 0;
437 } else { 441 } else {
438 startItemAction(viewportPos); 442 startItemAction(viewportPos);
439 } 443 }
440 } 444 }
441 } 445 }
442 } else { // ---------- viewport() 446 } else { // ---------- viewport()
443 selectItem(0); 447 selectItem(0);
444 mActionItem = 0; 448 mActionItem = 0;
445 if (me->button() == LeftButton ) { 449 if (me->button() == LeftButton ) {
446 setCursor(arrowCursor); 450 setCursor(arrowCursor);
447 startSelectAction(viewportPos); 451 startSelectAction(viewportPos);
452 } else if (me->button() == RightButton ) {
453 setCursor(arrowCursor);
454 if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action
455 endSelectAction( false ); // do not emit new event signal
456 leftMouseDown = false; // no more leftMouse computation
457 }
458 int x,y;
459 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
460 int gx,gy;
461 contentsToGrid(x,y,gx,gy);
462 mCurrentCellX = gx;
463 mCurrentCellY = gy;
464 mStartCellX = gx;
465 mStartCellY = gy;
466 mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
448 } 467 }
449 } 468 }
450 break; 469 break;
451 470
452 case QEvent::MouseButtonRelease: 471 case QEvent::MouseButtonRelease:
453 if ( rightClickTime.elapsed() > 500 && blockMoving ) 472
454 rightButtonPressed = true;
455 if (object != viewport()) { 473 if (object != viewport()) {
456 if (me->button() == RightButton || rightButtonPressed ) { 474 if (me->button() == LeftButton && leftMouseDown) {
457 if ( blockMoving ) {
458 mClickedItem = (KOAgendaItem *)object;
459 if (mActionItem ) {
460 endItemAction();
461 }
462 leftMouseDown = false; // no more leftMouse computation
463 if (mClickedItem) {
464 selectItem(mClickedItem);
465 emit showIncidencePopupSignal(mClickedItem->incidence());
466 }
467 }
468 } else if (me->button() == LeftButton && leftMouseDown) {
469 if (mActionItem) { 475 if (mActionItem) {
470 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 476 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
471 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); 477 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 );
472 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { 478 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) {
473 mScrollUpTimer.stop(); 479 mScrollUpTimer.stop();
474 mScrollDownTimer.stop(); 480 mScrollDownTimer.stop();
475 mActionItem->resetMove(); 481 mActionItem->resetMove();
476 placeSubCells( mActionItem ); 482 placeSubCells( mActionItem );
477 // emit startDragSignal( mActionItem->incidence() ); 483 // emit startDragSignal( mActionItem->incidence() );
478 setCursor( arrowCursor ); 484 setCursor( arrowCursor );
479 mActionItem = 0; 485 mActionItem = 0;
480 mActionType = NOP; 486 mActionType = NOP;
481 mItemMoved = 0; 487 mItemMoved = 0;
482 leftMouseDown = false; 488 leftMouseDown = false;
483 return true; 489 return true;
484 } 490 }
485 endItemAction(); 491 endItemAction();
486 } 492 }
487 } 493 }
488 494
489 } else { // ---------- viewport() 495 } else { // ---------- viewport()
490 if (me->button() == RightButton || rightButtonPressed ) { //right click 496 if (me->button() == LeftButton && leftMouseDown ) { //left click
491 if ( blockMoving ) { // we did mot moved the mouse much - popup menu
492 if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action
493 endSelectAction( false ); // do not emit new event signal
494 leftMouseDown = false; // no more leftMouse computation
495 }
496 int x,y;
497 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
498 int gx,gy;
499 contentsToGrid(x,y,gx,gy);
500 mCurrentCellX = gx;
501 mCurrentCellY = gy;
502 mStartCellX = gx;
503 mStartCellY = gy;
504 mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
505 }
506 }
507 else if (me->button() == LeftButton && leftMouseDown ) { //left click
508 endSelectAction( true ); // emit new event signal 497 endSelectAction( true ); // emit new event signal
509 } 498 }
510 } 499 }
511 if (me->button() == LeftButton) 500 if (me->button() == LeftButton)
512 leftMouseDown = false; 501 leftMouseDown = false;
513 else if (me->button() == RightButton) 502
514 rightMouseDown = false;
515 break; 503 break;
516 504
517 case QEvent::MouseMove: 505 case QEvent::MouseMove:
518 if ( !rightMouseDown && !leftMouseDown ) 506 if ( !leftMouseDown )
519 return true; 507 return true;
520 if ( blockMoving ) { 508 if ( blockMoving ) {
521 int dX, dY; 509 int dX, dY;
522 dX = startX - viewportPos.x(); 510 dX = startX - viewportPos.x();
523 if ( dX < 0 ) 511 if ( dX < 0 )
524 dX = -dX; 512 dX = -dX;
525 dY = viewportPos.y() - startY; 513 dY = viewportPos.y() - startY;
526 if ( dY < 0 ) 514 if ( dY < 0 )
527 dY = -dY; 515 dY = -dY;
528 //qDebug("%d %d %d ", dX, dY , blockmoveDist ); 516 //qDebug("%d %d %d ", dX, dY , blockmoveDist );
529 if ( dX > blockmoveDist || dY > blockmoveDist ) { 517 if ( dX > blockmoveDist || dY > blockmoveDist ) {
530 blockMoving = false; 518 blockMoving = false;
531 } 519 }
532 } 520 }
533 if (object != viewport()) { 521 if (object != viewport()) {
534 KOAgendaItem *moveItem = (KOAgendaItem *)object; 522 KOAgendaItem *moveItem = (KOAgendaItem *)object;
535 if (!moveItem->incidence()->isReadOnly() ) { 523 if (!moveItem->incidence()->isReadOnly() ) {
536 if (!mActionItem) 524 if (!mActionItem)
537 setNoActionCursor(moveItem,viewportPos); 525 setNoActionCursor(moveItem,viewportPos);
538 else { 526 else {
539 if ( !blockMoving ) 527 if ( !blockMoving )
540 performItemAction(viewportPos); 528 performItemAction(viewportPos);
541 } 529 }
542 } 530 }
543 } else { // ---------- viewport() 531 } else { // ---------- viewport()
544 if ( mActionType == SELECT ) { 532 if ( mActionType == SELECT ) {
545 performSelectAction( viewportPos ); 533 performSelectAction( viewportPos );
546 } 534 }
547 } 535 }
548 break; 536 break;
549 537
550 case QEvent::MouseButtonDblClick: 538 case QEvent::MouseButtonDblClick:
551 blockMoving = false; 539 blockMoving = false;
552 leftMouseDown = false; 540 leftMouseDown = false;
553 rightMouseDown = false;
554 if (object == viewport()) { 541 if (object == viewport()) {
555 selectItem(0); 542 selectItem(0);
556 int x,y; 543 int x,y;
557 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 544 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
558 int gx,gy; 545 int gx,gy;
559 contentsToGrid(x,y,gx,gy); 546 contentsToGrid(x,y,gx,gy);
560 emit newEventSignal(gx,gy); 547 emit newEventSignal(gx,gy);
561 } else { 548 } else {
562 KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; 549 KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object;
563 selectItem(doubleClickedItem); 550 selectItem(doubleClickedItem);
564 if ( KOPrefs::instance()->mEditOnDoubleClick ) 551 if ( KOPrefs::instance()->mEditOnDoubleClick )
565 emit editIncidenceSignal(doubleClickedItem->incidence()); 552 emit editIncidenceSignal(doubleClickedItem->incidence());
566 else 553 else
567 emit showIncidenceSignal(doubleClickedItem->incidence()); 554 emit showIncidenceSignal(doubleClickedItem->incidence());
568 } 555 }
569 break; 556 break;
570 557
571 default: 558 default:
572 break; 559 break;
573 } 560 }
574 return true; 561 return true;
575} 562}
576 563
577void KOAgenda::newItem( int item ) 564void KOAgenda::newItem( int item )
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index b30ad75..905c1bf 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -54,49 +54,49 @@ extern int globalFlagBlockAgendaItemUpdate;
54 54
55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
56 56
57//-------------------------------------------------------------------------- 57//--------------------------------------------------------------------------
58 58
59class KOAgendaItemWhatsThis :public QWhatsThis 59class KOAgendaItemWhatsThis :public QWhatsThis
60{ 60{
61public: 61public:
62 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; 62 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
63 63
64protected: 64protected:
65 virtual QString text( const QPoint& ) 65 virtual QString text( const QPoint& )
66 { 66 {
67 return _view->getWhatsThisText() ; 67 return _view->getWhatsThisText() ;
68 } 68 }
69private: 69private:
70 KOAgendaItem * _view; 70 KOAgendaItem * _view;
71}; 71};
72 72
73KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 73KOAgendaItem::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);
87 xPaintCoord = -1; 87 xPaintCoord = -1;
88 yPaintCoord = -1; 88 yPaintCoord = -1;
89} 89}
90QString KOAgendaItem::getWhatsThisText() 90QString KOAgendaItem::getWhatsThisText()
91{ 91{
92 if ( mIncidence ) 92 if ( mIncidence )
93 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 93 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
94 KOPrefs::instance()->mWTshowDetails, 94 KOPrefs::instance()->mWTshowDetails,
95 KOPrefs::instance()->mWTshowCreated, 95 KOPrefs::instance()->mWTshowCreated,
96 KOPrefs::instance()->mWTshowChanged); 96 KOPrefs::instance()->mWTshowChanged);
97 return "KOAgendaItem::getWhatsThisText()::internal error"; 97 return "KOAgendaItem::getWhatsThisText()::internal error";
98} 98}
99void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 99void KOAgendaItem::init ( Incidence *incidence, QDate qd )
100{ 100{
101 mIncidence = incidence; 101 mIncidence = incidence;
102 mDate = qd; 102 mDate = qd;
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 3519985..6b63d7f 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -287,49 +287,49 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
287 287
288 288
289#ifndef DESKTOP_VERSION 289#ifndef DESKTOP_VERSION
290 mPopupMenu->insertSeparator(); 290 mPopupMenu->insertSeparator();
291 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 291 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
292 i18n("Beam selected via IR"),this, 292 i18n("Beam selected via IR"),this,
293 SLOT(beamSelected()),true); 293 SLOT(beamSelected()),true);
294#endif 294#endif
295 /* 295 /*
296 mPopupMenu = new QPopupMenu; 296 mPopupMenu = new QPopupMenu;
297 mPopupMenu->insertItem(i18n("Edit Event"), this, 297 mPopupMenu->insertItem(i18n("Edit Event"), this,
298 SLOT (editEvent())); 298 SLOT (editEvent()));
299 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 299 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
300 SLOT (deleteEvent())); 300 SLOT (deleteEvent()));
301 mPopupMenu->insertSeparator(); 301 mPopupMenu->insertSeparator();
302 mPopupMenu->insertItem(i18n("Show Dates"), this, 302 mPopupMenu->insertItem(i18n("Show Dates"), this,
303 SLOT(showDates())); 303 SLOT(showDates()));
304 mPopupMenu->insertItem(i18n("Hide Dates"), this, 304 mPopupMenu->insertItem(i18n("Hide Dates"), this,
305 SLOT(hideDates())); 305 SLOT(hideDates()));
306 */ 306 */
307 QObject::connect(mListView,SIGNAL( newEvent()), 307 QObject::connect(mListView,SIGNAL( newEvent()),
308 this,SIGNAL(signalNewEvent())); 308 this,SIGNAL(signalNewEvent()));
309 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 309 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
310 this,SLOT(defaultItemAction(QListViewItem *))); 310 this,SLOT(defaultItemAction(QListViewItem *)));
311 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, 311 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
312 const QPoint &, int )), 312 const QPoint &, int )),
313 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 313 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
314 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 314 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
315 SLOT(processSelectionChange(QListViewItem *))); 315 SLOT(processSelectionChange(QListViewItem *)));
316 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 316 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
317 SIGNAL(showIncidenceSignal(Incidence *)) ); 317 SIGNAL(showIncidenceSignal(Incidence *)) );
318 318
319 readSettings(KOGlobals::config(),"KOListView Layout"); 319 readSettings(KOGlobals::config(),"KOListView Layout");
320} 320}
321 321
322KOListView::~KOListView() 322KOListView::~KOListView()
323{ 323{
324 delete mPopupMenu; 324 delete mPopupMenu;
325} 325}
326QString KOListView::getWhatsThisText(QPoint p) 326QString KOListView::getWhatsThisText(QPoint p)
327{ 327{
328 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 328 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
329 if ( item ) 329 if ( item )
330 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 330 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
331 KOPrefs::instance()->mWTshowDetails, 331 KOPrefs::instance()->mWTshowDetails,
332 KOPrefs::instance()->mWTshowCreated, 332 KOPrefs::instance()->mWTshowCreated,
333 KOPrefs::instance()->mWTshowChanged); 333 KOPrefs::instance()->mWTshowChanged);
334 return i18n("That is the list view" ); 334 return i18n("That is the list view" );
335 335
@@ -1138,90 +1138,58 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1138 if ( e->state() == ShiftButton ) 1138 if ( e->state() == ShiftButton )
1139 ci->setSelected( false ); 1139 ci->setSelected( false );
1140 else 1140 else
1141 ci->setSelected( true ); 1141 ci->setSelected( true );
1142 cn = cn->nextSibling(); 1142 cn = cn->nextSibling();
1143 if ( cn ) { 1143 if ( cn ) {
1144 setCurrentItem ( cn ); 1144 setCurrentItem ( cn );
1145 ensureItemVisible ( cn ); 1145 ensureItemVisible ( cn );
1146 } 1146 }
1147 } 1147 }
1148 } 1148 }
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}
1156KOListViewListView::KOListViewListView(KOListView * lv ) 1156KOListViewListView::KOListViewListView(KOListView * lv )
1157 : KListView( lv ) 1157 : KListView( lv )
1158{ 1158{
1159#ifndef DESKTOP_VERSION 1159#ifndef DESKTOP_VERSION
1160 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 1160 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
1161#endif 1161#endif
1162 mYMousePos = -1000;
1163 setSelectionMode( QListView::Multi ); 1162 setSelectionMode( QListView::Multi );
1164 setMultiSelection( true); 1163 setMultiSelection( true);
1165 mAllowPopupMenu = true;
1166 mMouseDown = false;
1167
1168} 1164}
1169void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1165void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1170{ 1166{
1171 if (!e) return; 1167 if (!e) return;
1172 QPoint vp = contentsToViewport(e->pos()); 1168 QPoint vp = contentsToViewport(e->pos());
1173 QListViewItem *item = itemAt(vp); 1169 QListViewItem *item = itemAt(vp);
1174 if (!item) { 1170 if (!item) {
1175 emit newEvent(); 1171 emit newEvent();
1176 return; 1172 return;
1177 } 1173 }
1178 KListView::contentsMouseDoubleClickEvent(e); 1174 KListView::contentsMouseDoubleClickEvent(e);
1179} 1175}
1180 1176
1181
1182void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1177void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1183{ 1178{
1184 //qDebug("contentsMousePressEvent++++ "); 1179 //qDebug("contentsMousePressEvent++++ ");
1185 if (! mMouseDown ) {
1186 mAllowPopupMenu = true;
1187 mYMousePos = mapToGlobal( (e->pos())).y();
1188 }
1189 if ( e->button() == RightButton && mMouseDown )
1190 return;
1191 if ( e->button() == LeftButton )
1192 mMouseDown = true;
1193 KListView::contentsMousePressEvent( e ); 1180 KListView::contentsMousePressEvent( e );
1181 if ( e->button() == RightButton ) {
1182 QListViewItem* ci = currentItem();
1183 clearSelection () ;
1184 if ( ci )
1185 ci->setSelected( true );
1186 }
1194} 1187}
1195void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1188void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1196{ 1189{
1197 //qDebug("contentsMouseReleaseEv---- ");
1198 if ( ! mMouseDown ) {
1199 if ( e->button() == RightButton && ! mAllowPopupMenu )
1200 return;
1201 QListViewItem* ci = currentItem();
1202 if ( ci )
1203 ci->setSelected( true );
1204 KListView::contentsMouseReleaseEvent(e);
1205 return;
1206 }
1207 if ( e->button() == LeftButton )
1208 mMouseDown = false;
1209 if ( e->button() == RightButton && ! mAllowPopupMenu )
1210 return;
1211 if ( e->button() == RightButton ) {
1212 QListViewItem* ci = currentItem();
1213 if ( ci )
1214 ci->setSelected( true );
1215 }
1216 KListView::contentsMouseReleaseEvent(e); 1190 KListView::contentsMouseReleaseEvent(e);
1217} 1191}
1218void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1192void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1219{ 1193{
1220 // qDebug("contentsMouseMoveEv....... ");
1221 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
1222 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
1223 if ( diff < 0 ) diff = -diff;
1224 if ( diff > 20 )
1225 mAllowPopupMenu = false;
1226 KListView::contentsMouseMoveEvent(e); 1194 KListView::contentsMouseMoveEvent(e);
1227} 1195}
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index 0d9c525..eca71e2 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -202,51 +202,49 @@ class ListItemVisitor : public Incidence::Visitor
202 display events from one particular day or several days, it doesn't 202 display events from one particular day or several days, it doesn't
203 matter. To use a view that only handles one day at a time, use 203 matter. To use a view that only handles one day at a time, use
204 KODayListView. 204 KODayListView.
205 205
206 @short multi-column list view of various events. 206 @short multi-column list view of various events.
207 @author Preston Brown <pbrown@kde.org> 207 @author Preston Brown <pbrown@kde.org>
208 @see KOBaseView, KODayListView 208 @see KOBaseView, KODayListView
209*/ 209*/
210class KOListView; 210class KOListView;
211 211
212class KOListViewListView : public KListView 212class KOListViewListView : public KListView
213{ 213{
214 Q_OBJECT 214 Q_OBJECT
215 public: 215 public:
216 KOListViewListView(KOListView * lv ); 216 KOListViewListView(KOListView * lv );
217 signals: 217 signals:
218 void newEvent(); 218 void newEvent();
219 void showIncidence( Incidence* ); 219 void showIncidence( Incidence* );
220 private: 220 private:
221 void keyPressEvent ( QKeyEvent * ) ; 221 void keyPressEvent ( QKeyEvent * ) ;
222 void contentsMouseDoubleClickEvent(QMouseEvent *e); 222 void contentsMouseDoubleClickEvent(QMouseEvent *e);
223 void contentsMousePressEvent(QMouseEvent *e); 223 void contentsMousePressEvent(QMouseEvent *e);
224 void contentsMouseReleaseEvent(QMouseEvent *e); 224 void contentsMouseReleaseEvent(QMouseEvent *e);
225 void contentsMouseMoveEvent(QMouseEvent *e); 225 void contentsMouseMoveEvent(QMouseEvent *e);
226 bool mAllowPopupMenu;
227 bool mMouseDown; 226 bool mMouseDown;
228 int mYMousePos;
229}; 227};
230 228
231class KOListView : public KOEventView 229class KOListView : public KOEventView
232{ 230{
233 Q_OBJECT 231 Q_OBJECT
234 public: 232 public:
235 KOListView(Calendar *calendar, QWidget *parent = 0, 233 KOListView(Calendar *calendar, QWidget *parent = 0,
236 const char *name = 0); 234 const char *name = 0);
237 ~KOListView(); 235 ~KOListView();
238 236
239 virtual int maxDatesHint(); 237 virtual int maxDatesHint();
240 virtual int currentDateCount(); 238 virtual int currentDateCount();
241 virtual QPtrList<Incidence> selectedIncidences(); 239 virtual QPtrList<Incidence> selectedIncidences();
242 virtual DateList selectedDates(); 240 virtual DateList selectedDates();
243 241
244 void showDates(bool show); 242 void showDates(bool show);
245 Incidence* currentItem(); 243 Incidence* currentItem();
246 void addTodos(QPtrList<Todo> eventList); 244 void addTodos(QPtrList<Todo> eventList);
247 void addJournals(QPtrList<Journal> eventList); 245 void addJournals(QPtrList<Journal> eventList);
248 virtual void printPreview(CalPrinter *calPrinter, 246 virtual void printPreview(CalPrinter *calPrinter,
249 const QDate &, const QDate &); 247 const QDate &, const QDate &);
250 248
251 void readSettings(KConfig *config, QString setting = "KOListView Layout"); 249 void readSettings(KConfig *config, QString setting = "KOListView Layout");
252 void writeSettings(KConfig *config, QString setting = "KOListView Layout"); 250 void writeSettings(KConfig *config, QString setting = "KOListView Layout");
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 12233ee..9085775 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -493,48 +493,53 @@ void MonthViewCell::setHoliday( bool holiday )
493 mHoliday = holiday; 493 mHoliday = holiday;
494 //setMyPalette(); 494 //setMyPalette();
495} 495}
496 496
497void MonthViewCell::setHoliday( const QString &holiday ) 497void MonthViewCell::setHoliday( const QString &holiday )
498{ 498{
499 mHolidayString = holiday; 499 mHolidayString = holiday;
500 500
501 if ( !holiday.isEmpty() ) { 501 if ( !holiday.isEmpty() ) {
502 setHoliday( true ); 502 setHoliday( true );
503 } 503 }
504} 504}
505 505
506void MonthViewCell::startUpdateCell() 506void MonthViewCell::startUpdateCell()
507{ 507{
508 508
509 setFocusPolicy(NoFocus); 509 setFocusPolicy(NoFocus);
510 if ( !mMonthView->isUpdatePossible() ) 510 if ( !mMonthView->isUpdatePossible() )
511 return; 511 return;
512 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 512 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
513 while ( mitem ) { 513 while ( mitem ) {
514 mitem->setBlockRepaint( true ); 514 mitem->setBlockRepaint( true );
515 mitem = (MonthViewItem *)mitem->next(); 515 mitem = (MonthViewItem *)mitem->next();
516 } 516 }
517 if ( mAvailItemList.count() > 20 ) {
518 mAvailItemList.setAutoDelete( true );
519 mAvailItemList.clear();
520 mAvailItemList.setAutoDelete( false );
521 }
517 /* 522 /*
518 if ( !isVisible() ){ 523 if ( !isVisible() ){
519 return; 524 return;
520 } 525 }
521 */ 526 */
522 // qDebug("MonthViewCell::updateCell() "); 527 // qDebug("MonthViewCell::updateCell() ");
523 setPrimary( mDate.month()%2 ); 528 setPrimary( mDate.month()%2 );
524 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 529 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
525 if ( mDate == QDate::currentDate() ) { 530 if ( mDate == QDate::currentDate() ) {
526 setLineWidth( 3 ); 531 setLineWidth( 3 );
527 } else { 532 } else {
528 setLineWidth( 1 ); 533 setLineWidth( 1 );
529 } 534 }
530 mCurrentAvailItem = (MonthViewItem*) firstItem (); 535 mCurrentAvailItem = (MonthViewItem*) firstItem ();
531 //clear(); 536 //clear();
532 537
533#ifdef DESKTOP_VERSION 538#ifdef DESKTOP_VERSION
534 QToolTip::remove(this); 539 QToolTip::remove(this);
535#endif 540#endif
536 mToolTip.clear(); 541 mToolTip.clear();
537 //qApp->processEvents(); 542 //qApp->processEvents();
538#if 0 543#if 0
539 if ( !mHolidayString.isEmpty() ) { 544 if ( !mHolidayString.isEmpty() ) {
540 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 545 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
@@ -796,56 +801,56 @@ void MonthViewCell::updateConfig( bool bigFont ) // = false
796 801
797 QFontMetrics fm( font() ); 802 QFontMetrics fm( font() );
798 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 803 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
799 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 804 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
800 mHolidayPalette = mStandardPalette; 805 mHolidayPalette = mStandardPalette;
801 mPrimaryPalette = mStandardPalette; 806 mPrimaryPalette = mStandardPalette;
802 mNonPrimaryPalette = mStandardPalette; 807 mNonPrimaryPalette = mStandardPalette;
803 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 808 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
804 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 809 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
805 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 810 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
806 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 811 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
807 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 812 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
808 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 813 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
809 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 814 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
810 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 815 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
811 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 816 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
812 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 817 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
813 } 818 }
814 //updateCell(); 819 //updateCell();
815} 820}
816 821
817void MonthViewCell::enableScrollBars( bool enabled ) 822void MonthViewCell::enableScrollBars( bool enabled )
818{ 823{
819 if ( enabled ) { 824 if ( enabled ) {
820
821 QListBoxItem *fi = firstItem (); 825 QListBoxItem *fi = firstItem ();
822 if (fi ) { 826 if (fi ) {
823 int ihei = fi->height( this ); 827 int ihei = fi->height( this );
824 int hei = numRows () * ihei; 828 int hei = numRows () * ihei;
825 if ( hei < height() - horizontalScrollBar()->height () ) 829 if ( hei < height() - horizontalScrollBar()->height () ) {
826 setVScrollBarMode(QScrollView::AlwaysOff); 830 setVScrollBarMode(QScrollView::AlwaysOff);
827 else 831 }
832 else
828 setVScrollBarMode(QScrollView::Auto); 833 setVScrollBarMode(QScrollView::Auto);
829 if ( ihei *3 > height() ) 834 if ( ihei *3 > height() )
830 setHScrollBarMode(QScrollView::AlwaysOff); 835 setHScrollBarMode(QScrollView::AlwaysOff);
831 else 836 else
832 setHScrollBarMode(QScrollView::Auto); 837 setHScrollBarMode(QScrollView::Auto);
833 } else { 838 } else {
834 setVScrollBarMode(QScrollView::Auto); 839 setVScrollBarMode(QScrollView::Auto);
835 setHScrollBarMode(QScrollView::Auto); 840 setHScrollBarMode(QScrollView::Auto);
836 } 841 }
837 } else { 842 } else {
838 setVScrollBarMode(QScrollView::AlwaysOff); 843 setVScrollBarMode(QScrollView::AlwaysOff);
839 setHScrollBarMode(QScrollView::AlwaysOff); 844 setHScrollBarMode(QScrollView::AlwaysOff);
840 } 845 }
841} 846}
842 847
843Incidence *MonthViewCell::selectedIncidence() 848Incidence *MonthViewCell::selectedIncidence()
844{ 849{
845 int index = currentItem(); 850 int index = currentItem();
846 if ( index < 0 ) return 0; 851 if ( index < 0 ) return 0;
847 852
848 MonthViewItem *mitem = 853 MonthViewItem *mitem =
849 static_cast<MonthViewItem *>( item( index ) ); 854 static_cast<MonthViewItem *>( item( index ) );
850 855
851 if ( !mitem ) return 0; 856 if ( !mitem ) return 0;