author | zecke <zecke> | 2002-11-30 11:21:35 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-30 11:21:35 (UTC) |
commit | 599c58c6ab2ab936890cbbfa4e6299493c141f8a (patch) (unidiff) | |
tree | 2813dd18d67b6ff6d151cdd1f0e5c1718c0e8eec | |
parent | fdda15344fdf7f71fd9e1e4db15ecc5e12224ddb (diff) | |
download | opie-599c58c6ab2ab936890cbbfa4e6299493c141f8a.zip opie-599c58c6ab2ab936890cbbfa4e6299493c141f8a.tar.gz opie-599c58c6ab2ab936890cbbfa4e6299493c141f8a.tar.bz2 |
More implementation
-rw-r--r-- | core/pim/todo/taskeditoradvancedimpl.cpp | 63 | ||||
-rw-r--r-- | core/pim/todo/taskeditoradvancedimpl.h | 37 |
2 files changed, 100 insertions, 0 deletions
diff --git a/core/pim/todo/taskeditoradvancedimpl.cpp b/core/pim/todo/taskeditoradvancedimpl.cpp new file mode 100644 index 0000000..89f672c --- a/dev/null +++ b/core/pim/todo/taskeditoradvancedimpl.cpp | |||
@@ -0,0 +1,63 @@ | |||
1 | #include <qmultilineedit.h> | ||
2 | #include <qcombobox.h> | ||
3 | #include <qlabel.h> | ||
4 | #include <qlayout.h> | ||
5 | |||
6 | |||
7 | #include <opie/otodo.h> | ||
8 | #include <opie/opimmaintainer.h> | ||
9 | #include <opie/opimstate.h> | ||
10 | |||
11 | #include "taskeditoradvancedimpl.h" | ||
12 | |||
13 | |||
14 | TaskEditorAdvancedImpl::TaskEditorAdvancedImpl( QWidget* parent, const char* name ) | ||
15 | : TaskEditorAdvanced( parent, name ) { | ||
16 | initUI(); | ||
17 | } | ||
18 | TaskEditorAdvancedImpl::~TaskEditorAdvancedImpl() { | ||
19 | } | ||
20 | void TaskEditorAdvancedImpl::load( const OTodo& todo) { | ||
21 | m_edit->setText( todo.description() ); | ||
22 | |||
23 | /* OPimState */ | ||
24 | int state = todo.state().state(); | ||
25 | |||
26 | /* defualt to not started */ | ||
27 | if ( state == OPimState::Undefined ) | ||
28 | state = OPimState::NotStarted; | ||
29 | |||
30 | cmbState->setCurrentItem( state ); | ||
31 | |||
32 | /* Maintainer Mode */ | ||
33 | state = todo.maintainer().mode(); | ||
34 | if ( state == OPimMaintainer::Undefined ) | ||
35 | state = OPimMaintainer::Nothing; | ||
36 | |||
37 | cmbMode->setCurrentItem( state ); | ||
38 | |||
39 | } | ||
40 | void TaskEditorAdvancedImpl::save( OTodo& todo) { | ||
41 | todo.setDescription( m_edit->text() ); | ||
42 | todo.setState( OPimState( cmbState->currentItem() ) ); | ||
43 | |||
44 | /* Fix me resolve name to uid.....*/ | ||
45 | todo.setMaintainer( OPimMaintainer( cmbMode->currentItem(), -10 ) ); | ||
46 | qWarning("save"); | ||
47 | } | ||
48 | /* | ||
49 | * int the damn UI | ||
50 | */ | ||
51 | void TaskEditorAdvancedImpl::initUI() { | ||
52 | /* a MultiLineEdit */ | ||
53 | m_edit = new QMultiLineEdit( this ); | ||
54 | m_edit->setWordWrap( QMultiLineEdit::WidgetWidth ); | ||
55 | |||
56 | /* a Label */ | ||
57 | QLabel* lbl = new QLabel(this ); | ||
58 | lbl->setText( tr("Description") ); | ||
59 | |||
60 | /* add it to the QGridLayout of our base class */ | ||
61 | static_cast<QGridLayout*>(layout() )->addWidget( lbl , 3, 0 ); | ||
62 | static_cast<QGridLayout*>(layout() )->addWidget( m_edit, 4, 0 ); | ||
63 | } | ||
diff --git a/core/pim/todo/taskeditoradvancedimpl.h b/core/pim/todo/taskeditoradvancedimpl.h new file mode 100644 index 0000000..215d8cb --- a/dev/null +++ b/core/pim/todo/taskeditoradvancedimpl.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef OPIE_TASK_EDITOR_ADVANCED_IMPL_H | ||
2 | #define OPIE_TASK_EDITOR_ADVANCED_IMPL_H | ||
3 | |||
4 | #include "taskeditoradvanced.h" | ||
5 | |||
6 | /** | ||
7 | * This is the implementation of the Opie Task Editor Advanced tab | ||
8 | * it features the State! | ||
9 | * MaintainerMode | ||
10 | * Description | ||
11 | */ | ||
12 | class QMultiLineEdit; | ||
13 | class OTodo; | ||
14 | class TaskEditorAdvancedImpl : public TaskEditorAdvanced { | ||
15 | Q_OBJECT | ||
16 | public: | ||
17 | TaskEditorAdvancedImpl( QWidget* parent = 0, const char* name = 0 ); | ||
18 | ~TaskEditorAdvancedImpl(); | ||
19 | |||
20 | /* | ||
21 | * I could have a struct which returns a QWidget* | ||
22 | * load and save to a OTodo | ||
23 | * and use multiple inheretence with all other widgets | ||
24 | * and then simply iterate over the list of structs | ||
25 | * this way I could easily have plugins for the whole editor.... | ||
26 | * but I do not do it -zecke | ||
27 | */ | ||
28 | void load( const OTodo& ); | ||
29 | void save( OTodo& ); | ||
30 | |||
31 | private: | ||
32 | void initUI(); | ||
33 | QMultiLineEdit* m_edit; | ||
34 | }; | ||
35 | |||
36 | |||
37 | #endif | ||