Index: trunk/examples/widgets/calendarwidget/window.cpp
===================================================================
--- trunk/examples/widgets/calendarwidget/window.cpp	(revision 5)
+++ trunk/examples/widgets/calendarwidget/window.cpp	(revision 561)
@@ -2,5 +2,6 @@
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
 **
 ** This file is part of the examples of the Qt Toolkit.
@@ -21,8 +22,7 @@
 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 **
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 **
 ** GNU General Public License Usage
@@ -34,6 +34,6 @@
 ** met: http://www.gnu.org/copyleft/gpl.html.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
 ** $QT_END_LICENSE$
 **
@@ -168,20 +168,20 @@
 void Window::reformatCalendarPage()
 {
-    QTextCharFormat mayFirstFormat;
-    if (mayFirstCheckBox->isChecked())
+    if (firstFridayCheckBox->isChecked()) {
+        QDate firstFriday(calendar->yearShown(), calendar->monthShown(), 1);
+        while (firstFriday.dayOfWeek() != Qt::Friday)
+            firstFriday = firstFriday.addDays(1);
+        QTextCharFormat firstFridayFormat;
+        firstFridayFormat.setForeground(Qt::blue);
+        calendar->setDateTextFormat(firstFriday, firstFridayFormat);
+    }
+
+    //May First in Red takes precedence
+    if (mayFirstCheckBox->isChecked()) {
+        const QDate mayFirst(calendar->yearShown(), 5, 1);
+        QTextCharFormat mayFirstFormat;
         mayFirstFormat.setForeground(Qt::red);
-
-    QTextCharFormat firstFridayFormat;
-    if (firstFridayCheckBox->isChecked())
-        firstFridayFormat.setForeground(Qt::blue);
-
-    QDate date(calendar->yearShown(), calendar->monthShown(), 1); 
-
-    calendar->setDateTextFormat(QDate(date.year(), 5, 1), mayFirstFormat);
-
-    date.setDate(date.year(), date.month(), 1);
-    while (date.dayOfWeek() != Qt::Friday)
-        date = date.addDays(1);
-    calendar->setDateTextFormat(date, firstFridayFormat);
+        calendar->setDateTextFormat(mayFirst, mayFirstFormat);
+    }
 }
 //! [8]
@@ -197,5 +197,5 @@
     calendar->setGridVisible(true);
 
-    connect(calendar, SIGNAL(currentPageChanged(int, int)),
+    connect(calendar, SIGNAL(currentPageChanged(int,int)),
             this, SLOT(reformatCalendarPage()));
 
@@ -358,12 +358,12 @@
 
 //! [13] //! [14]
-    connect(currentDateEdit, SIGNAL(dateChanged(const QDate &)),
-            calendar, SLOT(setSelectedDate(const QDate &)));
+    connect(currentDateEdit, SIGNAL(dateChanged(QDate)),
+            calendar, SLOT(setSelectedDate(QDate)));
     connect(calendar, SIGNAL(selectionChanged()),
             this, SLOT(selectedDateChanged()));
-    connect(minimumDateEdit, SIGNAL(dateChanged(const QDate &)),
-            this, SLOT(minimumDateChanged(const QDate &)));
-    connect(maximumDateEdit, SIGNAL(dateChanged(const QDate &)),
-            this, SLOT(maximumDateChanged(const QDate &)));
+    connect(minimumDateEdit, SIGNAL(dateChanged(QDate)),
+            this, SLOT(minimumDateChanged(QDate)));
+    connect(maximumDateEdit, SIGNAL(dateChanged(QDate)),
+            this, SLOT(maximumDateChanged(QDate)));
 
 //! [14]
@@ -419,5 +419,5 @@
     connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)),
             this, SLOT(weekendFormatChanged()));
-    connect(headerTextFormatCombo, SIGNAL(currentIndexChanged(const QString &)),
+    connect(headerTextFormatCombo, SIGNAL(currentIndexChanged(QString)),
             this, SLOT(reformatHeaders()));
     connect(firstFridayCheckBox, SIGNAL(toggled(bool)),
