Qtopia library API Documentation

calendar.cpp

00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
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 }
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:03 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001