author | zautrix <zautrix> | 2005-10-27 23:22:36 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-27 23:22:36 (UTC) |
commit | cbda16d4966c7483d20d1b6b5a64c8af367ea732 (patch) (unidiff) | |
tree | 47099fd5b318c47eb1d8fff3d8a3eef6e34f6f23 /microkde/kdatetbl.cpp | |
parent | d6d384e50cfd511866958e58cdd3adeb35ed1c4e (diff) | |
download | kdepimpi-cbda16d4966c7483d20d1b6b5a64c8af367ea732.zip kdepimpi-cbda16d4966c7483d20d1b6b5a64c8af367ea732.tar.gz kdepimpi-cbda16d4966c7483d20d1b6b5a64c8af367ea732.tar.bz2 |
us fix
-rw-r--r-- | microkde/kdatetbl.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index 4271b55..353f78d 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp | |||
@@ -239,49 +239,37 @@ KDateTable::keyPressEvent( QKeyEvent *e ) | |||
239 | 239 | ||
240 | int temp=firstday+date.day()-dayoff; | 240 | int temp=firstday+date.day()-dayoff; |
241 | int pos = temp; | 241 | int pos = temp; |
242 | bool irgnore = true; | 242 | bool irgnore = true; |
243 | int add = 0; | ||
243 | if ( e->state() != Qt::ControlButton ) { | 244 | if ( e->state() != Qt::ControlButton ) { |
244 | if ( e->key() == Qt::Key_Up ) { | 245 | if ( e->key() == Qt::Key_Up ) { |
245 | pos -= 7; | 246 | add -= 7; |
246 | irgnore = false; | 247 | irgnore = false; |
247 | } | 248 | } |
248 | if ( e->key() == Qt::Key_Down ) { | 249 | if ( e->key() == Qt::Key_Down ) { |
249 | pos += 7; | 250 | add += 7; |
250 | irgnore = false; | 251 | irgnore = false; |
251 | } | 252 | } |
252 | if ( e->key() == Qt::Key_Left ) { | 253 | if ( e->key() == Qt::Key_Left ) { |
253 | pos--; | 254 | --add; |
254 | irgnore = false; | 255 | irgnore = false; |
255 | } | 256 | } |
256 | if ( e->key() == Qt::Key_Right ) { | 257 | if ( e->key() == Qt::Key_Right ) { |
257 | pos++; | 258 | ++add; |
258 | irgnore = false; | 259 | irgnore = false; |
259 | } | 260 | } |
260 | } | 261 | } |
261 | if ( irgnore ) | 262 | if ( irgnore ) { |
262 | e->ignore(); | 263 | e->ignore(); |
263 | |||
264 | if(pos+dayoff<=firstday) | ||
265 | { // this day is in the previous month | ||
266 | KNotifyClient::beep(); | ||
267 | return; | ||
268 | } | ||
269 | if(firstday+numdays<pos+dayoff) | ||
270 | { // this date is in the next month | ||
271 | KNotifyClient::beep(i18n( "Month not long enough" )); | ||
272 | return; | ||
273 | } | ||
274 | |||
275 | if ( pos == temp ) | ||
276 | return; | 264 | return; |
265 | } | ||
277 | 266 | ||
278 | setDate(QDate(date.year(), date.month(), pos-firstday+dayoff)); | 267 | pos += add; |
268 | setDate(date.addDays( add )); | ||
279 | updateCell(temp/7+1, temp%7); // Update the previously selected cell | 269 | updateCell(temp/7+1, temp%7); // Update the previously selected cell |
280 | updateCell(pos/7+1, pos%7); // Update the selected cell | 270 | updateCell(pos/7+1, pos%7); // Update the selected cell |
281 | assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); | 271 | |
282 | |||
283 | |||
284 | } | 272 | } |
285 | 273 | ||
286 | void | 274 | void |
287 | KDateTable::viewportResizeEvent(QResizeEvent * e) | 275 | KDateTable::viewportResizeEvent(QResizeEvent * e) |