summaryrefslogtreecommitdiff
path: root/core/pim
Unidiff
Diffstat (limited to 'core/pim') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp213
-rw-r--r--core/pim/todo/mainwindow.h24
-rw-r--r--core/pim/todo/otaskeditor.cpp35
-rw-r--r--core/pim/todo/otaskeditor.h5
-rw-r--r--core/pim/todo/tableview.cpp27
-rw-r--r--core/pim/todo/taskeditoradvanced.ui8
-rw-r--r--core/pim/todo/taskeditoroverviewimpl.cpp55
-rw-r--r--core/pim/todo/taskeditoroverviewimpl.h1
-rw-r--r--core/pim/todo/todo.pro6
-rw-r--r--core/pim/todo/todomanager.cpp7
-rw-r--r--core/pim/todo/todomanager.h7
-rw-r--r--core/pim/todo/todoview.cpp55
-rw-r--r--core/pim/todo/todoview.h82
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
@@ -46,2 +46,3 @@
46 46
47#include <opie/orecur.h>
47#include <opie/otodoaccessvcal.h> 48#include <opie/otodoaccessvcal.h>
@@ -61,3 +62,5 @@ using namespace Todo;
61MainWindow::MainWindow( QWidget* parent, 62MainWindow::MainWindow( QWidget* parent,
62 const char* name ) { 63 const char* name )
64 : OPimMainWindow("Todolist")
65{
63 66
@@ -179,3 +182,3 @@ void MainWindow::initActions() {
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() );
@@ -183,5 +186,2 @@ void MainWindow::initActions() {
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
@@ -222,3 +222,2 @@ void MainWindow::initUI() {
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 );
@@ -256,13 +255,5 @@ MainWindow::~MainWindow() {
256void MainWindow::connectBase( ViewBase* base) { 255void 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, 258QPopupMenu* 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}
267QPopupMenu* MainWindow::contextMenu( int uid ) {
268 QPopupMenu* menu = new QPopupMenu(); 259 QPopupMenu* menu = new QPopupMenu();
@@ -272,4 +263,14 @@ QPopupMenu* MainWindow::contextMenu( int uid ) {
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;
@@ -283,5 +284,2 @@ QPopupMenu* MainWindow::edit() {
283} 284}
284QPopupMenu* MainWindow::view() {
285 return m_view;
286}
287QToolBar* MainWindow::toolbar() { 285QToolBar* MainWindow::toolbar() {
@@ -415,24 +413,3 @@ void MainWindow::slotNewFromTemplate( int id ) {
415void MainWindow::slotNew() { 413void 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}
@@ -476,3 +453,2 @@ void MainWindow::slotDeleteAll() {
476 453
477 //QString strName = table->text( table->currentRow(), 2 ).left( 30 );
478 454
@@ -496,4 +472,4 @@ void MainWindow::slotDeleteCompleted() {
496 472
497 // FIXME 473
498 //m_todoMgr.remove( currentView()->completed() ); 474 m_todoMgr.removeCompleted();
499 currentView()->updateView( ); 475 currentView()->updateView( );
@@ -554,14 +530,3 @@ static const char *beamfile = "/tmp/opie-todo.vcs";
554void MainWindow::slotBeam() { 530void 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}
@@ -706 +671,135 @@ QuickEditBase* MainWindow::quickEditor() {
706} 671}
672void MainWindow::slotComplete( int uid ) {
673 slotComplete( event(uid) );
674}
675void 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}
727void MainWindow::flush() {
728 slotFlush();
729}
730void MainWindow::reload() {
731 slotReload();
732}
733int 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... */
762bool MainWindow::remove( int uid ) {
763 if (m_syncing) return false;
764
765 return m_todoMgr.remove( uid );
766}
767void 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}
780void MainWindow::show( int uid ) {
781 slotShow( uid );
782}
783void MainWindow::edit( int uid ) {
784 slotEdit( uid );
785}
786void 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 */
803OPimRecord* 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
@@ -32,3 +32,2 @@
32#include <qlist.h> 32#include <qlist.h>
33#include <qmainwindow.h>
34 33
@@ -36,2 +35,3 @@
36#include <opie/otodo.h> 35#include <opie/otodo.h>
36#include <opie/opimmainwindow.h>
37 37
@@ -58,4 +58,5 @@ namespace Todo {
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:
@@ -66,6 +67,5 @@ namespace Todo {
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();
@@ -138,3 +138,2 @@ private slots:
138 *m_options, 138 *m_options,
139 *m_view,
140 *m_template; 139 *m_template;
@@ -163,4 +162,5 @@ private slots:
163 void slotEdit(int); 162 void slotEdit(int);
164private 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 );
@@ -168,2 +168,3 @@ private slots:
168 void slotDuplicate(); 168 void slotDuplicate();
169
169 void slotDelete(); 170 void slotDelete();
@@ -187,2 +188,13 @@ private slots:
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 };
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
@@ -4,2 +4,3 @@
4#include <qmultilineedit.h> 4#include <qmultilineedit.h>
5#include <qscrollview.h>
5 6
@@ -8,3 +9,3 @@
8#include "taskeditoroverviewimpl.h" 9#include "taskeditoroverviewimpl.h"
9#include "taskeditoradvanced.h" 10#include "taskeditoradvancedimpl.h"
10#include "taskeditoralarms.h" 11#include "taskeditoralarms.h"
@@ -42,3 +43,4 @@ OTodo OTaskEditor::todo()const{
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
@@ -48,9 +50,18 @@ 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}
51void OTaskEditor::init() { 54void 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 /*
@@ -61,9 +72,3 @@ void OTaskEditor::init() {
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") );
@@ -83,3 +88,2 @@ void OTaskEditor::init() {
83 88
84 lay->addWidget(m_tab );
85 89
@@ -89,2 +93,7 @@ void OTaskEditor::init() {
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 );
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
@@ -9,3 +9,3 @@
9class TaskEditorOverViewImpl; 9class TaskEditorOverViewImpl;
10class TaskEditorAdvanced; 10class TaskEditorAdvancedImpl;
11class TaskEditorAlarms; 11class TaskEditorAlarms;
@@ -34,3 +34,3 @@ private:
34 TaskEditorOverViewImpl* m_overView; 34 TaskEditorOverViewImpl* m_overView;
35 TaskEditorAdvanced *m_adv; 35 TaskEditorAdvancedImpl *m_adv;
36 TaskEditorAlarms *m_alarm; 36 TaskEditorAlarms *m_alarm;
@@ -38,3 +38,2 @@ private:
38 ORecurranceWidget* m_rec; 38 ORecurranceWidget* m_rec;
39 QMultiLineEdit* m_line;
40 int m_uid; 39 int m_uid;
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
@@ -37,2 +37,4 @@
37 37
38#include <opie/orecur.h>
39
38#include "mainwindow.h" 40#include "mainwindow.h"
@@ -122,3 +124,3 @@ TableView::~TableView() {
122void TableView::slotShowMenu() { 124void 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() );
@@ -131,3 +133,3 @@ 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;
@@ -135,3 +137,4 @@ int TableView::current() {
135QString TableView::currentRepresentation() { 137QString 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}
@@ -147,3 +150,3 @@ void TableView::updateView( ) {
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!
@@ -244,6 +247,3 @@ void TableView::slotClicked(int row, int col, int,
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 }
@@ -371,3 +371,3 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
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();
@@ -464,3 +464,3 @@ void TableView::slotPriority() {
464void TableView::timerEvent( QTimerEvent* ev ) { 464void 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 )
@@ -515,7 +515,4 @@ void TableView::contentsMouseReleaseEvent( QMouseEvent* e) {
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 }
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
@@ -13,3 +13,3 @@
13 <y>0</y> 13 <y>0</y>
14 <width>236</width> 14 <width>232</width>
15 <height>307</height> 15 <height>307</height>
@@ -197,2 +197,8 @@
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>
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
@@ -9,2 +9,4 @@
9 9
10#include <opie/orecur.h>
11
10#include "taskeditoroverviewimpl.h" 12#include "taskeditoroverviewimpl.h"
@@ -22,3 +24,3 @@ TaskEditorOverViewImpl::~TaskEditorOverViewImpl() {
22void TaskEditorOverViewImpl::load( const OTodo& todo) { 24void TaskEditorOverViewImpl::load( const OTodo& todo) {
23 /* 25 /*
24 * now that we're 'preloaded' we 26 * now that we're 'preloaded' we
@@ -31,3 +33,5 @@ void TaskEditorOverViewImpl::load( const OTodo& todo) {
31 33
32 34 /*
35 * get some basic dateinfos for now
36 */
33 QDate date = QDate::currentDate(); 37 QDate date = QDate::currentDate();
@@ -35,8 +39,21 @@ void TaskEditorOverViewImpl::load( const OTodo& todo) {
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
@@ -49,2 +66,3 @@ void TaskEditorOverViewImpl::load( const OTodo& todo) {
49 btnDue->setEnabled( todo.hasDueDate() ); 66 btnDue->setEnabled( todo.hasDueDate() );
67 m_due = todo.dueDate();
50 68
@@ -57,3 +75,7 @@ void TaskEditorOverViewImpl::load( const OTodo& todo) {
57void TaskEditorOverViewImpl::save( OTodo& to) { 75void 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() ) {
@@ -63,2 +85,17 @@ void TaskEditorOverViewImpl::save( OTodo& to) {
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 ) {
@@ -138,2 +175,3 @@ void TaskEditorOverViewImpl::slotDueChecked() {
138 btnDue->setEnabled( ckbDue->isChecked() ); 175 btnDue->setEnabled( ckbDue->isChecked() );
176 emit dueDateChanged( m_due );
139 qWarning("slotDueChecked"); 177 qWarning("slotDueChecked");
@@ -143,2 +181,3 @@ void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) {
143 btnDue->setText( TimeString::longDateString( m_due ) ); 181 btnDue->setText( TimeString::longDateString( m_due ) );
182 emit dueDateChanged( m_due );
144} 183}
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
@@ -22,2 +22,3 @@ signals:
22 void recurranceEnabled( bool ); 22 void recurranceEnabled( bool );
23 void dueDateChanged( const QDate& date );
23 24
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
@@ -20,3 +20,4 @@ HEADERS = smalltodo.h \
20 otaskeditor.h \ 20 otaskeditor.h \
21 taskeditoroverviewimpl.h 21 taskeditoroverviewimpl.h \
22 taskeditoradvancedimpl.h
22 23
@@ -39,3 +40,4 @@ SOURCES = smalltodo.cpp \
39 otaskeditor.cpp \ 40 otaskeditor.cpp \
40 taskeditoroverviewimpl.cpp 41 taskeditoroverviewimpl.cpp \
42 taskeditoradvancedimpl.cpp
41 43
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
@@ -87,4 +87,4 @@ void TodoManager::update( int, const OTodo& ev) {
87} 87}
88void TodoManager::remove( int uid ) { 88bool TodoManager::remove( int uid ) {
89 m_db->remove( uid ); 89 return m_db->remove( uid );
90} 90}
@@ -93,2 +93,5 @@ void TodoManager::removeAll() {
93} 93}
94void TodoManager::removeCompleted() {
95 m_db->removeAllCompleted();
96}
94void TodoManager::save() { 97void TodoManager::save() {
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
@@ -84,4 +84,9 @@ namespace Todo {
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();
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
@@ -6,2 +6,5 @@ using namespace Todo;
6 6
7
8
9
7TodoView::TodoView( MainWindow* win ) 10TodoView::TodoView( MainWindow* win )
@@ -9,3 +12,2 @@ TodoView::TodoView( MainWindow* win )
9{ 12{
10 hack = new InternQtHack;
11 m_asc = false; 13 m_asc = false;
@@ -14,35 +16,3 @@ TodoView::TodoView( MainWindow* win )
14TodoView::~TodoView() { 16TodoView::~TodoView() {
15 delete hack;
16}; 17};
17
18void TodoView::connectShow(QObject* obj,
19 const char* slot ) {
20 QObject::connect( hack, SIGNAL(showTodo(int) ),
21 obj, slot );
22}
23void TodoView::connectEdit( QObject* obj,
24 const char* slot ) {
25 QObject::connect( hack, SIGNAL(edit(int) ),
26 obj, slot );
27}
28void TodoView::connectUpdateSmall( QObject* obj,
29 const char* slot ) {
30 QObject::connect( hack, SIGNAL(update(int, const Todo::SmallTodo& ) ),
31 obj, slot );
32}
33void TodoView::connectUpdateBig( QObject* obj,
34 const char* slot ) {
35 QObject::connect( hack, SIGNAL(update(int, const OTodo& ) ),
36 obj, slot );
37}
38void TodoView::connectUpdateView( QObject* obj,
39 const char* slot ) {
40 QObject::connect( hack, SIGNAL(update(QWidget*) ),
41 obj, slot );
42}
43void TodoView::connectRemove( QObject* obj,
44 const char* slot ) {
45 QObject::connect( hack, SIGNAL(remove(int) ),
46 obj, slot );
47}
48MainWindow* TodoView::todoWindow() { 18MainWindow* TodoView::todoWindow() {
@@ -51,3 +21,5 @@ MainWindow* TodoView::todoWindow() {
51 21
52OTodo TodoView::event(int uid ) { return m_main->event( uid ); } 22OTodo TodoView::event(int uid ) {
23 return m_main->event( uid );
24}
53OTodoAccess::List TodoView::list(){ 25OTodoAccess::List TodoView::list(){
@@ -79 +51,16 @@ void TodoView::update(int , const OTodo& ev ) {
79} 51}
52void TodoView::showTodo( int uid ) {
53 m_main->slotShow( uid );
54}
55void TodoView::edit( int uid ) {
56 m_main->slotEdit( uid );
57}
58void TodoView::remove( int uid ) {
59 m_main->m_todoMgr.remove( uid );
60}
61void TodoView::complete( int uid ) {
62 m_main->slotComplete( uid );
63}
64void 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
@@ -42,39 +42,2 @@
42namespace Todo { 42namespace 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;
@@ -84,3 +47,3 @@ namespace Todo {
84 */ 47 */
85 class ViewBase { 48 struct ViewBase {
86 public: 49 public:
@@ -104,12 +67,3 @@ namespace Todo {
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 };
@@ -140,17 +94,2 @@ namespace Todo {
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:
@@ -166,16 +105,13 @@ namespace Todo {
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;