-rw-r--r-- | bin/kdepim/WhatsNew.txt | 5 | ||||
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 1 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 14 | ||||
-rw-r--r-- | libkdepim/kdatepicker.cpp | 8 | ||||
-rw-r--r-- | microkde/kdatetbl.cpp | 32 |
5 files changed, 34 insertions, 26 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index edf7eb1..681e433 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -1,66 +1,71 @@ Info about the changes in new versions of KDE-Pim/Pi +********** VERSION 2.2.6 ************ + +KO/Pi: +Made navigation in datepicker more userfriendly when using keyboard for scrolling. + ********** VERSION 2.2.5 ************ Bugfixes in KO/Pi, KA/Pi and OM/Pi. Added possibility to disable auto saving in KO/Pi. How to disable it? Good question! Next question, please? Added info about count of events/todos/journals to calendar info. ********** VERSION 2.2.4 ************ KO/Pi alarm applet: Made font smaller and added a dealy before starting KO/Pi to avoid problems accessing data storage when an alarm did wake up the Z. Added 3 sec notification about a started timer. KO/Pi: Added export option for all data to File->Export menu. Better management if a save error occours. Added 15 sec delay in automatic saving when Z wake up from suspend and the automatic save timer did expire - to avoid problems accessing data storage directly after wake up. Fix for displaying month names of an utf8 translated language (like Russian). I hope a Russian version of KO/Pi will be available soon. Added duration info about multiday events. Changed behaviour of "Set complete" in Todo viewer: Now Todo viewer closes not automatically. KA/Pi: Added for vCard import the option to import contact data in Latin1 format. ********** VERSION 2.2.3 ************ KO/Pi: Fixed a problem with (non empty) exception dates in the exception date edit dialog of recurring events for newly created events. Fixed usability problem in KA/Pi: Now searching works for "all phone numbers and all addresses" if "all fields" is selected as search option. Changed some behaviour in OM/Pi mail management to make it more usable. ********** VERSION 2.2.2 ************ KO/Pi: Fixed a problem with the sort order of last modified date in list view. KA/Pi: Fixed a resource config read problem on windows. ********** VERSION 2.2.1 ************ KO/Pi: Fixed a problem displaying very long allday events in agenda view in single day mode. Fixed a problem with the default settings for new todos. Added an error message dialog if saving of calendar files is not possible. Made it impossible to close KO/Pi if saving fails. Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick. Added config options for conflict detection. KA/Pi: Added a config option to turn on asking before a contact is deleted. Fixed a problem with the default view and view selection at startup. Formatted name is now set on import, if formatted name is empty. Fixed a problem of displaying images in the contact details view: Now the wid/hei ratio is not changed. I a picture is larger than 128 pixels in wid or hei it is downscaled to max 128 pixels wid/hei. ********** VERSION 2.2.0 ************ diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 288ce4b..767e243 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1517,65 +1517,64 @@ { "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" }, { "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" }, { "Pi-Sync: Connected!","Pi-Sync: Verbunden!" }, { "Receiving file from remote...","Empfange entfernte Datei..." }, { "Sending back synced file...","Sende synchronisierte Datei zurück..." }, { "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" }, { "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" }, { "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." }, { "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" }, { "Writing back file ...","Schreibe Datei zurück..." }, { "Sending back file ...","Sende Datei zurück..." }, { "Eeek, there I am ticklish!","Hihi, da bin ich kitzlig!" }, { "Created","Angelegt" }, { "Last Modified Sub","Zuletzt geändertes Sub" }, { "Checking conflicts ... please wait","Überprüfe Konflikte ... bitte warten" }, { "Show times on two lines","Zeige Zeiten auf zwei Zeilen" }, { "Save using LOCAL storage","Speichere nutze LOCAL Pfad" }, { "Duration","Dauer" }, { " day"," Tag" }, { "Click this button to display all todos in a <b>flat</b> hierarchy","Klicke diesen Knopf um alle Todos in einer <b>flachen</b> Hierarchie darzustellen" }, { "Click this button to display all todos <b>openend</b>","Klicke diesen Knopf um alle Todos <b>geöffnet</b> darzustellen" }, { "Click this button to display all todos <b>closed</b>","Klicke diesen Knopf um alle Todos <b>geschlossen</b> darzustellen" }, { "Click this button to toggle show/hide <b>running</b> todos","Klicke diesen Knopf um <b>zeige Laufende</b> umzuschalten" }, { "Click this button to toggle show/hide <b>completed</b> todos","Klicke diesen Knopf um <b>zeige Erledigte</b> umzuschalten" }, { "Click this button to add a new subtodo to the currently selected todo","Klicke diesen Knopf um ein Untertodo zu dem gerade selektierten Todo hinzuzufügen" }, { "In this column you can <b>set a calendar to be visible</b>. If a calendar is not visible its entries are not displayed in the views. You can add items to it and it is loaded/saved as usual.","In dieser Spalte kann man einen <b>Kalender auf sichtbar schalten</b>. Wenn ein Kalender nicht sichtbar ist werden seine Einträge nicht in den Ansichten angezeigt. Man kann Einträge hinzufügen und laden/speichern wie gewöhnlich." }, { "In this column you can see the <b>name of the calendar</b>. If you click on the name button you will get an information box about the loaded calendar file. If the file was not loaded at startup you can try to load it here again.","In dieser Spalte wird der <b>Name des Kalenders</b> angezeigt. Wenn Sie auf den Namen klicken wird Information über die Kalenderdatei angezeigt. Wenn die Datei beim Start nicht geladen wurde können Sie hier erneut versuchen sie zu laden." }, { "In this column you can <b>disable the alarms of a calendar all together</b>. The alarm data in the calendar itself is not changed, the alarms are marked internally as "do not use". Useful if you load a calendar of another person but do not want to get notified about alarms of that person.","In dieser Spalte können die <b>Alarme eines Kalenders alle zusammen abgeschaltet werden</b>. Die Alarmdaten im Kalender selbst werden nicht verändert, es werde die Alarme intern als "nicht beachten" markiert. Nützlich wenn Sie den Kalender einer anderen Person laden aber nicht über dessen Alarme unterrichtet werden wollen." }, { "In this column you can <b>set a calendar and all entries of the calendar to read only</b>. If a calendar is readonly the entries cannot be edited and no items can be added to the calendar. If you change a setting of a calendar to readonly in this column all data will be saved because the data of a readonly calendar is not saved later.","In dieser Spalte können Sie einen <b>Kalender und alle Einträge auf schreibgeschützt setzen</b>. Einträge eines schreibgeschützten Kalenders können nicht verändert werden und es können keine Einträge zum Kalender hinzugefügt werden. Wenn Sie die Einstellung eines Kalenders in dieser Spalte auf schreibgeschützt setzen werden alle Daten automatisch abgespeichert, da die Daten eines schreibgeschützten Kalenders später nicht mehr gespeichert werden." }, { "Click this button to <b>add a calendar</b>. You can add an existing calendar file or you can add a new calendar and KO/Pi creates a new empty calendar file for you.","Klicken Sie diesen Knopf <b>um einen Kalender hinzuzufügen</b>. Sie können eine existierende Kalenderdatei hinzufügen oder einen neuen Kalender und KO/Pi legt dann eine neue leere Kalenderdatei für Sie an." }, { "<b>iCal (*.ics) file on disk:</b><br>(will be created, if not existing)","<b>iCal (*.ics) Datei:</b><br>(Datei wird angelegt, wenn sie nicht existiert)" }, { "Error saving data","Fehler beim Abspeichern" }, { "Calendar(s) not saved:","Nicht gespeicherte Kalender:" }, { "Enable conflict detection","Schalte Konflikterkennung an" }, { "Filter for the edited event","Filter für den bearbeiteten Termin" }, { "Filter for other events","Filter für die anderen Termine" }, { "Check Allday with Allday","Prüfe GanzTag mit GanzTag" }, { "Check Allday with NonAllday","Prüfe GanzTag mit NichtGanzTag" }, { "Check NonAllday with Allday","Prüfe NichtGanzTag mit GanzTag" }, { "Check NonAllday with NonAllday","Prüfe NichtGanzTag mit NichtGanzTag" }, { "Conflict detection","Konflikterkennung" }, { "Loading calendar files ... please wait","Lade Kalenderdateien ... bitte warten" }, { "Show multiday allday ev. in date nav.","Zeige Multi-Ganzt.Term.in Datums Nav." }, { "Include events which "show as free"","Inklusive Termine mit "Zeige Zeit als frei"" }, { "Conflict detection checks an <b>edited event</b> with <b>other events</b> for overlapping.","Konflikterkennung prüft einen <b>bearbeiteten Termin</b> auf Überschneidungen mit <b>anderen Terminen</b>." }, { " Yes, close "," Ja, beenden " }, { "Export All Data","Exportiere alle Daten" }, { "You can save all data\nto another file via\nFile->Export->Export All Data","Sie können alle Daten in\neine andere Datei speichern unter\nDatei->Exportiere->Exportiere alle Daten" }, { "<p><b>Duration:</b> %1 days</p>","<p><b>Dauer:</b> %1 Tage</p>" }, { " (Duration: %1 days)"," (Dauer: %1 Tage)" }, { "Autosave enabled!","Auto-Speichern angeschaltet!" }, { "Autosave disabled! Save timer stopped!","Auto-Speichern ausgeschaltet! Speicher Timer gestoppt!" }, { "Autosave disabled!","Auto-Speichern ist ausgeschaltet!" }, { "Yes, Save!","Ja, Speichern!" }, { "Calendar is modified\nbut Autosave is disabled!\nDo you want\nto save the data?","Der Kalender wurde verändert,\naber Auto-Speichern ist\nabgeschaltet. Möchten Sie\ndie Daten speichern?" }, { "<p><b>C+ctrl</b>: Dis/enable automatic saving</p>\n","<p><b>C+ctrl</b>: Auto-Speichern ab/anschalten</p>\n" }, { "<br>The calendar contains<br><b>%1 events<br>%2 todos<br>%3 journals</b>","<br>Der Kalender enthält<br><b>%1 Termine<br>%2 Todos<br>%3 Journale</b>" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, -{ "","" }, diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 610aae6..85e9166 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -676,135 +676,143 @@ void MonthViewCell::startUpdateCell() mToolTip.clear(); //qApp->processEvents(); #if 0 if ( !mHolidayString.isEmpty() ) { MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); item->setPalette( mHolidayPalette ); insertItem( item ); mToolTip.append ( mHolidayString ); } #endif } int MonthViewCell::insertEvent(Event *event) { bool useToolTips = true; #ifndef DESKTOP_VERSION useToolTips = false; #endif QString mToolTipText; setFocusPolicy(WheelFocus); if ( !(event->doesRecur() == Recurrence::rNone) ) { if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) return mdayCount; else if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) return mdayCount; } if ( event->isHoliday()) { setHoliday( true ); if ( mDate.dayOfWeek() == 7 ) setLineWidth( 3 ); } QString text; int multiday = 0;// 1 = start, 2 = midddle, 3 = end day if (event->isMultiDay()) { QString prefix = "<->";multiday = 2; QString time; if ( event->doesRecur() ) { if ( event->recursOn( mDate) ) { prefix ="->" ;multiday = 1; } else { int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); if ( event->recursOn( mDate.addDays( -days)) ) { prefix ="<-" ;multiday = 3; } } } else { if (mDate == event->dtStart().date()) { prefix ="->" ;multiday = 1; } else if (mDate == event->dtEnd().date()) { prefix ="<-" ;multiday = 3; } } if ( !event->doesFloat() ) { if ( mDate == event->dtStart().date () ) time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; else if ( mDate == event->dtEnd().date () ) time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; } text = time + event->summary(); + + int dur = 0; + if ( event->doesFloat() ) { + dur = event->dtStart().daysTo(event->dtEnd())+1; + + } if ( useToolTips ) { mToolTipText += prefix + text; - if ( event->doesFloat() ) { - mToolTipText += i18n(" (Duration: %1 days)" ).arg ( event->dtStart().daysTo(event->dtEnd())+1); - + if ( dur ) { + mToolTipText += i18n(" (Duration: %1 days)" ).arg ( dur ); } } + if ( dur ) { + text += " ("+ QString::number( dur ) + i18n(" days" ) + ")"; + } } else { if (event->doesFloat()) { text = event->summary(); if ( useToolTips ) mToolTipText += text; } else { text = KGlobal::locale()->formatTime(event->dtStart().time()); text += " " + event->summary(); if ( useToolTips ) mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); } } if ( useToolTips && ! event->location().isEmpty() ) { mToolTipText += " (" + event->location() +")"; } MonthViewItem *item ; if ( mAvailItemList.count() ) { item = mAvailItemList.first(); mAvailItemList.remove( item ); item->recycle( event, text ); } else { item = new MonthViewItem( event, text ); } QPalette pal; if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { QStringList categories = event->categories(); QString cat = categories.first(); if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { pal = getPalette(); if (cat.isEmpty()) { //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() )); } else { pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); } } else { if (cat.isEmpty()) { //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() )); } else { pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); } } } else { pal = mStandardPalette ; } pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); item->setPalette( pal ); item->setRecur( event->doesRecur() ); item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); item->setMoreInfo( event->description().length() > 0 ); #ifdef DESKTOP_VERSION Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, KOPrefs::instance()->email()); if ( me != 0 ) { if ( me->status() == Attendee::NeedsAction && me->RSVP()) item->setReply(true && multiday < 2); else item->setReply(false); diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp index 25b4e81..68ef943 100644 --- a/libkdepim/kdatepicker.cpp +++ b/libkdepim/kdatepicker.cpp @@ -91,128 +91,132 @@ KDatePicker::~KDatePicker() void KDatePicker::resizeEvent(QResizeEvent*) { QWidget *buttons[] = { yearBackward, monthBackward, selectMonth, selectYear, monthForward, yearForward }; const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); QSize sizes[NoOfButtons]; int buttonHeight=0; int count; int w; int x=0; // ----- calculate button row height: for(count=0; count<NoOfButtons; ++count) { int xS = buttons[count]->sizeHint().width(); int yS = buttons[count]->sizeHint().height(); if ( QApplication::desktop()->width() < 320 ) sizes[count]=QSize ( xS+4, yS ); else sizes[count]=QSize ( xS+10, yS ); buttonHeight=QMAX(buttonHeight, sizes[count].height()); } buttonHeight += 10; // ----- calculate size of the month button: w=0; for(count=0; count<NoOfButtons; ++count) { if(buttons[count]!=selectMonth) { w+=sizes[count].width(); } else { x=count; } } sizes[x].setWidth(width()-w); // stretch the month button // ----- place the buttons: x=0; for(count=0; count<NoOfButtons; ++count) { w=sizes[count].width(); buttons[count]->setGeometry(x, 0, w, buttonHeight); x+=w; } // ----- place the line edit for direct input: sizes[0]=lineDate->sizeHint(); //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); int todaywid = todayBut->sizeHint().width(); todayBut->setGeometry(0, height()-sizes[0].height(),todaywid, sizes[0].height()); lineDate->setGeometry(0+todaywid, height()-sizes[0].height(), width()-todaywid, sizes[0].height()); // ----- adjust the table: table->setGeometry(0, buttonHeight, width(), height()-buttonHeight-sizes[0].height()); } void KDatePicker::dateChangedSlot(QDate date) { lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true)); //line->setText(KGlobal::locale()->formatDate(date, true)); + QString temp; + selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); + temp.setNum(date.year()); + selectYear->setText(temp); emit(dateChanged(date)); } void KDatePicker::tableClickedSlot() { emit(dateSelected(table->getDate())); emit(tableClicked()); } const QDate& KDatePicker::getDate() const { return table->getDate(); } const QDate & KDatePicker::date() const { return table->getDate(); } void KDatePicker::goToday() { slotSetDate( QDate::currentDate() ); } void KDatePicker::slotSetDate( QDate date ) { if(date.isValid()) { QString temp; // ----- table->setDate(date); selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); temp.setNum(date.year()); selectYear->setText(temp); //line->setText(KGlobal::locale()->formatDate(date, true)); lineDate->setDate( date ); } } bool KDatePicker::setDate(const QDate& date) { table->setFocus(); if(date.isValid()) { QString temp; // ----- table->setDate(date); selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); temp.setNum(date.year()); selectYear->setText(temp); //line->setText(KGlobal::locale()->formatDate(date, true)); lineDate->setDate( date ); return true; } else { return false; } } @@ -414,77 +418,81 @@ KDatePicker::sizeHint() const cx=QMAX(cx, tableSize.width()); // line edit ignored if ( cx > QApplication::desktop()->width() -5 ) cx = QApplication::desktop()->width() -5; // ----- calculate height hint: cy+=tableSize.height()+lineDate->sizeHint().height(); return QSize(cx, cy); } void KDatePicker::setFontSize(int s) { QWidget *buttons[]= { // yearBackward, // monthBackward, selectMonth, selectYear, // monthForward, // yearForward }; const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); int count; QFont font; QRect r; // ----- fontsize=s; for(count=0; count<NoOfButtons; ++count) { font=buttons[count]->font(); font.setPointSize(s); buttons[count]->setFont(font); } QFontMetrics metrics(selectMonth->fontMetrics()); for(int i=1; i <= 12; ++i) { // maxMonthRect is used by sizeHint() r=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); maxMonthRect.setWidth(QMAX(r.width(), maxMonthRect.width())); maxMonthRect.setHeight(QMAX(r.height(), maxMonthRect.height())); } table->setFontSize(s); } void KDatePicker::virtual_hook( int id, void* data ) { /*BASE::virtual_hook( id, data );*/ } void KDatePicker::keyPressEvent ( QKeyEvent * e ) { switch ( e->key() ) { case Qt::Key_Right: monthForwardClicked(); break; case Qt::Key_Left: monthBackwardClicked(); break; case Qt::Key_Down: yearForwardClicked(); break; case Qt::Key_Up: yearBackwardClicked(); break; + case Qt::Key_T: + goToday(); + break; + case Qt::Key_Return: case Qt::Key_Enter: case Qt::Key_Space: tableClickedSlot(); break; case Qt::Key_Escape: e->ignore(); break; default: break; } } diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index 4271b55..353f78d 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp @@ -179,169 +179,157 @@ KDateTable::paintCell(QPainter *painter, int row, int col) painter->setBrush(darkRed); pen=white; } else { painter->setBrush(darkGray); pen=white; } } else { if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) { painter->setPen(green); painter->setBrush(darkGreen); pen=white; } else { painter->setBrush(QColor(220,245,255)); painter->setPen(QColor(220,245,255)); } } painter->drawRect(0, 0, w, h); painter->setPen(pen); painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect); } /* if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width()); if(rect.height()>maxCell.height()) { maxCell.setHeight(rect.height()); } */ } void KDateTable::keyPressEvent( QKeyEvent *e ) { /* // not working properly if ( e->key() == Qt::Key_Prior ) { if ( date.month() == 1 ) { KNotifyClient::beep(); return; } int day = date.day(); if ( day > 27 ) while ( !QDate::isValid( date.year(), date.month()-1, day ) ) day--; setDate(QDate(date.year(), date.month()-1, day)); return; } if ( e->key() == Qt::Key_Next ) { if ( date.month() == 12 ) { KNotifyClient::beep(); return; } int day = date.day(); if ( day > 27 ) while ( !QDate::isValid( date.year(), date.month()+1, day ) ) day--; setDate(QDate(date.year(), date.month()+1, day)); return; } */ int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; int temp=firstday+date.day()-dayoff; int pos = temp; bool irgnore = true; + int add = 0; if ( e->state() != Qt::ControlButton ) { if ( e->key() == Qt::Key_Up ) { - pos -= 7; + add -= 7; irgnore = false; } if ( e->key() == Qt::Key_Down ) { - pos += 7; + add += 7; irgnore = false; } if ( e->key() == Qt::Key_Left ) { - pos--; + --add; irgnore = false; } if ( e->key() == Qt::Key_Right ) { - pos++; + ++add; irgnore = false; } } - if ( irgnore ) + if ( irgnore ) { e->ignore(); - - 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)); + pos += add; + setDate(date.addDays( add )); 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 "); } } 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; |