author | drw <drw> | 2004-04-02 22:15:36 (UTC) |
---|---|---|
committer | drw <drw> | 2004-04-02 22:15:36 (UTC) |
commit | edd008d91ca57453601d0c2098936287d98975e6 (patch) (unidiff) | |
tree | ffdc1d494333537e33a3ad0390f83968cb884966 | |
parent | 6f335843b89f60fe009b43a4134e9b3753fff974 (diff) | |
download | opie-edd008d91ca57453601d0c2098936287d98975e6.zip opie-edd008d91ca57453601d0c2098936287d98975e6.tar.gz opie-edd008d91ca57453601d0c2098936287d98975e6.tar.bz2 |
Use ODebug (another 35 down...) - all of core/pim is converted.
-rw-r--r-- | core/pim/todo/main.cpp | 4 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 19 | ||||
-rw-r--r-- | core/pim/todo/opie-todo.control | 2 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.cpp | 4 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 34 | ||||
-rw-r--r-- | core/pim/todo/templatedialog.cpp | 10 | ||||
-rw-r--r-- | core/pim/todo/todoeditor.cpp | 5 | ||||
-rw-r--r-- | core/pim/todo/todomanager.cpp | 7 | ||||
-rw-r--r-- | core/pim/todo/todotemplatemanager.cpp | 7 | ||||
-rw-r--r-- | core/pim/todo/todoview.cpp | 6 |
10 files changed, 56 insertions, 42 deletions
diff --git a/core/pim/todo/main.cpp b/core/pim/todo/main.cpp index 7763169..d070ff8 100644 --- a/core/pim/todo/main.cpp +++ b/core/pim/todo/main.cpp | |||
@@ -7,42 +7,42 @@ | |||
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "mainwindow.h" | 21 | #include "mainwindow.h" |
22 | 22 | ||
23 | 23 | #include <opie2/odebug.h> | |
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 | qWarning("QTime %d", t/1000 ); | 40 | Opie::Core::owarn << "QTime " << t/1000 << oendl; |
41 | mw.setCaption( QObject::tr("Opie Todolist")); | 41 | mw.setCaption( QObject::tr("Opie Todolist")); |
42 | QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) ); | 42 | QObject::connect( &a, SIGNAL( flush() ), &mw, SLOT( slotFlush() ) ); |
43 | QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) ); | 43 | QObject::connect( &a, SIGNAL( reload() ), &mw, SLOT( slotReload() ) ); |
44 | 44 | ||
45 | a.showMainWidget(&mw); | 45 | a.showMainWidget(&mw); |
46 | 46 | ||
47 | return a.exec(); | 47 | return a.exec(); |
48 | } | 48 | } |
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index f0642c4..d552928 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -15,32 +15,33 @@ | |||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = General Public License along with | 21 | -_. . . )=. = General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
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 <unistd.h> | 29 | #include <unistd.h> |
30 | 30 | ||
31 | #include <opie2/odebug.h> | ||
31 | #include <opie2/opimrecurrence.h> | 32 | #include <opie2/opimrecurrence.h> |
32 | #include <opie2/opimnotifymanager.h> | 33 | #include <opie2/opimnotifymanager.h> |
33 | #include <opie2/otodoaccessvcal.h> | 34 | #include <opie2/otodoaccessvcal.h> |
34 | #include <opie2/oapplicationfactory.h> | 35 | #include <opie2/oapplicationfactory.h> |
35 | 36 | ||
36 | #include <qpe/applnk.h> | 37 | #include <qpe/applnk.h> |
37 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
38 | #include <qpe/ir.h> | 39 | #include <qpe/ir.h> |
39 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
40 | #include <qpe/qpemessagebox.h> | 41 | #include <qpe/qpemessagebox.h> |
41 | #include <qpe/alarmserver.h> | 42 | #include <qpe/alarmserver.h> |
42 | #include <qpe/qpeapplication.h> | 43 | #include <qpe/qpeapplication.h> |
43 | 44 | ||
44 | #include <qmenubar.h> | 45 | #include <qmenubar.h> |
45 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
46 | #include <qpushbutton.h> | 47 | #include <qpushbutton.h> |
@@ -282,52 +283,52 @@ QPopupMenu* MainWindow::contextMenu( int , bool recur ) { | |||
282 | m_duplicateAction->addTo( menu ); | 283 | m_duplicateAction->addTo( menu ); |
283 | 284 | ||
284 | menu->insertSeparator(); | 285 | menu->insertSeparator(); |
285 | 286 | ||
286 | /* | 287 | /* |
287 | * if this event recurs we allow | 288 | * if this event recurs we allow |
288 | * to detach it. | 289 | * to detach it. |
289 | * remove all | 290 | * remove all |
290 | */ | 291 | */ |
291 | if ( recur ) { | 292 | if ( recur ) { |
292 | ; // FIXME | 293 | ; // FIXME |
293 | } | 294 | } |
294 | 295 | ||
295 | return menu; | 296 | return menu; |
296 | } | 297 | } |
297 | QPopupMenu* MainWindow::options() { | 298 | QPopupMenu* MainWindow::options() { |
298 | qWarning("Options"); | 299 | Opie::Core::owarn << "Options" << oendl; |
299 | return m_options; | 300 | return m_options; |
300 | } | 301 | } |
301 | QPopupMenu* MainWindow::edit() { | 302 | QPopupMenu* MainWindow::edit() { |
302 | return m_edit; | 303 | return m_edit; |
303 | } | 304 | } |
304 | QToolBar* MainWindow::toolbar() { | 305 | QToolBar* MainWindow::toolbar() { |
305 | return m_tool; | 306 | return m_tool; |
306 | } | 307 | } |
307 | OPimTodoAccess::List MainWindow::list()const { | 308 | OPimTodoAccess::List MainWindow::list()const { |
308 | return m_todoMgr.list(); | 309 | return m_todoMgr.list(); |
309 | } | 310 | } |
310 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { | 311 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { |
311 | int cat = 0; | 312 | int cat = 0; |
312 | if ( m_curCat != QWidget::tr("All Categories") ) | 313 | if ( m_curCat != QWidget::tr("All Categories") ) |
313 | cat = currentCatId(); | 314 | cat = currentCatId(); |
314 | if ( m_curCat == QWidget::tr("Unfiled") ) | 315 | if ( m_curCat == QWidget::tr("Unfiled") ) |
315 | cat = -1; | 316 | cat = -1; |
316 | 317 | ||
317 | qWarning(" Category %d %s", cat, m_curCat.latin1() ); | 318 | Opie::Core::owarn << " Category " << cat << " " << m_curCat << oendl; |
318 | 319 | ||
319 | int filter = 1; | 320 | int filter = 1; |
320 | 321 | ||
321 | if (!m_completed ) | 322 | if (!m_completed ) |
322 | filter |= 4; | 323 | filter |= 4; |
323 | if (m_overdue) | 324 | if (m_overdue) |
324 | filter |= 2; | 325 | filter |= 2; |
325 | 326 | ||
326 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); | 327 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); |
327 | } | 328 | } |
328 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { | 329 | OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { |
329 | int cat = 0; | 330 | int cat = 0; |
330 | if ( m_curCat != QWidget::tr("All Categories") ) | 331 | if ( m_curCat != QWidget::tr("All Categories") ) |
331 | cat = currentCatId(); | 332 | cat = currentCatId(); |
332 | 333 | ||
333 | if ( m_curCat == QWidget::tr("Unfiled") ) | 334 | if ( m_curCat == QWidget::tr("Unfiled") ) |
@@ -360,33 +361,33 @@ void MainWindow::closeEvent( QCloseEvent* e ) { | |||
360 | if (m_stack->visibleWidget() == currentShow()->widget() ) { | 361 | if (m_stack->visibleWidget() == currentShow()->widget() ) { |
361 | m_showing = false; | 362 | m_showing = false; |
362 | raiseCurrentView(); | 363 | raiseCurrentView(); |
363 | e->ignore(); | 364 | e->ignore(); |
364 | return; | 365 | return; |
365 | } | 366 | } |
366 | /* | 367 | /* |
367 | * we should have flushed and now we're still saving | 368 | * we should have flushed and now we're still saving |
368 | * so there is no need to flush | 369 | * so there is no need to flush |
369 | */ | 370 | */ |
370 | if (m_syncing ) { | 371 | if (m_syncing ) { |
371 | e->accept(); | 372 | e->accept(); |
372 | return; | 373 | return; |
373 | } | 374 | } |
374 | bool quit = false; | 375 | bool quit = false; |
375 | if ( m_todoMgr.saveAll() ){ | 376 | if ( m_todoMgr.saveAll() ){ |
376 | qWarning("saved"); | 377 | Opie::Core::owarn << "saved" << oendl; |
377 | quit = true; | 378 | quit = true; |
378 | }else { | 379 | }else { |
379 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), | 380 | if ( QMessageBox::critical( this, QWidget::tr("Out of space"), |
380 | QWidget::tr("Todo was unable\n" | 381 | QWidget::tr("Todo was unable\n" |
381 | "to save your changes.\n" | 382 | "to save your changes.\n" |
382 | "Free up some space\n" | 383 | "Free up some space\n" |
383 | "and try again.\n" | 384 | "and try again.\n" |
384 | "\nQuit Anyway?"), | 385 | "\nQuit Anyway?"), |
385 | QMessageBox::Yes|QMessageBox::Escape, | 386 | QMessageBox::Yes|QMessageBox::Escape, |
386 | QMessageBox::No|QMessageBox::Default) | 387 | QMessageBox::No|QMessageBox::Default) |
387 | != QMessageBox::No ) { | 388 | != QMessageBox::No ) { |
388 | e->accept(); | 389 | e->accept(); |
389 | quit = true; | 390 | quit = true; |
390 | }else | 391 | }else |
391 | e->ignore(); | 392 | e->ignore(); |
392 | 393 | ||
@@ -523,33 +524,33 @@ void MainWindow::slotDeleteCompleted() { | |||
523 | m_todoMgr.removeCompleted(); | 524 | m_todoMgr.removeCompleted(); |
524 | currentView()->updateView( ); | 525 | currentView()->updateView( ); |
525 | } | 526 | } |
526 | void MainWindow::slotFind() { | 527 | void MainWindow::slotFind() { |
527 | 528 | ||
528 | } | 529 | } |
529 | void MainWindow::slotEdit() { | 530 | void MainWindow::slotEdit() { |
530 | slotEdit( currentView()->current() ); | 531 | slotEdit( currentView()->current() ); |
531 | } | 532 | } |
532 | /* | 533 | /* |
533 | * set the category | 534 | * set the category |
534 | */ | 535 | */ |
535 | void MainWindow::setCategory( int c) { | 536 | void MainWindow::setCategory( int c) { |
536 | if ( c <= 0 ) return; | 537 | if ( c <= 0 ) return; |
537 | 538 | ||
538 | 539 | ||
539 | qWarning("Iterating over cats %d", c ); | 540 | Opie::Core::owarn << "Iterating over cats " << c << oendl; |
540 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) | 541 | for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) |
541 | m_catMenu->setItemChecked(i, c == (int)i ); | 542 | m_catMenu->setItemChecked(i, c == (int)i ); |
542 | 543 | ||
543 | if (c == 1 ) { | 544 | if (c == 1 ) { |
544 | m_curCat = QString::null; | 545 | m_curCat = QString::null; |
545 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); | 546 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); |
546 | 547 | ||
547 | }else if ( c == (int)m_catMenu->count() - 1 ) { | 548 | }else if ( c == (int)m_catMenu->count() - 1 ) { |
548 | m_curCat = QWidget::tr("Unfiled"); | 549 | m_curCat = QWidget::tr("Unfiled"); |
549 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); | 550 | setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); |
550 | }else { | 551 | }else { |
551 | m_curCat = m_todoMgr.categories()[c-2]; | 552 | m_curCat = m_todoMgr.categories()[c-2]; |
552 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); | 553 | setCaption( QWidget::tr("Todo") + " - " + m_curCat ); |
553 | } | 554 | } |
554 | m_catMenu->setItemChecked( c, true ); | 555 | m_catMenu->setItemChecked( c, true ); |
555 | 556 | ||
@@ -667,33 +668,33 @@ void MainWindow::raiseCurrentView() { | |||
667 | // due QPE/Application/todolist show(int) | 668 | // due QPE/Application/todolist show(int) |
668 | // we might not have the populateCategories slot called once | 669 | // we might not have the populateCategories slot called once |
669 | // we would show the otodo but then imediately switch to the currentView | 670 | // we would show the otodo but then imediately switch to the currentView |
670 | // if we're initially showing we shouldn't raise the table | 671 | // if we're initially showing we shouldn't raise the table |
671 | // in returnFromView we fix up m_showing | 672 | // in returnFromView we fix up m_showing |
672 | if (m_showing ) return; | 673 | if (m_showing ) return; |
673 | 674 | ||
674 | m_stack->raiseWidget( m_curView->widget() ); | 675 | m_stack->raiseWidget( m_curView->widget() ); |
675 | } | 676 | } |
676 | void MainWindow::slotShowDue(bool ov) { | 677 | void MainWindow::slotShowDue(bool ov) { |
677 | m_overdue = ov; | 678 | m_overdue = ov; |
678 | currentView()->showOverDue( ov ); | 679 | currentView()->showOverDue( ov ); |
679 | raiseCurrentView(); | 680 | raiseCurrentView(); |
680 | } | 681 | } |
681 | void MainWindow::slotShow( int uid ) { | 682 | void MainWindow::slotShow( int uid ) { |
682 | if ( uid == 0 ) return; | 683 | if ( uid == 0 ) return; |
683 | qWarning("slotShow"); | 684 | Opie::Core::owarn << "slotShow" << oendl; |
684 | currentShow()->slotShow( event( uid ) ); | 685 | currentShow()->slotShow( event( uid ) ); |
685 | m_stack->raiseWidget( currentShow()->widget() ); | 686 | m_stack->raiseWidget( currentShow()->widget() ); |
686 | } | 687 | } |
687 | void MainWindow::slotShowNext() { | 688 | void MainWindow::slotShowNext() { |
688 | int l = currentView()->next(); | 689 | int l = currentView()->next(); |
689 | if (l!=0) | 690 | if (l!=0) |
690 | slotShow(l); | 691 | slotShow(l); |
691 | } | 692 | } |
692 | void MainWindow::slotShowPrev() { | 693 | void MainWindow::slotShowPrev() { |
693 | int l = currentView()->prev(); | 694 | int l = currentView()->prev(); |
694 | if (l!=0) | 695 | if (l!=0) |
695 | slotShow(l); | 696 | slotShow(l); |
696 | } | 697 | } |
697 | void MainWindow::slotEdit( int uid ) { | 698 | void MainWindow::slotEdit( int uid ) { |
698 | if (uid == 0 ) return; | 699 | if (uid == 0 ) return; |
699 | if(m_syncing) { | 700 | if(m_syncing) { |
@@ -726,33 +727,33 @@ void MainWindow::updateTodo( const OPimTodo& ev) { | |||
726 | m_todoMgr.update( ev.uid() , ev ); | 727 | m_todoMgr.update( ev.uid() , ev ); |
727 | } | 728 | } |
728 | /* The view changed it's configuration | 729 | /* The view changed it's configuration |
729 | * update the view menu | 730 | * update the view menu |
730 | */ | 731 | */ |
731 | void MainWindow::slotUpdate3( QWidget* ) { | 732 | void MainWindow::slotUpdate3( QWidget* ) { |
732 | 733 | ||
733 | } | 734 | } |
734 | void MainWindow::updateList() { | 735 | void MainWindow::updateList() { |
735 | m_todoMgr.updateList(); | 736 | m_todoMgr.updateList(); |
736 | } | 737 | } |
737 | void MainWindow::setReadAhead( uint count ) { | 738 | void MainWindow::setReadAhead( uint count ) { |
738 | if (m_todoMgr.todoDB() ) | 739 | if (m_todoMgr.todoDB() ) |
739 | m_todoMgr.todoDB()->setReadAhead( count ); | 740 | m_todoMgr.todoDB()->setReadAhead( count ); |
740 | } | 741 | } |
741 | void MainWindow::slotQuickEntered() { | 742 | void MainWindow::slotQuickEntered() { |
742 | qWarning("entered"); | 743 | Opie::Core::owarn << "entered" << oendl; |
743 | OPimTodo todo = quickEditor()->todo(); | 744 | OPimTodo todo = quickEditor()->todo(); |
744 | if (todo.isEmpty() ) | 745 | if (todo.isEmpty() ) |
745 | return; | 746 | return; |
746 | 747 | ||
747 | m_todoMgr.add( todo ); | 748 | m_todoMgr.add( todo ); |
748 | currentView()->addEvent( todo ); | 749 | currentView()->addEvent( todo ); |
749 | raiseCurrentView(); | 750 | raiseCurrentView(); |
750 | } | 751 | } |
751 | QuickEditBase* MainWindow::quickEditor() { | 752 | QuickEditBase* MainWindow::quickEditor() { |
752 | return m_curQuick; | 753 | return m_curQuick; |
753 | } | 754 | } |
754 | void MainWindow::slotComplete( int uid ) { | 755 | void MainWindow::slotComplete( int uid ) { |
755 | slotComplete( event(uid) ); | 756 | slotComplete( event(uid) ); |
756 | } | 757 | } |
757 | void MainWindow::slotComplete( const OPimTodo& todo ) { | 758 | void MainWindow::slotComplete( const OPimTodo& todo ) { |
758 | OPimTodo to = todo; | 759 | OPimTodo to = todo; |
@@ -773,33 +774,33 @@ void MainWindow::slotComplete( const OPimTodo& todo ) { | |||
773 | if ( to.hasRecurrence() && to.isCompleted() ) { | 774 | if ( to.hasRecurrence() && to.isCompleted() ) { |
774 | OPimTodo to2( to ); | 775 | OPimTodo to2( to ); |
775 | 776 | ||
776 | /* the spinned off one won't recur anymore */ | 777 | /* the spinned off one won't recur anymore */ |
777 | to.setRecurrence( OPimRecurrence() ); | 778 | to.setRecurrence( OPimRecurrence() ); |
778 | 779 | ||
779 | OPimRecurrence rec = to2.recurrence(); | 780 | OPimRecurrence rec = to2.recurrence(); |
780 | rec.setStart( to.dueDate() ); | 781 | rec.setStart( to.dueDate() ); |
781 | to2.setRecurrence( rec ); | 782 | to2.setRecurrence( rec ); |
782 | /* | 783 | /* |
783 | * if there is a next occurence | 784 | * if there is a next occurence |
784 | * from the duedate of the last recurrance | 785 | * from the duedate of the last recurrance |
785 | */ | 786 | */ |
786 | QDate date; | 787 | QDate date; |
787 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { | 788 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { |
788 | int dayDiff = to.dueDate().daysTo( date ); | 789 | int dayDiff = to.dueDate().daysTo( date ); |
789 | qWarning("day diff is %d", dayDiff ); | 790 | Opie::Core::owarn << "day diff is " << dayDiff << oendl; |
790 | QDate inval; | 791 | QDate inval; |
791 | /* generate a new uid for the old record */ | 792 | /* generate a new uid for the old record */ |
792 | to.setUid( 1 ); | 793 | to.setUid( 1 ); |
793 | 794 | ||
794 | /* add the old one cause it has a new UID here cause it was spin off */ | 795 | /* add the old one cause it has a new UID here cause it was spin off */ |
795 | m_todoMgr.add( to ); | 796 | m_todoMgr.add( to ); |
796 | 797 | ||
797 | /* | 798 | /* |
798 | * update the due date | 799 | * update the due date |
799 | * start date | 800 | * start date |
800 | * and complete date | 801 | * and complete date |
801 | */ | 802 | */ |
802 | to2.setDueDate( date ); | 803 | to2.setDueDate( date ); |
803 | rec.setStart( date ); | 804 | rec.setStart( date ); |
804 | to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week | 805 | to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week |
805 | 806 | ||
@@ -936,41 +937,41 @@ namespace { | |||
936 | bool found = false; | 937 | bool found = false; |
937 | QDateTime oldDt = (*oldIt).dateTime(); | 938 | QDateTime oldDt = (*oldIt).dateTime(); |
938 | for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { | 939 | for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { |
939 | if ( oldDt == (*newIt).dateTime() ) { | 940 | if ( oldDt == (*newIt).dateTime() ) { |
940 | found = true; | 941 | found = true; |
941 | break; | 942 | break; |
942 | } | 943 | } |
943 | } | 944 | } |
944 | if (!found) | 945 | if (!found) |
945 | nonMatching.append( (*oldIt) ); | 946 | nonMatching.append( (*oldIt) ); |
946 | } | 947 | } |
947 | return nonMatching; | 948 | return nonMatching; |
948 | } | 949 | } |
949 | void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { | 950 | void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { |
950 | OPimNotifyManager::Alarms::ConstIterator it; | 951 | OPimNotifyManager::Alarms::ConstIterator it; |
951 | for ( it = als.begin(); it != als.end(); ++it ) { | 952 | for ( it = als.begin(); it != als.end(); ++it ) { |
952 | qWarning("Adding alarm for %s", (*it).dateTime().toString().latin1() ); | 953 | Opie::Core::owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl; |
953 | AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); | 954 | AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); |
954 | } | 955 | } |
955 | 956 | ||
956 | } | 957 | } |
957 | void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { | 958 | void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { |
958 | OPimNotifyManager::Alarms::ConstIterator it; | 959 | OPimNotifyManager::Alarms::ConstIterator it; |
959 | for ( it = als.begin(); it != als.end(); ++it ) { | 960 | for ( it = als.begin(); it != als.end(); ++it ) { |
960 | qWarning("Removinf alarm for %s", (*it).dateTime().toString().latin1() ); | 961 | Opie::Core::owarn << "Removinf alarm for " << (*it).dateTime().toString() << oendl; |
961 | AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); | 962 | AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); |
962 | } | 963 | } |
963 | } | 964 | } |
964 | } | 965 | } |
965 | 966 | ||
966 | void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { | 967 | void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { |
967 | /* | 968 | /* |
968 | * if oldTodo is not empty and has notifiers we need to find the deleted ones | 969 | * if oldTodo is not empty and has notifiers we need to find the deleted ones |
969 | */ | 970 | */ |
970 | if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) { | 971 | if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) { |
971 | OPimNotifyManager::Alarms removed; | 972 | OPimNotifyManager::Alarms removed; |
972 | OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms(); | 973 | OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms(); |
973 | if (!newTodo.hasNotifiers() ) | 974 | if (!newTodo.hasNotifiers() ) |
974 | removed = oldAls; | 975 | removed = oldAls; |
975 | else | 976 | else |
976 | removed = findNonMatching( oldAls, newTodo.notifiers().alarms() ); | 977 | removed = findNonMatching( oldAls, newTodo.notifiers().alarms() ); |
diff --git a/core/pim/todo/opie-todo.control b/core/pim/todo/opie-todo.control index 47c2b67..3a65c04 100644 --- a/core/pim/todo/opie-todo.control +++ b/core/pim/todo/opie-todo.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-todo | 1 | Package: opie-todo |
2 | Files: plugins/application/libtodolist.so* bin/todolist apps/1Pim/todo.desktop | 2 | Files: plugins/application/libtodolist.so* bin/todolist apps/1Pim/todo.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/pim | 4 | Section: opie/pim |
5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> | 5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, libopiecore2, libopieui2, libopiepim2, opie-pics, libopiedb2 | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2, libopiepim2, opie-pics |
8 | Description: Todo list manager | 8 | Description: Todo list manager |
9 | A Todo list manager for the Opie environment. | 9 | A Todo list manager for the Opie environment. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp index a8349c1..55a3dd5 100644 --- a/core/pim/todo/otaskeditor.cpp +++ b/core/pim/todo/otaskeditor.cpp | |||
@@ -1,18 +1,20 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | 2 | ||
3 | #include <opie2/odebug.h> | ||
4 | |||
3 | #include "taskeditoroverview.h" | 5 | #include "taskeditoroverview.h" |
4 | #include "taskeditorstatus.h" | 6 | #include "taskeditorstatus.h" |
5 | #include "taskeditoralarms.h" | 7 | #include "taskeditoralarms.h" |
6 | 8 | ||
7 | #include "otaskeditor.h" | 9 | #include "otaskeditor.h" |
8 | 10 | ||
9 | using namespace Opie::Ui; | 11 | using namespace Opie::Ui; |
10 | using namespace Opie; | 12 | using namespace Opie; |
11 | 13 | ||
12 | OTaskEditor::OTaskEditor(int cur) | 14 | OTaskEditor::OTaskEditor(int cur) |
13 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { | 15 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { |
14 | init(); | 16 | init(); |
15 | init( cur ); | 17 | init( cur ); |
16 | } | 18 | } |
17 | OTaskEditor::OTaskEditor( const OPimTodo& to) | 19 | OTaskEditor::OTaskEditor( const OPimTodo& to) |
18 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { | 20 | : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { |
@@ -20,33 +22,33 @@ OTaskEditor::OTaskEditor( const OPimTodo& to) | |||
20 | init( to ); | 22 | init( to ); |
21 | } | 23 | } |
22 | OTaskEditor::~OTaskEditor() { | 24 | OTaskEditor::~OTaskEditor() { |
23 | 25 | ||
24 | } | 26 | } |
25 | void OTaskEditor::init( int cur ) { | 27 | void OTaskEditor::init( int cur ) { |
26 | OPimTodo to; | 28 | OPimTodo to; |
27 | to.setUid( 1 ); // generate a new uid | 29 | to.setUid( 1 ); // generate a new uid |
28 | if ( cur != 0 ) | 30 | if ( cur != 0 ) |
29 | to.setCategories( cur ); | 31 | to.setCategories( cur ); |
30 | load(to); | 32 | load(to); |
31 | } | 33 | } |
32 | void OTaskEditor::init( const OPimTodo& to ) { | 34 | void OTaskEditor::init( const OPimTodo& to ) { |
33 | load( to ); | 35 | load( to ); |
34 | } | 36 | } |
35 | OPimTodo OTaskEditor::todo()const{ | 37 | OPimTodo OTaskEditor::todo()const{ |
36 | qWarning("saving!"); | 38 | Opie::Core::owarn << "saving!" << oendl; |
37 | OPimTodo to ( m_todo ); | 39 | OPimTodo to ( m_todo ); |
38 | m_overView->save( to ); | 40 | m_overView->save( to ); |
39 | m_stat->save( to ); | 41 | m_stat->save( to ); |
40 | to.setRecurrence( m_rec->recurrence() ); | 42 | to.setRecurrence( m_rec->recurrence() ); |
41 | m_alarm->save( to ); | 43 | m_alarm->save( to ); |
42 | 44 | ||
43 | return to; | 45 | return to; |
44 | } | 46 | } |
45 | void OTaskEditor::load(const OPimTodo& to) { | 47 | void OTaskEditor::load(const OPimTodo& to) { |
46 | m_overView->load( to ); | 48 | m_overView->load( to ); |
47 | m_stat->load( to ); | 49 | m_stat->load( to ); |
48 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); | 50 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); |
49 | m_alarm->load( to ); | 51 | m_alarm->load( to ); |
50 | 52 | ||
51 | m_todo = to; | 53 | m_todo = to; |
52 | } | 54 | } |
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 0d298f4..0b1c579 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -16,41 +16,42 @@ | |||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
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 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | #include <cmath> | 29 | #include <cmath> |
30 | #include <cctype> | 30 | #include <cctype> |
31 | 31 | ||
32 | #include <qcombobox.h> | 32 | #include <opie2/odebug.h> |
33 | #include <qlineedit.h> | 33 | #include <opie2/opimrecurrence.h> |
34 | #include <qtimer.h> | ||
35 | #include <qpopupmenu.h> | ||
36 | 34 | ||
37 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
38 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
39 | 37 | ||
40 | #include <opie2/opimrecurrence.h> | 38 | #include <qcombobox.h> |
39 | #include <qlineedit.h> | ||
40 | #include <qtimer.h> | ||
41 | #include <qpopupmenu.h> | ||
41 | 42 | ||
42 | #include "mainwindow.h" | 43 | #include "mainwindow.h" |
43 | //#include "tableitems.h" | 44 | //#include "tableitems.h" |
44 | #include "tableview.h" | 45 | #include "tableview.h" |
45 | 46 | ||
46 | using namespace Todo; | 47 | using namespace Todo; |
47 | 48 | ||
48 | namespace { | 49 | namespace { |
49 | static const int BoxSize = 14; | 50 | static const int BoxSize = 14; |
50 | static const int RowHeight = 20; | 51 | static const int RowHeight = 20; |
51 | } | 52 | } |
52 | 53 | ||
53 | TableView::EditorWidget::EditorWidget() : m_wid(0l), m_row(-1), m_col(-1) { | 54 | TableView::EditorWidget::EditorWidget() : m_wid(0l), m_row(-1), m_col(-1) { |
54 | } | 55 | } |
55 | void TableView::EditorWidget::setCellWidget(QWidget* wid, int row, int col ) { | 56 | void TableView::EditorWidget::setCellWidget(QWidget* wid, int row, int col ) { |
56 | m_wid = wid; | 57 | m_wid = wid; |
@@ -181,47 +182,47 @@ int TableView::prev() { | |||
181 | if ( currentRow() - 1 < 0 ) return 0; | 182 | if ( currentRow() - 1 < 0 ) return 0; |
182 | setCurrentCell( currentRow() -1, currentColumn() ); | 183 | setCurrentCell( currentRow() -1, currentColumn() ); |
183 | return sorted().uidAt( currentRow() ); | 184 | return sorted().uidAt( currentRow() ); |
184 | 185 | ||
185 | } | 186 | } |
186 | QString TableView::currentRepresentation() { | 187 | QString TableView::currentRepresentation() { |
187 | OPimTodo to = sorted()[currentRow()]; | 188 | OPimTodo to = sorted()[currentRow()]; |
188 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; | 189 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; |
189 | } | 190 | } |
190 | /* show overdue */ | 191 | /* show overdue */ |
191 | void TableView::showOverDue( bool ) { | 192 | void TableView::showOverDue( bool ) { |
192 | clear(); | 193 | clear(); |
193 | updateView(); | 194 | updateView(); |
194 | } | 195 | } |
195 | 196 | ||
196 | void TableView::updateView( ) { | 197 | void TableView::updateView( ) { |
197 | qWarning("update view"); | 198 | Opie::Core::owarn << "update view" << oendl; |
198 | m_row = false; | 199 | m_row = false; |
199 | static int id; | 200 | static int id; |
200 | id = startTimer(4000 ); | 201 | id = startTimer(4000 ); |
201 | /* FIXME we want one page to be read! | 202 | /* FIXME we want one page to be read! |
202 | * | 203 | * |
203 | * Calculate that screensize | 204 | * Calculate that screensize |
204 | */ | 205 | */ |
205 | todoWindow()->setReadAhead( 4 ); | 206 | todoWindow()->setReadAhead( 4 ); |
206 | sort(); | 207 | sort(); |
207 | OPimTodoAccess::List::Iterator it, end; | 208 | OPimTodoAccess::List::Iterator it, end; |
208 | it = sorted().begin(); | 209 | it = sorted().begin(); |
209 | end = sorted().end(); | 210 | end = sorted().end(); |
210 | 211 | ||
211 | qWarning("setTodos"); | 212 | Opie::Core::owarn << "setTodos" << oendl; |
212 | QTime time; | 213 | QTime time; |
213 | time.start(); | 214 | time.start(); |
214 | m_enablePaint = false; | 215 | m_enablePaint = false; |
215 | setUpdatesEnabled( false ); | 216 | setUpdatesEnabled( false ); |
216 | viewport()->setUpdatesEnabled( false ); | 217 | viewport()->setUpdatesEnabled( false ); |
217 | 218 | ||
218 | setNumRows( it.count() ); | 219 | setNumRows( it.count() ); |
219 | if ( it.count() == 0 ) | 220 | if ( it.count() == 0 ) |
220 | killTimer(id); | 221 | killTimer(id); |
221 | 222 | ||
222 | // int elc = time.elapsed(); | 223 | // int elc = time.elapsed(); |
223 | setUpdatesEnabled( true ); | 224 | setUpdatesEnabled( true ); |
224 | viewport()->setUpdatesEnabled( true ); | 225 | viewport()->setUpdatesEnabled( true ); |
225 | viewport()->update(); | 226 | viewport()->update(); |
226 | 227 | ||
227 | m_enablePaint = true; | 228 | m_enablePaint = true; |
@@ -241,60 +242,60 @@ void TableView::addEvent( const OPimTodo&) { | |||
241 | /* | 242 | /* |
242 | * find the event | 243 | * find the event |
243 | * and then replace the complete row | 244 | * and then replace the complete row |
244 | */ | 245 | */ |
245 | void TableView::replaceEvent( const OPimTodo& ev) { | 246 | void TableView::replaceEvent( const OPimTodo& ev) { |
246 | addEvent( ev ); | 247 | addEvent( ev ); |
247 | } | 248 | } |
248 | /* | 249 | /* |
249 | * re aligning table can be slow too | 250 | * re aligning table can be slow too |
250 | * FIXME: look what performs better | 251 | * FIXME: look what performs better |
251 | * either this or the old align table | 252 | * either this or the old align table |
252 | */ | 253 | */ |
253 | void TableView::removeEvent( int ) { | 254 | void TableView::removeEvent( int ) { |
254 | updateView(); | 255 | updateView(); |
255 | } | 256 | } |
256 | void TableView::setShowCompleted( bool b) { | 257 | void TableView::setShowCompleted( bool b) { |
257 | qWarning("Show Completed %d" , b ); | 258 | Opie::Core::owarn << "Show Completed " << b << oendl; |
258 | updateView(); | 259 | updateView(); |
259 | } | 260 | } |
260 | void TableView::setShowDeadline( bool b ) { | 261 | void TableView::setShowDeadline( bool b ) { |
261 | qWarning( "Show DeadLine %d" , b ); | 262 | Opie::Core::owarn << "Show Deadline " << b << oendl; |
262 | if ( b ) | 263 | if ( b ) |
263 | showColumn( 3 ); | 264 | showColumn( 3 ); |
264 | else | 265 | else |
265 | hideColumn( 3 ); | 266 | hideColumn( 3 ); |
266 | 267 | ||
267 | // Try to intelligently size columns | 268 | // Try to intelligently size columns |
268 | // TODO - would use width() below, but doesn't have valid value at time of c'tor | 269 | // TODO - would use width() below, but doesn't have valid value at time of c'tor |
269 | int col2width = 238; | 270 | int col2width = 238; |
270 | int width = m_pic_completed.width(); | 271 | int width = m_pic_completed.width(); |
271 | setColumnWidth( 0, width ); | 272 | setColumnWidth( 0, width ); |
272 | col2width -= width; | 273 | col2width -= width; |
273 | width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; | 274 | width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; |
274 | setColumnWidth( 1, width ); | 275 | setColumnWidth( 1, width ); |
275 | col2width -= width; | 276 | col2width -= width; |
276 | if ( b ) { | 277 | if ( b ) { |
277 | width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; | 278 | width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; |
278 | setColumnWidth( 3, width ); | 279 | setColumnWidth( 3, width ); |
279 | col2width -= width; | 280 | col2width -= width; |
280 | } | 281 | } |
281 | setColumnWidth( 2, col2width ); | 282 | setColumnWidth( 2, col2width ); |
282 | } | 283 | } |
283 | void TableView::setShowCategory( const QString& str) { | 284 | void TableView::setShowCategory( const QString& str) { |
284 | qWarning("setShowCategory"); | 285 | Opie::Core::owarn << "setShowCategory" << oendl; |
285 | if ( str != m_oleCat || m_first ) | 286 | if ( str != m_oleCat || m_first ) |
286 | updateView(); | 287 | updateView(); |
287 | 288 | ||
288 | m_oleCat = str; | 289 | m_oleCat = str; |
289 | m_first = false; | 290 | m_first = false; |
290 | 291 | ||
291 | } | 292 | } |
292 | void TableView::clear() { | 293 | void TableView::clear() { |
293 | setNumRows(0); | 294 | setNumRows(0); |
294 | } | 295 | } |
295 | void TableView::slotClicked(int row, int col, int, | 296 | void TableView::slotClicked(int row, int col, int, |
296 | const QPoint& point) { | 297 | const QPoint& point) { |
297 | if ( m_editorWidget.cellWidget() ) { | 298 | if ( m_editorWidget.cellWidget() ) { |
298 | //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | 299 | //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); |
299 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | 300 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), |
300 | true, true ); | 301 | true, true ); |
@@ -333,56 +334,57 @@ void TableView::slotClicked(int row, int col, int, | |||
333 | m_menuTimer->stop(); | 334 | m_menuTimer->stop(); |
334 | showTodo( ui ); | 335 | showTodo( ui ); |
335 | break; | 336 | break; |
336 | } | 337 | } |
337 | case 3: { | 338 | case 3: { |
338 | m_menuTimer->stop(); | 339 | m_menuTimer->stop(); |
339 | TodoView::edit( ui ); | 340 | TodoView::edit( ui ); |
340 | break; | 341 | break; |
341 | } | 342 | } |
342 | } | 343 | } |
343 | 344 | ||
344 | 345 | ||
345 | } | 346 | } |
346 | void TableView::slotPressed(int row, int col, int, | 347 | void TableView::slotPressed(int row, int col, int, |
347 | const QPoint& point) { | 348 | const QPoint& point) { |
348 | 349 | ||
349 | qWarning("pressed row %d col %d x:%d+y:%d", row,col,point.x(),point.y() ); | 350 | Opie::Core::owarn << "pressed row " << row << " col " << col << " x:" << point.x() |
351 | << "+y:" << point.y() << oendl; | ||
350 | m_prevP = point; | 352 | m_prevP = point; |
351 | /* TextColumn column */ | 353 | /* TextColumn column */ |
352 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) | 354 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) |
353 | m_menuTimer->start( 750, TRUE ); | 355 | m_menuTimer->start( 750, TRUE ); |
354 | } | 356 | } |
355 | void TableView::slotValueChanged( int, int ) { | 357 | void TableView::slotValueChanged( int, int ) { |
356 | qWarning("Value Changed"); | 358 | Opie::Core::owarn << "Value Changed" << oendl; |
357 | } | 359 | } |
358 | void TableView::slotCurrentChanged(int, int ) { | 360 | void TableView::slotCurrentChanged(int, int ) { |
359 | m_menuTimer->stop(); | 361 | m_menuTimer->stop(); |
360 | } | 362 | } |
361 | QWidget* TableView::widget() { | 363 | QWidget* TableView::widget() { |
362 | return this; | 364 | return this; |
363 | } | 365 | } |
364 | /* | 366 | /* |
365 | * We need to overwrite sortColumn | 367 | * We need to overwrite sortColumn |
366 | * because we want to sort whole row | 368 | * because we want to sort whole row |
367 | * based | 369 | * based |
368 | * We event want to set the setOrder | 370 | * We event want to set the setOrder |
369 | * to a sort() and update() | 371 | * to a sort() and update() |
370 | */ | 372 | */ |
371 | void TableView::sortColumn( int col, bool asc, bool ) { | 373 | void TableView::sortColumn( int col, bool asc, bool ) { |
372 | qWarning("bool %d", asc ); | 374 | Opie::Core::owarn << "bool " << asc << oendl; |
373 | setSortOrder( col ); | 375 | setSortOrder( col ); |
374 | setAscending( asc ); | 376 | setAscending( asc ); |
375 | updateView(); | 377 | updateView(); |
376 | } | 378 | } |
377 | void TableView::viewportPaintEvent( QPaintEvent* e) { | 379 | void TableView::viewportPaintEvent( QPaintEvent* e) { |
378 | if (m_enablePaint ) | 380 | if (m_enablePaint ) |
379 | QTable::viewportPaintEvent( e ); | 381 | QTable::viewportPaintEvent( e ); |
380 | } | 382 | } |
381 | /* | 383 | /* |
382 | * This segment is copyrighted by TT | 384 | * This segment is copyrighted by TT |
383 | * it was taken from their todolist | 385 | * it was taken from their todolist |
384 | * application this code is GPL | 386 | * application this code is GPL |
385 | */ | 387 | */ |
386 | void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { | 388 | void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { |
387 | const QColorGroup &cg = colorGroup(); | 389 | const QColorGroup &cg = colorGroup(); |
388 | 390 | ||
@@ -479,33 +481,33 @@ QWidget* TableView::createEditor(int row, int col, bool )const { | |||
479 | } | 481 | } |
480 | combo->setCurrentItem( sorted()[row].priority()-1 ); | 482 | combo->setCurrentItem( sorted()[row].priority()-1 ); |
481 | return combo; | 483 | return combo; |
482 | } | 484 | } |
483 | /* summary */ | 485 | /* summary */ |
484 | case 2:{ | 486 | case 2:{ |
485 | QLineEdit* edit = new QLineEdit( viewport() ); | 487 | QLineEdit* edit = new QLineEdit( viewport() ); |
486 | edit->setText( sorted()[row].summary() ); | 488 | edit->setText( sorted()[row].summary() ); |
487 | return edit; | 489 | return edit; |
488 | } | 490 | } |
489 | case 0: | 491 | case 0: |
490 | default: | 492 | default: |
491 | return 0l; | 493 | return 0l; |
492 | } | 494 | } |
493 | } | 495 | } |
494 | void TableView::setCellContentFromEditor(int row, int col ) { | 496 | void TableView::setCellContentFromEditor(int row, int col ) { |
495 | qWarning("set cell content from editor"); | 497 | Opie::Core::owarn << "set cell content from editor" << oendl; |
496 | if ( col == 1 ) { | 498 | if ( col == 1 ) { |
497 | QWidget* wid = cellWidget(row, 1 ); | 499 | QWidget* wid = cellWidget(row, 1 ); |
498 | if ( wid->inherits("QComboBox") ) { | 500 | if ( wid->inherits("QComboBox") ) { |
499 | int pri = ((QComboBox*)wid)->currentItem() + 1; | 501 | int pri = ((QComboBox*)wid)->currentItem() + 1; |
500 | OPimTodo todo = sorted()[row]; | 502 | OPimTodo todo = sorted()[row]; |
501 | if ( todo.priority() != pri ) { | 503 | if ( todo.priority() != pri ) { |
502 | todo.setPriority( pri ); | 504 | todo.setPriority( pri ); |
503 | TodoView::update( todo.uid(), todo ); | 505 | TodoView::update( todo.uid(), todo ); |
504 | updateView(); | 506 | updateView(); |
505 | } | 507 | } |
506 | } | 508 | } |
507 | }else if ( col == 2) { | 509 | }else if ( col == 2) { |
508 | QWidget* wid = cellWidget(row, 2); | 510 | QWidget* wid = cellWidget(row, 2); |
509 | if ( wid->inherits("QLineEdit") ) { | 511 | if ( wid->inherits("QLineEdit") ) { |
510 | QString text = ((QLineEdit*)wid)->text(); | 512 | QString text = ((QLineEdit*)wid)->text(); |
511 | OPimTodo todo = sorted()[row]; | 513 | OPimTodo todo = sorted()[row]; |
@@ -515,33 +517,33 @@ void TableView::setCellContentFromEditor(int row, int col ) { | |||
515 | updateView(); | 517 | updateView(); |
516 | } | 518 | } |
517 | } | 519 | } |
518 | } | 520 | } |
519 | } | 521 | } |
520 | void TableView::slotPriority() { | 522 | void TableView::slotPriority() { |
521 | setCellContentFromEditor( currentRow(), currentColumn() ); | 523 | setCellContentFromEditor( currentRow(), currentColumn() ); |
522 | } | 524 | } |
523 | /* | 525 | /* |
524 | * We'll use the TimerEvent to read ahead or to keep the cahce always | 526 | * We'll use the TimerEvent to read ahead or to keep the cahce always |
525 | * filled enough. | 527 | * filled enough. |
526 | * We will try to read ahead 4 items in both ways | 528 | * We will try to read ahead 4 items in both ways |
527 | * up and down. On odd or even we will currentRow()+-4 or +-9 | 529 | * up and down. On odd or even we will currentRow()+-4 or +-9 |
528 | * | 530 | * |
529 | */ | 531 | */ |
530 | void TableView::timerEvent( QTimerEvent* ) { | 532 | void TableView::timerEvent( QTimerEvent* ) { |
531 | // qWarning("sorted %d", sorted().count() ); | 533 | // Opie::Core::owarn << "sorted " << sorted().count() << oendl; |
532 | if (sorted().count() == 0 ) | 534 | if (sorted().count() == 0 ) |
533 | return; | 535 | return; |
534 | 536 | ||
535 | int row = currentRow(); | 537 | int row = currentRow(); |
536 | if ( m_row ) { | 538 | if ( m_row ) { |
537 | int ro = row-4; | 539 | int ro = row-4; |
538 | if (ro < 0 ) ro = 0; | 540 | if (ro < 0 ) ro = 0; |
539 | sorted()[ro]; | 541 | sorted()[ro]; |
540 | 542 | ||
541 | ro = row+4; | 543 | ro = row+4; |
542 | sorted()[ro]; | 544 | sorted()[ro]; |
543 | } else { | 545 | } else { |
544 | int ro = row + 8; | 546 | int ro = row + 8; |
545 | sorted()[ro]; | 547 | sorted()[ro]; |
546 | 548 | ||
547 | ro = row-8; | 549 | ro = row-8; |
@@ -563,33 +565,33 @@ void TableView::timerEvent( QTimerEvent* ) { | |||
563 | * Then we check if they're some pixel horizontal away | 565 | * Then we check if they're some pixel horizontal away |
564 | * if the distance between the two points is greater than | 566 | * if the distance between the two points is greater than |
565 | * 8 we mark the underlying todo as completed and do a repaint | 567 | * 8 we mark the underlying todo as completed and do a repaint |
566 | * | 568 | * |
567 | * BUG: When clicking on the Due column and it's scrollable | 569 | * BUG: When clicking on the Due column and it's scrollable |
568 | * the todo is marked as completed... | 570 | * the todo is marked as completed... |
569 | * REASON: QTable is doing auto scrolling which leads to a move | 571 | * REASON: QTable is doing auto scrolling which leads to a move |
570 | * in the x coordinate and this way it's able to pass the | 572 | * in the x coordinate and this way it's able to pass the |
571 | * m_completeStrokeWidth criteria | 573 | * m_completeStrokeWidth criteria |
572 | * WORKAROUND: strike through needs to strike through the same | 574 | * WORKAROUND: strike through needs to strike through the same |
573 | * row and two columns! | 575 | * row and two columns! |
574 | */ | 576 | */ |
575 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { | 577 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { |
576 | int row = rowAt(m_prevP.y()); | 578 | int row = rowAt(m_prevP.y()); |
577 | int colOld = columnAt(m_prevP.x() ); | 579 | int colOld = columnAt(m_prevP.x() ); |
578 | int colNew = columnAt(e->x() ); | 580 | int colNew = columnAt(e->x() ); |
579 | qWarning("colNew: %d colOld: %d", colNew, colOld ); | 581 | Opie::Core::owarn << "colNew: " << colNew << " colOld: " << colOld << oendl; |
580 | if ( row == rowAt( e->y() ) && row != -1 && | 582 | if ( row == rowAt( e->y() ) && row != -1 && |
581 | colOld != colNew ) { | 583 | colOld != colNew ) { |
582 | TodoView::complete( sorted()[row] ); | 584 | TodoView::complete( sorted()[row] ); |
583 | return; | 585 | return; |
584 | } | 586 | } |
585 | QTable::contentsMouseReleaseEvent( e ); | 587 | QTable::contentsMouseReleaseEvent( e ); |
586 | } | 588 | } |
587 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { | 589 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { |
588 | m_menuTimer->stop(); | 590 | m_menuTimer->stop(); |
589 | QTable::contentsMouseMoveEvent( e ); | 591 | QTable::contentsMouseMoveEvent( e ); |
590 | } | 592 | } |
591 | void TableView::keyPressEvent( QKeyEvent* event) { | 593 | void TableView::keyPressEvent( QKeyEvent* event) { |
592 | if ( m_editorWidget.cellWidget() ) { | 594 | if ( m_editorWidget.cellWidget() ) { |
593 | // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | 595 | // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); |
594 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | 596 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), |
595 | true, true ); | 597 | true, true ); |
diff --git a/core/pim/todo/templatedialog.cpp b/core/pim/todo/templatedialog.cpp index 8dfbd0b..32327a6 100644 --- a/core/pim/todo/templatedialog.cpp +++ b/core/pim/todo/templatedialog.cpp | |||
@@ -1,16 +1,18 @@ | |||
1 | #include <opie2/odebug.h> | ||
2 | |||
1 | #include <qpushbutton.h> | 3 | #include <qpushbutton.h> |
2 | #include <qhbox.h> | 4 | #include <qhbox.h> |
3 | #include <qlayout.h> | 5 | #include <qlayout.h> |
4 | #include <qlistview.h> | 6 | #include <qlistview.h> |
5 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
6 | 8 | ||
7 | #include "templatedialog.h" | 9 | #include "templatedialog.h" |
8 | 10 | ||
9 | 11 | ||
10 | using namespace Todo; | 12 | using namespace Todo; |
11 | 13 | ||
12 | /* TRANSLATOR Todo::TemplateDialog */ | 14 | /* TRANSLATOR Todo::TemplateDialog */ |
13 | 15 | ||
14 | TemplateDialog::TemplateDialog( QWidget* widget ) | 16 | TemplateDialog::TemplateDialog( QWidget* widget ) |
15 | : QDialog( widget, "TemplateDialog", TRUE ) | 17 | : QDialog( widget, "TemplateDialog", TRUE ) |
16 | { | 18 | { |
@@ -36,27 +38,27 @@ TemplateDialog::TemplateDialog( QWidget* widget ) | |||
36 | connect(m_rem, SIGNAL(clicked() ), | 38 | connect(m_rem, SIGNAL(clicked() ), |
37 | this, SLOT(slotRemove() ) ); | 39 | this, SLOT(slotRemove() ) ); |
38 | connect(m_lne, SIGNAL(returnPressed() ), | 40 | connect(m_lne, SIGNAL(returnPressed() ), |
39 | this, SLOT(slotReturn() ) ); | 41 | this, SLOT(slotReturn() ) ); |
40 | 42 | ||
41 | } | 43 | } |
42 | TemplateDialog::~TemplateDialog() { | 44 | TemplateDialog::~TemplateDialog() { |
43 | // Qt does delete our widgets | 45 | // Qt does delete our widgets |
44 | } | 46 | } |
45 | QListView* TemplateDialog::listView() { | 47 | QListView* TemplateDialog::listView() { |
46 | return m_list; | 48 | return m_list; |
47 | } | 49 | } |
48 | QLineEdit* TemplateDialog::edit() { | 50 | QLineEdit* TemplateDialog::edit() { |
49 | return m_lne; | 51 | return m_lne; |
50 | } | 52 | } |
51 | void TemplateDialog::slotAdd() { | 53 | void TemplateDialog::slotAdd() { |
52 | qWarning("Not Implemented here"); | 54 | Opie::Core::owarn << "Not Implemented here" << oendl; |
53 | } | 55 | } |
54 | void TemplateDialog::slotRemove() { | 56 | void TemplateDialog::slotRemove() { |
55 | qWarning("Not Implemented here"); | 57 | Opie::Core::owarn << "Not Implemented here" << oendl; |
56 | } | 58 | } |
57 | void TemplateDialog::slotEdit() { | 59 | void TemplateDialog::slotEdit() { |
58 | qWarning("Not Implemented here"); | 60 | Opie::Core::owarn << "Not Implemented here" << oendl; |
59 | } | 61 | } |
60 | void TemplateDialog::slotReturn() { | 62 | void TemplateDialog::slotReturn() { |
61 | qWarning("Not Implemented here"); | 63 | Opie::Core::owarn << "Not Implemented here" << oendl; |
62 | } | 64 | } |
diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp index 4b5ecb1..7857d52 100644 --- a/core/pim/todo/todoeditor.cpp +++ b/core/pim/todo/todoeditor.cpp | |||
@@ -1,50 +1,51 @@ | |||
1 | #include <opie2/odebug.h> | ||
1 | 2 | ||
2 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
3 | 4 | ||
4 | #include "otaskeditor.h" | 5 | #include "otaskeditor.h" |
5 | #include "todoeditor.h" | 6 | #include "todoeditor.h" |
6 | 7 | ||
7 | using namespace Opie; | 8 | using namespace Opie; |
8 | using namespace Todo; | 9 | using namespace Todo; |
9 | 10 | ||
10 | Editor::Editor() { | 11 | Editor::Editor() { |
11 | m_accepted = false; | 12 | m_accepted = false; |
12 | m_self = 0l; | 13 | m_self = 0l; |
13 | } | 14 | } |
14 | Editor::~Editor() { | 15 | Editor::~Editor() { |
15 | delete m_self; | 16 | delete m_self; |
16 | m_self = 0; | 17 | m_self = 0; |
17 | } | 18 | } |
18 | OPimTodo Editor::newTodo( int cur, | 19 | OPimTodo Editor::newTodo( int cur, |
19 | QWidget*) { | 20 | QWidget*) { |
20 | 21 | ||
21 | OTaskEditor *e = self(); | 22 | OTaskEditor *e = self(); |
22 | e->setCaption( QObject::tr("Enter Task") ); | 23 | e->setCaption( QObject::tr("Enter Task") ); |
23 | e->init( cur ); | 24 | e->init( cur ); |
24 | 25 | ||
25 | int ret = QPEApplication::execDialog( e ); | 26 | int ret = QPEApplication::execDialog( e ); |
26 | 27 | ||
27 | if ( QDialog::Accepted == ret ) { | 28 | if ( QDialog::Accepted == ret ) { |
28 | m_accepted = true; | 29 | m_accepted = true; |
29 | }else | 30 | }else |
30 | m_accepted = false; | 31 | m_accepted = false; |
31 | 32 | ||
32 | OPimTodo ev = e->todo(); | 33 | OPimTodo ev = e->todo(); |
33 | qWarning("Todo uid"); | 34 | Opie::Core::owarn << "Todo uid" << oendl; |
34 | qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() ); | 35 | Opie::Core::owarn << "Todo " << ev.summary() << " " << ev.progress() << " " << ev.isCompleted() << oendl; |
35 | ev.setUid(1); | 36 | ev.setUid(1); |
36 | 37 | ||
37 | return ev; | 38 | return ev; |
38 | } | 39 | } |
39 | OPimTodo Editor::edit( QWidget *, | 40 | OPimTodo Editor::edit( QWidget *, |
40 | const OPimTodo& todo ) { | 41 | const OPimTodo& todo ) { |
41 | OTaskEditor *e = self(); | 42 | OTaskEditor *e = self(); |
42 | e->init( todo ); | 43 | e->init( todo ); |
43 | e->setCaption( QObject::tr( "Edit Task" ) ); | 44 | e->setCaption( QObject::tr( "Edit Task" ) ); |
44 | 45 | ||
45 | int ret = QPEApplication::execDialog( e ); | 46 | int ret = QPEApplication::execDialog( e ); |
46 | 47 | ||
47 | OPimTodo ev = e->todo(); | 48 | OPimTodo ev = e->todo(); |
48 | if ( ret == QDialog::Accepted ) | 49 | if ( ret == QDialog::Accepted ) |
49 | m_accepted = true; | 50 | m_accepted = true; |
50 | else | 51 | else |
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp index 21e1d0c..7826747 100644 --- a/core/pim/todo/todomanager.cpp +++ b/core/pim/todo/todomanager.cpp | |||
@@ -12,54 +12,57 @@ | |||
12 | .i_,=:_. -<s. This program is distributed in the hope that | 12 | .i_,=:_. -<s. This program is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
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 | |||
29 | #include <opie2/odebug.h> | ||
30 | |||
28 | #include <qpe/categoryselect.h> | 31 | #include <qpe/categoryselect.h> |
29 | 32 | ||
30 | #include "todomanager.h" | 33 | #include "todomanager.h" |
31 | 34 | ||
32 | using namespace Todo; | 35 | using namespace Todo; |
33 | 36 | ||
34 | TodoManager::TodoManager( QObject *obj ) | 37 | TodoManager::TodoManager( QObject *obj ) |
35 | : QObject( obj ) { | 38 | : QObject( obj ) { |
36 | m_db = 0l; | 39 | m_db = 0l; |
37 | QTime time; | 40 | QTime time; |
38 | time.start(); | 41 | time.start(); |
39 | int el = time.elapsed(); | 42 | int el = time.elapsed(); |
40 | qWarning("QTimer for loading %d", el/1000 ); | 43 | Opie::Core::owarn << "QTimer for loading " << el/1000 << oendl; |
41 | } | 44 | } |
42 | TodoManager::~TodoManager() { | 45 | TodoManager::~TodoManager() { |
43 | delete m_db; | 46 | delete m_db; |
44 | } | 47 | } |
45 | OPimTodo TodoManager::event(int uid ) { | 48 | OPimTodo TodoManager::event(int uid ) { |
46 | return m_db->find( uid ); | 49 | return m_db->find( uid ); |
47 | } | 50 | } |
48 | void TodoManager::updateList() { | 51 | void TodoManager::updateList() { |
49 | qWarning("update list"); | 52 | Opie::Core::owarn << "update lists" << oendl; |
50 | m_list = m_db->allRecords(); | 53 | m_list = m_db->allRecords(); |
51 | } | 54 | } |
52 | OPimTodoAccess::List TodoManager::list() const{ | 55 | OPimTodoAccess::List TodoManager::list() const{ |
53 | return m_list; | 56 | return m_list; |
54 | } | 57 | } |
55 | OPimTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) { | 58 | OPimTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) { |
56 | return m_db->sorted( asc, so, f, cat ); | 59 | return m_db->sorted( asc, so, f, cat ); |
57 | } | 60 | } |
58 | OPimTodoAccess::List::Iterator TodoManager::overDue() { | 61 | OPimTodoAccess::List::Iterator TodoManager::overDue() { |
59 | int filter = 2 | 1; | 62 | int filter = 2 | 1; |
60 | m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca ); | 63 | m_list = m_db->sorted(m_asc, m_sortOrder, filter, m_ca ); |
61 | m_it = m_list.begin(); | 64 | m_it = m_list.begin(); |
62 | return m_it; | 65 | return m_it; |
63 | } | 66 | } |
64 | OPimTodoAccess::List::Iterator TodoManager::fromTo( const QDate& start, | 67 | OPimTodoAccess::List::Iterator TodoManager::fromTo( const QDate& start, |
65 | const QDate& end ) { | 68 | const QDate& end ) { |
diff --git a/core/pim/todo/todotemplatemanager.cpp b/core/pim/todo/todotemplatemanager.cpp index eeac51b..0b20d5a 100644 --- a/core/pim/todo/todotemplatemanager.cpp +++ b/core/pim/todo/todotemplatemanager.cpp | |||
@@ -1,16 +1,17 @@ | |||
1 | #include <opie2/odebug.h> | ||
1 | #include <opie2/otodoaccess.h> | 2 | #include <opie2/otodoaccess.h> |
2 | #include <opie2/otodoaccessxml.h> | 3 | #include <opie2/otodoaccessxml.h> |
3 | 4 | ||
4 | #include <qpe/config.h> | 5 | #include <qpe/config.h> |
5 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
6 | 7 | ||
7 | #include "todotemplatemanager.h" | 8 | #include "todotemplatemanager.h" |
8 | 9 | ||
9 | 10 | ||
10 | using namespace Todo; | 11 | using namespace Todo; |
11 | 12 | ||
12 | TemplateManager::TemplateManager() { | 13 | TemplateManager::TemplateManager() { |
13 | m_path = Global::applicationFileName("todolist", "templates.xml"); | 14 | m_path = Global::applicationFileName("todolist", "templates.xml"); |
14 | } | 15 | } |
15 | TemplateManager::~TemplateManager() { | 16 | TemplateManager::~TemplateManager() { |
16 | save(); | 17 | save(); |
@@ -22,55 +23,55 @@ void TemplateManager::load() { | |||
22 | OPimTodoAccess todoDB(xml ); | 23 | OPimTodoAccess todoDB(xml ); |
23 | todoDB.load(); | 24 | todoDB.load(); |
24 | 25 | ||
25 | OPimTodoAccess::List::Iterator it; | 26 | OPimTodoAccess::List::Iterator it; |
26 | OPimTodoAccess::List list = todoDB.allRecords(); | 27 | OPimTodoAccess::List list = todoDB.allRecords(); |
27 | for ( it = list.begin(); it != list.end(); ++it ) { | 28 | for ( it = list.begin(); it != list.end(); ++it ) { |
28 | OPimTodo ev = (*it); | 29 | OPimTodo ev = (*it); |
29 | conf.setGroup( QString::number( ev.uid() ) ); | 30 | conf.setGroup( QString::number( ev.uid() ) ); |
30 | QString str = conf.readEntry("Name", QString::null ); | 31 | QString str = conf.readEntry("Name", QString::null ); |
31 | if (str.isEmpty() ) | 32 | if (str.isEmpty() ) |
32 | continue; | 33 | continue; |
33 | 34 | ||
34 | m_templates.insert( str, ev ); | 35 | m_templates.insert( str, ev ); |
35 | } | 36 | } |
36 | } | 37 | } |
37 | void TemplateManager::save() { | 38 | void TemplateManager::save() { |
38 | qWarning("Saving!!!!"); | 39 | Opie::Core::owarn << "Saving!!!!" << oendl; |
39 | Config conf("todolist_templates"); | 40 | Config conf("todolist_templates"); |
40 | 41 | ||
41 | OPimTodoAccessXML *res = new OPimTodoAccessXML( "template", | 42 | OPimTodoAccessXML *res = new OPimTodoAccessXML( "template", |
42 | m_path ); | 43 | m_path ); |
43 | OPimTodoAccess db(res); | 44 | OPimTodoAccess db(res); |
44 | db.load(); | 45 | db.load(); |
45 | db.clear(); | 46 | db.clear(); |
46 | 47 | ||
47 | 48 | ||
48 | QMap<QString, OPimTodo>::Iterator it; | 49 | QMap<QString, OPimTodo>::Iterator it; |
49 | for ( it = m_templates.begin(); it != m_templates.end(); ++it ) { | 50 | for ( it = m_templates.begin(); it != m_templates.end(); ++it ) { |
50 | OPimTodo ev = it.data(); | 51 | OPimTodo ev = it.data(); |
51 | conf.setGroup( QString::number( ev.uid() ) ); | 52 | conf.setGroup( QString::number( ev.uid() ) ); |
52 | qWarning("Name" + it.key() ); | 53 | Opie::Core::owarn << "Name " << it.key() << oendl; |
53 | conf.writeEntry("Name", it.key() ); | 54 | conf.writeEntry("Name", it.key() ); |
54 | db.add( ev ); | 55 | db.add( ev ); |
55 | } | 56 | } |
56 | db.save(); | 57 | db.save(); |
57 | } | 58 | } |
58 | void TemplateManager::addEvent( const QString& str, | 59 | void TemplateManager::addEvent( const QString& str, |
59 | const OPimTodo& ev) { | 60 | const OPimTodo& ev) { |
60 | qWarning("AddEvent"+ str ); | 61 | Opie::Core::owarn << "AddEvent " << str << oendl; |
61 | OPimTodo todo = ev; | 62 | OPimTodo todo = ev; |
62 | if( ev.uid() == 0 ) | 63 | if( ev.uid() == 0 ) |
63 | todo.setUid(1); // generate a new uid | 64 | todo.setUid(1); // generate a new uid |
64 | 65 | ||
65 | m_templates.replace( str, todo ); | 66 | m_templates.replace( str, todo ); |
66 | } | 67 | } |
67 | void TemplateManager::removeEvent( const QString& str ) { | 68 | void TemplateManager::removeEvent( const QString& str ) { |
68 | m_templates.remove( str ); | 69 | m_templates.remove( str ); |
69 | } | 70 | } |
70 | QStringList TemplateManager::templates() const { | 71 | QStringList TemplateManager::templates() const { |
71 | QStringList list; | 72 | QStringList list; |
72 | QMap<QString, OPimTodo>::ConstIterator it; | 73 | QMap<QString, OPimTodo>::ConstIterator it; |
73 | for (it = m_templates.begin(); it != m_templates.end(); ++it ) { | 74 | for (it = m_templates.begin(); it != m_templates.end(); ++it ) { |
74 | list << it.key(); | 75 | list << it.key(); |
75 | } | 76 | } |
76 | 77 | ||
diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp index d99cf77..03e1060 100644 --- a/core/pim/todo/todoview.cpp +++ b/core/pim/todo/todoview.cpp | |||
@@ -1,59 +1,61 @@ | |||
1 | #include "mainwindow.h" | 1 | #include "mainwindow.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | ||
4 | |||
3 | #include "todoview.h" | 5 | #include "todoview.h" |
4 | 6 | ||
5 | using namespace Todo; | 7 | using namespace Todo; |
6 | 8 | ||
7 | 9 | ||
8 | 10 | ||
9 | 11 | ||
10 | TodoView::TodoView( MainWindow* win ) | 12 | TodoView::TodoView( MainWindow* win ) |
11 | : m_main( win ) | 13 | : m_main( win ) |
12 | { | 14 | { |
13 | m_asc = false; | 15 | m_asc = false; |
14 | m_sortOrder = -1; | 16 | m_sortOrder = -1; |
15 | } | 17 | } |
16 | TodoView::~TodoView() { | 18 | TodoView::~TodoView() { |
17 | }; | 19 | }; |
18 | MainWindow* TodoView::todoWindow() { | 20 | MainWindow* TodoView::todoWindow() { |
19 | return m_main; | 21 | return m_main; |
20 | } | 22 | } |
21 | 23 | ||
22 | OPimTodo TodoView::event(int uid ) { | 24 | OPimTodo TodoView::event(int uid ) { |
23 | return m_main->event( uid ); | 25 | return m_main->event( uid ); |
24 | } | 26 | } |
25 | OPimTodoAccess::List TodoView::list(){ | 27 | OPimTodoAccess::List TodoView::list(){ |
26 | todoWindow()->updateList(); | 28 | todoWindow()->updateList(); |
27 | return todoWindow()->list(); | 29 | return todoWindow()->list(); |
28 | } | 30 | } |
29 | OPimTodoAccess::List TodoView::sorted()const{ | 31 | OPimTodoAccess::List TodoView::sorted()const{ |
30 | return m_sort; | 32 | return m_sort; |
31 | } | 33 | } |
32 | void TodoView::sort() { | 34 | void TodoView::sort() { |
33 | m_sort = todoWindow()->sorted(m_asc,m_sortOrder ); | 35 | m_sort = todoWindow()->sorted(m_asc,m_sortOrder ); |
34 | qWarning("m_sort.count() = %d", m_sort.count() ); | 36 | Opie::Core::owarn << "m_sort.count() = " << m_sort.count() << oendl; |
35 | } | 37 | } |
36 | void TodoView::sort(int sort) { | 38 | void TodoView::sort(int sort) { |
37 | m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); | 39 | m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); |
38 | } | 40 | } |
39 | void TodoView::setSortOrder( int order ) { | 41 | void TodoView::setSortOrder( int order ) { |
40 | m_sortOrder = order; | 42 | m_sortOrder = order; |
41 | } | 43 | } |
42 | void TodoView::setAscending( bool b ) { | 44 | void TodoView::setAscending( bool b ) { |
43 | qWarning("setAscending %d", b ); | 45 | Opie::Core::owarn << "setAscending " << b << oendl; |
44 | m_asc = b; | 46 | m_asc = b; |
45 | } | 47 | } |
46 | void TodoView::update(int, const SmallTodo& ) { | 48 | void TodoView::update(int, const SmallTodo& ) { |
47 | //m_main->slotUpate1( uid, to ); | 49 | //m_main->slotUpate1( uid, to ); |
48 | } | 50 | } |
49 | void TodoView::update(int , const OPimTodo& ev ) { | 51 | void TodoView::update(int , const OPimTodo& ev ) { |
50 | m_main->updateTodo( ev ); | 52 | m_main->updateTodo( ev ); |
51 | } | 53 | } |
52 | void TodoView::showTodo( int uid ) { | 54 | void TodoView::showTodo( int uid ) { |
53 | m_main->slotShow( uid ); | 55 | m_main->slotShow( uid ); |
54 | } | 56 | } |
55 | void TodoView::edit( int uid ) { | 57 | void TodoView::edit( int uid ) { |
56 | m_main->slotEdit( uid ); | 58 | m_main->slotEdit( uid ); |
57 | } | 59 | } |
58 | void TodoView::remove( int uid ) { | 60 | void TodoView::remove( int uid ) { |
59 | m_main->m_todoMgr.remove( uid ); | 61 | m_main->m_todoMgr.remove( uid ); |