summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-31 23:55:51 (UTC)
committer zautrix <zautrix>2005-03-31 23:55:51 (UTC)
commitb76ad1e7e329051a47e28c9d132ce3fcd0b25c5c (patch) (unidiff)
treeb0b3d0eb7a3d29981c183275aadeed0cbbef0007 /korganizer
parentc0fa26aa3b33c293853bdd7d028ddb0545e33c85 (diff)
downloadkdepimpi-b76ad1e7e329051a47e28c9d132ce3fcd0b25c5c.zip
kdepimpi-b76ad1e7e329051a47e28c9d132ce3fcd0b25c5c.tar.gz
kdepimpi-b76ad1e7e329051a47e28c9d132ce3fcd0b25c5c.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagenda.cpp5
-rw-r--r--korganizer/koagenda.h2
-rw-r--r--korganizer/koagendaview.cpp15
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/komonthview.cpp7
-rw-r--r--korganizer/kotodoview.cpp81
-rw-r--r--korganizer/kotodoview.h5
-rw-r--r--korganizer/koviewmanager.cpp4
8 files changed, 98 insertions, 22 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 1a24887..9720f43 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -219,49 +219,49 @@ QDate KOAgenda::selectedIncidenceDate() const
219} 219}
220 220
221 221
222void KOAgenda::init() 222void KOAgenda::init()
223{ 223{
224 mPopupTimer = new QTimer(this); 224 mPopupTimer = new QTimer(this);
225 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 225 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
226 226
227 mNewItemPopup = new QPopupMenu( this ); 227 mNewItemPopup = new QPopupMenu( this );
228 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); 228 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
229 QString pathString = ""; 229 QString pathString = "";
230 if ( !KOPrefs::instance()->mToolBarMiniIcons ) { 230 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
231 if ( QApplication::desktop()->width() < 480 ) 231 if ( QApplication::desktop()->width() < 480 )
232 pathString += "icons16/"; 232 pathString += "icons16/";
233 } else 233 } else
234 pathString += "iconsmini/"; 234 pathString += "iconsmini/";
235 235
236 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); 236 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
237 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); 237 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
238 mNewItemPopup->insertSeparator ( ); 238 mNewItemPopup->insertSeparator ( );
239 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); 239 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 );
240 mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); 240 mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 );
241 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); 241 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 );
242 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); 242 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 );
243 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next month"),6 ); 243 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 );
244 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); 244 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
245#ifndef _WIN32_ 245#ifndef _WIN32_
246 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase 246 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase
247 viewport()->setWFlags ( wflags); 247 viewport()->setWFlags ( wflags);
248#endif 248#endif
249 mGridSpacingX = 80; 249 mGridSpacingX = 80;
250 mResizeBorderWidth = 8; 250 mResizeBorderWidth = 8;
251 mScrollBorderWidth = 8; 251 mScrollBorderWidth = 8;
252 mScrollDelay = 30; 252 mScrollDelay = 30;
253 mScrollOffset = 10; 253 mScrollOffset = 10;
254 mPaintPixmap.resize( 20,20); 254 mPaintPixmap.resize( 20,20);
255 //enableClipper(true); 255 //enableClipper(true);
256 256
257 // Grab key strokes for keyboard navigation of agenda. Seems to have no 257 // Grab key strokes for keyboard navigation of agenda. Seems to have no
258 // effect. Has to be fixed. 258 // effect. Has to be fixed.
259 setFocusPolicy(WheelFocus); 259 setFocusPolicy(WheelFocus);
260 260
261 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); 261 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp()));
262 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); 262 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown()));
263 connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); 263 connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize()));
264 264
265 mStartCellX = 0; 265 mStartCellX = 0;
266 mStartCellY = 0; 266 mStartCellY = 0;
267 mCurrentCellX = 0; 267 mCurrentCellX = 0;
@@ -733,50 +733,49 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
733 selectItem(doubleClickedItem); 733 selectItem(doubleClickedItem);
734 if ( KOPrefs::instance()->mEditOnDoubleClick ) 734 if ( KOPrefs::instance()->mEditOnDoubleClick )
735 emit editIncidenceSignal(doubleClickedItem->incidence()); 735 emit editIncidenceSignal(doubleClickedItem->incidence());
736 else 736 else
737 emit showIncidenceSignal(doubleClickedItem->incidence()); 737 emit showIncidenceSignal(doubleClickedItem->incidence());
738 } 738 }
739 break; 739 break;
740 740
741 default: 741 default:
742 break; 742 break;
743 } 743 }
744 return true; 744 return true;
745#endif 745#endif
746} 746}
747 747
748void KOAgenda::newItem( int item ) 748void KOAgenda::newItem( int item )
749{ 749{
750 if ( item == 1 ) { //new event 750 if ( item == 1 ) { //new event
751 newEventSignal(mStartCellX ,mStartCellY ); 751 newEventSignal(mStartCellX ,mStartCellY );
752 } else 752 } else
753 if ( item == 2 ) { //new event 753 if ( item == 2 ) { //new event
754 newTodoSignal(mStartCellX ,mStartCellY ); 754 newTodoSignal(mStartCellX ,mStartCellY );
755 } else 755 } else
756 { 756 {
757 QDate day = mSelectedDates[mStartCellX]; 757 emit showDateView( item, mStartCellX );
758 emit showDateView( item, day );
759 // 3Day view 758 // 3Day view
760 // 4Week view 759 // 4Week view
761 // 5Month view 760 // 5Month view
762 // 6Journal view 761 // 6Journal view
763 } 762 }
764} 763}
765void KOAgenda::startSelectAction(QPoint viewportPos) 764void KOAgenda::startSelectAction(QPoint viewportPos)
766{ 765{
767 //emit newStartSelectSignal(); 766 //emit newStartSelectSignal();
768 767
769 mActionType = SELECT; 768 mActionType = SELECT;
770 769
771 int x,y; 770 int x,y;
772 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 771 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
773 int gx,gy; 772 int gx,gy;
774 contentsToGrid(x,y,gx,gy); 773 contentsToGrid(x,y,gx,gy);
775 774
776 mStartCellX = gx; 775 mStartCellX = gx;
777 mStartCellY = gy; 776 mStartCellY = gy;
778 mCurrentCellX = gx; 777 mCurrentCellX = gx;
779 mCurrentCellY = gy; 778 mCurrentCellY = gy;
780 779
781 // Store coordinates of old selection 780 // Store coordinates of old selection
782 int selectionX = mSelectionCellX * mGridSpacingX; 781 int selectionX = mSelectionCellX * mGridSpacingX;
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 3d33ae5..35c08b6 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -124,49 +124,49 @@ class KOAgenda : public QScrollView
124 void storePosition(); 124 void storePosition();
125 void restorePosition(); 125 void restorePosition();
126 126
127 127
128 public slots: 128 public slots:
129 void popupMenu(); 129 void popupMenu();
130 void newItem( int ); 130 void newItem( int );
131 void moveChild( QWidget *, int, int ); 131 void moveChild( QWidget *, int, int );
132 void scrollUp(); 132 void scrollUp();
133 void scrollDown(); 133 void scrollDown();
134 void updateTodo( Todo * t, int , bool ); 134 void updateTodo( Todo * t, int , bool );
135 void popupAlarm(); 135 void popupAlarm();
136 136
137 void checkScrollBoundaries(int); 137 void checkScrollBoundaries(int);
138 138
139 /** Deselect selected items. This function does not emit any signals. */ 139 /** Deselect selected items. This function does not emit any signals. */
140 void deselectItem(); 140 void deselectItem();
141 /** Select item. If the argument is 0, the currently selected item gets 141 /** Select item. If the argument is 0, the currently selected item gets
142 deselected. This function emits the itemSelected(bool) signal to inform 142 deselected. This function emits the itemSelected(bool) signal to inform
143 about selection/deseelction of events. */ 143 about selection/deseelction of events. */
144 void selectItem(KOAgendaItem *); 144 void selectItem(KOAgendaItem *);
145 void finishResize(); 145 void finishResize();
146 146
147 signals: 147 signals:
148 void showDateView( int, QDate ); 148 void showDateView( int, int);
149 void newEventSignal(); 149 void newEventSignal();
150 void newEventSignal(int gx,int gy); 150 void newEventSignal(int gx,int gy);
151 void newTodoSignal(int gx,int gy); 151 void newTodoSignal(int gx,int gy);
152 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 152 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
153 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 153 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
154 void newStartSelectSignal(); 154 void newStartSelectSignal();
155 void showIncidenceSignal(Incidence *); 155 void showIncidenceSignal(Incidence *);
156 void editIncidenceSignal(Incidence *); 156 void editIncidenceSignal(Incidence *);
157 void deleteIncidenceSignal(Incidence *); 157 void deleteIncidenceSignal(Incidence *);
158 void showIncidencePopupSignal(Incidence *); 158 void showIncidencePopupSignal(Incidence *);
159 159
160 void itemModified(KOAgendaItem *item, int ); 160 void itemModified(KOAgendaItem *item, int );
161 void incidenceSelected(Incidence *); 161 void incidenceSelected(Incidence *);
162 162
163 void lowerYChanged(int); 163 void lowerYChanged(int);
164 void upperYChanged(int); 164 void upperYChanged(int);
165 165
166 void startDragSignal(Incidence *); 166 void startDragSignal(Incidence *);
167 void addToCalSignal(Incidence *, Incidence *); 167 void addToCalSignal(Incidence *, Incidence *);
168 void resizedSignal(); 168 void resizedSignal();
169 169
170 protected: 170 protected:
171 QPainter mPixPainter; 171 QPainter mPixPainter;
172 QPixmap mPaintPixmap; 172 QPixmap mPaintPixmap;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index b9909d6..2996acb 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -467,50 +467,50 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
467 467
468 468
469 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 469 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
470 mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 470 mAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
471 471
472 // make connections between dependent widgets 472 // make connections between dependent widgets
473 mTimeLabels->setAgenda(mAgenda); 473 mTimeLabels->setAgenda(mAgenda);
474 474
475 // Update widgets to reflect user preferences 475 // Update widgets to reflect user preferences
476 // updateConfig(); 476 // updateConfig();
477 477
478 // createDayLabels(); 478 // createDayLabels();
479 479
480 // these blank widgets make the All Day Event box line up with the agenda 480 // these blank widgets make the All Day Event box line up with the agenda
481 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 481 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
482 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 482 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
483 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 483 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
484 484
485 // Scrolling 485 // Scrolling
486 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), 486 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)),
487 mTimeLabels, SLOT(positionChanged())); 487 mTimeLabels, SLOT(positionChanged()));
488 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), 488 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)),
489 SLOT(setContentsPos(int))); 489 SLOT(setContentsPos(int)));
490 490
491 connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); 491 connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int )));
492 connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); 492 connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) ));
493 493
494 // Create/Show/Edit/Delete Event 494 // Create/Show/Edit/Delete Event
495 connect(mAgenda,SIGNAL(newEventSignal(int,int)), 495 connect(mAgenda,SIGNAL(newEventSignal(int,int)),
496 SLOT(newEvent(int,int))); 496 SLOT(newEvent(int,int)));
497 connect(mAgenda,SIGNAL(newTodoSignal(int,int)), 497 connect(mAgenda,SIGNAL(newTodoSignal(int,int)),
498 SLOT(newTodo(int,int))); 498 SLOT(newTodo(int,int)));
499 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), 499 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
500 SLOT(newEvent(int,int,int,int))); 500 SLOT(newEvent(int,int,int,int)));
501 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), 501 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
502 SLOT(newEventAllDay(int,int))); 502 SLOT(newEventAllDay(int,int)));
503 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), 503 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)),
504 SLOT(newTodoAllDay(int,int))); 504 SLOT(newTodoAllDay(int,int)));
505 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), 505 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
506 SLOT(newEventAllDay(int,int))); 506 SLOT(newEventAllDay(int,int)));
507 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 507 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
508 SLOT(newTimeSpanSelected(int,int,int,int))); 508 SLOT(newTimeSpanSelected(int,int,int,int)));
509 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 509 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
510 SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); 510 SLOT(newTimeSpanSelectedAllDay(int,int,int,int)));
511 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 511 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
512 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 512 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
513 513
514 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 514 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
515 SIGNAL(editIncidenceSignal(Incidence *))); 515 SIGNAL(editIncidenceSignal(Incidence *)));
516 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 516 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
@@ -1289,48 +1289,59 @@ void KOAgendaView::repaintAgenda()
1289void KOAgendaView::clearView() 1289void KOAgendaView::clearView()
1290{ 1290{
1291 // kdDebug() << "ClearView" << endl; 1291 // kdDebug() << "ClearView" << endl;
1292 mAllDayAgenda->clear(); 1292 mAllDayAgenda->clear();
1293 mAgenda->clear(); 1293 mAgenda->clear();
1294} 1294}
1295 1295
1296void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1296void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1297 const QDate &td) 1297 const QDate &td)
1298{ 1298{
1299#ifndef KORG_NOPRINTER 1299#ifndef KORG_NOPRINTER
1300 if (fd == td) 1300 if (fd == td)
1301 calPrinter->preview(CalPrinter::Day, fd, td); 1301 calPrinter->preview(CalPrinter::Day, fd, td);
1302 else 1302 else
1303 calPrinter->preview(CalPrinter::Week, fd, td); 1303 calPrinter->preview(CalPrinter::Week, fd, td);
1304#endif 1304#endif
1305} 1305}
1306 1306
1307// void KOAgendaView::updateMovedTodo() 1307// void KOAgendaView::updateMovedTodo()
1308// { 1308// {
1309// // updateConfig(); 1309// // updateConfig();
1310// // emit updateTodoViews(); 1310// // emit updateTodoViews();
1311// } 1311// }
1312 1312
1313void KOAgendaView::slotShowDateView( int mode , int d )
1314{
1315 if ( d >= mSelectedDates.count() ) {
1316 qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() );
1317
1318 } else {
1319 QDate day = mSelectedDates[d];
1320 emit showDateView(mode , day );
1321 }
1322
1323}
1313void KOAgendaView::newEvent(int gx, int gy) 1324void KOAgendaView::newEvent(int gx, int gy)
1314{ 1325{
1315 if (!mSelectedDates.count()) return; 1326 if (!mSelectedDates.count()) return;
1316 1327
1317 QDate day = mSelectedDates[gx]; 1328 QDate day = mSelectedDates[gx];
1318 1329
1319 QTime time = mAgenda->gyToTime(gy); 1330 QTime time = mAgenda->gyToTime(gy);
1320 QDateTime dt(day,time); 1331 QDateTime dt(day,time);
1321 // if ( dt < QDateTime::currentDateTime () ) 1332 // if ( dt < QDateTime::currentDateTime () )
1322 // dt = QDateTime::currentDateTime ().addSecs( 3600 ); 1333 // dt = QDateTime::currentDateTime ().addSecs( 3600 );
1323 emit newEventSignal(dt); 1334 emit newEventSignal(dt);
1324} 1335}
1325 1336
1326void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) 1337void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd)
1327{ 1338{
1328 if (!mSelectedDates.count()) return; 1339 if (!mSelectedDates.count()) return;
1329 1340
1330 QDate dayStart = mSelectedDates[gxStart]; 1341 QDate dayStart = mSelectedDates[gxStart];
1331 QDate dayEnd = mSelectedDates[gxEnd]; 1342 QDate dayEnd = mSelectedDates[gxEnd];
1332 1343
1333 QTime timeStart = mAgenda->gyToTime(gyStart); 1344 QTime timeStart = mAgenda->gyToTime(gyStart);
1334 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); 1345 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 );
1335 1346
1336 QDateTime dtStart(dayStart,timeStart); 1347 QDateTime dtStart(dayStart,timeStart);
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 57b4e46..6dc81c6 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -185,48 +185,49 @@ class KOAgendaView : public KOEventView {
185 virtual void showEvents(QPtrList<Event> eventList); 185 virtual void showEvents(QPtrList<Event> eventList);
186 186
187 void updateTodo( Todo *, int ); 187 void updateTodo( Todo *, int );
188 void changeEventDisplay(Event *, int); 188 void changeEventDisplay(Event *, int);
189 189
190 void clearSelection(); 190 void clearSelection();
191 191
192 void newTodo(int gx,int gy); 192 void newTodo(int gx,int gy);
193 void newEvent(int gx,int gy); 193 void newEvent(int gx,int gy);
194 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); 194 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
195 void newEventAllDay(int gx, int gy); 195 void newEventAllDay(int gx, int gy);
196 void newTodoAllDay(int gx, int gy); 196 void newTodoAllDay(int gx, int gy);
197 197
198 void startDrag(Event *); 198 void startDrag(Event *);
199 199
200 void readSettings(); 200 void readSettings();
201 void readSettings(KConfig *); 201 void readSettings(KConfig *);
202 void writeSettings(KConfig *); 202 void writeSettings(KConfig *);
203 203
204 void setContentsPos(int y); 204 void setContentsPos(int y);
205 205
206 void scrollOneHourUp(); 206 void scrollOneHourUp();
207 void scrollOneHourDown(); 207 void scrollOneHourDown();
208 void addToCalSlot(Incidence *, Incidence *); 208 void addToCalSlot(Incidence *, Incidence *);
209 void slotShowDateView( int, int );
209 210
210 signals: 211 signals:
211 void showDateView( int, QDate ); 212 void showDateView( int, QDate );
212 void newTodoSignal( QDateTime ,bool ); 213 void newTodoSignal( QDateTime ,bool );
213 void toggleExpand(); 214 void toggleExpand();
214 void selectWeekNum( int ); 215 void selectWeekNum( int );
215 void todoMoved( Todo *, int ); 216 void todoMoved( Todo *, int );
216 void incidenceChanged(Incidence * , int ); 217 void incidenceChanged(Incidence * , int );
217 // void cloneIncidenceSignal(Incidence *); 218 // void cloneIncidenceSignal(Incidence *);
218 219
219 protected: 220 protected:
220 KOAgendaButton* getNewDaylabel(); 221 KOAgendaButton* getNewDaylabel();
221 bool mBlockUpdating; 222 bool mBlockUpdating;
222 int mUpcomingWidth; 223 int mUpcomingWidth;
223 /** Fill agenda beginning with date startDate */ 224 /** Fill agenda beginning with date startDate */
224 void fillAgenda(const QDate &startDate); 225 void fillAgenda(const QDate &startDate);
225 void resizeEvent( QResizeEvent* e ); 226 void resizeEvent( QResizeEvent* e );
226 /** Fill agenda using the current set value for the start date */ 227 /** Fill agenda using the current set value for the start date */
227 void fillAgenda(); 228 void fillAgenda();
228 229
229 /** Create labels for the selected dates. */ 230 /** Create labels for the selected dates. */
230 void createDayLabels(); 231 void createDayLabels();
231 232
232 /** 233 /**
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index b9ce4f4..ab9a4b6 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -916,49 +916,53 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
916 mLabel->resize( mLabelBigSize ); 916 mLabel->resize( mLabelBigSize );
917 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 917 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
918 } else { 918 } else {
919 mLabel->resize( mLabelSize ); 919 mLabel->resize( mLabelSize );
920 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 920 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
921 } 921 }
922 mLabel->setText( text ); 922 mLabel->setText( text );
923 923
924 int size = height() - mLabel->height() - lineWidth()-1; 924 int size = height() - mLabel->height() - lineWidth()-1;
925 //qDebug("LW %d ", lineWidth()); 925 //qDebug("LW %d ", lineWidth());
926 if ( size > 0 ) 926 if ( size > 0 )
927 verticalScrollBar()->setMaximumHeight( size ); 927 verticalScrollBar()->setMaximumHeight( size );
928 size = width() - mLabel->width() -lineWidth()-1; 928 size = width() - mLabel->width() -lineWidth()-1;
929 if ( size > 0 ) 929 if ( size > 0 )
930 horizontalScrollBar()->setMaximumWidth( size ); 930 horizontalScrollBar()->setMaximumWidth( size );
931 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 931 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
932 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 932 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
933 // mItemList->resize ( width(), height () ); 933 // mItemList->resize ( width(), height () );
934 if ( e ) 934 if ( e )
935 KNoScrollListBox::resizeEvent ( e ); 935 KNoScrollListBox::resizeEvent ( e );
936} 936}
937 937
938void MonthViewCell::defaultAction( QListBoxItem *item ) 938void MonthViewCell::defaultAction( QListBoxItem *item )
939{ 939{
940 if ( !item ) return; 940 if ( !item ) {
941 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
942 emit newEventSignal( dt );
943 return;
944 }
941 945
942 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 946 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
943 Incidence *incidence = eventItem->incidence(); 947 Incidence *incidence = eventItem->incidence();
944 if ( incidence ) mMonthView->defaultAction( incidence ); 948 if ( incidence ) mMonthView->defaultAction( incidence );
945} 949}
946void MonthViewCell::showDay() 950void MonthViewCell::showDay()
947{ 951{
948 emit showDaySignal( date() ); 952 emit showDaySignal( date() );
949} 953}
950void MonthViewCell::newEvent() 954void MonthViewCell::newEvent()
951{ 955{
952 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 956 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
953 emit newEventSignal( dt ); 957 emit newEventSignal( dt );
954} 958}
955void MonthViewCell::cellClicked( QListBoxItem *item ) 959void MonthViewCell::cellClicked( QListBoxItem *item )
956{ 960{
957 static QListBoxItem * lastClicked = 0; 961 static QListBoxItem * lastClicked = 0;
958 if ( item == 0 ) { 962 if ( item == 0 ) {
959 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 963 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
960 emit newEventSignal( dt ); 964 emit newEventSignal( dt );
961 return; 965 return;
962 } 966 }
963 /* 967 /*
964 if ( lastClicked ) 968 if ( lastClicked )
@@ -1350,48 +1354,49 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
1350 int wno; 1354 int wno;
1351 // remember, according to ISO 8601, the first week of the year is the 1355 // remember, according to ISO 8601, the first week of the year is the
1352 // first week that contains a thursday. Thus we must subtract off 4, 1356 // first week that contains a thursday. Thus we must subtract off 4,
1353 // not just 1. 1357 // not just 1.
1354 int dayOfYear = date.dayOfYear(); 1358 int dayOfYear = date.dayOfYear();
1355 if (dayOfYear % 7 != 0) 1359 if (dayOfYear % 7 != 0)
1356 wno = dayOfYear / 7 + 1; 1360 wno = dayOfYear / 7 + 1;
1357 else 1361 else
1358 wno =dayOfYear / 7; 1362 wno =dayOfYear / 7;
1359 (*weekLabels)[i]->setWeekNum( wno ); 1363 (*weekLabels)[i]->setWeekNum( wno );
1360 date = date.addDays( 7 ); 1364 date = date.addDays( 7 );
1361 } 1365 }
1362 updateView(); 1366 updateView();
1363} 1367}
1364 1368
1365void KOMonthView::showEvents(QPtrList<Event>) 1369void KOMonthView::showEvents(QPtrList<Event>)
1366{ 1370{
1367 qDebug("KOMonthView::selectEvents is not implemented yet. "); 1371 qDebug("KOMonthView::selectEvents is not implemented yet. ");
1368} 1372}
1369 1373
1370void KOMonthView::changeEventDisplay(Event *, int) 1374void KOMonthView::changeEventDisplay(Event *, int)
1371{ 1375{
1372 // this should be re-written to be much more efficient, but this 1376 // this should be re-written to be much more efficient, but this
1373 // quick-and-dirty-hack gets the job done for right now. 1377 // quick-and-dirty-hack gets the job done for right now.
1378 qDebug("KOMonthView::changeEventDisplay ");
1374 updateView(); 1379 updateView();
1375} 1380}
1376 1381
1377void KOMonthView::updateView() 1382void KOMonthView::updateView()
1378{ 1383{
1379 1384
1380 if ( !updatePossible ) 1385 if ( !updatePossible )
1381 return; 1386 return;
1382 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); 1387 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU ");
1383 //QTime ti; 1388 //QTime ti;
1384 //ti.start(); 1389 //ti.start();
1385 clearSelection(); 1390 clearSelection();
1386 QPtrVector<MonthViewCell> *cells; 1391 QPtrVector<MonthViewCell> *cells;
1387 if ( mShowWeekView ) { 1392 if ( mShowWeekView ) {
1388 cells = &mCellsW; 1393 cells = &mCellsW;
1389 } else { 1394 } else {
1390 cells = &mCells; 1395 cells = &mCells;
1391 } 1396 }
1392#if 1 1397#if 1
1393 int i; 1398 int i;
1394 int timeSpan = (*cells).size()-1; 1399 int timeSpan = (*cells).size()-1;
1395 if ( KOPrefs::instance()->mMonthViewWeek ) 1400 if ( KOPrefs::instance()->mMonthViewWeek )
1396 timeSpan = 6; 1401 timeSpan = 6;
1397 for( i = 0; i < timeSpan + 1; ++i ) { 1402 for( i = 0; i < timeSpan + 1; ++i ) {
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index e008625..ccc4b01 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -243,74 +243,88 @@ void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
243 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 243 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
244 if (item) { 244 if (item) {
245 DndFactory factory( mCalendar ); 245 DndFactory factory( mCalendar );
246 ICalDrag *vd = factory.createDrag( 246 ICalDrag *vd = factory.createDrag(
247 ((KOTodoViewItem *)item)->todo(),viewport()); 247 ((KOTodoViewItem *)item)->todo(),viewport());
248 internalDrop = false; 248 internalDrop = false;
249 // we cannot do any senseful here, because the DnD is still broken in Qt 249 // we cannot do any senseful here, because the DnD is still broken in Qt
250 if (vd->drag()) { 250 if (vd->drag()) {
251 if ( !internalDrop ) { 251 if ( !internalDrop ) {
252 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); 252 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() );
253 qDebug("Dnd: External move: Delete drag source "); 253 qDebug("Dnd: External move: Delete drag source ");
254 } else 254 } else
255 qDebug("Dnd: Internal move "); 255 qDebug("Dnd: Internal move ");
256 256
257 } else { 257 } else {
258 if ( !internalDrop ) { 258 if ( !internalDrop ) {
259 qDebug("Dnd: External Copy"); 259 qDebug("Dnd: External Copy");
260 } else 260 } else
261 qDebug("DnD: Internal copy: Copy pending"); 261 qDebug("DnD: Internal copy: Copy pending");
262 } 262 }
263 } 263 }
264 } 264 }
265#endif 265#endif
266} 266}
267void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 267void KOTodoListView::keyReleaseEvent ( QKeyEvent *e )
268{ 268{
269 if ( !e->isAutoRepeat() ) {
270 mFlagKeyPressed = false;
271 }
272}
273
269 274
275void KOTodoListView::keyPressEvent ( QKeyEvent * e )
276{
277 qApp->processEvents();
278 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
279 e->ignore();
280 // qDebug(" ignore %d",e->isAutoRepeat() );
281 return;
282 }
283 if (! e->isAutoRepeat() )
284 mFlagKeyPressed = true;
270 QListViewItem* cn; 285 QListViewItem* cn;
271 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 286 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
272 cn = currentItem(); 287 cn = currentItem();
273 if ( cn ) { 288 if ( cn ) {
274 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 289 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
275 if ( ci ){ 290 if ( ci ){
276 if ( e->state() == ShiftButton ) 291 if ( e->state() == ShiftButton )
277 ci->setOn( false ); 292 ci->setOn( false );
278 else 293 else
279 ci->setOn( true ); 294 ci->setOn( true );
280 cn = cn->itemBelow(); 295 cn = cn->itemBelow();
281 if ( cn ) { 296 if ( cn ) {
282 setCurrentItem ( cn ); 297 setCurrentItem ( cn );
283 ensureItemVisible ( cn ); 298 ensureItemVisible ( cn );
284 } 299 }
285 300
286 } 301 }
287 } 302 }
288 303
289 return; 304 return;
290 } 305 }
291 306
292 // qDebug("KOTodoListView::keyPressEvent ");
293 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 307 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
294 switch ( e->key() ) { 308 switch ( e->key() ) {
295 case Qt::Key_Down: 309 case Qt::Key_Down:
296 case Qt::Key_Up: 310 case Qt::Key_Up:
297 QListView::keyPressEvent ( e ); 311 QListView::keyPressEvent ( e );
298 break; 312 break;
299 case Qt::Key_Left: 313 case Qt::Key_Left:
300 case Qt::Key_Right: 314 case Qt::Key_Right:
301 QListView::keyPressEvent ( e ); 315 QListView::keyPressEvent ( e );
302 e->accept(); 316 e->accept();
303 return; 317 return;
304 break; 318 break;
305 default: 319 default:
306 e->ignore(); 320 e->ignore();
307 break; 321 break;
308 } 322 }
309 return; 323 return;
310 } 324 }
311 e->ignore(); 325 e->ignore();
312} 326}
313void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 327void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
314{ 328{
315 QListView::contentsMouseReleaseEvent(e); 329 QListView::contentsMouseReleaseEvent(e);
316 mMousePressed = false; 330 mMousePressed = false;
@@ -577,60 +591,59 @@ void KOTodoView::paintNeeded()
577 if ( mPendingUpdateBeforeRepaint ) { 591 if ( mPendingUpdateBeforeRepaint ) {
578 updateView(); 592 updateView();
579 mPendingUpdateBeforeRepaint = false; 593 mPendingUpdateBeforeRepaint = false;
580 } 594 }
581} 595}
582void KOTodoView::paintEvent(QPaintEvent * pevent) 596void KOTodoView::paintEvent(QPaintEvent * pevent)
583{ 597{
584 if ( mPendingUpdateBeforeRepaint ) { 598 if ( mPendingUpdateBeforeRepaint ) {
585 updateView(); 599 updateView();
586 mPendingUpdateBeforeRepaint = false; 600 mPendingUpdateBeforeRepaint = false;
587 } 601 }
588 KOrg::BaseView::paintEvent( pevent); 602 KOrg::BaseView::paintEvent( pevent);
589} 603}
590 604
591void KOTodoView::updateView() 605void KOTodoView::updateView()
592{ 606{
593 pendingSubtodo = 0; 607 pendingSubtodo = 0;
594 if ( mBlockUpdate ) { 608 if ( mBlockUpdate ) {
595 return; 609 return;
596 } 610 }
597 if ( !isVisible() ) { 611 if ( !isVisible() ) {
598 mPendingUpdateBeforeRepaint = true; 612 mPendingUpdateBeforeRepaint = true;
599 return; 613 return;
600 } 614 }
615 storeCurrentItem();
601 //qDebug("KOTodoView::updateView() %x", this); 616 //qDebug("KOTodoView::updateView() %x", this);
602 if ( isFlatDisplay ) { 617 if ( isFlatDisplay ) {
603 displayAllFlat(); 618 displayAllFlat();
619 resetCurrentItem();
604 return; 620 return;
605 } 621 }
606 //qDebug("update "); 622 //qDebug("update ");
607// kdDebug() << "KOTodoView::updateView()" << endl; 623// kdDebug() << "KOTodoView::updateView()" << endl;
608 QFont fo = KOPrefs::instance()->mTodoViewFont; 624 QFont fo = KOPrefs::instance()->mTodoViewFont;
609 Incidence* oldInc = 0; 625
610 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
611 if (mActiveItem)
612 oldInc = mActiveItem->todo();
613 626
614 mTodoListView->clear(); 627 mTodoListView->clear();
615 if ( mName == "todolistsmall" ) { 628 if ( mName == "todolistsmall" ) {
616 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 629 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
617 int ps = fo.pointSize() -2; 630 int ps = fo.pointSize() -2;
618 if ( ps > 12 ) 631 if ( ps > 12 )
619 ps -= 2; 632 ps -= 2;
620 fo.setPointSize( ps ); 633 fo.setPointSize( ps );
621 } 634 }
622 } 635 }
623 636
624 mTodoListView->setFont( fo ); 637 mTodoListView->setFont( fo );
625 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 638 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
626 //mTodoListView->header()->setMaximumHeight(fm.height()); 639 //mTodoListView->header()->setMaximumHeight(fm.height());
627 QPtrList<Todo> todoList = calendar()->todos(); 640 QPtrList<Todo> todoList = calendar()->todos();
628 641
629/* 642/*
630 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 643 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
631 Event *t; 644 Event *t;
632 for(t = todoList.first(); t; t = todoList.next()) { 645 for(t = todoList.first(); t; t = todoList.next()) {
633 kdDebug() << " " << t->getSummary() << endl; 646 kdDebug() << " " << t->getSummary() << endl;
634 647
635 if (t->getRelatedTo()) { 648 if (t->getRelatedTo()) {
636 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 649 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
@@ -670,69 +683,108 @@ void KOTodoView::updateView()
670 } 683 }
671 } else 684 } else
672 incidence = 0; 685 incidence = 0;
673 } 686 }
674 if ( next ) 687 if ( next )
675 todo = todoList.next(); 688 todo = todoList.next();
676 } 689 }
677// qDebug("again .... "); 690// qDebug("again .... ");
678// for(todo = todoList.first(); todo; todo = todoList.next()) { 691// for(todo = todoList.first(); todo; todo = todoList.next()) {
679 692
680// qDebug("yytodo %s ", todo->summary().latin1()); 693// qDebug("yytodo %s ", todo->summary().latin1());
681// } 694// }
682 //qDebug("for "); 695 //qDebug("for ");
683 for(todo = todoList.first(); todo; todo = todoList.next()) { 696 for(todo = todoList.first(); todo; todo = todoList.next()) {
684 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 697 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
685 { 698 {
686 insertTodoItem(todo); 699 insertTodoItem(todo);
687 } 700 }
688 } 701 }
689 //qDebug("for end "); 702 //qDebug("for end ");
690 // Restore opened/closed state 703 // Restore opened/closed state
691 mTodoListView->blockSignals( true ); 704 mTodoListView->blockSignals( true );
692 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 705 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
693 mTodoListView->blockSignals( false ); 706 mTodoListView->blockSignals( false );
707 resetCurrentItem();
708 processSelectionChange();
709}
710
711void KOTodoView::storeCurrentItem()
712{
713 mCurItem = 0;
714 mCurItemRootParent = 0;
715 mCurItemAbove = 0;
716 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
717 if (mActiveItem) {
718 mCurItem = mActiveItem->todo();
719 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
720 if ( activeItemAbove )
721 mCurItemAbove = activeItemAbove->todo();
722 while ( mActiveItem->parent() != 0 )
723 mActiveItem = (KOTodoViewItem*)mActiveItem->parent();
724 mCurItemRootParent = mActiveItem->todo();
725 }
726 mActiveItem = 0;
727}
728
729void KOTodoView::resetCurrentItem()
730{
694 mTodoListView->setFocus(); 731 mTodoListView->setFocus();
732 KOTodoViewItem* foundItem = 0;
733 KOTodoViewItem* foundItemRoot = 0;
734 KOTodoViewItem* foundItemAbove = 0;
695 if ( mTodoListView->firstChild () ) { 735 if ( mTodoListView->firstChild () ) {
696 if ( oldInc ) { 736 if ( mCurItem ) {
697 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); 737 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
698 while ( item ) { 738 while ( item ) {
699 if ( item->todo() == oldInc ) { 739 if ( item->todo() == mCurItem ) {
700 mTodoListView->setCurrentItem( item ); 740 foundItem = item;
701 mTodoListView->ensureItemVisible( item );
702 break; 741 break;
742 } else if ( item->todo() == mCurItemAbove ) {
743 foundItemAbove = item;
744
745 } else if ( item->todo() == mCurItemRootParent ) {
746 foundItemRoot = item;
703 } 747 }
704 item = (KOTodoViewItem*)item->itemBelow(); 748 item = (KOTodoViewItem*)item->itemBelow();
705 } 749 }
706 if ( ! item ) 750 if ( ! foundItem ) {
707 mTodoListView->setCurrentItem( mTodoListView->firstChild () ); 751 if ( foundItemAbove )
752 foundItem = foundItemAbove;
753 else
754 foundItem = foundItemRoot;
755 }
756 }
757 if ( foundItem ) {
758 mTodoListView->setCurrentItem( foundItem );
759 mTodoListView->ensureItemVisible( foundItem );
708 } else { 760 } else {
709 mTodoListView->setCurrentItem( mTodoListView->firstChild () ); 761 mTodoListView->setCurrentItem( mTodoListView->firstChild () );
710 } 762 }
711 } 763 }
712 processSelectionChange(); 764 mTodoListView->setFocus();
713} 765}
714 766//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
715bool KOTodoView::checkTodo( Todo * todo ) 767bool KOTodoView::checkTodo( Todo * todo )
716{ 768{
717 769
718 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) 770 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
719 return false; 771 return false;
720 if ( !todo->isCompleted() ) { 772 if ( !todo->isCompleted() ) {
721 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) 773 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
722 return true; 774 return true;
723 } 775 }
724 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { 776 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
725 if ( todo->hasStartDate() ) 777 if ( todo->hasStartDate() )
726 if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) 778 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
727 return false; 779 return false;
728 if ( todo->hasDueDate() ) 780 if ( todo->hasDueDate() )
729 if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) 781 if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
730 return false; 782 return false;
731 } 783 }
732 return true; 784 return true;
733} 785}
734 786
735void KOTodoView::restoreItemState( QListViewItem *item ) 787void KOTodoView::restoreItemState( QListViewItem *item )
736{ 788{
737 pendingSubtodo = 0; 789 pendingSubtodo = 0;
738 while( item ) { 790 while( item ) {
@@ -1218,48 +1270,49 @@ void KOTodoView::toggleCompleted()
1218 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; 1270 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo;
1219 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 1271 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
1220 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 1272 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
1221 updateView(); 1273 updateView();
1222} 1274}
1223 1275
1224void KOTodoView::addQuickTodo() 1276void KOTodoView::addQuickTodo()
1225{ 1277{
1226 Todo *todo = new Todo(); 1278 Todo *todo = new Todo();
1227 todo->setSummary(mQuickAdd->text()); 1279 todo->setSummary(mQuickAdd->text());
1228 todo->setOrganizer(KOPrefs::instance()->email()); 1280 todo->setOrganizer(KOPrefs::instance()->email());
1229 CalFilter * cf = mCalendar->filter(); 1281 CalFilter * cf = mCalendar->filter();
1230 if ( cf ) { 1282 if ( cf ) {
1231 if ( cf->isEnabled()&& cf->showCategories()) { 1283 if ( cf->isEnabled()&& cf->showCategories()) {
1232 todo->setCategories(cf->categoryList()); 1284 todo->setCategories(cf->categoryList());
1233 } 1285 }
1234 if ( cf->isEnabled() ) 1286 if ( cf->isEnabled() )
1235 todo->setSecrecy( cf->getSecrecy()); 1287 todo->setSecrecy( cf->getSecrecy());
1236 } 1288 }
1237 mCalendar->addTodo(todo); 1289 mCalendar->addTodo(todo);
1238 mQuickAdd->setText(""); 1290 mQuickAdd->setText("");
1239 todoModified (todo, KOGlobals::EVENTADDED ); 1291 todoModified (todo, KOGlobals::EVENTADDED );
1240 updateView(); 1292 updateView();
1241} 1293}
1294
1242void KOTodoView::keyPressEvent ( QKeyEvent * e ) 1295void KOTodoView::keyPressEvent ( QKeyEvent * e )
1243{ 1296{
1244 // e->ignore(); 1297 // e->ignore();
1245 //return; 1298 //return;
1246 //qDebug("KOTodoView::keyPressEvent "); 1299 //qDebug("KOTodoView::keyPressEvent ");
1247 switch ( e->key() ) { 1300 switch ( e->key() ) {
1248 case Qt::Key_Down: 1301 case Qt::Key_Down:
1249 case Qt::Key_Up: 1302 case Qt::Key_Up:
1250 QWidget::keyPressEvent ( e ); 1303 QWidget::keyPressEvent ( e );
1251 break; 1304 break;
1252 1305
1253 case Qt::Key_Q: 1306 case Qt::Key_Q:
1254 toggleQuickTodo(); 1307 toggleQuickTodo();
1255 break; 1308 break;
1256 case Qt::Key_U: 1309 case Qt::Key_U:
1257 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1310 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1258 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1311 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1259 unparentTodo(); 1312 unparentTodo();
1260 e->accept(); 1313 e->accept();
1261 } else 1314 } else
1262 e->ignore(); 1315 e->ignore();
1263 break; 1316 break;
1264 case Qt::Key_S: 1317 case Qt::Key_S:
1265 if ( e->state() == Qt::ControlButton ) { 1318 if ( e->state() == Qt::ControlButton ) {
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index eab0754..e553d0e 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -65,49 +65,51 @@ class KOTodoListView : public KListView
65 void todoDropped(Todo *, int); 65 void todoDropped(Todo *, int);
66 void double_Clicked(QListViewItem *item); 66 void double_Clicked(QListViewItem *item);
67 void reparentTodoSignal( Todo *,Todo * ); 67 void reparentTodoSignal( Todo *,Todo * );
68 void unparentTodoSignal(Todo *); 68 void unparentTodoSignal(Todo *);
69 void deleteTodo( Todo * ); 69 void deleteTodo( Todo * );
70 protected: 70 protected:
71 void contentsDragEnterEvent(QDragEnterEvent *); 71 void contentsDragEnterEvent(QDragEnterEvent *);
72 void contentsDragMoveEvent(QDragMoveEvent *); 72 void contentsDragMoveEvent(QDragMoveEvent *);
73 void contentsDragLeaveEvent(QDragLeaveEvent *); 73 void contentsDragLeaveEvent(QDragLeaveEvent *);
74 void contentsDropEvent(QDropEvent *); 74 void contentsDropEvent(QDropEvent *);
75 75
76 void contentsMousePressEvent(QMouseEvent *); 76 void contentsMousePressEvent(QMouseEvent *);
77 void contentsMouseMoveEvent(QMouseEvent *); 77 void contentsMouseMoveEvent(QMouseEvent *);
78 void contentsMouseReleaseEvent(QMouseEvent *); 78 void contentsMouseReleaseEvent(QMouseEvent *);
79 void contentsMouseDoubleClickEvent(QMouseEvent *); 79 void contentsMouseDoubleClickEvent(QMouseEvent *);
80 80
81 private: 81 private:
82 void paintEvent(QPaintEvent * pevent); 82 void paintEvent(QPaintEvent * pevent);
83 bool internalDrop; 83 bool internalDrop;
84 QString mName; 84 QString mName;
85 Calendar *mCalendar; 85 Calendar *mCalendar;
86 QPoint mPressPos; 86 QPoint mPressPos;
87 bool mMousePressed; 87 bool mMousePressed;
88 QListViewItem *mOldCurrent; 88 QListViewItem *mOldCurrent;
89 bool mFlagKeyPressed;
89 void keyPressEvent ( QKeyEvent * ) ; 90 void keyPressEvent ( QKeyEvent * ) ;
91 void keyReleaseEvent ( QKeyEvent * ) ;
90}; 92};
91 93
92 94
93/** 95/**
94 This is the line-edit on top of the todoview for fast addition of new todos 96 This is the line-edit on top of the todoview for fast addition of new todos
95*/ 97*/
96class KOQuickTodo : public QLineEdit 98class KOQuickTodo : public QLineEdit
97{ 99{
98 public: 100 public:
99 KOQuickTodo(QWidget *parent=0); 101 KOQuickTodo(QWidget *parent=0);
100 protected: 102 protected:
101 void focusInEvent(QFocusEvent *ev); 103 void focusInEvent(QFocusEvent *ev);
102 void focusOutEvent(QFocusEvent *ev); 104 void focusOutEvent(QFocusEvent *ev);
103}; 105};
104 106
105 107
106/** 108/**
107 This class provides a multi-column list view of todo events. 109 This class provides a multi-column list view of todo events.
108 110
109 @short multi-column list view of todo events. 111 @short multi-column list view of todo events.
110 @author Cornelius Schumacher <schumacher@kde.org> 112 @author Cornelius Schumacher <schumacher@kde.org>
111*/ 113*/
112class KOTodoView : public KOrg::BaseView 114class KOTodoView : public KOrg::BaseView
113{ 115{
@@ -231,27 +233,30 @@ class KOTodoView : public KOrg::BaseView
231 bool isFlatDisplay; 233 bool isFlatDisplay;
232 void setOpen( QListViewItem*, bool setOpen); 234 void setOpen( QListViewItem*, bool setOpen);
233 KOTodoListView *mTodoListView; 235 KOTodoListView *mTodoListView;
234 QPopupMenu *mItemPopupMenu; 236 QPopupMenu *mItemPopupMenu;
235 QPopupMenu *mPopupMenu; 237 QPopupMenu *mPopupMenu;
236 QPopupMenu *mPriorityPopupMenu; 238 QPopupMenu *mPriorityPopupMenu;
237 QPopupMenu *mPercentageCompletedPopupMenu; 239 QPopupMenu *mPercentageCompletedPopupMenu;
238 QPopupMenu *mCategoryPopupMenu; 240 QPopupMenu *mCategoryPopupMenu;
239 241
240 QMap<int, int> mPercentage; 242 QMap<int, int> mPercentage;
241 QMap<int, int> mPriority; 243 QMap<int, int> mPriority;
242 QMap<int, QString> mCategory; 244 QMap<int, QString> mCategory;
243 KOTodoViewItem *mActiveItem; 245 KOTodoViewItem *mActiveItem;
244 246
245 QMap<Todo *,KOTodoViewItem *> mTodoMap; 247 QMap<Todo *,KOTodoViewItem *> mTodoMap;
246 QString mName; 248 QString mName;
247 249
248 DocPrefs *mDocPrefs; 250 DocPrefs *mDocPrefs;
249 QString mCurrentDoc; 251 QString mCurrentDoc;
250 KOQuickTodo *mQuickAdd; 252 KOQuickTodo *mQuickAdd;
251 bool mBlockUpdate; 253 bool mBlockUpdate;
252 void keyPressEvent ( QKeyEvent * ) ; 254 void keyPressEvent ( QKeyEvent * ) ;
253 KOTodoViewItem * pendingSubtodo; 255 KOTodoViewItem * pendingSubtodo;
254 DateNavigator* mNavigator; 256 DateNavigator* mNavigator;
257 void storeCurrentItem();
258 void resetCurrentItem();
259 Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
255}; 260};
256 261
257#endif 262#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index f97aa98..c442d0b 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -117,49 +117,49 @@ void KOViewManager::showDateView( int view, QDate date)
117 static bool lastNDMode = false; 117 static bool lastNDMode = false;
118 static QDate lastDate; 118 static QDate lastDate;
119 //qDebug("date %d %s", view, date.toString().latin1()); 119 //qDebug("date %d %s", view, date.toString().latin1());
120 120
121 if (view != 9) 121 if (view != 9)
122 lastMode = 0; 122 lastMode = 0;
123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
124 bool savemFlagShowNextxDays = mFlagShowNextxDays; 124 bool savemFlagShowNextxDays = mFlagShowNextxDays;
125 mFlagShowNextxDays = false; 125 mFlagShowNextxDays = false;
126 if ( view == 3 ) { 126 if ( view == 3 ) {
127 //mCurrentAgendaView = 1 ; 127 //mCurrentAgendaView = 1 ;
128 lastDate = mMainView->dateNavigator()->selectedDates().first(); 128 lastDate = mMainView->dateNavigator()->selectedDates().first();
129 lastCount = mMainView->dateNavigator()->selectedDates().count(); 129 lastCount = mMainView->dateNavigator()->selectedDates().count();
130 lastNDMode = savemFlagShowNextxDays; 130 lastNDMode = savemFlagShowNextxDays;
131 mMainView->dateNavigator()->selectDate( date ); 131 mMainView->dateNavigator()->selectDate( date );
132 lastMode = 1; 132 lastMode = 1;
133 mCurrentAgendaView = 1 ; 133 mCurrentAgendaView = 1 ;
134 } else if (view == 4 ) { 134 } else if (view == 4 ) {
135 mCurrentAgendaView = 7 ; 135 mCurrentAgendaView = 7 ;
136 mMainView->dateNavigator()->selectDates( date, 7 ); 136 mMainView->dateNavigator()->selectDates( date, 7 );
137 } else if (view == 5 ) { 137 } else if (view == 5 ) {
138 mCurrentAgendaView = 14 ; 138 mCurrentAgendaView = 14 ;
139 mMainView->dateNavigator()->selectDates( date, 14); 139 mMainView->dateNavigator()->selectDates( date, 14);
140 } else if (view == 6 ) { 140 } else if (view == 6 ) {
141 //mMainView->dateNavigator()->selectDates( date, 7 ); 141 resetDateSilent( date,1);
142 showMonthView(); 142 showMonthView();
143 } else if (view == 7 ) { 143 } else if (view == 7 ) {
144 mMainView->dateNavigator()->selectDate( date ); 144 mMainView->dateNavigator()->selectDate( date );
145 showJournalView(); 145 showJournalView();
146 } else if (view == 8 ) { 146 } else if (view == 8 ) {
147 globalFlagBlockAgenda = 1; 147 globalFlagBlockAgenda = 1;
148 if ( mCurrentAgendaView != 3 ) 148 if ( mCurrentAgendaView != 3 )
149 mCurrentAgendaView = -1; 149 mCurrentAgendaView = -1;
150 showAgendaView(KOPrefs::instance()->mFullViewMonth); 150 showAgendaView(KOPrefs::instance()->mFullViewMonth);
151 globalFlagBlockAgenda = 2; 151 globalFlagBlockAgenda = 2;
152 mMainView->dateNavigator()->selectDates( date , 152 mMainView->dateNavigator()->selectDates( date ,
153 KOPrefs::instance()->mNextXDays ); 153 KOPrefs::instance()->mNextXDays );
154 mFlagShowNextxDays = true; 154 mFlagShowNextxDays = true;
155 mCurrentAgendaView = 3 ; 155 mCurrentAgendaView = 3 ;
156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
157 if ( lastMode ) { 157 if ( lastMode ) {
158 mCurrentAgendaView = lastCount ; 158 mCurrentAgendaView = lastCount ;
159 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 159 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
160 mFlagShowNextxDays = lastNDMode; 160 mFlagShowNextxDays = lastNDMode;
161 if ( mFlagShowNextxDays ) { 161 if ( mFlagShowNextxDays ) {
162 mCurrentAgendaView = 3 ; 162 mCurrentAgendaView = 3 ;
163 } 163 }
164 } else 164 } else
165 showWeekView(); 165 showWeekView();
@@ -368,48 +368,50 @@ void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
368void KOViewManager::updateView() 368void KOViewManager::updateView()
369{ 369{
370 // qDebug("KOViewManager::updateView() "); 370 // qDebug("KOViewManager::updateView() ");
371 // if we are updating mTodoView, we get endless recursion 371 // if we are updating mTodoView, we get endless recursion
372 if ( mTodoView == mCurrentView ) 372 if ( mTodoView == mCurrentView )
373 return; 373 return;
374 if ( mCurrentView ) mCurrentView->updateView(); 374 if ( mCurrentView ) mCurrentView->updateView();
375 375
376} 376}
377 377
378void KOViewManager::updateView(const QDate &start, const QDate &end) 378void KOViewManager::updateView(const QDate &start, const QDate &end)
379{ 379{
380 // kdDebug() << "KOViewManager::updateView()" << endl; 380 // kdDebug() << "KOViewManager::updateView()" << endl;
381 381
382 if (mCurrentView) mCurrentView->showDates(start, end); 382 if (mCurrentView) mCurrentView->showDates(start, end);
383 383
384 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 384 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
385} 385}
386 386
387 387
388void KOViewManager::updateWNview() 388void KOViewManager::updateWNview()
389{ 389{
390 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 390 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
391 mWhatsNextView->updateView(); 391 mWhatsNextView->updateView();
392 if ( mCurrentView == mMonthView && mMonthView )
393 mMonthView->updateView();
392 394
393} 395}
394void KOViewManager::showWhatsNextView() 396void KOViewManager::showWhatsNextView()
395{ 397{
396 if (!mWhatsNextView) { 398 if (!mWhatsNextView) {
397 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 399 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
398 "KOViewManager::WhatsNextView"); 400 "KOViewManager::WhatsNextView");
399 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 401 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
400 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 402 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
401 addView(mWhatsNextView); 403 addView(mWhatsNextView);
402 connect(this, SIGNAL( printWNV() ), 404 connect(this, SIGNAL( printWNV() ),
403 mWhatsNextView, SLOT( printMe() ) ); 405 mWhatsNextView, SLOT( printMe() ) );
404 } 406 }
405 globalFlagBlockAgenda = 1; 407 globalFlagBlockAgenda = 1;
406 showView(mWhatsNextView, true ); 408 showView(mWhatsNextView, true );
407 //mWhatsNextView->updateView(); 409 //mWhatsNextView->updateView();
408 410
409} 411}
410 412
411void KOViewManager::slotprintWNV() 413void KOViewManager::slotprintWNV()
412{ 414{
413 if (!mWhatsNextView) 415 if (!mWhatsNextView)
414 showWhatsNextView(); 416 showWhatsNextView();
415 emit printWNV(); 417 emit printWNV();