-rw-r--r-- | libopie/otimepicker.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libopie/otimepicker.cpp b/libopie/otimepicker.cpp index 1eca7c5..11b80ed 100644 --- a/libopie/otimepicker.cpp +++ b/libopie/otimepicker.cpp | |||
@@ -112,131 +112,131 @@ void OTimePicker::slotMinute(bool b) { | |||
112 | */ | 112 | */ |
113 | void OTimePicker::setTime( const QTime& t) { | 113 | void OTimePicker::setTime( const QTime& t) { |
114 | setTime( t.hour(), t.minute() ); | 114 | setTime( t.hour(), t.minute() ); |
115 | } | 115 | } |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * Method to set the time. No signal gets emitted during this method call | 118 | * Method to set the time. No signal gets emitted during this method call |
119 | * @param h The hour | 119 | * @param h The hour |
120 | * @param m The minute. Minutes need to set by 5 minute steps | 120 | * @param m The minute. Minutes need to set by 5 minute steps |
121 | */ | 121 | */ |
122 | void OTimePicker::setTime( int h, int m ) { | 122 | void OTimePicker::setTime( int h, int m ) { |
123 | setHour(h); | 123 | setHour(h); |
124 | setMinute(m); | 124 | setMinute(m); |
125 | } | 125 | } |
126 | 126 | ||
127 | /* | 127 | /* |
128 | * FIXME round minutes to the 5 minute arrangement -zecke | 128 | * FIXME round minutes to the 5 minute arrangement -zecke |
129 | */ | 129 | */ |
130 | /** | 130 | /** |
131 | * Method to set the minutes | 131 | * Method to set the minutes |
132 | * @param m minutes | 132 | * @param m minutes |
133 | */ | 133 | */ |
134 | void OTimePicker::setMinute(int m) { | 134 | void OTimePicker::setMinute(int m) { |
135 | 135 | ||
136 | QString minute; | 136 | QString minute; |
137 | minute.sprintf("%.2d",m); | 137 | minute.sprintf("%.2d",m); |
138 | 138 | ||
139 | QValueListIterator<OClickableLabel *> it; | 139 | QValueListIterator<OClickableLabel *> it; |
140 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { | 140 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { |
141 | if ((*it)->text() == minute) (*it)->setOn(true); | 141 | if ((*it)->text() == minute) (*it)->setOn(true); |
142 | else (*it)->setOn(false); | 142 | else (*it)->setOn(false); |
143 | } | 143 | } |
144 | 144 | ||
145 | tm.setHMS(tm.hour(),m,0); | 145 | tm.setHMS(tm.hour(),m,0); |
146 | } | 146 | } |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * Method to set the hour | 149 | * Method to set the hour |
150 | */ | 150 | */ |
151 | void OTimePicker::setHour(int h) { | 151 | void OTimePicker::setHour(int h) { |
152 | 152 | ||
153 | QString hour; | 153 | QString hour; |
154 | hour.sprintf("%.2d",h); | 154 | hour.sprintf("%.2d",h); |
155 | 155 | ||
156 | QValueListIterator<OClickableLabel *> it; | 156 | QValueListIterator<OClickableLabel *> it; |
157 | for (it=hourLst.begin(); it!=hourLst.end(); it++) { | 157 | for (it=hourLst.begin(); it!=hourLst.end(); it++) { |
158 | if ((*it)->text() == hour) (*it)->setOn(true); | 158 | if ((*it)->text() == hour) (*it)->setOn(true); |
159 | else (*it)->setOn(false); | 159 | else (*it)->setOn(false); |
160 | } | 160 | } |
161 | tm.setHMS(h,tm.minute(),0); | 161 | tm.setHMS(h,tm.minute(),0); |
162 | } | 162 | } |
163 | 163 | ||
164 | 164 | ||
165 | /** | 165 | /** |
166 | * This is a modal Dialog. | 166 | * This is a modal Dialog. |
167 | * | 167 | * |
168 | * @param parent The parent widget | 168 | * @param parent The parent widget |
169 | * @param name The name of the object | 169 | * @param name The name of the object |
170 | * @param fl Possible window flags | 170 | * @param fl Possible window flags |
171 | */ | 171 | */ |
172 | OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) | 172 | OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) |
173 | : OTimePickerDialogBase (parent , name, true , fl) | 173 | : OTimePickerDialogBase (parent , name, true , fl) |
174 | { | 174 | { |
175 | 175 | ||
176 | connect ( m_timePicker, SIGNAL( timeChanged( const QTime& ) ), | 176 | connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ), |
177 | this, SLOT( setTime ( const QTime& ) ) ); | 177 | this, SLOT( setTime(const QTime&) ) ); |
178 | connect ( minuteField, SIGNAL( textChanged ( const QString& ) ), | 178 | connect ( minuteField, SIGNAL( textChanged(const QString&) ), |
179 | this, SLOT ( setMinute ( const QString& ) ) ); | 179 | this, SLOT ( setMinute(const QString&) ) ); |
180 | connect ( hourField, SIGNAL( textChanged ( const QString& ) ), | 180 | connect ( hourField, SIGNAL( textChanged(const QString&) ), |
181 | this, SLOT ( setHour ( const QString& ) ) ); | 181 | this, SLOT ( setHour(const QString&) ) ); |
182 | 182 | ||
183 | } | 183 | } |
184 | 184 | ||
185 | /** | 185 | /** |
186 | * @return the time | 186 | * @return the time |
187 | */ | 187 | */ |
188 | QTime OTimePickerDialog::time()const | 188 | QTime OTimePickerDialog::time()const |
189 | { | 189 | { |
190 | return m_time; | 190 | return m_time; |
191 | } | 191 | } |
192 | 192 | ||
193 | /** | 193 | /** |
194 | * Set the time to time | 194 | * Set the time to time |
195 | * @param time The time to be set | 195 | * @param time The time to be set |
196 | */ | 196 | */ |
197 | void OTimePickerDialog::setTime( const QTime& time ) | 197 | void OTimePickerDialog::setTime( const QTime& time ) |
198 | { | 198 | { |
199 | m_time = time; | 199 | m_time = time; |
200 | 200 | ||
201 | m_timePicker->setHour ( time.hour() ); | 201 | m_timePicker->setHour ( time.hour() ); |
202 | m_timePicker->setMinute( time.minute() ); | 202 | m_timePicker->setMinute( time.minute() ); |
203 | 203 | ||
204 | // Set Textfields | 204 | // Set Textfields |
205 | if ( time.hour() < 10 ) | 205 | if ( time.hour() < 10 ) |
206 | hourField->setText( "0" + QString::number( time.hour() ) ); | 206 | hourField->setText( "0" + QString::number( time.hour() ) ); |
207 | else | 207 | else |
208 | hourField->setText( QString::number( time.hour() ) ); | 208 | hourField->setText( QString::number( time.hour() ) ); |
209 | 209 | ||
210 | if ( time.minute() < 10 ) | 210 | if ( time.minute() < 10 ) |
211 | minuteField->setText( "0" + QString::number( time.minute() ) ); | 211 | minuteField->setText( "0" + QString::number( time.minute() ) ); |
212 | else | 212 | else |
213 | minuteField->setText( QString::number( time.minute() ) ); | 213 | minuteField->setText( QString::number( time.minute() ) ); |
214 | 214 | ||
215 | } | 215 | } |
216 | 216 | ||
217 | /** | 217 | /** |
218 | * This method takes the current minute and tries to set hour | 218 | * This method takes the current minute and tries to set hour |
219 | * to hour. This succeeds if the resulting date is valid | 219 | * to hour. This succeeds if the resulting date is valid |
220 | * @param hour The hour as a string | 220 | * @param hour The hour as a string |
221 | */ | 221 | */ |
222 | void OTimePickerDialog::setHour ( const QString& hour ) | 222 | void OTimePickerDialog::setHour ( const QString& hour ) |
223 | { | 223 | { |
224 | if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ){ | 224 | if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ){ |
225 | m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); | 225 | m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); |
226 | setTime ( m_time ); | 226 | setTime ( m_time ); |
227 | } | 227 | } |
228 | 228 | ||
229 | } | 229 | } |
230 | 230 | ||
231 | /** | 231 | /** |
232 | * Method to set a new minute. It tries to convert the string to int and | 232 | * Method to set a new minute. It tries to convert the string to int and |
233 | * if the resulting date is valid a new date is set. | 233 | * if the resulting date is valid a new date is set. |
234 | * @see setHour | 234 | * @see setHour |
235 | */ | 235 | */ |
236 | void OTimePickerDialog::setMinute ( const QString& minute ) | 236 | void OTimePickerDialog::setMinute ( const QString& minute ) |
237 | { | 237 | { |
238 | if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) ){ | 238 | if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) ){ |
239 | m_time.setHMS ( m_time.hour(), minute.toInt(), 00 ); | 239 | m_time.setHMS ( m_time.hour(), minute.toInt(), 00 ); |
240 | setTime ( m_time ); | 240 | setTime ( m_time ); |
241 | } | 241 | } |
242 | } | 242 | } |