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