author | zautrix <zautrix> | 2005-03-30 11:55:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-30 11:55:53 (UTC) |
commit | b5222dd7a607f78235b1ea39fea0f95a9c08ccd3 (patch) (side-by-side diff) | |
tree | 4e4d334ae9d8805b7718c1610bd84af128fd8151 /microkde/kdatetbl.cpp | |
parent | 597cad3a63e6c22855704bf8435db70e3c2b184f (diff) | |
download | kdepimpi-b5222dd7a607f78235b1ea39fea0f95a9c08ccd3.zip kdepimpi-b5222dd7a607f78235b1ea39fea0f95a9c08ccd3.tar.gz kdepimpi-b5222dd7a607f78235b1ea39fea0f95a9c08ccd3.tar.bz2 |
fixes
-rw-r--r-- | microkde/kdatetbl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index d182279..2d97c8c 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp @@ -263,129 +263,129 @@ KDateTable::keyPressEvent( QKeyEvent *e ) if(pos+dayoff<=firstday) { // this day is in the previous month KNotifyClient::beep(); return; } if(firstday+numdays<pos+dayoff) { // this date is in the next month KNotifyClient::beep(i18n( "Month not long enough" )); return; } if ( pos == temp ) return; setDate(QDate(date.year(), date.month(), pos-firstday+dayoff)); updateCell(temp/7+1, temp%7); // Update the previously selected cell updateCell(pos/7+1, pos%7); // Update the selected cell assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); } void KDateTable::viewportResizeEvent(QResizeEvent * e) { QGridView::viewportResizeEvent(e); setCellWidth(viewport()->width()/7); setCellHeight(viewport()->height()/7); } void KDateTable::setFontSize(int size) { int count; QRect rect; // ----- store rectangles: fontsize=size; QFont _font = font(); _font.setPointSize(fontsize); setFont( _font ); _font.setBold( true ); QFontMetrics metrics(_font); // ----- find largest day name: maxCell.setWidth(0); maxCell.setHeight(0); for(count=0; count<7; ++count) { rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true)); maxCell.setWidth(QMAX(maxCell.width(), rect.width())); maxCell.setHeight(QMAX(maxCell.height(), rect.height())); } // ----- compare with a real wide number and add some space: rect=metrics.boundingRect(QString::fromLatin1("88")); maxCell.setWidth(QMAX(maxCell.width()+2, rect.width())); #ifdef DESKTOP_VERSION maxCell.setHeight(QMAX(maxCell.height()+8, rect.height())); #else maxCell.setHeight(QMAX(maxCell.height()+4, rect.height())); #endif if ( maxCell.width() * 1000 / maxCell.height() > 1900 ) { maxCell.setHeight(maxCell.width() * 1000 / 1900 ); - qDebug("setmax "); + //qDebug("setmax "); } } void KDateTable::contentsMousePressEvent(QMouseEvent *e) { if(e->type()!=QEvent::MouseButtonPress) { // the KDatePicker only reacts on mouse press events: return; } if(!isEnabled()) { KNotifyClient::beep(); return; } int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; // ----- int row, col, pos, temp; QPoint mouseCoord; // ----- mouseCoord = e->pos(); row=rowAt(mouseCoord.y()); col=columnAt(mouseCoord.x()); if(row<0 || col<0) { // the user clicked on the frame of the table return; } pos=7*(row-1)+col+1; #if 0 if(pos+dayoff<=firstday) { // this day is in the previous month KNotifyClient::beep(); return; } if(firstday+numdays<pos+dayoff) { // this date is in the next month KNotifyClient::beep(); return; } #endif temp=firstday+date.day()-dayoff-1; QDate da = QDate(date.year(), date.month(),1); setDate(da.addDays( pos-firstday+dayoff-1)); updateCell(temp/7+1, temp%7); // Update the previously selected cell updateCell(row, col); // Update the selected cell // assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); emit(tableClicked()); } bool KDateTable::setDate(const QDate& date_) { bool changed=false; QDate temp; mMarkCurrent = false; // ----- if(!date_.isValid()) { kdDebug() << "KDateTable::setDate: refusing to set invalid date." << endl; return false; } if(date!=date_) { |