summaryrefslogtreecommitdiff
authorzecke <zecke>2004-04-04 21:35:02 (UTC)
committer zecke <zecke>2004-04-04 21:35:02 (UTC)
commit4da953f1ef0349acc5b86ee15b9e3005dabc319f (patch) (unidiff)
tree89d73beecf627948657e43557a3e5d02739a8e13
parentf664b509b5e622ab74560fb74093175e50b2790c (diff)
downloadopie-4da953f1ef0349acc5b86ee15b9e3005dabc319f.zip
opie-4da953f1ef0349acc5b86ee15b9e3005dabc319f.tar.gz
opie-4da953f1ef0349acc5b86ee15b9e3005dabc319f.tar.bz2
fix up owarn usage
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp42
-rw-r--r--core/pim/todo/otaskeditor.cpp1
-rw-r--r--core/pim/todo/tableview.cpp20
-rw-r--r--core/pim/todo/templatedialog.cpp4
-rw-r--r--core/pim/todo/todoeditor.cpp2
-rw-r--r--core/pim/todo/todomanager.cpp4
-rw-r--r--core/pim/todo/todotemplatemanager.cpp3
-rw-r--r--core/pim/todo/todoview.cpp4
8 files changed, 36 insertions, 44 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index d552928..924fde1 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -50,28 +50,28 @@
50#include <qlayout.h> 50#include <qlayout.h>
51#include <qwhatsthis.h> 51#include <qwhatsthis.h>
52 52
53#include "quickeditimpl.h" 53#include "quickeditimpl.h"
54#include "todotemplatemanager.h" 54#include "todotemplatemanager.h"
55#include "templateeditor.h" 55#include "templateeditor.h"
56#include "tableview.h" 56#include "tableview.h"
57 57
58#include "textviewshow.h" 58#include "textviewshow.h"
59#include "todoeditor.h" 59#include "todoeditor.h"
60#include "mainwindow.h" 60#include "mainwindow.h"
61 61
62using namespace Opie::Core; 62using Opie::Core::OApplicationFactory;
63OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) 63OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> )
64 64
65 using namespace Opie; 65using namespace Opie;
66using namespace Todo; 66using namespace Todo;
67 67
68MainWindow::MainWindow( QWidget* parent, 68MainWindow::MainWindow( QWidget* parent,
69 const char* name, WFlags ) 69 const char* name, WFlags )
70 : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) 70 : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp )
71{ 71{
72 if (!name) 72 if (!name)
73 setName("todo window"); 73 setName("todo window");
74 74
75 m_syncing = false; 75 m_syncing = false;
76 m_showing = false; 76 m_showing = false;
77 m_counter = 0; 77 m_counter = 0;
@@ -287,44 +287,44 @@ QPopupMenu* MainWindow::contextMenu( int , bool recur ) {
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}
298QPopupMenu* MainWindow::options() { 298QPopupMenu* MainWindow::options() {
299 Opie::Core::owarn << "Options" << oendl; 299 owarn << "Options" << oendl;
300 return m_options; 300 return m_options;
301} 301}
302QPopupMenu* MainWindow::edit() { 302QPopupMenu* MainWindow::edit() {
303 return m_edit; 303 return m_edit;
304} 304}
305QToolBar* MainWindow::toolbar() { 305QToolBar* MainWindow::toolbar() {
306 return m_tool; 306 return m_tool;
307} 307}
308OPimTodoAccess::List MainWindow::list()const { 308OPimTodoAccess::List MainWindow::list()const {
309 return m_todoMgr.list(); 309 return m_todoMgr.list();
310} 310}
311OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { 311OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
312 int cat = 0; 312 int cat = 0;
313 if ( m_curCat != QWidget::tr("All Categories") ) 313 if ( m_curCat != QWidget::tr("All Categories") )
314 cat = currentCatId(); 314 cat = currentCatId();
315 if ( m_curCat == QWidget::tr("Unfiled") ) 315 if ( m_curCat == QWidget::tr("Unfiled") )
316 cat = -1; 316 cat = -1;
317 317
318 Opie::Core::owarn << " Category " << cat << " " << m_curCat << oendl; 318 owarn << " Category " << cat << " " << m_curCat << oendl;
319 319
320 int filter = 1; 320 int filter = 1;
321 321
322 if (!m_completed ) 322 if (!m_completed )
323 filter |= 4; 323 filter |= 4;
324 if (m_overdue) 324 if (m_overdue)
325 filter |= 2; 325 filter |= 2;
326 326
327 return m_todoMgr.sorted( asc, sortOrder, filter, cat ); 327 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
328} 328}
329OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { 329OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
330 int cat = 0; 330 int cat = 0;
@@ -365,25 +365,25 @@ void MainWindow::closeEvent( QCloseEvent* e ) {
365 return; 365 return;
366 } 366 }
367 /* 367 /*
368 * we should have flushed and now we're still saving 368 * we should have flushed and now we're still saving
369 * so there is no need to flush 369 * so there is no need to flush
370 */ 370 */
371 if (m_syncing ) { 371 if (m_syncing ) {
372 e->accept(); 372 e->accept();
373 return; 373 return;
374 } 374 }
375 bool quit = false; 375 bool quit = false;
376 if ( m_todoMgr.saveAll() ){ 376 if ( m_todoMgr.saveAll() ){
377 Opie::Core::owarn << "saved" << oendl; 377 owarn << "saved" << oendl;
378 quit = true; 378 quit = true;
379 }else { 379 }else {
380 if ( QMessageBox::critical( this, QWidget::tr("Out of space"), 380 if ( QMessageBox::critical( this, QWidget::tr("Out of space"),
381 QWidget::tr("Todo was unable\n" 381 QWidget::tr("Todo was unable\n"
382 "to save your changes.\n" 382 "to save your changes.\n"
383 "Free up some space\n" 383 "Free up some space\n"
384 "and try again.\n" 384 "and try again.\n"
385 "\nQuit Anyway?"), 385 "\nQuit Anyway?"),
386 QMessageBox::Yes|QMessageBox::Escape, 386 QMessageBox::Yes|QMessageBox::Escape,
387 QMessageBox::No|QMessageBox::Default) 387 QMessageBox::No|QMessageBox::Default)
388 != QMessageBox::No ) { 388 != QMessageBox::No ) {
389 e->accept(); 389 e->accept();
@@ -528,25 +528,25 @@ void MainWindow::slotFind() {
528 528
529} 529}
530void MainWindow::slotEdit() { 530void MainWindow::slotEdit() {
531 slotEdit( currentView()->current() ); 531 slotEdit( currentView()->current() );
532} 532}
533/* 533/*
534 * set the category 534 * set the category
535 */ 535 */
536void MainWindow::setCategory( int c) { 536void MainWindow::setCategory( int c) {
537 if ( c <= 0 ) return; 537 if ( c <= 0 ) return;
538 538
539 539
540 Opie::Core::owarn << "Iterating over cats " << c << oendl; 540 owarn << "Iterating over cats " << c << oendl;
541 for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) 541 for ( unsigned int i = 1; i < m_catMenu->count(); i++ )
542 m_catMenu->setItemChecked(i, c == (int)i ); 542 m_catMenu->setItemChecked(i, c == (int)i );
543 543
544 if (c == 1 ) { 544 if (c == 1 ) {
545 m_curCat = QString::null; 545 m_curCat = QString::null;
546 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); 546 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) );
547 547
548 }else if ( c == (int)m_catMenu->count() - 1 ) { 548 }else if ( c == (int)m_catMenu->count() - 1 ) {
549 m_curCat = QWidget::tr("Unfiled"); 549 m_curCat = QWidget::tr("Unfiled");
550 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); 550 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") );
551 }else { 551 }else {
552 m_curCat = m_todoMgr.categories()[c-2]; 552 m_curCat = m_todoMgr.categories()[c-2];
@@ -591,35 +591,35 @@ void MainWindow::beamDone( Ir* ir) {
591 delete ir; 591 delete ir;
592 ::unlink( beamfile ); 592 ::unlink( beamfile );
593} 593}
594void MainWindow::receiveFile( const QString& filename ) { 594void MainWindow::receiveFile( const QString& filename ) {
595 OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename ); 595 OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename );
596 596
597 OPimTodoAccess acc( cal ); 597 OPimTodoAccess acc( cal );
598 acc.load(); 598 acc.load();
599 OPimTodoAccess::List list = acc.allRecords(); 599 OPimTodoAccess::List list = acc.allRecords();
600 600
601 if (list.count()){ 601 if (list.count()){
602 602
603 QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); 603 QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() );
604 604
605 if ( QMessageBox::information(this, QWidget::tr("New Tasks"), 605 if ( QMessageBox::information(this, QWidget::tr("New Tasks"),
606 message, QMessageBox::Ok, 606 message, QMessageBox::Ok,
607 QMessageBox::Cancel ) == QMessageBox::Ok ) { 607 QMessageBox::Cancel ) == QMessageBox::Ok ) {
608 OPimTodoAccess::List::Iterator it; 608 OPimTodoAccess::List::Iterator it;
609 for ( it = list.begin(); it != list.end(); ++it ) 609 for ( it = list.begin(); it != list.end(); ++it )
610 m_todoMgr.add( (*it) ); 610 m_todoMgr.add( (*it) );
611 611
612 currentView()->updateView(); 612 currentView()->updateView();
613 } 613 }
614 } 614 }
615} 615}
616 616
617void MainWindow::slotFlush() { 617void MainWindow::slotFlush() {
618 m_syncing = TRUE; 618 m_syncing = TRUE;
619 m_todoMgr.save(); 619 m_todoMgr.save();
620} 620}
621void MainWindow::slotShowDetails() { 621void MainWindow::slotShowDetails() {
622 slotShow( currentView()->current() ); 622 slotShow( currentView()->current() );
623} 623}
624/* 624/*
625 * populate the Categories 625 * populate the Categories
@@ -672,25 +672,27 @@ void MainWindow::raiseCurrentView() {
672 // in returnFromView we fix up m_showing 672 // in returnFromView we fix up m_showing
673 if (m_showing ) return; 673 if (m_showing ) return;
674 674
675 m_stack->raiseWidget( m_curView->widget() ); 675 m_stack->raiseWidget( m_curView->widget() );
676} 676}
677void MainWindow::slotShowDue(bool ov) { 677void MainWindow::slotShowDue(bool ov) {
678 m_overdue = ov; 678 m_overdue = ov;
679 currentView()->showOverDue( ov ); 679 currentView()->showOverDue( ov );
680 raiseCurrentView(); 680 raiseCurrentView();
681} 681}
682void MainWindow::slotShow( int uid ) { 682void MainWindow::slotShow( int uid ) {
683 if ( uid == 0 ) return; 683 if ( uid == 0 ) return;
684 Opie::Core::owarn << "slotShow" << oendl; 684
685
686 owarn << "slotShow" << oendl;
685 currentShow()->slotShow( event( uid ) ); 687 currentShow()->slotShow( event( uid ) );
686 m_stack->raiseWidget( currentShow()->widget() ); 688 m_stack->raiseWidget( currentShow()->widget() );
687} 689}
688void MainWindow::slotShowNext() { 690void MainWindow::slotShowNext() {
689 int l = currentView()->next(); 691 int l = currentView()->next();
690 if (l!=0) 692 if (l!=0)
691 slotShow(l); 693 slotShow(l);
692} 694}
693void MainWindow::slotShowPrev() { 695void MainWindow::slotShowPrev() {
694 int l = currentView()->prev(); 696 int l = currentView()->prev();
695 if (l!=0) 697 if (l!=0)
696 slotShow(l); 698 slotShow(l);
@@ -731,25 +733,25 @@ void MainWindow::updateTodo( const OPimTodo& ev) {
731 */ 733 */
732void MainWindow::slotUpdate3( QWidget* ) { 734void MainWindow::slotUpdate3( QWidget* ) {
733 735
734} 736}
735void MainWindow::updateList() { 737void MainWindow::updateList() {
736 m_todoMgr.updateList(); 738 m_todoMgr.updateList();
737} 739}
738void MainWindow::setReadAhead( uint count ) { 740void MainWindow::setReadAhead( uint count ) {
739 if (m_todoMgr.todoDB() ) 741 if (m_todoMgr.todoDB() )
740 m_todoMgr.todoDB()->setReadAhead( count ); 742 m_todoMgr.todoDB()->setReadAhead( count );
741} 743}
742void MainWindow::slotQuickEntered() { 744void MainWindow::slotQuickEntered() {
743 Opie::Core::owarn << "entered" << oendl; 745 owarn << "entered" << oendl;
744 OPimTodo todo = quickEditor()->todo(); 746 OPimTodo todo = quickEditor()->todo();
745 if (todo.isEmpty() ) 747 if (todo.isEmpty() )
746 return; 748 return;
747 749
748 m_todoMgr.add( todo ); 750 m_todoMgr.add( todo );
749 currentView()->addEvent( todo ); 751 currentView()->addEvent( todo );
750 raiseCurrentView(); 752 raiseCurrentView();
751} 753}
752QuickEditBase* MainWindow::quickEditor() { 754QuickEditBase* MainWindow::quickEditor() {
753 return m_curQuick; 755 return m_curQuick;
754} 756}
755void MainWindow::slotComplete( int uid ) { 757void MainWindow::slotComplete( int uid ) {
@@ -778,25 +780,25 @@ void MainWindow::slotComplete( const OPimTodo& todo ) {
778 to.setRecurrence( OPimRecurrence() ); 780 to.setRecurrence( OPimRecurrence() );
779 781
780 OPimRecurrence rec = to2.recurrence(); 782 OPimRecurrence rec = to2.recurrence();
781 rec.setStart( to.dueDate() ); 783 rec.setStart( to.dueDate() );
782 to2.setRecurrence( rec ); 784 to2.setRecurrence( rec );
783 /* 785 /*
784 * if there is a next occurence 786 * if there is a next occurence
785 * from the duedate of the last recurrance 787 * from the duedate of the last recurrance
786 */ 788 */
787 QDate date; 789 QDate date;
788 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { 790 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) {
789 int dayDiff = to.dueDate().daysTo( date ); 791 int dayDiff = to.dueDate().daysTo( date );
790 Opie::Core::owarn << "day diff is " << dayDiff << oendl; 792 owarn << "day diff is " << dayDiff << oendl;
791 QDate inval; 793 QDate inval;
792 /* generate a new uid for the old record */ 794 /* generate a new uid for the old record */
793 to.setUid( 1 ); 795 to.setUid( 1 );
794 796
795 /* add the old one cause it has a new UID here cause it was spin off */ 797 /* add the old one cause it has a new UID here cause it was spin off */
796 m_todoMgr.add( to ); 798 m_todoMgr.add( to );
797 799
798 /* 800 /*
799 * update the due date 801 * update the due date
800 * start date 802 * start date
801 * and complete date 803 * and complete date
802 */ 804 */
@@ -941,33 +943,33 @@ namespace {
941 found = true; 943 found = true;
942 break; 944 break;
943 } 945 }
944 } 946 }
945 if (!found) 947 if (!found)
946 nonMatching.append( (*oldIt) ); 948 nonMatching.append( (*oldIt) );
947 } 949 }
948 return nonMatching; 950 return nonMatching;
949 } 951 }
950 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { 952 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
951 OPimNotifyManager::Alarms::ConstIterator it; 953 OPimNotifyManager::Alarms::ConstIterator it;
952 for ( it = als.begin(); it != als.end(); ++it ) { 954 for ( it = als.begin(); it != als.end(); ++it ) {
953 Opie::Core::owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl; 955 owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl;
954 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); 956 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
955 } 957 }
956 958
957 } 959 }
958 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { 960 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
959 OPimNotifyManager::Alarms::ConstIterator it; 961 OPimNotifyManager::Alarms::ConstIterator it;
960 for ( it = als.begin(); it != als.end(); ++it ) { 962 for ( it = als.begin(); it != als.end(); ++it ) {
961 Opie::Core::owarn << "Removinf alarm for " << (*it).dateTime().toString() << oendl; 963 owarn << "Removinf alarm for " << (*it).dateTime().toString() << oendl;
962 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); 964 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
963 } 965 }
964 } 966 }
965} 967}
966 968
967void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { 969void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) {
968 /* 970 /*
969 * if oldTodo is not empty and has notifiers we need to find the deleted ones 971 * if oldTodo is not empty and has notifiers we need to find the deleted ones
970 */ 972 */
971 if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) { 973 if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) {
972 OPimNotifyManager::Alarms removed; 974 OPimNotifyManager::Alarms removed;
973 OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms(); 975 OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms();
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp
index 55a3dd5..bbc177d 100644
--- a/core/pim/todo/otaskeditor.cpp
+++ b/core/pim/todo/otaskeditor.cpp
@@ -26,25 +26,24 @@ OTaskEditor::~OTaskEditor() {
26} 26}
27void OTaskEditor::init( int cur ) { 27void OTaskEditor::init( int cur ) {
28 OPimTodo to; 28 OPimTodo to;
29 to.setUid( 1 ); // generate a new uid 29 to.setUid( 1 ); // generate a new uid
30 if ( cur != 0 ) 30 if ( cur != 0 )
31 to.setCategories( cur ); 31 to.setCategories( cur );
32 load(to); 32 load(to);
33} 33}
34void OTaskEditor::init( const OPimTodo& to ) { 34void OTaskEditor::init( const OPimTodo& to ) {
35 load( to ); 35 load( to );
36} 36}
37OPimTodo OTaskEditor::todo()const{ 37OPimTodo OTaskEditor::todo()const{
38 Opie::Core::owarn << "saving!" << oendl;
39 OPimTodo to ( m_todo ); 38 OPimTodo to ( m_todo );
40 m_overView->save( to ); 39 m_overView->save( to );
41 m_stat->save( to ); 40 m_stat->save( to );
42 to.setRecurrence( m_rec->recurrence() ); 41 to.setRecurrence( m_rec->recurrence() );
43 m_alarm->save( to ); 42 m_alarm->save( to );
44 43
45 return to; 44 return to;
46} 45}
47void OTaskEditor::load(const OPimTodo& to) { 46void OTaskEditor::load(const OPimTodo& to) {
48 m_overView->load( to ); 47 m_overView->load( to );
49 m_stat->load( to ); 48 m_stat->load( to );
50 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); 49 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() );
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index 0b1c579..b7458d8 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -186,39 +186,39 @@ int TableView::prev() {
186} 186}
187QString TableView::currentRepresentation() { 187QString 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 */
192void TableView::showOverDue( bool ) { 192void TableView::showOverDue( bool ) {
193 clear(); 193 clear();
194 updateView(); 194 updateView();
195} 195}
196 196
197void TableView::updateView( ) { 197void TableView::updateView( ) {
198 Opie::Core::owarn << "update view" << oendl; 198 owarn << "update view" << oendl;
199 m_row = false; 199 m_row = false;
200 static int id; 200 static int id;
201 id = startTimer(4000 ); 201 id = startTimer(4000 );
202 /* FIXME we want one page to be read! 202 /* FIXME we want one page to be read!
203 * 203 *
204 * Calculate that screensize 204 * Calculate that screensize
205 */ 205 */
206 todoWindow()->setReadAhead( 4 ); 206 todoWindow()->setReadAhead( 4 );
207 sort(); 207 sort();
208 OPimTodoAccess::List::Iterator it, end; 208 OPimTodoAccess::List::Iterator it, end;
209 it = sorted().begin(); 209 it = sorted().begin();
210 end = sorted().end(); 210 end = sorted().end();
211 211
212 Opie::Core::owarn << "setTodos" << oendl; 212 owarn << "setTodos" << oendl;
213 QTime time; 213 QTime time;
214 time.start(); 214 time.start();
215 m_enablePaint = false; 215 m_enablePaint = false;
216 setUpdatesEnabled( false ); 216 setUpdatesEnabled( false );
217 viewport()->setUpdatesEnabled( false ); 217 viewport()->setUpdatesEnabled( false );
218 218
219 setNumRows( it.count() ); 219 setNumRows( it.count() );
220 if ( it.count() == 0 ) 220 if ( it.count() == 0 )
221 killTimer(id); 221 killTimer(id);
222 222
223// int elc = time.elapsed(); 223// int elc = time.elapsed();
224 setUpdatesEnabled( true ); 224 setUpdatesEnabled( true );
@@ -246,52 +246,52 @@ void TableView::addEvent( const OPimTodo&) {
246void TableView::replaceEvent( const OPimTodo& ev) { 246void TableView::replaceEvent( const OPimTodo& ev) {
247 addEvent( ev ); 247 addEvent( ev );
248} 248}
249/* 249/*
250 * re aligning table can be slow too 250 * re aligning table can be slow too
251 * FIXME: look what performs better 251 * FIXME: look what performs better
252 * either this or the old align table 252 * either this or the old align table
253 */ 253 */
254void TableView::removeEvent( int ) { 254void TableView::removeEvent( int ) {
255 updateView(); 255 updateView();
256} 256}
257void TableView::setShowCompleted( bool b) { 257void TableView::setShowCompleted( bool b) {
258 Opie::Core::owarn << "Show Completed " << b << oendl; 258 owarn << "Show Completed " << b << oendl;
259 updateView(); 259 updateView();
260} 260}
261void TableView::setShowDeadline( bool b ) { 261void TableView::setShowDeadline( bool b ) {
262 Opie::Core::owarn << "Show Deadline " << b << oendl; 262 owarn << "Show Deadline " << b << oendl;
263 if ( b ) 263 if ( b )
264 showColumn( 3 ); 264 showColumn( 3 );
265 else 265 else
266 hideColumn( 3 ); 266 hideColumn( 3 );
267 267
268 // Try to intelligently size columns 268 // Try to intelligently size columns
269 // 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
270 int col2width = 238; 270 int col2width = 238;
271 int width = m_pic_completed.width(); 271 int width = m_pic_completed.width();
272 setColumnWidth( 0, width ); 272 setColumnWidth( 0, width );
273 col2width -= width; 273 col2width -= width;
274 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8; 274 width = fontMetrics().boundingRect( horizontalHeader()->label( 1 ) ).width() + 8;
275 setColumnWidth( 1, width ); 275 setColumnWidth( 1, width );
276 col2width -= width; 276 col2width -= width;
277 if ( b ) { 277 if ( b ) {
278 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; 278 width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8;
279 setColumnWidth( 3, width ); 279 setColumnWidth( 3, width );
280 col2width -= width; 280 col2width -= width;
281 } 281 }
282 setColumnWidth( 2, col2width ); 282 setColumnWidth( 2, col2width );
283} 283}
284void TableView::setShowCategory( const QString& str) { 284void TableView::setShowCategory( const QString& str) {
285 Opie::Core::owarn << "setShowCategory" << oendl; 285 owarn << "setShowCategory" << oendl;
286 if ( str != m_oleCat || m_first ) 286 if ( str != m_oleCat || m_first )
287 updateView(); 287 updateView();
288 288
289 m_oleCat = str; 289 m_oleCat = str;
290 m_first = false; 290 m_first = false;
291 291
292} 292}
293void TableView::clear() { 293void TableView::clear() {
294 setNumRows(0); 294 setNumRows(0);
295} 295}
296void TableView::slotClicked(int row, int col, int, 296void TableView::slotClicked(int row, int col, int,
297 const QPoint& point) { 297 const QPoint& point) {
@@ -338,49 +338,49 @@ void TableView::slotClicked(int row, int col, int,
338 case 3: { 338 case 3: {
339 m_menuTimer->stop(); 339 m_menuTimer->stop();
340 TodoView::edit( ui ); 340 TodoView::edit( ui );
341 break; 341 break;
342 } 342 }
343 } 343 }
344 344
345 345
346} 346}
347void TableView::slotPressed(int row, int col, int, 347void TableView::slotPressed(int row, int col, int,
348 const QPoint& point) { 348 const QPoint& point) {
349 349
350 Opie::Core::owarn << "pressed row " << row << " col " << col << " x:" << point.x() 350 owarn << "pressed row " << row << " col " << col << " x:" << point.x()
351 << "+y:" << point.y() << oendl; 351 << "+y:" << point.y() << oendl;
352 m_prevP = point; 352 m_prevP = point;
353 /* TextColumn column */ 353 /* TextColumn column */
354 if ( col == 2 && cellGeometry( row, col ).contains( point ) ) 354 if ( col == 2 && cellGeometry( row, col ).contains( point ) )
355 m_menuTimer->start( 750, TRUE ); 355 m_menuTimer->start( 750, TRUE );
356} 356}
357void TableView::slotValueChanged( int, int ) { 357void TableView::slotValueChanged( int, int ) {
358 Opie::Core::owarn << "Value Changed" << oendl; 358 owarn << "Value Changed" << oendl;
359} 359}
360void TableView::slotCurrentChanged(int, int ) { 360void TableView::slotCurrentChanged(int, int ) {
361 m_menuTimer->stop(); 361 m_menuTimer->stop();
362} 362}
363QWidget* TableView::widget() { 363QWidget* TableView::widget() {
364 return this; 364 return this;
365} 365}
366/* 366/*
367 * We need to overwrite sortColumn 367 * We need to overwrite sortColumn
368 * because we want to sort whole row 368 * because we want to sort whole row
369 * based 369 * based
370 * We event want to set the setOrder 370 * We event want to set the setOrder
371 * to a sort() and update() 371 * to a sort() and update()
372 */ 372 */
373void TableView::sortColumn( int col, bool asc, bool ) { 373void TableView::sortColumn( int col, bool asc, bool ) {
374 Opie::Core::owarn << "bool " << asc << oendl; 374 owarn << "bool " << asc << oendl;
375 setSortOrder( col ); 375 setSortOrder( col );
376 setAscending( asc ); 376 setAscending( asc );
377 updateView(); 377 updateView();
378} 378}
379void TableView::viewportPaintEvent( QPaintEvent* e) { 379void TableView::viewportPaintEvent( QPaintEvent* e) {
380 if (m_enablePaint ) 380 if (m_enablePaint )
381 QTable::viewportPaintEvent( e ); 381 QTable::viewportPaintEvent( e );
382} 382}
383/* 383/*
384 * This segment is copyrighted by TT 384 * This segment is copyrighted by TT
385 * it was taken from their todolist 385 * it was taken from their todolist
386 * application this code is GPL 386 * application this code is GPL
@@ -485,25 +485,25 @@ QWidget* TableView::createEditor(int row, int col, bool )const {
485 /* summary */ 485 /* summary */
486 case 2:{ 486 case 2:{
487 QLineEdit* edit = new QLineEdit( viewport() ); 487 QLineEdit* edit = new QLineEdit( viewport() );
488 edit->setText( sorted()[row].summary() ); 488 edit->setText( sorted()[row].summary() );
489 return edit; 489 return edit;
490 } 490 }
491 case 0: 491 case 0:
492 default: 492 default:
493 return 0l; 493 return 0l;
494 } 494 }
495} 495}
496void TableView::setCellContentFromEditor(int row, int col ) { 496void TableView::setCellContentFromEditor(int row, int col ) {
497 Opie::Core::owarn << "set cell content from editor" << oendl; 497 owarn << "set cell content from editor" << oendl;
498 if ( col == 1 ) { 498 if ( col == 1 ) {
499 QWidget* wid = cellWidget(row, 1 ); 499 QWidget* wid = cellWidget(row, 1 );
500 if ( wid->inherits("QComboBox") ) { 500 if ( wid->inherits("QComboBox") ) {
501 int pri = ((QComboBox*)wid)->currentItem() + 1; 501 int pri = ((QComboBox*)wid)->currentItem() + 1;
502 OPimTodo todo = sorted()[row]; 502 OPimTodo todo = sorted()[row];
503 if ( todo.priority() != pri ) { 503 if ( todo.priority() != pri ) {
504 todo.setPriority( pri ); 504 todo.setPriority( pri );
505 TodoView::update( todo.uid(), todo ); 505 TodoView::update( todo.uid(), todo );
506 updateView(); 506 updateView();
507 } 507 }
508 } 508 }
509 }else if ( col == 2) { 509 }else if ( col == 2) {
@@ -569,25 +569,25 @@ void TableView::timerEvent( QTimerEvent* ) {
569 * BUG: When clicking on the Due column and it's scrollable 569 * BUG: When clicking on the Due column and it's scrollable
570 * the todo is marked as completed... 570 * the todo is marked as completed...
571 * REASON: QTable is doing auto scrolling which leads to a move 571 * 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 572 * in the x coordinate and this way it's able to pass the
573 * m_completeStrokeWidth criteria 573 * m_completeStrokeWidth criteria
574 * WORKAROUND: strike through needs to strike through the same 574 * WORKAROUND: strike through needs to strike through the same
575 * row and two columns! 575 * row and two columns!
576 */ 576 */
577void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { 577void TableView::contentsMouseReleaseEvent( QMouseEvent* e) {
578 int row = rowAt(m_prevP.y()); 578 int row = rowAt(m_prevP.y());
579 int colOld = columnAt(m_prevP.x() ); 579 int colOld = columnAt(m_prevP.x() );
580 int colNew = columnAt(e->x() ); 580 int colNew = columnAt(e->x() );
581 Opie::Core::owarn << "colNew: " << colNew << " colOld: " << colOld << oendl; 581 owarn << "colNew: " << colNew << " colOld: " << colOld << oendl;
582 if ( row == rowAt( e->y() ) && row != -1 && 582 if ( row == rowAt( e->y() ) && row != -1 &&
583 colOld != colNew ) { 583 colOld != colNew ) {
584 TodoView::complete( sorted()[row] ); 584 TodoView::complete( sorted()[row] );
585 return; 585 return;
586 } 586 }
587 QTable::contentsMouseReleaseEvent( e ); 587 QTable::contentsMouseReleaseEvent( e );
588} 588}
589void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { 589void TableView::contentsMouseMoveEvent( QMouseEvent* e ) {
590 m_menuTimer->stop(); 590 m_menuTimer->stop();
591 QTable::contentsMouseMoveEvent( e ); 591 QTable::contentsMouseMoveEvent( e );
592} 592}
593void TableView::keyPressEvent( QKeyEvent* event) { 593void TableView::keyPressEvent( QKeyEvent* event) {
diff --git a/core/pim/todo/templatedialog.cpp b/core/pim/todo/templatedialog.cpp
index 32327a6..8d72297 100644
--- a/core/pim/todo/templatedialog.cpp
+++ b/core/pim/todo/templatedialog.cpp
@@ -42,23 +42,19 @@ TemplateDialog::TemplateDialog( QWidget* widget )
42 42
43} 43}
44TemplateDialog::~TemplateDialog() { 44TemplateDialog::~TemplateDialog() {
45 // Qt does delete our widgets 45 // Qt does delete our widgets
46} 46}
47QListView* TemplateDialog::listView() { 47QListView* TemplateDialog::listView() {
48 return m_list; 48 return m_list;
49} 49}
50QLineEdit* TemplateDialog::edit() { 50QLineEdit* TemplateDialog::edit() {
51 return m_lne; 51 return m_lne;
52} 52}
53void TemplateDialog::slotAdd() { 53void TemplateDialog::slotAdd() {
54 Opie::Core::owarn << "Not Implemented here" << oendl;
55} 54}
56void TemplateDialog::slotRemove() { 55void TemplateDialog::slotRemove() {
57 Opie::Core::owarn << "Not Implemented here" << oendl;
58} 56}
59void TemplateDialog::slotEdit() { 57void TemplateDialog::slotEdit() {
60 Opie::Core::owarn << "Not Implemented here" << oendl;
61} 58}
62void TemplateDialog::slotReturn() { 59void TemplateDialog::slotReturn() {
63 Opie::Core::owarn << "Not Implemented here" << oendl;
64} 60}
diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp
index 7857d52..a1c559d 100644
--- a/core/pim/todo/todoeditor.cpp
+++ b/core/pim/todo/todoeditor.cpp
@@ -22,26 +22,24 @@ OPimTodo Editor::newTodo( int cur,
22 OTaskEditor *e = self(); 22 OTaskEditor *e = self();
23 e->setCaption( QObject::tr("Enter Task") ); 23 e->setCaption( QObject::tr("Enter Task") );
24 e->init( cur ); 24 e->init( cur );
25 25
26 int ret = QPEApplication::execDialog( e ); 26 int ret = QPEApplication::execDialog( e );
27 27
28 if ( QDialog::Accepted == ret ) { 28 if ( QDialog::Accepted == ret ) {
29 m_accepted = true; 29 m_accepted = true;
30 }else 30 }else
31 m_accepted = false; 31 m_accepted = false;
32 32
33 OPimTodo ev = e->todo(); 33 OPimTodo ev = e->todo();
34 Opie::Core::owarn << "Todo uid" << oendl;
35 Opie::Core::owarn << "Todo " << ev.summary() << " " << ev.progress() << " " << ev.isCompleted() << oendl;
36 ev.setUid(1); 34 ev.setUid(1);
37 35
38 return ev; 36 return ev;
39} 37}
40OPimTodo Editor::edit( QWidget *, 38OPimTodo Editor::edit( QWidget *,
41 const OPimTodo& todo ) { 39 const OPimTodo& todo ) {
42 OTaskEditor *e = self(); 40 OTaskEditor *e = self();
43 e->init( todo ); 41 e->init( todo );
44 e->setCaption( QObject::tr( "Edit Task" ) ); 42 e->setCaption( QObject::tr( "Edit Task" ) );
45 43
46 int ret = QPEApplication::execDialog( e ); 44 int ret = QPEApplication::execDialog( e );
47 45
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp
index 7826747..c4b8fbc 100644
--- a/core/pim/todo/todomanager.cpp
+++ b/core/pim/todo/todomanager.cpp
@@ -31,34 +31,34 @@
31#include <qpe/categoryselect.h> 31#include <qpe/categoryselect.h>
32 32
33#include "todomanager.h" 33#include "todomanager.h"
34 34
35using namespace Todo; 35using namespace Todo;
36 36
37TodoManager::TodoManager( QObject *obj ) 37TodoManager::TodoManager( QObject *obj )
38 : QObject( obj ) { 38 : QObject( obj ) {
39 m_db = 0l; 39 m_db = 0l;
40 QTime time; 40 QTime time;
41 time.start(); 41 time.start();
42 int el = time.elapsed(); 42 int el = time.elapsed();
43 Opie::Core::owarn << "QTimer for loading " << el/1000 << oendl; 43 owarn << "QTimer for loading " << el/1000 << oendl;
44} 44}
45TodoManager::~TodoManager() { 45TodoManager::~TodoManager() {
46 delete m_db; 46 delete m_db;
47} 47}
48OPimTodo TodoManager::event(int uid ) { 48OPimTodo TodoManager::event(int uid ) {
49 return m_db->find( uid ); 49 return m_db->find( uid );
50} 50}
51void TodoManager::updateList() { 51void TodoManager::updateList() {
52 Opie::Core::owarn << "update lists" << oendl; 52 owarn << "update lists" << oendl;
53 m_list = m_db->allRecords(); 53 m_list = m_db->allRecords();
54} 54}
55OPimTodoAccess::List TodoManager::list() const{ 55OPimTodoAccess::List TodoManager::list() const{
56 return m_list; 56 return m_list;
57} 57}
58OPimTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) { 58OPimTodoAccess::List TodoManager::sorted( bool asc, int so, int f, int cat ) {
59 return m_db->sorted( asc, so, f, cat ); 59 return m_db->sorted( asc, so, f, cat );
60} 60}
61OPimTodoAccess::List::Iterator TodoManager::overDue() { 61OPimTodoAccess::List::Iterator TodoManager::overDue() {
62 int filter = 2 | 1; 62 int filter = 2 | 1;
63 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 );
64 m_it = m_list.begin(); 64 m_it = m_list.begin();
diff --git a/core/pim/todo/todotemplatemanager.cpp b/core/pim/todo/todotemplatemanager.cpp
index 0b20d5a..7690d37 100644
--- a/core/pim/todo/todotemplatemanager.cpp
+++ b/core/pim/todo/todotemplatemanager.cpp
@@ -27,47 +27,44 @@ void TemplateManager::load() {
27 OPimTodoAccess::List list = todoDB.allRecords(); 27 OPimTodoAccess::List list = todoDB.allRecords();
28 for ( it = list.begin(); it != list.end(); ++it ) { 28 for ( it = list.begin(); it != list.end(); ++it ) {
29 OPimTodo ev = (*it); 29 OPimTodo ev = (*it);
30 conf.setGroup( QString::number( ev.uid() ) ); 30 conf.setGroup( QString::number( ev.uid() ) );
31 QString str = conf.readEntry("Name", QString::null ); 31 QString str = conf.readEntry("Name", QString::null );
32 if (str.isEmpty() ) 32 if (str.isEmpty() )
33 continue; 33 continue;
34 34
35 m_templates.insert( str, ev ); 35 m_templates.insert( str, ev );
36 } 36 }
37} 37}
38void TemplateManager::save() { 38void TemplateManager::save() {
39 Opie::Core::owarn << "Saving!!!!" << oendl;
40 Config conf("todolist_templates"); 39 Config conf("todolist_templates");
41 40
42 OPimTodoAccessXML *res = new OPimTodoAccessXML( "template", 41 OPimTodoAccessXML *res = new OPimTodoAccessXML( "template",
43 m_path ); 42 m_path );
44 OPimTodoAccess db(res); 43 OPimTodoAccess db(res);
45 db.load(); 44 db.load();
46 db.clear(); 45 db.clear();
47 46
48 47
49 QMap<QString, OPimTodo>::Iterator it; 48 QMap<QString, OPimTodo>::Iterator it;
50 for ( it = m_templates.begin(); it != m_templates.end(); ++it ) { 49 for ( it = m_templates.begin(); it != m_templates.end(); ++it ) {
51 OPimTodo ev = it.data(); 50 OPimTodo ev = it.data();
52 conf.setGroup( QString::number( ev.uid() ) ); 51 conf.setGroup( QString::number( ev.uid() ) );
53 Opie::Core::owarn << "Name " << it.key() << oendl;
54 conf.writeEntry("Name", it.key() ); 52 conf.writeEntry("Name", it.key() );
55 db.add( ev ); 53 db.add( ev );
56 } 54 }
57 db.save(); 55 db.save();
58} 56}
59void TemplateManager::addEvent( const QString& str, 57void TemplateManager::addEvent( const QString& str,
60 const OPimTodo& ev) { 58 const OPimTodo& ev) {
61 Opie::Core::owarn << "AddEvent " << str << oendl;
62 OPimTodo todo = ev; 59 OPimTodo todo = ev;
63 if( ev.uid() == 0 ) 60 if( ev.uid() == 0 )
64 todo.setUid(1); // generate a new uid 61 todo.setUid(1); // generate a new uid
65 62
66 m_templates.replace( str, todo ); 63 m_templates.replace( str, todo );
67} 64}
68void TemplateManager::removeEvent( const QString& str ) { 65void TemplateManager::removeEvent( const QString& str ) {
69 m_templates.remove( str ); 66 m_templates.remove( str );
70} 67}
71QStringList TemplateManager::templates() const { 68QStringList TemplateManager::templates() const {
72 QStringList list; 69 QStringList list;
73 QMap<QString, OPimTodo>::ConstIterator it; 70 QMap<QString, OPimTodo>::ConstIterator it;
diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp
index 03e1060..3d2c982 100644
--- a/core/pim/todo/todoview.cpp
+++ b/core/pim/todo/todoview.cpp
@@ -24,34 +24,34 @@ MainWindow* TodoView::todoWindow() {
24OPimTodo TodoView::event(int uid ) { 24OPimTodo TodoView::event(int uid ) {
25 return m_main->event( uid ); 25 return m_main->event( uid );
26} 26}
27OPimTodoAccess::List TodoView::list(){ 27OPimTodoAccess::List TodoView::list(){
28 todoWindow()->updateList(); 28 todoWindow()->updateList();
29 return todoWindow()->list(); 29 return todoWindow()->list();
30} 30}
31OPimTodoAccess::List TodoView::sorted()const{ 31OPimTodoAccess::List TodoView::sorted()const{
32 return m_sort; 32 return m_sort;
33} 33}
34void TodoView::sort() { 34void TodoView::sort() {
35 m_sort = todoWindow()->sorted(m_asc,m_sortOrder ); 35 m_sort = todoWindow()->sorted(m_asc,m_sortOrder );
36 Opie::Core::owarn << "m_sort.count() = " << m_sort.count() << oendl; 36 owarn << "m_sort.count() = " << m_sort.count() << oendl;
37} 37}
38void TodoView::sort(int sort) { 38void TodoView::sort(int sort) {
39 m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort ); 39 m_sort = todoWindow()->sorted(m_asc, m_sortOrder, sort );
40} 40}
41void TodoView::setSortOrder( int order ) { 41void TodoView::setSortOrder( int order ) {
42 m_sortOrder = order; 42 m_sortOrder = order;
43} 43}
44void TodoView::setAscending( bool b ) { 44void TodoView::setAscending( bool b ) {
45 Opie::Core::owarn << "setAscending " << b << oendl; 45 owarn << "setAscending " << b << oendl;
46 m_asc = b; 46 m_asc = b;
47} 47}
48void TodoView::update(int, const SmallTodo& ) { 48void TodoView::update(int, const SmallTodo& ) {
49 //m_main->slotUpate1( uid, to ); 49 //m_main->slotUpate1( uid, to );
50} 50}
51void TodoView::update(int , const OPimTodo& ev ) { 51void TodoView::update(int , const OPimTodo& ev ) {
52 m_main->updateTodo( ev ); 52 m_main->updateTodo( ev );
53} 53}
54void TodoView::showTodo( int uid ) { 54void TodoView::showTodo( int uid ) {
55 m_main->slotShow( uid ); 55 m_main->slotShow( uid );
56} 56}
57void TodoView::edit( int uid ) { 57void TodoView::edit( int uid ) {