summaryrefslogtreecommitdiffabout
Unidiff
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
@@ -27,81 +27,101 @@
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 }
@@ -475,65 +495,64 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
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{
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index 7321af2..5b8f420 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -17,64 +17,65 @@
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; }
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index b21b419..732fc46 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -3,94 +3,113 @@
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 }
@@ -195,64 +214,65 @@ bool ListItemVisitor::visit(Journal * j)
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);
@@ -266,64 +286,72 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
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 ;
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index 23afdb1..be9b09c 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -90,64 +90,65 @@ class KOListViewListView : public KListView
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:
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index da8b4bc..c5b9a21 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1,87 +1,105 @@
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();
@@ -366,64 +384,66 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
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();
@@ -503,64 +523,72 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
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;
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 2a9e737..1642132 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -105,64 +105,65 @@ class KOQuickTodo : public QLineEdit
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