summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-08 11:36:36 (UTC)
committer zautrix <zautrix>2005-04-08 11:36:36 (UTC)
commitba04f6a4b6b651dcff11ca17103cba42330e52be (patch) (unidiff)
treec8c02a1327abbd87cf5f019399e8e7bf1940a2bc
parent59fb8a0ac35bf3b81f1c4e2e4fc6b61356d064ef (diff)
downloadkdepimpi-ba04f6a4b6b651dcff11ca17103cba42330e52be.zip
kdepimpi-ba04f6a4b6b651dcff11ca17103cba42330e52be.tar.gz
kdepimpi-ba04f6a4b6b651dcff11ca17103cba42330e52be.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp21
-rw-r--r--korganizer/kotodoview.h2
2 files changed, 17 insertions, 6 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 395325c..935a5f5 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -222,1064 +222,1075 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
222 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); 222 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
223 if (X > header()->sectionPos(0) + 223 if (X > header()->sectionPos(0) +
224 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 224 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
225 itemMargin() +i->height()|| 225 itemMargin() +i->height()||
226 X < header()->sectionPos(0)) { 226 X < header()->sectionPos(0)) {
227 rootClicked = false; 227 rootClicked = false;
228 } 228 }
229 } else { 229 } else {
230 rootClicked = false; 230 rootClicked = false;
231 } 231 }
232#ifndef KORG_NODND 232#ifndef KORG_NODND
233 mMousePressed = false; 233 mMousePressed = false;
234 if (! rootClicked && !( e->button() == RightButton) ) { 234 if (! rootClicked && !( e->button() == RightButton) ) {
235 mPressPos = e->pos(); 235 mPressPos = e->pos();
236 mMousePressed = true; 236 mMousePressed = true;
237 } else { 237 } else {
238 mMousePressed = false; 238 mMousePressed = false;
239 } 239 }
240#endif 240#endif
241 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); 241 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
242#ifndef DESKTOP_VERSION 242#ifndef DESKTOP_VERSION
243 if (!( e->button() == RightButton && rootClicked) ) 243 if (!( e->button() == RightButton && rootClicked) )
244 QListView::contentsMousePressEvent(e); 244 QListView::contentsMousePressEvent(e);
245#else 245#else
246 QListView::contentsMousePressEvent(e); 246 QListView::contentsMousePressEvent(e);
247#endif 247#endif
248} 248}
249void KOTodoListView::paintEvent(QPaintEvent* e) 249void KOTodoListView::paintEvent(QPaintEvent* e)
250{ 250{
251 emit paintNeeded(); 251 emit paintNeeded();
252 QListView::paintEvent( e); 252 QListView::paintEvent( e);
253} 253}
254void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 254void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
255{ 255{
256 256
257#ifndef KORG_NODND 257#ifndef KORG_NODND
258 //QListView::contentsMouseMoveEvent(e); 258 //QListView::contentsMouseMoveEvent(e);
259 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 259 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
260 QApplication::startDragDistance()*3) { 260 QApplication::startDragDistance()*3) {
261 mMousePressed = false; 261 mMousePressed = false;
262 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 262 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
263 if (item) { 263 if (item) {
264 DndFactory factory( mCalendar ); 264 DndFactory factory( mCalendar );
265 ICalDrag *vd = factory.createDrag( 265 ICalDrag *vd = factory.createDrag(
266 ((KOTodoViewItem *)item)->todo(),viewport()); 266 ((KOTodoViewItem *)item)->todo(),viewport());
267 internalDrop = false; 267 internalDrop = false;
268 // we cannot do any senseful here, because the DnD is still broken in Qt 268 // we cannot do any senseful here, because the DnD is still broken in Qt
269 if (vd->drag()) { 269 if (vd->drag()) {
270 if ( !internalDrop ) { 270 if ( !internalDrop ) {
271 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); 271 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() );
272 qDebug("Dnd: External move: Delete drag source "); 272 qDebug("Dnd: External move: Delete drag source ");
273 } else 273 } else
274 qDebug("Dnd: Internal move "); 274 qDebug("Dnd: Internal move ");
275 275
276 } else { 276 } else {
277 if ( !internalDrop ) { 277 if ( !internalDrop ) {
278 qDebug("Dnd: External Copy"); 278 qDebug("Dnd: External Copy");
279 } else 279 } else
280 qDebug("DnD: Internal copy: Copy pending"); 280 qDebug("DnD: Internal copy: Copy pending");
281 } 281 }
282 } 282 }
283 } 283 }
284#endif 284#endif
285} 285}
286void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) 286void KOTodoListView::keyReleaseEvent ( QKeyEvent *e )
287{ 287{
288 if ( !e->isAutoRepeat() ) { 288 if ( !e->isAutoRepeat() ) {
289 mFlagKeyPressed = false; 289 mFlagKeyPressed = false;
290 } 290 }
291} 291}
292 292
293 293
294void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 294void KOTodoListView::keyPressEvent ( QKeyEvent * e )
295{ 295{
296 qApp->processEvents(); 296 qApp->processEvents();
297 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 297 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
298 e->ignore(); 298 e->ignore();
299 // qDebug(" ignore %d",e->isAutoRepeat() ); 299 // qDebug(" ignore %d",e->isAutoRepeat() );
300 return; 300 return;
301 } 301 }
302 if (! e->isAutoRepeat() ) 302 if (! e->isAutoRepeat() )
303 mFlagKeyPressed = true; 303 mFlagKeyPressed = true;
304 QListViewItem* cn; 304 QListViewItem* cn;
305 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 305 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
306 cn = currentItem(); 306 cn = currentItem();
307 if ( cn ) { 307 if ( cn ) {
308 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 308 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
309 if ( ci ){ 309 if ( ci ){
310 if ( e->state() == ShiftButton ) 310 if ( e->state() == ShiftButton )
311 ci->setOn( false ); 311 ci->setOn( false );
312 else 312 else
313 ci->setOn( true ); 313 ci->setOn( true );
314 cn = cn->itemBelow(); 314 cn = cn->itemBelow();
315 if ( cn ) { 315 if ( cn ) {
316 setCurrentItem ( cn ); 316 setCurrentItem ( cn );
317 ensureItemVisible ( cn ); 317 ensureItemVisible ( cn );
318 } 318 }
319 319
320 } 320 }
321 } 321 }
322 322
323 return; 323 return;
324 } 324 }
325 325
326 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 326 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
327 switch ( e->key() ) { 327 switch ( e->key() ) {
328 case Qt::Key_Down: 328 case Qt::Key_Down:
329 case Qt::Key_Up: 329 case Qt::Key_Up:
330 QListView::keyPressEvent ( e ); 330 QListView::keyPressEvent ( e );
331 break; 331 break;
332 case Qt::Key_Left: 332 case Qt::Key_Left:
333 case Qt::Key_Right: 333 case Qt::Key_Right:
334 QListView::keyPressEvent ( e ); 334 QListView::keyPressEvent ( e );
335 e->accept(); 335 e->accept();
336 return; 336 return;
337 break; 337 break;
338 default: 338 default:
339 e->ignore(); 339 e->ignore();
340 break; 340 break;
341 } 341 }
342 return; 342 return;
343 } 343 }
344 e->ignore(); 344 e->ignore();
345} 345}
346void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 346void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
347{ 347{
348 QListView::contentsMouseReleaseEvent(e); 348 QListView::contentsMouseReleaseEvent(e);
349 mMousePressed = false; 349 mMousePressed = false;
350} 350}
351 351
352void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 352void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
353{ 353{
354 if (!e) return; 354 if (!e) return;
355 355
356 QPoint vp = contentsToViewport(e->pos()); 356 QPoint vp = contentsToViewport(e->pos());
357 357
358 QListViewItem *item = itemAt(vp); 358 QListViewItem *item = itemAt(vp);
359 359
360 emit double_Clicked(item); 360 emit double_Clicked(item);
361 if (!item) return; 361 if (!item) return;
362 362
363 emit doubleClicked(item,vp,0); 363 emit doubleClicked(item,vp,0);
364} 364}
365 365
366///////////////////////////////////////////////////////////////////////////// 366/////////////////////////////////////////////////////////////////////////////
367 367
368KOQuickTodo::KOQuickTodo(QWidget *parent) : 368KOQuickTodo::KOQuickTodo(QWidget *parent) :
369 QLineEdit(parent) 369 QLineEdit(parent)
370{ 370{
371 setText(i18n("Click to add a new Todo")); 371 setText(i18n("Click to add a new Todo"));
372} 372}
373 373
374void KOQuickTodo::focusInEvent(QFocusEvent *ev) 374void KOQuickTodo::focusInEvent(QFocusEvent *ev)
375{ 375{
376 if ( text()==i18n("Click to add a new Todo") ) 376 if ( text()==i18n("Click to add a new Todo") )
377 setText(""); 377 setText("");
378 QLineEdit::focusInEvent(ev); 378 QLineEdit::focusInEvent(ev);
379} 379}
380 380
381void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 381void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
382{ 382{
383 setText(i18n("Click to add a new Todo")); 383 setText(i18n("Click to add a new Todo"));
384 QLineEdit::focusOutEvent(ev); 384 QLineEdit::focusOutEvent(ev);
385} 385}
386 386
387///////////////////////////////////////////////////////////////////////////// 387/////////////////////////////////////////////////////////////////////////////
388 388
389KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 389KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
390 KOrg::BaseView(calendar,parent,name) 390 KOrg::BaseView(calendar,parent,name)
391{ 391{
392 mPendingUpdateBeforeRepaint = false; 392 mPendingUpdateBeforeRepaint = false;
393 isFlatDisplay = false; 393 isFlatDisplay = false;
394 mNavigator = 0; 394 mNavigator = 0;
395 QBoxLayout *topLayout = new QVBoxLayout(this); 395 QBoxLayout *topLayout = new QVBoxLayout(this);
396 mName = QString ( name ); 396 mName = QString ( name );
397 mBlockUpdate = false; 397 mBlockUpdate = false;
398 mQuickAdd = new KOQuickTodo(this); 398 mQuickAdd = new KOQuickTodo(this);
399 topLayout->addWidget(mQuickAdd); 399 topLayout->addWidget(mQuickAdd);
400 400
401 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 401 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
402 402
403 mTodoListView = new KOTodoListView(calendar,this, name ); 403 mTodoListView = new KOTodoListView(calendar,this, name );
404 topLayout->addWidget(mTodoListView); 404 topLayout->addWidget(mTodoListView);
405 //mTodoListView->header()->setMaximumHeight(30); 405 //mTodoListView->header()->setMaximumHeight(30);
406 mTodoListView->setRootIsDecorated(true); 406 mTodoListView->setRootIsDecorated(true);
407 mTodoListView->setAllColumnsShowFocus(true); 407 mTodoListView->setAllColumnsShowFocus(true);
408 408
409 mTodoListView->setShowSortIndicator(true); 409 mTodoListView->setShowSortIndicator(true);
410 410
411 mTodoListView->addColumn(i18n("Todo")); 411 mTodoListView->addColumn(i18n("Todo"));
412 mTodoListView->addColumn(i18n("Prio")); 412 mTodoListView->addColumn(i18n("Prio"));
413 mTodoListView->setColumnAlignment(1,AlignHCenter); 413 mTodoListView->setColumnAlignment(1,AlignHCenter);
414 mTodoListView->addColumn(i18n("Complete")); 414 mTodoListView->addColumn(i18n("Complete"));
415 mTodoListView->setColumnAlignment(2,AlignCenter); 415 mTodoListView->setColumnAlignment(2,AlignCenter);
416 416
417 mTodoListView->addColumn(i18n("Due Date")); 417 mTodoListView->addColumn(i18n("Due Date"));
418 mTodoListView->setColumnAlignment(3,AlignLeft); 418 mTodoListView->setColumnAlignment(3,AlignLeft);
419 mTodoListView->addColumn(i18n("Due Time")); 419 mTodoListView->addColumn(i18n("Due Time"));
420 mTodoListView->setColumnAlignment(4,AlignHCenter); 420 mTodoListView->setColumnAlignment(4,AlignHCenter);
421 421
422 mTodoListView->addColumn(i18n("Start Date")); 422 mTodoListView->addColumn(i18n("Start Date"));
423 mTodoListView->setColumnAlignment(5,AlignLeft); 423 mTodoListView->setColumnAlignment(5,AlignLeft);
424 mTodoListView->addColumn(i18n("Start Time")); 424 mTodoListView->addColumn(i18n("Start Time"));
425 mTodoListView->setColumnAlignment(6,AlignHCenter); 425 mTodoListView->setColumnAlignment(6,AlignHCenter);
426 426
427 mTodoListView->addColumn(i18n("Cancelled")); 427 mTodoListView->addColumn(i18n("Cancelled"));
428 mTodoListView->addColumn(i18n("Categories")); 428 mTodoListView->addColumn(i18n("Categories"));
429#if 0 429#if 0
430 mTodoListView->addColumn(i18n("Sort Id")); 430 mTodoListView->addColumn(i18n("Sort Id"));
431 mTodoListView->setColumnAlignment(4,AlignHCenter); 431 mTodoListView->setColumnAlignment(4,AlignHCenter);
432#endif 432#endif
433 433
434 mTodoListView->setMinimumHeight( 60 ); 434 mTodoListView->setMinimumHeight( 60 );
435 mTodoListView->setItemsRenameable( true ); 435 mTodoListView->setItemsRenameable( true );
436 mTodoListView->setRenameable( 0 ); 436 mTodoListView->setRenameable( 0 );
437 mTodoListView->setColumnWidth( 0, 120 ); 437 mTodoListView->setColumnWidth( 0, 120 );
438 mTodoListView->setColumnWidthMode(0, QListView::Manual); 438 mTodoListView->setColumnWidthMode(0, QListView::Manual);
439 mTodoListView->setColumnWidthMode(1, QListView::Manual); 439 mTodoListView->setColumnWidthMode(1, QListView::Manual);
440 mTodoListView->setColumnWidthMode(2, QListView::Manual); 440 mTodoListView->setColumnWidthMode(2, QListView::Manual);
441 mTodoListView->setColumnWidthMode(3, QListView::Manual); 441 mTodoListView->setColumnWidthMode(3, QListView::Manual);
442 mTodoListView->setColumnWidthMode(4, QListView::Manual); 442 mTodoListView->setColumnWidthMode(4, QListView::Manual);
443 mTodoListView->setColumnWidthMode(5, QListView::Manual); 443 mTodoListView->setColumnWidthMode(5, QListView::Manual);
444 mTodoListView->setColumnWidthMode(6, QListView::Manual); 444 mTodoListView->setColumnWidthMode(6, QListView::Manual);
445 mTodoListView->setColumnWidthMode(7, QListView::Manual); 445 mTodoListView->setColumnWidthMode(7, QListView::Manual);
446 mTodoListView->setColumnWidthMode(8, QListView::Manual); 446 mTodoListView->setColumnWidthMode(8, QListView::Manual);
447 447
448 448
449 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); 449 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
450 450
451 mPriorityPopupMenu = new QPopupMenu(this); 451 mPriorityPopupMenu = new QPopupMenu(this);
452 for (int i = 1; i <= 5; i++) { 452 for (int i = 1; i <= 5; i++) {
453 QString label = QString ("%1").arg (i); 453 QString label = QString ("%1").arg (i);
454 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 454 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
455 } 455 }
456 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 456 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
457 457
458 mPercentageCompletedPopupMenu = new QPopupMenu(this); 458 mPercentageCompletedPopupMenu = new QPopupMenu(this);
459 for (int i = 0; i <= 100; i+=20) { 459 for (int i = 0; i <= 100; i+=20) {
460 QString label = QString ("%1 %").arg (i); 460 QString label = QString ("%1 %").arg (i);
461 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 461 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
462 } 462 }
463 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 463 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
464 464
465 465
466 466
467 mItemPopupMenu = new QPopupMenu(this); 467 mItemPopupMenu = new QPopupMenu(this);
468 mItemPopupMenu->insertItem(i18n("Show..."), this, 468 mItemPopupMenu->insertItem(i18n("Show..."), this,
469 SLOT (showTodo())); 469 SLOT (showTodo()));
470 mItemPopupMenu->insertItem(i18n("Edit..."), this, 470 mItemPopupMenu->insertItem(i18n("Edit..."), this,
471 SLOT (editTodo())); 471 SLOT (editTodo()));
472 mItemPopupMenu->insertItem( i18n("Delete"), this, 472 mItemPopupMenu->insertItem( i18n("Delete"), this,
473 SLOT (deleteTodo())); 473 SLOT (deleteTodo()));
474 mItemPopupMenu->insertItem( i18n("Clone..."), this, 474 mItemPopupMenu->insertItem( i18n("Clone..."), this,
475 SLOT (cloneTodo())); 475 SLOT (cloneTodo()));
476 mItemPopupMenu->insertItem( i18n("Move..."), this, 476 mItemPopupMenu->insertItem( i18n("Move..."), this,
477 SLOT (moveTodo())); 477 SLOT (moveTodo()));
478 mItemPopupMenu->insertItem( i18n("Beam..."), this, 478 mItemPopupMenu->insertItem( i18n("Beam..."), this,
479 SLOT (beamTodo())); 479 SLOT (beamTodo()));
480 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 480 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
481 SLOT (cancelTodo())); 481 SLOT (cancelTodo()));
482 mItemPopupMenu->insertSeparator(); 482 mItemPopupMenu->insertSeparator();
483 483
484 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 484 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
485 SLOT (newTodo())); 485 SLOT (newTodo()));
486 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 486 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
487 SLOT (newSubTodo())); 487 SLOT (newSubTodo()));
488 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 488 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
489 SLOT (unparentTodo()),0,21); 489 SLOT (unparentTodo()),0,21);
490 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 490 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
491 SLOT (reparentTodo()),0,22); 491 SLOT (reparentTodo()),0,22);
492 mItemPopupMenu->insertSeparator(); 492 mItemPopupMenu->insertSeparator();
493#if 0 493#if 0
494 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 494 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
495 this, SLOT( purgeCompleted() ) ); 495 this, SLOT( purgeCompleted() ) );
496 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 496 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
497 this, SLOT( toggleCompleted() ),0, 33 ); 497 this, SLOT( toggleCompleted() ),0, 33 );
498 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 498 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
499 this, SLOT( toggleQuickTodo() ),0, 34 ); 499 this, SLOT( toggleQuickTodo() ),0, 34 );
500 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 500 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
501 this, SLOT( toggleRunning() ),0, 35 ); 501 this, SLOT( toggleRunning() ),0, 35 );
502 502
503#endif 503#endif
504 mPopupMenu = new QPopupMenu(this); 504 mPopupMenu = new QPopupMenu(this);
505 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 505 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
506 SLOT (newTodo()),0,1); 506 SLOT (newTodo()),0,1);
507 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), 507 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"),
508 this, SLOT(purgeCompleted()),0,2); 508 this, SLOT(purgeCompleted()),0,2);
509 mPopupMenu->insertItem(i18n("Show Completed"), 509 mPopupMenu->insertItem(i18n("Show Completed"),
510 this, SLOT( toggleCompleted() ),0,3 ); 510 this, SLOT( toggleCompleted() ),0,3 );
511 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 511 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
512 this, SLOT( toggleQuickTodo() ),0,4 ); 512 this, SLOT( toggleQuickTodo() ),0,4 );
513 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 513 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
514 this, SLOT( toggleRunning() ),0,5 ); 514 this, SLOT( toggleRunning() ),0,5 );
515 mPopupMenu->insertItem(i18n(" set all open","Display all opened"), 515 mPopupMenu->insertItem(i18n(" set all open","Display all opened"),
516 this, SLOT( setAllOpen() ),0,6 ); 516 this, SLOT( setAllOpen() ),0,6 );
517 mPopupMenu->insertItem(i18n(" set all close","Display all closed"), 517 mPopupMenu->insertItem(i18n(" set all close","Display all closed"),
518 this, SLOT( setAllClose() ),0,7 ); 518 this, SLOT( setAllClose() ),0,7 );
519 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), 519 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
520 this, SLOT( setAllFlat() ),0,8 ); 520 this, SLOT( setAllFlat() ),0,8 );
521 mDocPrefs = new DocPrefs( name ); 521 mDocPrefs = new DocPrefs( name );
522 522
523 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); 523 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu );
524 mPopupMenu->setCheckable( true ); 524 mPopupMenu->setCheckable( true );
525 mItemPopupMenu->setCheckable( true ); 525 mItemPopupMenu->setCheckable( true );
526 526
527 527
528 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 528 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
529 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 529 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
530 530
531 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 531 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
532 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 532 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
533 533
534 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 534 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
535 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 535 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
536 536
537 537
538 // Double clicking conflicts with opening/closing the subtree 538 // Double clicking conflicts with opening/closing the subtree
539 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 539 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
540 SLOT( editItem( QListViewItem *) ) ); 540 SLOT( editItem( QListViewItem *) ) );
541 /* 541 /*
542 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 542 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
543 const QPoint &,int ) ), 543 const QPoint &,int ) ),
544 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 544 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
545 */ 545 */
546 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 546 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
547 const QPoint &,int ) ), 547 const QPoint &,int ) ),
548 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 548 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
549 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 549 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
550 SLOT( itemClicked( QListViewItem * ) ) ); 550 SLOT( itemClicked( QListViewItem * ) ) );
551 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 551 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
552 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 552 SLOT( itemDoubleClicked( QListViewItem * ) ) );
553 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 553 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
554 SLOT( updateView() ) ); 554 SLOT( updateView() ) );
555 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 555 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
556 SLOT( todoModified(Todo *, int) ) ); 556 SLOT( todoModified(Todo *, int) ) );
557 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 557 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
558 SLOT( itemStateChanged( QListViewItem * ) ) ); 558 SLOT( itemStateChanged( QListViewItem * ) ) );
559 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 559 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
560 SLOT( itemStateChanged( QListViewItem * ) ) ); 560 SLOT( itemStateChanged( QListViewItem * ) ) );
561 connect( mTodoListView, SIGNAL( paintNeeded() ), 561 connect( mTodoListView, SIGNAL( paintNeeded() ),
562 SLOT( paintNeeded()) ); 562 SLOT( paintNeeded()) );
563 563
564#if 0 564#if 0
565 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 565 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
566 SLOT(selectionChanged(QListViewItem *))); 566 SLOT(selectionChanged(QListViewItem *)));
567 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 567 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
568 SLOT(selectionChanged(QListViewItem *))); 568 SLOT(selectionChanged(QListViewItem *)));
569 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 569 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
570 SLOT(selectionChanged(QListViewItem *))); 570 SLOT(selectionChanged(QListViewItem *)));
571#endif 571#endif
572 572
573 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 573 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
574 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 574 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
575 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 575 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
576 576
577 connect( mTodoListView, SIGNAL(selectionChanged() ), 577 connect( mTodoListView, SIGNAL(selectionChanged() ),
578 SLOT( processSelectionChange() ) ); 578 SLOT( processSelectionChange() ) );
579 connect( mQuickAdd, SIGNAL( returnPressed () ), 579 connect( mQuickAdd, SIGNAL( returnPressed () ),
580 SLOT( addQuickTodo() ) ); 580 SLOT( addQuickTodo() ) );
581 581
582} 582}
583 583
584KOTodoView::~KOTodoView() 584KOTodoView::~KOTodoView()
585{ 585{
586 // delete mKOTodoViewWhatsThis; 586 // delete mKOTodoViewWhatsThis;
587 delete mDocPrefs; 587 delete mDocPrefs;
588} 588}
589QString KOTodoView::getWhatsThisText(QPoint p) 589QString KOTodoView::getWhatsThisText(QPoint p)
590{ 590{
591 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); 591 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
592 if ( item ) 592 if ( item )
593 return KIncidenceFormatter::instance()->getFormattedText( item->todo(), 593 return KIncidenceFormatter::instance()->getFormattedText( item->todo(),
594 KOPrefs::instance()->mWTshowDetails, 594 KOPrefs::instance()->mWTshowDetails,
595 KOPrefs::instance()->mWTshowCreated, 595 KOPrefs::instance()->mWTshowCreated,
596 KOPrefs::instance()->mWTshowChanged); 596 KOPrefs::instance()->mWTshowChanged);
597 return i18n("That is the todo view" ); 597 return i18n("That is the todo view" );
598 598
599} 599}
600 600
601void KOTodoView::jumpToDate () 601void KOTodoView::jumpToDate ()
602{ 602{
603 // if (mActiveItem) { 603 // if (mActiveItem) {
604// mActiveItem->todo()); 604// mActiveItem->todo());
605// if ( mActiveItem->todo()->hasDueDate() ) 605// if ( mActiveItem->todo()->hasDueDate() )
606// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 606// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
607} 607}
608void KOTodoView::paintNeeded() 608void KOTodoView::paintNeeded()
609{ 609{
610 if ( mPendingUpdateBeforeRepaint ) { 610 if ( mPendingUpdateBeforeRepaint ) {
611 updateView(); 611 updateView();
612 mPendingUpdateBeforeRepaint = false; 612 mPendingUpdateBeforeRepaint = false;
613 } 613 }
614} 614}
615void KOTodoView::paintEvent(QPaintEvent * pevent) 615void KOTodoView::paintEvent(QPaintEvent * pevent)
616{ 616{
617 if ( mPendingUpdateBeforeRepaint ) { 617 if ( mPendingUpdateBeforeRepaint ) {
618 updateView(); 618 updateView();
619 mPendingUpdateBeforeRepaint = false; 619 mPendingUpdateBeforeRepaint = false;
620 } 620 }
621 KOrg::BaseView::paintEvent( pevent); 621 KOrg::BaseView::paintEvent( pevent);
622} 622}
623 623
624void KOTodoView::updateView() 624void KOTodoView::updateView()
625{ 625{
626 pendingSubtodo = 0; 626 pendingSubtodo = 0;
627 if ( mBlockUpdate ) { 627 if ( mBlockUpdate ) {
628 return; 628 return;
629 } 629 }
630 if ( !isVisible() ) { 630 if ( !isVisible() ) {
631 mPendingUpdateBeforeRepaint = true; 631 mPendingUpdateBeforeRepaint = true;
632 return; 632 return;
633 } 633 }
634 storeCurrentItem(); 634 storeCurrentItem();
635 //qDebug("KOTodoView::updateView() %x", this); 635 //qDebug("KOTodoView::updateView() %x", this);
636 if ( isFlatDisplay ) { 636 if ( isFlatDisplay ) {
637 displayAllFlat(); 637 displayAllFlat();
638 resetCurrentItem(); 638 resetCurrentItem();
639 return; 639 return;
640 } 640 }
641 //qDebug("update "); 641 //qDebug("update ");
642// kdDebug() << "KOTodoView::updateView()" << endl; 642// kdDebug() << "KOTodoView::updateView()" << endl;
643 QFont fo = KOPrefs::instance()->mTodoViewFont; 643 QFont fo = KOPrefs::instance()->mTodoViewFont;
644 644
645 645
646 mTodoListView->clear(); 646 mTodoListView->clear();
647 if ( mName == "todolistsmall" ) { 647 if ( mName == "todolistsmall" ) {
648 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 648 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
649 int ps = fo.pointSize() -2; 649 int ps = fo.pointSize() -2;
650 if ( ps > 12 ) 650 if ( ps > 12 )
651 ps -= 2; 651 ps -= 2;
652 fo.setPointSize( ps ); 652 fo.setPointSize( ps );
653 } 653 }
654 } 654 }
655 655
656 mTodoListView->setFont( fo ); 656 mTodoListView->setFont( fo );
657 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 657 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
658 //mTodoListView->header()->setMaximumHeight(fm.height()); 658 //mTodoListView->header()->setMaximumHeight(fm.height());
659 QPtrList<Todo> todoList = calendar()->todos(); 659 QPtrList<Todo> todoList = calendar()->todos();
660 660
661/* 661/*
662 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 662 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
663 Event *t; 663 Event *t;
664 for(t = todoList.first(); t; t = todoList.next()) { 664 for(t = todoList.first(); t; t = todoList.next()) {
665 kdDebug() << " " << t->getSummary() << endl; 665 kdDebug() << " " << t->getSummary() << endl;
666 666
667 if (t->getRelatedTo()) { 667 if (t->getRelatedTo()) {
668 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 668 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
669 } 669 }
670 670
671 QPtrList<Event> l = t->getRelations(); 671 QPtrList<Event> l = t->getRelations();
672 Event *c; 672 Event *c;
673 for(c=l.first();c;c=l.next()) { 673 for(c=l.first();c;c=l.next()) {
674 kdDebug() << " - relation: " << c->getSummary() << endl; 674 kdDebug() << " - relation: " << c->getSummary() << endl;
675 } 675 }
676 } 676 }
677*/ 677*/
678 678
679 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 679 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
680 // specific order of events. That means that we have to generate parent items 680 // specific order of events. That means that we have to generate parent items
681 // recursively for proper hierarchical display of Todos. 681 // recursively for proper hierarchical display of Todos.
682 mTodoMap.clear(); 682 mTodoMap.clear();
683 Todo *todo; 683 Todo *todo;
684 todo = todoList.first();// todo; todo = todoList.next()) { 684 todo = todoList.first();// todo; todo = todoList.next()) {
685 while ( todo ) { 685 while ( todo ) {
686 bool next = true; 686 bool next = true;
687 // qDebug("todo %s ", todo->summary().latin1()); 687 // qDebug("todo %s ", todo->summary().latin1());
688 Incidence *incidence = todo->relatedTo(); 688 Incidence *incidence = todo->relatedTo();
689 while ( incidence ) { 689 while ( incidence ) {
690 if ( incidence->type() == "Todo") { 690 if ( incidence->type() == "Todo") {
691 //qDebug("related %s ",incidence->summary().latin1() ); 691 //qDebug("related %s ",incidence->summary().latin1() );
692 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 692 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
693 //qDebug("related not found "); 693 //qDebug("related not found ");
694 todoList.remove( ); 694 todoList.remove( );
695 todo = todoList.current(); 695 todo = todoList.current();
696 next = false; 696 next = false;
697 incidence = 0; 697 incidence = 0;
698 698
699 } else { 699 } else {
700 //qDebug("related found "); 700 //qDebug("related found ");
701 incidence = incidence->relatedTo(); 701 incidence = incidence->relatedTo();
702 } 702 }
703 } else 703 } else
704 incidence = 0; 704 incidence = 0;
705 } 705 }
706 if ( next ) 706 if ( next )
707 todo = todoList.next(); 707 todo = todoList.next();
708 } 708 }
709// qDebug("again .... "); 709// qDebug("again .... ");
710// for(todo = todoList.first(); todo; todo = todoList.next()) { 710// for(todo = todoList.first(); todo; todo = todoList.next()) {
711 711
712// qDebug("yytodo %s ", todo->summary().latin1()); 712// qDebug("yytodo %s ", todo->summary().latin1());
713// } 713// }
714 //qDebug("for "); 714 //qDebug("for ");
715 for(todo = todoList.first(); todo; todo = todoList.next()) { 715 for(todo = todoList.first(); todo; todo = todoList.next()) {
716 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 716 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
717 { 717 {
718 insertTodoItem(todo); 718 insertTodoItem(todo);
719 } 719 }
720 } 720 }
721 //qDebug("for end "); 721 //qDebug("for end ");
722 // Restore opened/closed state 722 // Restore opened/closed state
723 mTodoListView->blockSignals( true ); 723 mTodoListView->blockSignals( true );
724 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 724 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
725 mTodoListView->blockSignals( false ); 725 mTodoListView->blockSignals( false );
726 resetCurrentItem(); 726 resetCurrentItem();
727 processSelectionChange(); 727 processSelectionChange();
728} 728}
729 729
730void KOTodoView::storeCurrentItem() 730void KOTodoView::storeCurrentItem()
731{ 731{
732 mCurItem = 0; 732 mCurItem = 0;
733 mCurItemRootParent = 0; 733 mCurItemRootParent = 0;
734 mCurItemParent = 0;
734 mCurItemAbove = 0; 735 mCurItemAbove = 0;
735 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 736 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
736 if (mActiveItem) { 737 if (mActiveItem) {
737 mCurItem = mActiveItem->todo(); 738 mCurItem = mActiveItem->todo();
738 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 739 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
739 if ( activeItemAbove ) 740 if ( activeItemAbove )
740 mCurItemAbove = activeItemAbove->todo(); 741 mCurItemAbove = activeItemAbove->todo();
741 mCurItemRootParent = mCurItem; 742 mCurItemRootParent = mCurItem;
743 mCurItemParent = mCurItemRootParent->relatedTo();
742 while ( mCurItemRootParent->relatedTo() != 0 ) 744 while ( mCurItemRootParent->relatedTo() != 0 )
743 mCurItemRootParent = mCurItemRootParent->relatedTo(); 745 mCurItemRootParent = mCurItemRootParent->relatedTo();
744 } 746 }
745 mActiveItem = 0; 747 mActiveItem = 0;
746} 748}
747 749
748void KOTodoView::resetCurrentItem() 750void KOTodoView::resetCurrentItem()
749{ 751{
750 mTodoListView->setFocus(); 752 mTodoListView->setFocus();
751 KOTodoViewItem* foundItem = 0; 753 KOTodoViewItem* foundItem = 0;
752 KOTodoViewItem* foundItemRoot = 0; 754 KOTodoViewItem* foundItemRoot = 0;
755 KOTodoViewItem* foundItemParent = 0;
753 KOTodoViewItem* foundItemAbove = 0; 756 KOTodoViewItem* foundItemAbove = 0;
754 if ( mTodoListView->firstChild () ) { 757 if ( mTodoListView->firstChild () ) {
755 if ( mCurItem ) { 758 if ( mCurItem ) {
756 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); 759 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
757 while ( item ) { 760 while ( item ) {
758 if ( item->todo() == mCurItem ) { 761 if ( item->todo() == mCurItem ) {
759 foundItem = item; 762 foundItem = item;
760 break; 763 break;
761 } else if ( item->todo() == mCurItemAbove ) { 764 } else if ( item->todo() == mCurItemAbove ) {
762 foundItemAbove = item; 765 foundItemAbove = item;
763 766
764 } else if ( item->todo() == mCurItemRootParent ) { 767 }
768 if ( item->todo() == mCurItemRootParent ) {
765 foundItemRoot = item; 769 foundItemRoot = item;
766 } 770 }
771 if ( item->todo() == mCurItemParent ) {
772 foundItemParent = item;
773 }
767 item = (KOTodoViewItem*)item->itemBelow(); 774 item = (KOTodoViewItem*)item->itemBelow();
768 } 775 }
769 if ( ! foundItem ) { 776 if ( ! foundItem ) {
770 if ( foundItemRoot ) 777 if ( foundItemParent ) {
771 foundItem = foundItemRoot; 778 foundItem = foundItemParent;
772 else 779 } else {
773 foundItem = foundItemAbove; 780 if ( foundItemRoot )
781 foundItem = foundItemRoot;
782 else
783 foundItem = foundItemAbove;
784 }
774 } 785 }
775 } 786 }
776 if ( foundItem ) { 787 if ( foundItem ) {
777 mTodoListView->setCurrentItem( foundItem ); 788 mTodoListView->setCurrentItem( foundItem );
778 mTodoListView->ensureItemVisible( foundItem ); 789 mTodoListView->ensureItemVisible( foundItem );
779 } else { 790 } else {
780 mTodoListView->setCurrentItem( mTodoListView->firstChild () ); 791 mTodoListView->setCurrentItem( mTodoListView->firstChild () );
781 } 792 }
782 } 793 }
783 mTodoListView->setFocus(); 794 mTodoListView->setFocus();
784} 795}
785//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; 796//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
786bool KOTodoView::checkTodo( Todo * todo ) 797bool KOTodoView::checkTodo( Todo * todo )
787{ 798{
788 799
789 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) 800 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
790 return false; 801 return false;
791 if ( !todo->isCompleted() ) { 802 if ( !todo->isCompleted() ) {
792 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) 803 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
793 return true; 804 return true;
794 } 805 }
795 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { 806 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
796 if ( todo->hasStartDate() ) 807 if ( todo->hasStartDate() )
797 if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) 808 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
798 return false; 809 return false;
799 if ( todo->hasDueDate() ) 810 if ( todo->hasDueDate() )
800 if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) 811 if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
801 return false; 812 return false;
802 } 813 }
803 return true; 814 return true;
804} 815}
805 816
806void KOTodoView::restoreItemState( QListViewItem *item ) 817void KOTodoView::restoreItemState( QListViewItem *item )
807{ 818{
808 pendingSubtodo = 0; 819 pendingSubtodo = 0;
809 while( item ) { 820 while( item ) {
810 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 821 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
811 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); 822 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
812 if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); 823 if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
813 item = item->nextSibling(); 824 item = item->nextSibling();
814 } 825 }
815} 826}
816 827
817 828
818QMap<Todo *,KOTodoViewItem *>::ConstIterator 829QMap<Todo *,KOTodoViewItem *>::ConstIterator
819 KOTodoView::insertTodoItem(Todo *todo) 830 KOTodoView::insertTodoItem(Todo *todo)
820{ 831{
821 832
822// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; 833// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
823 // TODO: Check, if dynmaic cast is necessary 834 // TODO: Check, if dynmaic cast is necessary
824 835
825 pendingSubtodo = 0; 836 pendingSubtodo = 0;
826 Incidence *incidence = todo->relatedTo(); 837 Incidence *incidence = todo->relatedTo();
827 if (incidence && incidence->type() == "Todo") { 838 if (incidence && incidence->type() == "Todo") {
828 Todo *relatedTodo = static_cast<Todo *>(incidence); 839 Todo *relatedTodo = static_cast<Todo *>(incidence);
829 840
830// kdDebug() << " has Related" << endl; 841// kdDebug() << " has Related" << endl;
831 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 842 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
832 itemIterator = mTodoMap.find(relatedTodo); 843 itemIterator = mTodoMap.find(relatedTodo);
833 if (itemIterator == mTodoMap.end()) { 844 if (itemIterator == mTodoMap.end()) {
834// kdDebug() << " related not yet in list" << endl; 845// kdDebug() << " related not yet in list" << endl;
835 itemIterator = insertTodoItem (relatedTodo); 846 itemIterator = insertTodoItem (relatedTodo);
836 } 847 }
837 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem 848 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem
838 // and one into the map. Sure finding is more easy but why? -zecke 849 // and one into the map. Sure finding is more easy but why? -zecke
839 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); 850 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
840 return mTodoMap.insert(todo,todoItem); 851 return mTodoMap.insert(todo,todoItem);
841 } else { 852 } else {
842// kdDebug() << " no Related" << endl; 853// kdDebug() << " no Related" << endl;
843 // see above -zecke 854 // see above -zecke
844 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 855 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
845 return mTodoMap.insert(todo,todoItem); 856 return mTodoMap.insert(todo,todoItem);
846 } 857 }
847} 858}
848 859
849 860
850void KOTodoView::updateConfig() 861void KOTodoView::updateConfig()
851{ 862{
852 updateView(); 863 updateView();
853 mTodoListView->repaintContents(); 864 mTodoListView->repaintContents();
854} 865}
855 866
856QPtrList<Incidence> KOTodoView::selectedIncidences() 867QPtrList<Incidence> KOTodoView::selectedIncidences()
857{ 868{
858 QPtrList<Incidence> selected; 869 QPtrList<Incidence> selected;
859 870
860 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 871 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
861// if (!item) item = mActiveItem; 872// if (!item) item = mActiveItem;
862 if (item) selected.append(item->todo()); 873 if (item) selected.append(item->todo());
863 874
864 return selected; 875 return selected;
865} 876}
866 877
867QPtrList<Todo> KOTodoView::selectedTodos() 878QPtrList<Todo> KOTodoView::selectedTodos()
868{ 879{
869 QPtrList<Todo> selected; 880 QPtrList<Todo> selected;
870 881
871 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 882 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
872// if (!item) item = mActiveItem; 883// if (!item) item = mActiveItem;
873 if (item) selected.append(item->todo()); 884 if (item) selected.append(item->todo());
874 885
875 return selected; 886 return selected;
876} 887}
877 888
878void KOTodoView::changeEventDisplay(Event *, int) 889void KOTodoView::changeEventDisplay(Event *, int)
879{ 890{
880 updateView(); 891 updateView();
881} 892}
882 893
883void KOTodoView::showDates(const QDate &, const QDate &) 894void KOTodoView::showDates(const QDate &, const QDate &)
884{ 895{
885} 896}
886 897
887void KOTodoView::showEvents(QPtrList<Event>) 898void KOTodoView::showEvents(QPtrList<Event>)
888{ 899{
889 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; 900 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
890} 901}
891 902
892void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, 903void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
893 const QDate &td) 904 const QDate &td)
894{ 905{
895#ifndef KORG_NOPRINTER 906#ifndef KORG_NOPRINTER
896 calPrinter->preview(CalPrinter::Todolist, fd, td); 907 calPrinter->preview(CalPrinter::Todolist, fd, td);
897#endif 908#endif
898} 909}
899 910
900void KOTodoView::editItem(QListViewItem *item ) 911void KOTodoView::editItem(QListViewItem *item )
901{ 912{
902 // qDebug("editItem(QListViewItem *item ) "); 913 // qDebug("editItem(QListViewItem *item ) ");
903 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 914 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
904} 915}
905 916
906void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 917void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
907{ 918{
908 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 919 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
909} 920}
910 921
911void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) 922void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
912{ 923{
913 pendingSubtodo = 0; 924 pendingSubtodo = 0;
914 mActiveItem = (KOTodoViewItem *)item; 925 mActiveItem = (KOTodoViewItem *)item;
915 if (item) { 926 if (item) {
916 switch (column){ 927 switch (column){
917 case 1: 928 case 1:
918 mPriorityPopupMenu->popup(QCursor::pos ()); break; 929 mPriorityPopupMenu->popup(QCursor::pos ()); break;
919 case 2: 930 case 2:
920 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 931 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
921 case 3: 932 case 3:
922 moveTodo(); 933 moveTodo();
923 break; 934 break;
924 case 8: 935 case 8:
925 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; 936 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break;
926 default: 937 default:
927 mItemPopupMenu->popup(QCursor::pos()); 938 mItemPopupMenu->popup(QCursor::pos());
928 } 939 }
929 } else mPopupMenu->popup(QCursor::pos()); 940 } else mPopupMenu->popup(QCursor::pos());
930} 941}
931void KOTodoView::newTodo() 942void KOTodoView::newTodo()
932{ 943{
933 emit newTodoSignal(); 944 emit newTodoSignal();
934} 945}
935 946
936void KOTodoView::newSubTodo() 947void KOTodoView::newSubTodo()
937{ 948{
938 if (mActiveItem) { 949 if (mActiveItem) {
939 emit newSubTodoSignal(mActiveItem->todo()); 950 emit newSubTodoSignal(mActiveItem->todo());
940 } 951 }
941} 952}
942void KOTodoView::unparentTodo() 953void KOTodoView::unparentTodo()
943{ 954{
944 if (mActiveItem) { 955 if (mActiveItem) {
945 emit unparentTodoSignal(mActiveItem->todo()); 956 emit unparentTodoSignal(mActiveItem->todo());
946 } 957 }
947} 958}
948 959
949void KOTodoView::reparentTodo() 960void KOTodoView::reparentTodo()
950{ 961{
951 if (mActiveItem) { 962 if (mActiveItem) {
952 qDebug("KOTodoView::reparentTodo() "); 963 qDebug("KOTodoView::reparentTodo() ");
953 topLevelWidget()->setCaption(i18n("Click on new parent item")); 964 topLevelWidget()->setCaption(i18n("Click on new parent item"));
954 pendingSubtodo = mActiveItem; 965 pendingSubtodo = mActiveItem;
955 } 966 }
956} 967}
957void KOTodoView::editTodo() 968void KOTodoView::editTodo()
958{ 969{
959 if (mActiveItem) { 970 if (mActiveItem) {
960 emit editTodoSignal(mActiveItem->todo()); 971 emit editTodoSignal(mActiveItem->todo());
961 } 972 }
962} 973}
963void KOTodoView::cloneTodo() 974void KOTodoView::cloneTodo()
964{ 975{
965 if (mActiveItem) { 976 if (mActiveItem) {
966 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 977 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
967 } 978 }
968} 979}
969void KOTodoView::cancelTodo() 980void KOTodoView::cancelTodo()
970{ 981{
971 if (mActiveItem) { 982 if (mActiveItem) {
972 emit cancelTodoSignal((Incidence*)mActiveItem->todo()); 983 emit cancelTodoSignal((Incidence*)mActiveItem->todo());
973 } 984 }
974} 985}
975void KOTodoView::moveTodo() 986void KOTodoView::moveTodo()
976{ 987{
977 if (mActiveItem) { 988 if (mActiveItem) {
978 emit moveTodoSignal((Incidence*)mActiveItem->todo()); 989 emit moveTodoSignal((Incidence*)mActiveItem->todo());
979 } 990 }
980} 991}
981void KOTodoView::beamTodo() 992void KOTodoView::beamTodo()
982{ 993{
983 if (mActiveItem) { 994 if (mActiveItem) {
984 emit beamTodoSignal((Incidence*)mActiveItem->todo()); 995 emit beamTodoSignal((Incidence*)mActiveItem->todo());
985 } 996 }
986} 997}
987 998
988 999
989void KOTodoView::showTodo() 1000void KOTodoView::showTodo()
990{ 1001{
991 if (mActiveItem) { 1002 if (mActiveItem) {
992 emit showTodoSignal(mActiveItem->todo()); 1003 emit showTodoSignal(mActiveItem->todo());
993 } 1004 }
994} 1005}
995 1006
996void KOTodoView::deleteTodo() 1007void KOTodoView::deleteTodo()
997{ 1008{
998 if (mActiveItem) { 1009 if (mActiveItem) {
999 emit deleteTodoSignal(mActiveItem->todo()); 1010 emit deleteTodoSignal(mActiveItem->todo());
1000 } 1011 }
1001} 1012}
1002 1013
1003void KOTodoView::setNewPriority(int index) 1014void KOTodoView::setNewPriority(int index)
1004{ 1015{
1005 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1016 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1006 mActiveItem->todo()->setPriority(mPriority[index]); 1017 mActiveItem->todo()->setPriority(mPriority[index]);
1007 mActiveItem->construct(); 1018 mActiveItem->construct();
1008 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 1019 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
1009 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1020 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1010 } 1021 }
1011} 1022}
1012 1023
1013void KOTodoView::setNewPercentage(int index) 1024void KOTodoView::setNewPercentage(int index)
1014{ 1025{
1015 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1026 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1016 1027
1017 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { 1028 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
1018 mActiveItem->setOn( true ); 1029 mActiveItem->setOn( true );
1019 return; 1030 return;
1020 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { 1031 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
1021 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); 1032 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
1022 if ( par && par->isOn() ) 1033 if ( par && par->isOn() )
1023 par->setOn( false ); 1034 par->setOn( false );
1024 } 1035 }
1025 if (mPercentage[index] == 100) { 1036 if (mPercentage[index] == 100) {
1026 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 1037 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
1027 } else { 1038 } else {
1028 mActiveItem->todo()->setCompleted(false); 1039 mActiveItem->todo()->setCompleted(false);
1029 } 1040 }
1030 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 1041 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
1031 mActiveItem->construct(); 1042 mActiveItem->construct();
1032 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 1043 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
1033 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1044 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1034 } 1045 }
1035} 1046}
1036 1047
1037 1048
1038QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 1049QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
1039{ 1050{
1040 QPopupMenu* tempMenu = new QPopupMenu (this); 1051 QPopupMenu* tempMenu = new QPopupMenu (this);
1041 QStringList checkedCategories = todoItem->todo()->categories (); 1052 QStringList checkedCategories = todoItem->todo()->categories ();
1042 1053
1043 tempMenu->setCheckable (true); 1054 tempMenu->setCheckable (true);
1044 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 1055 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
1045 it != KOPrefs::instance()->mCustomCategories.end (); 1056 it != KOPrefs::instance()->mCustomCategories.end ();
1046 ++it) { 1057 ++it) {
1047 int index = tempMenu->insertItem (*it); 1058 int index = tempMenu->insertItem (*it);
1048 mCategory[index] = *it; 1059 mCategory[index] = *it;
1049 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 1060 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
1050 } 1061 }
1051 1062
1052 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 1063 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
1053 return tempMenu; 1064 return tempMenu;
1054 1065
1055 1066
1056} 1067}
1057void KOTodoView::changedCategories(int index) 1068void KOTodoView::changedCategories(int index)
1058{ 1069{
1059 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1070 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1060 QStringList categories = mActiveItem->todo()->categories (); 1071 QStringList categories = mActiveItem->todo()->categories ();
1061 QString colcat = categories.first(); 1072 QString colcat = categories.first();
1062 if (categories.find (mCategory[index]) != categories.end ()) 1073 if (categories.find (mCategory[index]) != categories.end ())
1063 categories.remove (mCategory[index]); 1074 categories.remove (mCategory[index]);
1064 else 1075 else
1065 categories.insert (categories.end(), mCategory[index]); 1076 categories.insert (categories.end(), mCategory[index]);
1066 categories.sort (); 1077 categories.sort ();
1067 if ( !colcat.isEmpty() ) { 1078 if ( !colcat.isEmpty() ) {
1068 if ( categories.find ( colcat ) != categories.end () ) { 1079 if ( categories.find ( colcat ) != categories.end () ) {
1069 categories.remove( colcat ); 1080 categories.remove( colcat );
1070 categories.prepend( colcat ); 1081 categories.prepend( colcat );
1071 } 1082 }
1072 } 1083 }
1073 mActiveItem->todo()->setCategories (categories); 1084 mActiveItem->todo()->setCategories (categories);
1074 mActiveItem->construct(); 1085 mActiveItem->construct();
1075 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1086 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1076 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1087 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1077 } 1088 }
1078} 1089}
1079void KOTodoView::itemDoubleClicked(QListViewItem *item) 1090void KOTodoView::itemDoubleClicked(QListViewItem *item)
1080{ 1091{
1081 if ( pendingSubtodo != 0 ) { 1092 if ( pendingSubtodo != 0 ) {
1082 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1093 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1083 } 1094 }
1084 pendingSubtodo = 0; 1095 pendingSubtodo = 0;
1085 int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1096 int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1086 //qDebug("ROW %d ", row); 1097 //qDebug("ROW %d ", row);
1087 if (!item) { 1098 if (!item) {
1088 newTodo(); 1099 newTodo();
1089 return; 1100 return;
1090 } else { 1101 } else {
1091 if ( row == 1 || row == 2 ) { 1102 if ( row == 1 || row == 2 ) {
1092 mActiveItem = (KOTodoViewItem *) item; 1103 mActiveItem = (KOTodoViewItem *) item;
1093 newSubTodo(); 1104 newSubTodo();
1094 return; 1105 return;
1095 } 1106 }
1096 } 1107 }
1097 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1108 if ( KOPrefs::instance()->mEditOnDoubleClick )
1098 editItem( item ); 1109 editItem( item );
1099 else 1110 else
1100 showItem( item , QPoint(), 0 ); 1111 showItem( item , QPoint(), 0 );
1101} 1112}
1102void KOTodoView::itemClicked(QListViewItem *item) 1113void KOTodoView::itemClicked(QListViewItem *item)
1103{ 1114{
1104 //qDebug("KOTodoView::itemClicked %d", item); 1115 //qDebug("KOTodoView::itemClicked %d", item);
1105 if (!item) { 1116 if (!item) {
1106 if ( pendingSubtodo != 0 ) { 1117 if ( pendingSubtodo != 0 ) {
1107 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1118 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1108 } 1119 }
1109 pendingSubtodo = 0; 1120 pendingSubtodo = 0;
1110 return; 1121 return;
1111 } 1122 }
1112 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1123 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1113 if ( pendingSubtodo != 0 ) { 1124 if ( pendingSubtodo != 0 ) {
1114 bool allowReparent = true; 1125 bool allowReparent = true;
1115 QListViewItem *par = item; 1126 QListViewItem *par = item;
1116 while ( par ) { 1127 while ( par ) {
1117 if ( par == pendingSubtodo ) { 1128 if ( par == pendingSubtodo ) {
1118 allowReparent = false; 1129 allowReparent = false;
1119 break; 1130 break;
1120 } 1131 }
1121 par = par->parent(); 1132 par = par->parent();
1122 } 1133 }
1123 if ( !allowReparent ) { 1134 if ( !allowReparent ) {
1124 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1135 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1125 qDebug("Recursive reparenting not possible "); 1136 qDebug("Recursive reparenting not possible ");
1126 pendingSubtodo = 0; 1137 pendingSubtodo = 0;
1127 } else { 1138 } else {
1128 Todo* newParent = todoItem->todo(); 1139 Todo* newParent = todoItem->todo();
1129 Todo* newSub = pendingSubtodo->todo(); 1140 Todo* newSub = pendingSubtodo->todo();
1130 pendingSubtodo = 0; 1141 pendingSubtodo = 0;
1131 emit reparentTodoSignal( newParent,newSub ); 1142 emit reparentTodoSignal( newParent,newSub );
1132 return; 1143 return;
1133 } 1144 }
1134 } 1145 }
1135#if 0 1146#if 0
1136 // handled by the item itself 1147 // handled by the item itself
1137 bool completed = todoItem->todo()->isCompleted(); // Completed or not? 1148 bool completed = todoItem->todo()->isCompleted(); // Completed or not?
1138 qDebug("com %d ",completed ); 1149 qDebug("com %d ",completed );
1139 qDebug("itemclicked "); 1150 qDebug("itemclicked ");
1140 if (todoItem->isOn()) { 1151 if (todoItem->isOn()) {
1141 qDebug("on "); 1152 qDebug("on ");
1142 if (!completed) { 1153 if (!completed) {
1143 qDebug("set true "); 1154 qDebug("set true ");
1144 todoItem->todo()->setCompleted(QDateTime::currentDateTime()); 1155 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
1145 } 1156 }
1146 } else { 1157 } else {
1147 qDebug("not on "); 1158 qDebug("not on ");
1148 if (completed) { 1159 if (completed) {
1149 qDebug("set false "); 1160 qDebug("set false ");
1150 todoItem->todo()->setCompleted(false); 1161 todoItem->todo()->setCompleted(false);
1151 } 1162 }
1152 } 1163 }
1153#endif 1164#endif
1154} 1165}
1155 1166
1156void KOTodoView::setDocumentId( const QString &id ) 1167void KOTodoView::setDocumentId( const QString &id )
1157{ 1168{
1158 kdDebug() << "KOTodoView::setDocumentId()" << endl; 1169 kdDebug() << "KOTodoView::setDocumentId()" << endl;
1159 1170
1160 mDocPrefs->setDoc( id ); 1171 mDocPrefs->setDoc( id );
1161} 1172}
1162 1173
1163void KOTodoView::itemStateChanged( QListViewItem *item ) 1174void KOTodoView::itemStateChanged( QListViewItem *item )
1164{ 1175{
1165 if (!item) return; 1176 if (!item) return;
1166 1177
1167 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1178 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1168 1179
1169// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1180// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1170 1181
1171 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1182 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1172} 1183}
1173 1184
1174void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1185void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1175{ 1186{
1176 mTodoListView->saveLayout(config,group); 1187 mTodoListView->saveLayout(config,group);
1177} 1188}
1178 1189
1179void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1190void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1180{ 1191{
1181 mTodoListView->restoreLayout(config,group); 1192 mTodoListView->restoreLayout(config,group);
1182} 1193}
1183 1194
1184void KOTodoView::processSelectionChange() 1195void KOTodoView::processSelectionChange()
1185{ 1196{
1186// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1197// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1187 1198
1188 KOTodoViewItem *item = 1199 KOTodoViewItem *item =
1189 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1200 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1190 1201
1191 if ( !item ) { 1202 if ( !item ) {
1192 emit incidenceSelected( 0 ); 1203 emit incidenceSelected( 0 );
1193 } else { 1204 } else {
1194 emit incidenceSelected( item->todo() ); 1205 emit incidenceSelected( item->todo() );
1195 } 1206 }
1196} 1207}
1197 1208
1198void KOTodoView::modified(bool b) 1209void KOTodoView::modified(bool b)
1199{ 1210{
1200 emit isModified(b); 1211 emit isModified(b);
1201} 1212}
1202void KOTodoView::setTodoModified( Todo* todo ) 1213void KOTodoView::setTodoModified( Todo* todo )
1203{ 1214{
1204 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1215 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1205} 1216}
1206void KOTodoView::clearSelection() 1217void KOTodoView::clearSelection()
1207{ 1218{
1208 mTodoListView->selectAll( false ); 1219 mTodoListView->selectAll( false );
1209} 1220}
1210void KOTodoView::setAllOpen() 1221void KOTodoView::setAllOpen()
1211{ 1222{
1212 if ( isFlatDisplay ) { 1223 if ( isFlatDisplay ) {
1213 isFlatDisplay = false; 1224 isFlatDisplay = false;
1214 mPopupMenu->setItemChecked( 8,false ); 1225 mPopupMenu->setItemChecked( 8,false );
1215 updateView(); 1226 updateView();
1216 } else { 1227 } else {
1217 storeCurrentItem(); 1228 storeCurrentItem();
1218 } 1229 }
1219 setOpen(mTodoListView->firstChild(), true); 1230 setOpen(mTodoListView->firstChild(), true);
1220 resetCurrentItem(); 1231 resetCurrentItem();
1221} 1232}
1222void KOTodoView::setAllClose() 1233void KOTodoView::setAllClose()
1223{ 1234{
1224 if ( isFlatDisplay ) { 1235 if ( isFlatDisplay ) {
1225 isFlatDisplay = false; 1236 isFlatDisplay = false;
1226 mPopupMenu->setItemChecked( 8,false ); 1237 mPopupMenu->setItemChecked( 8,false );
1227 updateView(); 1238 updateView();
1228 } else { 1239 } else {
1229 storeCurrentItem(); 1240 storeCurrentItem();
1230 } 1241 }
1231 setOpen(mTodoListView->firstChild(), false); 1242 setOpen(mTodoListView->firstChild(), false);
1232 resetCurrentItem(); 1243 resetCurrentItem();
1233} 1244}
1234void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) 1245void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
1235{ 1246{
1236 1247
1237 while ( item ) { 1248 while ( item ) {
1238 setOpen( item->firstChild(), setOpenI ); 1249 setOpen( item->firstChild(), setOpenI );
1239 item->setOpen( setOpenI ); 1250 item->setOpen( setOpenI );
1240 item = item->nextSibling(); 1251 item = item->nextSibling();
1241 } 1252 }
1242} 1253}
1243 1254
1244void KOTodoView::displayAllFlat() 1255void KOTodoView::displayAllFlat()
1245{ 1256{
1246 pendingSubtodo = 0; 1257 pendingSubtodo = 0;
1247 if ( mBlockUpdate ) { 1258 if ( mBlockUpdate ) {
1248 return; 1259 return;
1249 } 1260 }
1250 mPopupMenu->setItemChecked( 8,true ); 1261 mPopupMenu->setItemChecked( 8,true );
1251 isFlatDisplay = true; 1262 isFlatDisplay = true;
1252 QPtrList<Todo> todoList = calendar()->todos(); 1263 QPtrList<Todo> todoList = calendar()->todos();
1253 mTodoMap.clear(); 1264 mTodoMap.clear();
1254 mTodoListView->clear(); 1265 mTodoListView->clear();
1255 Todo *todo; 1266 Todo *todo;
1256 for(todo = todoList.first(); todo; todo = todoList.next()) { 1267 for(todo = todoList.first(); todo; todo = todoList.next()) {
1257 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1268 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1258 mTodoMap.insert(todo,todoItem); 1269 mTodoMap.insert(todo,todoItem);
1259 } 1270 }
1260 mTodoListView->setFocus(); 1271 mTodoListView->setFocus();
1261 processSelectionChange(); 1272 processSelectionChange();
1262} 1273}
1263 1274
1264void KOTodoView::setAllFlat() 1275void KOTodoView::setAllFlat()
1265{ 1276{
1266 if ( isFlatDisplay ) { 1277 if ( isFlatDisplay ) {
1267 isFlatDisplay = false; 1278 isFlatDisplay = false;
1268 mPopupMenu->setItemChecked( 8,false ); 1279 mPopupMenu->setItemChecked( 8,false );
1269 updateView(); 1280 updateView();
1270 return; 1281 return;
1271 } 1282 }
1272 storeCurrentItem(); 1283 storeCurrentItem();
1273 displayAllFlat(); 1284 displayAllFlat();
1274 resetCurrentItem(); 1285 resetCurrentItem();
1275} 1286}
1276 1287
1277void KOTodoView::purgeCompleted() 1288void KOTodoView::purgeCompleted()
1278{ 1289{
1279 emit purgeCompletedSignal(); 1290 emit purgeCompletedSignal();
1280 1291
1281} 1292}
1282void KOTodoView::toggleQuickTodo() 1293void KOTodoView::toggleQuickTodo()
1283{ 1294{
1284 if ( mQuickAdd->isVisible() ) { 1295 if ( mQuickAdd->isVisible() ) {
1285 mQuickAdd->hide(); 1296 mQuickAdd->hide();
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 39976cf..d0788a9 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -1,263 +1,263 @@
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 <qlistview.h> 35#include <qlistview.h>
36#include <klistview.h> 36#include <klistview.h>
37 37
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40 40
41#include <korganizer/baseview.h> 41#include <korganizer/baseview.h>
42 42
43#include "kotodoviewitem.h" 43#include "kotodoviewitem.h"
44#include "koprefs.h" 44#include "koprefs.h"
45#include "koglobals.h" 45#include "koglobals.h"
46#include "datenavigator.h" 46#include "datenavigator.h"
47 47
48class QDragEnterEvent; 48class QDragEnterEvent;
49class QDragMoveEvent; 49class QDragMoveEvent;
50class QDragLeaveEvent; 50class QDragLeaveEvent;
51class QDropEvent; 51class QDropEvent;
52class KOTodoViewWhatsThis; 52class KOTodoViewWhatsThis;
53 53
54class DocPrefs; 54class DocPrefs;
55 55
56class KOTodoListView : public KListView 56class KOTodoListView : public KListView
57{ 57{
58 Q_OBJECT 58 Q_OBJECT
59 public: 59 public:
60 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 60 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
61 virtual ~KOTodoListView() {} 61 virtual ~KOTodoListView() {}
62 62
63 signals: 63 signals:
64 void paintNeeded(); 64 void paintNeeded();
65 void todoDropped(Todo *, int); 65 void todoDropped(Todo *, int);
66 void double_Clicked(QListViewItem *item); 66 void double_Clicked(QListViewItem *item);
67 void reparentTodoSignal( Todo *,Todo * ); 67 void reparentTodoSignal( Todo *,Todo * );
68 void unparentTodoSignal(Todo *); 68 void unparentTodoSignal(Todo *);
69 void deleteTodo( Todo * ); 69 void deleteTodo( Todo * );
70 protected: 70 protected:
71 void wheelEvent (QWheelEvent *e); 71 void wheelEvent (QWheelEvent *e);
72 void contentsDragEnterEvent(QDragEnterEvent *); 72 void contentsDragEnterEvent(QDragEnterEvent *);
73 void contentsDragMoveEvent(QDragMoveEvent *); 73 void contentsDragMoveEvent(QDragMoveEvent *);
74 void contentsDragLeaveEvent(QDragLeaveEvent *); 74 void contentsDragLeaveEvent(QDragLeaveEvent *);
75 void contentsDropEvent(QDropEvent *); 75 void contentsDropEvent(QDropEvent *);
76 76
77 void contentsMousePressEvent(QMouseEvent *); 77 void contentsMousePressEvent(QMouseEvent *);
78 void contentsMouseMoveEvent(QMouseEvent *); 78 void contentsMouseMoveEvent(QMouseEvent *);
79 void contentsMouseReleaseEvent(QMouseEvent *); 79 void contentsMouseReleaseEvent(QMouseEvent *);
80 void contentsMouseDoubleClickEvent(QMouseEvent *); 80 void contentsMouseDoubleClickEvent(QMouseEvent *);
81 81
82 private: 82 private:
83 void paintEvent(QPaintEvent * pevent); 83 void paintEvent(QPaintEvent * pevent);
84 bool internalDrop; 84 bool internalDrop;
85 QString mName; 85 QString mName;
86 Calendar *mCalendar; 86 Calendar *mCalendar;
87 QPoint mPressPos; 87 QPoint mPressPos;
88 bool mMousePressed; 88 bool mMousePressed;
89 QListViewItem *mOldCurrent; 89 QListViewItem *mOldCurrent;
90 bool mFlagKeyPressed; 90 bool mFlagKeyPressed;
91 void keyPressEvent ( QKeyEvent * ) ; 91 void keyPressEvent ( QKeyEvent * ) ;
92 void keyReleaseEvent ( QKeyEvent * ) ; 92 void keyReleaseEvent ( QKeyEvent * ) ;
93}; 93};
94 94
95 95
96/** 96/**
97 This is the line-edit on top of the todoview for fast addition of new todos 97 This is the line-edit on top of the todoview for fast addition of new todos
98*/ 98*/
99class KOQuickTodo : public QLineEdit 99class KOQuickTodo : public QLineEdit
100{ 100{
101 public: 101 public:
102 KOQuickTodo(QWidget *parent=0); 102 KOQuickTodo(QWidget *parent=0);
103 protected: 103 protected:
104 void focusInEvent(QFocusEvent *ev); 104 void focusInEvent(QFocusEvent *ev);
105 void focusOutEvent(QFocusEvent *ev); 105 void focusOutEvent(QFocusEvent *ev);
106}; 106};
107 107
108 108
109/** 109/**
110 This class provides a multi-column list view of todo events. 110 This class provides a multi-column list view of todo events.
111 111
112 @short multi-column list view of todo events. 112 @short multi-column list view of todo events.
113 @author Cornelius Schumacher <schumacher@kde.org> 113 @author Cornelius Schumacher <schumacher@kde.org>
114*/ 114*/
115class KOTodoView : public KOrg::BaseView 115class KOTodoView : public KOrg::BaseView
116{ 116{
117 Q_OBJECT 117 Q_OBJECT
118 public: 118 public:
119 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 119 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
120 ~KOTodoView(); 120 ~KOTodoView();
121 121
122 QPtrList<Incidence> selectedIncidences(); 122 QPtrList<Incidence> selectedIncidences();
123 QPtrList<Todo> selectedTodos(); 123 QPtrList<Todo> selectedTodos();
124 124
125 DateList selectedDates() 125 DateList selectedDates()
126 {DateList q; 126 {DateList q;
127 return q;} 127 return q;}
128 128
129 /** Return number of shown dates. TodoView does not show dates, */ 129 /** Return number of shown dates. TodoView does not show dates, */
130 int currentDateCount() { return 0; } 130 int currentDateCount() { return 0; }
131 131
132 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 132 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
133 133
134 void setDocumentId( const QString & ); 134 void setDocumentId( const QString & );
135 135
136 void saveLayout(KConfig *config, const QString &group) const; 136 void saveLayout(KConfig *config, const QString &group) const;
137 void restoreLayout(KConfig *config, const QString &group); 137 void restoreLayout(KConfig *config, const QString &group);
138 /** Create a popup menu to set categories */ 138 /** Create a popup menu to set categories */
139 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); 139 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem);
140 void setNavigator( DateNavigator* nav ) {mNavigator = nav;} 140 void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
141 QString getWhatsThisText(QPoint p); 141 QString getWhatsThisText(QPoint p);
142 142
143 public slots: 143 public slots:
144 void updateView(); 144 void updateView();
145 void updateConfig(); 145 void updateConfig();
146 146
147 void changeEventDisplay(Event *, int); 147 void changeEventDisplay(Event *, int);
148 148
149 void showDates(const QDate &start, const QDate &end); 149 void showDates(const QDate &start, const QDate &end);
150 void showEvents(QPtrList<Event> eventList); 150 void showEvents(QPtrList<Event> eventList);
151 151
152 void clearSelection(); 152 void clearSelection();
153 void jumpToDate (); 153 void jumpToDate ();
154 154
155 void editItem(QListViewItem *item); 155 void editItem(QListViewItem *item);
156 void showItem(QListViewItem *item,const QPoint &,int); 156 void showItem(QListViewItem *item,const QPoint &,int);
157 void popupMenu(QListViewItem *item,const QPoint &,int); 157 void popupMenu(QListViewItem *item,const QPoint &,int);
158 void newTodo(); 158 void newTodo();
159 void newSubTodo(); 159 void newSubTodo();
160 void unparentTodo(); 160 void unparentTodo();
161 void reparentTodo(); 161 void reparentTodo();
162 void showTodo(); 162 void showTodo();
163 void editTodo(); 163 void editTodo();
164 void cloneTodo(); 164 void cloneTodo();
165 void cancelTodo(); 165 void cancelTodo();
166 void moveTodo(); 166 void moveTodo();
167 void beamTodo(); 167 void beamTodo();
168 void deleteTodo(); 168 void deleteTodo();
169 169
170 void setNewPriority(int); 170 void setNewPriority(int);
171 void setNewPercentage(int); 171 void setNewPercentage(int);
172 void changedCategories(int); 172 void changedCategories(int);
173 173
174 void setAllOpen(); 174 void setAllOpen();
175 void setAllClose(); 175 void setAllClose();
176 void setAllFlat(); 176 void setAllFlat();
177 void displayAllFlat(); 177 void displayAllFlat();
178 178
179 void purgeCompleted(); 179 void purgeCompleted();
180 void toggleCompleted(); 180 void toggleCompleted();
181 void toggleRunning(); 181 void toggleRunning();
182 void toggleQuickTodo(); 182 void toggleQuickTodo();
183 void updateTodo( Todo *, int ); 183 void updateTodo( Todo *, int );
184 184
185 void itemClicked(QListViewItem *); 185 void itemClicked(QListViewItem *);
186 void itemStateChanged(QListViewItem *); 186 void itemStateChanged(QListViewItem *);
187 void modified(bool); 187 void modified(bool);
188 void itemDoubleClicked(QListViewItem *item); 188 void itemDoubleClicked(QListViewItem *item);
189 189
190 signals: 190 signals:
191 void newTodoSignal(); 191 void newTodoSignal();
192 void newSubTodoSignal(Todo *); 192 void newSubTodoSignal(Todo *);
193 void unparentTodoSignal(Todo *); 193 void unparentTodoSignal(Todo *);
194 void reparentTodoSignal( Todo *,Todo * ); 194 void reparentTodoSignal( Todo *,Todo * );
195 void showTodoSignal(Todo *); 195 void showTodoSignal(Todo *);
196 196
197 void editTodoSignal(Todo *); 197 void editTodoSignal(Todo *);
198 void deleteTodoSignal(Todo *); 198 void deleteTodoSignal(Todo *);
199 void todoModifiedSignal (Todo *, int); 199 void todoModifiedSignal (Todo *, int);
200 200
201 void isModified(bool); 201 void isModified(bool);
202 void cloneTodoSignal( Incidence * ); 202 void cloneTodoSignal( Incidence * );
203 void cancelTodoSignal( Incidence * ); 203 void cancelTodoSignal( Incidence * );
204 void moveTodoSignal( Incidence * ); 204 void moveTodoSignal( Incidence * );
205 void beamTodoSignal( Incidence * ); 205 void beamTodoSignal( Incidence * );
206 void purgeCompletedSignal(); 206 void purgeCompletedSignal();
207 207
208 protected slots: 208 protected slots:
209 void paintNeeded(); 209 void paintNeeded();
210 void processSelectionChange(); 210 void processSelectionChange();
211 void addQuickTodo(); 211 void addQuickTodo();
212 void setTodoModified( Todo* ); 212 void setTodoModified( Todo* );
213 void todoModified(Todo *, int ); 213 void todoModified(Todo *, int );
214 214
215 private: 215 private:
216 /* 216 /*
217 * the TodoEditor approach is rather unscaling in the long 217 * the TodoEditor approach is rather unscaling in the long
218 * run. 218 * run.
219 * Korganizer keeps it in memory and we need to update 219 * Korganizer keeps it in memory and we need to update
220 * 1. make KOTodoViewItem a QObject again? 220 * 1. make KOTodoViewItem a QObject again?
221 * 2. add a public method for setting one todo modified? 221 * 2. add a public method for setting one todo modified?
222 * 3. add a private method for setting a todo modified + friend here? 222 * 3. add a private method for setting a todo modified + friend here?
223 * -- zecke 2002-07-08 223 * -- zecke 2002-07-08
224 */ 224 */
225 KOTodoViewWhatsThis* mKOTodoViewWhatsThis; 225 KOTodoViewWhatsThis* mKOTodoViewWhatsThis;
226 friend class KOTodoListView; 226 friend class KOTodoListView;
227 void paintEvent(QPaintEvent * pevent); 227 void paintEvent(QPaintEvent * pevent);
228 bool mPendingUpdateBeforeRepaint; 228 bool mPendingUpdateBeforeRepaint;
229 friend class KOTodoViewItem; 229 friend class KOTodoViewItem;
230 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 230 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
231 void restoreItemState( QListViewItem * ); 231 void restoreItemState( QListViewItem * );
232 232
233 bool checkTodo( Todo * ); 233 bool checkTodo( Todo * );
234 bool isFlatDisplay; 234 bool isFlatDisplay;
235 void setOpen( QListViewItem*, bool setOpen); 235 void setOpen( QListViewItem*, bool setOpen);
236 KOTodoListView *mTodoListView; 236 KOTodoListView *mTodoListView;
237 QPopupMenu *mItemPopupMenu; 237 QPopupMenu *mItemPopupMenu;
238 QPopupMenu *mPopupMenu; 238 QPopupMenu *mPopupMenu;
239 QPopupMenu *mPriorityPopupMenu; 239 QPopupMenu *mPriorityPopupMenu;
240 QPopupMenu *mPercentageCompletedPopupMenu; 240 QPopupMenu *mPercentageCompletedPopupMenu;
241 QPopupMenu *mCategoryPopupMenu; 241 QPopupMenu *mCategoryPopupMenu;
242 242
243 QMap<int, int> mPercentage; 243 QMap<int, int> mPercentage;
244 QMap<int, int> mPriority; 244 QMap<int, int> mPriority;
245 QMap<int, QString> mCategory; 245 QMap<int, QString> mCategory;
246 KOTodoViewItem *mActiveItem; 246 KOTodoViewItem *mActiveItem;
247 247
248 QMap<Todo *,KOTodoViewItem *> mTodoMap; 248 QMap<Todo *,KOTodoViewItem *> mTodoMap;
249 QString mName; 249 QString mName;
250 250
251 DocPrefs *mDocPrefs; 251 DocPrefs *mDocPrefs;
252 QString mCurrentDoc; 252 QString mCurrentDoc;
253 KOQuickTodo *mQuickAdd; 253 KOQuickTodo *mQuickAdd;
254 bool mBlockUpdate; 254 bool mBlockUpdate;
255 void keyPressEvent ( QKeyEvent * ) ; 255 void keyPressEvent ( QKeyEvent * ) ;
256 KOTodoViewItem * pendingSubtodo; 256 KOTodoViewItem * pendingSubtodo;
257 DateNavigator* mNavigator; 257 DateNavigator* mNavigator;
258 void storeCurrentItem(); 258 void storeCurrentItem();
259 void resetCurrentItem(); 259 void resetCurrentItem();
260 Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; 260 Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove;
261}; 261};
262 262
263#endif 263#endif