-rw-r--r-- | korganizer/kotodoview.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 06d40b1..2c017e1 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -431,147 +431,151 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | |||
431 | return; | 431 | return; |
432 | } | 432 | } |
433 | 433 | ||
434 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 434 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
435 | switch ( e->key() ) { | 435 | switch ( e->key() ) { |
436 | case Qt::Key_Down: | 436 | case Qt::Key_Down: |
437 | case Qt::Key_Up: | 437 | case Qt::Key_Up: |
438 | QListView::keyPressEvent ( e ); | 438 | QListView::keyPressEvent ( e ); |
439 | break; | 439 | break; |
440 | case Qt::Key_Left: | 440 | case Qt::Key_Left: |
441 | case Qt::Key_Right: | 441 | case Qt::Key_Right: |
442 | QListView::keyPressEvent ( e ); | 442 | QListView::keyPressEvent ( e ); |
443 | e->accept(); | 443 | e->accept(); |
444 | return; | 444 | return; |
445 | break; | 445 | break; |
446 | default: | 446 | default: |
447 | e->ignore(); | 447 | e->ignore(); |
448 | break; | 448 | break; |
449 | } | 449 | } |
450 | return; | 450 | return; |
451 | } | 451 | } |
452 | e->ignore(); | 452 | e->ignore(); |
453 | } | 453 | } |
454 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 454 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
455 | { | 455 | { |
456 | QListView::contentsMouseReleaseEvent(e); | 456 | QListView::contentsMouseReleaseEvent(e); |
457 | mMousePressed = false; | 457 | mMousePressed = false; |
458 | } | 458 | } |
459 | 459 | ||
460 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 460 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
461 | { | 461 | { |
462 | if (!e) return; | 462 | if (!e) return; |
463 | 463 | ||
464 | QPoint vp = contentsToViewport(e->pos()); | 464 | QPoint vp = contentsToViewport(e->pos()); |
465 | 465 | ||
466 | QListViewItem *item = itemAt(vp); | 466 | QListViewItem *item = itemAt(vp); |
467 | 467 | ||
468 | emit double_Clicked(item); | 468 | emit double_Clicked(item); |
469 | if (!item) return; | 469 | if (!item) return; |
470 | 470 | ||
471 | emit doubleClicked(item,vp,0); | 471 | emit doubleClicked(item,vp,0); |
472 | } | 472 | } |
473 | 473 | ||
474 | ///////////////////////////////////////////////////////////////////////////// | 474 | ///////////////////////////////////////////////////////////////////////////// |
475 | 475 | ||
476 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 476 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
477 | QLineEdit(parent) | 477 | QLineEdit(parent) |
478 | { | 478 | { |
479 | setText(i18n("Click to add a new Todo")); | 479 | setText(i18n("Click to add new Todo")); |
480 | } | 480 | } |
481 | 481 | ||
482 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 482 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
483 | { | 483 | { |
484 | if ( text()==i18n("Click to add a new Todo") ) | 484 | if ( text()==i18n("Click to add new Todo") ) |
485 | setText(""); | 485 | setText(""); |
486 | QLineEdit::focusInEvent(ev); | 486 | QLineEdit::focusInEvent(ev); |
487 | } | 487 | } |
488 | 488 | ||
489 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 489 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
490 | { | 490 | { |
491 | setText(i18n("Click to add a new Todo")); | 491 | setText(i18n("Click to add new Todo")); |
492 | QLineEdit::focusOutEvent(ev); | 492 | QLineEdit::focusOutEvent(ev); |
493 | } | 493 | } |
494 | 494 | ||
495 | ///////////////////////////////////////////////////////////////////////////// | 495 | ///////////////////////////////////////////////////////////////////////////// |
496 | 496 | ||
497 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 497 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
498 | KOrg::BaseView(calendar,parent,name) | 498 | KOrg::BaseView(calendar,parent,name) |
499 | { | 499 | { |
500 | mCategoryPopupMenu = 0; | 500 | mCategoryPopupMenu = 0; |
501 | mPendingUpdateBeforeRepaint = false; | 501 | mPendingUpdateBeforeRepaint = false; |
502 | isFlatDisplay = false; | 502 | isFlatDisplay = false; |
503 | mNavigator = 0; | 503 | mNavigator = 0; |
504 | QBoxLayout *topLayout = new QVBoxLayout(this); | 504 | QBoxLayout *topLayout = new QVBoxLayout(this); |
505 | mName = QString ( name ); | 505 | mName = QString ( name ); |
506 | mBlockUpdate = false; | 506 | mBlockUpdate = false; |
507 | mQuickBar = new QWidget( this ); | 507 | mQuickBar = new QWidget( this ); |
508 | topLayout->addWidget(mQuickBar); | 508 | topLayout->addWidget(mQuickBar); |
509 | 509 | ||
510 | mQuickAdd = new KOQuickTodo(mQuickBar); | 510 | mQuickAdd = new KOQuickTodo(mQuickBar); |
511 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); | 511 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); |
512 | quickLayout->addWidget( mQuickAdd ); | 512 | quickLayout->addWidget( mQuickAdd ); |
513 | QPushButton * flat = new QPushButton( "F",mQuickBar ); | 513 | QPushButton * flat = new QPushButton( "F",mQuickBar ); |
514 | int fixwid = flat->sizeHint().height(); | 514 | int fixwid = flat->sizeHint().height(); |
515 | if ( QApplication::desktop()->width() > 320 ) | 515 | if ( QApplication::desktop()->width() > 320 ) |
516 | fixwid *= 2; | 516 | fixwid *= 2; |
517 | flat->setFixedWidth( fixwid ); | 517 | flat->setFixedWidth( fixwid ); |
518 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); | 518 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); |
519 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); | 519 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); |
520 | allopen->setFixedWidth( fixwid ); | 520 | allopen->setFixedWidth( fixwid ); |
521 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); | 521 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); |
522 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); | 522 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); |
523 | allclose->setFixedWidth( fixwid ); | 523 | allclose->setFixedWidth( fixwid ); |
524 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); | 524 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); |
525 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); | 525 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); |
526 | s_done->setPixmap( SmallIcon("greenhook16")); | ||
526 | s_done->setFixedWidth( fixwid ); | 527 | s_done->setFixedWidth( fixwid ); |
528 | s_done->setFixedHeight( flat->sizeHint().height() ); | ||
527 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); | 529 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); |
528 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); | 530 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); |
531 | s_run->setPixmap( SmallIcon("ko16old")); | ||
529 | s_run->setFixedWidth( fixwid ); | 532 | s_run->setFixedWidth( fixwid ); |
533 | s_run->setFixedHeight( flat->sizeHint().height() ); | ||
530 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); | 534 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); |
531 | 535 | ||
532 | mNewSubBut = new QPushButton( "sub",mQuickBar ); | 536 | mNewSubBut = new QPushButton( "sub",mQuickBar ); |
533 | mNewSubBut->setFixedWidth( fixwid*3/2 ); | 537 | mNewSubBut->setFixedWidth( fixwid*3/2 ); |
534 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); | 538 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); |
535 | mNewSubBut->setEnabled( false ); | 539 | mNewSubBut->setEnabled( false ); |
536 | quickLayout->addWidget( mNewSubBut ); | 540 | quickLayout->addWidget( mNewSubBut ); |
537 | quickLayout->addWidget( s_done ); | 541 | quickLayout->addWidget( s_done ); |
538 | quickLayout->addWidget( s_run ); | 542 | quickLayout->addWidget( s_run ); |
539 | 543 | ||
540 | quickLayout->addWidget( allopen ); | 544 | quickLayout->addWidget( allopen ); |
541 | quickLayout->addWidget( allclose ); | 545 | quickLayout->addWidget( allclose ); |
542 | quickLayout->addWidget( flat ); | 546 | quickLayout->addWidget( flat ); |
543 | 547 | ||
544 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); | 548 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); |
545 | 549 | ||
546 | mTodoListView = new KOTodoListView(calendar,this, name ); | 550 | mTodoListView = new KOTodoListView(calendar,this, name ); |
547 | topLayout->addWidget(mTodoListView); | 551 | topLayout->addWidget(mTodoListView); |
548 | //mTodoListView->header()->setMaximumHeight(30); | 552 | //mTodoListView->header()->setMaximumHeight(30); |
549 | mTodoListView->setRootIsDecorated(true); | 553 | mTodoListView->setRootIsDecorated(true); |
550 | mTodoListView->setAllColumnsShowFocus(true); | 554 | mTodoListView->setAllColumnsShowFocus(true); |
551 | 555 | ||
552 | mTodoListView->setShowSortIndicator(true); | 556 | mTodoListView->setShowSortIndicator(true); |
553 | 557 | ||
554 | mTodoListView->addColumn(i18n("Todo")); | 558 | mTodoListView->addColumn(i18n("Todo")); |
555 | mTodoListView->addColumn(i18n("Prio")); | 559 | mTodoListView->addColumn(i18n("Prio")); |
556 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 560 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
557 | mTodoListView->addColumn(i18n("Complete")); | 561 | mTodoListView->addColumn(i18n("Complete")); |
558 | mTodoListView->setColumnAlignment(2,AlignCenter); | 562 | mTodoListView->setColumnAlignment(2,AlignCenter); |
559 | 563 | ||
560 | mTodoListView->addColumn(i18n("Due Date")); | 564 | mTodoListView->addColumn(i18n("Due Date")); |
561 | mTodoListView->setColumnAlignment(3,AlignLeft); | 565 | mTodoListView->setColumnAlignment(3,AlignLeft); |
562 | mTodoListView->addColumn(i18n("Due Time")); | 566 | mTodoListView->addColumn(i18n("Due Time")); |
563 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 567 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
564 | 568 | ||
565 | mTodoListView->addColumn(i18n("Start Date")); | 569 | mTodoListView->addColumn(i18n("Start Date")); |
566 | mTodoListView->setColumnAlignment(5,AlignLeft); | 570 | mTodoListView->setColumnAlignment(5,AlignLeft); |
567 | mTodoListView->addColumn(i18n("Start Time")); | 571 | mTodoListView->addColumn(i18n("Start Time")); |
568 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 572 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
569 | 573 | ||
570 | mTodoListView->addColumn(i18n("Cancelled")); | 574 | mTodoListView->addColumn(i18n("Cancelled")); |
571 | mTodoListView->addColumn(i18n("Categories")); | 575 | mTodoListView->addColumn(i18n("Categories")); |
572 | mTodoListView->addColumn(i18n("Calendar")); | 576 | mTodoListView->addColumn(i18n("Calendar")); |
573 | #if 0 | 577 | #if 0 |
574 | mTodoListView->addColumn(i18n("Sort Id")); | 578 | mTodoListView->addColumn(i18n("Sort Id")); |
575 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 579 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
576 | #endif | 580 | #endif |
577 | 581 | ||
@@ -1073,97 +1077,97 @@ void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | |||
1073 | const QDate &td) | 1077 | const QDate &td) |
1074 | { | 1078 | { |
1075 | #ifndef KORG_NOPRINTER | 1079 | #ifndef KORG_NOPRINTER |
1076 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 1080 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
1077 | #endif | 1081 | #endif |
1078 | } | 1082 | } |
1079 | 1083 | ||
1080 | void KOTodoView::editItem(QListViewItem *item ) | 1084 | void KOTodoView::editItem(QListViewItem *item ) |
1081 | { | 1085 | { |
1082 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 1086 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
1083 | } | 1087 | } |
1084 | 1088 | ||
1085 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 1089 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
1086 | { | 1090 | { |
1087 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 1091 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
1088 | } | 1092 | } |
1089 | 1093 | ||
1090 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 1094 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) |
1091 | { | 1095 | { |
1092 | pendingSubtodo = 0; | 1096 | pendingSubtodo = 0; |
1093 | mActiveItem = (KOTodoViewItem *)item; | 1097 | mActiveItem = (KOTodoViewItem *)item; |
1094 | if (item) { | 1098 | if (item) { |
1095 | switch (column){ | 1099 | switch (column){ |
1096 | case 1: | 1100 | case 1: |
1097 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 1101 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
1098 | case 2: | 1102 | case 2: |
1099 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 1103 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
1100 | case 3: | 1104 | case 3: |
1101 | moveTodo(); | 1105 | moveTodo(); |
1102 | break; | 1106 | break; |
1103 | case 8: | 1107 | case 8: |
1104 | mCategoryPopupMenu->popup(QCursor::pos ()); break; | 1108 | mCategoryPopupMenu->popup(QCursor::pos ()); break; |
1105 | case 9: | 1109 | case 9: |
1106 | mCalPopupMenu->popup(QCursor::pos ()); break; | 1110 | mCalPopupMenu->popup(QCursor::pos ()); break; |
1107 | default: | 1111 | default: |
1108 | mItemPopupMenu->popup(QCursor::pos()); | 1112 | mItemPopupMenu->popup(QCursor::pos()); |
1109 | } | 1113 | } |
1110 | } else mPopupMenu->popup(QCursor::pos()); | 1114 | } else mPopupMenu->popup(QCursor::pos()); |
1111 | } | 1115 | } |
1112 | void KOTodoView::newTodo() | 1116 | void KOTodoView::newTodo() |
1113 | { | 1117 | { |
1114 | emit newTodoSignal(); | 1118 | emit newTodoSignal(); |
1115 | } | 1119 | } |
1116 | 1120 | ||
1117 | void KOTodoView::newSubTodo() | 1121 | void KOTodoView::newSubTodo() |
1118 | { | 1122 | { |
1119 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1123 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1120 | if (mActiveItem) { | 1124 | if (mActiveItem) { |
1121 | if ( mQuickAdd->isVisible() && !mQuickAdd->text().isEmpty() && mQuickAdd->text() != i18n("Click to add a new Todo") ) { | 1125 | if ( mQuickAdd->isVisible() && !mQuickAdd->text().isEmpty() && mQuickAdd->text() != i18n("Click to add new Todo") ) { |
1122 | addQuickTodoPar( mActiveItem->todo()); | 1126 | addQuickTodoPar( mActiveItem->todo()); |
1123 | } else | 1127 | } else |
1124 | emit newSubTodoSignal(mActiveItem->todo()); | 1128 | emit newSubTodoSignal(mActiveItem->todo()); |
1125 | } | 1129 | } |
1126 | } | 1130 | } |
1127 | void KOTodoView::unparentTodo() | 1131 | void KOTodoView::unparentTodo() |
1128 | { | 1132 | { |
1129 | if (mActiveItem) { | 1133 | if (mActiveItem) { |
1130 | emit unparentTodoSignal(mActiveItem->todo()); | 1134 | emit unparentTodoSignal(mActiveItem->todo()); |
1131 | } | 1135 | } |
1132 | } | 1136 | } |
1133 | 1137 | ||
1134 | void KOTodoView::reparentTodo() | 1138 | void KOTodoView::reparentTodo() |
1135 | { | 1139 | { |
1136 | if (mActiveItem) { | 1140 | if (mActiveItem) { |
1137 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 1141 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
1138 | pendingSubtodo = mActiveItem; | 1142 | pendingSubtodo = mActiveItem; |
1139 | } | 1143 | } |
1140 | } | 1144 | } |
1141 | void KOTodoView::editTodo() | 1145 | void KOTodoView::editTodo() |
1142 | { | 1146 | { |
1143 | if (mActiveItem) { | 1147 | if (mActiveItem) { |
1144 | emit editTodoSignal(mActiveItem->todo()); | 1148 | emit editTodoSignal(mActiveItem->todo()); |
1145 | } | 1149 | } |
1146 | } | 1150 | } |
1147 | void KOTodoView::cloneTodo() | 1151 | void KOTodoView::cloneTodo() |
1148 | { | 1152 | { |
1149 | if (mActiveItem) { | 1153 | if (mActiveItem) { |
1150 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 1154 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
1151 | } | 1155 | } |
1152 | } | 1156 | } |
1153 | void KOTodoView::cancelTodo() | 1157 | void KOTodoView::cancelTodo() |
1154 | { | 1158 | { |
1155 | if (mActiveItem) { | 1159 | if (mActiveItem) { |
1156 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 1160 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
1157 | } | 1161 | } |
1158 | } | 1162 | } |
1159 | void KOTodoView::moveTodo() | 1163 | void KOTodoView::moveTodo() |
1160 | { | 1164 | { |
1161 | if (mActiveItem) { | 1165 | if (mActiveItem) { |
1162 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 1166 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
1163 | } | 1167 | } |
1164 | } | 1168 | } |
1165 | void KOTodoView::beamTodo() | 1169 | void KOTodoView::beamTodo() |
1166 | { | 1170 | { |
1167 | if (mActiveItem) { | 1171 | if (mActiveItem) { |
1168 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 1172 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
1169 | } | 1173 | } |