-rw-r--r-- | core/pim/todo/mainwindow.cpp | 213 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 24 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.cpp | 35 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.h | 5 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 27 | ||||
-rw-r--r-- | core/pim/todo/taskeditoradvanced.ui | 8 | ||||
-rw-r--r-- | core/pim/todo/taskeditoroverviewimpl.cpp | 55 | ||||
-rw-r--r-- | core/pim/todo/taskeditoroverviewimpl.h | 1 | ||||
-rw-r--r-- | core/pim/todo/todo.pro | 6 | ||||
-rw-r--r-- | core/pim/todo/todomanager.cpp | 7 | ||||
-rw-r--r-- | core/pim/todo/todomanager.h | 7 | ||||
-rw-r--r-- | core/pim/todo/todoview.cpp | 55 | ||||
-rw-r--r-- | core/pim/todo/todoview.h | 82 |
13 files changed, 310 insertions, 215 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 9b2423b..b2b3b8f 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -43,8 +43,9 @@ | |||
43 | #include <qpe/ir.h> | 43 | #include <qpe/ir.h> |
44 | #include <qpe/resource.h> | 44 | #include <qpe/resource.h> |
45 | #include <qpe/qpemessagebox.h> | 45 | #include <qpe/qpemessagebox.h> |
46 | 46 | ||
47 | #include <opie/orecur.h> | ||
47 | #include <opie/otodoaccessvcal.h> | 48 | #include <opie/otodoaccessvcal.h> |
48 | 49 | ||
49 | #include "quickeditimpl.h" | 50 | #include "quickeditimpl.h" |
50 | #include "todotemplatemanager.h" | 51 | #include "todotemplatemanager.h" |
@@ -58,9 +59,11 @@ | |||
58 | 59 | ||
59 | using namespace Todo; | 60 | using namespace Todo; |
60 | 61 | ||
61 | MainWindow::MainWindow( QWidget* parent, | 62 | MainWindow::MainWindow( QWidget* parent, |
62 | const char* name ) { | 63 | const char* name ) |
64 | : OPimMainWindow("Todolist") | ||
65 | { | ||
63 | 66 | ||
64 | m_syncing = false; | 67 | m_syncing = false; |
65 | m_counter = 0; | 68 | m_counter = 0; |
66 | m_tempManager = new TemplateManager(); | 69 | m_tempManager = new TemplateManager(); |
@@ -176,15 +179,12 @@ void MainWindow::initActions() { | |||
176 | 179 | ||
177 | /* initialize the view menu */ | 180 | /* initialize the view menu */ |
178 | a = new QAction( QString::null, tr("Show only over due"), | 181 | a = new QAction( QString::null, tr("Show only over due"), |
179 | 0, this, 0, TRUE ); | 182 | 0, this, 0, TRUE ); |
180 | a->addTo( m_view ); | 183 | a->addTo( m_options ); |
181 | a->setOn( showOverDue() ); | 184 | a->setOn( showOverDue() ); |
182 | connect(a, SIGNAL(toggled(bool)), | 185 | connect(a, SIGNAL(toggled(bool)), |
183 | this, SLOT(slotShowDue(bool) ) ); | 186 | this, SLOT(slotShowDue(bool) ) ); |
184 | m_view->insertSeparator(); | ||
185 | |||
186 | m_bar->insertItem( tr("View"), m_view ); | ||
187 | 187 | ||
188 | /* templates */ | 188 | /* templates */ |
189 | m_edit->insertItem(tr("New from template"), m_template, | 189 | m_edit->insertItem(tr("New from template"), m_template, |
190 | -1, 0 ); | 190 | -1, 0 ); |
@@ -219,9 +219,8 @@ void MainWindow::initUI() { | |||
219 | 219 | ||
220 | /** QPopupMenu */ | 220 | /** QPopupMenu */ |
221 | m_edit = new QPopupMenu( this ); | 221 | m_edit = new QPopupMenu( this ); |
222 | m_options = new QPopupMenu( this ); | 222 | m_options = new QPopupMenu( this ); |
223 | m_view = new QPopupMenu( this ); | ||
224 | m_catMenu = new QPopupMenu( this ); | 223 | m_catMenu = new QPopupMenu( this ); |
225 | m_template = new QPopupMenu( this ); | 224 | m_template = new QPopupMenu( this ); |
226 | 225 | ||
227 | m_catMenu->setCheckable( TRUE ); | 226 | m_catMenu->setCheckable( TRUE ); |
@@ -253,26 +252,28 @@ void MainWindow::initShow() { | |||
253 | MainWindow::~MainWindow() { | 252 | MainWindow::~MainWindow() { |
254 | delete templateManager(); | 253 | delete templateManager(); |
255 | } | 254 | } |
256 | void MainWindow::connectBase( ViewBase* base) { | 255 | void MainWindow::connectBase( ViewBase* base) { |
257 | base->connectShow( this, SLOT(slotShow(int) ) ); | 256 | // once templates and signals mix we'll use it again |
258 | base->connectEdit( this, SLOT(slotEdit(int) ) ); | 257 | } |
259 | base->connectUpdateSmall( this, | 258 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { |
260 | SLOT(slotUpate1(int, const Todo::SmallTodo&) )); | ||
261 | base->connectUpdateBig( this, | ||
262 | SLOT(slotUpate2(int, const OTodo& ) ) ); | ||
263 | base->connectUpdateView( this, SLOT(slotUpdate3( QWidget* ) ) ) ; | ||
264 | base->connectRemove(&m_todoMgr, | ||
265 | SLOT(remove(int)) ); | ||
266 | } | ||
267 | QPopupMenu* MainWindow::contextMenu( int uid ) { | ||
268 | QPopupMenu* menu = new QPopupMenu(); | 259 | QPopupMenu* menu = new QPopupMenu(); |
269 | 260 | ||
270 | m_editAction->addTo( menu ); | 261 | m_editAction->addTo( menu ); |
271 | m_deleteAction->addTo( menu ); | 262 | m_deleteAction->addTo( menu ); |
272 | m_duplicateAction->addTo( menu ); | 263 | m_duplicateAction->addTo( menu ); |
264 | |||
273 | menu->insertSeparator(); | 265 | menu->insertSeparator(); |
274 | 266 | ||
267 | /* | ||
268 | * if this event recurs we allow | ||
269 | * to detach it. | ||
270 | * remove all | ||
271 | */ | ||
272 | if ( recur ) { | ||
273 | ; // FIXME | ||
274 | } | ||
275 | |||
275 | return menu; | 276 | return menu; |
276 | } | 277 | } |
277 | QPopupMenu* MainWindow::options() { | 278 | QPopupMenu* MainWindow::options() { |
278 | qWarning("Options"); | 279 | qWarning("Options"); |
@@ -280,11 +281,8 @@ QPopupMenu* MainWindow::options() { | |||
280 | } | 281 | } |
281 | QPopupMenu* MainWindow::edit() { | 282 | QPopupMenu* MainWindow::edit() { |
282 | return m_edit; | 283 | return m_edit; |
283 | } | 284 | } |
284 | QPopupMenu* MainWindow::view() { | ||
285 | return m_view; | ||
286 | } | ||
287 | QToolBar* MainWindow::toolbar() { | 285 | QToolBar* MainWindow::toolbar() { |
288 | return m_tool; | 286 | return m_tool; |
289 | } | 287 | } |
290 | OTodoAccess::List MainWindow::list()const { | 288 | OTodoAccess::List MainWindow::list()const { |
@@ -412,30 +410,9 @@ void MainWindow::slotNewFromTemplate( int id ) { | |||
412 | populateCategories(); | 410 | populateCategories(); |
413 | } | 411 | } |
414 | } | 412 | } |
415 | void MainWindow::slotNew() { | 413 | void MainWindow::slotNew() { |
416 | if(m_syncing) { | 414 | create(); |
417 | QMessageBox::warning(this, tr("Todo"), | ||
418 | tr("Can not edit data, currently syncing")); | ||
419 | return; | ||
420 | } | ||
421 | |||
422 | |||
423 | OTodo todo = currentEditor()->newTodo( currentCatId(), | ||
424 | this ); | ||
425 | |||
426 | if ( currentEditor()->accepted() ) { | ||
427 | //todo.assignUid(); | ||
428 | m_todoMgr.add( todo ); | ||
429 | currentView()->addEvent( todo ); | ||
430 | |||
431 | |||
432 | // I'm afraid we must call this every time now, otherwise | ||
433 | // spend expensive time comparing all these strings... | ||
434 | // but only call if we changed something -zecke | ||
435 | populateCategories(); | ||
436 | } | ||
437 | raiseCurrentView( ); | ||
438 | } | 415 | } |
439 | void MainWindow::slotDuplicate() { | 416 | void MainWindow::slotDuplicate() { |
440 | if(m_syncing) { | 417 | if(m_syncing) { |
441 | QMessageBox::warning(this, tr("Todo"), | 418 | QMessageBox::warning(this, tr("Todo"), |
@@ -473,9 +450,8 @@ void MainWindow::slotDeleteAll() { | |||
473 | tr("Can not edit data, currently syncing")); | 450 | tr("Can not edit data, currently syncing")); |
474 | return; | 451 | return; |
475 | } | 452 | } |
476 | 453 | ||
477 | //QString strName = table->text( table->currentRow(), 2 ).left( 30 ); | ||
478 | 454 | ||
479 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all tasks?") ) ) | 455 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all tasks?") ) ) |
480 | return; | 456 | return; |
481 | 457 | ||
@@ -493,10 +469,10 @@ void MainWindow::slotDeleteCompleted() { | |||
493 | 469 | ||
494 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) ) | 470 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all completed tasks?") ) ) |
495 | return; | 471 | return; |
496 | 472 | ||
497 | // FIXME | 473 | |
498 | //m_todoMgr.remove( currentView()->completed() ); | 474 | m_todoMgr.removeCompleted(); |
499 | currentView()->updateView( ); | 475 | currentView()->updateView( ); |
500 | } | 476 | } |
501 | void MainWindow::slotFind() { | 477 | void MainWindow::slotFind() { |
502 | 478 | ||
@@ -551,20 +527,9 @@ void MainWindow::setDocument( const QString& fi) { | |||
551 | } | 527 | } |
552 | 528 | ||
553 | static const char *beamfile = "/tmp/opie-todo.vcs"; | 529 | static const char *beamfile = "/tmp/opie-todo.vcs"; |
554 | void MainWindow::slotBeam() { | 530 | void MainWindow::slotBeam() { |
555 | ::unlink( beamfile ); | 531 | beam( currentView()->current() ); |
556 | OTodo todo = event( currentView()->current() ); | ||
557 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); | ||
558 | OTodoAccess acc( cal ); | ||
559 | acc.load(); | ||
560 | acc.add( todo ); | ||
561 | acc.save(); | ||
562 | Ir* ir = new Ir(this ); | ||
563 | connect(ir, SIGNAL(done(Ir*) ), | ||
564 | this, SLOT(beamDone(Ir*) ) ); | ||
565 | ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); | ||
566 | |||
567 | } | 532 | } |
568 | void MainWindow::beamDone( Ir* ir) { | 533 | void MainWindow::beamDone( Ir* ir) { |
569 | delete ir; | 534 | delete ir; |
570 | ::unlink( beamfile ); | 535 | ::unlink( beamfile ); |
@@ -703,4 +668,138 @@ void MainWindow::slotQuickEntered() { | |||
703 | } | 668 | } |
704 | QuickEditBase* MainWindow::quickEditor() { | 669 | QuickEditBase* MainWindow::quickEditor() { |
705 | return m_curQuick; | 670 | return m_curQuick; |
706 | } | 671 | } |
672 | void MainWindow::slotComplete( int uid ) { | ||
673 | slotComplete( event(uid) ); | ||
674 | } | ||
675 | void MainWindow::slotComplete( const OTodo& todo ) { | ||
676 | OTodo to = todo; | ||
677 | to.setCompleted( !to.isCompleted() ); | ||
678 | to.setCompletedDate( QDate::currentDate() ); | ||
679 | |||
680 | /* | ||
681 | * if the item does recur | ||
682 | * we need to spin it off | ||
683 | * and update the items duedate to the next | ||
684 | * possible recurrance of this item... | ||
685 | * the spinned off one will loose the | ||
686 | */ | ||
687 | if ( to.recurrence().doesRecur() && to.isCompleted() ) { | ||
688 | OTodo to2( to ); | ||
689 | |||
690 | /* the spinned off one won't recur anymore */ | ||
691 | to.setRecurrence( ORecur() ); | ||
692 | |||
693 | ORecur rec = to2.recurrence(); | ||
694 | rec.setStart( to.dueDate() ); | ||
695 | to2.setRecurrence( rec ); | ||
696 | /* | ||
697 | * if there is a next occurence | ||
698 | * from the duedate of the last recurrance | ||
699 | */ | ||
700 | QDate date; | ||
701 | if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { | ||
702 | QDate inval; | ||
703 | /* generate a new uid for the old record */ | ||
704 | to.setUid( 1 ); | ||
705 | |||
706 | /* add the old one cause it has a new UID here cause it was spin off */ | ||
707 | m_todoMgr.add( to ); | ||
708 | |||
709 | /* | ||
710 | * update the due date | ||
711 | * start date | ||
712 | * and complete date | ||
713 | */ | ||
714 | to2.setDueDate( date ); | ||
715 | to2.setStartDate( inval ); | ||
716 | to2.setCompletedDate( inval ); | ||
717 | to2.setCompleted( false ); | ||
718 | updateTodo( to2 ); | ||
719 | }else | ||
720 | updateTodo( to ); | ||
721 | }else | ||
722 | updateTodo( to ); | ||
723 | |||
724 | currentView()->updateView(); | ||
725 | raiseCurrentView(); | ||
726 | } | ||
727 | void MainWindow::flush() { | ||
728 | slotFlush(); | ||
729 | } | ||
730 | void MainWindow::reload() { | ||
731 | slotReload(); | ||
732 | } | ||
733 | int MainWindow::create() { | ||
734 | int uid = 0; | ||
735 | if(m_syncing) { | ||
736 | QMessageBox::warning(this, tr("Todo"), | ||
737 | tr("Can not edit data, currently syncing")); | ||
738 | return uid; | ||
739 | } | ||
740 | |||
741 | |||
742 | OTodo todo = currentEditor()->newTodo( currentCatId(), | ||
743 | this ); | ||
744 | |||
745 | if ( currentEditor()->accepted() ) { | ||
746 | //todo.assignUid(); | ||
747 | uid = todo.uid(); | ||
748 | m_todoMgr.add( todo ); | ||
749 | currentView()->addEvent( todo ); | ||
750 | |||
751 | |||
752 | // I'm afraid we must call this every time now, otherwise | ||
753 | // spend expensive time comparing all these strings... | ||
754 | // but only call if we changed something -zecke | ||
755 | populateCategories(); | ||
756 | } | ||
757 | raiseCurrentView( ); | ||
758 | |||
759 | return uid; | ||
760 | } | ||
761 | /* delete it silently... */ | ||
762 | bool MainWindow::remove( int uid ) { | ||
763 | if (m_syncing) return false; | ||
764 | |||
765 | return m_todoMgr.remove( uid ); | ||
766 | } | ||
767 | void MainWindow::beam( int uid, int ) { | ||
768 | ::unlink( beamfile ); | ||
769 | OTodo todo = event( uid ); | ||
770 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); | ||
771 | OTodoAccess acc( cal ); | ||
772 | acc.load(); | ||
773 | acc.add( todo ); | ||
774 | acc.save(); | ||
775 | Ir* ir = new Ir(this ); | ||
776 | connect(ir, SIGNAL(done(Ir*) ), | ||
777 | this, SLOT(beamDone(Ir*) ) ); | ||
778 | ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); | ||
779 | } | ||
780 | void MainWindow::show( int uid ) { | ||
781 | slotShow( uid ); | ||
782 | } | ||
783 | void MainWindow::edit( int uid ) { | ||
784 | slotEdit( uid ); | ||
785 | } | ||
786 | void MainWindow::add( const OPimRecord& rec) { | ||
787 | if ( rec.rtti() != OTodo::rtti() ) return; | ||
788 | |||
789 | const OTodo& todo = static_cast<const OTodo&>(rec); | ||
790 | |||
791 | m_todoMgr.add(todo ); | ||
792 | currentView()->addEvent( todo ); | ||
793 | |||
794 | |||
795 | // I'm afraid we must call this every time now, otherwise | ||
796 | // spend expensive time comparing all these strings... | ||
797 | // but only call if we changed something -zecke | ||
798 | populateCategories(); | ||
799 | } | ||
800 | /* todo does not have the QDataStream<< and >> operators implemented :( | ||
801 | * FIXME | ||
802 | */ | ||
803 | OPimRecord* MainWindow::record( int rtti, const QByteArray& ) { | ||
804 | return 0l; | ||
805 | } | ||
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index 270cbd1..14cfa82 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -29,12 +29,12 @@ | |||
29 | #ifndef TODO_MAIN_WINDOW_H | 29 | #ifndef TODO_MAIN_WINDOW_H |
30 | #define TODO_MAIN_WINDOW_H | 30 | #define TODO_MAIN_WINDOW_H |
31 | 31 | ||
32 | #include <qlist.h> | 32 | #include <qlist.h> |
33 | #include <qmainwindow.h> | ||
34 | 33 | ||
35 | #include <opie/otodoaccess.h> | 34 | #include <opie/otodoaccess.h> |
36 | #include <opie/otodo.h> | 35 | #include <opie/otodo.h> |
36 | #include <opie/opimmainwindow.h> | ||
37 | 37 | ||
38 | #include "smalltodo.h" | 38 | #include "smalltodo.h" |
39 | #include "todoview.h" | 39 | #include "todoview.h" |
40 | #include "quickedit.h" | 40 | #include "quickedit.h" |
@@ -55,20 +55,20 @@ namespace Todo { | |||
55 | class TodoShow; | 55 | class TodoShow; |
56 | class TemplateEditor; | 56 | class TemplateEditor; |
57 | struct QuickEditBase; | 57 | struct QuickEditBase; |
58 | 58 | ||
59 | class MainWindow : public QMainWindow { | 59 | class MainWindow : public OPimMainWindow { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | friend class TodoView; // avoid QObject here.... | ||
61 | public: | 62 | public: |
62 | MainWindow( QWidget *parent = 0, | 63 | MainWindow( QWidget *parent = 0, |
63 | const char* name = 0 ); | 64 | const char* name = 0 ); |
64 | ~MainWindow(); | 65 | ~MainWindow(); |
65 | 66 | ||
66 | /** return a context menu for an OTodo */ | 67 | /** return a context menu for an OTodo */ |
67 | QPopupMenu* contextMenu(int uid ); | 68 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); |
68 | QPopupMenu* options(); | 69 | QPopupMenu* options(); |
69 | QPopupMenu* edit(); | 70 | QPopupMenu* edit(); |
70 | QPopupMenu* view(); | ||
71 | QToolBar* toolbar(); | 71 | QToolBar* toolbar(); |
72 | 72 | ||
73 | 73 | ||
74 | void updateList(); | 74 | void updateList(); |
@@ -135,9 +135,8 @@ private slots: | |||
135 | QWidgetStack *m_stack; | 135 | QWidgetStack *m_stack; |
136 | QPopupMenu* m_catMenu, | 136 | QPopupMenu* m_catMenu, |
137 | *m_edit, | 137 | *m_edit, |
138 | *m_options, | 138 | *m_options, |
139 | *m_view, | ||
140 | *m_template; | 139 | *m_template; |
141 | /* box with two rows | 140 | /* box with two rows |
142 | * top will be the quick edit | 141 | * top will be the quick edit |
143 | * this will bite my ass once | 142 | * this will bite my ass once |
@@ -160,13 +159,15 @@ private slots: | |||
160 | 159 | ||
161 | private slots: | 160 | private slots: |
162 | void slotShow(int); | 161 | void slotShow(int); |
163 | void slotEdit(int); | 162 | void slotEdit(int); |
164 | private slots: | ||
165 | void slotUpdate3( QWidget* ); | 163 | void slotUpdate3( QWidget* ); |
164 | void slotComplete( int uid ); | ||
165 | void slotComplete( const OTodo& ev ); | ||
166 | void slotNewFromTemplate(int id ); | 166 | void slotNewFromTemplate(int id ); |
167 | void slotNew(); | 167 | void slotNew(); |
168 | void slotDuplicate(); | 168 | void slotDuplicate(); |
169 | |||
169 | void slotDelete(); | 170 | void slotDelete(); |
170 | void slotDeleteAll(); | 171 | void slotDeleteAll(); |
171 | void slotDeleteCompleted(); | 172 | void slotDeleteCompleted(); |
172 | 173 | ||
@@ -184,8 +185,19 @@ private slots: | |||
184 | void slotBeam(); | 185 | void slotBeam(); |
185 | void beamDone( Ir* ); | 186 | void beamDone( Ir* ); |
186 | void slotShowDetails(); | 187 | void slotShowDetails(); |
187 | void slotShowDue( bool ); | 188 | void slotShowDue( bool ); |
189 | /* reimplementation from opimmainwindow */ | ||
190 | protected slots: | ||
191 | void flush(); | ||
192 | void reload(); | ||
193 | int create(); | ||
194 | bool remove( int uid ); | ||
195 | void beam(int uid, int transport = IrDa ); | ||
196 | void show( int uid ); | ||
197 | void edit( int uid ); | ||
198 | void add( const OPimRecord& ); | ||
199 | OPimRecord* record( int rtti, const QByteArray& ); | ||
188 | }; | 200 | }; |
189 | }; | 201 | }; |
190 | 202 | ||
191 | #endif | 203 | #endif |
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp index 8b261de..eeb3c0c 100644 --- a/core/pim/todo/otaskeditor.cpp +++ b/core/pim/todo/otaskeditor.cpp | |||
@@ -1,13 +1,14 @@ | |||
1 | #include <qdatetime.h> | 1 | #include <qdatetime.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qmultilineedit.h> | 4 | #include <qmultilineedit.h> |
5 | #include <qscrollview.h> | ||
5 | 6 | ||
6 | #include <opie/orecurrancewidget.h> | 7 | #include <opie/orecurrancewidget.h> |
7 | 8 | ||
8 | #include "taskeditoroverviewimpl.h" | 9 | #include "taskeditoroverviewimpl.h" |
9 | #include "taskeditoradvanced.h" | 10 | #include "taskeditoradvancedimpl.h" |
10 | #include "taskeditoralarms.h" | 11 | #include "taskeditoralarms.h" |
11 | 12 | ||
12 | #include "otaskeditor.h" | 13 | #include "otaskeditor.h" |
13 | 14 | ||
@@ -39,34 +40,38 @@ OTodo OTaskEditor::todo()const{ | |||
39 | qWarning("saving!"); | 40 | qWarning("saving!"); |
40 | OTodo to; | 41 | OTodo to; |
41 | to.setUid(m_uid ); | 42 | to.setUid(m_uid ); |
42 | m_overView->save( to ); | 43 | m_overView->save( to ); |
43 | to.setDescription( m_line->text() ); | 44 | m_adv->save( to ); |
45 | to.setRecurrence( m_rec->recurrence() ); | ||
44 | 46 | ||
45 | return to; | 47 | return to; |
46 | } | 48 | } |
47 | void OTaskEditor::load(const OTodo& to) { | 49 | void OTaskEditor::load(const OTodo& to) { |
48 | m_overView->load( to ); | 50 | m_overView->load( to ); |
49 | m_line->setText( to.description() ); | 51 | m_adv->load( to ); |
52 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); | ||
50 | } | 53 | } |
51 | void OTaskEditor::init() { | 54 | void OTaskEditor::init() { |
52 | QVBoxLayout* lay = new QVBoxLayout(this); | 55 | QVBoxLayout* lay = new QVBoxLayout(this ); |
56 | QScrollView* view = new QScrollView( this ); | ||
57 | view->setResizePolicy( QScrollView::AutoOneFit ); | ||
58 | lay->addWidget( view ); | ||
59 | |||
53 | setCaption("Task Editor"); | 60 | setCaption("Task Editor"); |
54 | m_tab = new OTabWidget(this); | 61 | QWidget* container = new QWidget( view->viewport() ); |
62 | view->addChild( container ); | ||
55 | 63 | ||
64 | QVBoxLayout* layo = new QVBoxLayout( container ); | ||
65 | m_tab = new OTabWidget(container ); | ||
66 | layo->addWidget( m_tab ); | ||
56 | /* | 67 | /* |
57 | * Add the Widgets | 68 | * Add the Widgets |
58 | */ | 69 | */ |
59 | m_overView = new TaskEditorOverViewImpl(m_tab ); | 70 | m_overView = new TaskEditorOverViewImpl(m_tab ); |
60 | m_tab->addTab( m_overView, QString::null, tr("Overview") ); | 71 | m_tab->addTab( m_overView, QString::null, tr("Overview") ); |
61 | 72 | ||
62 | m_adv = new TaskEditorAdvanced( m_tab ); | 73 | m_adv = new TaskEditorAdvancedImpl( m_tab ); |
63 | m_line = new QMultiLineEdit(m_adv ); | ||
64 | m_line->setWordWrap( QMultiLineEdit::WidgetWidth ); | ||
65 | QLabel* label = new QLabel(m_adv ); | ||
66 | label->setText( tr("Description") ); | ||
67 | ((QGridLayout*) m_adv->layout() )->addWidget( label,3, 0 ); | ||
68 | ((QGridLayout*) m_adv->layout())->addWidget( m_line,4,0 ); | ||
69 | m_tab->addTab( m_adv, QString::null, tr("Advanced") ); | 74 | m_tab->addTab( m_adv, QString::null, tr("Advanced") ); |
70 | 75 | ||
71 | m_alarm = new TaskEditorAlarms( m_tab ); | 76 | m_alarm = new TaskEditorAlarms( m_tab ); |
72 | m_tab->addTab( m_alarm, QString::null, tr("Alarms") ); | 77 | m_tab->addTab( m_alarm, QString::null, tr("Alarms") ); |
@@ -80,12 +85,16 @@ void OTaskEditor::init() { | |||
80 | 85 | ||
81 | m_rec = new ORecurranceWidget( true, QDate::currentDate(), this ); | 86 | m_rec = new ORecurranceWidget( true, QDate::currentDate(), this ); |
82 | m_tab->addTab( m_rec, QString::null, tr("Recurrance") ); | 87 | m_tab->addTab( m_rec, QString::null, tr("Recurrance") ); |
83 | 88 | ||
84 | lay->addWidget(m_tab ); | ||
85 | 89 | ||
86 | /* signal and slots */ | 90 | /* signal and slots */ |
87 | connect(m_overView, SIGNAL(recurranceEnabled(bool) ), | 91 | connect(m_overView, SIGNAL(recurranceEnabled(bool) ), |
88 | m_rec, SLOT(setEnabled(bool) ) ); | 92 | m_rec, SLOT(setEnabled(bool) ) ); |
89 | 93 | ||
94 | /* connect due date changed to the recurrence tab */ | ||
95 | connect(m_overView, SIGNAL(dueDateChanged(const QDate&) ), | ||
96 | m_rec, SLOT(setStartDate(const QDate& ) ) ); | ||
97 | |||
98 | |||
90 | m_tab->setCurrentTab( m_overView ); | 99 | m_tab->setCurrentTab( m_overView ); |
91 | } | 100 | } |
diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h index bcbd543..b43abbf 100644 --- a/core/pim/todo/otaskeditor.h +++ b/core/pim/todo/otaskeditor.h | |||
@@ -6,9 +6,9 @@ | |||
6 | #include <opie/otodo.h> | 6 | #include <opie/otodo.h> |
7 | #include <opie/otabwidget.h> | 7 | #include <opie/otabwidget.h> |
8 | 8 | ||
9 | class TaskEditorOverViewImpl; | 9 | class TaskEditorOverViewImpl; |
10 | class TaskEditorAdvanced; | 10 | class TaskEditorAdvancedImpl; |
11 | class TaskEditorAlarms; | 11 | class TaskEditorAlarms; |
12 | class ORecurranceWidget; | 12 | class ORecurranceWidget; |
13 | class QMultiLineEdit; | 13 | class QMultiLineEdit; |
14 | class OTaskEditor : public QDialog { | 14 | class OTaskEditor : public QDialog { |
@@ -31,13 +31,12 @@ private: | |||
31 | void init(); | 31 | void init(); |
32 | 32 | ||
33 | OTabWidget *m_tab; | 33 | OTabWidget *m_tab; |
34 | TaskEditorOverViewImpl* m_overView; | 34 | TaskEditorOverViewImpl* m_overView; |
35 | TaskEditorAdvanced *m_adv; | 35 | TaskEditorAdvancedImpl *m_adv; |
36 | TaskEditorAlarms *m_alarm; | 36 | TaskEditorAlarms *m_alarm; |
37 | TaskEditorAlarms* m_remind; | 37 | TaskEditorAlarms* m_remind; |
38 | ORecurranceWidget* m_rec; | 38 | ORecurranceWidget* m_rec; |
39 | QMultiLineEdit* m_line; | ||
40 | int m_uid; | 39 | int m_uid; |
41 | 40 | ||
42 | }; | 41 | }; |
43 | 42 | ||
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index ded2dbd..0f683c9 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -34,8 +34,10 @@ | |||
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | 35 | ||
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | 37 | ||
38 | #include <opie/orecur.h> | ||
39 | |||
38 | #include "mainwindow.h" | 40 | #include "mainwindow.h" |
39 | //#include "tableitems.h" | 41 | //#include "tableitems.h" |
40 | #include "tableview.h" | 42 | #include "tableview.h" |
41 | 43 | ||
@@ -119,22 +121,23 @@ void TableView::newDay() { | |||
119 | TableView::~TableView() { | 121 | TableView::~TableView() { |
120 | 122 | ||
121 | } | 123 | } |
122 | void TableView::slotShowMenu() { | 124 | void TableView::slotShowMenu() { |
123 | QPopupMenu *menu = todoWindow()->contextMenu( current() ); | 125 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); |
124 | menu->exec(QCursor::pos() ); | 126 | menu->exec(QCursor::pos() ); |
125 | delete menu; | 127 | delete menu; |
126 | } | 128 | } |
127 | QString TableView::type() const { | 129 | QString TableView::type() const { |
128 | return QString::fromLatin1( tr("Table View") ); | 130 | return QString::fromLatin1( tr("Table View") ); |
129 | } | 131 | } |
130 | int TableView::current() { | 132 | int TableView::current() { |
131 | int uid = sorted().uidAt(currentRow() ); | 133 | int uid = sorted().uidAt(currentRow() ); |
132 | qWarning("uid %d", uid ); | 134 | |
133 | return uid; | 135 | return uid; |
134 | } | 136 | } |
135 | QString TableView::currentRepresentation() { | 137 | QString TableView::currentRepresentation() { |
136 | return text( currentRow(), 2); | 138 | OTodo to = sorted()[currentRow()]; |
139 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; | ||
137 | } | 140 | } |
138 | /* show overdue */ | 141 | /* show overdue */ |
139 | void TableView::showOverDue( bool ) { | 142 | void TableView::showOverDue( bool ) { |
140 | clear(); | 143 | clear(); |
@@ -144,9 +147,9 @@ void TableView::showOverDue( bool ) { | |||
144 | void TableView::updateView( ) { | 147 | void TableView::updateView( ) { |
145 | qWarning("update view"); | 148 | qWarning("update view"); |
146 | m_row = false; | 149 | m_row = false; |
147 | static int id; | 150 | static int id; |
148 | id = startTimer(2000 ); | 151 | id = startTimer(4000 ); |
149 | /* FIXME we want one page to be read! | 152 | /* FIXME we want one page to be read! |
150 | * | 153 | * |
151 | * Calculate that screensize | 154 | * Calculate that screensize |
152 | */ | 155 | */ |
@@ -241,12 +244,9 @@ void TableView::slotClicked(int row, int col, int, | |||
241 | if ( x >= ( w - BoxSize ) / 2 && | 244 | if ( x >= ( w - BoxSize ) / 2 && |
242 | x <= ( w - BoxSize ) / 2 + BoxSize && | 245 | x <= ( w - BoxSize ) / 2 + BoxSize && |
243 | y >= ( h - BoxSize ) / 2 && | 246 | y >= ( h - BoxSize ) / 2 && |
244 | y <= ( h - BoxSize ) / 2 + BoxSize ) { | 247 | y <= ( h - BoxSize ) / 2 + BoxSize ) { |
245 | OTodo todo = sorted()[row]; | 248 | TodoView::complete(sorted()[row] ); |
246 | todo.setCompleted( !todo.isCompleted() ); | ||
247 | TodoView::update( todo.uid(), todo ); | ||
248 | updateView(); | ||
249 | } | 249 | } |
250 | } | 250 | } |
251 | break; | 251 | break; |
252 | 252 | ||
@@ -368,9 +368,9 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool | |||
368 | case 2: | 368 | case 2: |
369 | // description field | 369 | // description field |
370 | { | 370 | { |
371 | QString text = task.summary().isEmpty() ? | 371 | QString text = task.summary().isEmpty() ? |
372 | task.description() : | 372 | task.description().left(20) : |
373 | task.summary(); | 373 | task.summary(); |
374 | p->drawText(2,2 + fm.ascent(), text); | 374 | p->drawText(2,2 + fm.ascent(), text); |
375 | } | 375 | } |
376 | break; | 376 | break; |
@@ -461,9 +461,9 @@ void TableView::slotPriority() { | |||
461 | * up and down. On odd or even we will currentRow()+-4 or +-9 | 461 | * up and down. On odd or even we will currentRow()+-4 or +-9 |
462 | * | 462 | * |
463 | */ | 463 | */ |
464 | void TableView::timerEvent( QTimerEvent* ev ) { | 464 | void TableView::timerEvent( QTimerEvent* ev ) { |
465 | qWarning("sorted %d", sorted().count() ); | 465 | // qWarning("sorted %d", sorted().count() ); |
466 | if (sorted().count() == 0 ) | 466 | if (sorted().count() == 0 ) |
467 | return; | 467 | return; |
468 | 468 | ||
469 | int row = currentRow(); | 469 | int row = currentRow(); |
@@ -512,13 +512,10 @@ void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { | |||
512 | int colNew = columnAt(e->x() ); | 512 | int colNew = columnAt(e->x() ); |
513 | qWarning("colNew: %d colOld: %d", colNew, colOld ); | 513 | qWarning("colNew: %d colOld: %d", colNew, colOld ); |
514 | if ( row == rowAt( e->y() ) && row != -1 && | 514 | if ( row == rowAt( e->y() ) && row != -1 && |
515 | colOld != colNew ) { | 515 | colOld != colNew ) { |
516 | OTodo todo = sorted()[row]; | 516 | TodoView::complete( sorted()[row] ); |
517 | todo.setCompleted( !todo.isCompleted() ); | 517 | return; |
518 | TodoView::update( todo.uid(), todo ); | ||
519 | updateView(); | ||
520 | return; | ||
521 | } | 518 | } |
522 | QTable::contentsMouseReleaseEvent( e ); | 519 | QTable::contentsMouseReleaseEvent( e ); |
523 | } | 520 | } |
524 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { | 521 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { |
diff --git a/core/pim/todo/taskeditoradvanced.ui b/core/pim/todo/taskeditoradvanced.ui index 3ea1346..6160712 100644 --- a/core/pim/todo/taskeditoradvanced.ui +++ b/core/pim/todo/taskeditoradvanced.ui | |||
@@ -10,9 +10,9 @@ | |||
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>236</width> | 14 | <width>232</width> |
15 | <height>307</height> | 15 | <height>307</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
@@ -194,8 +194,14 @@ | |||
194 | <class>QComboBox</class> | 194 | <class>QComboBox</class> |
195 | <item> | 195 | <item> |
196 | <property> | 196 | <property> |
197 | <name>text</name> | 197 | <name>text</name> |
198 | <string>Nothing</string> | ||
199 | </property> | ||
200 | </item> | ||
201 | <item> | ||
202 | <property> | ||
203 | <name>text</name> | ||
198 | <string>Responsible</string> | 204 | <string>Responsible</string> |
199 | </property> | 205 | </property> |
200 | </item> | 206 | </item> |
201 | <item> | 207 | <item> |
diff --git a/core/pim/todo/taskeditoroverviewimpl.cpp b/core/pim/todo/taskeditoroverviewimpl.cpp index 24b3386..aef3b1d 100644 --- a/core/pim/todo/taskeditoroverviewimpl.cpp +++ b/core/pim/todo/taskeditoroverviewimpl.cpp | |||
@@ -6,8 +6,10 @@ | |||
6 | #include <qpe/datebookmonth.h> | 6 | #include <qpe/datebookmonth.h> |
7 | #include <qpe/categoryselect.h> | 7 | #include <qpe/categoryselect.h> |
8 | #include <qpe/timestring.h> | 8 | #include <qpe/timestring.h> |
9 | 9 | ||
10 | #include <opie/orecur.h> | ||
11 | |||
10 | #include "taskeditoroverviewimpl.h" | 12 | #include "taskeditoroverviewimpl.h" |
11 | 13 | ||
12 | /* | 14 | /* |
13 | * we need to hack | 15 | * we need to hack |
@@ -19,49 +21,84 @@ TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* nam | |||
19 | } | 21 | } |
20 | TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { | 22 | TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { |
21 | } | 23 | } |
22 | void TaskEditorOverViewImpl::load( const OTodo& todo) { | 24 | void TaskEditorOverViewImpl::load( const OTodo& todo) { |
23 | /* | 25 | /* |
24 | * now that we're 'preloaded' we | 26 | * now that we're 'preloaded' we |
25 | * need to disable the buttons | 27 | * need to disable the buttons |
26 | * holding the dat | 28 | * holding the dat |
27 | */ | 29 | */ |
28 | btnDue-> setEnabled( FALSE ); | 30 | btnDue-> setEnabled( FALSE ); |
29 | btnComp-> setEnabled( FALSE ); | 31 | btnComp-> setEnabled( FALSE ); |
30 | btnStart->setEnabled( FALSE ); | 32 | btnStart->setEnabled( FALSE ); |
31 | 33 | ||
32 | 34 | /* | |
35 | * get some basic dateinfos for now | ||
36 | */ | ||
33 | QDate date = QDate::currentDate(); | 37 | QDate date = QDate::currentDate(); |
34 | QString str = TimeString::longDateString( date ); | 38 | QString str = TimeString::longDateString( date ); |
35 | 39 | ||
36 | emit recurranceEnabled( FALSE ); | 40 | CheckBox7->setChecked( todo.recurrence().doesRecur() ); |
37 | ckbStart->setChecked( FALSE ); | 41 | emit recurranceEnabled( todo.recurrence().doesRecur() ); |
38 | btnStart->setText( str ); | 42 | |
39 | 43 | ||
40 | ckbComp->setChecked( FALSE ); | 44 | ckbStart->setChecked( todo.hasStartDate() ); |
41 | btnComp->setText( str ); | 45 | btnStart->setEnabled( todo.hasStartDate() ); |
46 | if ( todo.hasStartDate() ) { | ||
47 | m_start = todo.startDate(); | ||
48 | btnStart->setText( TimeString::longDateString( m_start ) ); | ||
49 | } else | ||
50 | btnStart->setText( str ); | ||
51 | |||
52 | ckbComp->setChecked( todo.hasCompletedDate() ); | ||
53 | btnComp->setEnabled( todo.hasCompletedDate() ); | ||
54 | if ( todo.hasCompletedDate() ) { | ||
55 | m_comp = todo.completedDate(); | ||
56 | btnComp->setText( TimeString::longDateString( m_comp ) ); | ||
57 | }else | ||
58 | btnComp->setText( str ); | ||
42 | 59 | ||
43 | cmbProgress->setCurrentItem( todo.progress()/20 ); | 60 | cmbProgress->setCurrentItem( todo.progress()/20 ); |
44 | cmbSum->insertItem( todo.summary(), 0 ); | 61 | cmbSum->insertItem( todo.summary(), 0 ); |
45 | cmbSum->setCurrentItem( 0 ); | 62 | cmbSum->setCurrentItem( 0 ); |
46 | 63 | ||
47 | ckbDue->setChecked( todo.hasDueDate() ); | 64 | ckbDue->setChecked( todo.hasDueDate() ); |
48 | btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); | 65 | btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); |
49 | btnDue->setEnabled( todo.hasDueDate() ); | 66 | btnDue->setEnabled( todo.hasDueDate() ); |
67 | m_due = todo.dueDate(); | ||
50 | 68 | ||
51 | cmbPrio->setCurrentItem( todo.priority() -1 ); | 69 | cmbPrio->setCurrentItem( todo.priority() -1 ); |
52 | ckbCompleted->setChecked( todo.isCompleted() ); | 70 | ckbCompleted->setChecked( todo.isCompleted() ); |
53 | 71 | ||
54 | comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); | 72 | comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); |
55 | 73 | ||
56 | } | 74 | } |
57 | void TaskEditorOverViewImpl::save( OTodo& to) { | 75 | void TaskEditorOverViewImpl::save( OTodo& to) { |
58 | qWarning("save it now"); | 76 | /* a invalid date */ |
77 | QDate inval; | ||
78 | /* save our info back */ | ||
79 | |||
80 | /* due date */ | ||
59 | if ( ckbDue->isChecked() ) { | 81 | if ( ckbDue->isChecked() ) { |
60 | to.setDueDate( m_due ); | 82 | to.setDueDate( m_due ); |
61 | to.setHasDueDate( true ); | 83 | to.setHasDueDate( true ); |
62 | }else | 84 | }else |
63 | to.setHasDueDate( false ); | 85 | to.setHasDueDate( false ); |
86 | |||
87 | /* start date */ | ||
88 | if ( ckbStart->isChecked() ) { | ||
89 | to.setStartDate( m_start ); | ||
90 | }else | ||
91 | to.setStartDate( inval ); | ||
92 | |||
93 | /* comp date */ | ||
94 | if ( ckbComp->isChecked() ) { | ||
95 | qWarning("completed checked"); | ||
96 | to.setCompletedDate( m_comp ); | ||
97 | }else | ||
98 | to.setCompletedDate( inval ); | ||
99 | |||
100 | |||
64 | if ( comboCategory->currentCategory() != -1 ) { | 101 | if ( comboCategory->currentCategory() != -1 ) { |
65 | QArray<int> arr = comboCategory->currentCategories(); | 102 | QArray<int> arr = comboCategory->currentCategories(); |
66 | to.setCategories( arr ); | 103 | to.setCategories( arr ); |
67 | } | 104 | } |
@@ -135,13 +172,15 @@ void TaskEditorOverViewImpl::slotStartChanged(int y, int m, int d) { | |||
135 | btnStart->setText( TimeString::longDateString( m_start ) ); | 172 | btnStart->setText( TimeString::longDateString( m_start ) ); |
136 | } | 173 | } |
137 | void TaskEditorOverViewImpl::slotDueChecked() { | 174 | void TaskEditorOverViewImpl::slotDueChecked() { |
138 | btnDue->setEnabled( ckbDue->isChecked() ); | 175 | btnDue->setEnabled( ckbDue->isChecked() ); |
176 | emit dueDateChanged( m_due ); | ||
139 | qWarning("slotDueChecked"); | 177 | qWarning("slotDueChecked"); |
140 | } | 178 | } |
141 | void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) { | 179 | void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) { |
142 | m_due.setYMD(y, m, d ); | 180 | m_due.setYMD(y, m, d ); |
143 | btnDue->setText( TimeString::longDateString( m_due ) ); | 181 | btnDue->setText( TimeString::longDateString( m_due ) ); |
182 | emit dueDateChanged( m_due ); | ||
144 | } | 183 | } |
145 | void TaskEditorOverViewImpl::slotCompletedChecked() { | 184 | void TaskEditorOverViewImpl::slotCompletedChecked() { |
146 | btnComp->setEnabled( ckbComp->isChecked() ); | 185 | btnComp->setEnabled( ckbComp->isChecked() ); |
147 | qWarning("slotCompletedChecked"); | 186 | qWarning("slotCompletedChecked"); |
diff --git a/core/pim/todo/taskeditoroverviewimpl.h b/core/pim/todo/taskeditoroverviewimpl.h index 4fab381..5ee985e 100644 --- a/core/pim/todo/taskeditoroverviewimpl.h +++ b/core/pim/todo/taskeditoroverviewimpl.h | |||
@@ -19,8 +19,9 @@ public: | |||
19 | void load( const OTodo& ); | 19 | void load( const OTodo& ); |
20 | void save( OTodo& ); | 20 | void save( OTodo& ); |
21 | signals: | 21 | signals: |
22 | void recurranceEnabled( bool ); | 22 | void recurranceEnabled( bool ); |
23 | void dueDateChanged( const QDate& date ); | ||
23 | 24 | ||
24 | private: | 25 | private: |
25 | void init(); | 26 | void init(); |
26 | void popup(QPushButton*, QPopupMenu*); | 27 | void popup(QPushButton*, QPopupMenu*); |
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index 8f21416..40a5f28 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro | |||
@@ -17,9 +17,10 @@ HEADERS = smalltodo.h \ | |||
17 | templatedialogimpl.h \ | 17 | templatedialogimpl.h \ |
18 | quickedit.h \ | 18 | quickedit.h \ |
19 | quickeditimpl.h \ | 19 | quickeditimpl.h \ |
20 | otaskeditor.h \ | 20 | otaskeditor.h \ |
21 | taskeditoroverviewimpl.h | 21 | taskeditoroverviewimpl.h \ |
22 | taskeditoradvancedimpl.h | ||
22 | 23 | ||
23 | SOURCES= smalltodo.cpp \ | 24 | SOURCES= smalltodo.cpp \ |
24 | todomanager.cpp \ | 25 | todomanager.cpp \ |
25 | mainwindow.cpp \ | 26 | mainwindow.cpp \ |
@@ -36,9 +37,10 @@ SOURCES = smalltodo.cpp \ | |||
36 | templatedialogimpl.cpp \ | 37 | templatedialogimpl.cpp \ |
37 | quickeditimpl.cpp \ | 38 | quickeditimpl.cpp \ |
38 | quickedit.cpp \ | 39 | quickedit.cpp \ |
39 | otaskeditor.cpp \ | 40 | otaskeditor.cpp \ |
40 | taskeditoroverviewimpl.cpp | 41 | taskeditoroverviewimpl.cpp \ |
42 | taskeditoradvancedimpl.cpp | ||
41 | 43 | ||
42 | INTERFACES= taskeditoradvanced.ui taskeditoralarms.ui taskeditoroverview.ui | 44 | INTERFACES= taskeditoradvanced.ui taskeditoralarms.ui taskeditoroverview.ui |
43 | TARGET = todolist | 45 | TARGET = todolist |
44 | INCLUDEPATH += $(OPIEDIR)/include | 46 | INCLUDEPATH += $(OPIEDIR)/include |
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp index 1f81539..b5b87de 100644 --- a/core/pim/todo/todomanager.cpp +++ b/core/pim/todo/todomanager.cpp | |||
@@ -84,14 +84,17 @@ void TodoManager::update( int, const SmallTodo& ) { | |||
84 | } | 84 | } |
85 | void TodoManager::update( int, const OTodo& ev) { | 85 | void TodoManager::update( int, const OTodo& ev) { |
86 | m_db->replace( ev ); | 86 | m_db->replace( ev ); |
87 | } | 87 | } |
88 | void TodoManager::remove( int uid ) { | 88 | bool TodoManager::remove( int uid ) { |
89 | m_db->remove( uid ); | 89 | return m_db->remove( uid ); |
90 | } | 90 | } |
91 | void TodoManager::removeAll() { | 91 | void TodoManager::removeAll() { |
92 | m_db->clear(); | 92 | m_db->clear(); |
93 | } | 93 | } |
94 | void TodoManager::removeCompleted() { | ||
95 | m_db->removeAllCompleted(); | ||
96 | } | ||
94 | void TodoManager::save() { | 97 | void TodoManager::save() { |
95 | m_db->save(); | 98 | m_db->save(); |
96 | } | 99 | } |
97 | bool TodoManager::saveAll() { | 100 | bool TodoManager::saveAll() { |
diff --git a/core/pim/todo/todomanager.h b/core/pim/todo/todomanager.h index b03b598..8544277 100644 --- a/core/pim/todo/todomanager.h +++ b/core/pim/todo/todomanager.h | |||
@@ -81,10 +81,15 @@ namespace Todo { | |||
81 | public slots: | 81 | public slots: |
82 | void add( const OTodo& ); | 82 | void add( const OTodo& ); |
83 | void update( int uid, const SmallTodo& ); | 83 | void update( int uid, const SmallTodo& ); |
84 | void update( int uid, const OTodo& ); | 84 | void update( int uid, const OTodo& ); |
85 | void remove( int uid ); | 85 | bool remove( int uid ); |
86 | void remove( const QArray<int>& ); | 86 | void remove( const QArray<int>& ); |
87 | |||
88 | /** | ||
89 | * remove all completed | ||
90 | */ | ||
91 | void removeCompleted(); | ||
87 | void removeAll(); | 92 | void removeAll(); |
88 | void reload(); | 93 | void reload(); |
89 | void save(); | 94 | void save(); |
90 | 95 | ||
diff --git a/core/pim/todo/todoview.cpp b/core/pim/todo/todoview.cpp index 4cf7d30..3e808e7 100644 --- a/core/pim/todo/todoview.cpp +++ b/core/pim/todo/todoview.cpp | |||
@@ -3,54 +3,26 @@ | |||
3 | #include "todoview.h" | 3 | #include "todoview.h" |
4 | 4 | ||
5 | using namespace Todo; | 5 | using namespace Todo; |
6 | 6 | ||
7 | |||
8 | |||
9 | |||
7 | TodoView::TodoView( MainWindow* win ) | 10 | TodoView::TodoView( MainWindow* win ) |
8 | : m_main( win ) | 11 | : m_main( win ) |
9 | { | 12 | { |
10 | hack = new InternQtHack; | ||
11 | m_asc = false; | 13 | m_asc = false; |
12 | m_sortOrder = -1; | 14 | m_sortOrder = -1; |
13 | } | 15 | } |
14 | TodoView::~TodoView() { | 16 | TodoView::~TodoView() { |
15 | delete hack; | ||
16 | }; | 17 | }; |
17 | |||
18 | void TodoView::connectShow(QObject* obj, | ||
19 | const char* slot ) { | ||
20 | QObject::connect( hack, SIGNAL(showTodo(int) ), | ||
21 | obj, slot ); | ||
22 | } | ||
23 | void TodoView::connectEdit( QObject* obj, | ||
24 | const char* slot ) { | ||
25 | QObject::connect( hack, SIGNAL(edit(int) ), | ||
26 | obj, slot ); | ||
27 | } | ||
28 | void TodoView::connectUpdateSmall( QObject* obj, | ||
29 | const char* slot ) { | ||
30 | QObject::connect( hack, SIGNAL(update(int, const Todo::SmallTodo& ) ), | ||
31 | obj, slot ); | ||
32 | } | ||
33 | void TodoView::connectUpdateBig( QObject* obj, | ||
34 | const char* slot ) { | ||
35 | QObject::connect( hack, SIGNAL(update(int, const OTodo& ) ), | ||
36 | obj, slot ); | ||
37 | } | ||
38 | void TodoView::connectUpdateView( QObject* obj, | ||
39 | const char* slot ) { | ||
40 | QObject::connect( hack, SIGNAL(update(QWidget*) ), | ||
41 | obj, slot ); | ||
42 | } | ||
43 | void TodoView::connectRemove( QObject* obj, | ||
44 | const char* slot ) { | ||
45 | QObject::connect( hack, SIGNAL(remove(int) ), | ||
46 | obj, slot ); | ||
47 | } | ||
48 | MainWindow* TodoView::todoWindow() { | 18 | MainWindow* TodoView::todoWindow() { |
49 | return m_main; | 19 | return m_main; |
50 | } | 20 | } |
51 | 21 | ||
52 | OTodo TodoView::event(int uid ) { return m_main->event( uid ); } | 22 | OTodo TodoView::event(int uid ) { |
23 | return m_main->event( uid ); | ||
24 | } | ||
53 | OTodoAccess::List TodoView::list(){ | 25 | OTodoAccess::List TodoView::list(){ |
54 | todoWindow()->updateList(); | 26 | todoWindow()->updateList(); |
55 | return todoWindow()->list(); | 27 | return todoWindow()->list(); |
56 | } | 28 | } |
@@ -76,4 +48,19 @@ void TodoView::update(int, const SmallTodo& ) { | |||
76 | } | 48 | } |
77 | void TodoView::update(int , const OTodo& ev ) { | 49 | void TodoView::update(int , const OTodo& ev ) { |
78 | m_main->updateTodo( ev ); | 50 | m_main->updateTodo( ev ); |
79 | } | 51 | } |
52 | void TodoView::showTodo( int uid ) { | ||
53 | m_main->slotShow( uid ); | ||
54 | } | ||
55 | void TodoView::edit( int uid ) { | ||
56 | m_main->slotEdit( uid ); | ||
57 | } | ||
58 | void TodoView::remove( int uid ) { | ||
59 | m_main->m_todoMgr.remove( uid ); | ||
60 | } | ||
61 | void TodoView::complete( int uid ) { | ||
62 | m_main->slotComplete( uid ); | ||
63 | } | ||
64 | void TodoView::complete( const OTodo& ev ) { | ||
65 | m_main->slotComplete( ev ); | ||
66 | } | ||
diff --git a/core/pim/todo/todoview.h b/core/pim/todo/todoview.h index e5c77f9..e73e808 100644 --- a/core/pim/todo/todoview.h +++ b/core/pim/todo/todoview.h | |||
@@ -39,51 +39,14 @@ | |||
39 | #include "smalltodo.h" | 39 | #include "smalltodo.h" |
40 | 40 | ||
41 | 41 | ||
42 | namespace Todo { | 42 | namespace Todo { |
43 | |||
44 | /** | ||
45 | * According to tronical it's not possible | ||
46 | * to have Q_OBJECT in a template at all | ||
47 | * so this is a hack widget not meant | ||
48 | * to be public | ||
49 | */ | ||
50 | class InternQtHack : public QObject { | ||
51 | Q_OBJECT | ||
52 | public: | ||
53 | InternQtHack() : QObject() {}; | ||
54 | void emitShow(int uid) { emit showTodo(uid); } | ||
55 | void emitEdit(int uid) { emit edit(uid ); } | ||
56 | void emitUpdate( int uid, | ||
57 | const SmallTodo& to) { | ||
58 | emit update(uid, to ); | ||
59 | } | ||
60 | void emitUpdate( int uid, | ||
61 | const OTodo& ev ){ | ||
62 | emit update(uid, ev ); | ||
63 | } | ||
64 | void emitRemove( int uid ) { | ||
65 | emit remove( uid ); | ||
66 | } | ||
67 | void emitUpdate( QWidget* wid ) { | ||
68 | emit update( wid ); | ||
69 | } | ||
70 | signals: | ||
71 | void showTodo(int uid ); | ||
72 | void edit(int uid ); | ||
73 | void update( int uid, const Todo::SmallTodo& ); | ||
74 | void update( int uid, const OTodo& ); | ||
75 | /* sorry you need to cast */; | ||
76 | void update( QWidget* wid ); | ||
77 | void remove( int uid ); | ||
78 | |||
79 | }; | ||
80 | class MainWindow; | 43 | class MainWindow; |
81 | 44 | ||
82 | /** | 45 | /** |
83 | * due to inheretince problems we need this base class | 46 | * due to inheretince problems we need this base class |
84 | */ | 47 | */ |
85 | class ViewBase { | 48 | struct ViewBase { |
86 | public: | 49 | public: |
87 | virtual QWidget* widget() = 0; | 50 | virtual QWidget* widget() = 0; |
88 | virtual QString type()const = 0; | 51 | virtual QString type()const = 0; |
89 | virtual int current() = 0; | 52 | virtual int current() = 0; |
@@ -101,18 +64,9 @@ namespace Todo { | |||
101 | virtual void setShowCompleted( bool ) = 0; | 64 | virtual void setShowCompleted( bool ) = 0; |
102 | virtual void setShowDeadline( bool ) = 0; | 65 | virtual void setShowDeadline( bool ) = 0; |
103 | virtual void setShowCategory( const QString& = QString::null ) = 0; | 66 | virtual void setShowCategory( const QString& = QString::null ) = 0; |
104 | virtual void clear() = 0; | 67 | virtual void clear() = 0; |
105 | /* virtual QArray<int> completed() = 0; */ | ||
106 | virtual void newDay() = 0; | 68 | virtual void newDay() = 0; |
107 | |||
108 | virtual void connectShow( QObject*, const char* ) = 0; | ||
109 | virtual void connectEdit( QObject*, const char* ) = 0; | ||
110 | virtual void connectUpdateSmall( QObject*, const char* ) = 0; | ||
111 | virtual void connectUpdateBig( QObject*, const char* ) = 0; | ||
112 | virtual void connectUpdateView( QObject*, const char*) = 0; | ||
113 | virtual void connectRemove( QObject*, const char* ) = 0; | ||
114 | |||
115 | }; | 69 | }; |
116 | 70 | ||
117 | /** | 71 | /** |
118 | * A base class for all TodoView which are showing | 72 | * A base class for all TodoView which are showing |
@@ -137,23 +91,8 @@ namespace Todo { | |||
137 | *d'tor | 91 | *d'tor |
138 | */ | 92 | */ |
139 | virtual ~TodoView(); | 93 | virtual ~TodoView(); |
140 | 94 | ||
141 | /* connect to the show signal */ | ||
142 | void connectShow(QObject* obj, | ||
143 | const char* slot ); | ||
144 | |||
145 | /* connect to edit */ | ||
146 | void connectEdit( QObject* obj, | ||
147 | const char* slot ); | ||
148 | void connectUpdateSmall( QObject* obj, | ||
149 | const char* slot ); | ||
150 | void connectUpdateBig( QObject* obj, | ||
151 | const char* slot ) ; | ||
152 | void connectUpdateView( QObject* obj, | ||
153 | const char* slot ); | ||
154 | void connectRemove( QObject* obj, | ||
155 | const char* slot ); | ||
156 | protected: | 95 | protected: |
157 | MainWindow* todoWindow(); | 96 | MainWindow* todoWindow(); |
158 | OTodo event(int uid ); | 97 | OTodo event(int uid ); |
159 | OTodoAccess::List list(); | 98 | OTodoAccess::List list(); |
@@ -163,22 +102,19 @@ namespace Todo { | |||
163 | void setSortOrder( int order ); | 102 | void setSortOrder( int order ); |
164 | void setAscending( bool ); | 103 | void setAscending( bool ); |
165 | 104 | ||
166 | /* | 105 | /* |
167 | These things needs to be implemented | 106 | * These things needs to be implemented |
168 | in a implementation | 107 | * in a implementation |
169 | signals: | 108 | */ |
170 | */ | 109 | void showTodo( int uid ); |
171 | protected: | 110 | void edit( int uid ); |
172 | void showTodo( int uid ) { hack->emitShow(uid); } | ||
173 | void edit( int uid ) { hack->emitEdit(uid); } | ||
174 | void update(int uid, const SmallTodo& to ); | 111 | void update(int uid, const SmallTodo& to ); |
175 | void update(int uid, const OTodo& ev); | 112 | void update(int uid, const OTodo& ev); |
176 | void remove( int uid ) { | 113 | void remove( int uid ); |
177 | hack->emitRemove( uid ); | 114 | void complete( int uid ); |
178 | } | 115 | void complete( const OTodo& ev ); |
179 | private: | 116 | private: |
180 | InternQtHack* hack; | ||
181 | MainWindow *m_main; | 117 | MainWindow *m_main; |
182 | OTodoAccess::List m_sort; | 118 | OTodoAccess::List m_sort; |
183 | bool m_asc : 1; | 119 | bool m_asc : 1; |
184 | int m_sortOrder; | 120 | int m_sortOrder; |