Diffstat (limited to 'core/pim/todo/otaskeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/otaskeditor.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp index eeb3c0c..e6ebf60 100644 --- a/core/pim/todo/otaskeditor.cpp +++ b/core/pim/todo/otaskeditor.cpp | |||
@@ -1,100 +1,93 @@ | |||
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> | ||
6 | 5 | ||
7 | #include <opie/orecurrancewidget.h> | 6 | #include <opie/orecurrancewidget.h> |
8 | 7 | ||
9 | #include "taskeditoroverviewimpl.h" | 8 | #include "taskeditoroverview.h" |
10 | #include "taskeditoradvancedimpl.h" | 9 | #include "taskeditoradvancedimpl.h" |
11 | #include "taskeditoralarms.h" | 10 | #include "taskeditoralarms.h" |
12 | 11 | ||
13 | #include "otaskeditor.h" | 12 | #include "otaskeditor.h" |
14 | 13 | ||
15 | OTaskEditor::OTaskEditor(int cur) | 14 | OTaskEditor::OTaskEditor(int cur) |
16 | : QDialog(0, 0, TRUE ) { | 15 | : QDialog(0, 0, TRUE ) { |
17 | init(); | 16 | init(); |
18 | init( cur ); | 17 | init( cur ); |
19 | } | 18 | } |
20 | OTaskEditor::OTaskEditor( const OTodo& to) | 19 | OTaskEditor::OTaskEditor( const OTodo& to) |
21 | : QDialog(0, 0, TRUE ) { | 20 | : QDialog(0, 0, TRUE ) { |
22 | init(); | 21 | init(); |
23 | init( to ); | 22 | init( to ); |
24 | } | 23 | } |
25 | OTaskEditor::~OTaskEditor() { | 24 | OTaskEditor::~OTaskEditor() { |
26 | 25 | ||
27 | } | 26 | } |
28 | void OTaskEditor::init( int cur ) { | 27 | void OTaskEditor::init( int cur ) { |
29 | OTodo to; | 28 | OTodo to; |
30 | if ( cur != 0 ) | 29 | if ( cur != 0 ) |
31 | to.setCategories( cur ); | 30 | to.setCategories( cur ); |
32 | load(to); | 31 | load(to); |
33 | m_uid = 1; // generate a new one | 32 | m_uid = 1; // generate a new one |
34 | } | 33 | } |
35 | void OTaskEditor::init( const OTodo& to ) { | 34 | void OTaskEditor::init( const OTodo& to ) { |
36 | load( to ); | 35 | load( to ); |
37 | m_uid = to.uid(); | 36 | m_uid = to.uid(); |
38 | } | 37 | } |
39 | OTodo OTaskEditor::todo()const{ | 38 | OTodo OTaskEditor::todo()const{ |
40 | qWarning("saving!"); | 39 | qWarning("saving!"); |
41 | OTodo to; | 40 | OTodo to; |
42 | to.setUid(m_uid ); | 41 | to.setUid(m_uid ); |
43 | m_overView->save( to ); | 42 | m_overView->save( to ); |
44 | m_adv->save( to ); | 43 | //m_adv->save( to ); |
45 | to.setRecurrence( m_rec->recurrence() ); | 44 | to.setRecurrence( m_rec->recurrence() ); |
46 | 45 | ||
47 | return to; | 46 | return to; |
48 | } | 47 | } |
49 | void OTaskEditor::load(const OTodo& to) { | 48 | void OTaskEditor::load(const OTodo& to) { |
50 | m_overView->load( to ); | 49 | m_overView->load( to ); |
51 | m_adv->load( to ); | 50 | //m_adv->load( to ); |
52 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); | 51 | m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); |
53 | } | 52 | } |
54 | void OTaskEditor::init() { | 53 | void OTaskEditor::init() { |
55 | QVBoxLayout* lay = new QVBoxLayout(this ); | ||
56 | QScrollView* view = new QScrollView( this ); | ||
57 | view->setResizePolicy( QScrollView::AutoOneFit ); | ||
58 | lay->addWidget( view ); | ||
59 | |||
60 | setCaption("Task Editor"); | 54 | setCaption("Task Editor"); |
61 | QWidget* container = new QWidget( view->viewport() ); | ||
62 | view->addChild( container ); | ||
63 | 55 | ||
64 | QVBoxLayout* layo = new QVBoxLayout( container ); | 56 | QVBoxLayout* layo = new QVBoxLayout( this ); |
65 | m_tab = new OTabWidget(container ); | 57 | m_tab = new OTabWidget( this ); |
66 | layo->addWidget( m_tab ); | 58 | layo->addWidget( m_tab ); |
59 | |||
67 | /* | 60 | /* |
68 | * Add the Widgets | 61 | * Add the Widgets |
69 | */ | 62 | */ |
70 | m_overView = new TaskEditorOverViewImpl(m_tab ); | 63 | m_overView = new TaskEditorOverView( m_tab ); |
71 | m_tab->addTab( m_overView, QString::null, tr("Overview") ); | 64 | m_tab->addTab( m_overView, "TodoList", tr("Overview") ); |
72 | 65 | ||
73 | m_adv = new TaskEditorAdvancedImpl( m_tab ); | 66 | m_adv = new TaskEditorAdvancedImpl( m_tab ); |
74 | m_tab->addTab( m_adv, QString::null, tr("Advanced") ); | 67 | m_tab->addTab( m_adv, "todo/advanced", tr("Advanced") ); |
75 | 68 | ||
76 | m_alarm = new TaskEditorAlarms( m_tab ); | 69 | m_alarm = new TaskEditorAlarms( m_tab ); |
77 | m_tab->addTab( m_alarm, QString::null, tr("Alarms") ); | 70 | m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); |
78 | 71 | ||
79 | m_remind = new TaskEditorAlarms( m_tab ); | 72 | m_remind = new TaskEditorAlarms( m_tab ); |
80 | m_tab->addTab( m_remind, QString::null, tr("Reminders") ); | 73 | m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); |
81 | 74 | ||
82 | QLabel* lbl = new QLabel(m_tab ); | 75 | QLabel* lbl = new QLabel( m_tab ); |
83 | lbl->setText( tr("X-Ref") ); | 76 | lbl->setText( tr("X-Ref") ); |
84 | m_tab->addTab( lbl, QString::null, tr("X-Ref") ); | 77 | m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); |
85 | 78 | ||
86 | m_rec = new ORecurranceWidget( true, QDate::currentDate(), this ); | 79 | m_rec = new ORecurranceWidget( true, QDate::currentDate(), this ); |
87 | m_tab->addTab( m_rec, QString::null, tr("Recurrance") ); | 80 | m_tab->addTab( m_rec, "repeat", tr("Recurrance") ); |
88 | 81 | ||
89 | 82 | ||
90 | /* signal and slots */ | 83 | /* signal and slots */ |
91 | connect(m_overView, SIGNAL(recurranceEnabled(bool) ), | 84 | connect(m_overView, SIGNAL(recurranceEnabled(bool) ), |
92 | m_rec, SLOT(setEnabled(bool) ) ); | 85 | m_rec, SLOT(setEnabled(bool) ) ); |
93 | 86 | ||
94 | /* connect due date changed to the recurrence tab */ | 87 | /* connect due date changed to the recurrence tab */ |
95 | connect(m_overView, SIGNAL(dueDateChanged(const QDate&) ), | 88 | connect(m_overView, SIGNAL(dueDateChanged(const QDate&) ), |
96 | m_rec, SLOT(setStartDate(const QDate& ) ) ); | 89 | m_rec, SLOT(setStartDate(const QDate& ) ) ); |
97 | 90 | ||
98 | 91 | ||
99 | m_tab->setCurrentTab( m_overView ); | 92 | m_tab->setCurrentTab( m_overView ); |
100 | } | 93 | } |