author | zecke <zecke> | 2003-05-07 16:16:44 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-05-07 16:16:44 (UTC) |
commit | 1cee00987d34729393fb9383d90babd39517cc68 (patch) (unidiff) | |
tree | 03a51eaf8bfcfd242b4bb98d29e941b0b9dcb38a | |
parent | 1e9e3371d61cfc404329a8bad51f8b061c1ad73d (diff) | |
download | opie-1cee00987d34729393fb9383d90babd39517cc68.zip opie-1cee00987d34729393fb9383d90babd39517cc68.tar.gz opie-1cee00987d34729393fb9383d90babd39517cc68.tar.bz2 |
try to use the has* functions
-rw-r--r-- | core/pim/todo/taskeditoroverview.cpp | 4 | ||||
-rw-r--r-- | core/pim/todo/taskeditorstatus.cpp | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/core/pim/todo/taskeditoroverview.cpp b/core/pim/todo/taskeditoroverview.cpp index 92408ba..9a8abea 100644 --- a/core/pim/todo/taskeditoroverview.cpp +++ b/core/pim/todo/taskeditoroverview.cpp | |||
@@ -1,177 +1,177 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 <> | 3 | .=l. Copyright (c) 2002 <> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This program is free software; you can | 5 | _;:, .> :=|. This program is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This program is distributed in the hope that | 12 | .i_,=:_. -<s. This program is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = General Public License along with | 21 | -_. . . )=. = General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "taskeditoroverview.h" | 29 | #include "taskeditoroverview.h" |
30 | 30 | ||
31 | #include <opie/orecur.h> | 31 | #include <opie/orecur.h> |
32 | 32 | ||
33 | #include <qpe/categoryselect.h> | 33 | #include <qpe/categoryselect.h> |
34 | #include <qpe/datebookmonth.h> | 34 | #include <qpe/datebookmonth.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <qpe/timestring.h> | 36 | #include <qpe/timestring.h> |
37 | 37 | ||
38 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qlabel.h> | 40 | #include <qlabel.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qmultilineedit.h> | 42 | #include <qmultilineedit.h> |
43 | #include <qwhatsthis.h> | 43 | #include <qwhatsthis.h> |
44 | 44 | ||
45 | TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl ) | 45 | TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl ) |
46 | : QWidget( parent, name, fl ) | 46 | : QWidget( parent, name, fl ) |
47 | { | 47 | { |
48 | // Load icons | 48 | // Load icons |
49 | // TODO - probably should be done globally somewhere else, | 49 | // TODO - probably should be done globally somewhere else, |
50 | // see also quickeditimpl.cpp/h, tableview.cpp/h | 50 | // see also quickeditimpl.cpp/h, tableview.cpp/h |
51 | QString namestr; | 51 | QString namestr; |
52 | for ( unsigned int i = 1; i < 6; i++ ) { | 52 | for ( unsigned int i = 1; i < 6; i++ ) { |
53 | namestr = "todo/priority"; | 53 | namestr = "todo/priority"; |
54 | namestr.append( QString::number( i ) ); | 54 | namestr.append( QString::number( i ) ); |
55 | m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); | 55 | m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); |
56 | } | 56 | } |
57 | 57 | ||
58 | QVBoxLayout *vb = new QVBoxLayout( this ); | 58 | QVBoxLayout *vb = new QVBoxLayout( this ); |
59 | 59 | ||
60 | QScrollView *sv = new QScrollView( this ); | 60 | QScrollView *sv = new QScrollView( this ); |
61 | vb->addWidget( sv ); | 61 | vb->addWidget( sv ); |
62 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 62 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
63 | sv->setFrameStyle( QFrame::NoFrame ); | 63 | sv->setFrameStyle( QFrame::NoFrame ); |
64 | 64 | ||
65 | QWidget *container = new QWidget( sv->viewport() ); | 65 | QWidget *container = new QWidget( sv->viewport() ); |
66 | sv->addChild( container ); | 66 | sv->addChild( container ); |
67 | 67 | ||
68 | QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 ); | 68 | QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 ); |
69 | 69 | ||
70 | // Description | 70 | // Description |
71 | QLabel *label = new QLabel( tr( "Description:" ), container ); | 71 | QLabel *label = new QLabel( tr( "Description:" ), container ); |
72 | layout->addWidget( label, 0, 0 ); | 72 | layout->addWidget( label, 0, 0 ); |
73 | QWhatsThis::add( label, tr( "Enter brief description of the task here." ) ); | 73 | QWhatsThis::add( label, tr( "Enter brief description of the task here." ) ); |
74 | cmbDesc = new QComboBox( TRUE, container ); | 74 | cmbDesc = new QComboBox( TRUE, container ); |
75 | cmbDesc->insertItem( tr( "Complete " ) ); | 75 | cmbDesc->insertItem( tr( "Complete " ) ); |
76 | cmbDesc->insertItem( tr( "Work on " ) ); | 76 | cmbDesc->insertItem( tr( "Work on " ) ); |
77 | cmbDesc->insertItem( tr( "Buy " ) ); | 77 | cmbDesc->insertItem( tr( "Buy " ) ); |
78 | cmbDesc->insertItem( tr( "Organize " ) ); | 78 | cmbDesc->insertItem( tr( "Organize " ) ); |
79 | cmbDesc->insertItem( tr( "Get " ) ); | 79 | cmbDesc->insertItem( tr( "Get " ) ); |
80 | cmbDesc->insertItem( tr( "Update " ) ); | 80 | cmbDesc->insertItem( tr( "Update " ) ); |
81 | cmbDesc->insertItem( tr( "Create " ) ); | 81 | cmbDesc->insertItem( tr( "Create " ) ); |
82 | cmbDesc->insertItem( tr( "Plan " ) ); | 82 | cmbDesc->insertItem( tr( "Plan " ) ); |
83 | cmbDesc->insertItem( tr( "Call " ) ); | 83 | cmbDesc->insertItem( tr( "Call " ) ); |
84 | cmbDesc->insertItem( tr( "Mail " ) ); | 84 | cmbDesc->insertItem( tr( "Mail " ) ); |
85 | cmbDesc->clearEdit(); | 85 | cmbDesc->clearEdit(); |
86 | layout->addMultiCellWidget( cmbDesc, 1, 1, 0, 1 ); | 86 | layout->addMultiCellWidget( cmbDesc, 1, 1, 0, 1 ); |
87 | QWhatsThis::add( cmbDesc, tr( "Enter brief description of the task here." ) ); | 87 | QWhatsThis::add( cmbDesc, tr( "Enter brief description of the task here." ) ); |
88 | 88 | ||
89 | // Priority | 89 | // Priority |
90 | label = new QLabel( QWidget::tr( "Priority:" ), container ); | 90 | label = new QLabel( QWidget::tr( "Priority:" ), container ); |
91 | layout->addWidget( label, 2, 0 ); | 91 | layout->addWidget( label, 2, 0 ); |
92 | QWhatsThis::add( label, tr( "Select priority of task here." ) ); | 92 | QWhatsThis::add( label, tr( "Select priority of task here." ) ); |
93 | cmbPriority = new QComboBox( FALSE, container ); | 93 | cmbPriority = new QComboBox( FALSE, container ); |
94 | cmbPriority->setMinimumHeight( 26 ); | 94 | cmbPriority->setMinimumHeight( 26 ); |
95 | cmbPriority->insertItem( m_pic_priority[ 0 ], tr( "Very High" ) ); | 95 | cmbPriority->insertItem( m_pic_priority[ 0 ], tr( "Very High" ) ); |
96 | cmbPriority->insertItem( m_pic_priority[ 1 ], tr( "High" ) ); | 96 | cmbPriority->insertItem( m_pic_priority[ 1 ], tr( "High" ) ); |
97 | cmbPriority->insertItem( m_pic_priority[ 2 ], tr( "Normal" ) ); | 97 | cmbPriority->insertItem( m_pic_priority[ 2 ], tr( "Normal" ) ); |
98 | cmbPriority->insertItem( m_pic_priority[ 3 ], tr( "Low" ) ); | 98 | cmbPriority->insertItem( m_pic_priority[ 3 ], tr( "Low" ) ); |
99 | cmbPriority->insertItem( m_pic_priority[ 4 ], tr( "Very Low" ) ); | 99 | cmbPriority->insertItem( m_pic_priority[ 4 ], tr( "Very Low" ) ); |
100 | cmbPriority->setCurrentItem( 2 ); | 100 | cmbPriority->setCurrentItem( 2 ); |
101 | layout->addWidget( cmbPriority, 2, 1 ); | 101 | layout->addWidget( cmbPriority, 2, 1 ); |
102 | QWhatsThis::add( cmbPriority, tr( "Select priority of task here." ) ); | 102 | QWhatsThis::add( cmbPriority, tr( "Select priority of task here." ) ); |
103 | 103 | ||
104 | // Category | 104 | // Category |
105 | label = new QLabel( tr( "Category:" ), container ); | 105 | label = new QLabel( tr( "Category:" ), container ); |
106 | layout->addWidget( label, 3, 0 ); | 106 | layout->addWidget( label, 3, 0 ); |
107 | QWhatsThis::add( label, tr( "Select category to organize this task with." ) ); | 107 | QWhatsThis::add( label, tr( "Select category to organize this task with." ) ); |
108 | cmbCategory = new CategorySelect( container ); | 108 | cmbCategory = new CategorySelect( container ); |
109 | layout->addWidget( cmbCategory, 3, 1 ); | 109 | layout->addWidget( cmbCategory, 3, 1 ); |
110 | QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) ); | 110 | QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) ); |
111 | 111 | ||
112 | // Recurrence | 112 | // Recurrence |
113 | ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container ); | 113 | ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container ); |
114 | layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 ); | 114 | layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 ); |
115 | QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) ); | 115 | QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) ); |
116 | connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) ); | 116 | connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) ); |
117 | 117 | ||
118 | // Notes | 118 | // Notes |
119 | label = new QLabel( tr( "Notes:" ), container ); | 119 | label = new QLabel( tr( "Notes:" ), container ); |
120 | layout->addWidget( label, 5, 0 ); | 120 | layout->addWidget( label, 5, 0 ); |
121 | QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) ); | 121 | QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) ); |
122 | mleNotes = new QMultiLineEdit( container ); | 122 | mleNotes = new QMultiLineEdit( container ); |
123 | mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth ); | 123 | mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth ); |
124 | layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 ); | 124 | layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 ); |
125 | QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) ); | 125 | QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) ); |
126 | } | 126 | } |
127 | 127 | ||
128 | TaskEditorOverView::~TaskEditorOverView() | 128 | TaskEditorOverView::~TaskEditorOverView() |
129 | { | 129 | { |
130 | } | 130 | } |
131 | 131 | ||
132 | void TaskEditorOverView::load( const OTodo& todo ) | 132 | void TaskEditorOverView::load( const OTodo& todo ) |
133 | { | 133 | { |
134 | // Description | 134 | // Description |
135 | cmbDesc->insertItem( todo.summary(), 0 ); | 135 | cmbDesc->insertItem( todo.summary(), 0 ); |
136 | cmbDesc->setCurrentItem( 0 ); | 136 | cmbDesc->setCurrentItem( 0 ); |
137 | 137 | ||
138 | // Priority | 138 | // Priority |
139 | cmbPriority->setCurrentItem( todo.priority() - 1 ); | 139 | cmbPriority->setCurrentItem( todo.priority() - 1 ); |
140 | 140 | ||
141 | // Category | 141 | // Category |
142 | cmbCategory->setCategories( todo.categories(), "Todo List", tr( "Todo List" ) ); | 142 | cmbCategory->setCategories( todo.categories(), "Todo List", tr( "Todo List" ) ); |
143 | 143 | ||
144 | // Recurrence | 144 | // Recurrence |
145 | ckbRecurrence->setChecked( todo.recurrence().doesRecur() ); | 145 | ckbRecurrence->setChecked( todo.hasRecurrence() ); |
146 | emit recurranceEnabled( todo.recurrence().doesRecur() ); | 146 | emit recurranceEnabled( todo.hasRecurrence() ); |
147 | 147 | ||
148 | // Notes | 148 | // Notes |
149 | mleNotes->setText( todo.description() ); | 149 | mleNotes->setText( todo.description() ); |
150 | 150 | ||
151 | } | 151 | } |
152 | 152 | ||
153 | void TaskEditorOverView::save( OTodo &todo ) | 153 | void TaskEditorOverView::save( OTodo &todo ) |
154 | { | 154 | { |
155 | // Description | 155 | // Description |
156 | todo.setSummary( cmbDesc->currentText() ); | 156 | todo.setSummary( cmbDesc->currentText() ); |
157 | 157 | ||
158 | // Priority | 158 | // Priority |
159 | todo.setPriority( cmbPriority->currentItem() + 1 ); | 159 | todo.setPriority( cmbPriority->currentItem() + 1 ); |
160 | 160 | ||
161 | // Category | 161 | // Category |
162 | if ( cmbCategory->currentCategory() != -1 ) | 162 | if ( cmbCategory->currentCategory() != -1 ) |
163 | { | 163 | { |
164 | QArray<int> arr = cmbCategory->currentCategories(); | 164 | QArray<int> arr = cmbCategory->currentCategories(); |
165 | todo.setCategories( arr ); | 165 | todo.setCategories( arr ); |
166 | } | 166 | } |
167 | 167 | ||
168 | // Recurrence - don't need to save here... | 168 | // Recurrence - don't need to save here... |
169 | 169 | ||
170 | // Notes | 170 | // Notes |
171 | todo.setDescription( mleNotes->text() ); | 171 | todo.setDescription( mleNotes->text() ); |
172 | } | 172 | } |
173 | 173 | ||
174 | void TaskEditorOverView::slotRecClicked() | 174 | void TaskEditorOverView::slotRecClicked() |
175 | { | 175 | { |
176 | emit recurranceEnabled( ckbRecurrence->isChecked() ); | 176 | emit recurranceEnabled( ckbRecurrence->isChecked() ); |
177 | } | 177 | } |
diff --git a/core/pim/todo/taskeditorstatus.cpp b/core/pim/todo/taskeditorstatus.cpp index b11fdab..4331877 100644 --- a/core/pim/todo/taskeditorstatus.cpp +++ b/core/pim/todo/taskeditorstatus.cpp | |||
@@ -1,301 +1,301 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 <> | 3 | .=l. Copyright (c) 2002 <> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This program is free software; you can | 5 | _;:, .> :=|. This program is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This program is distributed in the hope that | 12 | .i_,=:_. -<s. This program is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = General Public License along with | 21 | -_. . . )=. = General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "taskeditorstatus.h" | 29 | #include "taskeditorstatus.h" |
30 | 30 | ||
31 | #include <opie/otodo.h> | 31 | #include <opie/otodo.h> |
32 | #include <opie/opimmaintainer.h> | 32 | #include <opie/opimmaintainer.h> |
33 | #include <opie/opimstate.h> | 33 | #include <opie/opimstate.h> |
34 | 34 | ||
35 | #include <qpe/datebookmonth.h> | 35 | #include <qpe/datebookmonth.h> |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <qpe/timestring.h> | 37 | #include <qpe/timestring.h> |
38 | 38 | ||
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qlabel.h> | 41 | #include <qlabel.h> |
42 | #include <qlayout.h> | 42 | #include <qlayout.h> |
43 | #include <qscrollview.h> | 43 | #include <qscrollview.h> |
44 | #include <qtoolbutton.h> | 44 | #include <qtoolbutton.h> |
45 | #include <qwhatsthis.h> | 45 | #include <qwhatsthis.h> |
46 | 46 | ||
47 | // FIXME add the hack slots instead of setPopup!!!! | 47 | // FIXME add the hack slots instead of setPopup!!!! |
48 | // drw you shouldn't have removed them | 48 | // drw you shouldn't have removed them |
49 | 49 | ||
50 | TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags fl ) | 50 | TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags fl ) |
51 | : QWidget( parent, name, fl ) | 51 | : QWidget( parent, name, fl ) |
52 | { | 52 | { |
53 | QDate curDate = QDate::currentDate(); | 53 | QDate curDate = QDate::currentDate(); |
54 | m_start = m_comp = m_due = curDate; | 54 | m_start = m_comp = m_due = curDate; |
55 | QString curDateStr = TimeString::longDateString( curDate ); | 55 | QString curDateStr = TimeString::longDateString( curDate ); |
56 | 56 | ||
57 | QVBoxLayout *vb = new QVBoxLayout( this ); | 57 | QVBoxLayout *vb = new QVBoxLayout( this ); |
58 | 58 | ||
59 | QScrollView *sv = new QScrollView( this ); | 59 | QScrollView *sv = new QScrollView( this ); |
60 | vb->addWidget( sv ); | 60 | vb->addWidget( sv ); |
61 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 61 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
62 | sv->setFrameStyle( QFrame::NoFrame ); | 62 | sv->setFrameStyle( QFrame::NoFrame ); |
63 | 63 | ||
64 | QWidget *container = new QWidget( sv->viewport() ); | 64 | QWidget *container = new QWidget( sv->viewport() ); |
65 | sv->addChild( container ); | 65 | sv->addChild( container ); |
66 | 66 | ||
67 | QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 ); | 67 | QGridLayout *layout = new QGridLayout( container, 7, 3, 4, 4 ); |
68 | 68 | ||
69 | // Status | 69 | // Status |
70 | QLabel *label = new QLabel( tr( "Status:" ), container ); | 70 | QLabel *label = new QLabel( tr( "Status:" ), container ); |
71 | layout->addWidget( label, 0, 0 ); | 71 | layout->addWidget( label, 0, 0 ); |
72 | QWhatsThis::add( label, tr( "Click here to set the current status of this task." ) ); | 72 | QWhatsThis::add( label, tr( "Click here to set the current status of this task." ) ); |
73 | cmbStatus = new QComboBox( FALSE, container ); | 73 | cmbStatus = new QComboBox( FALSE, container ); |
74 | cmbStatus->insertItem( tr( "Started" ) ); | 74 | cmbStatus->insertItem( tr( "Started" ) ); |
75 | cmbStatus->insertItem( tr( "Postponed" ) ); | 75 | cmbStatus->insertItem( tr( "Postponed" ) ); |
76 | cmbStatus->insertItem( tr( "Finished" ) ); | 76 | cmbStatus->insertItem( tr( "Finished" ) ); |
77 | cmbStatus->insertItem( tr( "Not started" ) ); | 77 | cmbStatus->insertItem( tr( "Not started" ) ); |
78 | layout->addMultiCellWidget( cmbStatus, 0, 0, 1, 2 ); | 78 | layout->addMultiCellWidget( cmbStatus, 0, 0, 1, 2 ); |
79 | QWhatsThis::add( cmbStatus, tr( "Click here to set the current status of this task." ) ); | 79 | QWhatsThis::add( cmbStatus, tr( "Click here to set the current status of this task." ) ); |
80 | 80 | ||
81 | // Progress | 81 | // Progress |
82 | label = new QLabel( tr( "Progress:" ), container ); | 82 | label = new QLabel( tr( "Progress:" ), container ); |
83 | layout->addWidget( label, 1, 0 ); | 83 | layout->addWidget( label, 1, 0 ); |
84 | QWhatsThis::add( label, tr( "Select progress made on this task here." ) ); | 84 | QWhatsThis::add( label, tr( "Select progress made on this task here." ) ); |
85 | cmbProgress = new QComboBox( FALSE, container ); | 85 | cmbProgress = new QComboBox( FALSE, container ); |
86 | cmbProgress->insertItem( tr( "0 %" ) ); | 86 | cmbProgress->insertItem( tr( "0 %" ) ); |
87 | cmbProgress->insertItem( tr( "20 %" ) ); | 87 | cmbProgress->insertItem( tr( "20 %" ) ); |
88 | cmbProgress->insertItem( tr( "40 %" ) ); | 88 | cmbProgress->insertItem( tr( "40 %" ) ); |
89 | cmbProgress->insertItem( tr( "60 %" ) ); | 89 | cmbProgress->insertItem( tr( "60 %" ) ); |
90 | cmbProgress->insertItem( tr( "80 %" ) ); | 90 | cmbProgress->insertItem( tr( "80 %" ) ); |
91 | cmbProgress->insertItem( tr( "100 %" ) ); | 91 | cmbProgress->insertItem( tr( "100 %" ) ); |
92 | layout->addMultiCellWidget( cmbProgress, 1, 1, 1, 2 ); | 92 | layout->addMultiCellWidget( cmbProgress, 1, 1, 1, 2 ); |
93 | QWhatsThis::add( cmbProgress, tr( "Select progress made on this task here." ) ); | 93 | QWhatsThis::add( cmbProgress, tr( "Select progress made on this task here." ) ); |
94 | 94 | ||
95 | // Start date | 95 | // Start date |
96 | ckbStart = new QCheckBox( tr( "Start Date:" ), container ); | 96 | ckbStart = new QCheckBox( tr( "Start Date:" ), container ); |
97 | layout->addWidget( ckbStart, 2, 0 ); | 97 | layout->addWidget( ckbStart, 2, 0 ); |
98 | QWhatsThis::add( ckbStart, tr( "Click here to set the date this task was started." ) ); | 98 | QWhatsThis::add( ckbStart, tr( "Click here to set the date this task was started." ) ); |
99 | connect( ckbStart, SIGNAL( clicked() ), this, SLOT( slotStartChecked() ) ); | 99 | connect( ckbStart, SIGNAL( clicked() ), this, SLOT( slotStartChecked() ) ); |
100 | btnStart = new QPushButton( curDateStr, container ); | 100 | btnStart = new QPushButton( curDateStr, container ); |
101 | btnStart->setEnabled( FALSE ); | 101 | btnStart->setEnabled( FALSE ); |
102 | layout->addMultiCellWidget( btnStart, 2, 2, 1, 2 ); | 102 | layout->addMultiCellWidget( btnStart, 2, 2, 1, 2 ); |
103 | QWhatsThis::add( btnStart, tr( "Click here to set the date this task was started." ) ); | 103 | QWhatsThis::add( btnStart, tr( "Click here to set the date this task was started." ) ); |
104 | QPopupMenu *popup = new QPopupMenu( this ); | 104 | QPopupMenu *popup = new QPopupMenu( this ); |
105 | m_startBook = new DateBookMonth( popup, 0, TRUE ); | 105 | m_startBook = new DateBookMonth( popup, 0, TRUE ); |
106 | popup->insertItem( m_startBook ); | 106 | popup->insertItem( m_startBook ); |
107 | btnStart->setPopup( popup ); | 107 | btnStart->setPopup( popup ); |
108 | connect( m_startBook, SIGNAL( dateClicked( int, int, int ) ), | 108 | connect( m_startBook, SIGNAL( dateClicked( int, int, int ) ), |
109 | this, SLOT( slotStartChanged( int, int, int ) ) ); | 109 | this, SLOT( slotStartChanged( int, int, int ) ) ); |
110 | 110 | ||
111 | // Due date | 111 | // Due date |
112 | ckbDue = new QCheckBox( tr( "Due Date:" ), container ); | 112 | ckbDue = new QCheckBox( tr( "Due Date:" ), container ); |
113 | layout->addWidget( ckbDue, 3, 0 ); | 113 | layout->addWidget( ckbDue, 3, 0 ); |
114 | QWhatsThis::add( ckbDue, tr( "Click here to set the date this task needs to be completed by." ) ); | 114 | QWhatsThis::add( ckbDue, tr( "Click here to set the date this task needs to be completed by." ) ); |
115 | connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) ); | 115 | connect( ckbDue, SIGNAL( clicked() ), this, SLOT( slotDueChecked() ) ); |
116 | btnDue = new QPushButton( curDateStr, container ); | 116 | btnDue = new QPushButton( curDateStr, container ); |
117 | btnDue->setEnabled( FALSE ); | 117 | btnDue->setEnabled( FALSE ); |
118 | layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 ); | 118 | layout->addMultiCellWidget( btnDue, 3, 3, 1, 2 ); |
119 | QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) ); | 119 | QWhatsThis::add( btnDue, tr( "Click here to set the date this task needs to be completed by." ) ); |
120 | popup = new QPopupMenu( this ); | 120 | popup = new QPopupMenu( this ); |
121 | m_dueBook = new DateBookMonth( popup, 0, TRUE ); | 121 | m_dueBook = new DateBookMonth( popup, 0, TRUE ); |
122 | popup->insertItem( m_dueBook ); | 122 | popup->insertItem( m_dueBook ); |
123 | btnDue->setPopup( popup ); | 123 | btnDue->setPopup( popup ); |
124 | connect( m_dueBook, SIGNAL( dateClicked( int, int, int ) ), | 124 | connect( m_dueBook, SIGNAL( dateClicked( int, int, int ) ), |
125 | this, SLOT( slotDueChanged( int, int, int ) ) ); | 125 | this, SLOT( slotDueChanged( int, int, int ) ) ); |
126 | 126 | ||
127 | // Completed | 127 | // Completed |
128 | ckbComp = new QCheckBox( tr( "Completed:" ), container ); | 128 | ckbComp = new QCheckBox( tr( "Completed:" ), container ); |
129 | layout->addWidget( ckbComp, 4, 0 ); | 129 | layout->addWidget( ckbComp, 4, 0 ); |
130 | QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) ); | 130 | QWhatsThis::add( ckbComp, tr( "Click here to mark this task as completed." ) ); |
131 | connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) ); | 131 | connect( ckbComp, SIGNAL( clicked() ), this, SLOT( slotCompChecked() ) ); |
132 | btnComp = new QPushButton( curDateStr, container ); | 132 | btnComp = new QPushButton( curDateStr, container ); |
133 | btnComp->setEnabled( FALSE ); | 133 | btnComp->setEnabled( FALSE ); |
134 | layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 ); | 134 | layout->addMultiCellWidget( btnComp, 4, 4, 1, 2 ); |
135 | QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) ); | 135 | QWhatsThis::add( btnComp, tr( "Click here to set the date this task was completed." ) ); |
136 | popup = new QPopupMenu( this ); | 136 | popup = new QPopupMenu( this ); |
137 | m_compBook = new DateBookMonth( popup, 0, TRUE ); | 137 | m_compBook = new DateBookMonth( popup, 0, TRUE ); |
138 | popup->insertItem( m_compBook ); | 138 | popup->insertItem( m_compBook ); |
139 | btnComp->setPopup( popup ); | 139 | btnComp->setPopup( popup ); |
140 | connect( m_compBook, SIGNAL( dateClicked( int, int, int ) ), | 140 | connect( m_compBook, SIGNAL( dateClicked( int, int, int ) ), |
141 | this, SLOT( slotCompChanged( int, int, int ) ) ); | 141 | this, SLOT( slotCompChanged( int, int, int ) ) ); |
142 | 142 | ||
143 | QSpacerItem *spacer = new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); | 143 | QSpacerItem *spacer = new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ); |
144 | layout->addItem( spacer, 5, 0 ); | 144 | layout->addItem( spacer, 5, 0 ); |
145 | 145 | ||
146 | // Maintainer mode | 146 | // Maintainer mode |
147 | label = new QLabel( tr( "Maintainer Mode:" ), container ); | 147 | label = new QLabel( tr( "Maintainer Mode:" ), container ); |
148 | layout->addWidget( label, 6, 0 ); | 148 | layout->addWidget( label, 6, 0 ); |
149 | QWhatsThis::add( label, tr( "Click here to set the maintainer's role." ) ); | 149 | QWhatsThis::add( label, tr( "Click here to set the maintainer's role." ) ); |
150 | cmbMaintMode = new QComboBox( FALSE, container ); | 150 | cmbMaintMode = new QComboBox( FALSE, container ); |
151 | cmbMaintMode->insertItem( tr( "Nothing" ) ); | 151 | cmbMaintMode->insertItem( tr( "Nothing" ) ); |
152 | cmbMaintMode->insertItem( tr( "Responsible" ) ); | 152 | cmbMaintMode->insertItem( tr( "Responsible" ) ); |
153 | cmbMaintMode->insertItem( tr( "Done By" ) ); | 153 | cmbMaintMode->insertItem( tr( "Done By" ) ); |
154 | cmbMaintMode->insertItem( tr( "Coordinating" ) ); | 154 | cmbMaintMode->insertItem( tr( "Coordinating" ) ); |
155 | layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 ); | 155 | layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 ); |
156 | QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) ); | 156 | QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) ); |
157 | 157 | ||
158 | // Maintainer | 158 | // Maintainer |
159 | label = new QLabel( tr( "Maintainer:" ), container ); | 159 | label = new QLabel( tr( "Maintainer:" ), container ); |
160 | layout->addWidget( label, 7, 0 ); | 160 | layout->addWidget( label, 7, 0 ); |
161 | QWhatsThis::add( label, tr( "This is the name of the current task maintainer." ) ); | 161 | QWhatsThis::add( label, tr( "This is the name of the current task maintainer." ) ); |
162 | txtMaintainer = new QLabel( tr( "test" ), container ); | 162 | txtMaintainer = new QLabel( tr( "test" ), container ); |
163 | txtMaintainer->setTextFormat( QLabel::RichText ); | 163 | txtMaintainer->setTextFormat( QLabel::RichText ); |
164 | layout->addWidget( txtMaintainer, 7, 1 ); | 164 | layout->addWidget( txtMaintainer, 7, 1 ); |
165 | QWhatsThis::add( txtMaintainer, tr( "This is the name of the current task maintainer." ) ); | 165 | QWhatsThis::add( txtMaintainer, tr( "This is the name of the current task maintainer." ) ); |
166 | tbtMaintainer = new QToolButton( container ); | 166 | tbtMaintainer = new QToolButton( container ); |
167 | tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) ); | 167 | tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) ); |
168 | layout->addWidget( tbtMaintainer, 7, 2 ); | 168 | layout->addWidget( tbtMaintainer, 7, 2 ); |
169 | QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) ); | 169 | QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) ); |
170 | } | 170 | } |
171 | 171 | ||
172 | TaskEditorStatus::~TaskEditorStatus() | 172 | TaskEditorStatus::~TaskEditorStatus() |
173 | { | 173 | { |
174 | } | 174 | } |
175 | 175 | ||
176 | void TaskEditorStatus::load( const OTodo &todo ) | 176 | void TaskEditorStatus::load( const OTodo &todo ) |
177 | { | 177 | { |
178 | QDate date = QDate::currentDate(); | 178 | QDate date = QDate::currentDate(); |
179 | QString str = TimeString::longDateString( date ); | 179 | QString str = TimeString::longDateString( date ); |
180 | 180 | ||
181 | // Status | 181 | // Status |
182 | int state = todo.state().state(); | 182 | int state = todo.hasState()? todo.state().state() : OPimState::NotStarted; |
183 | if ( state == OPimState::Undefined ) | 183 | if ( state == OPimState::Undefined ) |
184 | state = OPimState::NotStarted; | 184 | state = OPimState::NotStarted; |
185 | cmbStatus->setCurrentItem( state ); | 185 | cmbStatus->setCurrentItem( state ); |
186 | 186 | ||
187 | // Progress | 187 | // Progress |
188 | cmbProgress->setCurrentItem( todo.progress() / 20 ); | 188 | cmbProgress->setCurrentItem( todo.progress() / 20 ); |
189 | 189 | ||
190 | // Start date | 190 | // Start date |
191 | ckbStart->setChecked( todo.hasStartDate() ); | 191 | ckbStart->setChecked( todo.hasStartDate() ); |
192 | btnStart->setEnabled( todo.hasStartDate() ); | 192 | btnStart->setEnabled( todo.hasStartDate() ); |
193 | if ( todo.hasStartDate() ) | 193 | if ( todo.hasStartDate() ) |
194 | { | 194 | { |
195 | m_start = todo.startDate(); | 195 | m_start = todo.startDate(); |
196 | btnStart->setText( TimeString::longDateString( m_start ) ); | 196 | btnStart->setText( TimeString::longDateString( m_start ) ); |
197 | } | 197 | } |
198 | else | 198 | else |
199 | btnStart->setText( str ); | 199 | btnStart->setText( str ); |
200 | 200 | ||
201 | // Due date | 201 | // Due date |
202 | ckbDue->setChecked( todo.hasDueDate() ); | 202 | ckbDue->setChecked( todo.hasDueDate() ); |
203 | btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); | 203 | btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); |
204 | btnDue->setEnabled( todo.hasDueDate() ); | 204 | btnDue->setEnabled( todo.hasDueDate() ); |
205 | m_due = todo.dueDate(); | 205 | m_due = todo.dueDate(); |
206 | 206 | ||
207 | // Completed | 207 | // Completed |
208 | ckbComp->setChecked( todo.isCompleted() ); | 208 | ckbComp->setChecked( todo.isCompleted() ); |
209 | btnComp->setEnabled( todo.hasCompletedDate() ); | 209 | btnComp->setEnabled( todo.hasCompletedDate() ); |
210 | if ( todo.hasCompletedDate() ) | 210 | if ( todo.hasCompletedDate() ) |
211 | { | 211 | { |
212 | m_comp = todo.completedDate(); | 212 | m_comp = todo.completedDate(); |
213 | btnComp->setText( TimeString::longDateString( m_comp ) ); | 213 | btnComp->setText( TimeString::longDateString( m_comp ) ); |
214 | } | 214 | } |
215 | else | 215 | else |
216 | btnComp->setText( str ); | 216 | btnComp->setText( str ); |
217 | 217 | ||
218 | // Maintainer Mode | 218 | // Maintainer Mode |
219 | state = todo.maintainer().mode(); | 219 | state = todo.hasMaintainer() ? todo.maintainer().mode() : OPimMaintainer::Nothing; |
220 | if ( state == OPimMaintainer::Undefined ) | 220 | if ( state == OPimMaintainer::Undefined ) |
221 | state = OPimMaintainer::Nothing; | 221 | state = OPimMaintainer::Nothing; |
222 | cmbMaintMode->setCurrentItem( state ); | 222 | cmbMaintMode->setCurrentItem( state ); |
223 | 223 | ||
224 | // Maintainer - not implemented yet | 224 | // Maintainer - not implemented yet |
225 | } | 225 | } |
226 | 226 | ||
227 | void TaskEditorStatus::save( OTodo &todo ) | 227 | void TaskEditorStatus::save( OTodo &todo ) |
228 | { | 228 | { |
229 | QDate inval; | 229 | QDate inval; |
230 | 230 | ||
231 | // Status | 231 | // Status |
232 | todo.setState( OPimState( cmbStatus->currentItem() ) ); | 232 | todo.setState( OPimState( cmbStatus->currentItem() ) ); |
233 | 233 | ||
234 | // Progress | 234 | // Progress |
235 | todo.setProgress( cmbProgress->currentItem() * 20 ); | 235 | todo.setProgress( cmbProgress->currentItem() * 20 ); |
236 | 236 | ||
237 | // Start date | 237 | // Start date |
238 | if ( ckbStart->isChecked() ) | 238 | if ( ckbStart->isChecked() ) |
239 | { | 239 | { |
240 | todo.setStartDate( m_start ); | 240 | todo.setStartDate( m_start ); |
241 | } | 241 | } |
242 | else | 242 | else |
243 | todo.setStartDate( inval ); | 243 | todo.setStartDate( inval ); |
244 | 244 | ||
245 | // Due date | 245 | // Due date |
246 | if ( ckbDue->isChecked() ) | 246 | if ( ckbDue->isChecked() ) |
247 | { | 247 | { |
248 | todo.setDueDate( m_due ); | 248 | todo.setDueDate( m_due ); |
249 | todo.setHasDueDate( true ); | 249 | todo.setHasDueDate( true ); |
250 | } | 250 | } |
251 | else | 251 | else |
252 | todo.setHasDueDate( false ); | 252 | todo.setHasDueDate( false ); |
253 | 253 | ||
254 | // Completed | 254 | // Completed |
255 | todo.setCompleted( ckbComp->isChecked() ); | 255 | todo.setCompleted( ckbComp->isChecked() ); |
256 | if ( ckbComp->isChecked() ) | 256 | if ( ckbComp->isChecked() ) |
257 | { | 257 | { |
258 | todo.setCompletedDate( m_comp ); | 258 | todo.setCompletedDate( m_comp ); |
259 | } | 259 | } |
260 | else | 260 | else |
261 | todo.setCompletedDate( inval ); | 261 | todo.setCompletedDate( inval ); |
262 | 262 | ||
263 | // Maintainer mode - not implemented yet | 263 | // Maintainer mode - not implemented yet |
264 | 264 | ||
265 | // Maintainer | 265 | // Maintainer |
266 | /* TODO - resolve name to uid.....*/ | 266 | /* TODO - resolve name to uid.....*/ |
267 | todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) ); | 267 | todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) ); |
268 | } | 268 | } |
269 | 269 | ||
270 | void TaskEditorStatus::slotStartChecked() | 270 | void TaskEditorStatus::slotStartChecked() |
271 | { | 271 | { |
272 | btnStart->setEnabled( ckbStart->isChecked() ); | 272 | btnStart->setEnabled( ckbStart->isChecked() ); |
273 | } | 273 | } |
274 | 274 | ||
275 | void TaskEditorStatus::slotCompChecked() | 275 | void TaskEditorStatus::slotCompChecked() |
276 | { | 276 | { |
277 | btnComp->setEnabled( ckbComp->isChecked() ); | 277 | btnComp->setEnabled( ckbComp->isChecked() ); |
278 | } | 278 | } |
279 | 279 | ||
280 | void TaskEditorStatus::slotDueChecked() | 280 | void TaskEditorStatus::slotDueChecked() |
281 | { | 281 | { |
282 | btnDue->setEnabled( ckbDue->isChecked() ); | 282 | btnDue->setEnabled( ckbDue->isChecked() ); |
283 | } | 283 | } |
284 | 284 | ||
285 | void TaskEditorStatus::slotStartChanged(int y, int m, int d) | 285 | void TaskEditorStatus::slotStartChanged(int y, int m, int d) |
286 | { | 286 | { |
287 | m_start.setYMD( y, m, d ); | 287 | m_start.setYMD( y, m, d ); |
288 | btnStart->setText( TimeString::longDateString( m_start ) ); | 288 | btnStart->setText( TimeString::longDateString( m_start ) ); |
289 | } | 289 | } |
290 | 290 | ||
291 | void TaskEditorStatus::slotCompChanged(int y, int m, int d) | 291 | void TaskEditorStatus::slotCompChanged(int y, int m, int d) |
292 | { | 292 | { |
293 | m_comp.setYMD( y, m, d ); | 293 | m_comp.setYMD( y, m, d ); |
294 | btnComp->setText( TimeString::longDateString( m_comp ) ); | 294 | btnComp->setText( TimeString::longDateString( m_comp ) ); |
295 | } | 295 | } |
296 | 296 | ||
297 | void TaskEditorStatus::slotDueChanged(int y, int m, int d) | 297 | void TaskEditorStatus::slotDueChanged(int y, int m, int d) |
298 | { | 298 | { |
299 | m_due.setYMD( y, m, d ); | 299 | m_due.setYMD( y, m, d ); |
300 | btnDue->setText( TimeString::longDateString( m_due ) ); | 300 | btnDue->setText( TimeString::longDateString( m_due ) ); |
301 | } | 301 | } |