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, 22 insertions, 13 deletions
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,91 +1,100 @@ | |||
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 | ||
14 | OTaskEditor::OTaskEditor(int cur) | 15 | OTaskEditor::OTaskEditor(int cur) |
15 | : QDialog(0, 0, TRUE ) { | 16 | : QDialog(0, 0, TRUE ) { |
16 | init(); | 17 | init(); |
17 | init( cur ); | 18 | init( cur ); |
18 | } | 19 | } |
19 | OTaskEditor::OTaskEditor( const OTodo& to) | 20 | OTaskEditor::OTaskEditor( const OTodo& to) |
20 | : QDialog(0, 0, TRUE ) { | 21 | : QDialog(0, 0, TRUE ) { |
21 | init(); | 22 | init(); |
22 | init( to ); | 23 | init( to ); |
23 | } | 24 | } |
24 | OTaskEditor::~OTaskEditor() { | 25 | OTaskEditor::~OTaskEditor() { |
25 | 26 | ||
26 | } | 27 | } |
27 | void OTaskEditor::init( int cur ) { | 28 | void OTaskEditor::init( int cur ) { |
28 | OTodo to; | 29 | OTodo to; |
29 | if ( cur != 0 ) | 30 | if ( cur != 0 ) |
30 | to.setCategories( cur ); | 31 | to.setCategories( cur ); |
31 | load(to); | 32 | load(to); |
32 | m_uid = 1; // generate a new one | 33 | m_uid = 1; // generate a new one |
33 | } | 34 | } |
34 | void OTaskEditor::init( const OTodo& to ) { | 35 | void OTaskEditor::init( const OTodo& to ) { |
35 | load( to ); | 36 | load( to ); |
36 | m_uid = to.uid(); | 37 | m_uid = to.uid(); |
37 | } | 38 | } |
38 | OTodo OTaskEditor::todo()const{ | 39 | 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") ); |
73 | 78 | ||
74 | m_remind = new TaskEditorAlarms( m_tab ); | 79 | m_remind = new TaskEditorAlarms( m_tab ); |
75 | m_tab->addTab( m_remind, QString::null, tr("Reminders") ); | 80 | m_tab->addTab( m_remind, QString::null, tr("Reminders") ); |
76 | 81 | ||
77 | QLabel* lbl = new QLabel(m_tab ); | 82 | QLabel* lbl = new QLabel(m_tab ); |
78 | lbl->setText( tr("X-Ref") ); | 83 | lbl->setText( tr("X-Ref") ); |
79 | m_tab->addTab( lbl, QString::null, tr("X-Ref") ); | 84 | m_tab->addTab( lbl, QString::null, tr("X-Ref") ); |
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 | } |