Diffstat (limited to 'core/pim/todo/otaskeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/otaskeditor.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp new file mode 100644 index 0000000..e8e922f --- a/dev/null +++ b/core/pim/todo/otaskeditor.cpp | |||
@@ -0,0 +1,83 @@ | |||
1 | #include <qdatetime.h> | ||
2 | #include <qlayout.h> | ||
3 | #include <qlabel.h> | ||
4 | #include <qmultilineedit.h> | ||
5 | |||
6 | #include <opie/orecurrancewidget.h> | ||
7 | |||
8 | #include "taskeditoroverviewimpl.h" | ||
9 | #include "taskeditoradvanced.h" | ||
10 | #include "taskeditoralarms.h" | ||
11 | |||
12 | #include "otaskeditor.h" | ||
13 | |||
14 | OTaskEditor::OTaskEditor(int cur) | ||
15 | : QDialog(0, 0, TRUE ) { | ||
16 | init(); | ||
17 | OTodo to; | ||
18 | to.setCategories( cur ); | ||
19 | load(to); | ||
20 | m_uid = 1; // generate a new one | ||
21 | } | ||
22 | OTaskEditor::OTaskEditor( const OTodo& to) | ||
23 | : QDialog(0, 0, TRUE ) { | ||
24 | init(); | ||
25 | load( to ); | ||
26 | m_uid = to.uid(); | ||
27 | } | ||
28 | OTaskEditor::~OTaskEditor() { | ||
29 | |||
30 | } | ||
31 | OTodo OTaskEditor::todo()const{ | ||
32 | qWarning("saving!"); | ||
33 | OTodo to; | ||
34 | to.setUid(m_uid ); | ||
35 | m_overView->save( to ); | ||
36 | to.setDescription( m_line->text() ); | ||
37 | |||
38 | return to; | ||
39 | } | ||
40 | void OTaskEditor::load(const OTodo& to) { | ||
41 | m_overView->load( to ); | ||
42 | m_line->setText( to.description() ); | ||
43 | } | ||
44 | void OTaskEditor::init() { | ||
45 | QVBoxLayout* lay = new QVBoxLayout(this); | ||
46 | setCaption("Task Editor"); | ||
47 | m_tab = new OTabWidget(this); | ||
48 | |||
49 | /* | ||
50 | * Add the Widgets | ||
51 | */ | ||
52 | m_overView = new TaskEditorOverViewImpl(m_tab ); | ||
53 | m_tab->addTab( m_overView, QString::null, tr("Overview") ); | ||
54 | |||
55 | m_adv = new TaskEditorAdvanced( m_tab ); | ||
56 | m_line = new QMultiLineEdit(m_adv ); | ||
57 | QLabel* label = new QLabel(m_adv ); | ||
58 | label->setText( tr("Description") ); | ||
59 | ((QGridLayout*) m_adv->layout() )->addWidget( label,3, 0 ); | ||
60 | ((QGridLayout*) m_adv->layout())->addWidget( m_line,4,0 ); | ||
61 | m_tab->addTab( m_adv, QString::null, tr("Advanced") ); | ||
62 | |||
63 | m_alarm = new TaskEditorAlarms( m_tab ); | ||
64 | m_tab->addTab( m_alarm, QString::null, tr("Alarms") ); | ||
65 | |||
66 | m_remind = new TaskEditorAlarms( m_tab ); | ||
67 | m_tab->addTab( m_remind, QString::null, tr("Reminders") ); | ||
68 | |||
69 | QLabel* lbl = new QLabel(m_tab ); | ||
70 | lbl->setText( tr("X-Ref") ); | ||
71 | m_tab->addTab( lbl, QString::null, tr("X-Ref") ); | ||
72 | |||
73 | m_rec = new ORecurranceWidget( true, QDate::currentDate(), this ); | ||
74 | m_tab->addTab( m_rec, QString::null, tr("Recurrance") ); | ||
75 | |||
76 | lay->addWidget(m_tab ); | ||
77 | |||
78 | /* signal and slots */ | ||
79 | connect(m_overView, SIGNAL(recurranceEnabled(bool) ), | ||
80 | m_rec, SLOT(setEnabled(bool) ) ); | ||
81 | |||
82 | m_tab->setCurrentTab( m_overView ); | ||
83 | } | ||