summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt7
-rw-r--r--korganizer/kodaymatrix.cpp30
-rw-r--r--korganizer/kodaymatrix.h2
-rw-r--r--korganizer/komonthview.cpp6
-rw-r--r--korganizer/kotodoview.cpp17
-rw-r--r--korganizer/kotodoview.h4
-rw-r--r--korganizer/koviewmanager.cpp1
7 files changed, 46 insertions, 21 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 178f92d..2858d9c 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,54 +1,61 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3 3
4********** VERSION 2.0.1 ************ 4********** VERSION 2.0.1 ************
5 5
6Oooops ... I forgot to test on the Zaurus 5500 ... 6Oooops ... I forgot to test on the Zaurus 5500 ...
7 7
8Fixed many problems of new (english) strings (and german translations) 8Fixed many problems of new (english) strings (and german translations)
9introduced in the latest versions, where the text was not fitting on the 9introduced in the latest versions, where the text was not fitting on the
10240x320 display of the Zaurus 5500. 10240x320 display of the Zaurus 5500.
11 11
12KO/Pi:
12Added a popup menu ( press pen and hold to get popup ) to the agenda view 13Added a popup menu ( press pen and hold to get popup ) to the agenda view
13with many useful items (add event/todo, show next week, two weeks, month, journal). 14with many useful items (add event/todo, show next week, two weeks, month, journal).
14 15
15Added items to the todolist popup menu for: 16Added items to the todolist popup menu for:
16Display all opened, all closed or all todos flat. 17Display all opened, all closed or all todos flat.
17The "flat" view makes is possible to sort all todos after ,e.g., prio or date. 18The "flat" view makes is possible to sort all todos after ,e.g., prio or date.
18Made the reparenting of todos on the desktop possible via Drag&Drop. 19Made the reparenting of todos on the desktop possible via Drag&Drop.
19Fixed several bugs in setting the completed datetime for todos. 20Fixed several bugs in setting the completed datetime for todos.
20Added info about completed datetime of todos to the todo viewer. 21Added info about completed datetime of todos to the todo viewer.
21Now displaying a completed todo (with completed datetime set) in the agenda view 22Now displaying a completed todo (with completed datetime set) in the agenda view
22at the time of the completion. Such that now it is possible to see in the agenda view 23at the time of the completion. Such that now it is possible to see in the agenda view
23when what todo was completed. 24when what todo was completed.
24Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. 25Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos.
25Now the behaviour is: 26Now the behaviour is:
26Setting a parent to complete sets all (sub)childs to complete. 27Setting a parent to complete sets all (sub)childs to complete.
27Setting a parent to uncomplete does not change the childs. 28Setting a parent to uncomplete does not change the childs.
28Setting a child to uncomplete sets all parent to uncomplete. 29Setting a child to uncomplete sets all parent to uncomplete.
29Setting a child to complete does not change the parents. 30Setting a child to complete does not change the parents.
30 31
32Smart updating and double buffering of the daymatrix.
33Showing holidays in the day matrix.
34Many other small performance updates.
35
36Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode.
37
31Now the translation file usertranslation.txt is supposed to be in utf8 format. 38Now the translation file usertranslation.txt is supposed to be in utf8 format.
32If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. 39If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu.
33 40
34 41
35********** VERSION 2.0.0 ************ 42********** VERSION 2.0.0 ************
36 43
37Stable release 2.0.0! 44Stable release 2.0.0!
38 45
39KO/Pi: 46KO/Pi:
40Fixed problem in edit dialog recreation at startup. 47Fixed problem in edit dialog recreation at startup.
41Made "toggle view*" menu items enabled context sensitive. 48Made "toggle view*" menu items enabled context sensitive.
42Changed agenda size menu to items 1-10. 49Changed agenda size menu to items 1-10.
43Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. 50Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down.
44Usebility enhancements in the KO/Pi menus. 51Usebility enhancements in the KO/Pi menus.
45Birthday import now adds year to summary. 52Birthday import now adds year to summary.
46What's Next view shows age in years for birthday. 53What's Next view shows age in years for birthday.
47 54
48OM/Pi: 55OM/Pi:
49Added three info lines to display subject, from and to of selected mails. 56Added three info lines to display subject, from and to of selected mails.
50 57
51KA/Pi: 58KA/Pi:
52Fixed jump bar behaviour on Zaurus. 59Fixed jump bar behaviour on Zaurus.
53Now KA/Pi search field supports searching for a range of starting characters. 60Now KA/Pi search field supports searching for a range of starting characters.
54E.g. to search for all contact beginning with b to n, type 61E.g. to search for all contact beginning with b to n, type
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index ca896b5..549ef2a 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -191,125 +191,118 @@ void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
191void KODayMatrix::recalculateToday() 191void KODayMatrix::recalculateToday()
192{ 192{
193 today = -1; 193 today = -1;
194 for (int i=0; i<NUMDAYS; i++) { 194 for (int i=0; i<NUMDAYS; i++) {
195 events[i] = 0; 195 events[i] = 0;
196 days[i] = startdate.addDays(i); 196 days[i] = startdate.addDays(i);
197 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 197 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
198 198
199 // if today is in the currently displayed month, hilight today 199 // if today is in the currently displayed month, hilight today
200 if (days[i].year() == QDate::currentDate().year() && 200 if (days[i].year() == QDate::currentDate().year() &&
201 days[i].month() == QDate::currentDate().month() && 201 days[i].month() == QDate::currentDate().month() &&
202 days[i].day() == QDate::currentDate().day()) { 202 days[i].day() == QDate::currentDate().day()) {
203 today = i; 203 today = i;
204 } 204 }
205 } 205 }
206 // qDebug(QString("Today is visible at %1.").arg(today)); 206 // qDebug(QString("Today is visible at %1.").arg(today));
207} 207}
208 208
209void KODayMatrix::updateView() 209void KODayMatrix::updateView()
210{ 210{
211 updateView(startdate); 211 updateView(startdate);
212} 212}
213void KODayMatrix::repaintViewTimed() 213void KODayMatrix::repaintViewTimed()
214{ 214{
215 qDebug("KODayMatrix::repaintViewTimed ");
216 mRepaintTimer->stop(); 215 mRepaintTimer->stop();
217 repaint(false); 216 repaint(false);
218} 217}
219void KODayMatrix::updateViewTimed() 218void KODayMatrix::updateViewTimed()
220{ 219{
221 220
222 mUpdateTimer->stop(); 221 mUpdateTimer->stop();
223 qDebug("KODayMatrix::updateView(QDate actdate)");
224 for(int i = 0; i < NUMDAYS; i++) { 222 for(int i = 0; i < NUMDAYS; i++) {
225
226 // if events are set for the day then remember to draw it bold 223 // if events are set for the day then remember to draw it bold
227 QPtrList<Event> eventlist = mCalendar->events(days[i]); 224 QPtrList<Event> eventlist = mCalendar->events(days[i]);
228 Event *event; 225 Event *event;
229 int numEvents = eventlist.count(); 226 int numEvents = eventlist.count();
230 227 QString holiStr = "";
231 for(event=eventlist.first();event != 0;event=eventlist.next()) { 228 for(event=eventlist.first();event != 0;event=eventlist.next()) {
232 ushort recurType = event->recurrence()->doesRecur(); 229 ushort recurType = event->recurrence()->doesRecur();
233
234 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 230 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
235 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 231 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
236 numEvents--; 232 numEvents--;
237 } 233 }
234 if ( event->categories().contains( i18n("Holiday") ) || event->categories().contains( "Holiday" )) {
235 if ( !holiStr.isEmpty() )
236 holiStr += "\n";
237 holiStr += event->summary();
238 }
238 } 239 }
239 events[i] = numEvents; 240 events[i] = numEvents;
240
241 //if it is a holy day then draw it red. Sundays are consider holidays, too 241 //if it is a holy day then draw it red. Sundays are consider holidays, too
242#ifndef KORG_NOPLUGINS
243 QString holiStr = KOCore::self()->holiday(days[i]);
244#else
245 QString holiStr = QString::null;
246#endif
247 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || 242 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) ||
248 !holiStr.isEmpty()) { 243 !holiStr.isEmpty()) {
249 if (holiStr.isNull()) holiStr = "";
250 mHolidays[i] = holiStr; 244 mHolidays[i] = holiStr;
251
252 } else { 245 } else {
253 mHolidays[i] = QString::null; 246 mHolidays[i] = QString::null;
254 } 247 }
255 } 248 }
256 if ( ! mPendingUpdateBeforeRepaint ) 249 if ( ! mPendingUpdateBeforeRepaint )
257 repaint(false); 250 repaint(false);
258 } 251 }
259void KODayMatrix::updateView(QDate actdate) 252void KODayMatrix::updateView(QDate actdate)
260{ 253{
261 254
262 if ( ! actdate.isValid() ) { 255 if ( ! actdate.isValid() ) {
263 //qDebug("date not valid "); 256 //qDebug("date not valid ");
264 return; 257 return;
265 } 258 }
266 mDayChanged = false; 259 mDayChanged = false;
267 //flag to indicate if the starting day of the matrix has changed by this call 260 //flag to indicate if the starting day of the matrix has changed by this call
268 //mDayChanged = false; 261 //mDayChanged = false;
269 // if a new startdate is to be set then apply Cornelius's calculation 262 // if a new startdate is to be set then apply Cornelius's calculation
270 // of the first day to be shown 263 // of the first day to be shown
271 if (actdate != startdate) { 264 if (actdate != startdate) {
272 // reset index of selection according to shift of starting date from startdate to actdate 265 // reset index of selection according to shift of starting date from startdate to actdate
273 if (mSelStart != NOSELECTION) { 266 if (mSelStart != NOSELECTION) {
274 int tmp = actdate.daysTo(startdate); 267 int tmp = actdate.daysTo(startdate);
275 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; 268 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl;
276 // shift selection if new one would be visible at least partly ! 269 // shift selection if new one would be visible at least partly !
277 270
278 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { 271 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) {
279 // nested if is required for next X display pushed from a different month - correction required 272 // nested if is required for next X display pushed from a different month - correction required
280 // otherwise, for month forward and backward, it must be avoided 273 // otherwise, for month forward and backward, it must be avoided
281 if( mSelStart > NUMDAYS || mSelStart < 0 ) 274 if( mSelStart > NUMDAYS || mSelStart < 0 )
282 mSelStart = mSelStart + tmp; 275 mSelStart = mSelStart + tmp;
283 if( mSelEnd > NUMDAYS || mSelEnd < 0 ) 276 if( mSelEnd > NUMDAYS || mSelEnd < 0 )
284 mSelEnd = mSelEnd + tmp; 277 mSelEnd = mSelEnd + tmp;
285 } 278 }
286 } 279 }
287 startdate = actdate; 280 startdate = actdate;
288 mDayChanged = true; 281 mDayChanged = true;
289 recalculateToday(); 282 recalculateToday();
290 } 283 }
291 qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); 284 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
292 if ( !isVisible() ) { 285 if ( !isVisible() ) {
293 mPendingUpdateBeforeRepaint = true; 286 mPendingUpdateBeforeRepaint = true;
294 } else { 287 } else {
295#ifdef DESKTOP_VERSION 288#ifdef DESKTOP_VERSION
296 //mRepaintTimer->start( 250 ); 289 //mRepaintTimer->start( 250 );
297 mUpdateTimer->start( 250 ); 290 mUpdateTimer->start( 250 );
298#else 291#else
299 mRepaintTimer->start( 350 ); 292 mRepaintTimer->start( 350 );
300 mUpdateTimer->start( 2000 ); 293 mUpdateTimer->start( 2000 );
301#endif 294#endif
302 } 295 }
303} 296}
304 297
305const QDate& KODayMatrix::getDate(int offset) 298const QDate& KODayMatrix::getDate(int offset)
306{ 299{
307 if (offset < 0 || offset > NUMDAYS-1) { 300 if (offset < 0 || offset > NUMDAYS-1) {
308 qDebug("Wrong offset2 "); 301 qDebug("Wrong offset2 ");
309 return days[0]; 302 return days[0];
310 } 303 }
311 return days[offset]; 304 return days[offset];
312} 305}
313 306
314QString KODayMatrix::getHolidayLabel(int offset) 307QString KODayMatrix::getHolidayLabel(int offset)
315{ 308{
@@ -466,54 +459,58 @@ void KODayMatrix::dropEvent(QDropEvent *e)
466 int duration = start.daysTo(end); 459 int duration = start.daysTo(end);
467 int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); 460 int idx = getDayIndexFrom(e->pos().x(), e->pos().y());
468 461
469 start.setDate(days[idx]); 462 start.setDate(days[idx]);
470 end.setDate(days[idx].addDays(duration)); 463 end.setDate(days[idx].addDays(duration));
471 464
472 event->setDtStart(start); 465 event->setDtStart(start);
473 event->setDtEnd(end); 466 event->setDtEnd(end);
474 mCalendar->addEvent(event); 467 mCalendar->addEvent(event);
475 468
476 emit eventDropped(event); 469 emit eventDropped(event);
477 } else { 470 } else {
478// kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; 471// kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl;
479 e->ignore(); 472 e->ignore();
480 } 473 }
481#endif 474#endif
482} 475}
483 476
484// ---------------------------------------------------------------------------- 477// ----------------------------------------------------------------------------
485// P A I N T E V E N T H A N D L I N G 478// P A I N T E V E N T H A N D L I N G
486// ---------------------------------------------------------------------------- 479// ----------------------------------------------------------------------------
487 480
488void KODayMatrix::paintEvent(QPaintEvent * pevent) 481void KODayMatrix::paintEvent(QPaintEvent * pevent)
489{ 482{
490//kdDebug() << "KODayMatrix::paintEvent() BEGIN" << endl; 483 if ( width() <= 0 || height() <= 0 )
484 return;
491 if ( mPendingUpdateBeforeRepaint ) { 485 if ( mPendingUpdateBeforeRepaint ) {
492 updateViewTimed(); 486 updateViewTimed();
493 mPendingUpdateBeforeRepaint = false; 487 mPendingUpdateBeforeRepaint = false;
494 } 488 }
495 QPainter p(this); 489 if ( myPix.width() != width() || myPix.height()!=height() ) {
490 myPix.resize(size() );
491 }
492 QPainter p(&myPix);
496 493
497 QRect sz = frameRect(); 494 QRect sz = frameRect();
498 int dheight = daysize.height(); 495 int dheight = daysize.height();
499 int dwidth = daysize.width(); 496 int dwidth = daysize.width();
500 int row,col; 497 int row,col;
501 int selw, selh; 498 int selw, selh;
502 bool isRTL = KOGlobals::self()->reverseLayout(); 499 bool isRTL = KOGlobals::self()->reverseLayout();
503 500
504 // draw background and topleft frame 501 // draw background and topleft frame
505 p.fillRect(pevent->rect(), mDefaultBackColor); 502 p.fillRect(pevent->rect(), mDefaultBackColor);
506 p.setPen(mDefaultTextColor); 503 p.setPen(mDefaultTextColor);
507 p.drawRect(0, 0, sz.width()+1, sz.height()+1); 504 p.drawRect(0, 0, sz.width()+1, sz.height()+1);
508 505
509 // draw selected days with highlighted background color 506 // draw selected days with highlighted background color
510 if (mSelStart != NOSELECTION) { 507 if (mSelStart != NOSELECTION) {
511 508
512 row = mSelStart/7; 509 row = mSelStart/7;
513 col = mSelStart -row*7; 510 col = mSelStart -row*7;
514 QColor selcol = KOPrefs::instance()->mHighlightColor; 511 QColor selcol = KOPrefs::instance()->mHighlightColor;
515 512
516 if (row == mSelEnd/7) { 513 if (row == mSelEnd/7) {
517 // Single row selection 514 // Single row selection
518 p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth, 515 p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth,
519 row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol); 516 row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol);
@@ -595,36 +592,37 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
595 p.setPen(mHolidayColorShaded); 592 p.setPen(mHolidayColorShaded);
596 } 593 }
597 } 594 }
598 595
599 // draw selected days with special color 596 // draw selected days with special color
600 // DO NOT specially highlight holidays in selection ! 597 // DO NOT specially highlight holidays in selection !
601 if (i >= mSelStart && i <= mSelEnd) { 598 if (i >= mSelStart && i <= mSelEnd) {
602 p.setPen(mSelectedDaysColor); 599 p.setPen(mSelectedDaysColor);
603 } 600 }
604 601
605 p.drawText(col*dwidth, row*dheight, dwidth, dheight, 602 p.drawText(col*dwidth, row*dheight, dwidth, dheight,
606 Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); 603 Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]);
607 604
608 // reset color to actual color 605 // reset color to actual color
609 if (!mHolidays[i].isNull()) { 606 if (!mHolidays[i].isNull()) {
610 p.setPen(actcol); 607 p.setPen(actcol);
611 } 608 }
612 // reset bold font to plain font 609 // reset bold font to plain font
613 if (events[i] > 0) { 610 if (events[i] > 0) {
614 QFont myFont = font(); 611 QFont myFont = font();
615 myFont.setBold(false); 612 myFont.setBold(false);
616 p.setFont(myFont); 613 p.setFont(myFont);
617 } 614 }
618 } 615 }
616 bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP);
619} 617}
620 618
621// ---------------------------------------------------------------------------- 619// ----------------------------------------------------------------------------
622// R E SI Z E E V E N T H A N D L I N G 620// R E SI Z E E V E N T H A N D L I N G
623// ---------------------------------------------------------------------------- 621// ----------------------------------------------------------------------------
624 622
625void KODayMatrix::resizeEvent(QResizeEvent *) 623void KODayMatrix::resizeEvent(QResizeEvent *)
626{ 624{
627 QRect sz = frameRect(); 625 QRect sz = frameRect();
628 daysize.setHeight(sz.height()*7 / NUMDAYS); 626 daysize.setHeight(sz.height()*7 / NUMDAYS);
629 daysize.setWidth(sz.width() / 7); 627 daysize.setWidth(sz.width() / 7);
630} 628}
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index ac2f59c..2dd112a 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -10,48 +10,49 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KODAYMAT_H 23#ifndef _KODAYMAT_H
24#define _KODAYMAT_H 24#define _KODAYMAT_H
25 25
26#include <libkcal/calendar.h> 26#include <libkcal/calendar.h>
27 27
28#include <qstring.h> 28#include <qstring.h>
29#include <qframe.h> 29#include <qframe.h>
30#include <qcolor.h> 30#include <qcolor.h>
31#include <qpen.h> 31#include <qpen.h>
32#include <qdatetime.h> 32#include <qdatetime.h>
33#include <qtooltip.h> 33#include <qtooltip.h>
34#include <qpixmap.h>
34 35
35#include <qmap.h> 36#include <qmap.h>
36 37
37class QDragEnterEvent; 38class QDragEnterEvent;
38class QDragMoveEvent; 39class QDragMoveEvent;
39class QDragLeaveEvent; 40class QDragLeaveEvent;
40class QDropEvent; 41class QDropEvent;
41 42
42class KODayMatrix; 43class KODayMatrix;
43 44
44using namespace KCal; 45using namespace KCal;
45 46
46 47
47/** 48/**
48 * small helper class to dynamically show tooltips inside the day matrix. 49 * small helper class to dynamically show tooltips inside the day matrix.
49 * This class asks the day matrix object for a appropriate label which 50 * This class asks the day matrix object for a appropriate label which
50 * is in our special case the name of the holiday or null if this day is no holiday. 51 * is in our special case the name of the holiday or null if this day is no holiday.
51 */ 52 */
52class DynamicTip : public QToolTip 53class DynamicTip : public QToolTip
53{ 54{
54public: 55public:
55 56
56 /** 57 /**
57 * Constructor that expects a KODayMatrix object as parent. 58 * Constructor that expects a KODayMatrix object as parent.
@@ -200,48 +201,49 @@ signals:
200 */ 201 */
201 void eventDropped(Event *event); 202 void eventDropped(Event *event);
202 203
203protected: 204protected:
204 205
205 void paintEvent(QPaintEvent *ev); 206 void paintEvent(QPaintEvent *ev);
206 207
207 void mousePressEvent (QMouseEvent* e); 208 void mousePressEvent (QMouseEvent* e);
208 209
209 void mouseReleaseEvent (QMouseEvent* e); 210 void mouseReleaseEvent (QMouseEvent* e);
210 211
211 void mouseMoveEvent (QMouseEvent* e); 212 void mouseMoveEvent (QMouseEvent* e);
212 213
213 void dragEnterEvent(QDragEnterEvent *); 214 void dragEnterEvent(QDragEnterEvent *);
214 215
215 void dragMoveEvent(QDragMoveEvent *); 216 void dragMoveEvent(QDragMoveEvent *);
216 217
217 void dragLeaveEvent(QDragLeaveEvent *); 218 void dragLeaveEvent(QDragLeaveEvent *);
218 219
219 void dropEvent(QDropEvent *); 220 void dropEvent(QDropEvent *);
220 221
221 void resizeEvent(QResizeEvent *); 222 void resizeEvent(QResizeEvent *);
222 223
223private: 224private:
225 QPixmap myPix;
224 QTimer* mUpdateTimer; 226 QTimer* mUpdateTimer;
225 QTimer* mRepaintTimer; 227 QTimer* mRepaintTimer;
226 bool mDayChanged; 228 bool mDayChanged;
227 bool mPendingUpdateBeforeRepaint; 229 bool mPendingUpdateBeforeRepaint;
228 230
229 /** returns the index of the day located at the matrix's widget (x,y) position. 231 /** returns the index of the day located at the matrix's widget (x,y) position.
230 * 232 *
231 * @param x horizontal coordinate 233 * @param x horizontal coordinate
232 * @param y vertical coordinate 234 * @param y vertical coordinate
233 */ 235 */
234 int getDayIndexFrom(int x, int y); 236 int getDayIndexFrom(int x, int y);
235 237
236 /** calculates a "shaded" color from the supplied color object. 238 /** calculates a "shaded" color from the supplied color object.
237 * (Copied from Cornelius's kdpdatebutton.cpp) 239 * (Copied from Cornelius's kdpdatebutton.cpp)
238 * 240 *
239 * @param color source based on which a shaded color should be calculated. 241 * @param color source based on which a shaded color should be calculated.
240 */ 242 */
241 QColor getShadedColor(QColor color); 243 QColor getShadedColor(QColor color);
242 244
243 /** number of days to be displayed. For now there is no support for any other number then 42. 245 /** number of days to be displayed. For now there is no support for any other number then 42.
244 so change it at your own risk :o) */ 246 so change it at your own risk :o) */
245 static const int NUMDAYS; 247 static const int NUMDAYS;
246 248
247 /** calendar instance to be queried for holidays, events, ... */ 249 /** calendar instance to be queried for holidays, events, ... */
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 4cff23a..6411156 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -955,50 +955,50 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
955 wno =dayOfYear / 7; 955 wno =dayOfYear / 7;
956 mWeekLabels[i]->setWeekNum( wno ); 956 mWeekLabels[i]->setWeekNum( wno );
957 date = date.addDays( 7 ); 957 date = date.addDays( 7 );
958 } 958 }
959 updateView(); 959 updateView();
960} 960}
961 961
962void KOMonthView::showEvents(QPtrList<Event>) 962void KOMonthView::showEvents(QPtrList<Event>)
963{ 963{
964 qDebug("KOMonthView::selectEvents is not implemented yet. "); 964 qDebug("KOMonthView::selectEvents is not implemented yet. ");
965} 965}
966 966
967void KOMonthView::changeEventDisplay(Event *, int) 967void KOMonthView::changeEventDisplay(Event *, int)
968{ 968{
969 // this should be re-written to be much more efficient, but this 969 // this should be re-written to be much more efficient, but this
970 // quick-and-dirty-hack gets the job done for right now. 970 // quick-and-dirty-hack gets the job done for right now.
971 updateView(); 971 updateView();
972} 972}
973 973
974void KOMonthView::updateView() 974void KOMonthView::updateView()
975{ 975{
976 976
977 if ( !updatePossible ) 977 if ( !updatePossible )
978 return; 978 return;
979 QTime ti; 979 //QTime ti;
980 ti.start(); 980 //ti.start();
981#if 1 981#if 1
982 int i; 982 int i;
983 for( i = 0; i < mCells.count(); ++i ) { 983 for( i = 0; i < mCells.count(); ++i ) {
984 mCells[i]->startUpdateCell(); 984 mCells[i]->startUpdateCell();
985 } 985 }
986 986
987 QPtrList<Event> events = calendar()->events(); 987 QPtrList<Event> events = calendar()->events();
988 Event *event; 988 Event *event;
989 QDateTime dt; 989 QDateTime dt;
990 bool ok; 990 bool ok;
991 int timeSpan = mCells.size()-1; 991 int timeSpan = mCells.size()-1;
992 QDate endDate = mStartDate.addDays( timeSpan ); 992 QDate endDate = mStartDate.addDays( timeSpan );
993 for( event = events.first(); event; event = events.next() ) { // for event 993 for( event = events.first(); event; event = events.next() ) { // for event
994 if ( event->doesRecur() ) { 994 if ( event->doesRecur() ) {
995 bool last; 995 bool last;
996 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 996 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
997 QDateTime incidenceEnd; 997 QDateTime incidenceEnd;
998 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 998 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
999 bool invalid = false; 999 bool invalid = false;
1000 while( true ) { 1000 while( true ) {
1001 if ( incidenceStart.isValid() ) { 1001 if ( incidenceStart.isValid() ) {
1002 incidenceEnd = incidenceStart.addDays( eventlen ); 1002 incidenceEnd = incidenceStart.addDays( eventlen );
1003 int st = incidenceStart.date().daysTo( endDate ); 1003 int st = incidenceStart.date().daysTo( endDate );
1004 if ( st >= 0 ) { // start before timeend 1004 if ( st >= 0 ) { // start before timeend
@@ -1059,49 +1059,49 @@ void KOMonthView::updateView()
1059 } 1059 }
1060 } 1060 }
1061 1061
1062 for( i = 0; i < mCells.count(); ++i ) { 1062 for( i = 0; i < mCells.count(); ++i ) {
1063 mCells[i]->finishUpdateCell(); 1063 mCells[i]->finishUpdateCell();
1064 } 1064 }
1065 processSelectionChange(); 1065 processSelectionChange();
1066 mCells[0]->setFocus(); 1066 mCells[0]->setFocus();
1067 1067
1068 1068
1069#else 1069#else
1070 // old code 1070 // old code
1071 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1071 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1072 int i; 1072 int i;
1073 for( i = 0; i < mCells.count(); ++i ) { 1073 for( i = 0; i < mCells.count(); ++i ) {
1074 mCells[i]->updateCell(); 1074 mCells[i]->updateCell();
1075 } 1075 }
1076 1076
1077 //qDebug("KOMonthView::updateView() "); 1077 //qDebug("KOMonthView::updateView() ");
1078 processSelectionChange(); 1078 processSelectionChange();
1079 // qDebug("---------------------------------------------------------------------+ "); 1079 // qDebug("---------------------------------------------------------------------+ ");
1080 mCells[0]->setFocus(); 1080 mCells[0]->setFocus();
1081#endif 1081#endif
1082 1082
1083 qDebug("update time %d ", ti.elapsed()); 1083 //qDebug("update time %d ", ti.elapsed());
1084} 1084}
1085 1085
1086void KOMonthView::resizeEvent(QResizeEvent * e) 1086void KOMonthView::resizeEvent(QResizeEvent * e)
1087{ 1087{
1088 computeLayout(); 1088 computeLayout();
1089 mCells[0]->setFocus(); 1089 mCells[0]->setFocus();
1090} 1090}
1091void KOMonthView::computeLayout() 1091void KOMonthView::computeLayout()
1092{ 1092{
1093 // select the appropriate heading string size. E.g. "Wednesday" or "Wed". 1093 // select the appropriate heading string size. E.g. "Wednesday" or "Wed".
1094 // note this only changes the text if the requested size crosses the 1094 // note this only changes the text if the requested size crosses the
1095 // threshold between big enough to support the full name and not big 1095 // threshold between big enough to support the full name and not big
1096 // enough. 1096 // enough.
1097 1097
1098 int daysToShow = 7; 1098 int daysToShow = 7;
1099 bool combinedSatSun = false; 1099 bool combinedSatSun = false;
1100 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1100 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1101 daysToShow = 6; 1101 daysToShow = 6;
1102 combinedSatSun = true; 1102 combinedSatSun = true;
1103 } 1103 }
1104 int tWid = topLevelWidget()->size().width(); 1104 int tWid = topLevelWidget()->size().width();
1105 int tHei = topLevelWidget()->size().height(); 1105 int tHei = topLevelWidget()->size().height();
1106 1106
1107 int wid = size().width();//e 1107 int wid = size().width();//e
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 82437d8..99402c4 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -188,49 +188,53 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
188} 188}
189 189
190void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 190void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
191{ 191{
192#ifndef KORG_NODND 192#ifndef KORG_NODND
193 QPoint p(contentsToViewport(e->pos())); 193 QPoint p(contentsToViewport(e->pos()));
194 QListViewItem *i = itemAt(p); 194 QListViewItem *i = itemAt(p);
195 mMousePressed = false; 195 mMousePressed = false;
196 if (i) { 196 if (i) {
197 // if the user clicked into the root decoration of the item, don't 197 // if the user clicked into the root decoration of the item, don't
198 // try to start a drag! 198 // try to start a drag!
199 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + 199 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) +
200 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 200 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
201 itemMargin() || 201 itemMargin() ||
202 p.x() < header()->sectionPos(header()->mapToIndex(0))) { 202 p.x() < header()->sectionPos(header()->mapToIndex(0))) {
203 if (e->button()==Qt::LeftButton) { 203 if (e->button()==Qt::LeftButton) {
204 mPressPos = e->pos(); 204 mPressPos = e->pos();
205 mMousePressed = true; 205 mMousePressed = true;
206 } 206 }
207 } 207 }
208 } 208 }
209#endif 209#endif
210 QListView::contentsMousePressEvent(e); 210 QListView::contentsMousePressEvent(e);
211} 211}
212 212void KOTodoListView::paintEvent(QPaintEvent* e)
213{
214 emit paintNeeded();
215 QListView::paintEvent( e);
216}
213void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 217void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
214{ 218{
215 219
216#ifndef KORG_NODND 220#ifndef KORG_NODND
217 QListView::contentsMouseMoveEvent(e); 221 QListView::contentsMouseMoveEvent(e);
218 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 222 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
219 QApplication::startDragDistance()) { 223 QApplication::startDragDistance()) {
220 mMousePressed = false; 224 mMousePressed = false;
221 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 225 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
222 if (item) { 226 if (item) {
223 DndFactory factory( mCalendar ); 227 DndFactory factory( mCalendar );
224 ICalDrag *vd = factory.createDrag( 228 ICalDrag *vd = factory.createDrag(
225 ((KOTodoViewItem *)item)->todo(),viewport()); 229 ((KOTodoViewItem *)item)->todo(),viewport());
226 internalDrop = false; 230 internalDrop = false;
227 // we cannot do any senseful here, because the DnD is still broken in Qt 231 // we cannot do any senseful here, because the DnD is still broken in Qt
228 if (vd->drag()) { 232 if (vd->drag()) {
229 if ( !internalDrop ) { 233 if ( !internalDrop ) {
230 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); 234 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() );
231 qDebug("Dnd: External move: Delete drag source "); 235 qDebug("Dnd: External move: Delete drag source ");
232 } else 236 } else
233 qDebug("Dnd: Internal move "); 237 qDebug("Dnd: Internal move ");
234 238
235 } else { 239 } else {
236 if ( !internalDrop ) { 240 if ( !internalDrop ) {
@@ -480,90 +484,99 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
480 484
481 // Double clicking conflicts with opening/closing the subtree 485 // Double clicking conflicts with opening/closing the subtree
482 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 486 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
483 SLOT( editItem( QListViewItem *) ) ); 487 SLOT( editItem( QListViewItem *) ) );
484 /* 488 /*
485 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 489 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
486 const QPoint &,int ) ), 490 const QPoint &,int ) ),
487 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 491 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
488 */ 492 */
489 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 493 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
490 const QPoint &,int ) ), 494 const QPoint &,int ) ),
491 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 495 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
492 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 496 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
493 SLOT( itemClicked( QListViewItem * ) ) ); 497 SLOT( itemClicked( QListViewItem * ) ) );
494 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 498 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
495 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 499 SLOT( itemDoubleClicked( QListViewItem * ) ) );
496 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 500 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
497 SLOT( updateView() ) ); 501 SLOT( updateView() ) );
498 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 502 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
499 SLOT( todoModified(Todo *, int) ) ); 503 SLOT( todoModified(Todo *, int) ) );
500 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 504 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
501 SLOT( itemStateChanged( QListViewItem * ) ) ); 505 SLOT( itemStateChanged( QListViewItem * ) ) );
502 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 506 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
503 SLOT( itemStateChanged( QListViewItem * ) ) ); 507 SLOT( itemStateChanged( QListViewItem * ) ) );
508 connect( mTodoListView, SIGNAL( paintNeeded() ),
509 SLOT( paintNeeded()) );
504 510
505#if 0 511#if 0
506 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 512 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
507 SLOT(selectionChanged(QListViewItem *))); 513 SLOT(selectionChanged(QListViewItem *)));
508 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 514 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
509 SLOT(selectionChanged(QListViewItem *))); 515 SLOT(selectionChanged(QListViewItem *)));
510 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 516 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
511 SLOT(selectionChanged(QListViewItem *))); 517 SLOT(selectionChanged(QListViewItem *)));
512#endif 518#endif
513 519
514 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 520 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
515 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 521 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
516 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 522 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
517 523
518 connect( mTodoListView, SIGNAL(selectionChanged() ), 524 connect( mTodoListView, SIGNAL(selectionChanged() ),
519 SLOT( processSelectionChange() ) ); 525 SLOT( processSelectionChange() ) );
520 connect( mQuickAdd, SIGNAL( returnPressed () ), 526 connect( mQuickAdd, SIGNAL( returnPressed () ),
521 SLOT( addQuickTodo() ) ); 527 SLOT( addQuickTodo() ) );
522 528
523} 529}
524 530
525KOTodoView::~KOTodoView() 531KOTodoView::~KOTodoView()
526{ 532{
527 delete mDocPrefs; 533 delete mDocPrefs;
528} 534}
529 535
530void KOTodoView::jumpToDate () 536void KOTodoView::jumpToDate ()
531{ 537{
532 // if (mActiveItem) { 538 // if (mActiveItem) {
533// mActiveItem->todo()); 539// mActiveItem->todo());
534// if ( mActiveItem->todo()->hasDueDate() ) 540// if ( mActiveItem->todo()->hasDueDate() )
535// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 541// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
536} 542}
543void KOTodoView::paintNeeded()
544{
545 if ( mPendingUpdateBeforeRepaint ) {
546 updateView();
547 mPendingUpdateBeforeRepaint = false;
548 }
549}
537void KOTodoView::paintEvent(QPaintEvent * pevent) 550void KOTodoView::paintEvent(QPaintEvent * pevent)
538{ 551{
539 if ( mPendingUpdateBeforeRepaint ) { 552 if ( mPendingUpdateBeforeRepaint ) {
540 updateView(); 553 updateView();
541 mPendingUpdateBeforeRepaint = false; 554 mPendingUpdateBeforeRepaint = false;
542 } 555 }
543 KOrg::BaseView::paintEvent( pevent); 556 KOrg::BaseView::paintEvent( pevent);
544} 557}
545 bool mPendingUpdateBeforeRepaint; 558
546void KOTodoView::updateView() 559void KOTodoView::updateView()
547{ 560{
548 pendingSubtodo = 0; 561 pendingSubtodo = 0;
549 if ( mBlockUpdate ) { 562 if ( mBlockUpdate ) {
550 return; 563 return;
551 } 564 }
552 if ( !isVisible() ) { 565 if ( !isVisible() ) {
553 mPendingUpdateBeforeRepaint = true; 566 mPendingUpdateBeforeRepaint = true;
554 return; 567 return;
555 } 568 }
556 //qDebug("KOTodoView::updateView() %x", this); 569 //qDebug("KOTodoView::updateView() %x", this);
557 if ( isFlatDisplay ) { 570 if ( isFlatDisplay ) {
558 setAllFlat(); 571 setAllFlat();
559 return; 572 return;
560 } 573 }
561 //qDebug("update "); 574 //qDebug("update ");
562// kdDebug() << "KOTodoView::updateView()" << endl; 575// kdDebug() << "KOTodoView::updateView()" << endl;
563 QFont fo = KOPrefs::instance()->mTodoViewFont; 576 QFont fo = KOPrefs::instance()->mTodoViewFont;
564 mTodoListView->clear(); 577 mTodoListView->clear();
565 if ( mName == "todolistsmall" ) { 578 if ( mName == "todolistsmall" ) {
566 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 579 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
567 int ps = fo.pointSize() -2; 580 int ps = fo.pointSize() -2;
568 if ( ps > 12 ) 581 if ( ps > 12 )
569 ps -= 2; 582 ps -= 2;
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 16bc133..2a9e737 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -39,65 +39,67 @@
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40 40
41#include <korganizer/baseview.h> 41#include <korganizer/baseview.h>
42 42
43#include "kotodoviewitem.h" 43#include "kotodoviewitem.h"
44#include "koprefs.h" 44#include "koprefs.h"
45#include "koglobals.h" 45#include "koglobals.h"
46#include "datenavigator.h" 46#include "datenavigator.h"
47 47
48class QDragEnterEvent; 48class QDragEnterEvent;
49class QDragMoveEvent; 49class QDragMoveEvent;
50class QDragLeaveEvent; 50class QDragLeaveEvent;
51class QDropEvent; 51class QDropEvent;
52 52
53class DocPrefs; 53class DocPrefs;
54 54
55class KOTodoListView : public KListView 55class KOTodoListView : public KListView
56{ 56{
57 Q_OBJECT 57 Q_OBJECT
58 public: 58 public:
59 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 59 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
60 virtual ~KOTodoListView() {} 60 virtual ~KOTodoListView() {}
61 61
62 signals: 62 signals:
63 void paintNeeded();
63 void todoDropped(Todo *, int); 64 void todoDropped(Todo *, int);
64 void double_Clicked(QListViewItem *item); 65 void double_Clicked(QListViewItem *item);
65 void reparentTodoSignal( Todo *,Todo * ); 66 void reparentTodoSignal( Todo *,Todo * );
66 void unparentTodoSignal(Todo *); 67 void unparentTodoSignal(Todo *);
67 void deleteTodo( Todo * ); 68 void deleteTodo( Todo * );
68 protected: 69 protected:
69 void contentsDragEnterEvent(QDragEnterEvent *); 70 void contentsDragEnterEvent(QDragEnterEvent *);
70 void contentsDragMoveEvent(QDragMoveEvent *); 71 void contentsDragMoveEvent(QDragMoveEvent *);
71 void contentsDragLeaveEvent(QDragLeaveEvent *); 72 void contentsDragLeaveEvent(QDragLeaveEvent *);
72 void contentsDropEvent(QDropEvent *); 73 void contentsDropEvent(QDropEvent *);
73 74
74 void contentsMousePressEvent(QMouseEvent *); 75 void contentsMousePressEvent(QMouseEvent *);
75 void contentsMouseMoveEvent(QMouseEvent *); 76 void contentsMouseMoveEvent(QMouseEvent *);
76 void contentsMouseReleaseEvent(QMouseEvent *); 77 void contentsMouseReleaseEvent(QMouseEvent *);
77 void contentsMouseDoubleClickEvent(QMouseEvent *); 78 void contentsMouseDoubleClickEvent(QMouseEvent *);
78 79
79 private: 80 private:
81 void paintEvent(QPaintEvent * pevent);
80 bool internalDrop; 82 bool internalDrop;
81 QString mName; 83 QString mName;
82 Calendar *mCalendar; 84 Calendar *mCalendar;
83 QPoint mPressPos; 85 QPoint mPressPos;
84 bool mMousePressed; 86 bool mMousePressed;
85 QListViewItem *mOldCurrent; 87 QListViewItem *mOldCurrent;
86 void keyPressEvent ( QKeyEvent * ) ; 88 void keyPressEvent ( QKeyEvent * ) ;
87}; 89};
88 90
89 91
90/** 92/**
91 This is the line-edit on top of the todoview for fast addition of new todos 93 This is the line-edit on top of the todoview for fast addition of new todos
92*/ 94*/
93class KOQuickTodo : public QLineEdit 95class KOQuickTodo : public QLineEdit
94{ 96{
95 public: 97 public:
96 KOQuickTodo(QWidget *parent=0); 98 KOQuickTodo(QWidget *parent=0);
97 protected: 99 protected:
98 void focusInEvent(QFocusEvent *ev); 100 void focusInEvent(QFocusEvent *ev);
99 void focusOutEvent(QFocusEvent *ev); 101 void focusOutEvent(QFocusEvent *ev);
100}; 102};
101 103
102 104
103/** 105/**
@@ -177,63 +179,65 @@ class KOTodoView : public KOrg::BaseView
177 void itemClicked(QListViewItem *); 179 void itemClicked(QListViewItem *);
178 void itemStateChanged(QListViewItem *); 180 void itemStateChanged(QListViewItem *);
179 void modified(bool); 181 void modified(bool);
180 void itemDoubleClicked(QListViewItem *item); 182 void itemDoubleClicked(QListViewItem *item);
181 183
182 signals: 184 signals:
183 void newTodoSignal(); 185 void newTodoSignal();
184 void newSubTodoSignal(Todo *); 186 void newSubTodoSignal(Todo *);
185 void unparentTodoSignal(Todo *); 187 void unparentTodoSignal(Todo *);
186 void reparentTodoSignal( Todo *,Todo * ); 188 void reparentTodoSignal( Todo *,Todo * );
187 void showTodoSignal(Todo *); 189 void showTodoSignal(Todo *);
188 190
189 void editTodoSignal(Todo *); 191 void editTodoSignal(Todo *);
190 void deleteTodoSignal(Todo *); 192 void deleteTodoSignal(Todo *);
191 void todoModifiedSignal (Todo *, int); 193 void todoModifiedSignal (Todo *, int);
192 194
193 void isModified(bool); 195 void isModified(bool);
194 void cloneTodoSignal( Incidence * ); 196 void cloneTodoSignal( Incidence * );
195 void cancelTodoSignal( Incidence * ); 197 void cancelTodoSignal( Incidence * );
196 void moveTodoSignal( Incidence * ); 198 void moveTodoSignal( Incidence * );
197 void beamTodoSignal( Incidence * ); 199 void beamTodoSignal( Incidence * );
198 void purgeCompletedSignal(); 200 void purgeCompletedSignal();
199 201
200 protected slots: 202 protected slots:
203 void paintNeeded();
201 void processSelectionChange(); 204 void processSelectionChange();
202 void addQuickTodo(); 205 void addQuickTodo();
203 void setTodoModified( Todo* ); 206 void setTodoModified( Todo* );
204 void todoModified(Todo *, int ); 207 void todoModified(Todo *, int );
205 208
206 private: 209 private:
207 /* 210 /*
208 * the TodoEditor approach is rather unscaling in the long 211 * the TodoEditor approach is rather unscaling in the long
209 * run. 212 * run.
210 * Korganizer keeps it in memory and we need to update 213 * Korganizer keeps it in memory and we need to update
211 * 1. make KOTodoViewItem a QObject again? 214 * 1. make KOTodoViewItem a QObject again?
212 * 2. add a public method for setting one todo modified? 215 * 2. add a public method for setting one todo modified?
213 * 3. add a private method for setting a todo modified + friend here? 216 * 3. add a private method for setting a todo modified + friend here?
214 * -- zecke 2002-07-08 217 * -- zecke 2002-07-08
215 */ 218 */
219 friend class KOTodoListView;
216 void paintEvent(QPaintEvent * pevent); 220 void paintEvent(QPaintEvent * pevent);
217 bool mPendingUpdateBeforeRepaint; 221 bool mPendingUpdateBeforeRepaint;
218 friend class KOTodoViewItem; 222 friend class KOTodoViewItem;
219 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 223 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
220 void restoreItemState( QListViewItem * ); 224 void restoreItemState( QListViewItem * );
221 225
222 bool checkTodo( Todo * ); 226 bool checkTodo( Todo * );
223 bool isFlatDisplay; 227 bool isFlatDisplay;
224 void setOpen( QListViewItem*, bool setOpen); 228 void setOpen( QListViewItem*, bool setOpen);
225 KOTodoListView *mTodoListView; 229 KOTodoListView *mTodoListView;
226 QPopupMenu *mItemPopupMenu; 230 QPopupMenu *mItemPopupMenu;
227 QPopupMenu *mPopupMenu; 231 QPopupMenu *mPopupMenu;
228 QPopupMenu *mPriorityPopupMenu; 232 QPopupMenu *mPriorityPopupMenu;
229 QPopupMenu *mPercentageCompletedPopupMenu; 233 QPopupMenu *mPercentageCompletedPopupMenu;
230 QPopupMenu *mCategoryPopupMenu; 234 QPopupMenu *mCategoryPopupMenu;
231 235
232 QMap<int, int> mPercentage; 236 QMap<int, int> mPercentage;
233 QMap<int, int> mPriority; 237 QMap<int, int> mPriority;
234 QMap<int, QString> mCategory; 238 QMap<int, QString> mCategory;
235 KOTodoViewItem *mActiveItem; 239 KOTodoViewItem *mActiveItem;
236 240
237 QMap<Todo *,KOTodoViewItem *> mTodoMap; 241 QMap<Todo *,KOTodoViewItem *> mTodoMap;
238 QString mName; 242 QString mName;
239 243
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 30f5fb1..188ad23 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -583,48 +583,49 @@ void KOViewManager::showTodoView()
583 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 583 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
584 KConfig *config = KOGlobals::config(); 584 KConfig *config = KOGlobals::config();
585 mTodoView->restoreLayout(config,"Todo View"); 585 mTodoView->restoreLayout(config,"Todo View");
586 mTodoView->setNavigator( mMainView->dateNavigator() ); 586 mTodoView->setNavigator( mMainView->dateNavigator() );
587 } 587 }
588 588
589 globalFlagBlockAgenda = 1; 589 globalFlagBlockAgenda = 1;
590 showView( mTodoView, true ); 590 showView( mTodoView, true );
591 591
592} 592}
593 593
594void KOViewManager::showJournalView() 594void KOViewManager::showJournalView()
595{ 595{
596 //mFlagShowNextxDays = false; 596 //mFlagShowNextxDays = false;
597 if (!mJournalView) { 597 if (!mJournalView) {
598 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 598 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
599 "KOViewManager::JournalView"); 599 "KOViewManager::JournalView");
600 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 600 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
601 SLOT( updateConfig() ) ); 601 SLOT( updateConfig() ) );
602 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 602 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
603 addView(mJournalView); 603 addView(mJournalView);
604 } 604 }
605 605
606 showView(mJournalView); 606 showView(mJournalView);
607 mMainView->dateNavigator()->selectDates( 1 );
607} 608}
608 609
609void KOViewManager::showTimeSpanView() 610void KOViewManager::showTimeSpanView()
610{ 611{
611 //mFlagShowNextxDays = false; 612 //mFlagShowNextxDays = false;
612 if (!mTimeSpanView) { 613 if (!mTimeSpanView) {
613 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 614 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
614 "KOViewManager::TimeSpanView"); 615 "KOViewManager::TimeSpanView");
615 addView(mTimeSpanView); 616 addView(mTimeSpanView);
616 617
617 mTimeSpanView->readSettings(); 618 mTimeSpanView->readSettings();
618 } 619 }
619 620
620 showView(mTimeSpanView); 621 showView(mTimeSpanView);
621} 622}
622 623
623Incidence *KOViewManager::currentSelection() 624Incidence *KOViewManager::currentSelection()
624{ 625{
625 if (!mCurrentView) return 0; 626 if (!mCurrentView) return 0;
626 if ( mCurrentView == mListView ) { 627 if ( mCurrentView == mListView ) {
627 if ( mListView->currentItem() ) 628 if ( mListView->currentItem() )
628 return mListView->currentItem(); 629 return mListView->currentItem();
629 } 630 }
630 return mCurrentView->selectedIncidences().first(); 631 return mCurrentView->selectedIncidences().first();