00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "calendar.h"
00021 #include "qpeglobal.h"
00022
00023 #include <qdatetime.h>
00024 #include <qobject.h>
00025
00026
00035 static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() QPE_SYMBOL_UNUSED;
00036 static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() {
00037 (void)QObject::tr("Jan");
00038 (void)QObject::tr("Feb");
00039 (void)QObject::tr("Mar");
00040 (void)QObject::tr("Apr");
00041 (void)QObject::tr("May");
00042 (void)QObject::tr("Jun");
00043 (void)QObject::tr("Jul");
00044 (void)QObject::tr("Aug");
00045 (void)QObject::tr("Sep");
00046 (void)QObject::tr("Oct");
00047 (void)QObject::tr("Nov");
00048 (void)QObject::tr("Dec");
00049 (void)QObject::tr("Mon");
00050 (void)QObject::tr("Tue");
00051 (void)QObject::tr("Wed");
00052 (void)QObject::tr("Thu");
00053 (void)QObject::tr("Fri");
00054 (void)QObject::tr("Sat");
00055 (void)QObject::tr("Sun");
00056 }
00057
00058
00059
00065 QString Calendar::nameOfMonth( int m )
00066 {
00067 QDate d;
00068 return QObject::tr( d.monthName( m ) );
00069 }
00070
00075 QString Calendar::nameOfDay( int d )
00076 {
00077 QDate dt;
00078 return QObject::tr( dt.dayName( d ) );
00079 }
00080
00082 QValueList<Calendar::Day> Calendar::daysOfMonth( int year, int month,
00083 bool startWithMonday )
00084 {
00085 QDate temp;
00086 temp.setYMD( year, month, 1 );
00087 int firstDay = temp.dayOfWeek();
00088 int i;
00089 QDate prev;
00090 QValueList<Day> days;
00091
00092 if ( startWithMonday )
00093 i = 1;
00094 else
00095 i = 0;
00096
00097 if ( month > 1 )
00098 prev.setYMD( year, month - 1, 1 );
00099 else
00100 prev.setYMD( year - 1, 12, 1 );
00101 for ( ; i < firstDay; i++ ) {
00102 days.append( Day( prev.daysInMonth() - ( firstDay - i - 1 ),
00103 Day::PrevMonth, FALSE ) );
00104 }
00105 for ( i = 1; i <= temp.daysInMonth(); i++ )
00106 days.append( Day( i, Day::ThisMonth, FALSE ) );
00107 i = 0;
00108 while ( days.count() < 6 * 7 )
00109 days.append( Day( ++i, Day::NextMonth, FALSE ) );
00110
00111 return days;
00112 }