summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp13
-rw-r--r--korganizer/kotodoview.h1
2 files changed, 12 insertions, 2 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 07bfdbf..a12c43e 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1,281 +1,290 @@
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#include <qwhatsthis.h>
28#include <qdialog.h> 28#include <qdialog.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31 31
32#include <qinputdialog.h> 32#include <qinputdialog.h>
33 33
34#include <qvbox.h> 34#include <qvbox.h>
35#include <kdebug.h> 35#include <kdebug.h>
36#include "koprefs.h" 36#include "koprefs.h"
37#include <klocale.h> 37#include <klocale.h>
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kdateedit.h> 39#include <kdateedit.h>
40#include "ktimeedit.h" 40#include "ktimeedit.h"
41#include <kiconloader.h> 41#include <kiconloader.h>
42#include <kmessagebox.h> 42#include <kmessagebox.h>
43 43
44#include <libkcal/icaldrag.h> 44#include <libkcal/icaldrag.h>
45#include <libkcal/vcaldrag.h> 45#include <libkcal/vcaldrag.h>
46#include <libkcal/calfilter.h> 46#include <libkcal/calfilter.h>
47#include <libkcal/dndfactory.h> 47#include <libkcal/dndfactory.h>
48#include <libkcal/calendarresources.h> 48#include <libkcal/calendarresources.h>
49#include <libkcal/resourcecalendar.h> 49#include <libkcal/resourcecalendar.h>
50#include <kresources/resourceselectdialog.h> 50#include <kresources/resourceselectdialog.h>
51#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
52#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
53#include <qpe/qpeapplication.h> 53#include <qpe/qpeapplication.h>
54#else 54#else
55#include <qapplication.h> 55#include <qapplication.h>
56#endif 56#endif
57#ifndef KORG_NOPRINTER 57#ifndef KORG_NOPRINTER
58#include "calprinter.h" 58#include "calprinter.h"
59#endif 59#endif
60#include "docprefs.h" 60#include "docprefs.h"
61 61
62#include "kotodoview.h" 62#include "kotodoview.h"
63using namespace KOrg; 63using namespace KOrg;
64 64
65 65
66KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) : 66KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) :
67 QDialog( parent, name, true ) 67 QDialog( parent, name, true )
68{ 68{
69 mStopAll = true; 69 mStopAll = true;
70 setCaption( i18n("Start todo") ); 70 setCaption( i18n("Start todo") );
71 QVBoxLayout* lay = new QVBoxLayout( this ); 71 QVBoxLayout* lay = new QVBoxLayout( this );
72 lay->setSpacing( 3 ); 72 lay->setSpacing( 3 );
73 lay->setMargin( 3 ); 73 lay->setMargin( 3 );
74 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this ); 74 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this );
75 lay->addWidget( lab ); 75 lay->addWidget( lab );
76 lab->setAlignment( AlignCenter ); 76 lab->setAlignment( AlignCenter );
77 77
78 QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this ); 78 QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this );
79 lay->addWidget( ok ); 79 lay->addWidget( ok );
80 ok->setDefault( true ); 80 ok->setDefault( true );
81 QPushButton * start = new QPushButton( i18n("Start todo"), this ); 81 QPushButton * start = new QPushButton( i18n("Start todo"), this );
82 lay->addWidget( start ); 82 lay->addWidget( start );
83 QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this ); 83 QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this );
84 lay->addWidget( cancel ); 84 lay->addWidget( cancel );
85 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 85 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
86 connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) ); 86 connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) );
87 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 87 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
88 resize( sizeHint() ); 88 resize( sizeHint() );
89 89
90} 90}
91void KOStartTodoPrefs::doStop() 91void KOStartTodoPrefs::doStop()
92{ 92{
93 mStopAll = false; 93 mStopAll = false;
94 accept(); 94 accept();
95} 95}
96KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : 96KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
97 QDialog( parent, name, true ) 97 QDialog( parent, name, true )
98{ 98{
99 mTodo = todo; 99 mTodo = todo;
100 setCaption( i18n("Stop todo") ); 100 setCaption( i18n("Stop todo") );
101 QVBoxLayout* lay = new QVBoxLayout( this ); 101 QVBoxLayout* lay = new QVBoxLayout( this );
102 lay->setSpacing( 3 ); 102 lay->setSpacing( 3 );
103 lay->setMargin( 3 ); 103 lay->setMargin( 3 );
104 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); 104 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this );
105 lay->addWidget( lab ); 105 lay->addWidget( lab );
106 lab->setAlignment( AlignHCenter ); 106 lab->setAlignment( AlignHCenter );
107 lab = new QLabel( i18n("Additional Comment:"), this ); 107 lab = new QLabel( i18n("Additional Comment:"), this );
108 lay->addWidget( lab ); 108 lay->addWidget( lab );
109 mComment = new QLineEdit( this ); 109 mComment = new QLineEdit( this );
110 lay->addWidget( mComment ); 110 lay->addWidget( mComment );
111 QHBox * start = new QHBox ( this ); 111 QHBox * start = new QHBox ( this );
112 lay->addWidget( start ); 112 lay->addWidget( start );
113 lab = new QLabel( i18n("Start:"), start ); 113 lab = new QLabel( i18n("Start:"), start );
114 QHBox * end = new QHBox ( this ); 114 QHBox * end = new QHBox ( this );
115 lay->addWidget( end ); 115 lay->addWidget( end );
116 lab = new QLabel( i18n("End:"), end ); 116 lab = new QLabel( i18n("End:"), end );
117 sde = new KDateEdit( start ); 117 sde = new KDateEdit( start );
118 ste = new KOTimeEdit( start ); 118 ste = new KOTimeEdit( start );
119 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); 119 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) );
120 ede = new KDateEdit( end ); 120 ede = new KDateEdit( end );
121 ete = new KOTimeEdit(end ); 121 ete = new KOTimeEdit(end );
122 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); 122 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) );
123 sde->setDate( mTodo->runStart().date() ); 123 sde->setDate( mTodo->runStart().date() );
124 ste->setTime( mTodo->runStart().time() ); 124 ste->setTime( mTodo->runStart().time() );
125 ede->setDate( QDate::currentDate()); 125 mStop = QDateTime::currentDateTime();
126 ete->setTime( QTime::currentTime() ); 126 ede->setDate( mStop.date());
127 ete->setTime( mStop.time() );
127 QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); 128 QPushButton * ok = new QPushButton( i18n("Stop and save"), this );
128 lay->addWidget( ok ); 129 lay->addWidget( ok );
129 ok->setDefault( true ); 130 ok->setDefault( true );
130 QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); 131 QPushButton * cancel = new QPushButton( i18n("Continue running"), this );
131 lay->addWidget( cancel ); 132 lay->addWidget( cancel );
132 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 133 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
133 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 134 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
134 ok = new QPushButton( i18n("Stop - do not save"), this ); 135 ok = new QPushButton( i18n("Stop - do not save"), this );
135 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); 136 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) );
136 lay->addWidget( ok ); 137 lay->addWidget( ok );
137 if (QApplication::desktop()->width() < 320 ) 138 if (QApplication::desktop()->width() < 320 )
138 resize( 240, sizeHint().height() ); 139 resize( 240, sizeHint().height() );
139 else 140 else
140 resize( 320, sizeHint().height() ); 141 resize( 320, sizeHint().height() );
141 142
142} 143}
143 144
144void KOStopTodoPrefs::accept() 145void KOStopTodoPrefs::accept()
145{ 146{
146 QDateTime start = QDateTime( sde->date(), ste->getTime() ); 147 QDateTime start = QDateTime( sde->date(), ste->getTime() );
147 QDateTime stop = QDateTime( ede->date(), ete->getTime() ); 148 QDateTime stop = QDateTime( ede->date(), ete->getTime() );
148 if ( start > stop ) { 149 if ( start > stop ) {
149 KMessageBox::sorry(this, 150 KMessageBox::sorry(this,
150 i18n("The start time is\nafter the end time!"), 151 i18n("The start time is\nafter the end time!"),
151 i18n("Time mismatch!")); 152 i18n("Time mismatch!"));
152 return; 153 return;
153 } 154 }
155 // restoring the seconds
156 if ( start == QDateTime( mTodo->runStart().date(),
157 QTime(mTodo->runStart().time().hour() , mTodo->runStart().time().minute() ) ) )
158 start = mTodo->runStart();
159 if ( stop == QDateTime( mStop.date(),
160 QTime( mStop.time().hour() , mStop.time().minute() ) ) )
161 stop = mStop;
162
154 mTodo->saveRunningInfo( mComment->text(), start, stop ); 163 mTodo->saveRunningInfo( mComment->text(), start, stop );
155 QDialog::accept(); 164 QDialog::accept();
156} 165}
157void KOStopTodoPrefs::doNotSave() 166void KOStopTodoPrefs::doNotSave()
158{ 167{
159 int result = KMessageBox::warningContinueCancel(this, 168 int result = KMessageBox::warningContinueCancel(this,
160 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); 169 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") );
161 if (result != KMessageBox::Continue) return; 170 if (result != KMessageBox::Continue) return;
162 mTodo->stopRunning(); 171 mTodo->stopRunning();
163 QDialog::accept(); 172 QDialog::accept();
164} 173}
165 174
166 175
167class KOTodoViewWhatsThis :public QWhatsThis 176class KOTodoViewWhatsThis :public QWhatsThis
168{ 177{
169public: 178public:
170 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 179 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
171 180
172protected: 181protected:
173 virtual QString text( const QPoint& p) 182 virtual QString text( const QPoint& p)
174 { 183 {
175 return _view->getWhatsThisText(p) ; 184 return _view->getWhatsThisText(p) ;
176 } 185 }
177private: 186private:
178 QWidget* _wid; 187 QWidget* _wid;
179 KOTodoView * _view; 188 KOTodoView * _view;
180}; 189};
181 190
182KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 191KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
183 const char *name) : 192 const char *name) :
184 KListView(parent,name) 193 KListView(parent,name)
185{ 194{
186 mName = QString ( name ); 195 mName = QString ( name );
187 mCalendar = calendar; 196 mCalendar = calendar;
188#ifndef DESKTOP_VERSION 197#ifndef DESKTOP_VERSION
189 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 198 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
190#endif 199#endif
191 mOldCurrent = 0; 200 mOldCurrent = 0;
192 mMousePressed = false; 201 mMousePressed = false;
193 202
194 setAcceptDrops(true); 203 setAcceptDrops(true);
195 viewport()->setAcceptDrops(true); 204 viewport()->setAcceptDrops(true);
196 int size = 16; 205 int size = 16;
197 if (qApp->desktop()->width() < 300 ) 206 if (qApp->desktop()->width() < 300 )
198 size = 12; 207 size = 12;
199 setTreeStepSize( size + 6 ); 208 setTreeStepSize( size + 6 );
200 209
201} 210}
202 211
203void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 212void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
204{ 213{
205#ifndef KORG_NODND 214#ifndef KORG_NODND
206// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 215// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
207 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 216 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
208 !QTextDrag::canDecode( e ) ) { 217 !QTextDrag::canDecode( e ) ) {
209 e->ignore(); 218 e->ignore();
210 return; 219 return;
211 } 220 }
212 221
213 mOldCurrent = currentItem(); 222 mOldCurrent = currentItem();
214#endif 223#endif
215} 224}
216 225
217 226
218void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 227void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
219{ 228{
220#ifndef KORG_NODND 229#ifndef KORG_NODND
221// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 230// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
222 231
223 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 232 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
224 !QTextDrag::canDecode( e ) ) { 233 !QTextDrag::canDecode( e ) ) {
225 e->ignore(); 234 e->ignore();
226 return; 235 return;
227 } 236 }
228 237
229 e->accept(); 238 e->accept();
230#endif 239#endif
231} 240}
232 241
233void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) 242void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
234{ 243{
235#ifndef KORG_NODND 244#ifndef KORG_NODND
236// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; 245// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl;
237 246
238 setCurrentItem(mOldCurrent); 247 setCurrentItem(mOldCurrent);
239 setSelected(mOldCurrent,true); 248 setSelected(mOldCurrent,true);
240#endif 249#endif
241} 250}
242 251
243void KOTodoListView::contentsDropEvent(QDropEvent *e) 252void KOTodoListView::contentsDropEvent(QDropEvent *e)
244{ 253{
245#ifndef KORG_NODND 254#ifndef KORG_NODND
246// kdDebug() << "KOTodoListView::contentsDropEvent" << endl; 255// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
247 256
248 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 257 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
249 !QTextDrag::canDecode( e ) ) { 258 !QTextDrag::canDecode( e ) ) {
250 e->ignore(); 259 e->ignore();
251 return; 260 return;
252 } 261 }
253 262
254 DndFactory factory( mCalendar ); 263 DndFactory factory( mCalendar );
255 Todo *todo = factory.createDropTodo(e); 264 Todo *todo = factory.createDropTodo(e);
256 265
257 if (todo) { 266 if (todo) {
258 e->acceptAction(); 267 e->acceptAction();
259 268
260 KOTodoViewItem *destination = 269 KOTodoViewItem *destination =
261 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); 270 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
262 Todo *destinationEvent = 0; 271 Todo *destinationEvent = 0;
263 if (destination) destinationEvent = destination->todo(); 272 if (destination) destinationEvent = destination->todo();
264 273
265 Todo *existingTodo = mCalendar->todo(todo->uid()); 274 Todo *existingTodo = mCalendar->todo(todo->uid());
266 275
267 if(existingTodo) { 276 if(existingTodo) {
268 Incidence *to = destinationEvent; 277 Incidence *to = destinationEvent;
269 while(to) { 278 while(to) {
270 if (to->uid() == todo->uid()) { 279 if (to->uid() == todo->uid()) {
271 KMessageBox::sorry(this, 280 KMessageBox::sorry(this,
272 i18n("Cannot move Todo to itself\nor a child of itself"), 281 i18n("Cannot move Todo to itself\nor a child of itself"),
273 i18n("Drop Todo")); 282 i18n("Drop Todo"));
274 delete todo; 283 delete todo;
275 return; 284 return;
276 } 285 }
277 to = to->relatedTo(); 286 to = to->relatedTo();
278 } 287 }
279 internalDrop = true; 288 internalDrop = true;
280 if ( destinationEvent ) 289 if ( destinationEvent )
281 reparentTodoSignal( destinationEvent, existingTodo ); 290 reparentTodoSignal( destinationEvent, existingTodo );
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 9180015..ecd0ad9 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -1,201 +1,202 @@
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#ifndef KOTODOVIEW_H 23#ifndef KOTODOVIEW_H
24#define KOTODOVIEW_H 24#define KOTODOVIEW_H
25 25
26#include <qfont.h> 26#include <qfont.h>
27#include <qfontmetrics.h> 27#include <qfontmetrics.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qptrlist.h> 29#include <qptrlist.h>
30#include <qstrlist.h> 30#include <qstrlist.h>
31#include <qlistbox.h> 31#include <qlistbox.h>
32#include <qpopupmenu.h> 32#include <qpopupmenu.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qmap.h> 34#include <qmap.h>
35#include <qdialog.h> 35#include <qdialog.h>
36#include <qlabel.h> 36#include <qlabel.h>
37#include <qlistview.h> 37#include <qlistview.h>
38#include <klistview.h> 38#include <klistview.h>
39 39
40#include <libkcal/calendar.h> 40#include <libkcal/calendar.h>
41#include <libkcal/todo.h> 41#include <libkcal/todo.h>
42 42
43#include <korganizer/baseview.h> 43#include <korganizer/baseview.h>
44 44
45#include "kotodoviewitem.h" 45#include "kotodoviewitem.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "koglobals.h" 47#include "koglobals.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49 49
50class QDragEnterEvent; 50class QDragEnterEvent;
51class QDragMoveEvent; 51class QDragMoveEvent;
52class QDragLeaveEvent; 52class QDragLeaveEvent;
53class QDropEvent; 53class QDropEvent;
54class KOTodoViewWhatsThis; 54class KOTodoViewWhatsThis;
55class KDateEdit; 55class KDateEdit;
56class KOTimeEdit; 56class KOTimeEdit;
57 57
58class DocPrefs; 58class DocPrefs;
59 59
60 60
61class KOStopTodoPrefs : public QDialog 61class KOStopTodoPrefs : public QDialog
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64 public: 64 public:
65 KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ; 65 KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ;
66 66
67 67
68private slots: 68private slots:
69 void doNotSave(); 69 void doNotSave();
70 void accept(); 70 void accept();
71private: 71private:
72 Todo* mTodo; 72 Todo* mTodo;
73 QLineEdit* mComment; 73 QLineEdit* mComment;
74 QDateTime mStop;
74 KDateEdit *sde, *ede; 75 KDateEdit *sde, *ede;
75 KOTimeEdit *ste, *ete; 76 KOTimeEdit *ste, *ete;
76 77
77}; 78};
78 79
79class KOStartTodoPrefs : public QDialog 80class KOStartTodoPrefs : public QDialog
80{ 81{
81 Q_OBJECT 82 Q_OBJECT
82 public: 83 public:
83 KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ; 84 KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ;
84 85
85 bool stopAll() { return mStopAll; } 86 bool stopAll() { return mStopAll; }
86private slots: 87private slots:
87 void doStop(); 88 void doStop();
88private: 89private:
89 bool mStopAll; 90 bool mStopAll;
90 91
91}; 92};
92 93
93class KOTodoListView : public KListView 94class KOTodoListView : public KListView
94{ 95{
95 Q_OBJECT 96 Q_OBJECT
96 public: 97 public:
97 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 98 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
98 virtual ~KOTodoListView() {} 99 virtual ~KOTodoListView() {}
99 100
100 signals: 101 signals:
101 void paintNeeded(); 102 void paintNeeded();
102 void todoDropped(Todo *, int); 103 void todoDropped(Todo *, int);
103 void double_Clicked(QListViewItem *item); 104 void double_Clicked(QListViewItem *item);
104 void reparentTodoSignal( Todo *,Todo * ); 105 void reparentTodoSignal( Todo *,Todo * );
105 void unparentTodoSignal(Todo *); 106 void unparentTodoSignal(Todo *);
106 void deleteTodo( Todo * ); 107 void deleteTodo( Todo * );
107 protected: 108 protected:
108 void wheelEvent (QWheelEvent *e); 109 void wheelEvent (QWheelEvent *e);
109 void contentsDragEnterEvent(QDragEnterEvent *); 110 void contentsDragEnterEvent(QDragEnterEvent *);
110 void contentsDragMoveEvent(QDragMoveEvent *); 111 void contentsDragMoveEvent(QDragMoveEvent *);
111 void contentsDragLeaveEvent(QDragLeaveEvent *); 112 void contentsDragLeaveEvent(QDragLeaveEvent *);
112 void contentsDropEvent(QDropEvent *); 113 void contentsDropEvent(QDropEvent *);
113 114
114 void contentsMousePressEvent(QMouseEvent *); 115 void contentsMousePressEvent(QMouseEvent *);
115 void contentsMouseMoveEvent(QMouseEvent *); 116 void contentsMouseMoveEvent(QMouseEvent *);
116 void contentsMouseReleaseEvent(QMouseEvent *); 117 void contentsMouseReleaseEvent(QMouseEvent *);
117 void contentsMouseDoubleClickEvent(QMouseEvent *); 118 void contentsMouseDoubleClickEvent(QMouseEvent *);
118 119
119 private: 120 private:
120 void paintEvent(QPaintEvent * pevent); 121 void paintEvent(QPaintEvent * pevent);
121 bool internalDrop; 122 bool internalDrop;
122 QString mName; 123 QString mName;
123 Calendar *mCalendar; 124 Calendar *mCalendar;
124 QPoint mPressPos; 125 QPoint mPressPos;
125 bool mMousePressed; 126 bool mMousePressed;
126 QListViewItem *mOldCurrent; 127 QListViewItem *mOldCurrent;
127 bool mFlagKeyPressed; 128 bool mFlagKeyPressed;
128 void keyPressEvent ( QKeyEvent * ) ; 129 void keyPressEvent ( QKeyEvent * ) ;
129 void keyReleaseEvent ( QKeyEvent * ) ; 130 void keyReleaseEvent ( QKeyEvent * ) ;
130}; 131};
131 132
132 133
133/** 134/**
134 This is the line-edit on top of the todoview for fast addition of new todos 135 This is the line-edit on top of the todoview for fast addition of new todos
135*/ 136*/
136class KOQuickTodo : public QLineEdit 137class KOQuickTodo : public QLineEdit
137{ 138{
138 public: 139 public:
139 KOQuickTodo(QWidget *parent=0); 140 KOQuickTodo(QWidget *parent=0);
140 protected: 141 protected:
141 void focusInEvent(QFocusEvent *ev); 142 void focusInEvent(QFocusEvent *ev);
142 void focusOutEvent(QFocusEvent *ev); 143 void focusOutEvent(QFocusEvent *ev);
143}; 144};
144 145
145 146
146/** 147/**
147 This class provides a multi-column list view of todo events. 148 This class provides a multi-column list view of todo events.
148 149
149 @short multi-column list view of todo events. 150 @short multi-column list view of todo events.
150 @author Cornelius Schumacher <schumacher@kde.org> 151 @author Cornelius Schumacher <schumacher@kde.org>
151*/ 152*/
152class KOTodoView : public KOrg::BaseView 153class KOTodoView : public KOrg::BaseView
153{ 154{
154 Q_OBJECT 155 Q_OBJECT
155 public: 156 public:
156 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 157 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
157 ~KOTodoView(); 158 ~KOTodoView();
158 159
159 QPtrList<Incidence> selectedIncidences(); 160 QPtrList<Incidence> selectedIncidences();
160 QPtrList<Todo> selectedTodos(); 161 QPtrList<Todo> selectedTodos();
161 162
162 DateList selectedDates() 163 DateList selectedDates()
163 {DateList q; 164 {DateList q;
164 return q;} 165 return q;}
165 166
166 /** Return number of shown dates. TodoView does not show dates, */ 167 /** Return number of shown dates. TodoView does not show dates, */
167 int currentDateCount() { return 0; } 168 int currentDateCount() { return 0; }
168 169
169 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 170 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
170 171
171 void setDocumentId( const QString & ); 172 void setDocumentId( const QString & );
172 173
173 void saveLayout(KConfig *config, const QString &group) const; 174 void saveLayout(KConfig *config, const QString &group) const;
174 void restoreLayout(KConfig *config, const QString &group); 175 void restoreLayout(KConfig *config, const QString &group);
175 void setNavigator( DateNavigator* nav ) {mNavigator = nav;} 176 void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
176 QString getWhatsThisText(QPoint p); 177 QString getWhatsThisText(QPoint p);
177 void clearList( bool saveCurrentItem = true ); 178 void clearList( bool saveCurrentItem = true );
178 179
179 public slots: 180 public slots:
180 void updateView(); 181 void updateView();
181 void updateConfig(); 182 void updateConfig();
182 183
183 void changeEventDisplay(Event *, int); 184 void changeEventDisplay(Event *, int);
184 185
185 void showDates(const QDate &start, const QDate &end); 186 void showDates(const QDate &start, const QDate &end);
186 void showEvents(QPtrList<Event> eventList); 187 void showEvents(QPtrList<Event> eventList);
187 188
188 void clearSelection(); 189 void clearSelection();
189 void jumpToDate (); 190 void jumpToDate ();
190 191
191 void editItem(QListViewItem *item); 192 void editItem(QListViewItem *item);
192 void showItem(QListViewItem *item,const QPoint &,int); 193 void showItem(QListViewItem *item,const QPoint &,int);
193 void popupMenu(QListViewItem *item,const QPoint &,int); 194 void popupMenu(QListViewItem *item,const QPoint &,int);
194 void newTodo(); 195 void newTodo();
195 void newSubTodo(); 196 void newSubTodo();
196 void unparentTodo(); 197 void unparentTodo();
197 void reparentTodo(); 198 void reparentTodo();
198 void showTodo(); 199 void showTodo();
199 void editTodo(); 200 void editTodo();
200 void cloneTodo(); 201 void cloneTodo();
201 void cancelTodo(); 202 void cancelTodo();