author | zecke <zecke> | 2002-11-30 11:21:35 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-30 11:21:35 (UTC) |
commit | 599c58c6ab2ab936890cbbfa4e6299493c141f8a (patch) (side-by-side diff) | |
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 @@ +#include <qmultilineedit.h> +#include <qcombobox.h> +#include <qlabel.h> +#include <qlayout.h> + + +#include <opie/otodo.h> +#include <opie/opimmaintainer.h> +#include <opie/opimstate.h> + +#include "taskeditoradvancedimpl.h" + + +TaskEditorAdvancedImpl::TaskEditorAdvancedImpl( QWidget* parent, const char* name ) + : TaskEditorAdvanced( parent, name ) { + initUI(); +} +TaskEditorAdvancedImpl::~TaskEditorAdvancedImpl() { +} +void TaskEditorAdvancedImpl::load( const OTodo& todo) { + m_edit->setText( todo.description() ); + + /* OPimState */ + int state = todo.state().state(); + + /* defualt to not started */ + if ( state == OPimState::Undefined ) + state = OPimState::NotStarted; + + cmbState->setCurrentItem( state ); + + /* Maintainer Mode */ + state = todo.maintainer().mode(); + if ( state == OPimMaintainer::Undefined ) + state = OPimMaintainer::Nothing; + + cmbMode->setCurrentItem( state ); + +} +void TaskEditorAdvancedImpl::save( OTodo& todo) { + todo.setDescription( m_edit->text() ); + todo.setState( OPimState( cmbState->currentItem() ) ); + + /* Fix me resolve name to uid.....*/ + todo.setMaintainer( OPimMaintainer( cmbMode->currentItem(), -10 ) ); + qWarning("save"); +} +/* + * int the damn UI + */ +void TaskEditorAdvancedImpl::initUI() { + /* a MultiLineEdit */ + m_edit = new QMultiLineEdit( this ); + m_edit->setWordWrap( QMultiLineEdit::WidgetWidth ); + + /* a Label */ + QLabel* lbl = new QLabel(this ); + lbl->setText( tr("Description") ); + + /* add it to the QGridLayout of our base class */ + static_cast<QGridLayout*>(layout() )->addWidget( lbl , 3, 0 ); + static_cast<QGridLayout*>(layout() )->addWidget( m_edit, 4, 0 ); +} 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 @@ +#ifndef OPIE_TASK_EDITOR_ADVANCED_IMPL_H +#define OPIE_TASK_EDITOR_ADVANCED_IMPL_H + +#include "taskeditoradvanced.h" + +/** + * This is the implementation of the Opie Task Editor Advanced tab + * it features the State! + * MaintainerMode + * Description + */ +class QMultiLineEdit; +class OTodo; +class TaskEditorAdvancedImpl : public TaskEditorAdvanced { + Q_OBJECT +public: + TaskEditorAdvancedImpl( QWidget* parent = 0, const char* name = 0 ); + ~TaskEditorAdvancedImpl(); + + /* + * I could have a struct which returns a QWidget* + * load and save to a OTodo + * and use multiple inheretence with all other widgets + * and then simply iterate over the list of structs + * this way I could easily have plugins for the whole editor.... + * but I do not do it -zecke + */ + void load( const OTodo& ); + void save( OTodo& ); + +private: + void initUI(); + QMultiLineEdit* m_edit; +}; + + +#endif |