Diffstat (limited to 'core/pim/todo/taskeditoradvanced.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/todo/taskeditoradvanced.cpp | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/core/pim/todo/taskeditoradvanced.cpp b/core/pim/todo/taskeditoradvanced.cpp new file mode 100644 index 0000000..a431d47 --- a/dev/null +++ b/core/pim/todo/taskeditoradvanced.cpp | |||
@@ -0,0 +1,132 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 <> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This program is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This program is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #include "taskeditoradvanced.h" | ||
30 | |||
31 | #include <opie/otodo.h> | ||
32 | #include <opie/opimmaintainer.h> | ||
33 | #include <opie/opimstate.h> | ||
34 | |||
35 | #include <qpe/resource.h> | ||
36 | |||
37 | #include <qcombobox.h> | ||
38 | #include <qlabel.h> | ||
39 | #include <qlayout.h> | ||
40 | #include <qmultilineedit.h> | ||
41 | #include <qscrollview.h> | ||
42 | #include <qtoolbutton.h> | ||
43 | #include <qwhatsthis.h> | ||
44 | |||
45 | TaskEditorAdvanced::TaskEditorAdvanced( QWidget* parent, const char* name, WFlags fl ) | ||
46 | : QWidget( parent, name, fl ) | ||
47 | { | ||
48 | QVBoxLayout *vb = new QVBoxLayout( this ); | ||
49 | |||
50 | QScrollView *sv = new QScrollView( this ); | ||
51 | vb->addWidget( sv ); | ||
52 | sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
53 | sv->setFrameStyle( QFrame::NoFrame ); | ||
54 | |||
55 | QWidget *container = new QWidget( sv->viewport() ); | ||
56 | sv->addChild( container ); | ||
57 | |||
58 | QGridLayout *layout = new QGridLayout( container, 5, 3, 4, 4 ); | ||
59 | |||
60 | QLabel *label = new QLabel( tr( "State:" ), container ); | ||
61 | layout->addWidget( label, 0, 0 ); | ||
62 | |||
63 | cmbState = new QComboBox( FALSE, container ); | ||
64 | cmbState->insertItem( tr( "Started" ) ); | ||
65 | cmbState->insertItem( tr( "Postponed" ) ); | ||
66 | cmbState->insertItem( tr( "Finished" ) ); | ||
67 | cmbState->insertItem( tr( "Not started" ) ); | ||
68 | layout->addMultiCellWidget( cmbState, 0, 0, 1, 2 ); | ||
69 | |||
70 | label = new QLabel( tr( "Maintain Mode:" ), container ); | ||
71 | layout->addWidget( label, 1, 0 ); | ||
72 | |||
73 | cmbMode = new QComboBox( FALSE, container ); | ||
74 | cmbMode->insertItem( tr( "Nothing" ) ); | ||
75 | cmbMode->insertItem( tr( "Responsible" ) ); | ||
76 | cmbMode->insertItem( tr( "Done By" ) ); | ||
77 | cmbMode->insertItem( tr( "Coordinating" ) ); | ||
78 | layout->addMultiCellWidget( cmbMode, 1, 1, 1, 2 ); | ||
79 | |||
80 | label = new QLabel( tr( "Maintainer:" ), container ); | ||
81 | layout->addWidget( label, 2, 0 ); | ||
82 | |||
83 | txtMaintainer = new QLabel( tr( "test" ), container ); | ||
84 | txtMaintainer->setTextFormat( QLabel::RichText ); | ||
85 | layout->addWidget( txtMaintainer, 2, 1 ); | ||
86 | |||
87 | tbtMaintainer = new QToolButton( container ); | ||
88 | tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) ); | ||
89 | layout->addWidget( tbtMaintainer, 2, 2 ); | ||
90 | |||
91 | label = new QLabel( tr( "Description:" ), container ); | ||
92 | layout->addWidget( label, 3, 0 ); | ||
93 | |||
94 | m_edit = new QMultiLineEdit( this ); | ||
95 | m_edit->setWordWrap( QMultiLineEdit::WidgetWidth ); | ||
96 | layout->addMultiCellWidget( m_edit, 4, 4, 0, 2 ); | ||
97 | } | ||
98 | |||
99 | TaskEditorAdvanced::~TaskEditorAdvanced() | ||
100 | { | ||
101 | } | ||
102 | |||
103 | void TaskEditorAdvanced::load( const OTodo &todo ) | ||
104 | { | ||
105 | m_edit->setText( todo.description() ); | ||
106 | |||
107 | /* OPimState */ | ||
108 | int state = todo.state().state(); | ||
109 | |||
110 | /* defualt to not started */ | ||
111 | if ( state == OPimState::Undefined ) | ||
112 | state = OPimState::NotStarted; | ||
113 | |||
114 | cmbState->setCurrentItem( state ); | ||
115 | |||
116 | /* Maintainer Mode */ | ||
117 | state = todo.maintainer().mode(); | ||
118 | if ( state == OPimMaintainer::Undefined ) | ||
119 | state = OPimMaintainer::Nothing; | ||
120 | |||
121 | cmbMode->setCurrentItem( state ); | ||
122 | } | ||
123 | |||
124 | void TaskEditorAdvanced::save( OTodo &todo ) | ||
125 | { | ||
126 | todo.setDescription( m_edit->text() ); | ||
127 | todo.setState( OPimState( cmbState->currentItem() ) ); | ||
128 | |||
129 | /* Fix me resolve name to uid.....*/ | ||
130 | todo.setMaintainer( OPimMaintainer( cmbMode->currentItem(), -10 ) ); | ||
131 | qWarning("save"); | ||
132 | } | ||