author | zautrix <zautrix> | 2005-07-06 21:11:20 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-06 21:11:20 (UTC) |
commit | e1731d8790403a079613f291b4ac172d8f04c960 (patch) (unidiff) | |
tree | 75b13b2235fb6045b5c4b29f3d65d761c46ff746 /korganizer/kotodoview.cpp | |
parent | 984e2132871c79990f6d9eac5702f7f32186f235 (diff) | |
download | kdepimpi-e1731d8790403a079613f291b4ac172d8f04c960.zip kdepimpi-e1731d8790403a079613f291b4ac172d8f04c960.tar.gz kdepimpi-e1731d8790403a079613f291b4ac172d8f04c960.tar.bz2 |
fixes
-rw-r--r-- | korganizer/kotodoview.cpp | 78 |
1 files changed, 70 insertions, 8 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index a87e6fc..c23a8ee 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -505,8 +505,42 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
505 | mName = QString ( name ); | 505 | mName = QString ( name ); |
506 | mBlockUpdate = false; | 506 | mBlockUpdate = false; |
507 | mQuickAdd = new KOQuickTodo(this); | 507 | mQuickBar = new QWidget( this ); |
508 | topLayout->addWidget(mQuickAdd); | 508 | topLayout->addWidget(mQuickBar); |
509 | 509 | ||
510 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 510 | mQuickAdd = new KOQuickTodo(mQuickBar); |
511 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); | ||
512 | quickLayout->addWidget( mQuickAdd ); | ||
513 | QPushButton * flat = new QPushButton( "F",mQuickBar ); | ||
514 | int fixwid = flat->sizeHint().height(); | ||
515 | if ( QApplication::desktop()->width() > 320 ) | ||
516 | fixwid *= 2; | ||
517 | flat->setFixedWidth( fixwid ); | ||
518 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); | ||
519 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); | ||
520 | allopen->setFixedWidth( fixwid ); | ||
521 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); | ||
522 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); | ||
523 | allclose->setFixedWidth( fixwid ); | ||
524 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); | ||
525 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); | ||
526 | s_done->setFixedWidth( fixwid ); | ||
527 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); | ||
528 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); | ||
529 | s_run->setFixedWidth( fixwid ); | ||
530 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); | ||
531 | |||
532 | mNewSubBut = new QPushButton( "sub",mQuickBar ); | ||
533 | mNewSubBut->setFixedWidth( fixwid*3/2 ); | ||
534 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); | ||
535 | mNewSubBut->setEnabled( false ); | ||
536 | quickLayout->addWidget( mNewSubBut ); | ||
537 | quickLayout->addWidget( s_done ); | ||
538 | quickLayout->addWidget( s_run ); | ||
539 | |||
540 | quickLayout->addWidget( allopen ); | ||
541 | quickLayout->addWidget( allclose ); | ||
542 | quickLayout->addWidget( flat ); | ||
543 | |||
544 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); | ||
511 | 545 | ||
512 | mTodoListView = new KOTodoListView(calendar,this, name ); | 546 | mTodoListView = new KOTodoListView(calendar,this, name ); |
@@ -1083,5 +1117,9 @@ void KOTodoView::newTodo() | |||
1083 | void KOTodoView::newSubTodo() | 1117 | void KOTodoView::newSubTodo() |
1084 | { | 1118 | { |
1119 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | ||
1085 | if (mActiveItem) { | 1120 | if (mActiveItem) { |
1121 | if ( mQuickAdd->isVisible() && !mQuickAdd->text().isEmpty() && mQuickAdd->text() != i18n("Click to add a new Todo") ) { | ||
1122 | addQuickTodoPar( mActiveItem->todo()); | ||
1123 | } else | ||
1086 | emit newSubTodoSignal(mActiveItem->todo()); | 1124 | emit newSubTodoSignal(mActiveItem->todo()); |
1087 | } | 1125 | } |
@@ -1392,6 +1430,8 @@ void KOTodoView::processSelectionChange() | |||
1392 | if ( !item ) { | 1430 | if ( !item ) { |
1393 | emit incidenceSelected( 0 ); | 1431 | emit incidenceSelected( 0 ); |
1432 | mNewSubBut->setEnabled( false ); | ||
1394 | } else { | 1433 | } else { |
1395 | emit incidenceSelected( item->todo() ); | 1434 | emit incidenceSelected( item->todo() ); |
1435 | mNewSubBut->setEnabled( true ); | ||
1396 | } | 1436 | } |
1397 | } | 1437 | } |
@@ -1481,10 +1521,10 @@ void KOTodoView::purgeCompleted() | |||
1481 | void KOTodoView::toggleQuickTodo() | 1521 | void KOTodoView::toggleQuickTodo() |
1482 | { | 1522 | { |
1483 | if ( mQuickAdd->isVisible() ) { | 1523 | if ( mQuickBar->isVisible() ) { |
1484 | mQuickAdd->hide(); | 1524 | mQuickBar->hide(); |
1485 | KOPrefs::instance()->mEnableQuickTodo = false; | 1525 | KOPrefs::instance()->mEnableQuickTodo = false; |
1486 | } | 1526 | } |
1487 | else { | 1527 | else { |
1488 | mQuickAdd->show(); | 1528 | mQuickBar->show(); |
1489 | KOPrefs::instance()->mEnableQuickTodo = true; | 1529 | KOPrefs::instance()->mEnableQuickTodo = true; |
1490 | } | 1530 | } |
@@ -1499,4 +1539,8 @@ void KOTodoView::toggleRunning() | |||
1499 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1539 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1500 | updateView(); | 1540 | updateView(); |
1541 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | ||
1542 | topLevelWidget()->setCaption(i18n("Hide not Running")); | ||
1543 | else | ||
1544 | topLevelWidget()->setCaption(i18n("Show not Running")); | ||
1501 | } | 1545 | } |
1502 | 1546 | ||
@@ -1507,11 +1551,28 @@ void KOTodoView::toggleCompleted() | |||
1507 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1551 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1508 | updateView(); | 1552 | updateView(); |
1553 | if ( KOPrefs::instance()->mShowCompletedTodo ) | ||
1554 | topLevelWidget()->setCaption(i18n("Show Completed")); | ||
1555 | else | ||
1556 | topLevelWidget()->setCaption(i18n("Hide Completed")); | ||
1509 | } | 1557 | } |
1510 | 1558 | ||
1511 | void KOTodoView::addQuickTodo() | 1559 | void KOTodoView::addQuickTodo() |
1512 | { | 1560 | { |
1561 | addQuickTodoPar( 0 ); | ||
1562 | } | ||
1563 | void KOTodoView::addQuickTodoPar( Todo * parentTodo) | ||
1564 | { | ||
1513 | Todo *todo = new Todo(); | 1565 | Todo *todo = new Todo(); |
1514 | todo->setSummary(mQuickAdd->text()); | 1566 | todo->setSummary(mQuickAdd->text()); |
1515 | todo->setOrganizer(KOPrefs::instance()->email()); | 1567 | todo->setOrganizer(KOPrefs::instance()->email()); |
1568 | if ( parentTodo ) { | ||
1569 | todo->setRelatedTo(parentTodo); | ||
1570 | |||
1571 | todo->setCategories (parentTodo->categoriesStr ()); | ||
1572 | todo->setSecrecy (parentTodo->secrecy ()); | ||
1573 | if ( parentTodo->priority() < 3 ) | ||
1574 | todo->setPriority( parentTodo->priority() ); | ||
1575 | todo->setCalID( parentTodo->calID() ); | ||
1576 | } else { | ||
1516 | CalFilter * cf = mCalendar->filter(); | 1577 | CalFilter * cf = mCalendar->filter(); |
1517 | if ( cf ) { | 1578 | if ( cf ) { |
@@ -1522,10 +1583,11 @@ void KOTodoView::addQuickTodo() | |||
1522 | todo->setSecrecy( cf->getSecrecy()); | 1583 | todo->setSecrecy( cf->getSecrecy()); |
1523 | } | 1584 | } |
1585 | } | ||
1524 | mCalendar->addTodo(todo); | 1586 | mCalendar->addTodo(todo); |
1525 | mQuickAdd->setText(""); | 1587 | mQuickAdd->setText(""); |
1526 | todoModified (todo, KOGlobals::EVENTADDED ); | 1588 | todoModified (todo, KOGlobals::EVENTADDED ); |
1527 | updateView(); | 1589 | updateView(); |
1528 | } | ||
1529 | 1590 | ||
1591 | } | ||
1530 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1592 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1531 | { | 1593 | { |