Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

calendar.cpp

Go to the documentation of this file.
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 #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 }

Generated on Sat Nov 5 16:16:34 2005 for OPIE by  doxygen 1.4.2