summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp198
1 files changed, 107 insertions, 91 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index ba94057..2b8fbd3 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -16,27 +16,43 @@
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 <QDesktopWidget>
25
24#include <qlayout.h> 26#include <qlayout.h>
25#include <qheader.h> 27#include <q3header.h>
26#include <qcursor.h> 28#include <qcursor.h>
27#include <qwhatsthis.h> 29#include <q3whatsthis.h>
28#include <qdialog.h> 30#include <qdialog.h>
29#include <qlabel.h> 31#include <qlabel.h>
30#include <qpushbutton.h> 32#include <qpushbutton.h>
31 33
32#include <qinputdialog.h> 34#include <qinputdialog.h>
33 35
34#include <qvbox.h> 36#include <q3vbox.h>
37//Added by qt3to4:
38#include <QWheelEvent>
39#include <QFocusEvent>
40#include <QDragLeaveEvent>
41#include <QMouseEvent>
42#include <QDragEnterEvent>
43#include <QKeyEvent>
44#include <Q3HBoxLayout>
45#include <Q3VBoxLayout>
46#include <QDropEvent>
47#include <QDragMoveEvent>
48#include <QPaintEvent>
49#include <Q3PopupMenu>
50#include <Q3PtrList>
35#include <kdebug.h> 51#include <kdebug.h>
36#include "koprefs.h" 52#include "koprefs.h"
37#include <klocale.h> 53#include <klocale.h>
38#include <kglobal.h> 54#include <kglobal.h>
39#include <kdateedit.h> 55#include <kdateedit.h>
40#include "ktimeedit.h" 56#include "ktimeedit.h"
41#include <kiconloader.h> 57#include <kiconloader.h>
42#include <kmessagebox.h> 58#include <kmessagebox.h>
@@ -63,22 +79,22 @@
63using namespace KOrg; 79using namespace KOrg;
64 80
65 81
66KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) : 82KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) :
67 QDialog( parent, name, true ) 83 QDialog( parent, name, true )
68{ 84{
69 mStopAll = true; 85 mStopAll = true;
70 setCaption( i18n("Start todo") ); 86 setCaption( i18n("Start todo") );
71 QVBoxLayout* lay = new QVBoxLayout( this ); 87 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
72 lay->setSpacing( 3 ); 88 lay->setSpacing( 3 );
73 lay->setMargin( 3 ); 89 lay->setMargin( 3 );
74 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this ); 90 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this );
75 lay->addWidget( lab ); 91 lay->addWidget( lab );
76 lab->setAlignment( AlignCenter ); 92 lab->setAlignment( Qt::AlignCenter );
77 93
78 QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this ); 94 QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this );
79 lay->addWidget( ok ); 95 lay->addWidget( ok );
80 ok->setDefault( true ); 96 ok->setDefault( true );
81 QPushButton * start = new QPushButton( i18n("Start todo"), this ); 97 QPushButton * start = new QPushButton( i18n("Start todo"), this );
82 lay->addWidget( start ); 98 lay->addWidget( start );
83 QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this ); 99 QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this );
84 lay->addWidget( cancel ); 100 lay->addWidget( cancel );
@@ -93,30 +109,30 @@ void KOStartTodoPrefs::doStop()
93 mStopAll = false; 109 mStopAll = false;
94 accept(); 110 accept();
95} 111}
96KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : 112KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
97 QDialog( parent, name, true ) 113 QDialog( parent, name, true )
98{ 114{
99 mTodo = todo; 115 mTodo = todo;
100 setCaption( i18n("Stop todo") ); 116 setCaption( i18n("Stop todo") );
101 QVBoxLayout* lay = new QVBoxLayout( this ); 117 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
102 lay->setSpacing( 3 ); 118 lay->setSpacing( 3 );
103 lay->setMargin( 3 ); 119 lay->setMargin( 3 );
104 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); 120 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this );
105 lay->addWidget( lab ); 121 lay->addWidget( lab );
106 lab->setAlignment( AlignHCenter ); 122 lab->setAlignment( Qt::AlignHCenter );
107 lab = new QLabel( i18n("Additional Comment:"), this ); 123 lab = new QLabel( i18n("Additional Comment:"), this );
108 lay->addWidget( lab ); 124 lay->addWidget( lab );
109 mComment = new QLineEdit( this ); 125 mComment = new QLineEdit( this );
110 lay->addWidget( mComment ); 126 lay->addWidget( mComment );
111 QHBox * start = new QHBox ( this ); 127 Q3HBox * start = new Q3HBox ( this );
112 lay->addWidget( start ); 128 lay->addWidget( start );
113 lab = new QLabel( i18n("Start:"), start ); 129 lab = new QLabel( i18n("Start:"), start );
114 QHBox * end = new QHBox ( this ); 130 Q3HBox * end = new Q3HBox ( this );
115 lay->addWidget( end ); 131 lay->addWidget( end );
116 lab = new QLabel( i18n("End:"), end ); 132 lab = new QLabel( i18n("End:"), end );
117 sde = new KDateEdit( start ); 133 sde = new KDateEdit( start );
118 ste = new KOTimeEdit( start ); 134 ste = new KOTimeEdit( start );
119 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); 135 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) );
120 ede = new KDateEdit( end ); 136 ede = new KDateEdit( end );
121 ete = new KOTimeEdit(end ); 137 ete = new KOTimeEdit(end );
122 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); 138 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) );
@@ -168,20 +184,20 @@ void KOStopTodoPrefs::doNotSave()
168 int result = KMessageBox::warningContinueCancel(this, 184 int result = KMessageBox::warningContinueCancel(this,
169 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); 185 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") );
170 if (result != KMessageBox::Continue) return; 186 if (result != KMessageBox::Continue) return;
171 mTodo->stopRunning(); 187 mTodo->stopRunning();
172 QDialog::accept(); 188 QDialog::accept();
173} 189}
174 190
175 191
176class KOTodoViewWhatsThis :public QWhatsThis 192class KOTodoViewWhatsThis :public Q3WhatsThis
177{ 193{
178public: 194public:
179 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 195 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : Q3WhatsThis( wid ), _wid(wid),_view (view) { };
180 196
181protected: 197protected:
182 virtual QString text( const QPoint& p) 198 virtual QString text( const QPoint& p)
183 { 199 {
184 return _view->getWhatsThisText(p) ; 200 return _view->getWhatsThisText(p) ;
185 } 201 }
186private: 202private:
187 QWidget* _wid; 203 QWidget* _wid;
@@ -209,33 +225,33 @@ KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
209 225
210} 226}
211 227
212void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 228void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
213{ 229{
214#ifndef KORG_NODND 230#ifndef KORG_NODND
215// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 231// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
216 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 232 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
217 !QTextDrag::canDecode( e ) ) { 233 !Q3TextDrag::canDecode( e ) ) {
218 e->ignore(); 234 e->ignore();
219 return; 235 return;
220 } 236 }
221 237
222 mOldCurrent = currentItem(); 238 mOldCurrent = currentItem();
223#endif 239#endif
224} 240}
225 241
226 242
227void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 243void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
228{ 244{
229#ifndef KORG_NODND 245#ifndef KORG_NODND
230// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 246// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
231 247
232 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 248 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
233 !QTextDrag::canDecode( e ) ) { 249 !Q3TextDrag::canDecode( e ) ) {
234 e->ignore(); 250 e->ignore();
235 return; 251 return;
236 } 252 }
237 253
238 e->accept(); 254 e->accept();
239#endif 255#endif
240} 256}
241 257
@@ -250,17 +266,17 @@ void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
250} 266}
251 267
252void KOTodoListView::contentsDropEvent(QDropEvent *e) 268void KOTodoListView::contentsDropEvent(QDropEvent *e)
253{ 269{
254#ifndef KORG_NODND 270#ifndef KORG_NODND
255// kdDebug() << "KOTodoListView::contentsDropEvent" << endl; 271// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
256 272
257 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 273 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
258 !QTextDrag::canDecode( e ) ) { 274 !Q3TextDrag::canDecode( e ) ) {
259 e->ignore(); 275 e->ignore();
260 return; 276 return;
261 } 277 }
262 278
263 DndFactory factory( mCalendar ); 279 DndFactory factory( mCalendar );
264 Todo *todo = factory.createDropTodo(e); 280 Todo *todo = factory.createDropTodo(e);
265 281
266 if (todo) { 282 if (todo) {
@@ -295,17 +311,17 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
295 mCalendar->addTodo(todo); 311 mCalendar->addTodo(todo);
296 emit todoDropped(todo, KOGlobals::EVENTADDED); 312 emit todoDropped(todo, KOGlobals::EVENTADDED);
297 if ( destinationEvent ) 313 if ( destinationEvent )
298 reparentTodoSignal( destinationEvent, todo ); 314 reparentTodoSignal( destinationEvent, todo );
299 } 315 }
300 } 316 }
301 else { 317 else {
302 QString text; 318 QString text;
303 if (QTextDrag::decode(e,text)) { 319 if (Q3TextDrag::decode(e,text)) {
304 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); 320 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) );
305 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); 321 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) ));
306 qDebug("Dropped : " + text); 322 qDebug("Dropped : " + text);
307 QStringList emails = QStringList::split(",",text); 323 QStringList emails = QStringList::split(",",text);
308 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 324 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
309 int pos = (*it).find("<"); 325 int pos = (*it).find("<");
310 QString name = (*it).left(pos); 326 QString name = (*it).left(pos);
311 QString email = (*it).mid(pos); 327 QString email = (*it).mid(pos);
@@ -318,24 +334,24 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
318 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); 334 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable ");
319 e->ignore(); 335 e->ignore();
320 } 336 }
321 } 337 }
322#endif 338#endif
323} 339}
324void KOTodoListView::wheelEvent (QWheelEvent *e) 340void KOTodoListView::wheelEvent (QWheelEvent *e)
325{ 341{
326 QListView::wheelEvent (e); 342 Q3ListView::wheelEvent (e);
327} 343}
328 344
329void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 345void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
330{ 346{
331 347
332 QPoint p(contentsToViewport(e->pos())); 348 QPoint p(contentsToViewport(e->pos()));
333 QListViewItem *i = itemAt(p); 349 Q3ListViewItem *i = itemAt(p);
334 bool rootClicked = true; 350 bool rootClicked = true;
335 if (i) { 351 if (i) {
336 // if the user clicked into the root decoration of the item, don't 352 // if the user clicked into the root decoration of the item, don't
337 // try to start a drag! 353 // try to start a drag!
338 int X = p.x(); 354 int X = p.x();
339 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); 355 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
340 if (X > header()->sectionPos(0) + 356 if (X > header()->sectionPos(0) +
341 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 357 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
@@ -343,45 +359,45 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
343 X < header()->sectionPos(0)) { 359 X < header()->sectionPos(0)) {
344 rootClicked = false; 360 rootClicked = false;
345 } 361 }
346 } else { 362 } else {
347 rootClicked = false; 363 rootClicked = false;
348 } 364 }
349#ifndef KORG_NODND 365#ifndef KORG_NODND
350 mMousePressed = false; 366 mMousePressed = false;
351 if (! rootClicked && !( e->button() == RightButton) ) { 367 if (! rootClicked && !( e->button() == Qt::RightButton) ) {
352 mPressPos = e->pos(); 368 mPressPos = e->pos();
353 mMousePressed = true; 369 mMousePressed = true;
354 } else { 370 } else {
355 mMousePressed = false; 371 mMousePressed = false;
356 } 372 }
357#endif 373#endif
358 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); 374 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
359#ifndef DESKTOP_VERSION 375#ifndef DESKTOP_VERSION
360 if (!( e->button() == RightButton && rootClicked) ) 376 if (!( e->button() == RightButton && rootClicked) )
361 QListView::contentsMousePressEvent(e); 377 Q3ListView::contentsMousePressEvent(e);
362#else 378#else
363 QListView::contentsMousePressEvent(e); 379 Q3ListView::contentsMousePressEvent(e);
364#endif 380#endif
365} 381}
366void KOTodoListView::paintEvent(QPaintEvent* e) 382void KOTodoListView::paintEvent(QPaintEvent* e)
367{ 383{
368 emit paintNeeded(); 384 emit paintNeeded();
369 QListView::paintEvent( e); 385 Q3ListView::paintEvent( e);
370} 386}
371void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 387void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
372{ 388{
373 389
374#ifndef KORG_NODND 390#ifndef KORG_NODND
375 //QListView::contentsMouseMoveEvent(e); 391 //QListView::contentsMouseMoveEvent(e);
376 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 392 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
377 QApplication::startDragDistance()*3) { 393 QApplication::startDragDistance()*3) {
378 mMousePressed = false; 394 mMousePressed = false;
379 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 395 Q3ListViewItem *item = itemAt(contentsToViewport(mPressPos));
380 if (item) { 396 if (item) {
381 DndFactory factory( mCalendar ); 397 DndFactory factory( mCalendar );
382 ICalDrag *vd = factory.createDrag( 398 ICalDrag *vd = factory.createDrag(
383 ((KOTodoViewItem *)item)->todo(),viewport()); 399 ((KOTodoViewItem *)item)->todo(),viewport());
384 internalDrop = false; 400 internalDrop = false;
385 // we cannot do any senseful here, because the DnD is still broken in Qt 401 // we cannot do any senseful here, because the DnD is still broken in Qt
386 if (vd->drag()) { 402 if (vd->drag()) {
387 if ( !internalDrop ) { 403 if ( !internalDrop ) {
@@ -417,23 +433,23 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e )
417 } 433 }
418 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 434 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
419 e->ignore(); 435 e->ignore();
420 // qDebug(" ignore %d",e->isAutoRepeat() ); 436 // qDebug(" ignore %d",e->isAutoRepeat() );
421 return; 437 return;
422 } 438 }
423 if (! e->isAutoRepeat() ) 439 if (! e->isAutoRepeat() )
424 mFlagKeyPressed = true; 440 mFlagKeyPressed = true;
425 QListViewItem* cn; 441 Q3ListViewItem* cn;
426 if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") { 442 if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") {
427 cn = currentItem(); 443 cn = currentItem();
428 if ( cn ) { 444 if ( cn ) {
429 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 445 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
430 if ( ci ){ 446 if ( ci ){
431 if ( e->state() == ShiftButton ) 447 if ( e->state() == Qt::ShiftButton )
432 ci->setOn( false ); 448 ci->setOn( false );
433 else 449 else
434 ci->setOn( true ); 450 ci->setOn( true );
435 cn = cn->itemBelow(); 451 cn = cn->itemBelow();
436 if ( cn ) { 452 if ( cn ) {
437 setCurrentItem ( cn ); 453 setCurrentItem ( cn );
438 ensureItemVisible ( cn ); 454 ensureItemVisible ( cn );
439 } 455 }
@@ -444,60 +460,60 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e )
444 e->accept(); 460 e->accept();
445 return; 461 return;
446 } 462 }
447 463
448 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 464 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
449 switch ( e->key() ) { 465 switch ( e->key() ) {
450 case Qt::Key_Down: 466 case Qt::Key_Down:
451 case Qt::Key_Up: 467 case Qt::Key_Up:
452 QListView::keyPressEvent ( e ); 468 Q3ListView::keyPressEvent ( e );
453 e->accept(); 469 e->accept();
454 break; 470 break;
455 case Qt::Key_Left: 471 case Qt::Key_Left:
456 case Qt::Key_Right: 472 case Qt::Key_Right:
457 QListView::keyPressEvent ( e ); 473 Q3ListView::keyPressEvent ( e );
458 e->accept(); 474 e->accept();
459 return; 475 return;
460 break; 476 break;
461 default: 477 default:
462 e->ignore(); 478 e->ignore();
463 break; 479 break;
464 } 480 }
465 return; 481 return;
466 } 482 }
467 e->ignore(); 483 e->ignore();
468} 484}
469void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 485void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
470{ 486{
471 QListView::contentsMouseReleaseEvent(e); 487 Q3ListView::contentsMouseReleaseEvent(e);
472 mMousePressed = false; 488 mMousePressed = false;
473} 489}
474 490
475void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 491void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
476{ 492{
477 if (!e) return; 493 if (!e) return;
478 494
479 QPoint vp = contentsToViewport(e->pos()); 495 QPoint vp = contentsToViewport(e->pos());
480 496
481 QListViewItem *item = itemAt(vp); 497 Q3ListViewItem *item = itemAt(vp);
482 498
483 emit double_Clicked(item); 499 emit double_Clicked(item);
484 if (!item) return; 500 if (!item) return;
485 501
486 emit doubleClicked(item,vp,0); 502 emit doubleClicked(item,vp,0);
487} 503}
488 504
489///////////////////////////////////////////////////////////////////////////// 505/////////////////////////////////////////////////////////////////////////////
490 506
491KOQuickTodo::KOQuickTodo(QWidget *parent) : 507KOQuickTodo::KOQuickTodo(QWidget *parent) :
492 QLineEdit(parent) 508 QLineEdit(parent)
493{ 509{
494 setText(i18n("Click to add new Todo")); 510 setText(i18n("Click to add new Todo"));
495 setFocusPolicy ( QWidget::ClickFocus ); 511 setFocusPolicy ( Qt::ClickFocus );
496} 512}
497 513
498void KOQuickTodo::focusInEvent(QFocusEvent *ev) 514void KOQuickTodo::focusInEvent(QFocusEvent *ev)
499{ 515{
500 if ( text()==i18n("Click to add new Todo") ) 516 if ( text()==i18n("Click to add new Todo") )
501 setText(""); 517 setText("");
502 QLineEdit::focusInEvent(ev); 518 QLineEdit::focusInEvent(ev);
503} 519}
@@ -518,24 +534,24 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
518 mCurItemRootParent = 0; 534 mCurItemRootParent = 0;
519 mCurItemParent = 0; 535 mCurItemParent = 0;
520 mCurItemAbove = 0; 536 mCurItemAbove = 0;
521 mActiveItem = 0; 537 mActiveItem = 0;
522 mCategoryPopupMenu = 0; 538 mCategoryPopupMenu = 0;
523 mPendingUpdateBeforeRepaint = false; 539 mPendingUpdateBeforeRepaint = false;
524 isFlatDisplay = false; 540 isFlatDisplay = false;
525 mNavigator = 0; 541 mNavigator = 0;
526 QBoxLayout *topLayout = new QVBoxLayout(this); 542 Q3BoxLayout *topLayout = new Q3VBoxLayout(this);
527 mName = QString ( name ); 543 mName = QString ( name );
528 mBlockUpdate = false; 544 mBlockUpdate = false;
529 mQuickBar = new QWidget( this ); 545 mQuickBar = new QWidget( this );
530 topLayout->addWidget(mQuickBar); 546 topLayout->addWidget(mQuickBar);
531 547
532 mQuickAdd = new KOQuickTodo(mQuickBar); 548 mQuickAdd = new KOQuickTodo(mQuickBar);
533 QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); 549 Q3BoxLayout *quickLayout = new Q3HBoxLayout(mQuickBar);
534 quickLayout->addWidget( mQuickAdd ); 550 quickLayout->addWidget( mQuickAdd );
535 mNewSubBut = new QPushButton( "sub",mQuickBar ); 551 mNewSubBut = new QPushButton( "sub",mQuickBar );
536 QPushButton * s_done = new QPushButton( "D",mQuickBar ); 552 QPushButton * s_done = new QPushButton( "D",mQuickBar );
537 QPushButton * s_run = new QPushButton( "R",mQuickBar ); 553 QPushButton * s_run = new QPushButton( "R",mQuickBar );
538 QPushButton * allopen = new QPushButton( "O",mQuickBar ); 554 QPushButton * allopen = new QPushButton( "O",mQuickBar );
539 QPushButton * allclose = new QPushButton( "C",mQuickBar ); 555 QPushButton * allclose = new QPushButton( "C",mQuickBar );
540 QPushButton * flat = new QPushButton( "F",mQuickBar ); 556 QPushButton * flat = new QPushButton( "F",mQuickBar );
541 557
@@ -563,29 +579,29 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
563 579
564 flat->setFixedHeight(fixhei ); 580 flat->setFixedHeight(fixhei );
565 s_done->setFixedHeight(fixhei ); 581 s_done->setFixedHeight(fixhei );
566 allopen->setFixedHeight(fixhei ); 582 allopen->setFixedHeight(fixhei );
567 allclose->setFixedHeight(fixhei ); 583 allclose->setFixedHeight(fixhei );
568 s_run->setFixedHeight(fixhei ); 584 s_run->setFixedHeight(fixhei );
569 mNewSubBut->setFixedHeight(fixhei ); 585 mNewSubBut->setFixedHeight(fixhei );
570 586
571 flat->setFocusPolicy( NoFocus ); 587 flat->setFocusPolicy( Qt::NoFocus );
572 s_done->setFocusPolicy( NoFocus ); 588 s_done->setFocusPolicy( Qt::NoFocus );
573 allopen->setFocusPolicy( NoFocus ); 589 allopen->setFocusPolicy( Qt::NoFocus );
574 allclose->setFocusPolicy( NoFocus ); 590 allclose->setFocusPolicy( Qt::NoFocus );
575 s_run->setFocusPolicy( NoFocus ); 591 s_run->setFocusPolicy( Qt::NoFocus );
576 mNewSubBut->setFocusPolicy( NoFocus ); 592 mNewSubBut->setFocusPolicy( Qt::NoFocus );
577 593
578 QWhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) ); 594 Q3WhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) );
579 QWhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) ); 595 Q3WhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) );
580 QWhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) ); 596 Q3WhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) );
581 QWhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) ); 597 Q3WhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) );
582 QWhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) ); 598 Q3WhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) );
583 QWhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) ); 599 Q3WhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) );
584 600
585 quickLayout->addWidget( mNewSubBut ); 601 quickLayout->addWidget( mNewSubBut );
586 quickLayout->addWidget( s_done ); 602 quickLayout->addWidget( s_done );
587 quickLayout->addWidget( s_run ); 603 quickLayout->addWidget( s_run );
588 quickLayout->addWidget( allopen ); 604 quickLayout->addWidget( allopen );
589 quickLayout->addWidget( allclose ); 605 quickLayout->addWidget( allclose );
590 quickLayout->addWidget( flat ); 606 quickLayout->addWidget( flat );
591 607
@@ -596,81 +612,81 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
596 //mTodoListView->header()->setMaximumHeight(30); 612 //mTodoListView->header()->setMaximumHeight(30);
597 mTodoListView->setRootIsDecorated(true); 613 mTodoListView->setRootIsDecorated(true);
598 mTodoListView->setAllColumnsShowFocus(true); 614 mTodoListView->setAllColumnsShowFocus(true);
599 615
600 mTodoListView->setShowSortIndicator(true); 616 mTodoListView->setShowSortIndicator(true);
601 617
602 mTodoListView->addColumn(i18n("Todo")); 618 mTodoListView->addColumn(i18n("Todo"));
603 mTodoListView->addColumn(i18n("Prio")); 619 mTodoListView->addColumn(i18n("Prio"));
604 mTodoListView->setColumnAlignment(1,AlignHCenter); 620 mTodoListView->setColumnAlignment(1,Qt::AlignHCenter);
605 mTodoListView->addColumn(i18n("Complete")); 621 mTodoListView->addColumn(i18n("Complete"));
606 mTodoListView->setColumnAlignment(2,AlignCenter); 622 mTodoListView->setColumnAlignment(2,Qt::AlignCenter);
607 623
608 mTodoListView->addColumn(i18n("Due Date")); 624 mTodoListView->addColumn(i18n("Due Date"));
609 mTodoListView->setColumnAlignment(3,AlignLeft); 625 mTodoListView->setColumnAlignment(3,Qt::AlignLeft);
610 mTodoListView->addColumn(i18n("Due Time")); 626 mTodoListView->addColumn(i18n("Due Time"));
611 mTodoListView->setColumnAlignment(4,AlignHCenter); 627 mTodoListView->setColumnAlignment(4,Qt::AlignHCenter);
612 628
613 mTodoListView->addColumn(i18n("Start Date")); 629 mTodoListView->addColumn(i18n("Start Date"));
614 mTodoListView->setColumnAlignment(5,AlignLeft); 630 mTodoListView->setColumnAlignment(5,Qt::AlignLeft);
615 mTodoListView->addColumn(i18n("Start Time")); 631 mTodoListView->addColumn(i18n("Start Time"));
616 mTodoListView->setColumnAlignment(6,AlignHCenter); 632 mTodoListView->setColumnAlignment(6,Qt::AlignHCenter);
617 633
618 //mTodoListView->addColumn(i18n("Cancelled")); 634 //mTodoListView->addColumn(i18n("Cancelled"));
619 mTodoListView->addColumn(i18n("Categories")); 635 mTodoListView->addColumn(i18n("Categories"));
620 mTodoListView->addColumn(i18n("Calendar")); 636 mTodoListView->addColumn(i18n("Calendar"));
621 mTodoListView->addColumn(i18n("Last Modified")); 637 mTodoListView->addColumn(i18n("Last Modified"));
622 mTodoListView->addColumn(i18n("Created")); 638 mTodoListView->addColumn(i18n("Created"));
623 mTodoListView->addColumn(i18n("Last Modified Sub")); 639 mTodoListView->addColumn(i18n("Last Modified Sub"));
624#if 0 640#if 0
625 mTodoListView->addColumn(i18n("Sort Id")); 641 mTodoListView->addColumn(i18n("Sort Id"));
626 mTodoListView->setColumnAlignment(4,AlignHCenter); 642 mTodoListView->setColumnAlignment(4,Qt::AlignHCenter);
627#endif 643#endif
628 644
629 mTodoListView->setMinimumHeight( 60 ); 645 mTodoListView->setMinimumHeight( 60 );
630 mTodoListView->setItemsRenameable( true ); 646 mTodoListView->setItemsRenameable( true );
631 mTodoListView->setRenameable( 0 ); 647 mTodoListView->setRenameable( 0 );
632 mTodoListView->setColumnWidth( 0, 120 ); 648 mTodoListView->setColumnWidth( 0, 120 );
633 int iii = 0; 649 int iii = 0;
634 for ( iii = 0; iii< 12 ; ++iii ) 650 for ( iii = 0; iii< 12 ; ++iii )
635 mTodoListView->setColumnWidthMode( iii, QListView::Manual ); 651 mTodoListView->setColumnWidthMode( iii, Q3ListView::Manual );
636 652
637 653
638 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); 654 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
639 655
640 mPriorityPopupMenu = new QPopupMenu(this); 656 mPriorityPopupMenu = new Q3PopupMenu(this);
641 for (int i = 1; i <= 5; i++) { 657 for (int i = 1; i <= 5; i++) {
642 QString label = QString ("%1").arg (i); 658 QString label = QString ("%1").arg (i);
643 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 659 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
644 } 660 }
645 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 661 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
646 662
647 mPercentageCompletedPopupMenu = new QPopupMenu(this); 663 mPercentageCompletedPopupMenu = new Q3PopupMenu(this);
648 for (int i = 0; i <= 100; i+=20) { 664 for (int i = 0; i <= 100; i+=20) {
649 QString label = QString ("%1 %").arg (i); 665 QString label = QString ("%1 %").arg (i);
650 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 666 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
651 } 667 }
652 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 668 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
653 669
654 670
655 mCategoryPopupMenu = new QPopupMenu (this); 671 mCategoryPopupMenu = new Q3PopupMenu (this);
656 mCategoryPopupMenu->setCheckable (true); 672 mCategoryPopupMenu->setCheckable (true);
657 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 673 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
658 connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); 674 connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ()));
659 675
660 mCalPopupMenu = new QPopupMenu (this); 676 mCalPopupMenu = new Q3PopupMenu (this);
661 mCalPopupMenu->setCheckable (true); 677 mCalPopupMenu->setCheckable (true);
662 connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); 678 connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int)));
663 connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); 679 connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ()));
664 680
665 681
666 682
667 683
668 mItemPopupMenu = new QPopupMenu(this); 684 mItemPopupMenu = new Q3PopupMenu(this);
669 mItemPopupMenu->insertItem(i18n("Show"), this, 685 mItemPopupMenu->insertItem(i18n("Show"), this,
670 SLOT (showTodo())); 686 SLOT (showTodo()));
671 mItemPopupMenu->insertItem(i18n("Edit..."), this, 687 mItemPopupMenu->insertItem(i18n("Edit..."), this,
672 SLOT (editTodo())); 688 SLOT (editTodo()));
673 mItemPopupMenu->insertItem( i18n("Delete..."), this, 689 mItemPopupMenu->insertItem( i18n("Delete..."), this,
674 SLOT (deleteTodo())); 690 SLOT (deleteTodo()));
675 mItemPopupMenu->insertItem( i18n("Clone..."), this, 691 mItemPopupMenu->insertItem( i18n("Clone..."), this,
676 SLOT (cloneTodo())); 692 SLOT (cloneTodo()));
@@ -705,17 +721,17 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
705 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 721 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
706 this, SLOT( toggleCompleted() ),0, 33 ); 722 this, SLOT( toggleCompleted() ),0, 33 );
707 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 723 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
708 this, SLOT( toggleQuickTodo() ),0, 34 ); 724 this, SLOT( toggleQuickTodo() ),0, 34 );
709 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 725 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
710 this, SLOT( toggleRunning() ),0, 35 ); 726 this, SLOT( toggleRunning() ),0, 35 );
711 727
712#endif 728#endif
713 mPopupMenu = new QPopupMenu(this); 729 mPopupMenu = new Q3PopupMenu(this);
714 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 730 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
715 SLOT (newTodo()),0,1); 731 SLOT (newTodo()),0,1);
716 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), 732 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."),
717 this, SLOT(purgeCompleted()),0,2); 733 this, SLOT(purgeCompleted()),0,2);
718 mPopupMenu->insertItem(i18n("Show Completed"), 734 mPopupMenu->insertItem(i18n("Show Completed"),
719 this, SLOT( toggleCompleted() ),0,3 ); 735 this, SLOT( toggleCompleted() ),0,3 );
720 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 736 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
721 this, SLOT( toggleRunning() ),0,5 ); 737 this, SLOT( toggleRunning() ),0,5 );
@@ -741,48 +757,48 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
741 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 757 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
742 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 758 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
743 759
744 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 760 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
745 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 761 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
746 762
747 763
748 // Double clicking conflicts with opening/closing the subtree 764 // Double clicking conflicts with opening/closing the subtree
749 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 765 connect( mTodoListView, SIGNAL( doubleClicked( Q3ListViewItem *) ),
750 SLOT( editItem( QListViewItem *) ) ); 766 SLOT( editItem( Q3ListViewItem *) ) );
751 /* 767 /*
752 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 768 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
753 const QPoint &,int ) ), 769 const QPoint &,int ) ),
754 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 770 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
755 */ 771 */
756 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 772 connect( mTodoListView, SIGNAL( contextRequest ( Q3ListViewItem *,
757 const QPoint &,int ) ), 773 const QPoint &,int ) ),
758 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 774 SLOT( popupMenu( Q3ListViewItem *, const QPoint & ,int) ) );
759 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 775 connect( mTodoListView, SIGNAL( clicked( Q3ListViewItem * ) ),
760 SLOT( itemClicked( QListViewItem * ) ) ); 776 SLOT( itemClicked( Q3ListViewItem * ) ) );
761 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 777 connect( mTodoListView, SIGNAL( double_Clicked( Q3ListViewItem * ) ),
762 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 778 SLOT( itemDoubleClicked( Q3ListViewItem * ) ) );
763 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 779 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
764 SLOT( updateView() ) ); 780 SLOT( updateView() ) );
765 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 781 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
766 SLOT( todoModified(Todo *, int) ) ); 782 SLOT( todoModified(Todo *, int) ) );
767 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 783 connect( mTodoListView, SIGNAL( expanded( Q3ListViewItem * ) ),
768 SLOT( itemStateChanged( QListViewItem * ) ) ); 784 SLOT( itemStateChanged( Q3ListViewItem * ) ) );
769 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 785 connect( mTodoListView, SIGNAL( collapsed( Q3ListViewItem * ) ),
770 SLOT( itemStateChanged( QListViewItem * ) ) ); 786 SLOT( itemStateChanged( Q3ListViewItem * ) ) );
771 connect( mTodoListView, SIGNAL( paintNeeded() ), 787 connect( mTodoListView, SIGNAL( paintNeeded() ),
772 SLOT( paintNeeded()) ); 788 SLOT( paintNeeded()) );
773 789
774#if 0 790#if 0
775 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 791 connect(mTodoListView,SIGNAL(selectionChanged(Q3ListViewItem *)),
776 SLOT(selectionChanged(QListViewItem *))); 792 SLOT(selectionChanged(Q3ListViewItem *)));
777 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 793 connect(mTodoListView,SIGNAL(clicked(Q3ListViewItem *)),
778 SLOT(selectionChanged(QListViewItem *))); 794 SLOT(selectionChanged(Q3ListViewItem *)));
779 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 795 connect(mTodoListView,SIGNAL(pressed(Q3ListViewItem *)),
780 SLOT(selectionChanged(QListViewItem *))); 796 SLOT(selectionChanged(Q3ListViewItem *)));
781#endif 797#endif
782 798
783 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 799 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
784 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 800 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
785 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 801 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
786 802
787 connect( mTodoListView, SIGNAL(selectionChanged() ), 803 connect( mTodoListView, SIGNAL(selectionChanged() ),
788 SLOT( processSelectionChange() ) ); 804 SLOT( processSelectionChange() ) );
@@ -876,17 +892,17 @@ void KOTodoView::updateView()
876 ps -= 2; 892 ps -= 2;
877 fo.setPointSize( ps ); 893 fo.setPointSize( ps );
878 } 894 }
879 } 895 }
880 896
881 mTodoListView->setFont( fo ); 897 mTodoListView->setFont( fo );
882 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 898 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
883 //mTodoListView->header()->setMaximumHeight(fm.height()); 899 //mTodoListView->header()->setMaximumHeight(fm.height());
884 QPtrList<Todo> todoList = calendar()->todos(); 900 Q3PtrList<Todo> todoList = calendar()->todos();
885 901
886/* 902/*
887 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 903 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
888 Event *t; 904 Event *t;
889 for(t = todoList.first(); t; t = todoList.next()) { 905 for(t = todoList.first(); t; t = todoList.next()) {
890 kdDebug() << " " << t->getSummary() << endl; 906 kdDebug() << " " << t->getSummary() << endl;
891 907
892 if (t->getRelatedTo()) { 908 if (t->getRelatedTo()) {
@@ -1039,17 +1055,17 @@ bool KOTodoView::checkTodo( Todo * todo )
1039 return false; 1055 return false;
1040 if ( todo->hasDueDate() ) 1056 if ( todo->hasDueDate() )
1041 if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) 1057 if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
1042 return false; 1058 return false;
1043 } 1059 }
1044 return true; 1060 return true;
1045} 1061}
1046 1062
1047void KOTodoView::restoreItemState( QListViewItem *item ) 1063void KOTodoView::restoreItemState( Q3ListViewItem *item )
1048{ 1064{
1049 pendingSubtodo = 0; 1065 pendingSubtodo = 0;
1050 while( item ) { 1066 while( item ) {
1051 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1067 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1052 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); 1068 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
1053 if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); 1069 if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
1054 item = item->nextSibling(); 1070 item = item->nextSibling();
1055 } 1071 }
@@ -1091,30 +1107,30 @@ KOTodoView::insertTodoItem(Todo *todo)
1091 1107
1092 1108
1093void KOTodoView::updateConfig() 1109void KOTodoView::updateConfig()
1094{ 1110{
1095 updateView(); 1111 updateView();
1096 mTodoListView->repaintContents(); 1112 mTodoListView->repaintContents();
1097} 1113}
1098 1114
1099QPtrList<Incidence> KOTodoView::selectedIncidences() 1115Q3PtrList<Incidence> KOTodoView::selectedIncidences()
1100{ 1116{
1101 QPtrList<Incidence> selected; 1117 Q3PtrList<Incidence> selected;
1102 1118
1103 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 1119 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
1104// if (!item) item = mActiveItem; 1120// if (!item) item = mActiveItem;
1105 if (item) selected.append(item->todo()); 1121 if (item) selected.append(item->todo());
1106 1122
1107 return selected; 1123 return selected;
1108} 1124}
1109 1125
1110QPtrList<Todo> KOTodoView::selectedTodos() 1126Q3PtrList<Todo> KOTodoView::selectedTodos()
1111{ 1127{
1112 QPtrList<Todo> selected; 1128 Q3PtrList<Todo> selected;
1113 1129
1114 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 1130 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
1115// if (!item) item = mActiveItem; 1131// if (!item) item = mActiveItem;
1116 if (item) selected.append(item->todo()); 1132 if (item) selected.append(item->todo());
1117 1133
1118 return selected; 1134 return selected;
1119} 1135}
1120 1136
@@ -1122,42 +1138,42 @@ void KOTodoView::changeEventDisplay(Event *, int)
1122{ 1138{
1123 updateView(); 1139 updateView();
1124} 1140}
1125 1141
1126void KOTodoView::showDates(const QDate &, const QDate &) 1142void KOTodoView::showDates(const QDate &, const QDate &)
1127{ 1143{
1128} 1144}
1129 1145
1130void KOTodoView::showEvents(QPtrList<Event>) 1146void KOTodoView::showEvents(Q3PtrList<Event>)
1131{ 1147{
1132 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; 1148 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
1133} 1149}
1134 1150
1135void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1151void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1136 const QDate &td) 1152 const QDate &td)
1137{ 1153{
1138#ifndef KORG_NOPRINTER 1154#ifndef KORG_NOPRINTER
1139 calPrinter->preview(CalPrinter::Todolist, fd, td); 1155 calPrinter->preview(CalPrinter::Todolist, fd, td);
1140#endif 1156#endif
1141} 1157}
1142 1158
1143void KOTodoView::editItem(QListViewItem *item ) 1159void KOTodoView::editItem(Q3ListViewItem *item )
1144{ 1160{
1145 if ( item ) 1161 if ( item )
1146 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 1162 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
1147} 1163}
1148 1164
1149void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 1165void KOTodoView::showItem(Q3ListViewItem *item,const QPoint &,int)
1150{ 1166{
1151 if ( item ) 1167 if ( item )
1152 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 1168 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
1153} 1169}
1154 1170
1155void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) 1171void KOTodoView::popupMenu(Q3ListViewItem *item,const QPoint &p,int column)
1156{ 1172{
1157 pendingSubtodo = 0; 1173 pendingSubtodo = 0;
1158 mActiveItem = (KOTodoViewItem *)item; 1174 mActiveItem = (KOTodoViewItem *)item;
1159 if (item) { 1175 if (item) {
1160 switch (column){ 1176 switch (column){
1161 case 1: 1177 case 1:
1162 mPriorityPopupMenu->popup(QCursor::pos ()); break; 1178 mPriorityPopupMenu->popup(QCursor::pos ()); break;
1163 case 2: 1179 case 2:
@@ -1356,17 +1372,17 @@ void KOTodoView::toggleRunningItemQuick()
1356 toggleRunningItem(); 1372 toggleRunningItem();
1357 return; 1373 return;
1358 } else { 1374 } else {
1359 t->setRunning( true ); 1375 t->setRunning( true );
1360 mActiveItem->construct(); 1376 mActiveItem->construct();
1361 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); 1377 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!"));
1362 } 1378 }
1363} 1379}
1364void KOTodoView::itemDoubleClicked(QListViewItem *item) 1380void KOTodoView::itemDoubleClicked(Q3ListViewItem *item)
1365{ 1381{
1366 if ( pendingSubtodo != 0 ) { 1382 if ( pendingSubtodo != 0 ) {
1367 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1383 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1368 } 1384 }
1369 pendingSubtodo = 0; 1385 pendingSubtodo = 0;
1370 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1386 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1371 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1387 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1372 //qDebug("ROW %d ", row); 1388 //qDebug("ROW %d ", row);
@@ -1423,30 +1439,30 @@ void KOTodoView::toggleRunningItem()
1423 updateView(); 1439 updateView();
1424 } else { 1440 } else {
1425 t->setRunning( true ); 1441 t->setRunning( true );
1426 updateTodo ( t, KOGlobals::EVENTEDITED ); 1442 updateTodo ( t, KOGlobals::EVENTEDITED );
1427 } 1443 }
1428 } 1444 }
1429} 1445}
1430 1446
1431void KOTodoView::itemClicked(QListViewItem *item) 1447void KOTodoView::itemClicked(Q3ListViewItem *item)
1432{ 1448{
1433 //qDebug("KOTodoView::itemClicked %d", item); 1449 //qDebug("KOTodoView::itemClicked %d", item);
1434 if (!item) { 1450 if (!item) {
1435 if ( pendingSubtodo != 0 ) { 1451 if ( pendingSubtodo != 0 ) {
1436 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1452 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1437 } 1453 }
1438 pendingSubtodo = 0; 1454 pendingSubtodo = 0;
1439 return; 1455 return;
1440 } 1456 }
1441 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1457 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1442 if ( pendingSubtodo != 0 ) { 1458 if ( pendingSubtodo != 0 ) {
1443 bool allowReparent = true; 1459 bool allowReparent = true;
1444 QListViewItem *par = item; 1460 Q3ListViewItem *par = item;
1445 while ( par ) { 1461 while ( par ) {
1446 if ( par == pendingSubtodo ) { 1462 if ( par == pendingSubtodo ) {
1447 allowReparent = false; 1463 allowReparent = false;
1448 break; 1464 break;
1449 } 1465 }
1450 par = par->parent(); 1466 par = par->parent();
1451 } 1467 }
1452 if ( !allowReparent ) { 1468 if ( !allowReparent ) {
@@ -1464,17 +1480,17 @@ void KOTodoView::itemClicked(QListViewItem *item)
1464} 1480}
1465 1481
1466void KOTodoView::setDocumentId( const QString &id ) 1482void KOTodoView::setDocumentId( const QString &id )
1467{ 1483{
1468 1484
1469 mDocPrefs->setDoc( id ); 1485 mDocPrefs->setDoc( id );
1470} 1486}
1471 1487
1472void KOTodoView::itemStateChanged( QListViewItem *item ) 1488void KOTodoView::itemStateChanged( Q3ListViewItem *item )
1473{ 1489{
1474 if (!item) return; 1490 if (!item) return;
1475 1491
1476 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1492 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1477 1493
1478// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1494// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1479 1495
1480 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1496 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
@@ -1537,17 +1553,17 @@ void KOTodoView::setAllClose()
1537 mPopupMenu->setItemChecked( 8,false ); 1553 mPopupMenu->setItemChecked( 8,false );
1538 updateView(); 1554 updateView();
1539 } else { 1555 } else {
1540 storeCurrentItem(); 1556 storeCurrentItem();
1541 } 1557 }
1542 setOpen(mTodoListView->firstChild(), false); 1558 setOpen(mTodoListView->firstChild(), false);
1543 resetCurrentItem(); 1559 resetCurrentItem();
1544} 1560}
1545void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) 1561void KOTodoView::setOpen( Q3ListViewItem* item, bool setOpenI)
1546{ 1562{
1547 1563
1548 while ( item ) { 1564 while ( item ) {
1549 setOpen( item->firstChild(), setOpenI ); 1565 setOpen( item->firstChild(), setOpenI );
1550 item->setOpen( setOpenI ); 1566 item->setOpen( setOpenI );
1551 item = item->nextSibling(); 1567 item = item->nextSibling();
1552 } 1568 }
1553} 1569}
@@ -1558,17 +1574,17 @@ void KOTodoView::displayAllFlat()
1558 mActiveItem = 0; 1574 mActiveItem = 0;
1559 pendingSubtodo = 0; 1575 pendingSubtodo = 0;
1560 if ( mBlockUpdate ) { 1576 if ( mBlockUpdate ) {
1561 return; 1577 return;
1562 } 1578 }
1563 clearList (); 1579 clearList ();
1564 mPopupMenu->setItemChecked( 8,true ); 1580 mPopupMenu->setItemChecked( 8,true );
1565 isFlatDisplay = true; 1581 isFlatDisplay = true;
1566 QPtrList<Todo> todoList = calendar()->todos(); 1582 Q3PtrList<Todo> todoList = calendar()->todos();
1567 Todo *todo; 1583 Todo *todo;
1568 for(todo = todoList.first(); todo; todo = todoList.next()) { 1584 for(todo = todoList.first(); todo; todo = todoList.next()) {
1569 if ( checkTodo( todo ) ) { 1585 if ( checkTodo( todo ) ) {
1570 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1586 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1571 mTodoMap.insert(todo,todoItem); 1587 mTodoMap.insert(todo,todoItem);
1572 } 1588 }
1573 } 1589 }
1574 resetCurrentItem(); 1590 resetCurrentItem();