summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp17
-rw-r--r--korganizer/calendarview.h4
-rw-r--r--korganizer/koagenda.cpp60
-rw-r--r--korganizer/koagenda.h6
-rw-r--r--korganizer/koagendaview.cpp19
-rw-r--r--korganizer/koagendaview.h3
-rw-r--r--korganizer/koeditorgeneraltodo.cpp13
-rw-r--r--korganizer/koviewmanager.cpp9
8 files changed, 114 insertions, 17 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 257a4dd..035d630 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2641,17 +2641,20 @@ void CalendarView::newEvent(QDateTime fh)
2641 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2641 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2642} 2642}
2643 2643
2644void CalendarView::newEvent(QDate dt) 2644void CalendarView::newEvent(QDate dt)
2645{ 2645{
2646 newEvent(QDateTime(dt, QTime(0,0,0)), 2646 newEvent(QDateTime(dt, QTime(0,0,0)),
2647 QDateTime(dt, QTime(0,0,0)), true); 2647 QDateTime(dt, QTime(0,0,0)), true);
2648} 2648}
2649 2649void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint)
2650{
2651 newEvent(fromHint, toHint, false);
2652}
2650void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2653void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2651{ 2654{
2652 2655
2653 showEventEditor(); 2656 showEventEditor();
2654 mEventEditor->newEvent(fromHint,toHint,allDay); 2657 mEventEditor->newEvent(fromHint,toHint,allDay);
2655 if ( mFilterView->filtersEnabled() ) { 2658 if ( mFilterView->filtersEnabled() ) {
2656 CalFilter *filter = mFilterView->selectedFilter(); 2659 CalFilter *filter = mFilterView->selectedFilter();
2657 if (filter && filter->showCategories()) { 2660 if (filter && filter->showCategories()) {
@@ -2679,32 +2682,36 @@ void CalendarView::todoToBeDeleted(Todo *)
2679} 2682}
2680void CalendarView::todoDeleted() 2683void CalendarView::todoDeleted()
2681{ 2684{
2682 //qDebug(" todoDeleted()"); 2685 //qDebug(" todoDeleted()");
2683 updateTodoViews(); 2686 updateTodoViews();
2684} 2687}
2685 2688
2686 2689
2687 2690void CalendarView::newTodoDateTime( QDateTime dt, bool allday )
2688void CalendarView::newTodo()
2689{ 2691{
2690 2692 qDebug("datetime ");
2691 showTodoEditor(); 2693 showTodoEditor();
2692 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2694 mTodoEditor->newTodo(dt,0,allday);
2693 if ( mFilterView->filtersEnabled() ) { 2695 if ( mFilterView->filtersEnabled() ) {
2694 CalFilter *filter = mFilterView->selectedFilter(); 2696 CalFilter *filter = mFilterView->selectedFilter();
2695 if (filter && filter->showCategories()) { 2697 if (filter && filter->showCategories()) {
2696 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2698 mTodoEditor->setCategories(filter->categoryList().join(",") );
2697 } 2699 }
2698 if ( filter ) 2700 if ( filter )
2699 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2701 mTodoEditor->setSecrecy( filter->getSecrecy() );
2700 } 2702 }
2701} 2703}
2702 2704
2705void CalendarView::newTodo()
2706{
2707 newTodoDateTime( QDateTime(),true );
2708}
2709
2703void CalendarView::newSubTodo() 2710void CalendarView::newSubTodo()
2704{ 2711{
2705 Todo *todo = selectedTodo(); 2712 Todo *todo = selectedTodo();
2706 if ( todo ) newSubTodo( todo ); 2713 if ( todo ) newSubTodo( todo );
2707} 2714}
2708 2715
2709void CalendarView::newSubTodo(Todo *parentEvent) 2716void CalendarView::newSubTodo(Todo *parentEvent)
2710{ 2717{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index c8d6bdd..7c59a8d 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -220,17 +220,18 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
220 void deleteIncidence(); 220 void deleteIncidence();
221 void cloneIncidence(); 221 void cloneIncidence();
222 void moveIncidence(); 222 void moveIncidence();
223 void beamIncidence(); 223 void beamIncidence();
224 void toggleCancelIncidence(); 224 void toggleCancelIncidence();
225 225
226 /** create an editeventwin with supplied date/time, and if bool is true, 226 /** create an editeventwin with supplied date/time, and if bool is true,
227 * make the event take all day. */ 227 * make the event take all day. */
228 void newEvent(QDateTime, QDateTime, bool allDay = false); 228 void newEvent(QDateTime, QDateTime, bool allDay );
229 void newEvent(QDateTime, QDateTime);
229 void newEvent(QDateTime fh); 230 void newEvent(QDateTime fh);
230 void newEvent(QDate dt); 231 void newEvent(QDate dt);
231 /** create new event without having a date hint. Takes current date as 232 /** create new event without having a date hint. Takes current date as
232 default hint. */ 233 default hint. */
233 void newEvent(); 234 void newEvent();
234 void newFloatingEvent(); 235 void newFloatingEvent();
235 236
236 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 237 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
@@ -255,16 +256,17 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
255 void showJournal(Journal *); 256 void showJournal(Journal *);
256 void deleteJournal(Journal *); 257 void deleteJournal(Journal *);
257 /** Create an editor dialog for a todo */ 258 /** Create an editor dialog for a todo */
258 void editTodo(Todo *); 259 void editTodo(Todo *);
259 /** Create a read-only viewer dialog for the supplied todo */ 260 /** Create a read-only viewer dialog for the supplied todo */
260 void showTodo(Todo *); 261 void showTodo(Todo *);
261 /** create new todo */ 262 /** create new todo */
262 void newTodo(); 263 void newTodo();
264 void newTodoDateTime(QDateTime, bool allday);
263 /** create new todo with a parent todo */ 265 /** create new todo with a parent todo */
264 void newSubTodo(); 266 void newSubTodo();
265 /** create new todo with a parent todo */ 267 /** create new todo with a parent todo */
266 void newSubTodo(Todo *); 268 void newSubTodo(Todo *);
267 /** Delete todo */ 269 /** Delete todo */
268 void deleteTodo(Todo *); 270 void deleteTodo(Todo *);
269 271
270 272
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 7e0b216..73ee5cb 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -163,16 +163,27 @@ void MarcusBains::updateLocation(bool recalculate)
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 mNewItemPopup = new QPopupMenu( this );
172 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
173 QString pathString = "";
174 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
175 if ( QApplication::desktop()->width() < 480 )
176 pathString += "icons16/";
177 } else
178 pathString += "iconsmini/";
179
180 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
181 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
171 182
172 mColumns = columns; 183 mColumns = columns;
173 mRows = rows; 184 mRows = rows;
174 mGridSpacingY = rowSize; 185 mGridSpacingY = rowSize;
175 mAllDayMode = false; 186 mAllDayMode = false;
176#ifndef DESKTOP_VERSION 187#ifndef DESKTOP_VERSION
177 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 188 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
178#endif 189#endif
@@ -182,17 +193,26 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
182 193
183/* 194/*
184 Create an agenda widget with columns columns and one row. This is used for 195 Create an agenda widget with columns columns and one row. This is used for
185 all-day events. 196 all-day events.
186*/ 197*/
187KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : 198KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
188 QScrollView(parent,name,f) 199 QScrollView(parent,name,f)
189{ 200{
190 201 mNewItemPopup = new QPopupMenu( this );
202 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
203 QString pathString = "";
204 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
205 if ( QApplication::desktop()->width() < 480 )
206 pathString += "icons16/";
207 } else
208 pathString += "iconsmini/";
209 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."),1 );
210 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
191 blockResize = false; 211 blockResize = false;
192 mColumns = columns; 212 mColumns = columns;
193 mRows = 1; 213 mRows = 1;
194 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); 214 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize);
195 mGridSpacingY = KOPrefs::instance()->mAllDaySize; 215 mGridSpacingY = KOPrefs::instance()->mAllDaySize;
196 mAllDayMode = true; 216 mAllDayMode = true;
197#ifndef DESKTOP_VERSION 217#ifndef DESKTOP_VERSION
198 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 218 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
@@ -413,19 +433,35 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
413 startY = viewportPos.y(); 433 startY = viewportPos.y();
414 block = true; 434 block = true;
415 } 435 }
416 } 436 }
417 } 437 }
418 } else { 438 } else {
419 selectItem(0); 439 selectItem(0);
420 mActionItem = 0; 440 mActionItem = 0;
441 if (me->button() == RightButton ) {
442 blockNewEvent = true;
443 qDebug("right ");
444 int x,y;
445 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
446 int gx,gy;
447 contentsToGrid(x,y,gx,gy);
448 mStartCellX = gx;
449 mStartCellY = gy;
450 mCurrentCellX = gx;
451 mCurrentCellY = gy;
452 mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
453
454 } else {
455 blockNewEvent = false;
421 setCursor(arrowCursor); 456 setCursor(arrowCursor);
422 startSelectAction(viewportPos); 457 startSelectAction(viewportPos);
423 } 458 }
459 }
424 break; 460 break;
425 461
426 case QEvent::MouseButtonRelease: 462 case QEvent::MouseButtonRelease:
427 //qDebug("QEvent::MouseButtonRelease: "); 463 //qDebug("QEvent::MouseButtonRelease: ");
428 if (me->button() == RightButton && block ) { 464 if (me->button() == RightButton && block ) {
429 if (object != viewport()) { 465 if (object != viewport()) {
430 mClickedItem = (KOAgendaItem *)object; 466 mClickedItem = (KOAgendaItem *)object;
431 if (mActionItem ) { 467 if (mActionItem ) {
@@ -451,17 +487,21 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
451 setCursor( arrowCursor ); 487 setCursor( arrowCursor );
452 mActionItem = 0; 488 mActionItem = 0;
453 mActionType = NOP; 489 mActionType = NOP;
454 mItemMoved = 0; 490 mItemMoved = 0;
455 return true; 491 return true;
456 } 492 }
457 endItemAction(); 493 endItemAction();
458 } else if ( mActionType == SELECT ) { 494 } else if ( mActionType == SELECT ) {
459 endSelectAction(); 495 if (me->button() == RightButton ) {
496
497 } else {
498 endSelectAction( !blockNewEvent );
499 }
460 } 500 }
461 break; 501 break;
462 502
463 case QEvent::MouseMove: 503 case QEvent::MouseMove:
464 if (object != viewport()) { 504 if (object != viewport()) {
465 KOAgendaItem *moveItem = (KOAgendaItem *)object; 505 KOAgendaItem *moveItem = (KOAgendaItem *)object;
466 //qDebug("moveItem %d ",moveItem ); 506 //qDebug("moveItem %d ",moveItem );
467 if (!moveItem->incidence()->isReadOnly() /*&& 507 if (!moveItem->incidence()->isReadOnly() /*&&
@@ -515,16 +555,26 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
515 555
516 default: 556 default:
517 break; 557 break;
518 } 558 }
519 559
520 return true; 560 return true;
521} 561}
522 562
563void KOAgenda::newItem( int item )
564{
565 qDebug("new %d ", item);
566 if ( item == 1 ) { //new event
567 newEventSignal(mStartCellX ,mStartCellY );
568 }
569 if ( item == 2 ) { //new event
570 newTodoSignal(mStartCellX ,mStartCellY );
571 }
572}
523void KOAgenda::startSelectAction(QPoint viewportPos) 573void KOAgenda::startSelectAction(QPoint viewportPos)
524{ 574{
525 //emit newStartSelectSignal(); 575 //emit newStartSelectSignal();
526 576
527 mActionType = SELECT; 577 mActionType = SELECT;
528 578
529 int x,y; 579 int x,y;
530 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 580 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
@@ -604,23 +654,25 @@ void KOAgenda::performSelectAction(QPoint viewportPos)
604 mGridSpacingX, selectionHeight,false ); 654 mGridSpacingX, selectionHeight,false );
605 655
606 mCurrentCellY = gy; 656 mCurrentCellY = gy;
607 } else { 657 } else {
608 } 658 }
609 } 659 }
610} 660}
611 661
612void KOAgenda::endSelectAction() 662void KOAgenda::endSelectAction( bool emitNewEvent )
613{ 663{
614 mActionType = NOP; 664 mActionType = NOP;
615 mScrollUpTimer.stop(); 665 mScrollUpTimer.stop();
616 mScrollDownTimer.stop(); 666 mScrollDownTimer.stop();
617 667
618 emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); 668 emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
669 if ( emitNewEvent && mStartCellY < mCurrentCellY )
670 emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
619} 671}
620 672
621void KOAgenda::startItemAction(QPoint viewportPos) 673void KOAgenda::startItemAction(QPoint viewportPos)
622{ 674{
623 int x,y; 675 int x,y;
624 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 676 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
625 int gx,gy; 677 int gx,gy;
626 contentsToGrid(x,y,gx,gy); 678 contentsToGrid(x,y,gx,gy);
@@ -1655,17 +1707,17 @@ void KOAgenda::scrollUp()
1655void KOAgenda::scrollDown() 1707void KOAgenda::scrollDown()
1656{ 1708{
1657 scrollBy(0,mScrollOffset); 1709 scrollBy(0,mScrollOffset);
1658} 1710}
1659 1711
1660void KOAgenda::popupAlarm() 1712void KOAgenda::popupAlarm()
1661{ 1713{
1662 if (!mClickedItem) { 1714 if (!mClickedItem) {
1663 kdDebug() << "KOAgenda::popupAlarm() called without having a clicked item" << endl; 1715 qDebug("KOAgenda::popupAlarm() called without having a clicked item ");
1664 return; 1716 return;
1665 } 1717 }
1666// TODO: deal correctly with multiple alarms 1718// TODO: deal correctly with multiple alarms
1667 Alarm* alarm; 1719 Alarm* alarm;
1668 QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); 1720 QPtrList<Alarm> list(mClickedItem->incidence()->alarms());
1669 for(alarm=list.first();alarm;alarm=list.next()) { 1721 for(alarm=list.first();alarm;alarm=list.next()) {
1670 alarm->toggleAlarm(); 1722 alarm->toggleAlarm();
1671 } 1723 }
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 111242f..12943d7 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 newItem( int );
129 void moveChild( QWidget *, int, int ); 130 void moveChild( QWidget *, int, int );
130 void scrollUp(); 131 void scrollUp();
131 void scrollDown(); 132 void scrollDown();
132 void updateTodo( Todo * t, int , bool ); 133 void updateTodo( Todo * t, int , bool );
133 void popupAlarm(); 134 void popupAlarm();
134 135
135 void checkScrollBoundaries(int); 136 void checkScrollBoundaries(int);
136 137
@@ -140,16 +141,17 @@ class KOAgenda : public QScrollView
140 deselected. This function emits the itemSelected(bool) signal to inform 141 deselected. This function emits the itemSelected(bool) signal to inform
141 about selection/deseelction of events. */ 142 about selection/deseelction of events. */
142 void selectItem(KOAgendaItem *); 143 void selectItem(KOAgendaItem *);
143 void finishResize(); 144 void finishResize();
144 145
145 signals: 146 signals:
146 void newEventSignal(); 147 void newEventSignal();
147 void newEventSignal(int gx,int gy); 148 void newEventSignal(int gx,int gy);
149 void newTodoSignal(int gx,int gy);
148 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 150 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
149 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 151 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
150 void newStartSelectSignal(); 152 void newStartSelectSignal();
151 void showIncidenceSignal(Incidence *); 153 void showIncidenceSignal(Incidence *);
152 void editIncidenceSignal(Incidence *); 154 void editIncidenceSignal(Incidence *);
153 void deleteIncidenceSignal(Incidence *); 155 void deleteIncidenceSignal(Incidence *);
154 void showIncidencePopupSignal(Incidence *); 156 void showIncidencePopupSignal(Incidence *);
155 157
@@ -175,17 +177,17 @@ class KOAgenda : public QScrollView
175 177
176 /** Start selecting time span. */ 178 /** Start selecting time span. */
177 void startSelectAction(QPoint viewportPos); 179 void startSelectAction(QPoint viewportPos);
178 180
179 /** Select time span. */ 181 /** Select time span. */
180 void performSelectAction(QPoint viewportPos); 182 void performSelectAction(QPoint viewportPos);
181 183
182 /** Emd selecting time span. */ 184 /** Emd selecting time span. */
183 void endSelectAction(); 185 void endSelectAction( bool emitNewEvent = false );
184 186
185 /** Start moving/resizing agenda item */ 187 /** Start moving/resizing agenda item */
186 void startItemAction(QPoint viewportPos); 188 void startItemAction(QPoint viewportPos);
187 189
188 /** Move/resize agenda item */ 190 /** Move/resize agenda item */
189 void performItemAction(QPoint viewportPos); 191 void performItemAction(QPoint viewportPos);
190 192
191 /** End moving/resizing agenda item */ 193 /** End moving/resizing agenda item */
@@ -202,16 +204,17 @@ class KOAgenda : public QScrollView
202 */ 204 */
203 void keyPressEvent( QKeyEvent * ); 205 void keyPressEvent( QKeyEvent * );
204 206
205 void calculateWorkingHours(); 207 void calculateWorkingHours();
206 208
207 virtual void contentsMousePressEvent ( QMouseEvent * ); 209 virtual void contentsMousePressEvent ( QMouseEvent * );
208 210
209 private: 211 private:
212 bool blockNewEvent;
210 void init(); 213 void init();
211 void marcus_bains(); 214 void marcus_bains();
212 bool mAllDayMode; 215 bool mAllDayMode;
213 bool blockResize; 216 bool blockResize;
214 QTimer mResizeTimer; 217 QTimer mResizeTimer;
215 double mContentPosition; 218 double mContentPosition;
216 219
217 // Width and height of agenda cells 220 // Width and height of agenda cells
@@ -269,16 +272,17 @@ class KOAgenda : public QScrollView
269 272
270 bool mItemMoved; 273 bool mItemMoved;
271 274
272 // List of all Items contained in agenda 275 // List of all Items contained in agenda
273 QPtrList<KOAgendaItem> mItems; 276 QPtrList<KOAgendaItem> mItems;
274 QPtrList<KOAgendaItem> mUnusedItems; 277 QPtrList<KOAgendaItem> mUnusedItems;
275 KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport); 278 KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport);
276 QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems 279 QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems
280 QPopupMenu *mNewItemPopup;
277 281
278 int mOldLowerScrollValue; 282 int mOldLowerScrollValue;
279 int mOldUpperScrollValue; 283 int mOldUpperScrollValue;
280 KOAgendaItem * getItemForTodo ( Todo * todo ); 284 KOAgendaItem * getItemForTodo ( Todo * todo );
281 QMemArray<bool> *mHolidayMask; 285 QMemArray<bool> *mHolidayMask;
282 int mCurPixWid; 286 int mCurPixWid;
283 int mCurPixHei; 287 int mCurPixHei;
284}; 288};
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index f54f7bc..60ae41f 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -483,20 +483,24 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
483 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), 483 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)),
484 mTimeLabels, SLOT(positionChanged())); 484 mTimeLabels, SLOT(positionChanged()));
485 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), 485 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)),
486 SLOT(setContentsPos(int))); 486 SLOT(setContentsPos(int)));
487 487
488 // Create/Show/Edit/Delete Event 488 // Create/Show/Edit/Delete Event
489 connect(mAgenda,SIGNAL(newEventSignal(int,int)), 489 connect(mAgenda,SIGNAL(newEventSignal(int,int)),
490 SLOT(newEvent(int,int))); 490 SLOT(newEvent(int,int)));
491 connect(mAgenda,SIGNAL(newTodoSignal(int,int)),
492 SLOT(newTodo(int,int)));
491 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), 493 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
492 SLOT(newEvent(int,int,int,int))); 494 SLOT(newEvent(int,int,int,int)));
493 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), 495 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
494 SLOT(newEventAllDay(int,int))); 496 SLOT(newEventAllDay(int,int)));
497 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)),
498 SLOT(newTodoAllDay(int,int)));
495 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), 499 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
496 SLOT(newEventAllDay(int,int))); 500 SLOT(newEventAllDay(int,int)));
497 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 501 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
498 SLOT(newTimeSpanSelected(int,int,int,int))); 502 SLOT(newTimeSpanSelected(int,int,int,int)));
499 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 503 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
500 SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); 504 SLOT(newTimeSpanSelectedAllDay(int,int,int,int)));
501 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 505 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
502 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 506 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
@@ -1278,16 +1282,31 @@ void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd)
1278void KOAgendaView::newEventAllDay(int gx, int ) 1282void KOAgendaView::newEventAllDay(int gx, int )
1279{ 1283{
1280 if (!mSelectedDates.count()) return; 1284 if (!mSelectedDates.count()) return;
1281 1285
1282 QDate day = mSelectedDates[gx]; 1286 QDate day = mSelectedDates[gx];
1283 1287
1284 emit newEventSignal(day); 1288 emit newEventSignal(day);
1285} 1289}
1290void KOAgendaView::newTodoAllDay(int gx, int )
1291{
1292 if (!mSelectedDates.count()) return;
1293
1294 QDateTime day (mSelectedDates[gx] );
1295 emit newTodoSignal(day, true);
1296}
1297void KOAgendaView::newTodo(int gx, int gy )
1298{
1299 if (!mSelectedDates.count()) return;
1300 QDate dayStart = mSelectedDates[gx];
1301 QTime timeStart = mAgenda->gyToTime(gy);
1302 QDateTime dt (dayStart,timeStart);
1303 emit newTodoSignal( dt, false );
1304}
1286 1305
1287void KOAgendaView::updateEventIndicatorTop(int newY) 1306void KOAgendaView::updateEventIndicatorTop(int newY)
1288{ 1307{
1289 uint i; 1308 uint i;
1290 for(i=0;i<mMinY.size();++i) { 1309 for(i=0;i<mMinY.size();++i) {
1291 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); 1310 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true);
1292 else mEventIndicatorTop->enableColumn(i,false); 1311 else mEventIndicatorTop->enableColumn(i,false);
1293 } 1312 }
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 3cf938f..01d74a1 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -157,34 +157,37 @@ class KOAgendaView : public KOEventView {
157 virtual void showDates(const QDate &start, const QDate &end); 157 virtual void showDates(const QDate &start, const QDate &end);
158 virtual void showEvents(QPtrList<Event> eventList); 158 virtual void showEvents(QPtrList<Event> eventList);
159 159
160 void updateTodo( Todo *, int ); 160 void updateTodo( Todo *, int );
161 void changeEventDisplay(Event *, int); 161 void changeEventDisplay(Event *, int);
162 162
163 void clearSelection(); 163 void clearSelection();
164 164
165 void newTodo(int gx,int gy);
165 void newEvent(int gx,int gy); 166 void newEvent(int gx,int gy);
166 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); 167 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
167 void newEventAllDay(int gx, int gy); 168 void newEventAllDay(int gx, int gy);
169 void newTodoAllDay(int gx, int gy);
168 170
169 void startDrag(Event *); 171 void startDrag(Event *);
170 172
171 void readSettings(); 173 void readSettings();
172 void readSettings(KConfig *); 174 void readSettings(KConfig *);
173 void writeSettings(KConfig *); 175 void writeSettings(KConfig *);
174 176
175 void setContentsPos(int y); 177 void setContentsPos(int y);
176 178
177 void setExpandedButton( bool expanded ); 179 void setExpandedButton( bool expanded );
178 void scrollOneHourUp(); 180 void scrollOneHourUp();
179 void scrollOneHourDown(); 181 void scrollOneHourDown();
180 void addToCalSlot(Incidence *, Incidence *); 182 void addToCalSlot(Incidence *, Incidence *);
181 183
182 signals: 184 signals:
185 void newTodoSignal( QDateTime ,bool );
183 void toggleExpand(); 186 void toggleExpand();
184 void todoMoved( Todo *, int ); 187 void todoMoved( Todo *, int );
185 void incidenceChanged(Incidence * , int ); 188 void incidenceChanged(Incidence * , int );
186 // void cloneIncidenceSignal(Incidence *); 189 // void cloneIncidenceSignal(Incidence *);
187 190
188 protected: 191 protected:
189 bool mBlockUpdating; 192 bool mBlockUpdating;
190 int mUpcomingWidth; 193 int mUpcomingWidth;
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 158a7d3..b9a028b 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -190,30 +190,35 @@ void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay)
190 if(mTimeButton->isChecked()) { 190 if(mTimeButton->isChecked()) {
191 mTimeButton->setEnabled(true); 191 mTimeButton->setEnabled(true);
192 } 192 }
193 else { 193 else {
194 mTimeButton->setEnabled(false); 194 mTimeButton->setEnabled(false);
195 } 195 }
196 196
197 enableTimeEdits( !allDay ); 197 enableTimeEdits( !allDay );
198 198 if ( due.isValid() ) {
199 mDueCheck->setChecked(true);
200 enableDueEdit(true);
201 } else {
199 mDueCheck->setChecked(false); 202 mDueCheck->setChecked(false);
200 enableDueEdit(false); 203 enableDueEdit(false);
204 due = QDateTime::currentDateTime().addDays(7);
205 }
201 206
202 alarmDisable(true); 207 alarmDisable(true);
203 208
204 mStartCheck->setChecked(false); 209 mStartCheck->setChecked(false);
205 enableStartEdit(false); 210 enableStartEdit(false);
206 211
207 mDueDateEdit->setDate(due.date()); 212 mDueDateEdit->setDate(due.date());
208 mDueTimeEdit->setTime(due.time()); 213 mDueTimeEdit->setTime(due.time());
209 214 due = due.addDays(-7);
210 mStartDateEdit->setDate(QDate::currentDate()); 215 mStartDateEdit->setDate(due.date());
211 mStartTimeEdit->setTime(QTime::currentTime()); 216 mStartTimeEdit->setTime(due.time());
212 217
213 mPriorityCombo->setCurrentItem(2); 218 mPriorityCombo->setCurrentItem(2);
214 mCompletedLabel->setText(i18n("completed"));; 219 mCompletedLabel->setText(i18n("completed"));;
215 mCompletedCombo->setCurrentItem(0); 220 mCompletedCombo->setCurrentItem(0);
216} 221}
217 222
218void KOEditorGeneralTodo::readTodo(Todo *todo) 223void KOEditorGeneralTodo::readTodo(Todo *todo)
219{ 224{
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index e8d5ab1..a88276e 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -302,20 +302,25 @@ void KOViewManager::showAgendaView( bool fullScreen )
302 addView(mAgendaView); 302 addView(mAgendaView);
303#ifndef DESKTOP_VERSION 303#ifndef DESKTOP_VERSION
304 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 304 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
305#endif 305#endif
306 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 306 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
307 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 307 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
308 308
309 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 309 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
310
311
312
313 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
314 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
310 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 315 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
311 mMainView, SLOT(newEvent(QDateTime))); 316 mMainView, SLOT(newEvent(QDateTime)));
312 // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 317 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
313 // mMainView, SLOT(newEvent(QDateTime,QDateTime))); 318 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
314 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 319 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
315 mMainView, SLOT(newEvent(QDate))); 320 mMainView, SLOT(newEvent(QDate)));
316 321
317 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 322 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
318 mMainView, SLOT(editIncidence(Incidence *))); 323 mMainView, SLOT(editIncidence(Incidence *)));
319 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 324 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
320 mMainView, SLOT(showIncidence(Incidence *))); 325 mMainView, SLOT(showIncidence(Incidence *)));
321 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 326 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),