summaryrefslogtreecommitdiff
path: root/core/pim/todo/taskeditoradvancedimpl.cpp
blob: 89f672cb1cee1252d83b44988c9af1f0e40e1f11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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 );
}