author | drw <drw> | 2002-12-23 17:13:12 (UTC) |
---|---|---|
committer | drw <drw> | 2002-12-23 17:13:12 (UTC) |
commit | 1cb75c721b69459494cb599730a96bbc1ddc0f65 (patch) (unidiff) | |
tree | 9a45955d74016b639593c4a888acb4e96e17e9fb /core/pim/todo/taskeditoroverviewimpl.cpp | |
parent | deb4685b99d6c5917f92ce188ead09fdd9c37859 (diff) | |
download | opie-1cb75c721b69459494cb599730a96bbc1ddc0f65.zip opie-1cb75c721b69459494cb599730a96bbc1ddc0f65.tar.gz opie-1cb75c721b69459494cb599730a96bbc1ddc0f65.tar.bz2 |
Task Editor dialog: 1. added tab icons 2. rearranged the overview tab 3. alarm/reminder tab updates 4. code clean-up. Still need to work on advanced tab and add qwhatsthis.
Diffstat (limited to 'core/pim/todo/taskeditoroverviewimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/taskeditoroverviewimpl.cpp | 221 |
1 files changed, 0 insertions, 221 deletions
diff --git a/core/pim/todo/taskeditoroverviewimpl.cpp b/core/pim/todo/taskeditoroverviewimpl.cpp deleted file mode 100644 index aef3b1d..0000000 --- a/core/pim/todo/taskeditoroverviewimpl.cpp +++ b/dev/null | |||
@@ -1,221 +0,0 @@ | |||
1 | #include <qapplication.h> | ||
2 | #include <qcheckbox.h> | ||
3 | #include <qcombobox.h> | ||
4 | #include <qpopupmenu.h> | ||
5 | |||
6 | #include <qpe/datebookmonth.h> | ||
7 | #include <qpe/categoryselect.h> | ||
8 | #include <qpe/timestring.h> | ||
9 | |||
10 | #include <opie/orecur.h> | ||
11 | |||
12 | #include "taskeditoroverviewimpl.h" | ||
13 | |||
14 | /* | ||
15 | * we need to hack | ||
16 | */ | ||
17 | |||
18 | TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* name ) | ||
19 | : TaskEditorOverView( parent, name ) { | ||
20 | init(); | ||
21 | } | ||
22 | TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { | ||
23 | } | ||
24 | void TaskEditorOverViewImpl::load( const OTodo& todo) { | ||
25 | /* | ||
26 | * now that we're 'preloaded' we | ||
27 | * need to disable the buttons | ||
28 | * holding the dat | ||
29 | */ | ||
30 | btnDue-> setEnabled( FALSE ); | ||
31 | btnComp-> setEnabled( FALSE ); | ||
32 | btnStart->setEnabled( FALSE ); | ||
33 | |||
34 | /* | ||
35 | * get some basic dateinfos for now | ||
36 | */ | ||
37 | QDate date = QDate::currentDate(); | ||
38 | QString str = TimeString::longDateString( date ); | ||
39 | |||
40 | CheckBox7->setChecked( todo.recurrence().doesRecur() ); | ||
41 | emit recurranceEnabled( todo.recurrence().doesRecur() ); | ||
42 | |||
43 | |||
44 | ckbStart->setChecked( todo.hasStartDate() ); | ||
45 | btnStart->setEnabled( todo.hasStartDate() ); | ||
46 | if ( todo.hasStartDate() ) { | ||
47 | m_start = todo.startDate(); | ||
48 | btnStart->setText( TimeString::longDateString( m_start ) ); | ||
49 | } else | ||
50 | btnStart->setText( str ); | ||
51 | |||
52 | ckbComp->setChecked( todo.hasCompletedDate() ); | ||
53 | btnComp->setEnabled( todo.hasCompletedDate() ); | ||
54 | if ( todo.hasCompletedDate() ) { | ||
55 | m_comp = todo.completedDate(); | ||
56 | btnComp->setText( TimeString::longDateString( m_comp ) ); | ||
57 | }else | ||
58 | btnComp->setText( str ); | ||
59 | |||
60 | cmbProgress->setCurrentItem( todo.progress()/20 ); | ||
61 | cmbSum->insertItem( todo.summary(), 0 ); | ||
62 | cmbSum->setCurrentItem( 0 ); | ||
63 | |||
64 | ckbDue->setChecked( todo.hasDueDate() ); | ||
65 | btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); | ||
66 | btnDue->setEnabled( todo.hasDueDate() ); | ||
67 | m_due = todo.dueDate(); | ||
68 | |||
69 | cmbPrio->setCurrentItem( todo.priority() -1 ); | ||
70 | ckbCompleted->setChecked( todo.isCompleted() ); | ||
71 | |||
72 | comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); | ||
73 | |||
74 | } | ||
75 | void TaskEditorOverViewImpl::save( OTodo& to) { | ||
76 | /* a invalid date */ | ||
77 | QDate inval; | ||
78 | /* save our info back */ | ||
79 | |||
80 | /* due date */ | ||
81 | if ( ckbDue->isChecked() ) { | ||
82 | to.setDueDate( m_due ); | ||
83 | to.setHasDueDate( true ); | ||
84 | }else | ||
85 | to.setHasDueDate( false ); | ||
86 | |||
87 | /* start date */ | ||
88 | if ( ckbStart->isChecked() ) { | ||
89 | to.setStartDate( m_start ); | ||
90 | }else | ||
91 | to.setStartDate( inval ); | ||
92 | |||
93 | /* comp date */ | ||
94 | if ( ckbComp->isChecked() ) { | ||
95 | qWarning("completed checked"); | ||
96 | to.setCompletedDate( m_comp ); | ||
97 | }else | ||
98 | to.setCompletedDate( inval ); | ||
99 | |||
100 | |||
101 | if ( comboCategory->currentCategory() != -1 ) { | ||
102 | QArray<int> arr = comboCategory->currentCategories(); | ||
103 | to.setCategories( arr ); | ||
104 | } | ||
105 | to.setPriority( cmbPrio->currentItem() + 1 ); | ||
106 | to.setCompleted( ckbCompleted->isChecked() ); | ||
107 | to.setSummary( cmbSum->currentText() ); | ||
108 | to.setProgress( cmbProgress->currentItem() * 20 ); | ||
109 | } | ||
110 | /* | ||
111 | * here we will init the basic view | ||
112 | * one Popup for each Date Button | ||
113 | * and some other signal and slots connection | ||
114 | */ | ||
115 | void TaskEditorOverViewImpl::init() { | ||
116 | QDate curDate = QDate::currentDate(); | ||
117 | m_start = m_comp = m_due = curDate; | ||
118 | QString str = TimeString::longDateString( curDate ); | ||
119 | |||
120 | |||
121 | |||
122 | /* Start Date Picker */ | ||
123 | m_startPop = new QPopupMenu(this); | ||
124 | m_startBook = new DateBookMonth(m_startPop, 0, TRUE ); | ||
125 | m_startPop->insertItem( m_startBook ); | ||
126 | connect( m_startBook, SIGNAL( dateClicked(int, int, int) ), | ||
127 | this, SLOT(slotStartChanged(int, int, int) ) ); | ||
128 | |||
129 | |||
130 | /* Due Date Picker */ | ||
131 | m_duePop = new QPopupMenu(this); | ||
132 | m_dueBook = new DateBookMonth(m_duePop, 0, TRUE ); | ||
133 | m_duePop->insertItem( m_dueBook ); | ||
134 | connect( m_dueBook, SIGNAL( dateClicked(int, int, int) ), | ||
135 | this, SLOT(slotDueChanged(int, int, int) ) ); | ||
136 | |||
137 | m_compPop = new QPopupMenu(this); | ||
138 | m_compBook = new DateBookMonth(m_compPop, 0, TRUE ); | ||
139 | m_compPop->insertItem(m_compBook ); | ||
140 | connect( m_compBook, SIGNAL(dateClicked(int, int, int) ), | ||
141 | this, SLOT(slotCompletedChanged(int, int, int) ) ); | ||
142 | |||
143 | |||
144 | /* | ||
145 | * another part of the hack | ||
146 | * it's deprecated in Qt2 but | ||
147 | * still available in my qt-copy of Qt3.1beta2 | ||
148 | */ | ||
149 | btnDue->setIsMenuButton( TRUE ); | ||
150 | btnStart->setIsMenuButton( TRUE ); | ||
151 | btnComp->setIsMenuButton( TRUE ); | ||
152 | |||
153 | /* now connect the hack */ | ||
154 | connect(btnDue, SIGNAL(clicked() ), | ||
155 | this, SLOT(hackySlotHack2() ) ); | ||
156 | connect(btnStart, SIGNAL(clicked() ), | ||
157 | this, SLOT(hackySlotHack1() ) ); | ||
158 | connect(btnComp, SIGNAL(clicked() ), | ||
159 | this, SLOT(hackySlotHack3() ) ); | ||
160 | |||
161 | /* recurrance */ | ||
162 | connect(CheckBox7, SIGNAL(clicked() ), | ||
163 | this, SLOT(slotRecClicked() ) ); | ||
164 | } | ||
165 | |||
166 | void TaskEditorOverViewImpl::slotStartChecked() { | ||
167 | qWarning("slotStartChecked"); | ||
168 | btnStart->setEnabled( ckbStart->isChecked() ); | ||
169 | } | ||
170 | void TaskEditorOverViewImpl::slotStartChanged(int y, int m, int d) { | ||
171 | m_start.setYMD( y, m, d ); | ||
172 | btnStart->setText( TimeString::longDateString( m_start ) ); | ||
173 | } | ||
174 | void TaskEditorOverViewImpl::slotDueChecked() { | ||
175 | btnDue->setEnabled( ckbDue->isChecked() ); | ||
176 | emit dueDateChanged( m_due ); | ||
177 | qWarning("slotDueChecked"); | ||
178 | } | ||
179 | void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) { | ||
180 | m_due.setYMD(y, m, d ); | ||
181 | btnDue->setText( TimeString::longDateString( m_due ) ); | ||
182 | emit dueDateChanged( m_due ); | ||
183 | } | ||
184 | void TaskEditorOverViewImpl::slotCompletedChecked() { | ||
185 | btnComp->setEnabled( ckbComp->isChecked() ); | ||
186 | qWarning("slotCompletedChecked"); | ||
187 | } | ||
188 | void TaskEditorOverViewImpl::slotCompletedChanged(int y, int m, int d) { | ||
189 | m_comp.setYMD( y, m, d ); | ||
190 | btnComp->setText( TimeString::longDateString( m_comp ) ); | ||
191 | } | ||
192 | /* | ||
193 | * called by a button pressed event... | ||
194 | * three slots to avoid ugly name() tests | ||
195 | * to sender() | ||
196 | */ | ||
197 | void TaskEditorOverViewImpl::hackySlotHack1() { | ||
198 | btnStart->setDown( FALSE ); | ||
199 | popup( btnStart, m_startPop ); | ||
200 | } | ||
201 | void TaskEditorOverViewImpl::hackySlotHack2() { | ||
202 | btnDue->setDown( FALSE ); | ||
203 | popup( btnDue, m_duePop ); | ||
204 | } | ||
205 | void TaskEditorOverViewImpl::hackySlotHack3() { | ||
206 | btnComp->setDown( FALSE ); | ||
207 | popup( btnComp, m_compPop ); | ||
208 | } | ||
209 | void TaskEditorOverViewImpl::slotRecClicked() { | ||
210 | qWarning("enabled recurrance"); | ||
211 | emit recurranceEnabled( CheckBox7->isChecked() ); | ||
212 | } | ||
213 | /* | ||
214 | * GPL from TT QPushButton code | ||
215 | */ | ||
216 | void TaskEditorOverViewImpl::popup( QPushButton* pu, QPopupMenu* pop) { | ||
217 | if ( pu->mapToGlobal( QPoint(0, pu->rect().bottom() ) ).y() + pop->sizeHint().height() <= qApp->desktop()->height() ) | ||
218 | pop->exec( pu->mapToGlobal( pu->rect().bottomLeft() ) ); | ||
219 | else | ||
220 | pop->exec( pu->mapToGlobal( pu->rect().topLeft() - QPoint(0, pu->sizeHint().height() ) ) ); | ||
221 | } | ||