[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: developer.kde.org/documentation/library/kdeqt/kde3arch
From: Carlos Moro <cfmoro () correo ! uniovi ! es>
Date: 2003-01-08 0:08:13
[Download RAW message or body]
CVS commit by cfmoro:
added week day names porting documentation
M +29 -1 kcalendarsystem.html 1.2
--- developer.kde.org/documentation/library/kdeqt/kde3arch/kcalendarsystem.html #1.1:1.2
@@ -11,5 +11,5 @@
<p>Previously it has been normal to use QDate::addDays(), QDate::addMonths(),
and QDate::addYears() to get a date a few days, months or years later. It's
-important to reallize that QDate operates with Gregorian dates, and that a
+important to realize that QDate operates with Gregorian dates, and that a
Gregorian month will most likely be of different length than a non gregorian
one.</p>
@@ -53,4 +53,32 @@
for ( int i = 1; i <= max; ++i )
lst << calendar->monthName(i);
+</pre>
+<h2>Week day names</h2>
+<p>A few applications use KLocale::weekDayName() to get the name of the week day.
+The name returned belong to Gregorian calendar. This method should be replaced by
+the similar method in KCalendarSystem. If you're working in a custom widget that
+for instace paints in a different colour the day of the week dedicated to pray
+in tradition (e.g. Sunday in Gregorian calendar, 5th day in Hijri calendar), the method
+KCalendarSystem::weekDayOfPray() might be useful.
+<h3>Example</h3>
+You have a program that wants to print the name of the days of week and mark with
+a '*' the day of pray.
+<pre>
+ // Works only with Gregorian
+ KLocale * locale = KGlobal::locale();
+ QStringList lst;
+ for ( int i = 1; i <= 7; ++i )
+ if( i == 7 )
+ lst << QString("*").append( locale->weekDayName(i) );
+ else
+ lst << locale->weekDayName(i);
+ // KCalendarSystem
+ const KCalendarSystem * calendar = KGlobal::locale()->calendar();
+ QStringList lst;
+ for ( int i = 1; i <= 7; ++i )
+ if( i == calendar->weekDayOfPray() )
+ lst << QString("*").append( calendar->weekDayName(i) );
+ else
+ lst << calendar->weekDayName(i);
</pre>
</body>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic