summaryrefslogtreecommitdiffabout
path: root/libkdepim/kdatepicker.cpp
Unidiff
Diffstat (limited to 'libkdepim/kdatepicker.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kdatepicker.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp
index 25b4e81..68ef943 100644
--- a/libkdepim/kdatepicker.cpp
+++ b/libkdepim/kdatepicker.cpp
@@ -131,48 +131,52 @@ KDatePicker::resizeEvent(QResizeEvent*)
131 // ----- place the buttons: 131 // ----- place the buttons:
132 x=0; 132 x=0;
133 for(count=0; count<NoOfButtons; ++count) 133 for(count=0; count<NoOfButtons; ++count)
134 { 134 {
135 w=sizes[count].width(); 135 w=sizes[count].width();
136 buttons[count]->setGeometry(x, 0, w, buttonHeight); 136 buttons[count]->setGeometry(x, 0, w, buttonHeight);
137 x+=w; 137 x+=w;
138 } 138 }
139 // ----- place the line edit for direct input: 139 // ----- place the line edit for direct input:
140 sizes[0]=lineDate->sizeHint(); 140 sizes[0]=lineDate->sizeHint();
141 //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); 141 //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height());
142 int todaywid = todayBut->sizeHint().width(); 142 int todaywid = todayBut->sizeHint().width();
143todayBut->setGeometry(0, height()-sizes[0].height(),todaywid, sizes[0].height()); 143todayBut->setGeometry(0, height()-sizes[0].height(),todaywid, sizes[0].height());
144 lineDate->setGeometry(0+todaywid, height()-sizes[0].height(), width()-todaywid, sizes[0].height()); 144 lineDate->setGeometry(0+todaywid, height()-sizes[0].height(), width()-todaywid, sizes[0].height());
145 // ----- adjust the table: 145 // ----- adjust the table:
146 table->setGeometry(0, buttonHeight, width(), 146 table->setGeometry(0, buttonHeight, width(),
147 height()-buttonHeight-sizes[0].height()); 147 height()-buttonHeight-sizes[0].height());
148} 148}
149 149
150void 150void
151KDatePicker::dateChangedSlot(QDate date) 151KDatePicker::dateChangedSlot(QDate date)
152{ 152{
153 lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true)); 153 lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true));
154 //line->setText(KGlobal::locale()->formatDate(date, true)); 154 //line->setText(KGlobal::locale()->formatDate(date, true));
155 QString temp;
156 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false));
157 temp.setNum(date.year());
158 selectYear->setText(temp);
155 emit(dateChanged(date)); 159 emit(dateChanged(date));
156} 160}
157 161
158void 162void
159KDatePicker::tableClickedSlot() 163KDatePicker::tableClickedSlot()
160{ 164{
161 165
162 emit(dateSelected(table->getDate())); 166 emit(dateSelected(table->getDate()));
163 emit(tableClicked()); 167 emit(tableClicked());
164} 168}
165 169
166const QDate& 170const QDate&
167KDatePicker::getDate() const 171KDatePicker::getDate() const
168{ 172{
169 return table->getDate(); 173 return table->getDate();
170} 174}
171 175
172const QDate & 176const QDate &
173KDatePicker::date() const 177KDatePicker::date() const
174{ 178{
175 return table->getDate(); 179 return table->getDate();
176} 180}
177 181
178void KDatePicker::goToday() 182void KDatePicker::goToday()
@@ -454,37 +458,41 @@ KDatePicker::setFontSize(int s)
454} 458}
455 459
456void KDatePicker::virtual_hook( int id, void* data ) 460void KDatePicker::virtual_hook( int id, void* data )
457{ /*BASE::virtual_hook( id, data );*/ } 461{ /*BASE::virtual_hook( id, data );*/ }
458 462
459void KDatePicker::keyPressEvent ( QKeyEvent * e ) 463void KDatePicker::keyPressEvent ( QKeyEvent * e )
460{ 464{
461 switch ( e->key() ) { 465 switch ( e->key() ) {
462 case Qt::Key_Right: 466 case Qt::Key_Right:
463 monthForwardClicked(); 467 monthForwardClicked();
464 break; 468 break;
465 case Qt::Key_Left: 469 case Qt::Key_Left:
466 monthBackwardClicked(); 470 monthBackwardClicked();
467 break; 471 break;
468 472
469 case Qt::Key_Down: 473 case Qt::Key_Down:
470 yearForwardClicked(); 474 yearForwardClicked();
471 475
472 break; 476 break;
473 477
474 case Qt::Key_Up: 478 case Qt::Key_Up:
475 yearBackwardClicked(); 479 yearBackwardClicked();
476 break; 480 break;
477 481
482 case Qt::Key_T:
483 goToday();
484 break;
485
478 case Qt::Key_Return: 486 case Qt::Key_Return:
479 case Qt::Key_Enter: 487 case Qt::Key_Enter:
480 case Qt::Key_Space: 488 case Qt::Key_Space:
481 tableClickedSlot(); 489 tableClickedSlot();
482 break; 490 break;
483 case Qt::Key_Escape: 491 case Qt::Key_Escape:
484 e->ignore(); 492 e->ignore();
485 break; 493 break;
486 default: 494 default:
487 break; 495 break;
488 } 496 }
489 497
490} 498}