summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-02 12:16:34 (UTC)
committer zautrix <zautrix>2005-04-02 12:16:34 (UTC)
commit997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe (patch) (unidiff)
treef788b37459574b5cea0d2ab874882c6a396c240d /korganizer
parente0d51120d2f0c178115746e0c1357af40f95bc77 (diff)
downloadkdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.zip
kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.gz
kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.bz2
more fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp57
-rw-r--r--korganizer/koagenda.h4
-rw-r--r--korganizer/koagendaview.cpp18
-rw-r--r--korganizer/koagendaview.h4
-rw-r--r--korganizer/kotodoview.cpp49
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
@@ -159,43 +159,44 @@ void MarcusBains::updateLocation(bool recalculate)
159 159
160//////////////////////////////////////////////////////////////////////////// 160////////////////////////////////////////////////////////////////////////////
161 161
162 162
163/* 163/*
164 Create an agenda widget with rows rows and columns columns. 164 Create an agenda widget with rows rows and columns columns.
165*/ 165*/
166KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, 166KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
167 const char *name,WFlags f) : 167 const char *name,WFlags f) :
168 QScrollView(parent,name,f) 168 QScrollView(parent,name,f)
169{ 169{
170 170
171 171 mAllAgendaPopup = 0;
172 mColumns = columns; 172 mColumns = columns;
173 mRows = rows; 173 mRows = rows;
174 mGridSpacingY = rowSize; 174 mGridSpacingY = rowSize;
175 mAllDayMode = false; 175 mAllDayMode = false;
176#ifndef DESKTOP_VERSION 176#ifndef DESKTOP_VERSION
177 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 177 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
178#endif 178#endif
179 mHolidayMask = 0; 179 mHolidayMask = 0;
180 init(); 180 init();
181} 181}
182 182
183/* 183/*
184 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
185 all-day events. 185 all-day events.
186*/ 186*/
187KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : 187KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
188 QScrollView(parent,name,f) 188 QScrollView(parent,name,f)
189{ 189{
190 mAllAgendaPopup = 0;
190 blockResize = false; 191 blockResize = false;
191 mColumns = columns; 192 mColumns = columns;
192 mRows = 1; 193 mRows = 1;
193 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); 194 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize);
194 mGridSpacingY = KOPrefs::instance()->mAllDaySize; 195 mGridSpacingY = KOPrefs::instance()->mAllDaySize;
195 mAllDayMode = true; 196 mAllDayMode = true;
196#ifndef DESKTOP_VERSION 197#ifndef DESKTOP_VERSION
197 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 198 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
198#endif 199#endif
199 mHolidayMask = 0; 200 mHolidayMask = 0;
200 init(); 201 init();
201} 202}
@@ -223,25 +224,25 @@ void KOAgenda::init()
223{ 224{
224 mPopupTimer = new QTimer(this); 225 mPopupTimer = new QTimer(this);
225 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 226 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
226 227
227 mNewItemPopup = new QPopupMenu( this ); 228 mNewItemPopup = new QPopupMenu( this );
228 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); 229 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
229 QString pathString = ""; 230 QString pathString = "";
230 if ( !KOPrefs::instance()->mToolBarMiniIcons ) { 231 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
231 if ( QApplication::desktop()->width() < 480 ) 232 if ( QApplication::desktop()->width() < 480 )
232 pathString += "icons16/"; 233 pathString += "icons16/";
233 } else 234 } else
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 );
237 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); 238 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
238 mNewItemPopup->insertSeparator ( ); 239 mNewItemPopup->insertSeparator ( );
239 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); 240 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 );
240 mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); 241 mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 );
241 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); 242 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 );
242 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); 243 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 );
243 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); 244 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 );
244 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); 245 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
245#ifndef _WIN32_ 246#ifndef _WIN32_
246 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase 247 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase
247 viewport()->setWFlags ( wflags); 248 viewport()->setWFlags ( wflags);
@@ -378,61 +379,100 @@ bool KOAgenda::eventFilter ( QObject *object, QEvent *event )
378 } 379 }
379} 380}
380void KOAgenda::popupMenu() 381void KOAgenda::popupMenu()
381{ 382{
382 mPopupTimer->stop(); 383 mPopupTimer->stop();
383 if ( mPopupKind == 1 ) { 384 if ( mPopupKind == 1 ) {
384 if (mActionItem ) { 385 if (mActionItem ) {
385 endItemAction(); 386 endItemAction();
386 } 387 }
387 mLeftMouseDown = false; // no more leftMouse computation 388 mLeftMouseDown = false; // no more leftMouse computation
388 if (mPopupItem) { 389 if (mPopupItem) {
389 selectItem(mPopupItem); 390 selectItem(mPopupItem);
391 if ( mAllAgendaPopup )
392 mAllAgendaPopup->installEventFilter( this );
390 emit showIncidencePopupSignal(mPopupItem->incidence()); 393 emit showIncidencePopupSignal(mPopupItem->incidence());
391 394
392 } 395 }
393 } else if ( mPopupKind == 2 ) { 396 } else if ( mPopupKind == 2 ) {
394 if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action 397 if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action
395 endSelectAction( false ); // do not emit new event signal 398 endSelectAction( false ); // do not emit new event signal
396 mLeftMouseDown = false; // no more leftMouse computation 399 mLeftMouseDown = false; // no more leftMouse computation
397 } 400 }
401 mNewItemPopup->installEventFilter( this );
398 mNewItemPopup->popup( mPopupPos); 402 mNewItemPopup->popup( mPopupPos);
403
399 } 404 }
400 mLeftMouseDown = false; 405 mLeftMouseDown = false;
401 mPopupItem = 0; 406 mPopupItem = 0;
402 mPopupKind = 0; 407 mPopupKind = 0;
403} 408}
404 409
405bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) 410bool 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;
409 if (object != viewport()) { 451 if (object != viewport()) {
410 viewportPos = ((QWidget *)object)->mapToParent(me->pos()); 452 viewportPos = ((QWidget *)object)->mapToParent(me->pos());
411 } else { 453 } else {
412 viewportPos = me->pos(); 454 viewportPos = me->pos();
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()) {
419 case QEvent::MouseButtonPress: 458 case QEvent::MouseButtonPress:
420 if (me->button() == LeftButton) { 459 if (me->button() == LeftButton) {
421 mPopupTimer->start( 600 ); 460 mPopupTimer->start( 600 );
422 mLeftMouseDown = true; 461 mLeftMouseDown = true;
423 } 462 }
424 blockMoving = true; 463 blockMoving = true;
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()) {
428 mPopupItem = (KOAgendaItem *)object; 468 mPopupItem = (KOAgendaItem *)object;
429 mPopupKind = 1; 469 mPopupKind = 1;
430 if (me->button() == RightButton) { 470 if (me->button() == RightButton) {
431 popupMenu(); 471 popupMenu();
432 } else if (me->button() == LeftButton) { 472 } else if (me->button() == LeftButton) {
433 mActionItem = (KOAgendaItem *)object; 473 mActionItem = (KOAgendaItem *)object;
434 if (mActionItem) { 474 if (mActionItem) {
435 if ( mSelectionHeight > 0 ) { 475 if ( mSelectionHeight > 0 ) {
436 int selectionCellX = mSelectionCellX * mGridSpacingX; 476 int selectionCellX = mSelectionCellX * mGridSpacingX;
437 int selectionYTop = mSelectionYTop; 477 int selectionYTop = mSelectionYTop;
438 int gridSpacingX = mGridSpacingX; 478 int gridSpacingX = mGridSpacingX;
@@ -446,25 +486,24 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
446 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { 486 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) {
447 mActionItem = 0; 487 mActionItem = 0;
448 } else { 488 } else {
449 startItemAction(viewportPos); 489 startItemAction(viewportPos);
450 } 490 }
451 } 491 }
452 } 492 }
453 } else { // ---------- viewport() 493 } else { // ---------- viewport()
454 mPopupItem = 0; 494 mPopupItem = 0;
455 mPopupKind = 2; 495 mPopupKind = 2;
456 selectItem(0); 496 selectItem(0);
457 mActionItem = 0; 497 mActionItem = 0;
458 mPopupPos = viewport()->mapToGlobal( me->pos() );
459 if (me->button() == RightButton) { 498 if (me->button() == RightButton) {
460 int x,y; 499 int x,y;
461 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 500 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
462 int gx,gy; 501 int gx,gy;
463 contentsToGrid(x,y,gx,gy); 502 contentsToGrid(x,y,gx,gy);
464 mCurrentCellX = gx; 503 mCurrentCellX = gx;
465 mCurrentCellY = gy; 504 mCurrentCellY = gy;
466 mStartCellX = gx; 505 mStartCellX = gx;
467 mStartCellY = gy; 506 mStartCellY = gy;
468 popupMenu(); 507 popupMenu();
469 } else if (me->button() == LeftButton) { 508 } else if (me->button() == LeftButton) {
470 setCursor(arrowCursor); 509 setCursor(arrowCursor);
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 35c08b6..4f1fdb9 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -22,24 +22,25 @@
22*/ 22*/
23#ifndef KOAGENDA_H 23#ifndef KOAGENDA_H
24#define KOAGENDA_H 24#define KOAGENDA_H
25 25
26#include <qscrollview.h> 26#include <qscrollview.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qmemarray.h> 28#include <qmemarray.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qpixmap.h> 30#include <qpixmap.h>
31#include <qguardedptr.h> 31#include <qguardedptr.h>
32 32
33#include "koagendaitem.h" 33#include "koagendaitem.h"
34#include "koeventview.h"
34 35
35class QPopupMenu; 36class QPopupMenu;
36class QTime; 37class QTime;
37class KConfig; 38class KConfig;
38class QFrame; 39class QFrame;
39class KOAgenda; 40class KOAgenda;
40class KCal::Event; 41class KCal::Event;
41class KCal::Todo; 42class KCal::Todo;
42 43
43using namespace KCal; 44using namespace KCal;
44 45
45class MarcusBains : public QFrame { 46class MarcusBains : public QFrame {
@@ -114,25 +115,25 @@ class KOAgenda : public QScrollView
114 void updateConfig(); 115 void updateConfig();
115 116
116 void checkScrollBoundaries(); 117 void checkScrollBoundaries();
117 118
118 void setHolidayMask(QMemArray<bool> *); 119 void setHolidayMask(QMemArray<bool> *);
119 void setDateList(const DateList &selectedDates); 120 void setDateList(const DateList &selectedDates);
120 DateList dateList() const; 121 DateList dateList() const;
121 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); 122 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false);
122 void finishUpdate(); 123 void finishUpdate();
123 void printSelection(); 124 void printSelection();
124 void storePosition(); 125 void storePosition();
125 void restorePosition(); 126 void restorePosition();
126 127 void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; }
127 128
128 public slots: 129 public slots:
129 void popupMenu(); 130 void popupMenu();
130 void newItem( int ); 131 void newItem( int );
131 void moveChild( QWidget *, int, int ); 132 void moveChild( QWidget *, int, int );
132 void scrollUp(); 133 void scrollUp();
133 void scrollDown(); 134 void scrollDown();
134 void updateTodo( Todo * t, int , bool ); 135 void updateTodo( Todo * t, int , bool );
135 void popupAlarm(); 136 void popupAlarm();
136 137
137 void checkScrollBoundaries(int); 138 void checkScrollBoundaries(int);
138 139
@@ -159,24 +160,25 @@ class KOAgenda : public QScrollView
159 160
160 void itemModified(KOAgendaItem *item, int ); 161 void itemModified(KOAgendaItem *item, int );
161 void incidenceSelected(Incidence *); 162 void incidenceSelected(Incidence *);
162 163
163 void lowerYChanged(int); 164 void lowerYChanged(int);
164 void upperYChanged(int); 165 void upperYChanged(int);
165 166
166 void startDragSignal(Incidence *); 167 void startDragSignal(Incidence *);
167 void addToCalSignal(Incidence *, Incidence *); 168 void addToCalSignal(Incidence *, Incidence *);
168 void resizedSignal(); 169 void resizedSignal();
169 170
170 protected: 171 protected:
172 KOEventPopupMenu * mAllAgendaPopup;
171 QPainter mPixPainter; 173 QPainter mPixPainter;
172 QPixmap mPaintPixmap; 174 QPixmap mPaintPixmap;
173 QPixmap mHighlightPixmap; 175 QPixmap mHighlightPixmap;
174 void drawContents(QPainter *p,int cx, int cy, int cw, int ch); 176 void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
175 virtual void resizeEvent ( QResizeEvent * ); 177 virtual void resizeEvent ( QResizeEvent * );
176 178
177 /** Handles mouse events. Called from eventFilter */ 179 /** Handles mouse events. Called from eventFilter */
178 virtual bool eventFilter_mouse ( QObject *, QMouseEvent * ); 180 virtual bool eventFilter_mouse ( QObject *, QMouseEvent * );
179 181
180 /** Start selecting time span. */ 182 /** Start selecting time span. */
181 void startSelectAction(QPoint viewportPos); 183 void startSelectAction(QPoint viewportPos);
182 184
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 8d32152..95388ef 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -496,27 +496,25 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
496 widebut = heibut ; 496 widebut = heibut ;
497 497
498 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 498 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
499 // QSizePolicy::Fixed ) ); 499 // QSizePolicy::Fixed ) );
500 mExpandButton->setFixedSize( widebut, widebut); 500 mExpandButton->setFixedSize( widebut, widebut);
501 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 501 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
502 mExpandButton->setFocusPolicy(NoFocus); 502 mExpandButton->setFocusPolicy(NoFocus);
503 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 503 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
504 mAllDayAgenda->setFocusPolicy(NoFocus); 504 mAllDayAgenda->setFocusPolicy(NoFocus);
505 QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); 505 QLabel *dummyAllDayRight = new QLabel (mAllDayFrame);
506 506
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
512 // Create agenda frame 510 // Create agenda frame
513 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); 511 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3);
514 // QHBox *agendaFrame = new QHBox(splitterAgenda); 512 // QHBox *agendaFrame = new QHBox(splitterAgenda);
515 513
516 // create event indicator bars 514 // create event indicator bars
517 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 515 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
518#ifndef DESKTOP_VERSION 516#ifndef DESKTOP_VERSION
519 // FIX 517 // FIX
520 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 518 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
521#endif 519#endif
522 mDayLabelsFrame = new QHBox(agendaFrame); 520 mDayLabelsFrame = new QHBox(agendaFrame);
@@ -535,34 +533,38 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
535 // Create time labels 533 // Create time labels
536 mTimeLabels = new TimeLabels(24,agendaFrame); 534 mTimeLabels = new TimeLabels(24,agendaFrame);
537 agendaLayout->addWidget(mTimeLabels,2,0); 535 agendaLayout->addWidget(mTimeLabels,2,0);
538 connect(mTimeLabels,SIGNAL( scaleChanged()), 536 connect(mTimeLabels,SIGNAL( scaleChanged()),
539 this,SLOT(updateConfig())); 537 this,SLOT(updateConfig()));
540 538
541 // Create agenda 539 // Create agenda
542 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); 540 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
543 agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); 541 agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2);
544 agendaLayout->setColStretch(1,1); 542 agendaLayout->setColStretch(1,1);
545 mAgenda->setFocusPolicy(NoFocus); 543 mAgenda->setFocusPolicy(NoFocus);
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,
551 SLOT(popupAlarm()),true); 549 SLOT(popupAlarm()),true);
552 550
553 551
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
558 mTimeLabels->setAgenda(mAgenda); 560 mTimeLabels->setAgenda(mAgenda);
559 561
560 // Update widgets to reflect user preferences 562 // Update widgets to reflect user preferences
561 // updateConfig(); 563 // updateConfig();
562 564
563 // createDayLabels(); 565 // createDayLabels();
564 566
565 // these blank widgets make the All Day Event box line up with the agenda 567 // these blank widgets make the All Day Event box line up with the agenda
566 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 568 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
567 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 569 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
568 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 570 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
@@ -658,26 +660,26 @@ void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
658 660
659 if ( incOld ) { 661 if ( incOld ) {
660 if ( incOld->type() == "Todo" ) 662 if ( incOld->type() == "Todo" )
661 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 663 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
662 else 664 else
663 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); 665 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
664 } 666 }
665 667
666} 668}
667 669
668KOAgendaView::~KOAgendaView() 670KOAgendaView::~KOAgendaView()
669{ 671{
670 delete mAgendaPopup; 672 delete mAllAgendaPopup;
671 delete mAllDayAgendaPopup; 673 //delete mAllDayAgendaPopup;
672 delete KOAgendaItem::paintPix(); 674 delete KOAgendaItem::paintPix();
673 delete KOAgendaItem::paintPixSel(); 675 delete KOAgendaItem::paintPixSel();
674} 676}
675void KOAgendaView::resizeEvent( QResizeEvent* e ) 677void KOAgendaView::resizeEvent( QResizeEvent* e )
676{ 678{
677 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); 679 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width());
678 bool uc = false; 680 bool uc = false;
679 int ow = e->oldSize().width(); 681 int ow = e->oldSize().width();
680 int oh = e->oldSize().height(); 682 int oh = e->oldSize().height();
681 int w = e->size().width(); 683 int w = e->size().width();
682 int h = e->size().height(); 684 int h = e->size().height();
683 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { 685 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) {
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 30c9b05..c6e6602 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -262,26 +262,26 @@ class KOAgendaView : public KOEventView {
262 TimeLabels *mTimeLabels; 262 TimeLabels *mTimeLabels;
263 QWidget *mDummyAllDayLeft; 263 QWidget *mDummyAllDayLeft;
264 264
265 KDGanttMinimizeSplitter* mSplitterAgenda; 265 KDGanttMinimizeSplitter* mSplitterAgenda;
266 QPushButton *mExpandButton; 266 QPushButton *mExpandButton;
267 267
268 DateList mSelectedDates; // List of dates to be displayed 268 DateList mSelectedDates; // List of dates to be displayed
269 int mViewType; 269 int mViewType;
270 270
271 bool mWeekStartsMonday; 271 bool mWeekStartsMonday;
272 int mStartHour; 272 int mStartHour;
273 273
274 KOEventPopupMenu *mAgendaPopup; 274 KOEventPopupMenu *mAllAgendaPopup;
275 KOEventPopupMenu *mAllDayAgendaPopup; 275 //KOEventPopupMenu *mAllDayAgendaPopup;
276 276
277 EventIndicator *mEventIndicatorTop; 277 EventIndicator *mEventIndicatorTop;
278 EventIndicator *mEventIndicatorBottom; 278 EventIndicator *mEventIndicatorBottom;
279 279
280 QMemArray<int> mMinY; 280 QMemArray<int> mMinY;
281 QMemArray<int> mMaxY; 281 QMemArray<int> mMaxY;
282 282
283 QMemArray<bool> mHolidayMask; 283 QMemArray<bool> mHolidayMask;
284 284
285 QPtrList<KOAgendaButton> mDayLabelsList; 285 QPtrList<KOAgendaButton> mDayLabelsList;
286 QDateTime mTimeSpanBegin; 286 QDateTime mTimeSpanBegin;
287 QDateTime mTimeSpanEnd; 287 QDateTime mTimeSpanEnd;
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index ccc4b01..0a315cb 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -198,43 +198,54 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
198 } 198 }
199 } 199 }
200 else { 200 else {
201 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); 201 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable ");
202 e->ignore(); 202 e->ignore();
203 } 203 }
204 } 204 }
205#endif 205#endif
206} 206}
207 207
208void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 208void 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}
230void KOTodoListView::paintEvent(QPaintEvent* e) 241void KOTodoListView::paintEvent(QPaintEvent* e)
231{ 242{
232 emit paintNeeded(); 243 emit paintNeeded();
233 QListView::paintEvent( e); 244 QListView::paintEvent( e);
234} 245}
235void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 246void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
236{ 247{
237 248
238#ifndef KORG_NODND 249#ifndef KORG_NODND
239 //QListView::contentsMouseMoveEvent(e); 250 //QListView::contentsMouseMoveEvent(e);
240 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 251 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
@@ -1054,36 +1065,44 @@ void KOTodoView::changedCategories(int index)
1054 mActiveItem->todo()->setCategories (categories); 1065 mActiveItem->todo()->setCategories (categories);
1055 mActiveItem->construct(); 1066 mActiveItem->construct();
1056 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1067 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1057 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1068 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1058 } 1069 }
1059} 1070}
1060void KOTodoView::itemDoubleClicked(QListViewItem *item) 1071void KOTodoView::itemDoubleClicked(QListViewItem *item)
1061{ 1072{
1062 if ( pendingSubtodo != 0 ) { 1073 if ( pendingSubtodo != 0 ) {
1063 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1074 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1064 } 1075 }
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) {
1067 newTodo(); 1080 newTodo();
1068 return; 1081 return;
1082 } else {
1083 if ( row == 1 ) {
1084 mActiveItem = (KOTodoViewItem *) item;
1085 newSubTodo();
1086 return;
1087 }
1069 } 1088 }
1070 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1089 if ( KOPrefs::instance()->mEditOnDoubleClick )
1071 editItem( item ); 1090 editItem( item );
1072 else 1091 else
1073 showItem( item , QPoint(), 0 ); 1092 showItem( item , QPoint(), 0 );
1074} 1093}
1075void KOTodoView::itemClicked(QListViewItem *item) 1094void KOTodoView::itemClicked(QListViewItem *item)
1076{ 1095{
1077 1096 //qDebug("KOTodoView::itemClicked %d", item);
1078 if (!item) { 1097 if (!item) {
1079 if ( pendingSubtodo != 0 ) { 1098 if ( pendingSubtodo != 0 ) {
1080 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1099 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1081 } 1100 }
1082 pendingSubtodo = 0; 1101 pendingSubtodo = 0;
1083 return; 1102 return;
1084 } 1103 }
1085 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1104 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1086 if ( pendingSubtodo != 0 ) { 1105 if ( pendingSubtodo != 0 ) {
1087 bool allowReparent = true; 1106 bool allowReparent = true;
1088 QListViewItem *par = item; 1107 QListViewItem *par = item;
1089 while ( par ) { 1108 while ( par ) {