author | zecke <zecke> | 2004-11-18 21:55:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-11-18 21:55:17 (UTC) |
commit | fdef8103e849b674c95d01785259e072bcfb5a4b (patch) (unidiff) | |
tree | 411432edf236f8858094598617383dea95c14c3a | |
parent | c94afa23120bb72709973ae4711106e6e502fe65 (diff) | |
download | opie-fdef8103e849b674c95d01785259e072bcfb5a4b.zip opie-fdef8103e849b674c95d01785259e072bcfb5a4b.tar.gz opie-fdef8103e849b674c95d01785259e072bcfb5a4b.tar.bz2 |
-Kill owarn statements from the code
-Kill magic numbers and use enum values
-rw-r--r-- | core/pim/todo/main.cpp | 1 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 16 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 32 | ||||
-rw-r--r-- | core/pim/todo/todomanager.cpp | 7 |
4 files changed, 22 insertions, 34 deletions
diff --git a/core/pim/todo/main.cpp b/core/pim/todo/main.cpp index d070ff8..a336ba3 100644 --- a/core/pim/todo/main.cpp +++ b/core/pim/todo/main.cpp | |||
@@ -24,25 +24,24 @@ | |||
24 | 24 | ||
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | 26 | ||
27 | void myMessages( QtMsgType, const char* ) { | 27 | void myMessages( QtMsgType, const char* ) { |
28 | 28 | ||
29 | } | 29 | } |
30 | 30 | ||
31 | int main( int argc, char **argv ) | 31 | int main( int argc, char **argv ) |
32 | { | 32 | { |
33 | qInstallMsgHandler( myMessages ); | 33 | qInstallMsgHandler( myMessages ); |
34 | QPEApplication a( argc, argv ); | 34 | QPEApplication a( argc, argv ); |
35 | 35 | ||
36 | QTime time; | 36 | QTime time; |
37 | time.start(); | 37 | time.start(); |
38 | Todo::MainWindow mw; | 38 | Todo::MainWindow mw; |
39 | int t = time.elapsed(); | 39 | int t = time.elapsed(); |
40 | Opie::Core::owarn << "QTime " << t/1000 << oendl; | ||
41 | mw.setCaption( QObject::tr("Opie Todolist")); | 40 | mw.setCaption( QObject::tr("Opie Todolist")); |
42 | QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) ); | 41 | QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) ); |
43 | QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) ); | 42 | QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) ); |
44 | 43 | ||
45 | a.showMainWidget(&mw); | 44 | a.showMainWidget(&mw); |
46 | 45 | ||
47 | return a.exec(); | 46 | return a.exec(); |
48 | } | 47 | } |
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 2002e87..9424c23 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -283,59 +283,56 @@ QPopupMenu* MainWindow::contextMenu( int , bool recur ) { | |||
283 | m_duplicateAction->addTo( menu ); | 283 | m_duplicateAction->addTo( menu ); |
284 | 284 | ||
285 | menu->insertSeparator(); | 285 | menu->insertSeparator(); |
286 | 286 | ||
287 | /* | 287 | /* |
288 | * if this event recurs we allow | 288 | * if this event recurs we allow |
289 | * to detach it. | 289 | * to detach it. |
290 | * remove all | 290 | * remove all |
291 | */ | 291 | */ |
292 | if ( recur ) { | 292 | if ( recur ) { |
293 | ; // FIXME | 293 | ; // FIXME |
294 | } | 294 | } |
295 | 295 | ||
296 | return menu; | 296 | return menu; |
297 | } | 297 | } |
298 | QPopupMenu* MainWindow::options() { | 298 | QPopupMenu* MainWindow::options() { |
299 | owarn << "Options" << oendl; | ||
300 | return m_options; | 299 | return m_options; |
301 | } | 300 | } |
302 | QPopupMenu* MainWindow::edit() { | 301 | QPopupMenu* MainWindow::edit() { |
303 | return m_edit; | 302 | return m_edit; |
304 | } | 303 | } |
305 | QToolBar* MainWindow::toolbar() { | 304 | QToolBar* MainWindow::toolbar() { |
306 | return m_tool; | 305 | return m_tool; |
307 | } | 306 | } |
308 | OPimTodoAccess::List MainWindow::list()const { | 307 | OPimTodoAccess::List MainWindow::list()const { |
309 | return m_todoMgr.list(); | 308 | return m_todoMgr.list(); |
310 | } | 309 | } |
311 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { | 310 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { |
312 | int cat = 0; | 311 | int cat = 0; |
313 | if ( m_curCat != QWidget::tr("All Categories") ) | 312 | if ( m_curCat != QWidget::tr("All Categories") ) |
314 | cat = currentCatId(); | 313 | cat = currentCatId(); |
315 | if ( m_curCat == QWidget::tr("Unfiled") ) | 314 | if ( m_curCat == QWidget::tr("Unfiled") ) |
316 | cat = -1; | 315 | cat = -1; |
317 | 316 | ||
318 | owarn << " Category " << cat << " " << m_curCat << oendl; | 317 | int filter = OPimTodoAccess::FilterCategory; |
319 | |||
320 | int filter = 1; | ||
321 | 318 | ||
322 | if (!m_completed ) | 319 | if (!m_completed ) |
323 | filter |= 4; | 320 | filter |= OPimTodoAccess::DoNotShowCompleted; |
324 | if (m_overdue) | 321 | if (m_overdue) |
325 | filter |= 2; | 322 | filter |= OPimTodoAccess::OnlyOverDue; |
326 | 323 | ||
327 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); | 324 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); |
328 | } | 325 | } |
329 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { | 326 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { |
330 | int cat = 0; | 327 | int cat = 0; |
331 | if ( m_curCat != QWidget::tr("All Categories") ) | 328 | if ( m_curCat != QWidget::tr("All Categories") ) |
332 | cat = currentCatId(); | 329 | cat = currentCatId(); |
333 | 330 | ||
334 | if ( m_curCat == QWidget::tr("Unfiled") ) | 331 | if ( m_curCat == QWidget::tr("Unfiled") ) |
335 | cat = -1; | 332 | cat = -1; |
336 | 333 | ||
337 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); | 334 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); |
338 | } | 335 | } |
339 | OPimTodo MainWindow::event( int uid ) { | 336 | OPimTodo MainWindow::event( int uid ) { |
340 | return m_todoMgr.event( uid ); | 337 | return m_todoMgr.event( uid ); |
341 | } | 338 | } |
@@ -361,33 +358,32 @@ void MainWindow::closeEvent( QCloseEvent* e ) { | |||
361 | if (m_stack->visibleWidget() == currentShow()->widget() ) { | 358 | if (m_stack->visibleWidget() == currentShow()->widget() ) { |
362 | m_showing = false; | 359 | m_showing = false; |
363 | raiseCurrentView(); | 360 | raiseCurrentView(); |
364 | e->ignore(); | 361 | e->ignore(); |
365 | return; | 362 | return; |
366 | } | 363 | } |
367 | /* | 364 | /* |
368 | * we should have flushed and now we're still saving | 365 | * we should have flushed and now we're still saving |
369 | * so there is no need to flush | 366 | * so there is no need to flush |
370 | */ | 367 | */ |
371 | if (m_syncing ) { | 368 | if (m_syncing ) { |
372 | e->accept(); | 369 | e->accept(); |
373 | return; | 370 | return; |
374 | } | 371 | } |
375 | bool quit = false; | 372 | bool quit = false; |
376 | if ( m_todoMgr.saveAll() ){ | 373 | if ( m_todoMgr.saveAll() ){ |
377 | owarn << "saved" << oendl; | ||
378 | quit = true; | 374 | quit = true; |
379 | }else { | 375 | }else { |
380 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), | 376 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), |
381 | QWidget::tr("Todo was unable\n" | 377 | QWidget::tr("Todo was unable\n" |
382 | "to save your changes.\n" | 378 | "to save your changes.\n" |
383 | "Free up some space\n" | 379 | "Free up some space\n" |
384 | "and try again.\n" | 380 | "and try again.\n" |
385 | "\nQuit Anyway?"), | 381 | "\nQuit Anyway?"), |
386 | QMessageBox::Yes|QMessageBox::Escape, | 382 | QMessageBox::Yes|QMessageBox::Escape, |
387 | QMessageBox::No|QMessageBox::Default) | 383 | QMessageBox::No|QMessageBox::Default) |
388 | != QMessageBox::No ) { | 384 | != QMessageBox::No ) { |
389 | e->accept(); | 385 | e->accept(); |
390 | quit = true; | 386 | quit = true; |
391 | }else | 387 | }else |
392 | e->ignore(); | 388 | e->ignore(); |
393 | 389 | ||
@@ -524,33 +520,32 @@ void MainWindow::slotDeleteCompleted() { | |||
524 | m_todoMgr.removeCompleted(); | 520 | m_todoMgr.removeCompleted(); |
525 | currentView()->updateView( ); | 521 | currentView()->updateView( ); |
526 | } | 522 | } |
527 | void MainWindow::slotFind() { | 523 | void MainWindow::slotFind() { |
528 | 524 | ||
529 | } | 525 | } |
530 | void MainWindow::slotEdit() { | 526 | void MainWindow::slotEdit() { |
531 | slotEdit( currentView()->current() ); | 527 | slotEdit( currentView()->current() ); |
532 | } | 528 | } |
533 | /* | 529 | /* |
534 | * set the category | 530 | * set the category |
535 | */ | 531 | */ |
536 | void MainWindow::setCategory( int c) { | 532 | void MainWindow::setCategory( int c) { |
537 | if ( c <= 0 ) return; | 533 | if ( c <= 0 ) return; |
538 | 534 | ||
539 | 535 | ||
540 | owarn << "Iterating over cats " << c << oendl; | ||
541 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) | 536 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) |
542 | m_catMenu->setItemChecked(i, c == (int)i ); | 537 | m_catMenu->setItemChecked(i, c == (int)i ); |
543 | 538 | ||
544 | if (c == 1 ) { | 539 | if (c == 1 ) { |
545 | m_curCat = QString::null; | 540 | m_curCat = QString::null; |
546 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); | 541 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); |
547 | 542 | ||
548 | }else if ( c == (int)m_catMenu->count() - 1 ) { | 543 | }else if ( c == (int)m_catMenu->count() - 1 ) { |
549 | m_curCat = QWidget::tr("Unfiled"); | 544 | m_curCat = QWidget::tr("Unfiled"); |
550 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); | 545 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); |
551 | }else { | 546 | }else { |
552 | m_curCat = m_todoMgr.categories()[c-2]; | 547 | m_curCat = m_todoMgr.categories()[c-2]; |
553 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); | 548 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); |
554 | } | 549 | } |
555 | m_catMenu->setItemChecked( c, true ); | 550 | m_catMenu->setItemChecked( c, true ); |
556 | 551 | ||
@@ -670,33 +665,32 @@ void MainWindow::raiseCurrentView() { | |||
670 | // we would show the otodo but then imediately switch to the currentView | 665 | // we would show the otodo but then imediately switch to the currentView |
671 | // if we're initially showing we shouldn't raise the table | 666 | // if we're initially showing we shouldn't raise the table |
672 | // in returnFromView we fix up m_showing | 667 | // in returnFromView we fix up m_showing |
673 | if (m_showing ) return; | 668 | if (m_showing ) return; |
674 | 669 | ||
675 | m_stack->raiseWidget( m_curView->widget() ); | 670 | m_stack->raiseWidget( m_curView->widget() ); |
676 | } | 671 | } |
677 | void MainWindow::slotShowDue(bool ov) { | 672 | void MainWindow::slotShowDue(bool ov) { |
678 | m_overdue = ov; | 673 | m_overdue = ov; |
679 | currentView()->showOverDue( ov ); | 674 | currentView()->showOverDue( ov ); |
680 | raiseCurrentView(); | 675 | raiseCurrentView(); |
681 | } | 676 | } |
682 | void MainWindow::slotShow( int uid ) { | 677 | void MainWindow::slotShow( int uid ) { |
683 | if ( uid == 0 ) return; | 678 | if ( uid == 0 ) return; |
684 | 679 | ||
685 | 680 | ||
686 | owarn << "slotShow" << oendl; | ||
687 | currentShow()->slotShow( event( uid ) ); | 681 | currentShow()->slotShow( event( uid ) ); |
688 | m_stack->raiseWidget( currentShow()->widget() ); | 682 | m_stack->raiseWidget( currentShow()->widget() ); |
689 | } | 683 | } |
690 | void MainWindow::slotShowNext() { | 684 | void MainWindow::slotShowNext() { |
691 | int l = currentView()->next(); | 685 | int l = currentView()->next(); |
692 | if (l!=0) | 686 | if (l!=0) |
693 | slotShow(l); | 687 | slotShow(l); |
694 | } | 688 | } |
695 | void MainWindow::slotShowPrev() { | 689 | void MainWindow::slotShowPrev() { |
696 | int l = currentView()->prev(); | 690 | int l = currentView()->prev(); |
697 | if (l!=0) | 691 | if (l!=0) |
698 | slotShow(l); | 692 | slotShow(l); |
699 | } | 693 | } |
700 | void MainWindow::slotEdit( int uid ) { | 694 | void MainWindow::slotEdit( int uid ) { |
701 | if (uid == 0 ) return; | 695 | if (uid == 0 ) return; |
702 | if(m_syncing) { | 696 | if(m_syncing) { |
@@ -729,33 +723,32 @@ void MainWindow::updateTodo( const OPimTodo& ev) { | |||
729 | m_todoMgr.update( ev.uid() , ev ); | 723 | m_todoMgr.update( ev.uid() , ev ); |
730 | } | 724 | } |
731 | /* The view changed it's configuration | 725 | /* The view changed it's configuration |
732 | * update the view menu | 726 | * update the view menu |
733 | */ | 727 | */ |
734 | void MainWindow::slotUpdate3( QWidget* ) { | 728 | void MainWindow::slotUpdate3( QWidget* ) { |
735 | 729 | ||
736 | } | 730 | } |
737 | void MainWindow::updateList() { | 731 | void MainWindow::updateList() { |
738 | m_todoMgr.updateList(); | 732 | m_todoMgr.updateList(); |
739 | } | 733 | } |
740 | void MainWindow::setReadAhead( uint count ) { | 734 | void MainWindow::setReadAhead( uint count ) { |
741 | if (m_todoMgr.todoDB() ) | 735 | if (m_todoMgr.todoDB() ) |
742 | m_todoMgr.todoDB()->setReadAhead( count ); | 736 | m_todoMgr.todoDB()->setReadAhead( count ); |
743 | } | 737 | } |
744 | void MainWindow::slotQuickEntered() { | 738 | void MainWindow::slotQuickEntered() { |
745 | owarn << "entered" << oendl; | ||
746 | OPimTodo todo = quickEditor()->todo(); | 739 | OPimTodo todo = quickEditor()->todo(); |
747 | if (todo.isEmpty() ) | 740 | if (todo.isEmpty() ) |
748 | return; | 741 | return; |
749 | 742 | ||
750 | m_todoMgr.add( todo ); | 743 | m_todoMgr.add( todo ); |
751 | currentView()->addEvent( todo ); | 744 | currentView()->addEvent( todo ); |
752 | raiseCurrentView(); | 745 | raiseCurrentView(); |
753 | } | 746 | } |
754 | QuickEditBase* MainWindow::quickEditor() { | 747 | QuickEditBase* MainWindow::quickEditor() { |
755 | return m_curQuick; | 748 | return m_curQuick; |
756 | } | 749 | } |
757 | void MainWindow::slotComplete( int uid ) { | 750 | void MainWindow::slotComplete( int uid ) { |
758 | slotComplete( event(uid) ); | 751 | slotComplete( event(uid) ); |
759 | } | 752 | } |
760 | void MainWindow::slotComplete( const OPimTodo& todo ) { | 753 | void MainWindow::slotComplete( const OPimTodo& todo ) { |
761 | OPimTodo to = todo; | 754 | OPimTodo to = todo; |
@@ -776,33 +769,32 @@ void MainWindow::slotComplete( const OPimTodo& todo ) { | |||
776 | if ( to.hasRecurrence() && to.isCompleted() ) { | 769 | if ( to.hasRecurrence() && to.isCompleted() ) { |
777 | OPimTodo to2( to ); | 770 | OPimTodo to2( to ); |
778 | 771 | ||
779 | /* the spinned off one won't recur anymore */ | 772 | /* the spinned off one won't recur anymore */ |
780 | to.setRecurrence( OPimRecurrence() ); | 773 | to.setRecurrence( OPimRecurrence() ); |
781 | 774 | ||
782 | OPimRecurrence rec = to2.recurrence(); | 775 | OPimRecurrence rec = to2.recurrence(); |
783 | rec.setStart( to.dueDate() ); | 776 | rec.setStart( to.dueDate() ); |
784 | to2.setRecurrence( rec ); | 777 | to2.setRecurrence( rec ); |
785 | /* | 778 | /* |
786 | * if there is a next occurence | 779 | * if there is a next occurence |
787 | * from the duedate of the last recurrance | 780 | * from the duedate of the last recurrance |
788 | */ | 781 | */ |
789 | QDate date; | 782 | QDate date; |
790 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { | 783 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { |
791 | int dayDiff = to.dueDate().daysTo( date ); | 784 | int dayDiff = to.dueDate().daysTo( date ); |
792 | owarn << "day diff is " << dayDiff << oendl; | ||
793 | QDate inval; | 785 | QDate inval; |
794 | /* generate a new uid for the old record */ | 786 | /* generate a new uid for the old record */ |
795 | to.setUid( 1 ); | 787 | to.setUid( 1 ); |
796 | 788 | ||
797 | /* add the old one cause it has a new UID here cause it was spin off */ | 789 | /* add the old one cause it has a new UID here cause it was spin off */ |
798 | m_todoMgr.add( to ); | 790 | m_todoMgr.add( to ); |
799 | 791 | ||
800 | /* | 792 | /* |
801 | * update the due date | 793 | * update the due date |
802 | * start date | 794 | * start date |
803 | * and complete date | 795 | * and complete date |
804 | */ | 796 | */ |
805 | to2.setDueDate( date ); | 797 | to2.setDueDate( date ); |
806 | rec.setStart( date ); | 798 | rec.setStart( date ); |
807 | to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week | 799 | to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week |
808 | 800 | ||
@@ -940,41 +932,39 @@ namespace { | |||
940 | bool found = false; | 932 | bool found = false; |
941 | QDateTime oldDt = (*oldIt).dateTime(); | 933 | QDateTime oldDt = (*oldIt).dateTime(); |
942 | for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { | 934 | for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { |
943 | if ( oldDt == (*newIt).dateTime() ) { | 935 | if ( oldDt == (*newIt).dateTime() ) { |
944 | found = true; | 936 | found = true; |
945 | break; | 937 | break; |
946 | } | 938 | } |
947 | } | 939 | } |
948 | if (!found) | 940 | if (!found) |
949 | nonMatching.append( (*oldIt) ); | 941 | nonMatching.append( (*oldIt) ); |
950 | } | 942 | } |
951 | return nonMatching; | 943 | return nonMatching; |
952 | } | 944 | } |
953 | void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { | 945 | void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { |
954 | OPimNotifyManager::Alarms::ConstIterator it; | 946 | OPimNotifyManager::Alarms::ConstIterator it; |
955 | for ( it = als.begin(); it != als.end(); ++it ) { | 947 | for ( it = als.begin(); it != als.end(); ++it ) { |
956 | owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl; | ||
957 | AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); | 948 | AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); |
958 | } | 949 | } |
959 | 950 | ||
960 | } | 951 | } |
961 | void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { | 952 | void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { |
962 | OPimNotifyManager::Alarms::ConstIterator it; | 953 | OPimNotifyManager::Alarms::ConstIterator it; |
963 | for ( it = als.begin(); it != als.end(); ++it ) { | 954 | for ( it = als.begin(); it != als.end(); ++it ) { |
964 | owarn << "Removinf alarm for " << (*it).dateTime().toString() << oendl; | ||
965 | AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); | 955 | AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); |
966 | } | 956 | } |
967 | } | 957 | } |
968 | } | 958 | } |
969 | 959 | ||
970 | void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { | 960 | void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { |
971 | /* | 961 | /* |
972 | * if oldTodo is not empty and has notifiers we need to find the deleted ones | 962 | * if oldTodo is not empty and has notifiers we need to find the deleted ones |
973 | */ | 963 | */ |
974 | if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) { | 964 | if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) { |
975 | OPimNotifyManager::Alarms removed; | 965 | OPimNotifyManager::Alarms removed; |
976 | OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms(); | 966 | OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms(); |
977 | if (!newTodo.hasNotifiers() ) | 967 | if (!newTodo.hasNotifiers() ) |
978 | removed = oldAls; | 968 | removed = oldAls; |
979 | else | 969 | else |
980 | removed = findNonMatching( oldAls, newTodo.notifiers().alarms() ); | 970 | removed = findNonMatching( oldAls, newTodo.notifiers().alarms() ); |
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index b7458d8..221faca 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -125,33 +125,33 @@ TableView::TableView( MainWindow* window, QWidget* wid ) | |||
125 | this, SLOT( slotValueChanged(int,int) ) ); | 125 | this, SLOT( slotValueChanged(int,int) ) ); |
126 | connect((QTable*)this, SIGNAL(currentChanged(int,int) ), | 126 | connect((QTable*)this, SIGNAL(currentChanged(int,int) ), |
127 | this, SLOT( slotCurrentChanged(int,int) ) ); | 127 | this, SLOT( slotCurrentChanged(int,int) ) ); |
128 | 128 | ||
129 | m_menuTimer = new QTimer( this ); | 129 | m_menuTimer = new QTimer( this ); |
130 | connect( m_menuTimer, SIGNAL(timeout()), | 130 | connect( m_menuTimer, SIGNAL(timeout()), |
131 | this, SLOT(slotShowMenu()) ); | 131 | this, SLOT(slotShowMenu()) ); |
132 | 132 | ||
133 | /* now let's init the config */ | 133 | /* now let's init the config */ |
134 | initConfig(); | 134 | initConfig(); |
135 | 135 | ||
136 | 136 | ||
137 | m_enablePaint = true; | 137 | m_enablePaint = true; |
138 | setUpdatesEnabled( true ); | 138 | setUpdatesEnabled( true ); |
139 | viewport()->setUpdatesEnabled( true ); | 139 | viewport()->setUpdatesEnabled( true ); |
140 | viewport()->update(); | 140 | viewport()->update(); |
141 | setSortOrder( 0 ); | 141 | setSortOrder( Opie::OPimTodoAccess::Completed ); |
142 | setAscending( TRUE ); | 142 | setAscending( TRUE ); |
143 | m_first = true; | 143 | m_first = true; |
144 | 144 | ||
145 | 145 | ||
146 | } | 146 | } |
147 | /* a new day has started | 147 | /* a new day has started |
148 | * update the day | 148 | * update the day |
149 | */ | 149 | */ |
150 | void TableView::newDay() { | 150 | void TableView::newDay() { |
151 | clear(); | 151 | clear(); |
152 | updateView(); | 152 | updateView(); |
153 | } | 153 | } |
154 | TableView::~TableView() { | 154 | TableView::~TableView() { |
155 | Config config( "todo" ); | 155 | Config config( "todo" ); |
156 | config.setGroup( "Options" ); | 156 | config.setGroup( "Options" ); |
157 | for (int i = 0; i < numCols(); i++ ) | 157 | for (int i = 0; i < numCols(); i++ ) |
@@ -182,47 +182,45 @@ int TableView::prev() { | |||
182 | if ( currentRow() - 1 < 0 ) return 0; | 182 | if ( currentRow() - 1 < 0 ) return 0; |
183 | setCurrentCell( currentRow() -1, currentColumn() ); | 183 | setCurrentCell( currentRow() -1, currentColumn() ); |
184 | return sorted().uidAt( currentRow() ); | 184 | return sorted().uidAt( currentRow() ); |
185 | 185 | ||
186 | } | 186 | } |
187 | QString TableView::currentRepresentation() { | 187 | QString TableView::currentRepresentation() { |
188 | OPimTodo to = sorted()[currentRow()]; | 188 | OPimTodo to = sorted()[currentRow()]; |
189 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; | 189 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; |
190 | } | 190 | } |
191 | /* show overdue */ | 191 | /* show overdue */ |
192 | void TableView::showOverDue( bool ) { | 192 | void TableView::showOverDue( bool ) { |
193 | clear(); | 193 | clear(); |
194 | updateView(); | 194 | updateView(); |
195 | } | 195 | } |
196 | 196 | ||
197 | void TableView::updateView( ) { | 197 | void TableView::updateView( ) { |
198 | owarn << "update view" << oendl; | ||
199 | m_row = false; | 198 | m_row = false; |
200 | static int id; | 199 | static int id; |
201 | id = startTimer(4000 ); | 200 | id = startTimer(4000 ); |
202 | /* FIXME we want one page to be read! | 201 | /* FIXME we want one page to be read! |
203 | * | 202 | * |
204 | * Calculate that screensize | 203 | * Calculate that screensize |
205 | */ | 204 | */ |
206 | todoWindow()->setReadAhead( 4 ); | 205 | todoWindow()->setReadAhead( 4 ); |
207 | sort(); | 206 | sort(); |
208 | OPimTodoAccess::List::Iterator it, end; | 207 | OPimTodoAccess::List::Iterator it, end; |
209 | it = sorted().begin(); | 208 | it = sorted().begin(); |
210 | end = sorted().end(); | 209 | end = sorted().end(); |
211 | 210 | ||
212 | owarn << "setTodos" << oendl; | ||
213 | QTime time; | 211 | QTime time; |
214 | time.start(); | 212 | time.start(); |
215 | m_enablePaint = false; | 213 | m_enablePaint = false; |
216 | setUpdatesEnabled( false ); | 214 | setUpdatesEnabled( false ); |
217 | viewport()->setUpdatesEnabled( false ); | 215 | viewport()->setUpdatesEnabled( false ); |
218 | 216 | ||
219 | setNumRows( it.count() ); | 217 | setNumRows( it.count() ); |
220 | if ( it.count() == 0 ) | 218 | if ( it.count() == 0 ) |
221 | killTimer(id); | 219 | killTimer(id); |
222 | 220 | ||
223 | // int elc = time.elapsed(); | 221 | // int elc = time.elapsed(); |
224 | setUpdatesEnabled( true ); | 222 | setUpdatesEnabled( true ); |
225 | viewport()->setUpdatesEnabled( true ); | 223 | viewport()->setUpdatesEnabled( true ); |
226 | viewport()->update(); | 224 | viewport()->update(); |
227 | 225 | ||
228 | m_enablePaint = true; | 226 | m_enablePaint = true; |
@@ -241,61 +239,58 @@ void TableView::addEvent( const OPimTodo&) { | |||
241 | } | 239 | } |
242 | /* | 240 | /* |
243 | * find the event | 241 | * find the event |
244 | * and then replace the complete row | 242 | * and then replace the complete row |
245 | */ | 243 | */ |
246 | void TableView::replaceEvent( const OPimTodo& ev) { | 244 | void TableView::replaceEvent( const OPimTodo& ev) { |
247 | addEvent( ev ); | 245 | addEvent( ev ); |
248 | } | 246 | } |
249 | /* | 247 | /* |
250 | * re aligning table can be slow too | 248 | * re aligning table can be slow too |
251 | * FIXME: look what performs better | 249 | * FIXME: look what performs better |
252 | * either this or the old align table | 250 | * either this or the old align table |
253 | */ | 251 | */ |
254 | void TableView::removeEvent( int ) { | 252 | void TableView::removeEvent( int ) { |
255 | updateView(); | 253 | updateView(); |
256 | } | 254 | } |
257 | void TableView::setShowCompleted( bool b) { | 255 | void TableView::setShowCompleted( bool ) { |
258 | owarn << "Show Completed " << b << oendl; | ||
259 | updateView(); | 256 | updateView(); |
260 | } | 257 | } |
261 | void TableView::setShowDeadline( bool b ) { | 258 | void TableView::setShowDeadline( bool b ) { |
262 | owarn << "Show Deadline " << b << oendl; | ||
263 | if ( b ) | 259 | if ( b ) |
264 | showColumn( 3 ); | 260 | showColumn( 3 ); |
265 | else | 261 | else |
266 | hideColumn( 3 ); | 262 | hideColumn( 3 ); |
267 | 263 | ||
268 | // Try to intelligently size columns | 264 | // Try to intelligently size columns |
269 | // TODO - would use width() below, but doesn't have valid value at time of c'tor | 265 | // TODO - would use width() below, but doesn't have valid value at time of c'tor |
270 | int col2width = 238; | 266 | int col2width = 238; |
271 | int width = m_pic_completed.width(); | 267 | int width = m_pic_completed.width(); |
272 | setColumnWidth( 0, width ); | 268 | setColumnWidth( 0, width ); |
273 | col2width -= width; | 269 | col2width -= width; |
274 | width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; | 270 | width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; |
275 | setColumnWidth( 1, width ); | 271 | setColumnWidth( 1, width ); |
276 | col2width -= width; | 272 | col2width -= width; |
277 | if ( b ) { | 273 | if ( b ) { |
278 | width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; | 274 | width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; |
279 | setColumnWidth( 3, width ); | 275 | setColumnWidth( 3, width ); |
280 | col2width -= width; | 276 | col2width -= width; |
281 | } | 277 | } |
282 | setColumnWidth( 2, col2width ); | 278 | setColumnWidth( 2, col2width ); |
283 | } | 279 | } |
284 | void TableView::setShowCategory( const QString& str) { | 280 | void TableView::setShowCategory( const QString& str) { |
285 | owarn << "setShowCategory" << oendl; | ||
286 | if ( str != m_oleCat || m_first ) | 281 | if ( str != m_oleCat || m_first ) |
287 | updateView(); | 282 | updateView(); |
288 | 283 | ||
289 | m_oleCat = str; | 284 | m_oleCat = str; |
290 | m_first = false; | 285 | m_first = false; |
291 | 286 | ||
292 | } | 287 | } |
293 | void TableView::clear() { | 288 | void TableView::clear() { |
294 | setNumRows(0); | 289 | setNumRows(0); |
295 | } | 290 | } |
296 | void TableView::slotClicked(int row, int col, int, | 291 | void TableView::slotClicked(int row, int col, int, |
297 | const QPoint& point) { | 292 | const QPoint& point) { |
298 | if ( m_editorWidget.cellWidget() ) { | 293 | if ( m_editorWidget.cellWidget() ) { |
299 | //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | 294 | //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); |
300 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | 295 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), |
301 | true, true ); | 296 | true, true ); |
@@ -334,57 +329,69 @@ void TableView::slotClicked(int row, int col, int, | |||
334 | m_menuTimer->stop(); | 329 | m_menuTimer->stop(); |
335 | showTodo( ui ); | 330 | showTodo( ui ); |
336 | break; | 331 | break; |
337 | } | 332 | } |
338 | case 3: { | 333 | case 3: { |
339 | m_menuTimer->stop(); | 334 | m_menuTimer->stop(); |
340 | TodoView::edit( ui ); | 335 | TodoView::edit( ui ); |
341 | break; | 336 | break; |
342 | } | 337 | } |
343 | } | 338 | } |
344 | 339 | ||
345 | 340 | ||
346 | } | 341 | } |
347 | void TableView::slotPressed(int row, int col, int, | 342 | void TableView::slotPressed(int row, int col, int, |
348 | const QPoint& point) { | 343 | const QPoint& point) { |
349 | 344 | ||
350 | owarn << "pressed row " << row << " col " << col << " x:" << point.x() | ||
351 | << "+y:" << point.y() << oendl; | ||
352 | m_prevP = point; | 345 | m_prevP = point; |
353 | /* TextColumn column */ | 346 | /* TextColumn column */ |
354 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) | 347 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) |
355 | m_menuTimer->start( 750, TRUE ); | 348 | m_menuTimer->start( 750, TRUE ); |
356 | } | 349 | } |
357 | void TableView::slotValueChanged( int, int ) { | 350 | void TableView::slotValueChanged( int, int ) { |
358 | owarn << "Value Changed" << oendl; | ||
359 | } | 351 | } |
360 | void TableView::slotCurrentChanged(int, int ) { | 352 | void TableView::slotCurrentChanged(int, int ) { |
361 | m_menuTimer->stop(); | 353 | m_menuTimer->stop(); |
362 | } | 354 | } |
363 | QWidget* TableView::widget() { | 355 | QWidget* TableView::widget() { |
364 | return this; | 356 | return this; |
365 | } | 357 | } |
366 | /* | 358 | /* |
367 | * We need to overwrite sortColumn | 359 | * We need to overwrite sortColumn |
368 | * because we want to sort whole row | 360 | * because we want to sort whole row |
369 | * based | 361 | * based |
370 | * We event want to set the setOrder | 362 | * We event want to set the setOrder |
371 | * to a sort() and update() | 363 | * to a sort() and update() |
372 | */ | 364 | */ |
373 | void TableView::sortColumn( int col, bool asc, bool ) { | 365 | void TableView::sortColumn( int col, bool asc, bool ) { |
374 | owarn << "bool " << asc << oendl; | 366 | switch(col) { |
367 | case 1: | ||
368 | col = Opie::OPimTodoAccess::Priority; | ||
369 | break; | ||
370 | case 2: | ||
371 | col = Opie::OPimTodoAccess::SortSummary; | ||
372 | break; | ||
373 | case 3: | ||
374 | col = Opie::OPimTodoAccess::Deadline; | ||
375 | break; | ||
376 | case 0: | ||
377 | default: | ||
378 | col = Opie::OPimTodoAccess::Completed; | ||
379 | break; | ||
380 | } | ||
381 | |||
375 | setSortOrder( col ); | 382 | setSortOrder( col ); |
376 | setAscending( asc ); | 383 | setAscending( asc ); |
377 | updateView(); | 384 | updateView(); |
378 | } | 385 | } |
379 | void TableView::viewportPaintEvent( QPaintEvent* e) { | 386 | void TableView::viewportPaintEvent( QPaintEvent* e) { |
380 | if (m_enablePaint ) | 387 | if (m_enablePaint ) |
381 | QTable::viewportPaintEvent( e ); | 388 | QTable::viewportPaintEvent( e ); |
382 | } | 389 | } |
383 | /* | 390 | /* |
384 | * This segment is copyrighted by TT | 391 | * This segment is copyrighted by TT |
385 | * it was taken from their todolist | 392 | * it was taken from their todolist |
386 | * application this code is GPL | 393 | * application this code is GPL |
387 | */ | 394 | */ |
388 | void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { | 395 | void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { |
389 | const QColorGroup &cg = colorGroup(); | 396 | const QColorGroup &cg = colorGroup(); |
390 | 397 | ||
@@ -481,33 +488,32 @@ QWidget* TableView::createEditor(int row, int col, bool )const { | |||
481 | } | 488 | } |
482 | combo->setCurrentItem( sorted()[row].priority()-1 ); | 489 | combo->setCurrentItem( sorted()[row].priority()-1 ); |
483 | return combo; | 490 | return combo; |
484 | } | 491 | } |
485 | /* summary */ | 492 | /* summary */ |
486 | case 2:{ | 493 | case 2:{ |
487 | QLineEdit* edit = new QLineEdit( viewport() ); | 494 | QLineEdit* edit = new QLineEdit( viewport() ); |
488 | edit->setText( sorted()[row].summary() ); | 495 | edit->setText( sorted()[row].summary() ); |
489 | return edit; | 496 | return edit; |
490 | } | 497 | } |
491 | case 0: | 498 | case 0: |
492 | default: | 499 | default: |
493 | return 0l; | 500 | return 0l; |
494 | } | 501 | } |
495 | } | 502 | } |
496 | void TableView::setCellContentFromEditor(int row, int col ) { | 503 | void TableView::setCellContentFromEditor(int row, int col ) { |
497 | owarn << "set cell content from editor" << oendl; | ||
498 | if ( col == 1 ) { | 504 | if ( col == 1 ) { |
499 | QWidget* wid = cellWidget(row, 1 ); | 505 | QWidget* wid = cellWidget(row, 1 ); |
500 | if ( wid->inherits("QComboBox") ) { | 506 | if ( wid->inherits("QComboBox") ) { |
501 | int pri = ((QComboBox*)wid)->currentItem() + 1; | 507 | int pri = ((QComboBox*)wid)->currentItem() + 1; |
502 | OPimTodo todo = sorted()[row]; | 508 | OPimTodo todo = sorted()[row]; |
503 | if ( todo.priority() != pri ) { | 509 | if ( todo.priority() != pri ) { |
504 | todo.setPriority( pri ); | 510 | todo.setPriority( pri ); |
505 | TodoView::update( todo.uid(), todo ); | 511 | TodoView::update( todo.uid(), todo ); |
506 | updateView(); | 512 | updateView(); |
507 | } | 513 | } |
508 | } | 514 | } |
509 | }else if ( col == 2) { | 515 | }else if ( col == 2) { |
510 | QWidget* wid = cellWidget(row, 2); | 516 | QWidget* wid = cellWidget(row, 2); |
511 | if ( wid->inherits("QLineEdit") ) { | 517 | if ( wid->inherits("QLineEdit") ) { |
512 | QString text = ((QLineEdit*)wid)->text(); | 518 | QString text = ((QLineEdit*)wid)->text(); |
513 | OPimTodo todo = sorted()[row]; | 519 | OPimTodo todo = sorted()[row]; |
@@ -517,33 +523,32 @@ void TableView::setCellContentFromEditor(int row, int col ) { | |||
517 | updateView(); | 523 | updateView(); |
518 | } | 524 | } |
519 | } | 525 | } |
520 | } | 526 | } |
521 | } | 527 | } |
522 | void TableView::slotPriority() { | 528 | void TableView::slotPriority() { |
523 | setCellContentFromEditor( currentRow(), currentColumn() ); | 529 | setCellContentFromEditor( currentRow(), currentColumn() ); |
524 | } | 530 | } |
525 | /* | 531 | /* |
526 | * We'll use the TimerEvent to read ahead or to keep the cahce always | 532 | * We'll use the TimerEvent to read ahead or to keep the cahce always |
527 | * filled enough. | 533 | * filled enough. |
528 | * We will try to read ahead 4 items in both ways | 534 | * We will try to read ahead 4 items in both ways |
529 | * up and down. On odd or even we will currentRow()+-4 or +-9 | 535 | * up and down. On odd or even we will currentRow()+-4 or +-9 |
530 | * | 536 | * |
531 | */ | 537 | */ |
532 | void TableView::timerEvent( QTimerEvent* ) { | 538 | void TableView::timerEvent( QTimerEvent* ) { |
533 | // Opie::Core::owarn << "sorted " << sorted().count() << oendl; | ||
534 | if (sorted().count() == 0 ) | 539 | if (sorted().count() == 0 ) |
535 | return; | 540 | return; |
536 | 541 | ||
537 | int row = currentRow(); | 542 | int row = currentRow(); |
538 | if ( m_row ) { | 543 | if ( m_row ) { |
539 | int ro = row-4; | 544 | int ro = row-4; |
540 | if (ro < 0 ) ro = 0; | 545 | if (ro < 0 ) ro = 0; |
541 | sorted()[ro]; | 546 | sorted()[ro]; |
542 | 547 | ||
543 | ro = row+4; | 548 | ro = row+4; |
544 | sorted()[ro]; | 549 | sorted()[ro]; |
545 | } else { | 550 | } else { |
546 | int ro = row + 8; | 551 | int ro = row + 8; |
547 | sorted()[ro]; | 552 | sorted()[ro]; |
548 | 553 | ||
549 | ro = row-8; | 554 | ro = row-8; |
@@ -565,33 +570,32 @@ void TableView::timerEvent( QTimerEvent* ) { | |||
565 | * Then we check if they're some pixel horizontal away | 570 | * Then we check if they're some pixel horizontal away |
566 | * if the distance between the two points is greater than | 571 | * if the distance between the two points is greater than |
567 | * 8 we mark the underlying todo as completed and do a repaint | 572 | * 8 we mark the underlying todo as completed and do a repaint |
568 | * | 573 | * |
569 | * BUG: When clicking on the Due column and it's scrollable | 574 | * BUG: When clicking on the Due column and it's scrollable |
570 | * the todo is marked as completed... | 575 | * the todo is marked as completed... |
571 | * REASON: QTable is doing auto scrolling which leads to a move | 576 | * REASON: QTable is doing auto scrolling which leads to a move |
572 | * in the x coordinate and this way it's able to pass the | 577 | * in the x coordinate and this way it's able to pass the |
573 | * m_completeStrokeWidth criteria | 578 | * m_completeStrokeWidth criteria |
574 | * WORKAROUND: strike through needs to strike through the same | 579 | * WORKAROUND: strike through needs to strike through the same |
575 | * row and two columns! | 580 | * row and two columns! |
576 | */ | 581 | */ |
577 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { | 582 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { |
578 | int row = rowAt(m_prevP.y()); | 583 | int row = rowAt(m_prevP.y()); |
579 | int colOld = columnAt(m_prevP.x() ); | 584 | int colOld = columnAt(m_prevP.x() ); |
580 | int colNew = columnAt(e->x() ); | 585 | int colNew = columnAt(e->x() ); |
581 | owarn << "colNew: " << colNew << " colOld: " << colOld << oendl; | ||
582 | if ( row == rowAt( e->y() ) && row != -1 && | 586 | if ( row == rowAt( e->y() ) && row != -1 && |
583 | colOld != colNew ) { | 587 | colOld != colNew ) { |
584 | TodoView::complete( sorted()[row] ); | 588 | TodoView::complete( sorted()[row] ); |
585 | return; | 589 | return; |
586 | } | 590 | } |
587 | QTable::contentsMouseReleaseEvent( e ); | 591 | QTable::contentsMouseReleaseEvent( e ); |
588 | } | 592 | } |
589 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { | 593 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { |
590 | m_menuTimer->stop(); | 594 | m_menuTimer->stop(); |
591 | QTable::contentsMouseMoveEvent( e ); | 595 | QTable::contentsMouseMoveEvent( e ); |
592 | } | 596 | } |
593 | void TableView::keyPressEvent( QKeyEvent* event) { | 597 | void TableView::keyPressEvent( QKeyEvent* event) { |
594 | if ( m_editorWidget.cellWidget() ) { | 598 | if ( m_editorWidget.cellWidget() ) { |
595 | // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | 599 | // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); |
596 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | 600 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), |
597 | true, true ); | 601 | true, true ); |
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp index c4b8fbc..7136f9a 100644 --- a/core/pim/todo/todomanager.cpp +++ b/core/pim/todo/todomanager.cpp | |||
@@ -24,55 +24,50 @@ | |||
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <opie2/odebug.h> | 29 | #include <opie2/odebug.h> |
30 | 30 | ||
31 | #include <qpe/categoryselect.h> | 31 | #include <qpe/categoryselect.h> |
32 | 32 | ||
33 | #include "todomanager.h" | 33 | #include "todomanager.h" |
34 | 34 | ||
35 | using namespace Todo; | 35 | using namespace Todo; |
36 | 36 | ||
37 | TodoManager::TodoManager( QObject *obj ) | 37 | TodoManager::TodoManager( QObject *obj ) |
38 | : QObject( obj ) { | 38 | : QObject( obj ) { |
39 | m_db = 0l; | 39 | m_db = 0l; |
40 | QTime time; | ||
41 | time.start(); | ||
42 | int el = time.elapsed(); | ||
43 | owarn << "QTimer for loading " << el/1000 << oendl; | ||
44 | } | 40 | } |
45 | TodoManager::~TodoManager() { | 41 | TodoManager::~TodoManager() { |
46 | delete m_db; | 42 | delete m_db; |
47 | } | 43 | } |
48 | OPimTodo TodoManager::event(int uid ) { | 44 | OPimTodo TodoManager::event(int uid ) { |
49 | return m_db->find( uid ); | 45 | return m_db->find( uid ); |
50 | } | 46 | } |
51 | void TodoManager::updateList() { | 47 | void TodoManager::updateList() { |
52 | owarn << "update lists" << oendl; | ||
53 | m_list = m_db->allRecords(); | 48 | m_list = m_db->allRecords(); |
54 | } | 49 | } |
55 | OPimTodoAccess::List TodoManager::list() const{ | 50 | OPimTodoAccess::List TodoManager::list() const{ |
56 | return m_list; | 51 | return m_list; |
57 | } | 52 | } |
58 | OPimTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) { | 53 | OPimTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) { |
59 | return m_db->sorted( asc, so, f, cat ); | 54 | return m_db->sorted( asc, so, f, cat ); |
60 | } | 55 | } |
61 | OPimTodoAccess::List::Iterator TodoManager::overDue() { | 56 | OPimTodoAccess::List::Iterator TodoManager::overDue() { |
62 | int filter = 2 | 1; | 57 | int filter = Opie::OPimTodoAccess::FilterCategory | Opie::OPimTodoAccess::OnlyOverDue; |
63 | m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca ); | 58 | m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca ); |
64 | m_it = m_list.begin(); | 59 | m_it = m_list.begin(); |
65 | return m_it; | 60 | return m_it; |
66 | } | 61 | } |
67 | OPimTodoAccess::List::Iterator TodoManager::fromTo( const QDate& start, | 62 | OPimTodoAccess::List::Iterator TodoManager::fromTo( const QDate& start, |
68 | const QDate& end ) { | 63 | const QDate& end ) { |
69 | m_list = m_db->effectiveToDos( start, end ); | 64 | m_list = m_db->effectiveToDos( start, end ); |
70 | m_it = m_list.begin(); | 65 | m_it = m_list.begin(); |
71 | return m_it; | 66 | return m_it; |
72 | } | 67 | } |
73 | OPimTodoAccess::List::Iterator TodoManager::query( const OPimTodo& ev, int query ) { | 68 | OPimTodoAccess::List::Iterator TodoManager::query( const OPimTodo& ev, int query ) { |
74 | m_list = m_db->queryByExample( ev, query ); | 69 | m_list = m_db->queryByExample( ev, query ); |
75 | m_it = m_list.begin(); | 70 | m_it = m_list.begin(); |
76 | return m_it; | 71 | return m_it; |
77 | } | 72 | } |
78 | OPimTodoAccess* TodoManager::todoDB() { | 73 | OPimTodoAccess* TodoManager::todoDB() { |