summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-02 10:58:10 (UTC)
committer zautrix <zautrix>2005-02-02 10:58:10 (UTC)
commitd2f6c50fb3b236e37aaa46ade819ab163f19868a (patch) (unidiff)
tree02b2c7bbcd6d78140def0650fa4b440199e04ef7
parent5bc675bc7e9d5d6fa2d2bc48675a7cfa985ab2c7 (diff)
downloadkdepimpi-d2f6c50fb3b236e37aaa46ade819ab163f19868a.zip
kdepimpi-d2f6c50fb3b236e37aaa46ade819ab163f19868a.tar.gz
kdepimpi-d2f6c50fb3b236e37aaa46ade819ab163f19868a.tar.bz2
qwt added
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp23
-rw-r--r--korganizer/koagendaitem.h1
-rw-r--r--korganizer/kolistview.cpp28
-rw-r--r--korganizer/kolistview.h1
-rw-r--r--korganizer/kotodoview.cpp28
-rw-r--r--korganizer/kotodoview.h1
6 files changed, 80 insertions, 2 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 5f9ed92..df7d612 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -11,113 +11,133 @@
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 19
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <qwhatsthis.h>
26#include <qdragobject.h> 26#include <qdragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29 29
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <klocale.h> 33#include <klocale.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#define AGENDA_ICON_SIZE 5 36#define AGENDA_ICON_SIZE 5
37#else 37#else
38#define AGENDA_ICON_SIZE 7 38#define AGENDA_ICON_SIZE 7
39#endif 39#endif
40#include <libkcal/icaldrag.h> 40#include <libkcal/icaldrag.h>
41#include <libkcal/vcaldrag.h> 41#include <libkcal/vcaldrag.h>
42#include <libkcal/kincidenceformatter.h> 42#include <libkcal/kincidenceformatter.h>
43extern int globalFlagBlockAgenda; 43extern int globalFlagBlockAgenda;
44extern int globalFlagBlockAgendaItemPaint; 44extern int globalFlagBlockAgendaItemPaint;
45extern int globalFlagBlockAgendaItemUpdate; 45extern int globalFlagBlockAgendaItemUpdate;
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48 48
49#include "koagendaitem.h" 49#include "koagendaitem.h"
50//#include "koagendaitem.moc" 50//#include "koagendaitem.moc"
51 51
52 52
53//-------------------------------------------------------------------------- 53//--------------------------------------------------------------------------
54 54
55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
56 56
57//-------------------------------------------------------------------------- 57//--------------------------------------------------------------------------
58 58
59class KOAgendaItemWhatsThis :public QWhatsThis
60{
61public:
62 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
63
64protected:
65 virtual QString text( const QPoint& )
66 {
67 return _view->getWhatsThisText() ;
68 }
69private:
70 KOAgendaItem * _view;
71};
72
59KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 73KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
60 const char *name,WFlags) : 74 const char *name,WFlags) :
61 QWidget(parent, name), mIncidence(incidence), mDate(qd) 75 QWidget(parent, name), mIncidence(incidence), mDate(qd)
62{ 76{
63#ifndef DESKTOP_VERSION 77#ifndef DESKTOP_VERSION
64 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 78 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
65#endif 79#endif
80 new KOAgendaItemWhatsThis(this);
66 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 81 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
67 setWFlags ( wflags); 82 setWFlags ( wflags);
68 mAllDay = allday; 83 mAllDay = allday;
69 init ( incidence, qd ); 84 init ( incidence, qd );
70 setMouseTracking(true); 85 setMouseTracking(true);
71 //setAcceptDrops(true); 86 //setAcceptDrops(true);
72 xPaintCoord = -1; 87 xPaintCoord = -1;
73 yPaintCoord = -1; 88 yPaintCoord = -1;
74} 89}
75 90QString KOAgendaItem::getWhatsThisText()
91{
92 if ( mIncidence )
93 return KIncidenceFormatter::instance()->getFormattedText( mIncidence );
94 return "KOAgendaItem::getWhatsThisText()::internal error";
95}
76void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 96void KOAgendaItem::init ( Incidence *incidence, QDate qd )
77{ 97{
78 mIncidence = incidence; 98 mIncidence = incidence;
79 mDate = qd; 99 mDate = qd;
80 mFirstMultiItem = 0; 100 mFirstMultiItem = 0;
81 mNextMultiItem = 0; 101 mNextMultiItem = 0;
82 mLastMultiItem = 0; 102 mLastMultiItem = 0;
83 computeText(); 103 computeText();
84 104
85 if ( (incidence->type() == "Todo") && 105 if ( (incidence->type() == "Todo") &&
86 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 106 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
87 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 107 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
88 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 108 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
89 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 109 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
90 else 110 else
91 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 111 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
92 } 112 }
93 else { 113 else {
94 QStringList categories = mIncidence->categories(); 114 QStringList categories = mIncidence->categories();
95 QString cat = categories.first(); 115 QString cat = categories.first();
96 if (cat.isEmpty()) { 116 if (cat.isEmpty()) {
97 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) 117 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) )
98 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 118 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
99 else 119 else
100 mBackgroundColor =KOPrefs::instance()->mEventColor; 120 mBackgroundColor =KOPrefs::instance()->mEventColor;
101 } else { 121 } else {
102 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 122 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
103 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 123 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
104 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 124 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
105 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 125 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
106 } 126 }
107 } 127 }
108 128
109 } 129 }
110 mColorGroup = QColorGroup( mBackgroundColor.light(), 130 mColorGroup = QColorGroup( mBackgroundColor.light(),
111 mBackgroundColor.dark(),mBackgroundColor.light(), 131 mBackgroundColor.dark(),mBackgroundColor.light(),
112 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 132 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
113 setBackgroundColor( mBackgroundColor ); 133 setBackgroundColor( mBackgroundColor );
114 134
115 setCellXY(0,0,1); 135 setCellXY(0,0,1);
116 setCellXWidth(0); 136 setCellXWidth(0);
117 setSubCell(0); 137 setSubCell(0);
118 setSubCells(1); 138 setSubCells(1);
119 setMultiItem(0,0,0); 139 setMultiItem(0,0,0);
120 startMove(); 140 startMove();
121 mSelected = true; 141 mSelected = true;
122 select(false); 142 select(false);
123 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 143 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
@@ -459,97 +479,96 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
459 ry = e->rect().y(); 479 ry = e->rect().y();
460 rw = e->rect().width(); 480 rw = e->rect().width();
461 rh = e->rect().height(); 481 rh = e->rect().height();
462 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 482 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
463 483
464 QPixmap* paintFrom ; 484 QPixmap* paintFrom ;
465 if ( mSelected ) { 485 if ( mSelected ) {
466 paintFrom = paintPixSel(); 486 paintFrom = paintPixSel();
467 } else { 487 } else {
468 if ( mAllDay ) 488 if ( mAllDay )
469 paintFrom = paintPixAllday(); 489 paintFrom = paintPixAllday();
470 else 490 else
471 paintFrom = paintPix(); 491 paintFrom = paintPix();
472 } 492 }
473 bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); 493 bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP);
474} 494}
475void KOAgendaItem::computeText() 495void KOAgendaItem::computeText()
476{ 496{
477 497
478 mDisplayedText = mIncidence->summary(); 498 mDisplayedText = mIncidence->summary();
479 if ( (mIncidence->type() == "Todo") ) { 499 if ( (mIncidence->type() == "Todo") ) {
480 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { 500 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
481 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 501 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
482 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 502 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
483 else if ( !(mIncidence->doesFloat())) 503 else if ( !(mIncidence->doesFloat()))
484 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 504 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
485 } 505 }
486 } else { 506 } else {
487 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) 507 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
488 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 508 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
489 509
490 if ( mAllDay ) { 510 if ( mAllDay ) {
491 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { 511 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
492 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; 512 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
493 } 513 }
494 } 514 }
495 515
496 } 516 }
497 517
498 if ( !mIncidence->location().isEmpty() ) { 518 if ( !mIncidence->location().isEmpty() ) {
499 if ( mAllDay ) 519 if ( mAllDay )
500 mDisplayedText += " ("; 520 mDisplayedText += " (";
501 else 521 else
502 mDisplayedText += "\n("; 522 mDisplayedText += "\n(";
503 mDisplayedText += mIncidence->location() +")"; 523 mDisplayedText += mIncidence->location() +")";
504 } 524 }
505 525
506 QString tipText = mIncidence->summary(); 526 QString tipText = mIncidence->summary();
507 QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence ));
508 if ( !mIncidence->doesFloat() ) { 527 if ( !mIncidence->doesFloat() ) {
509 if ( mIncidence->type() == "Event" ) { 528 if ( mIncidence->type() == "Event" ) {
510 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 529 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
511 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 530 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
512 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 531 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
513 } 532 }
514 else { 533 else {
515 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 534 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
516 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 535 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
517 } 536 }
518 } 537 }
519 else if ( mIncidence->type() == "Todo" ) { 538 else if ( mIncidence->type() == "Todo" ) {
520 if (mIncidence->hasStartDate()) 539 if (mIncidence->hasStartDate())
521 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); 540 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
522 if (((Todo*)mIncidence)->hasDueDate()) 541 if (((Todo*)mIncidence)->hasDueDate())
523 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); 542 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
524 } 543 }
525 } else if ( mIncidence->type() == "Todo" ) { 544 } else if ( mIncidence->type() == "Todo" ) {
526 if (mIncidence->hasStartDate()) 545 if (mIncidence->hasStartDate())
527 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); 546 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
528 if (((Todo*)mIncidence)->hasDueDate()) 547 if (((Todo*)mIncidence)->hasDueDate())
529 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); 548 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
530 } 549 }
531 550
532 if (!mIncidence->location().isEmpty()) { 551 if (!mIncidence->location().isEmpty()) {
533 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 552 tipText += "\n"+i18n("Location: ")+mIncidence->location();
534 } 553 }
535 QToolTip::add(this,tipText,toolTipGroup(),""); 554 QToolTip::add(this,tipText,toolTipGroup(),"");
536 555
537} 556}
538void KOAgendaItem::updateItem() 557void KOAgendaItem::updateItem()
539{ 558{
540 computeText(); 559 computeText();
541 560
542 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); 561 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
543 paintMe( mSelected ); 562 paintMe( mSelected );
544 repaint( false); 563 repaint( false);
545} 564}
546 565
547void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) 566void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
548{ 567{
549 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); 568 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1());
550 paintMe( mSelected ); 569 paintMe( mSelected );
551 repaint( false ); 570 repaint( false );
552} 571}
553 572
554/* 573/*
555 Return height of item in units of agenda cells 574 Return height of item in units of agenda cells
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index 7321af2..5b8f420 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -1,96 +1,97 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
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#ifndef KOAGENDAITEM_H 19#ifndef KOAGENDAITEM_H
20#define KOAGENDAITEM_H 20#define KOAGENDAITEM_H
21 21
22#include <qframe.h> 22#include <qframe.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qpixmap.h> 24#include <qpixmap.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qpalette.h> 26#include <qpalette.h>
27 27
28#include <libkcal/incidence.h> 28#include <libkcal/incidence.h>
29 29
30class QToolTipGroup; 30class QToolTipGroup;
31class QDragEnterEvent; 31class QDragEnterEvent;
32class QDropEvent; 32class QDropEvent;
33 33
34using namespace KCal; 34using namespace KCal;
35 35
36/* 36/*
37 The KOAgendaItem has to make sure that it receives all mouse events, which are 37 The KOAgendaItem has to make sure that it receives all mouse events, which are
38 to be used for dragging and resizing. That means it has to be installed as 38 to be used for dragging and resizing. That means it has to be installed as
39 eventfiler for its children, if it has children, and it has to pass mouse 39 eventfiler for its children, if it has children, and it has to pass mouse
40 events from the cildren to itself. See eventFilter(). 40 events from the cildren to itself. See eventFilter().
41*/ 41*/
42class KOAgendaItem : public QWidget 42class KOAgendaItem : public QWidget
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 public: 45 public:
46 KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0, 46 KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0,
47 WFlags f=0 ); 47 WFlags f=0 );
48 ~KOAgendaItem(); 48 ~KOAgendaItem();
49 QString getWhatsThisText();
49 void init ( Incidence *incidence, QDate qd ); 50 void init ( Incidence *incidence, QDate qd );
50 int cellX() { return mCellX; } 51 int cellX() { return mCellX; }
51 int cellXWidth() { return mCellXWidth; } 52 int cellXWidth() { return mCellXWidth; }
52 int cellYTop() { return mCellYTop; } 53 int cellYTop() { return mCellYTop; }
53 int cellYBottom() { return mCellYBottom; } 54 int cellYBottom() { return mCellYBottom; }
54 int cellHeight(); 55 int cellHeight();
55 int cellWidth(); 56 int cellWidth();
56 int subCell() { return mSubCell; } 57 int subCell() { return mSubCell; }
57 int subCells() { return mSubCells; } 58 int subCells() { return mSubCells; }
58 59
59 void setCellXY(int X, int YTop, int YBottom); 60 void setCellXY(int X, int YTop, int YBottom);
60 void setCellY(int YTop, int YBottom); 61 void setCellY(int YTop, int YBottom);
61 void setCellX(int XLeft, int XRight); 62 void setCellX(int XLeft, int XRight);
62 void setCellXWidth(int xwidth); 63 void setCellXWidth(int xwidth);
63 void setSubCell(int subCell); 64 void setSubCell(int subCell);
64 void setSubCells(int subCells); 65 void setSubCells(int subCells);
65 66
66 /** Start movement */ 67 /** Start movement */
67 void startMove(); 68 void startMove();
68 /** Reset to original values */ 69 /** Reset to original values */
69 void resetMove(); 70 void resetMove();
70 71
71 void moveRelative(int dx,int dy); 72 void moveRelative(int dx,int dy);
72 void expandTop(int dy); 73 void expandTop(int dy);
73 void expandBottom(int dy); 74 void expandBottom(int dy);
74 void expandLeft(int dx); 75 void expandLeft(int dx);
75 void expandRight(int dx); 76 void expandRight(int dx);
76 int mLastMoveXPos; 77 int mLastMoveXPos;
77 78
78 void setMultiItem(KOAgendaItem *first,KOAgendaItem *next, 79 void setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
79 KOAgendaItem *last); 80 KOAgendaItem *last);
80 KOAgendaItem *firstMultiItem() { return mFirstMultiItem; } 81 KOAgendaItem *firstMultiItem() { return mFirstMultiItem; }
81 KOAgendaItem *nextMultiItem() { return mNextMultiItem; } 82 KOAgendaItem *nextMultiItem() { return mNextMultiItem; }
82 KOAgendaItem *lastMultiItem() { return mLastMultiItem; } 83 KOAgendaItem *lastMultiItem() { return mLastMultiItem; }
83 84
84 Incidence *incidence() const { return mIncidence; } 85 Incidence *incidence() const { return mIncidence; }
85 QDate itemDate() { return mDate; } 86 QDate itemDate() { return mDate; }
86 87
87 /** Update the date of this item's occurence (not in the event) */ 88 /** Update the date of this item's occurence (not in the event) */
88 void setItemDate(QDate qd); 89 void setItemDate(QDate qd);
89 90
90 void setText ( const QString & text ) { mDisplayedText = text; } 91 void setText ( const QString & text ) { mDisplayedText = text; }
91 QString text () { return mDisplayedText; } 92 QString text () { return mDisplayedText; }
92 93
93 virtual bool eventFilter ( QObject *, QEvent * ); 94 virtual bool eventFilter ( QObject *, QEvent * );
94 95
95 static QToolTipGroup *toolTipGroup(); 96 static QToolTipGroup *toolTipGroup();
96 97
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index b21b419..732fc46 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,112 +1,131 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown 3 Copyright (c) 1999 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qwhatsthis.h>
35#include <qregexp.h> 36#include <qregexp.h>
36 37
37#include <klocale.h> 38#include <klocale.h>
38#include <kdebug.h> 39#include <kdebug.h>
39#include <kiconloader.h> 40#include <kiconloader.h>
40#include <kglobal.h> 41#include <kglobal.h>
41 42
42#include <libkdepim/kpimglobalprefs.h> 43#include <libkdepim/kpimglobalprefs.h>
43#include <libkcal/calendar.h> 44#include <libkcal/calendar.h>
44#include <libkcal/calendarlocal.h> 45#include <libkcal/calendarlocal.h>
45#include <libkcal/icalformat.h> 46#include <libkcal/icalformat.h>
46#include <libkcal/vcalformat.h> 47#include <libkcal/vcalformat.h>
47#include <libkcal/recurrence.h> 48#include <libkcal/recurrence.h>
48#include <libkcal/filestorage.h> 49#include <libkcal/filestorage.h>
49#include <libkdepim/categoryselectdialog.h> 50#include <libkdepim/categoryselectdialog.h>
51#include <libkcal/kincidenceformatter.h>
50#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
51#include <qpe/qpeapplication.h> 53#include <qpe/qpeapplication.h>
52#else 54#else
53#include <qapplication.h> 55#include <qapplication.h>
54#endif 56#endif
55 57
56#ifndef KORG_NOPRINTER 58#ifndef KORG_NOPRINTER
57#include "calprinter.h" 59#include "calprinter.h"
58#endif 60#endif
59#include "koglobals.h" 61#include "koglobals.h"
60#include "koprefs.h" 62#include "koprefs.h"
61#include "kfiledialog.h" 63#include "kfiledialog.h"
62 64
63#include "kolistview.h" 65#include "kolistview.h"
64 66
67
68class KOListViewWhatsThis :public QWhatsThis
69{
70public:
71 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
72
73protected:
74 virtual QString text( const QPoint& p)
75 {
76 return _view->getWhatsThisText(p) ;
77 }
78private:
79 QWidget* _wid;
80 KOListView * _view;
81};
82
83
65ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 84ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
66{ 85{
67 mItem = item; 86 mItem = item;
68 mDate = date; 87 mDate = date;
69} 88}
70 89
71ListItemVisitor::~ListItemVisitor() 90ListItemVisitor::~ListItemVisitor()
72{ 91{
73} 92}
74 93
75bool ListItemVisitor::visit(Event *e) 94bool ListItemVisitor::visit(Event *e)
76{ 95{
77 96
78 bool ok = false; 97 bool ok = false;
79 QString start, end; 98 QString start, end;
80 QDate ds, de; 99 QDate ds, de;
81 if ( e->doesRecur() ) { 100 if ( e->doesRecur() ) {
82 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 101 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
83 if ( ok ) { 102 if ( ok ) {
84 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 103 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
85 start = KGlobal::locale()->formatDate(ds,true); 104 start = KGlobal::locale()->formatDate(ds,true);
86 de = ds.addDays( days); 105 de = ds.addDays( days);
87 end = KGlobal::locale()->formatDate(de,true); 106 end = KGlobal::locale()->formatDate(de,true);
88 } 107 }
89 108
90 } 109 }
91 if ( ! ok ) { 110 if ( ! ok ) {
92 start =e->dtStartDateStr(); 111 start =e->dtStartDateStr();
93 end = e->dtEndDateStr(); 112 end = e->dtEndDateStr();
94 ds = e->dtStart().date(); 113 ds = e->dtStart().date();
95 de = e->dtEnd().date(); 114 de = e->dtEnd().date();
96 } 115 }
97 mItem->setText(0,e->summary()); 116 mItem->setText(0,e->summary());
98 mItem->setText(1,start); 117 mItem->setText(1,start);
99 mItem->setText(2,e->dtStartTimeStr()); 118 mItem->setText(2,e->dtStartTimeStr());
100 mItem->setText(3,end); 119 mItem->setText(3,end);
101 mItem->setText(4,e->dtEndTimeStr()); 120 mItem->setText(4,e->dtEndTimeStr());
102 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 121 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
103 mItem->setText(6, e->recurrence()->recurrenceText()); 122 mItem->setText(6, e->recurrence()->recurrenceText());
104 mItem->setText(7,"---"); 123 mItem->setText(7,"---");
105 mItem->setText(8,"---"); 124 mItem->setText(8,"---");
106 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 125 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
107 mItem->setText(10,e->categoriesStr()); 126 mItem->setText(10,e->categoriesStr());
108 127
109 QString key; 128 QString key;
110 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 129 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
111 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 130 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
112 mItem->setSortKey(1,key); 131 mItem->setSortKey(1,key);
@@ -179,167 +198,176 @@ bool ListItemVisitor::visit(Journal * j)
179 mItem->setText(3,"---"); 198 mItem->setText(3,"---");
180 mItem->setText(4,"---"); 199 mItem->setText(4,"---");
181 mItem->setText(5,"---"); 200 mItem->setText(5,"---");
182 mItem->setText(6,"---"); 201 mItem->setText(6,"---");
183 mItem->setText(7,j->dtStartDateStr()); 202 mItem->setText(7,j->dtStartDateStr());
184 mItem->setText(8,"---"); 203 mItem->setText(8,"---");
185 mItem->setText(9,"---"); 204 mItem->setText(9,"---");
186 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 205 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
187 206
188 QString key; 207 QString key;
189 QDate d = j->dtStart().date(); 208 QDate d = j->dtStart().date();
190 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 209 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
191 mItem->setSortKey(1,key); 210 mItem->setSortKey(1,key);
192 mItem->setSortKey(7,key); 211 mItem->setSortKey(7,key);
193 212
194 return true; 213 return true;
195} 214}
196 215
197KOListView::KOListView(Calendar *calendar, QWidget *parent, 216KOListView::KOListView(Calendar *calendar, QWidget *parent,
198 const char *name) 217 const char *name)
199 : KOEventView(calendar, parent, name) 218 : KOEventView(calendar, parent, name)
200{ 219{
201 mActiveItem = 0; 220 mActiveItem = 0;
202 mListView = new KOListViewListView(this); 221 mListView = new KOListViewListView(this);
203 mListView->addColumn(i18n("Summary")); 222 mListView->addColumn(i18n("Summary"));
204 mListView->addColumn(i18n("Start Date")); 223 mListView->addColumn(i18n("Start Date"));
205 mListView->addColumn(i18n("Start Time")); 224 mListView->addColumn(i18n("Start Time"));
206 mListView->addColumn(i18n("End Date")); 225 mListView->addColumn(i18n("End Date"));
207 mListView->addColumn(i18n("End Time")); 226 mListView->addColumn(i18n("End Time"));
208 mListView->addColumn(i18n("Alarm")); // alarm set? 227 mListView->addColumn(i18n("Alarm")); // alarm set?
209 mListView->addColumn(i18n("Recurs")); // recurs? 228 mListView->addColumn(i18n("Recurs")); // recurs?
210 mListView->addColumn(i18n("Due Date")); 229 mListView->addColumn(i18n("Due Date"));
211 mListView->addColumn(i18n("Due Time")); 230 mListView->addColumn(i18n("Due Time"));
212 mListView->addColumn(i18n("Cancelled")); 231 mListView->addColumn(i18n("Cancelled"));
213 mListView->addColumn(i18n("Categories")); 232 mListView->addColumn(i18n("Categories"));
214 233
215 mListView->setColumnAlignment(0,AlignLeft); 234 mListView->setColumnAlignment(0,AlignLeft);
216 mListView->setColumnAlignment(1,AlignLeft); 235 mListView->setColumnAlignment(1,AlignLeft);
217 mListView->setColumnAlignment(2,AlignHCenter); 236 mListView->setColumnAlignment(2,AlignHCenter);
218 mListView->setColumnAlignment(3,AlignLeft); 237 mListView->setColumnAlignment(3,AlignLeft);
219 mListView->setColumnAlignment(4,AlignHCenter); 238 mListView->setColumnAlignment(4,AlignHCenter);
220 mListView->setColumnAlignment(5,AlignLeft); 239 mListView->setColumnAlignment(5,AlignLeft);
221 mListView->setColumnAlignment(6,AlignLeft); 240 mListView->setColumnAlignment(6,AlignLeft);
222 mListView->setColumnAlignment(7,AlignLeft); 241 mListView->setColumnAlignment(7,AlignLeft);
223 mListView->setColumnAlignment(8,AlignLeft); 242 mListView->setColumnAlignment(8,AlignLeft);
224 mListView->setColumnAlignment(9,AlignLeft); 243 mListView->setColumnAlignment(9,AlignLeft);
225 mListView->setColumnAlignment(10,AlignLeft); 244 mListView->setColumnAlignment(10,AlignLeft);
226 mListView->setColumnWidthMode(10, QListView::Manual); 245 mListView->setColumnWidthMode(10, QListView::Manual);
246 new KOListViewWhatsThis(mListView->viewport(),this);
227 247
228 int iii = 0; 248 int iii = 0;
229 for ( iii = 0; iii< 10 ; ++iii ) 249 for ( iii = 0; iii< 10 ; ++iii )
230 mListView->setColumnWidthMode( iii, QListView::Manual ); 250 mListView->setColumnWidthMode( iii, QListView::Manual );
231 251
232 QBoxLayout *layoutTop = new QVBoxLayout(this); 252 QBoxLayout *layoutTop = new QVBoxLayout(this);
233 layoutTop->addWidget(mListView); 253 layoutTop->addWidget(mListView);
234 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 254 mListView->setFont ( KOPrefs::instance()->mListViewFont );
235 mPopupMenu = eventPopup(); 255 mPopupMenu = eventPopup();
236 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 256 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
237 i18n("Select all"),this, 257 i18n("Select all"),this,
238 SLOT(allSelection()),true); 258 SLOT(allSelection()),true);
239 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 259 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
240 i18n("Deselect All"),this, 260 i18n("Deselect All"),this,
241 SLOT(clearSelection()),true); 261 SLOT(clearSelection()),true);
242 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 262 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
243 i18n("Delete all selected"),this, 263 i18n("Delete all selected"),this,
244 SLOT(deleteAll()),true); 264 SLOT(deleteAll()),true);
245 mPopupMenu->insertSeparator(); 265 mPopupMenu->insertSeparator();
246 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 266 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
247 i18n("Save selected to file..."),this, 267 i18n("Save selected to file..."),this,
248 SLOT(saveToFile()),true); 268 SLOT(saveToFile()),true);
249 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 269 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
250 i18n("Save Journal/Description..."),this, 270 i18n("Save Journal/Description..."),this,
251 SLOT(saveDescriptionToFile()),true); 271 SLOT(saveDescriptionToFile()),true);
252 mPopupMenu->insertSeparator(); 272 mPopupMenu->insertSeparator();
253 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 273 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
254 i18n("Add Categ. to selected..."),this, 274 i18n("Add Categ. to selected..."),this,
255 SLOT(addCat()),true); 275 SLOT(addCat()),true);
256 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 276 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
257 i18n("Set Categ. for selected..."),this, 277 i18n("Set Categ. for selected..."),this,
258 SLOT(setCat()),true); 278 SLOT(setCat()),true);
259 mPopupMenu->insertSeparator(); 279 mPopupMenu->insertSeparator();
260 280
261 281
262#ifndef DESKTOP_VERSION 282#ifndef DESKTOP_VERSION
263 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 283 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
264 i18n("Beam selected via IR"),this, 284 i18n("Beam selected via IR"),this,
265 SLOT(beamSelected()),true); 285 SLOT(beamSelected()),true);
266#endif 286#endif
267 /* 287 /*
268 mPopupMenu = new QPopupMenu; 288 mPopupMenu = new QPopupMenu;
269 mPopupMenu->insertItem(i18n("Edit Event"), this, 289 mPopupMenu->insertItem(i18n("Edit Event"), this,
270 SLOT (editEvent())); 290 SLOT (editEvent()));
271 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 291 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
272 SLOT (deleteEvent())); 292 SLOT (deleteEvent()));
273 mPopupMenu->insertSeparator(); 293 mPopupMenu->insertSeparator();
274 mPopupMenu->insertItem(i18n("Show Dates"), this, 294 mPopupMenu->insertItem(i18n("Show Dates"), this,
275 SLOT(showDates())); 295 SLOT(showDates()));
276 mPopupMenu->insertItem(i18n("Hide Dates"), this, 296 mPopupMenu->insertItem(i18n("Hide Dates"), this,
277 SLOT(hideDates())); 297 SLOT(hideDates()));
278 */ 298 */
279 QObject::connect(mListView,SIGNAL( newEvent()), 299 QObject::connect(mListView,SIGNAL( newEvent()),
280 this,SIGNAL(signalNewEvent())); 300 this,SIGNAL(signalNewEvent()));
281 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 301 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
282 this,SLOT(defaultItemAction(QListViewItem *))); 302 this,SLOT(defaultItemAction(QListViewItem *)));
283 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, 303 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *,
284 const QPoint &, int )), 304 const QPoint &, int )),
285 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 305 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
286 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 306 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
287 SLOT(processSelectionChange(QListViewItem *))); 307 SLOT(processSelectionChange(QListViewItem *)));
288 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 308 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
289 SIGNAL(showIncidenceSignal(Incidence *)) ); 309 SIGNAL(showIncidenceSignal(Incidence *)) );
290 310
291 readSettings(KOGlobals::config(),"KOListView Layout"); 311 readSettings(KOGlobals::config(),"KOListView Layout");
292} 312}
293 313
294KOListView::~KOListView() 314KOListView::~KOListView()
295{ 315{
296 delete mPopupMenu; 316 delete mPopupMenu;
297} 317}
318QString KOListView::getWhatsThisText(QPoint p)
319{
320 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
321 if ( item )
322 return KIncidenceFormatter::instance()->getFormattedText( item->data() );
323 return i18n("That is the list view" );
324
325}
298 326
299void KOListView::updateList() 327void KOListView::updateList()
300{ 328{
301 // qDebug(" KOListView::updateList() "); 329 // qDebug(" KOListView::updateList() ");
302 330
303} 331}
304 332
305void KOListView::addCat( ) 333void KOListView::addCat( )
306{ 334{
307 setCategories( false ); 335 setCategories( false );
308} 336}
309void KOListView::setCat() 337void KOListView::setCat()
310{ 338{
311 setCategories( true ); 339 setCategories( true );
312} 340}
313void KOListView::setCategories( bool removeOld ) 341void KOListView::setCategories( bool removeOld )
314{ 342{
315 343
316 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 344 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
317 if (! csd->exec()) { 345 if (! csd->exec()) {
318 delete csd; 346 delete csd;
319 return; 347 return;
320 } 348 }
321 QStringList catList = csd->selectedCategories(); 349 QStringList catList = csd->selectedCategories();
322 delete csd; 350 delete csd;
323 // if ( catList.count() == 0 ) 351 // if ( catList.count() == 0 )
324 // return; 352 // return;
325 catList.sort(); 353 catList.sort();
326 QString categoriesStr = catList.join(","); 354 QString categoriesStr = catList.join(",");
327 int i; 355 int i;
328 QStringList itemList; 356 QStringList itemList;
329 QPtrList<KOListViewItem> sel ; 357 QPtrList<KOListViewItem> sel ;
330 QListViewItem *qitem = mListView->firstChild (); 358 QListViewItem *qitem = mListView->firstChild ();
331 while ( qitem ) { 359 while ( qitem ) {
332 if ( qitem->isSelected() ) { 360 if ( qitem->isSelected() ) {
333 sel.append(((KOListViewItem *)qitem)); 361 sel.append(((KOListViewItem *)qitem));
334 } 362 }
335 qitem = qitem->nextSibling(); 363 qitem = qitem->nextSibling();
336 } 364 }
337 KOListViewItem * item, *temp; 365 KOListViewItem * item, *temp;
338 item = sel.first(); 366 item = sel.first();
339 Incidence* inc; 367 Incidence* inc;
340 while ( item ) { 368 while ( item ) {
341 inc = item->data(); 369 inc = item->data();
342 if ( removeOld ) { 370 if ( removeOld ) {
343 inc->setCategories( categoriesStr ); 371 inc->setCategories( categoriesStr );
344 } else { 372 } else {
345 itemList = QStringList::split (",", inc->categoriesStr() ); 373 itemList = QStringList::split (",", inc->categoriesStr() );
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index 23afdb1..be9b09c 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -74,94 +74,95 @@ class ListItemVisitor : public Incidence::Visitor
74 @see KOBaseView, KODayListView 74 @see KOBaseView, KODayListView
75*/ 75*/
76class KOListView; 76class KOListView;
77 77
78class KOListViewListView : public KListView 78class KOListViewListView : public KListView
79{ 79{
80 Q_OBJECT 80 Q_OBJECT
81 public: 81 public:
82 KOListViewListView(KOListView * lv ); 82 KOListViewListView(KOListView * lv );
83 signals: 83 signals:
84 void newEvent(); 84 void newEvent();
85 void showIncidence( Incidence* ); 85 void showIncidence( Incidence* );
86 private: 86 private:
87 void keyPressEvent ( QKeyEvent * ) ; 87 void keyPressEvent ( QKeyEvent * ) ;
88 void contentsMouseDoubleClickEvent(QMouseEvent *e); 88 void contentsMouseDoubleClickEvent(QMouseEvent *e);
89 void contentsMousePressEvent(QMouseEvent *e); 89 void contentsMousePressEvent(QMouseEvent *e);
90 void contentsMouseReleaseEvent(QMouseEvent *e); 90 void contentsMouseReleaseEvent(QMouseEvent *e);
91 void contentsMouseMoveEvent(QMouseEvent *e); 91 void contentsMouseMoveEvent(QMouseEvent *e);
92 bool mAllowPopupMenu; 92 bool mAllowPopupMenu;
93 bool mMouseDown; 93 bool mMouseDown;
94 int mYMousePos; 94 int mYMousePos;
95}; 95};
96 96
97class KOListView : public KOEventView 97class KOListView : public KOEventView
98{ 98{
99 Q_OBJECT 99 Q_OBJECT
100 public: 100 public:
101 KOListView(Calendar *calendar, QWidget *parent = 0, 101 KOListView(Calendar *calendar, QWidget *parent = 0,
102 const char *name = 0); 102 const char *name = 0);
103 ~KOListView(); 103 ~KOListView();
104 104
105 virtual int maxDatesHint(); 105 virtual int maxDatesHint();
106 virtual int currentDateCount(); 106 virtual int currentDateCount();
107 virtual QPtrList<Incidence> selectedIncidences(); 107 virtual QPtrList<Incidence> selectedIncidences();
108 virtual DateList selectedDates(); 108 virtual DateList selectedDates();
109 109
110 void showDates(bool show); 110 void showDates(bool show);
111 Incidence* currentItem(); 111 Incidence* currentItem();
112 void addTodos(QPtrList<Todo> eventList); 112 void addTodos(QPtrList<Todo> eventList);
113 void addJournals(QPtrList<Journal> eventList); 113 void addJournals(QPtrList<Journal> eventList);
114 virtual void printPreview(CalPrinter *calPrinter, 114 virtual void printPreview(CalPrinter *calPrinter,
115 const QDate &, const QDate &); 115 const QDate &, const QDate &);
116 116
117 void readSettings(KConfig *config, QString setting = "KOListView Layout"); 117 void readSettings(KConfig *config, QString setting = "KOListView Layout");
118 void writeSettings(KConfig *config, QString setting = "KOListView Layout"); 118 void writeSettings(KConfig *config, QString setting = "KOListView Layout");
119 void updateList(); 119 void updateList();
120 void setStartDate(const QDate &start); 120 void setStartDate(const QDate &start);
121 int count(); 121 int count();
122 QString getWhatsThisText(QPoint p);
122 signals: 123 signals:
123 void signalNewEvent(); 124 void signalNewEvent();
124 void beamIncidenceList(QPtrList<Incidence>); 125 void beamIncidenceList(QPtrList<Incidence>);
125 126
126 public slots: 127 public slots:
127 virtual void updateView(); 128 virtual void updateView();
128 virtual void showDates(const QDate &start, const QDate &end); 129 virtual void showDates(const QDate &start, const QDate &end);
129 virtual void showEvents(QPtrList<Event> eventList); 130 virtual void showEvents(QPtrList<Event> eventList);
130 void clearSelection(); 131 void clearSelection();
131 void allSelection(); 132 void allSelection();
132 133
133 void clear(); 134 void clear();
134 void beamDone( Ir *ir ); 135 void beamDone( Ir *ir );
135 void showDates(); 136 void showDates();
136 void hideDates(); 137 void hideDates();
137 void deleteAll(); 138 void deleteAll();
138 void saveToFile(); 139 void saveToFile();
139 void saveDescriptionToFile(); 140 void saveDescriptionToFile();
140 void beamSelected(); 141 void beamSelected();
141 void updateConfig(); 142 void updateConfig();
142 void addCat(); 143 void addCat();
143 void setCat(); 144 void setCat();
144 void setCategories( bool removeOld ); 145 void setCategories( bool removeOld );
145 void changeEventDisplay(Event *, int); 146 void changeEventDisplay(Event *, int);
146 147
147 void defaultItemAction(QListViewItem *item); 148 void defaultItemAction(QListViewItem *item);
148 void popupMenu(QListViewItem *item,const QPoint &,int); 149 void popupMenu(QListViewItem *item,const QPoint &,int);
149 150
150 protected slots: 151 protected slots:
151 void processSelectionChange(QListViewItem *); 152 void processSelectionChange(QListViewItem *);
152 153
153 protected: 154 protected:
154 void addEvents(QPtrList<Event> eventList); 155 void addEvents(QPtrList<Event> eventList);
155 void addIncidence(Incidence *); 156 void addIncidence(Incidence *);
156 KOListViewItem *getItemForEvent(Event *event); 157 KOListViewItem *getItemForEvent(Event *event);
157 158
158 private: 159 private:
159 KOListViewListView *mListView; 160 KOListViewListView *mListView;
160 KOEventPopupMenu *mPopupMenu; 161 KOEventPopupMenu *mPopupMenu;
161 KOListViewItem *mActiveItem; 162 KOListViewItem *mActiveItem;
162 QDict<Incidence> mUidDict; 163 QDict<Incidence> mUidDict;
163 QDate mStartDate; 164 QDate mStartDate;
164 void keyPressEvent ( QKeyEvent * ) ; 165 void keyPressEvent ( QKeyEvent * ) ;
165}; 166};
166 167
167#endif 168#endif
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index da8b4bc..c5b9a21 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1,103 +1,121 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
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 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qheader.h> 25#include <qheader.h>
26#include <qcursor.h> 26#include <qcursor.h>
27#include <qwhatsthis.h>
27 28
28#include <qvbox.h> 29#include <qvbox.h>
29#include <kdebug.h> 30#include <kdebug.h>
30#include "koprefs.h" 31#include "koprefs.h"
31#include <klocale.h> 32#include <klocale.h>
32#include <kglobal.h> 33#include <kglobal.h>
33#include <kiconloader.h> 34#include <kiconloader.h>
34#include <kmessagebox.h> 35#include <kmessagebox.h>
35 36
36#include <libkcal/icaldrag.h> 37#include <libkcal/icaldrag.h>
37#include <libkcal/vcaldrag.h> 38#include <libkcal/vcaldrag.h>
38#include <libkcal/calfilter.h> 39#include <libkcal/calfilter.h>
39#include <libkcal/dndfactory.h> 40#include <libkcal/dndfactory.h>
40#include <libkcal/calendarresources.h> 41#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 42#include <libkcal/resourcecalendar.h>
42#include <kresources/resourceselectdialog.h> 43#include <kresources/resourceselectdialog.h>
44#include <libkcal/kincidenceformatter.h>
43#ifndef DESKTOP_VERSION 45#ifndef DESKTOP_VERSION
44#include <qpe/qpeapplication.h> 46#include <qpe/qpeapplication.h>
45#else 47#else
46#include <qapplication.h> 48#include <qapplication.h>
47#endif 49#endif
48#ifndef KORG_NOPRINTER 50#ifndef KORG_NOPRINTER
49#include "calprinter.h" 51#include "calprinter.h"
50#endif 52#endif
51#include "docprefs.h" 53#include "docprefs.h"
52 54
53#include "kotodoview.h" 55#include "kotodoview.h"
54using namespace KOrg; 56using namespace KOrg;
55 57
58
59class KOTodoViewWhatsThis :public QWhatsThis
60{
61public:
62 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
63
64protected:
65 virtual QString text( const QPoint& p)
66 {
67 return _view->getWhatsThisText(p) ;
68 }
69private:
70 QWidget* _wid;
71 KOTodoView * _view;
72};
73
56KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 74KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
57 const char *name) : 75 const char *name) :
58 KListView(parent,name) 76 KListView(parent,name)
59{ 77{
60 mName = QString ( name ); 78 mName = QString ( name );
61 mCalendar = calendar; 79 mCalendar = calendar;
62#ifndef DESKTOP_VERSION 80#ifndef DESKTOP_VERSION
63 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 81 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
64#endif 82#endif
65 mOldCurrent = 0; 83 mOldCurrent = 0;
66 mMousePressed = false; 84 mMousePressed = false;
67 85
68 setAcceptDrops(true); 86 setAcceptDrops(true);
69 viewport()->setAcceptDrops(true); 87 viewport()->setAcceptDrops(true);
70 int size = 16; 88 int size = 16;
71 if (qApp->desktop()->width() < 300 ) 89 if (qApp->desktop()->width() < 300 )
72 size = 12; 90 size = 12;
73 setTreeStepSize( size + 6 ); 91 setTreeStepSize( size + 6 );
74 92
75} 93}
76 94
77void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 95void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
78{ 96{
79#ifndef KORG_NODND 97#ifndef KORG_NODND
80// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 98// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
81 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 99 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
82 !QTextDrag::canDecode( e ) ) { 100 !QTextDrag::canDecode( e ) ) {
83 e->ignore(); 101 e->ignore();
84 return; 102 return;
85 } 103 }
86 104
87 mOldCurrent = currentItem(); 105 mOldCurrent = currentItem();
88#endif 106#endif
89} 107}
90 108
91 109
92void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 110void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
93{ 111{
94#ifndef KORG_NODND 112#ifndef KORG_NODND
95// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 113// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
96 114
97 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 115 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
98 !QTextDrag::canDecode( e ) ) { 116 !QTextDrag::canDecode( e ) ) {
99 e->ignore(); 117 e->ignore();
100 return; 118 return;
101 } 119 }
102 120
103 e->accept(); 121 e->accept();
@@ -350,96 +368,98 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
350 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 368 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
351 369
352 mTodoListView = new KOTodoListView(calendar,this, name ); 370 mTodoListView = new KOTodoListView(calendar,this, name );
353 topLayout->addWidget(mTodoListView); 371 topLayout->addWidget(mTodoListView);
354 //mTodoListView->header()->setMaximumHeight(30); 372 //mTodoListView->header()->setMaximumHeight(30);
355 mTodoListView->setRootIsDecorated(true); 373 mTodoListView->setRootIsDecorated(true);
356 mTodoListView->setAllColumnsShowFocus(true); 374 mTodoListView->setAllColumnsShowFocus(true);
357 375
358 mTodoListView->setShowSortIndicator(true); 376 mTodoListView->setShowSortIndicator(true);
359 377
360 mTodoListView->addColumn(i18n("Todo")); 378 mTodoListView->addColumn(i18n("Todo"));
361 mTodoListView->addColumn(i18n("Prio")); 379 mTodoListView->addColumn(i18n("Prio"));
362 mTodoListView->setColumnAlignment(1,AlignHCenter); 380 mTodoListView->setColumnAlignment(1,AlignHCenter);
363 mTodoListView->addColumn(i18n("Complete")); 381 mTodoListView->addColumn(i18n("Complete"));
364 mTodoListView->setColumnAlignment(2,AlignCenter); 382 mTodoListView->setColumnAlignment(2,AlignCenter);
365 383
366 mTodoListView->addColumn(i18n("Due Date")); 384 mTodoListView->addColumn(i18n("Due Date"));
367 mTodoListView->setColumnAlignment(3,AlignLeft); 385 mTodoListView->setColumnAlignment(3,AlignLeft);
368 mTodoListView->addColumn(i18n("Due Time")); 386 mTodoListView->addColumn(i18n("Due Time"));
369 mTodoListView->setColumnAlignment(4,AlignHCenter); 387 mTodoListView->setColumnAlignment(4,AlignHCenter);
370 388
371 mTodoListView->addColumn(i18n("Start Date")); 389 mTodoListView->addColumn(i18n("Start Date"));
372 mTodoListView->setColumnAlignment(5,AlignLeft); 390 mTodoListView->setColumnAlignment(5,AlignLeft);
373 mTodoListView->addColumn(i18n("Start Time")); 391 mTodoListView->addColumn(i18n("Start Time"));
374 mTodoListView->setColumnAlignment(6,AlignHCenter); 392 mTodoListView->setColumnAlignment(6,AlignHCenter);
375 393
376 mTodoListView->addColumn(i18n("Cancelled")); 394 mTodoListView->addColumn(i18n("Cancelled"));
377 mTodoListView->addColumn(i18n("Categories")); 395 mTodoListView->addColumn(i18n("Categories"));
378#if 0 396#if 0
379 mTodoListView->addColumn(i18n("Sort Id")); 397 mTodoListView->addColumn(i18n("Sort Id"));
380 mTodoListView->setColumnAlignment(4,AlignHCenter); 398 mTodoListView->setColumnAlignment(4,AlignHCenter);
381#endif 399#endif
382 400
383 mTodoListView->setMinimumHeight( 60 ); 401 mTodoListView->setMinimumHeight( 60 );
384 mTodoListView->setItemsRenameable( true ); 402 mTodoListView->setItemsRenameable( true );
385 mTodoListView->setRenameable( 0 ); 403 mTodoListView->setRenameable( 0 );
386 mTodoListView->setColumnWidth( 0, 120 ); 404 mTodoListView->setColumnWidth( 0, 120 );
387 mTodoListView->setColumnWidthMode(0, QListView::Manual); 405 mTodoListView->setColumnWidthMode(0, QListView::Manual);
388 mTodoListView->setColumnWidthMode(1, QListView::Manual); 406 mTodoListView->setColumnWidthMode(1, QListView::Manual);
389 mTodoListView->setColumnWidthMode(2, QListView::Manual); 407 mTodoListView->setColumnWidthMode(2, QListView::Manual);
390 mTodoListView->setColumnWidthMode(3, QListView::Manual); 408 mTodoListView->setColumnWidthMode(3, QListView::Manual);
391 mTodoListView->setColumnWidthMode(4, QListView::Manual); 409 mTodoListView->setColumnWidthMode(4, QListView::Manual);
392 mTodoListView->setColumnWidthMode(5, QListView::Manual); 410 mTodoListView->setColumnWidthMode(5, QListView::Manual);
393 mTodoListView->setColumnWidthMode(6, QListView::Manual); 411 mTodoListView->setColumnWidthMode(6, QListView::Manual);
394 mTodoListView->setColumnWidthMode(7, QListView::Manual); 412 mTodoListView->setColumnWidthMode(7, QListView::Manual);
395 mTodoListView->setColumnWidthMode(8, QListView::Manual); 413 mTodoListView->setColumnWidthMode(8, QListView::Manual);
396 414
397 415
416 new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
417
398 mPriorityPopupMenu = new QPopupMenu(this); 418 mPriorityPopupMenu = new QPopupMenu(this);
399 for (int i = 1; i <= 5; i++) { 419 for (int i = 1; i <= 5; i++) {
400 QString label = QString ("%1").arg (i); 420 QString label = QString ("%1").arg (i);
401 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 421 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
402 } 422 }
403 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 423 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
404 424
405 mPercentageCompletedPopupMenu = new QPopupMenu(this); 425 mPercentageCompletedPopupMenu = new QPopupMenu(this);
406 for (int i = 0; i <= 100; i+=20) { 426 for (int i = 0; i <= 100; i+=20) {
407 QString label = QString ("%1 %").arg (i); 427 QString label = QString ("%1 %").arg (i);
408 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 428 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
409 } 429 }
410 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 430 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
411 431
412 432
413 433
414 mItemPopupMenu = new QPopupMenu(this); 434 mItemPopupMenu = new QPopupMenu(this);
415 mItemPopupMenu->insertItem(i18n("Show..."), this, 435 mItemPopupMenu->insertItem(i18n("Show..."), this,
416 SLOT (showTodo())); 436 SLOT (showTodo()));
417 mItemPopupMenu->insertItem(i18n("Edit..."), this, 437 mItemPopupMenu->insertItem(i18n("Edit..."), this,
418 SLOT (editTodo())); 438 SLOT (editTodo()));
419 mItemPopupMenu->insertItem( i18n("Delete"), this, 439 mItemPopupMenu->insertItem( i18n("Delete"), this,
420 SLOT (deleteTodo())); 440 SLOT (deleteTodo()));
421 mItemPopupMenu->insertItem( i18n("Clone..."), this, 441 mItemPopupMenu->insertItem( i18n("Clone..."), this,
422 SLOT (cloneTodo())); 442 SLOT (cloneTodo()));
423 mItemPopupMenu->insertItem( i18n("Move..."), this, 443 mItemPopupMenu->insertItem( i18n("Move..."), this,
424 SLOT (moveTodo())); 444 SLOT (moveTodo()));
425 mItemPopupMenu->insertItem( i18n("Beam..."), this, 445 mItemPopupMenu->insertItem( i18n("Beam..."), this,
426 SLOT (beamTodo())); 446 SLOT (beamTodo()));
427 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 447 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
428 SLOT (cancelTodo())); 448 SLOT (cancelTodo()));
429 mItemPopupMenu->insertSeparator(); 449 mItemPopupMenu->insertSeparator();
430 450
431 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 451 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
432 SLOT (newTodo())); 452 SLOT (newTodo()));
433 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 453 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
434 SLOT (newSubTodo())); 454 SLOT (newSubTodo()));
435 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 455 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
436 SLOT (unparentTodo()),0,21); 456 SLOT (unparentTodo()),0,21);
437 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 457 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
438 SLOT (reparentTodo()),0,22); 458 SLOT (reparentTodo()),0,22);
439 mItemPopupMenu->insertSeparator(); 459 mItemPopupMenu->insertSeparator();
440#if 0 460#if 0
441 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 461 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
442 this, SLOT( purgeCompleted() ) ); 462 this, SLOT( purgeCompleted() ) );
443 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 463 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
444 this, SLOT( toggleCompleted() ),0, 33 ); 464 this, SLOT( toggleCompleted() ),0, 33 );
445 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 465 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
@@ -487,96 +507,104 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
487 SLOT( editItem( QListViewItem *) ) ); 507 SLOT( editItem( QListViewItem *) ) );
488 /* 508 /*
489 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 509 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
490 const QPoint &,int ) ), 510 const QPoint &,int ) ),
491 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 511 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
492 */ 512 */
493 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 513 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
494 const QPoint &,int ) ), 514 const QPoint &,int ) ),
495 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 515 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
496 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 516 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
497 SLOT( itemClicked( QListViewItem * ) ) ); 517 SLOT( itemClicked( QListViewItem * ) ) );
498 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 518 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
499 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 519 SLOT( itemDoubleClicked( QListViewItem * ) ) );
500 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 520 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
501 SLOT( updateView() ) ); 521 SLOT( updateView() ) );
502 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 522 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
503 SLOT( todoModified(Todo *, int) ) ); 523 SLOT( todoModified(Todo *, int) ) );
504 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 524 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
505 SLOT( itemStateChanged( QListViewItem * ) ) ); 525 SLOT( itemStateChanged( QListViewItem * ) ) );
506 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 526 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
507 SLOT( itemStateChanged( QListViewItem * ) ) ); 527 SLOT( itemStateChanged( QListViewItem * ) ) );
508 connect( mTodoListView, SIGNAL( paintNeeded() ), 528 connect( mTodoListView, SIGNAL( paintNeeded() ),
509 SLOT( paintNeeded()) ); 529 SLOT( paintNeeded()) );
510 530
511#if 0 531#if 0
512 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 532 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
513 SLOT(selectionChanged(QListViewItem *))); 533 SLOT(selectionChanged(QListViewItem *)));
514 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 534 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
515 SLOT(selectionChanged(QListViewItem *))); 535 SLOT(selectionChanged(QListViewItem *)));
516 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 536 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
517 SLOT(selectionChanged(QListViewItem *))); 537 SLOT(selectionChanged(QListViewItem *)));
518#endif 538#endif
519 539
520 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 540 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
521 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 541 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
522 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 542 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
523 543
524 connect( mTodoListView, SIGNAL(selectionChanged() ), 544 connect( mTodoListView, SIGNAL(selectionChanged() ),
525 SLOT( processSelectionChange() ) ); 545 SLOT( processSelectionChange() ) );
526 connect( mQuickAdd, SIGNAL( returnPressed () ), 546 connect( mQuickAdd, SIGNAL( returnPressed () ),
527 SLOT( addQuickTodo() ) ); 547 SLOT( addQuickTodo() ) );
528 548
529} 549}
530 550
531KOTodoView::~KOTodoView() 551KOTodoView::~KOTodoView()
532{ 552{
533 delete mDocPrefs; 553 delete mDocPrefs;
534} 554}
555QString KOTodoView::getWhatsThisText(QPoint p)
556{
557 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
558 if ( item )
559 return KIncidenceFormatter::instance()->getFormattedText( item->todo() );
560 return i18n("That is the todo view" );
561
562}
535 563
536void KOTodoView::jumpToDate () 564void KOTodoView::jumpToDate ()
537{ 565{
538 // if (mActiveItem) { 566 // if (mActiveItem) {
539// mActiveItem->todo()); 567// mActiveItem->todo());
540// if ( mActiveItem->todo()->hasDueDate() ) 568// if ( mActiveItem->todo()->hasDueDate() )
541// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 569// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
542} 570}
543void KOTodoView::paintNeeded() 571void KOTodoView::paintNeeded()
544{ 572{
545 if ( mPendingUpdateBeforeRepaint ) { 573 if ( mPendingUpdateBeforeRepaint ) {
546 updateView(); 574 updateView();
547 mPendingUpdateBeforeRepaint = false; 575 mPendingUpdateBeforeRepaint = false;
548 } 576 }
549} 577}
550void KOTodoView::paintEvent(QPaintEvent * pevent) 578void KOTodoView::paintEvent(QPaintEvent * pevent)
551{ 579{
552 if ( mPendingUpdateBeforeRepaint ) { 580 if ( mPendingUpdateBeforeRepaint ) {
553 updateView(); 581 updateView();
554 mPendingUpdateBeforeRepaint = false; 582 mPendingUpdateBeforeRepaint = false;
555 } 583 }
556 KOrg::BaseView::paintEvent( pevent); 584 KOrg::BaseView::paintEvent( pevent);
557} 585}
558 586
559void KOTodoView::updateView() 587void KOTodoView::updateView()
560{ 588{
561 pendingSubtodo = 0; 589 pendingSubtodo = 0;
562 if ( mBlockUpdate ) { 590 if ( mBlockUpdate ) {
563 return; 591 return;
564 } 592 }
565 if ( !isVisible() ) { 593 if ( !isVisible() ) {
566 mPendingUpdateBeforeRepaint = true; 594 mPendingUpdateBeforeRepaint = true;
567 return; 595 return;
568 } 596 }
569 //qDebug("KOTodoView::updateView() %x", this); 597 //qDebug("KOTodoView::updateView() %x", this);
570 if ( isFlatDisplay ) { 598 if ( isFlatDisplay ) {
571 setAllFlat(); 599 setAllFlat();
572 return; 600 return;
573 } 601 }
574 //qDebug("update "); 602 //qDebug("update ");
575// kdDebug() << "KOTodoView::updateView()" << endl; 603// kdDebug() << "KOTodoView::updateView()" << endl;
576 QFont fo = KOPrefs::instance()->mTodoViewFont; 604 QFont fo = KOPrefs::instance()->mTodoViewFont;
577 mTodoListView->clear(); 605 mTodoListView->clear();
578 if ( mName == "todolistsmall" ) { 606 if ( mName == "todolistsmall" ) {
579 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 607 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
580 int ps = fo.pointSize() -2; 608 int ps = fo.pointSize() -2;
581 if ( ps > 12 ) 609 if ( ps > 12 )
582 ps -= 2; 610 ps -= 2;
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 2a9e737..1642132 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -89,96 +89,97 @@ class KOTodoListView : public KListView
89}; 89};
90 90
91 91
92/** 92/**
93 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
94*/ 94*/
95class KOQuickTodo : public QLineEdit 95class KOQuickTodo : public QLineEdit
96{ 96{
97 public: 97 public:
98 KOQuickTodo(QWidget *parent=0); 98 KOQuickTodo(QWidget *parent=0);
99 protected: 99 protected:
100 void focusInEvent(QFocusEvent *ev); 100 void focusInEvent(QFocusEvent *ev);
101 void focusOutEvent(QFocusEvent *ev); 101 void focusOutEvent(QFocusEvent *ev);
102}; 102};
103 103
104 104
105/** 105/**
106 This class provides a multi-column list view of todo events. 106 This class provides a multi-column list view of todo events.
107 107
108 @short multi-column list view of todo events. 108 @short multi-column list view of todo events.
109 @author Cornelius Schumacher <schumacher@kde.org> 109 @author Cornelius Schumacher <schumacher@kde.org>
110*/ 110*/
111class KOTodoView : public KOrg::BaseView 111class KOTodoView : public KOrg::BaseView
112{ 112{
113 Q_OBJECT 113 Q_OBJECT
114 public: 114 public:
115 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 115 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
116 ~KOTodoView(); 116 ~KOTodoView();
117 117
118 QPtrList<Incidence> selectedIncidences(); 118 QPtrList<Incidence> selectedIncidences();
119 QPtrList<Todo> selectedTodos(); 119 QPtrList<Todo> selectedTodos();
120 120
121 DateList selectedDates() 121 DateList selectedDates()
122 {DateList q; 122 {DateList q;
123 return q;} 123 return q;}
124 124
125 /** Return number of shown dates. TodoView does not show dates, */ 125 /** Return number of shown dates. TodoView does not show dates, */
126 int currentDateCount() { return 0; } 126 int currentDateCount() { return 0; }
127 127
128 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 128 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
129 129
130 void setDocumentId( const QString & ); 130 void setDocumentId( const QString & );
131 131
132 void saveLayout(KConfig *config, const QString &group) const; 132 void saveLayout(KConfig *config, const QString &group) const;
133 void restoreLayout(KConfig *config, const QString &group); 133 void restoreLayout(KConfig *config, const QString &group);
134 /** Create a popup menu to set categories */ 134 /** Create a popup menu to set categories */
135 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); 135 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem);
136 void setNavigator( DateNavigator* nav ) {mNavigator = nav;} 136 void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
137 QString getWhatsThisText(QPoint p);
137 138
138 public slots: 139 public slots:
139 void updateView(); 140 void updateView();
140 void updateConfig(); 141 void updateConfig();
141 142
142 void changeEventDisplay(Event *, int); 143 void changeEventDisplay(Event *, int);
143 144
144 void showDates(const QDate &start, const QDate &end); 145 void showDates(const QDate &start, const QDate &end);
145 void showEvents(QPtrList<Event> eventList); 146 void showEvents(QPtrList<Event> eventList);
146 147
147 void clearSelection(); 148 void clearSelection();
148 void jumpToDate (); 149 void jumpToDate ();
149 150
150 void editItem(QListViewItem *item); 151 void editItem(QListViewItem *item);
151 void showItem(QListViewItem *item,const QPoint &,int); 152 void showItem(QListViewItem *item,const QPoint &,int);
152 void popupMenu(QListViewItem *item,const QPoint &,int); 153 void popupMenu(QListViewItem *item,const QPoint &,int);
153 void newTodo(); 154 void newTodo();
154 void newSubTodo(); 155 void newSubTodo();
155 void unparentTodo(); 156 void unparentTodo();
156 void reparentTodo(); 157 void reparentTodo();
157 void showTodo(); 158 void showTodo();
158 void editTodo(); 159 void editTodo();
159 void cloneTodo(); 160 void cloneTodo();
160 void cancelTodo(); 161 void cancelTodo();
161 void moveTodo(); 162 void moveTodo();
162 void beamTodo(); 163 void beamTodo();
163 void deleteTodo(); 164 void deleteTodo();
164 165
165 void setNewPriority(int); 166 void setNewPriority(int);
166 void setNewPercentage(int); 167 void setNewPercentage(int);
167 void changedCategories(int); 168 void changedCategories(int);
168 169
169 void setAllOpen(); 170 void setAllOpen();
170 void setAllClose(); 171 void setAllClose();
171 void setAllFlat(); 172 void setAllFlat();
172 173
173 void purgeCompleted(); 174 void purgeCompleted();
174 void toggleCompleted(); 175 void toggleCompleted();
175 void toggleRunning(); 176 void toggleRunning();
176 void toggleQuickTodo(); 177 void toggleQuickTodo();
177 void updateTodo( Todo *, int ); 178 void updateTodo( Todo *, int );
178 179
179 void itemClicked(QListViewItem *); 180 void itemClicked(QListViewItem *);
180 void itemStateChanged(QListViewItem *); 181 void itemStateChanged(QListViewItem *);
181 void modified(bool); 182 void modified(bool);
182 void itemDoubleClicked(QListViewItem *item); 183 void itemDoubleClicked(QListViewItem *item);
183 184
184 signals: 185 signals: