summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-31 11:08:09 (UTC)
committer zautrix <zautrix>2005-10-31 11:08:09 (UTC)
commitf1b53f2c08c2ce384f663ae6f0a818104db8c53e (patch) (unidiff)
tree312764b7399d464483042e44b79577c8c7872c85
parentf8bb077d4016222ebd7a1cf3080010d5e5c65649 (diff)
downloadkdepimpi-f1b53f2c08c2ce384f663ae6f0a818104db8c53e.zip
kdepimpi-f1b53f2c08c2ce384f663ae6f0a818104db8c53e.tar.gz
kdepimpi-f1b53f2c08c2ce384f663ae6f0a818104db8c53e.tar.bz2
fixx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp47
-rw-r--r--korganizer/kotodoview.h1
2 files changed, 31 insertions, 17 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index d79a9b9..ba94057 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1248,229 +1248,234 @@ void KOTodoView::deleteTodo()
1248 emit deleteTodoSignal(mActiveItem->todo()); 1248 emit deleteTodoSignal(mActiveItem->todo());
1249 } 1249 }
1250} 1250}
1251 1251
1252void KOTodoView::setNewPriority(int index) 1252void KOTodoView::setNewPriority(int index)
1253{ 1253{
1254 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1254 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1255 mActiveItem->todo()->setPriority(mPriority[index]); 1255 mActiveItem->todo()->setPriority(mPriority[index]);
1256 mActiveItem->construct(); 1256 mActiveItem->construct();
1257 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 1257 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
1258 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1258 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1259 } 1259 }
1260 processSelectionChange(); 1260 processSelectionChange();
1261} 1261}
1262 1262
1263void KOTodoView::setNewPercentage(int index) 1263void KOTodoView::setNewPercentage(int index)
1264{ 1264{
1265 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1265 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1266 1266
1267 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { 1267 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
1268 mActiveItem->setOn( true ); 1268 mActiveItem->setOn( true );
1269 processSelectionChange(); 1269 processSelectionChange();
1270 return; 1270 return;
1271 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { 1271 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
1272 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); 1272 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
1273 if ( par && par->isOn() ) 1273 if ( par && par->isOn() )
1274 par->setOn( false ); 1274 par->setOn( false );
1275 } 1275 }
1276 if (mPercentage[index] == 100) { 1276 if (mPercentage[index] == 100) {
1277 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 1277 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
1278 } else { 1278 } else {
1279 mActiveItem->todo()->setCompleted(false); 1279 mActiveItem->todo()->setCompleted(false);
1280 } 1280 }
1281 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 1281 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
1282 mActiveItem->construct(); 1282 mActiveItem->construct();
1283 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 1283 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
1284 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1284 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1285 } 1285 }
1286 processSelectionChange(); 1286 processSelectionChange();
1287} 1287}
1288 1288
1289void KOTodoView::fillCategories () 1289void KOTodoView::fillCategories ()
1290{ 1290{
1291 mCategoryPopupMenu->clear(); 1291 mCategoryPopupMenu->clear();
1292 if ( ! mActiveItem ) return; 1292 if ( ! mActiveItem ) return;
1293 QStringList checkedCategories = mActiveItem->todo()->categories (); 1293 QStringList checkedCategories = mActiveItem->todo()->categories ();
1294 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 1294 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
1295 it != KOPrefs::instance()->mCustomCategories.end (); 1295 it != KOPrefs::instance()->mCustomCategories.end ();
1296 ++it) { 1296 ++it) {
1297 int index = mCategoryPopupMenu->insertItem (*it); 1297 int index = mCategoryPopupMenu->insertItem (*it);
1298 mCategory[index] = *it; 1298 mCategory[index] = *it;
1299 if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); 1299 if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true);
1300 } 1300 }
1301} 1301}
1302void KOTodoView::fillCal () 1302void KOTodoView::fillCal ()
1303{ 1303{
1304 mCalPopupMenu->clear(); 1304 mCalPopupMenu->clear();
1305 if (!mActiveItem) return; 1305 if (!mActiveItem) return;
1306 bool readO = mActiveItem->todo()->isReadOnly(); 1306 bool readO = mActiveItem->todo()->isReadOnly();
1307 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 1307 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
1308 while ( kkf ) { 1308 while ( kkf ) {
1309 int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); 1309 int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber);
1310 if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) 1310 if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO )
1311 mCalPopupMenu->setItemEnabled( index, false ); 1311 mCalPopupMenu->setItemEnabled( index, false );
1312 mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); 1312 mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID());
1313 kkf = KOPrefs::instance()->mCalendars.next(); 1313 kkf = KOPrefs::instance()->mCalendars.next();
1314 } 1314 }
1315} 1315}
1316void KOTodoView::changedCal (int index ) 1316void KOTodoView::changedCal (int index )
1317{ 1317{
1318 if (!mActiveItem) return; 1318 if (!mActiveItem) return;
1319 mActiveItem->todo()->setCalID( index ); 1319 mActiveItem->todo()->setCalID( index );
1320 mActiveItem->construct(); 1320 mActiveItem->construct();
1321} 1321}
1322void KOTodoView::changedCategories(int index) 1322void KOTodoView::changedCategories(int index)
1323{ 1323{
1324 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1324 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1325 QStringList categories = mActiveItem->todo()->categories (); 1325 QStringList categories = mActiveItem->todo()->categories ();
1326 QString colcat = categories.first(); 1326 QString colcat = categories.first();
1327 if (categories.find (mCategory[index]) != categories.end ()) 1327 if (categories.find (mCategory[index]) != categories.end ())
1328 categories.remove (mCategory[index]); 1328 categories.remove (mCategory[index]);
1329 else 1329 else
1330 categories.insert (categories.end(), mCategory[index]); 1330 categories.insert (categories.end(), mCategory[index]);
1331 categories.sort (); 1331 categories.sort ();
1332 if ( !colcat.isEmpty() ) { 1332 if ( !colcat.isEmpty() ) {
1333 if ( categories.find ( colcat ) != categories.end () ) { 1333 if ( categories.find ( colcat ) != categories.end () ) {
1334 categories.remove( colcat ); 1334 categories.remove( colcat );
1335 categories.prepend( colcat ); 1335 categories.prepend( colcat );
1336 } 1336 }
1337 } 1337 }
1338 mActiveItem->todo()->setCategories (categories); 1338 mActiveItem->todo()->setCategories (categories);
1339 mActiveItem->construct(); 1339 mActiveItem->construct();
1340 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1340 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1341 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1341 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1342 } 1342 }
1343} 1343}
1344void KOTodoView::toggleRunningItemQuick()
1345{
1346 if ( !mActiveItem ) return;
1347 Todo * t = mActiveItem->todo();
1348 if ( t->isRunning() ) {
1349 if ( t->runTime() < 15) {
1350 t->stopRunning();
1351 mActiveItem->construct();
1352 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!"));
1353 return;
1354 }
1355 else
1356 toggleRunningItem();
1357 return;
1358 } else {
1359 t->setRunning( true );
1360 mActiveItem->construct();
1361 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!"));
1362 }
1363}
1344void KOTodoView::itemDoubleClicked(QListViewItem *item) 1364void KOTodoView::itemDoubleClicked(QListViewItem *item)
1345{ 1365{
1346 if ( pendingSubtodo != 0 ) { 1366 if ( pendingSubtodo != 0 ) {
1347 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1367 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1348 } 1368 }
1349 pendingSubtodo = 0; 1369 pendingSubtodo = 0;
1350 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1370 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1351 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1371 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1352 //qDebug("ROW %d ", row); 1372 //qDebug("ROW %d ", row);
1353 if (!item) { 1373 if (!item) {
1354 newTodo(); 1374 newTodo();
1355 return; 1375 return;
1356 } else { 1376 } else {
1357 if ( row == 1 ) { 1377 if ( row == 1 ) {
1358 mActiveItem = (KOTodoViewItem *) item; 1378 mActiveItem = (KOTodoViewItem *) item;
1359 newSubTodo(); 1379 newSubTodo();
1360 return; 1380 return;
1361 } 1381 }
1362 if ( row == 5 || row == 6 || row == 2) { 1382 if ( row == 5 || row == 6 || row == 2) {
1363 mActiveItem = (KOTodoViewItem *) item; 1383 mActiveItem = (KOTodoViewItem *) item;
1364 Todo * t = mActiveItem->todo(); 1384 toggleRunningItemQuick();
1365 if ( t->isRunning() ) { 1385 return;
1366 if ( t->runTime() < 15) {
1367 t->stopRunning();
1368 mActiveItem->construct();
1369 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!"));
1370 return;
1371 }
1372 else
1373 toggleRunningItem();
1374 return;
1375 } else {
1376 t->setRunning( true );
1377 mActiveItem->construct();
1378 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!"));
1379 return;
1380 }
1381 } 1386 }
1382 } 1387 }
1383 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1388 if ( KOPrefs::instance()->mEditOnDoubleClick )
1384 editItem( item ); 1389 editItem( item );
1385 else 1390 else
1386 showItem( item , QPoint(), 0 ); 1391 showItem( item , QPoint(), 0 );
1387} 1392}
1388void KOTodoView::toggleRunningItem() 1393void KOTodoView::toggleRunningItem()
1389{ 1394{
1390 // qDebug("KOTodoView::toggleRunning() "); 1395 // qDebug("KOTodoView::toggleRunning() ");
1391 if ( ! mActiveItem ) 1396 if ( ! mActiveItem )
1392 return; 1397 return;
1393 Todo * t = mActiveItem->todo(); 1398 Todo * t = mActiveItem->todo();
1394 if ( t->isRunning() ) { 1399 if ( t->isRunning() ) {
1395 KOStopTodoPrefs tp ( t, this ); 1400 KOStopTodoPrefs tp ( t, this );
1396 if (QApplication::desktop()->width() <= 800 ){ 1401 if (QApplication::desktop()->width() <= 800 ){
1397 int wid = tp.width(); 1402 int wid = tp.width();
1398 int hei = tp.height(); 1403 int hei = tp.height();
1399 int xx = (QApplication::desktop()->width()-wid)/2; 1404 int xx = (QApplication::desktop()->width()-wid)/2;
1400 int yy = (QApplication::desktop()->height()-hei)/2; 1405 int yy = (QApplication::desktop()->height()-hei)/2;
1401 tp.setGeometry( xx,yy,wid,hei ); 1406 tp.setGeometry( xx,yy,wid,hei );
1402 } 1407 }
1403 tp.exec(); 1408 tp.exec();
1404 updateTodo ( t, KOGlobals::EVENTEDITED ); 1409 updateTodo ( t, KOGlobals::EVENTEDITED );
1405 } else { 1410 } else {
1406 KOStartTodoPrefs tp ( t->summary(), this ); 1411 KOStartTodoPrefs tp ( t->summary(), this );
1407 if (QApplication::desktop()->width() <= 800 ){ 1412 if (QApplication::desktop()->width() <= 800 ){
1408 int wid = tp.width(); 1413 int wid = tp.width();
1409 int hei = tp.height(); 1414 int hei = tp.height();
1410 int xx = (QApplication::desktop()->width()-wid)/2; 1415 int xx = (QApplication::desktop()->width()-wid)/2;
1411 int yy = (QApplication::desktop()->height()-hei)/2; 1416 int yy = (QApplication::desktop()->height()-hei)/2;
1412 tp.setGeometry( xx,yy,wid,hei ); 1417 tp.setGeometry( xx,yy,wid,hei );
1413 } 1418 }
1414 if ( !tp.exec() ) return; 1419 if ( !tp.exec() ) return;
1415 if ( tp.stopAll() ) { 1420 if ( tp.stopAll() ) {
1416 mCalendar->stopAllTodos(); 1421 mCalendar->stopAllTodos();
1417 t->setRunning( true ); 1422 t->setRunning( true );
1418 updateView(); 1423 updateView();
1419 } else { 1424 } else {
1420 t->setRunning( true ); 1425 t->setRunning( true );
1421 updateTodo ( t, KOGlobals::EVENTEDITED ); 1426 updateTodo ( t, KOGlobals::EVENTEDITED );
1422 } 1427 }
1423 } 1428 }
1424} 1429}
1425 1430
1426void KOTodoView::itemClicked(QListViewItem *item) 1431void KOTodoView::itemClicked(QListViewItem *item)
1427{ 1432{
1428 //qDebug("KOTodoView::itemClicked %d", item); 1433 //qDebug("KOTodoView::itemClicked %d", item);
1429 if (!item) { 1434 if (!item) {
1430 if ( pendingSubtodo != 0 ) { 1435 if ( pendingSubtodo != 0 ) {
1431 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1436 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1432 } 1437 }
1433 pendingSubtodo = 0; 1438 pendingSubtodo = 0;
1434 return; 1439 return;
1435 } 1440 }
1436 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1441 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1437 if ( pendingSubtodo != 0 ) { 1442 if ( pendingSubtodo != 0 ) {
1438 bool allowReparent = true; 1443 bool allowReparent = true;
1439 QListViewItem *par = item; 1444 QListViewItem *par = item;
1440 while ( par ) { 1445 while ( par ) {
1441 if ( par == pendingSubtodo ) { 1446 if ( par == pendingSubtodo ) {
1442 allowReparent = false; 1447 allowReparent = false;
1443 break; 1448 break;
1444 } 1449 }
1445 par = par->parent(); 1450 par = par->parent();
1446 } 1451 }
1447 if ( !allowReparent ) { 1452 if ( !allowReparent ) {
1448 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1453 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1449 pendingSubtodo = 0; 1454 pendingSubtodo = 0;
1450 } else { 1455 } else {
1451 Todo* newParent = todoItem->todo(); 1456 Todo* newParent = todoItem->todo();
1452 Todo* newSub = pendingSubtodo->todo(); 1457 Todo* newSub = pendingSubtodo->todo();
1453 pendingSubtodo = 0; 1458 pendingSubtodo = 0;
1454 emit reparentTodoSignal( newParent,newSub ); 1459 emit reparentTodoSignal( newParent,newSub );
1455 return; 1460 return;
1456 } 1461 }
1457 } 1462 }
1458 1463
1459} 1464}
1460 1465
1461void KOTodoView::setDocumentId( const QString &id ) 1466void KOTodoView::setDocumentId( const QString &id )
1462{ 1467{
1463 1468
1464 mDocPrefs->setDoc( id ); 1469 mDocPrefs->setDoc( id );
1465} 1470}
1466 1471
1467void KOTodoView::itemStateChanged( QListViewItem *item ) 1472void KOTodoView::itemStateChanged( QListViewItem *item )
1468{ 1473{
1469 if (!item) return; 1474 if (!item) return;
1470 1475
1471 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1476 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1472 1477
1473// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1478// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1474 1479
1475 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1480 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1476} 1481}
@@ -1615,152 +1620,160 @@ void KOTodoView::toggleCompleted()
1615{ 1620{
1616 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; 1621 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo;
1617 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 1622 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
1618 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 1623 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
1619 updateView(); 1624 updateView();
1620 if ( KOPrefs::instance()->mShowCompletedTodo ) 1625 if ( KOPrefs::instance()->mShowCompletedTodo )
1621 topLevelWidget()->setCaption(i18n("Show Completed")); 1626 topLevelWidget()->setCaption(i18n("Show Completed"));
1622 else 1627 else
1623 topLevelWidget()->setCaption(i18n("Hide Completed")); 1628 topLevelWidget()->setCaption(i18n("Hide Completed"));
1624} 1629}
1625 1630
1626void KOTodoView::addQuickTodo() 1631void KOTodoView::addQuickTodo()
1627{ 1632{
1628 addQuickTodoPar( 0 ); 1633 addQuickTodoPar( 0 );
1629} 1634}
1630void KOTodoView::addQuickTodoPar( Todo * parentTodo) 1635void KOTodoView::addQuickTodoPar( Todo * parentTodo)
1631{ 1636{
1632 Todo *todo = new Todo(); 1637 Todo *todo = new Todo();
1633 todo->setSummary(mQuickAdd->text()); 1638 todo->setSummary(mQuickAdd->text());
1634 todo->setOrganizer(KOPrefs::instance()->email()); 1639 todo->setOrganizer(KOPrefs::instance()->email());
1635 if ( parentTodo ) { 1640 if ( parentTodo ) {
1636 todo->setRelatedTo(parentTodo); 1641 todo->setRelatedTo(parentTodo);
1637 1642
1638 todo->setCategories (parentTodo->categoriesStr ()); 1643 todo->setCategories (parentTodo->categoriesStr ());
1639 todo->setSecrecy (parentTodo->secrecy ()); 1644 todo->setSecrecy (parentTodo->secrecy ());
1640 if ( parentTodo->priority() < 3 ) 1645 if ( parentTodo->priority() < 3 )
1641 todo->setPriority( parentTodo->priority() ); 1646 todo->setPriority( parentTodo->priority() );
1642 todo->setCalID( parentTodo->calID() ); 1647 todo->setCalID( parentTodo->calID() );
1643 } else { 1648 } else {
1644 CalFilter * cf = mCalendar->filter(); 1649 CalFilter * cf = mCalendar->filter();
1645 if ( cf ) { 1650 if ( cf ) {
1646 if ( cf->isEnabled()&& cf->showCategories()) { 1651 if ( cf->isEnabled()&& cf->showCategories()) {
1647 todo->setCategories(cf->categoryList()); 1652 todo->setCategories(cf->categoryList());
1648 } 1653 }
1649 if ( cf->isEnabled() ) 1654 if ( cf->isEnabled() )
1650 todo->setSecrecy( cf->getSecrecy()); 1655 todo->setSecrecy( cf->getSecrecy());
1651 } 1656 }
1652 } 1657 }
1653 mCalendar->addTodo(todo); 1658 mCalendar->addTodo(todo);
1654 mQuickAdd->setText(""); 1659 mQuickAdd->setText("");
1655 todoModified (todo, KOGlobals::EVENTADDED ); 1660 todoModified (todo, KOGlobals::EVENTADDED );
1656 updateView(); 1661 updateView();
1657 1662
1658} 1663}
1659void KOTodoView::keyPressEvent ( QKeyEvent * e ) 1664void KOTodoView::keyPressEvent ( QKeyEvent * e )
1660{ 1665{
1661 // e->ignore(); 1666 // e->ignore();
1662 //return; 1667 //return;
1663 if ( !isVisible() ) { 1668 if ( !isVisible() ) {
1664 e->ignore(); 1669 e->ignore();
1665 return; 1670 return;
1666 } 1671 }
1667 switch ( e->key() ) { 1672 switch ( e->key() ) {
1668 case Qt::Key_Down: 1673 case Qt::Key_Down:
1669 case Qt::Key_Up: 1674 case Qt::Key_Up:
1670 // KOrg::BaseView::keyPressEvent ( e ); 1675 // KOrg::BaseView::keyPressEvent ( e );
1671 e->ignore(); 1676 e->ignore();
1672 break; 1677 break;
1673 1678
1674 case Qt::Key_Q: 1679 case Qt::Key_Q:
1675 1680
1676 1681
1677 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) { 1682 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) {
1678 e->ignore(); 1683 e->ignore();
1679 break; 1684 break;
1680 } 1685 }
1681 toggleQuickTodo(); 1686 toggleQuickTodo();
1682 break; 1687 break;
1683 case Qt::Key_U: 1688 case Qt::Key_U:
1684 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1689 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1685 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1690 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1686 unparentTodo(); 1691 unparentTodo();
1687 e->accept(); 1692 e->accept();
1688 } else 1693 } else
1689 e->ignore(); 1694 e->ignore();
1690 break; 1695 break;
1691 case Qt::Key_S: 1696 case Qt::Key_S:
1692 if ( e->state() == Qt::ControlButton ) { 1697 if ( e->state() == Qt::ControlButton ) {
1693 e->ignore(); 1698 e->ignore();
1694 break; 1699 break;
1695 } 1700 }
1696 if ( e->state() == Qt::ShiftButton ) { 1701 if ( e->state() == Qt::ShiftButton ) {
1697 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1702 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1698 reparentTodo(); 1703 reparentTodo();
1699 e->accept(); 1704 e->accept();
1700 } else 1705 } else
1701 e->ignore(); 1706 e->ignore();
1702 break; 1707 break;
1703 case Qt::Key_P: 1708 case Qt::Key_P:
1704 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1709 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1705 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1710 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1706 if ( pendingSubtodo ) 1711 if ( pendingSubtodo )
1707 itemClicked(mActiveItem); 1712 itemClicked(mActiveItem);
1708 e->accept(); 1713 e->accept();
1709 } else 1714 } else
1710 e->ignore(); 1715 e->ignore();
1716 break;
1717 case Qt::Key_R:
1718 if (!( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) ) {
1719 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1720 toggleRunningItemQuick();
1721 e->accept();
1722 } else
1723 e->ignore();
1711 break; 1724 break;
1712 case Qt::Key_Escape: 1725 case Qt::Key_Escape:
1713 if ( pendingSubtodo ) { 1726 if ( pendingSubtodo ) {
1714 itemClicked(0); 1727 itemClicked(0);
1715 e->accept(); 1728 e->accept();
1716 } else 1729 } else
1717 e->ignore(); 1730 e->ignore();
1718 break; 1731 break;
1719 default: 1732 default:
1720 e->ignore(); 1733 e->ignore();
1721 } 1734 }
1722 1735
1723 if ( true ) { 1736 if ( true ) {
1724 if ( e->key() == Qt::Key_I ) { 1737 if ( e->key() == Qt::Key_I ) {
1725 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); 1738 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem();
1726 if ( cn ) { 1739 if ( cn ) {
1727 mActiveItem = cn; 1740 mActiveItem = cn;
1728 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 1741 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
1729 if ( ci ){ 1742 if ( ci ){
1730 showTodo(); 1743 showTodo();
1731 cn = (KOTodoViewItem*)cn->itemBelow(); 1744 cn = (KOTodoViewItem*)cn->itemBelow();
1732 if ( cn ) { 1745 if ( cn ) {
1733 mTodoListView->setCurrentItem ( cn ); 1746 mTodoListView->setCurrentItem ( cn );
1734 mTodoListView->ensureItemVisible ( cn ); 1747 mTodoListView->ensureItemVisible ( cn );
1735 } 1748 }
1736 1749
1737 } 1750 }
1738 } 1751 }
1739 e->accept(); 1752 e->accept();
1740 } 1753 }
1741 } 1754 }
1742} 1755}
1743 1756
1744void KOTodoView::updateTodo( Todo * t, int type ) 1757void KOTodoView::updateTodo( Todo * t, int type )
1745{ 1758{
1746 if ( mBlockUpdate ) 1759 if ( mBlockUpdate )
1747 return; 1760 return;
1748 1761
1749 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 1762 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
1750 itemIterator = mTodoMap.find(t); 1763 itemIterator = mTodoMap.find(t);
1751 if (itemIterator != mTodoMap.end()) { 1764 if (itemIterator != mTodoMap.end()) {
1752 (*itemIterator)->construct(); 1765 (*itemIterator)->construct();
1753 } else { 1766 } else {
1754 if ( type == KOGlobals::EVENTADDED ) { 1767 if ( type == KOGlobals::EVENTADDED ) {
1755 insertTodoItem( t ); 1768 insertTodoItem( t );
1756 } 1769 }
1757 } 1770 }
1758 1771
1759} 1772}
1760 1773
1761void KOTodoView::todoModified(Todo * t , int p ) 1774void KOTodoView::todoModified(Todo * t , int p )
1762{ 1775{
1763 mBlockUpdate = true; 1776 mBlockUpdate = true;
1764 emit todoModifiedSignal ( t, p ); 1777 emit todoModifiedSignal ( t, p );
1765 mBlockUpdate = false; 1778 mBlockUpdate = false;
1766} 1779}
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 161ecb0..0cbc087 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -155,156 +155,157 @@ class KOTodoView : public KOrg::BaseView
155 Q_OBJECT 155 Q_OBJECT
156 public: 156 public:
157 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 157 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
158 ~KOTodoView(); 158 ~KOTodoView();
159 159
160 QPtrList<Incidence> selectedIncidences(); 160 QPtrList<Incidence> selectedIncidences();
161 QPtrList<Todo> selectedTodos(); 161 QPtrList<Todo> selectedTodos();
162 162
163 DateList selectedDates() 163 DateList selectedDates()
164 {DateList q; 164 {DateList q;
165 return q;} 165 return q;}
166 166
167 /** Return number of shown dates. TodoView does not show dates, */ 167 /** Return number of shown dates. TodoView does not show dates, */
168 int currentDateCount() { return 0; } 168 int currentDateCount() { return 0; }
169 169
170 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 170 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
171 171
172 void setDocumentId( const QString & ); 172 void setDocumentId( const QString & );
173 173
174 void saveLayout(KConfig *config, const QString &group) const; 174 void saveLayout(KConfig *config, const QString &group) const;
175 void restoreLayout(KConfig *config, const QString &group); 175 void restoreLayout(KConfig *config, const QString &group);
176 void setNavigator( DateNavigator* nav ) {mNavigator = nav;} 176 void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
177 QString getWhatsThisText(QPoint p); 177 QString getWhatsThisText(QPoint p);
178 void clearList( bool saveCurrentItem = true ); 178 void clearList( bool saveCurrentItem = true );
179 179
180 public slots: 180 public slots:
181 void updateView(); 181 void updateView();
182 void updateConfig(); 182 void updateConfig();
183 183
184 void changeEventDisplay(Event *, int); 184 void changeEventDisplay(Event *, int);
185 185
186 void showDates(const QDate &start, const QDate &end); 186 void showDates(const QDate &start, const QDate &end);
187 void showEvents(QPtrList<Event> eventList); 187 void showEvents(QPtrList<Event> eventList);
188 188
189 void clearSelection(); 189 void clearSelection();
190 void jumpToDate (); 190 void jumpToDate ();
191 191
192 void editItem(QListViewItem *item); 192 void editItem(QListViewItem *item);
193 void showItem(QListViewItem *item,const QPoint &,int); 193 void showItem(QListViewItem *item,const QPoint &,int);
194 void popupMenu(QListViewItem *item,const QPoint &,int); 194 void popupMenu(QListViewItem *item,const QPoint &,int);
195 void newTodo(); 195 void newTodo();
196 void newSubTodo(); 196 void newSubTodo();
197 void unparentTodo(); 197 void unparentTodo();
198 void reparentTodo(); 198 void reparentTodo();
199 void showTodo(); 199 void showTodo();
200 void editTodo(); 200 void editTodo();
201 void cloneTodo(); 201 void cloneTodo();
202 void cancelTodo(); 202 void cancelTodo();
203 void moveTodo(); 203 void moveTodo();
204 void beamTodo(); 204 void beamTodo();
205 void deleteTodo(); 205 void deleteTodo();
206 206
207 void setNewPriority(int); 207 void setNewPriority(int);
208 void setNewPercentage(int); 208 void setNewPercentage(int);
209 void changedCategories(int); 209 void changedCategories(int);
210 210
211 void setAllOpen(); 211 void setAllOpen();
212 void setAllClose(); 212 void setAllClose();
213 void setAllFlat(); 213 void setAllFlat();
214 void displayAllFlat(); 214 void displayAllFlat();
215 215
216 void purgeCompleted(); 216 void purgeCompleted();
217 void toggleCompleted(); 217 void toggleCompleted();
218 void toggleRunning(); 218 void toggleRunning();
219 void toggleQuickTodo(); 219 void toggleQuickTodo();
220 void updateTodo( Todo *, int ); 220 void updateTodo( Todo *, int );
221 221
222 void itemClicked(QListViewItem *); 222 void itemClicked(QListViewItem *);
223 void itemStateChanged(QListViewItem *); 223 void itemStateChanged(QListViewItem *);
224 void modified(bool); 224 void modified(bool);
225 void itemDoubleClicked(QListViewItem *item); 225 void itemDoubleClicked(QListViewItem *item);
226 void resetFocusToList(); 226 void resetFocusToList();
227 void fillCategories (); 227 void fillCategories ();
228 void fillCal (); 228 void fillCal ();
229 void changedCal (int); 229 void changedCal (int);
230 230
231 signals: 231 signals:
232 void newTodoSignal(); 232 void newTodoSignal();
233 void newSubTodoSignal(Todo *); 233 void newSubTodoSignal(Todo *);
234 void unparentTodoSignal(Todo *); 234 void unparentTodoSignal(Todo *);
235 void reparentTodoSignal( Todo *,Todo * ); 235 void reparentTodoSignal( Todo *,Todo * );
236 void showTodoSignal(Todo *); 236 void showTodoSignal(Todo *);
237 237
238 void editTodoSignal(Todo *); 238 void editTodoSignal(Todo *);
239 void deleteTodoSignal(Todo *); 239 void deleteTodoSignal(Todo *);
240 void todoModifiedSignal (Todo *, int); 240 void todoModifiedSignal (Todo *, int);
241 241
242 void isModified(bool); 242 void isModified(bool);
243 void cloneTodoSignal( Incidence * ); 243 void cloneTodoSignal( Incidence * );
244 void cancelTodoSignal( Incidence * ); 244 void cancelTodoSignal( Incidence * );
245 void moveTodoSignal( Incidence * ); 245 void moveTodoSignal( Incidence * );
246 void beamTodoSignal( Incidence * ); 246 void beamTodoSignal( Incidence * );
247 void purgeCompletedSignal(); 247 void purgeCompletedSignal();
248 248
249 protected slots: 249 protected slots:
250 void toggleRunningItem(); 250 void toggleRunningItem();
251 void toggleRunningItemQuick();
251 void paintNeeded(); 252 void paintNeeded();
252 void processSelectionChange(); 253 void processSelectionChange();
253 void addQuickTodo(); 254 void addQuickTodo();
254 void setTodoModified( Todo* ); 255 void setTodoModified( Todo* );
255 void todoModified(Todo *, int ); 256 void todoModified(Todo *, int );
256 257
257 private: 258 private:
258 bool mIsActiveWindow; 259 bool mIsActiveWindow;
259 void addQuickTodoPar( Todo * parentTodo); 260 void addQuickTodoPar( Todo * parentTodo);
260 /* 261 /*
261 * the TodoEditor approach is rather unscaling in the long 262 * the TodoEditor approach is rather unscaling in the long
262 * run. 263 * run.
263 * Korganizer keeps it in memory and we need to update 264 * Korganizer keeps it in memory and we need to update
264 * 1. make KOTodoViewItem a QObject again? 265 * 1. make KOTodoViewItem a QObject again?
265 * 2. add a public method for setting one todo modified? 266 * 2. add a public method for setting one todo modified?
266 * 3. add a private method for setting a todo modified + friend here? 267 * 3. add a private method for setting a todo modified + friend here?
267 * -- zecke 2002-07-08 268 * -- zecke 2002-07-08
268 */ 269 */
269 KOTodoViewWhatsThis* mKOTodoViewWhatsThis; 270 KOTodoViewWhatsThis* mKOTodoViewWhatsThis;
270 friend class KOTodoListView; 271 friend class KOTodoListView;
271 void paintEvent(QPaintEvent * pevent); 272 void paintEvent(QPaintEvent * pevent);
272 bool mPendingUpdateBeforeRepaint; 273 bool mPendingUpdateBeforeRepaint;
273 friend class KOTodoViewItem; 274 friend class KOTodoViewItem;
274 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 275 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
275 void restoreItemState( QListViewItem * ); 276 void restoreItemState( QListViewItem * );
276 277
277 bool checkTodo( Todo * ); 278 bool checkTodo( Todo * );
278 bool isFlatDisplay; 279 bool isFlatDisplay;
279 void setOpen( QListViewItem*, bool setOpen); 280 void setOpen( QListViewItem*, bool setOpen);
280 KOTodoListView *mTodoListView; 281 KOTodoListView *mTodoListView;
281 QPopupMenu *mItemPopupMenu; 282 QPopupMenu *mItemPopupMenu;
282 QPopupMenu *mPopupMenu; 283 QPopupMenu *mPopupMenu;
283 QPopupMenu *mPriorityPopupMenu; 284 QPopupMenu *mPriorityPopupMenu;
284 QPopupMenu *mPercentageCompletedPopupMenu; 285 QPopupMenu *mPercentageCompletedPopupMenu;
285 QPopupMenu *mCategoryPopupMenu; 286 QPopupMenu *mCategoryPopupMenu;
286 QPopupMenu *mCalPopupMenu; 287 QPopupMenu *mCalPopupMenu;
287 288
288 QMap<int, int> mPercentage; 289 QMap<int, int> mPercentage;
289 QMap<int, int> mPriority; 290 QMap<int, int> mPriority;
290 QMap<int, QString> mCategory; 291 QMap<int, QString> mCategory;
291 KOTodoViewItem *mActiveItem; 292 KOTodoViewItem *mActiveItem;
292 293
293 QMap<Todo *,KOTodoViewItem *> mTodoMap; 294 QMap<Todo *,KOTodoViewItem *> mTodoMap;
294 QString mName; 295 QString mName;
295 QWidget* mQuickBar; 296 QWidget* mQuickBar;
296 297
297 DocPrefs *mDocPrefs; 298 DocPrefs *mDocPrefs;
298 QString mCurrentDoc; 299 QString mCurrentDoc;
299 KOQuickTodo *mQuickAdd; 300 KOQuickTodo *mQuickAdd;
300 bool mBlockUpdate; 301 bool mBlockUpdate;
301 void keyPressEvent ( QKeyEvent * ) ; 302 void keyPressEvent ( QKeyEvent * ) ;
302 KOTodoViewItem * pendingSubtodo; 303 KOTodoViewItem * pendingSubtodo;
303 DateNavigator* mNavigator; 304 DateNavigator* mNavigator;
304 void storeCurrentItem(); 305 void storeCurrentItem();
305 void resetCurrentItem(); 306 void resetCurrentItem();
306 Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove; 307 Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove;
307 QPushButton * mNewSubBut; 308 QPushButton * mNewSubBut;
308}; 309};
309 310
310#endif 311#endif