[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdepim/kalarm
From:       David Jarvie <software () astrojar ! org ! uk>
Date:       2005-12-23 21:58:06
Message-ID: 1135375086.283048.1189.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 490962 by djarvie:

Use calendar-independent day and month name translations

 M  +33 -7     recurrenceedit.cpp  


--- branches/KDE/3.5/kdepim/kalarm/recurrenceedit.cpp #490961:490962
@@ -39,7 +39,6 @@
 #include <kiconloader.h>
 #include <kdialog.h>
 #include <kmessagebox.h>
-#include <kcalendarsystem.h>
 #include <kdebug.h>
 
 #include <libkcal/event.h>
@@ -63,6 +62,7 @@
 #include "recurrenceedit.moc"
 #include "recurrenceeditprivate.moc"
 
+static QString weekDayName(int day, const KLocale*);
 
 // Collect these widget labels together to ensure consistent wording and
 // translations across different modules.
@@ -1050,11 +1050,11 @@
 	// Save the first day of the week, just in case it changes while the dialog is open.
 	QWidget* box = new QWidget(this);   // this is to control the QWhatsThis text display area
 	QGridLayout* dgrid = new QGridLayout(box, 4, 2, 0, KDialog::spacingHint());
-	const KCalendarSystem* calendar = KGlobal::locale()->calendar();
+	const KLocale* locale = KGlobal::locale();
 	for (int i = 0;  i < 7;  ++i)
 	{
 		int day = KAlarm::localeDayInWeek_to_weekDay(i);
-		mDayBox[i] = new CheckBox(calendar->weekDayName(day), box);
+		mDayBox[i] = new CheckBox(weekDayName(day, locale), box);
 		mDayBox[i]->setFixedSize(mDayBox[i]->sizeHint());
 		mDayBox[i]->setReadOnly(readOnly);
 		dgrid->addWidget(mDayBox[i], i%4, i/4, Qt::AlignAuto);
@@ -1244,11 +1244,11 @@
 	mPosButton->setFocusWidget(mWeekCombo);
 
 	mDayOfWeekCombo = new ComboBox(false, box);
-	const KCalendarSystem* calendar = KGlobal::locale()->calendar();
+	const KLocale* locale = KGlobal::locale();
 	for (int i = 0;  i < 7;  ++i)
 	{
 		int day = KAlarm::localeDayInWeek_to_weekDay(i);
-		mDayOfWeekCombo->insertItem(calendar->weekDayName(day));
+		mDayOfWeekCombo->insertItem(weekDayName(day, locale));
 	}
 	mDayOfWeekCombo->setReadOnly(readOnly);
 	QWhatsThis::add(mDayOfWeekCombo, i18n("Select the day of the week on which to repeat the alarm"));
@@ -1395,10 +1395,21 @@
 	QWidget* w = new QWidget(this);   // this is to control the QWhatsThis text display area
 	hlayout->addWidget(w, 1, Qt::AlignAuto);
 	QGridLayout* grid = new QGridLayout(w, 4, 3, 0, KDialog::spacingHint());
-	const KCalendarSystem* calendar = KGlobal::locale()->calendar();
+	const KLocale* locale = KGlobal::locale();
+	mMonthBox[0] = new CheckBox(locale->translate("January"), w);
+	mMonthBox[1] = new CheckBox(locale->translate("February"), w);
+	mMonthBox[2] = new CheckBox(locale->translate("March"), w);
+	mMonthBox[3] = new CheckBox(locale->translate("April"), w);
+	mMonthBox[4] = new CheckBox(locale->translate("May"), w);
+	mMonthBox[5] = new CheckBox(locale->translate("June"), w);
+	mMonthBox[6] = new CheckBox(locale->translate("July"), w);
+	mMonthBox[7] = new CheckBox(locale->translate("August"), w);
+	mMonthBox[8] = new CheckBox(locale->translate("September"), w);
+	mMonthBox[9] = new CheckBox(locale->translate("October"), w);
+	mMonthBox[10] = new CheckBox(locale->translate("November"), w);
+	mMonthBox[11] = new CheckBox(locale->translate("December"), w);
 	for (int i = 0;  i < 12;  ++i)
 	{
-		mMonthBox[i] = new CheckBox(calendar->monthName(i + 1, 2000), w);
 		mMonthBox[i]->setFixedSize(mMonthBox[i]->sizeHint());
 		mMonthBox[i]->setReadOnly(readOnly);
 		grid->addWidget(mMonthBox[i], i%4, i/4, Qt::AlignAuto);
@@ -1565,3 +1576,18 @@
 	    ||  mSavedMonths    != months()
 	    ||  mSavedFeb29Type != feb29Type());
 }
+
+QString weekDayName(int day, const KLocale* locale)
+{
+	switch (day)
+	{
+		case 1: return locale->translate("Monday");
+		case 2: return locale->translate("Tuesday");
+		case 3: return locale->translate("Wednesday");
+		case 4: return locale->translate("Thursday");
+		case 5: return locale->translate("Friday");
+		case 6: return locale->translate("Saturday");
+		case 7: return locale->translate("Sunday");
+	}
+	return QString();
+}
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic