summaryrefslogtreecommitdiff
path: root/core/pim/todo/otaskeditor.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/otaskeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/otaskeditor.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp
index 84f854f..1ed20b4 100644
--- a/core/pim/todo/otaskeditor.cpp
+++ b/core/pim/todo/otaskeditor.cpp
@@ -1,69 +1,65 @@
1#include <qdatetime.h>
2#include <qlabel.h>
3#include <qlayout.h> 1#include <qlayout.h>
4#include <qmultilineedit.h>
5 2
6#include <opie/orecurrancewidget.h> 3#include <opie/orecurrancewidget.h>
7 4
8#include "taskeditoroverview.h" 5#include "taskeditoroverview.h"
9#include "taskeditorstatus.h" 6#include "taskeditorstatus.h"
10#include "taskeditoralarms.h" 7#include "taskeditoralarms.h"
11 8
12#include "otaskeditor.h" 9#include "otaskeditor.h"
13 10
14OTaskEditor::OTaskEditor(int cur) 11OTaskEditor::OTaskEditor(int cur)
15 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { 12 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) {
16 init(); 13 init();
17 init( cur ); 14 init( cur );
18} 15}
19OTaskEditor::OTaskEditor( const OTodo& to) 16OTaskEditor::OTaskEditor( const OTodo& to)
20 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { 17 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) {
21 init(); 18 init();
22 init( to ); 19 init( to );
23} 20}
24OTaskEditor::~OTaskEditor() { 21OTaskEditor::~OTaskEditor() {
25 22
26} 23}
27void OTaskEditor::init( int cur ) { 24void OTaskEditor::init( int cur ) {
28 OTodo to; 25 OTodo to;
26 to.setUid( 1 ); // generate a new uid
29 if ( cur != 0 ) 27 if ( cur != 0 )
30 to.setCategories( cur ); 28 to.setCategories( cur );
31 load(to); 29 load(to);
32 m_uid = 1; // generate a new one
33} 30}
34void OTaskEditor::init( const OTodo& to ) { 31void OTaskEditor::init( const OTodo& to ) {
35 load( to ); 32 load( to );
36 m_uid = to.uid();
37} 33}
38OTodo OTaskEditor::todo()const{ 34OTodo OTaskEditor::todo()const{
39 qWarning("saving!"); 35 qWarning("saving!");
40 OTodo to; 36 OTodo to ( m_todo );
41 to.setUid(m_uid );
42 m_overView->save( to ); 37 m_overView->save( to );
43 m_stat->save( to ); 38 m_stat->save( to );
44 to.setRecurrence( m_rec->recurrence() ); 39 to.setRecurrence( m_rec->recurrence() );
45 m_alarm->save( to ); 40 m_alarm->save( to );
46 41
47 return to; 42 return to;
48} 43}
49void OTaskEditor::load(const OTodo& to) { 44void OTaskEditor::load(const OTodo& to) {
50 m_overView->load( to ); 45 m_overView->load( to );
51 m_stat->load( to ); 46 m_stat->load( to );
52 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); 47 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() );
53 m_alarm->setEnabled( !to.hasRecurrence() );
54 m_alarm->load( to ); 48 m_alarm->load( to );
49
50 m_todo = to;
55} 51}
56void OTaskEditor::init() { 52void OTaskEditor::init() {
57 setCaption("Task Editor"); 53 setCaption(tr("Task Editor") );
58 54
59 QVBoxLayout* layo = new QVBoxLayout( this ); 55 QVBoxLayout* layo = new QVBoxLayout( this );
60 m_tab = new OTabWidget( this ); 56 m_tab = new OTabWidget( this );
61 layo->addWidget( m_tab ); 57 layo->addWidget( m_tab );
62 58
63 /* 59 /*
64 * Add the Widgets 60 * Add the Widgets
65 */ 61 */
66 m_overView = new TaskEditorOverView( m_tab ); 62 m_overView = new TaskEditorOverView( m_tab );
67 m_tab->addTab( m_overView, "todo/info", tr("Information") ); 63 m_tab->addTab( m_overView, "todo/info", tr("Information") );
68 64
69 m_stat = new TaskEditorStatus( m_tab ); 65 m_stat = new TaskEditorStatus( m_tab );