4 * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
5 * Copyright (c) 2008 John Layt <john@layt.net>
7 * Requires the Qt widget libraries, available at no cost at
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 #include <QFormLayout>
35 #include <KConfigGroup>
36 #include <KStandardDirs>
38 #include <KCalendarSystem>
41 #include "localetime.h"
42 #include "localetime.moc"
50 static StringPair
find( const QList
<StringPair
> &list
, const QChar
&c
)
52 for ( QList
<StringPair
>::ConstIterator it
= list
.begin();
55 if ((*it
).storeName
==c
) return (*it
);
63 /* Sort the string pairs with qHeapSort in the order we want
64 ( relative to the userName value and with "MESCORTO" before "MES" )
66 bool operator< (const StringPair
&p1
, const StringPair
&p2
)
68 return ! (p1
.userName
<p2
.userName
);
71 bool operator<= (const StringPair
&p1
, const StringPair
&p2
)
73 return ! (p1
.userName
<=p2
.userName
);
76 bool operator> (const StringPair
&p1
, const StringPair
&p2
)
78 return ! (p1
.userName
>p2
.userName
);
81 bool operator>= (const StringPair
&p1
, const StringPair
&p2
)
83 return ! (p1
.userName
>=p2
.userName
);
86 StringPair
KLocaleConfigTime::buildStringPair(const QChar
&c
, const QString
&s
) const
94 QList
<StringPair
> KLocaleConfigTime::timeMap() const
96 QList
< StringPair
> list
;
97 list
+=buildStringPair('H',ki18n("HH").toString(m_locale
));
98 list
+=buildStringPair('k',ki18n("hH").toString(m_locale
));
99 list
+=buildStringPair('I',ki18n("PH").toString(m_locale
));
100 list
+=buildStringPair('l',ki18n("pH").toString(m_locale
));
101 list
+=buildStringPair('M',ki18nc("Minute", "MM").toString(m_locale
));
102 list
+=buildStringPair('S',ki18n("SS").toString(m_locale
));
103 list
+=buildStringPair('p',ki18n("AMPM").toString(m_locale
));
110 QList
<StringPair
> KLocaleConfigTime::dateMap() const
112 QList
< StringPair
> list
;
113 list
+=buildStringPair('Y',ki18n("YYYY").toString(m_locale
));
114 list
+=buildStringPair('y',ki18n("YY").toString(m_locale
));
115 list
+=buildStringPair('n',ki18n("mM").toString(m_locale
));
116 list
+=buildStringPair('m',ki18nc("Month", "MM").toString(m_locale
));
117 list
+=buildStringPair('b',ki18n("SHORTMONTH").toString(m_locale
));
118 list
+=buildStringPair('B',ki18n("MONTH").toString(m_locale
));
119 list
+=buildStringPair('e',ki18n("dD").toString(m_locale
));
120 list
+=buildStringPair('d',ki18n("DD").toString(m_locale
));
121 list
+=buildStringPair('a',ki18n("SHORTWEEKDAY").toString(m_locale
));
122 list
+=buildStringPair('A',ki18n("WEEKDAY").toString(m_locale
));
129 QString
KLocaleConfigTime::userToStore(const QList
<StringPair
> & list
,
130 const QString
& userFormat
) const
134 for ( int pos
= 0; pos
< userFormat
.length(); ++pos
)
137 for ( QList
<StringPair
>::ConstIterator it
= list
.begin();
138 it
!= list
.end() && !bFound
;
141 QString s
= (*it
).userName
;
143 if ( userFormat
.mid( pos
, s
.length() ) == s
)
146 result
+= (*it
).storeName
;
148 pos
+= s
.length() - 1;
156 QChar c
= userFormat
.at( pos
);
167 QString
KLocaleConfigTime::storeToUser(const QList
<StringPair
> & list
,
168 const QString
& storeFormat
) const
172 bool escaped
= false;
173 for ( int pos
= 0; pos
< storeFormat
.length(); ++pos
)
175 QChar c
= storeFormat
.at(pos
);
178 StringPair it
= StringPair::find( list
, c
);
179 if ( !it
.userName
.isEmpty() )
180 result
+= it
.userName
;
195 KLocaleConfigTime::KLocaleConfigTime(KLocale
*_locale
,
201 QFormLayout
*lay
= new QFormLayout( this );
202 lay
->setMargin( KDialog::marginHint() );
203 lay
->setSpacing( KDialog::spacingHint());
205 QLabel
* labCalendarSystem
= new QLabel(this);
206 labCalendarSystem
->setObjectName( I18N_NOOP("Calendar system:") );
207 m_comboCalendarSystem
= new QComboBox(this);
208 lay
->addRow(labCalendarSystem
, m_comboCalendarSystem
);
209 m_comboCalendarSystem
->setEditable(false);
210 connect(m_comboCalendarSystem
, SIGNAL(activated(int)),
211 this, SLOT(slotCalendarSystemChanged(int)));
212 QStringList tmpCalendars
;
213 tmpCalendars
<< QString() << QString();
214 m_comboCalendarSystem
->addItems(tmpCalendars
);
216 QGroupBox
*fGr
= new QGroupBox(/*("Format"),*/this);
217 QFormLayout
*fLay
= new QFormLayout( fGr
);
219 m_labTimeFmt
= new QLabel(this);
220 m_labTimeFmt
->setObjectName( I18N_NOOP("Time format:") );
221 m_comboTimeFmt
= new QComboBox(this);
222 fLay
->addRow(m_labTimeFmt
,m_comboTimeFmt
);
223 m_comboTimeFmt
->setEditable(true);
224 //m_edTimeFmt = m_comboTimeFmt->lineEdit();
225 //m_edTimeFmt = new QLineEdit(this);
226 connect( m_comboTimeFmt
, SIGNAL( editTextChanged(const QString
&) ),
227 this, SLOT( slotTimeFmtChanged(const QString
&) ) );
229 m_labDateFmt
= new QLabel(this);
230 m_labDateFmt
->setObjectName( I18N_NOOP("Date format:") );
231 m_comboDateFmt
= new QComboBox(this);
232 fLay
->addRow(m_labDateFmt
,m_comboDateFmt
);
233 m_comboDateFmt
->setEditable(true);
234 connect( m_comboDateFmt
, SIGNAL( editTextChanged(const QString
&) ),
235 this, SLOT( slotDateFmtChanged(const QString
&) ) );
237 m_labDateFmtShort
= new QLabel(this);
238 m_labDateFmtShort
->setObjectName( I18N_NOOP("Short date format:") );
239 m_comboDateFmtShort
= new QComboBox(this);
240 fLay
->addRow(m_labDateFmtShort
,m_comboDateFmtShort
);
241 m_comboDateFmtShort
->setEditable(true);
242 connect( m_comboDateFmtShort
, SIGNAL( editTextChanged(const QString
&) ),
243 this, SLOT( slotDateFmtShortChanged(const QString
&) ) );
245 m_chDateMonthNamePossessive
= new QCheckBox(this);
246 m_chDateMonthNamePossessive
->setObjectName(I18N_NOOP("Use declined form of month name"));
247 fLay
->addWidget(m_chDateMonthNamePossessive
);
248 connect( m_chDateMonthNamePossessive
, SIGNAL(clicked()),
249 SLOT(slotDateMonthNamePossChanged()));
252 QGroupBox
*wGr
= new QGroupBox(/*("Week"),*/this);
253 QFormLayout
*wLay
= new QFormLayout( wGr
);
255 QLabel
* labWeekStartDay
= new QLabel(this);
256 labWeekStartDay
->setObjectName( I18N_NOOP("First day of the week:") );
257 m_comboWeekStartDay
= new QComboBox(this);
258 wLay
->addRow(labWeekStartDay
,m_comboWeekStartDay
);
259 m_comboWeekStartDay
->setEditable(false);
260 connect (m_comboWeekStartDay
, SIGNAL(activated(int)),
261 this, SLOT(slotWeekStartDayChanged(int)));
263 QLabel
* labWorkingWeekStartDay
= new QLabel(this);
264 labWorkingWeekStartDay
->setObjectName( I18N_NOOP("First working day of the week:") );
265 m_comboWorkingWeekStartDay
= new QComboBox(this);
266 wLay
->addRow(labWorkingWeekStartDay
,m_comboWorkingWeekStartDay
);
267 m_comboWorkingWeekStartDay
->setEditable(false);
268 connect (m_comboWorkingWeekStartDay
, SIGNAL(activated(int)),
269 this, SLOT(slotWorkingWeekStartDayChanged(int)));
271 QLabel
* labWorkingWeekEndDay
= new QLabel(this);
272 labWorkingWeekEndDay
->setObjectName( I18N_NOOP("Last working day of the week:") );
273 m_comboWorkingWeekEndDay
= new QComboBox(this);
274 wLay
->addRow(labWorkingWeekEndDay
,m_comboWorkingWeekEndDay
);
275 m_comboWorkingWeekEndDay
->setEditable(false);
276 connect (m_comboWorkingWeekEndDay
, SIGNAL(activated(int)),
277 this, SLOT(slotWorkingWeekEndDayChanged(int)));
280 QLabel
* labWeekDayOfPray
= new QLabel(this);
281 labWeekDayOfPray
->setObjectName( I18N_NOOP("Day of the week for religious observance:") );
282 m_comboWeekDayOfPray
= new QComboBox(this);
283 wLay
->addRow(labWeekDayOfPray
,m_comboWeekDayOfPray
);
284 m_comboWeekDayOfPray
->setEditable(false);
285 connect (m_comboWeekDayOfPray
, SIGNAL(activated(int)),
286 this, SLOT(slotWeekDayOfPrayChanged(int)));
288 lay
->addRow(fGr
,wGr
);
290 updateWeekDayNames();
294 KLocaleConfigTime::~KLocaleConfigTime()
298 void KLocaleConfigTime::save()
300 KSharedConfig::Ptr config
= KGlobal::config();
301 KConfigGroup
group(config
, "Locale");
302 KConfig
ent(KStandardDirs::locate("locale",
303 QString::fromLatin1("l10n/%1/entry.desktop")
304 .arg(m_locale
->country())));
305 ent
.setLocale(m_locale
->language());
306 KConfigGroup entGrp
= ent
.group("KCM Locale");
310 str
= entGrp
.readEntry("CalendarSystem", QString::fromLatin1("gregorian"));
311 group
.deleteEntry("CalendarSystem", KConfig::Persistent
| KConfig::Global
);
312 if (str
!= m_locale
->calendarType())
313 group
.writeEntry("CalendarSystem", m_locale
->calendarType(), KConfig::Persistent
|KConfig::Global
);
315 str
= entGrp
.readEntry("TimeFormat", QString::fromLatin1("%H:%M:%S"));
316 group
.deleteEntry("TimeFormat", KConfig::Persistent
| KConfig::Global
);
317 if (str
!= m_locale
->timeFormat())
318 group
.writeEntry("TimeFormat", m_locale
->timeFormat(), KConfig::Persistent
|KConfig::Global
);
320 str
= entGrp
.readEntry("DateFormat", QString::fromLatin1("%A %d %B %Y"));
321 group
.deleteEntry("DateFormat", KConfig::Persistent
| KConfig::Global
);
322 if (str
!= m_locale
->dateFormat())
323 group
.writeEntry("DateFormat", m_locale
->dateFormat(), KConfig::Persistent
|KConfig::Global
);
325 str
= entGrp
.readEntry("DateFormatShort", QString::fromLatin1("%Y-%m-%d"));
326 group
.deleteEntry("DateFormatShort", KConfig::Persistent
| KConfig::Global
);
327 if (str
!= m_locale
->dateFormatShort())
328 group
.writeEntry("DateFormatShort",
329 m_locale
->dateFormatShort(), KConfig::Persistent
|KConfig::Global
);
332 firstDay
= entGrp
.readEntry("WeekStartDay", 1); //default to Monday
333 group
.deleteEntry("WeekStartDay", KConfig::Persistent
| KConfig::Global
);
334 if (firstDay
!= m_locale
->weekStartDay())
335 group
.writeEntry("WeekStartDay", m_locale
->weekStartDay(), KConfig::Persistent
|KConfig::Global
);
338 firstWorkingDay
= entGrp
.readEntry("WorkingWeekStartDay", 1); //default to Monday
339 group
.deleteEntry("WorkingWeekStartDay", KConfig::Persistent
| KConfig::Global
);
340 if (firstWorkingDay
!= m_locale
->workingWeekStartDay())
341 group
.writeEntry("WorkingWeekStartDay", m_locale
->workingWeekStartDay(), KConfig::Persistent
|KConfig::Global
);
344 lastWorkingDay
= entGrp
.readEntry("WorkingWeekEndDay", 5); //default to Friday
345 group
.deleteEntry("WorkingWeekEndDay", KConfig::Persistent
| KConfig::Global
);
346 if (lastWorkingDay
!= m_locale
->workingWeekEndDay())
347 group
.writeEntry("WorkingWeekEndDay", m_locale
->workingWeekEndDay(), KConfig::Persistent
|KConfig::Global
);
350 prayDay
= entGrp
.readEntry("WeekDayOfPray", 7); //default to Sunday
351 group
.deleteEntry("WeekDayOfPray", KConfig::Persistent
| KConfig::Global
);
352 if (prayDay
!= m_locale
->weekDayOfPray())
353 group
.writeEntry("WeekDayOfPray", m_locale
->weekDayOfPray(), KConfig::Persistent
|KConfig::Global
);
356 b
= entGrp
.readEntry("DateMonthNamePossessive", false);
357 group
.deleteEntry("DateMonthNamePossessive", KConfig::Persistent
| KConfig::Global
);
358 if (b
!= m_locale
->dateMonthNamePossessive())
359 group
.writeEntry("DateMonthNamePossessive",
360 m_locale
->dateMonthNamePossessive(), KConfig::Persistent
|KConfig::Global
);
365 void KLocaleConfigTime::showEvent( QShowEvent
*e
)
367 // This option makes sense only for languages where nouns are declined
368 if ( !m_locale
->nounDeclension() )
369 m_chDateMonthNamePossessive
->hide();
370 QWidget::showEvent( e
);
373 void KLocaleConfigTime::slotCalendarSystemChanged(int calendarSystem
)
375 kDebug() << "CalendarSystem: " << calendarSystem
;
377 typedef QVector
<QString
> CalendarVector
;
378 CalendarVector
calendars(4);
379 calendars
[0] = "gregorian";
380 calendars
[1] = "hijri";
381 calendars
[2] = "hebrew";
382 calendars
[3] = "jalali";
384 QString calendarType
;
385 if( calendarSystem
>= calendars
.size())
386 calendarType
= calendars
.first();
388 calendarType
= calendars
.at(calendarSystem
);
390 m_locale
->setCalendar(calendarType
);
392 updateWeekDayNames();
393 emit
localeChanged();
396 void KLocaleConfigTime::slotLocaleChanged()
398 typedef QVector
<QString
> CalendarVector
;
399 CalendarVector
calendars(4);
400 calendars
[0] = "gregorian";
401 calendars
[1] = "hijri";
402 calendars
[2] = "hebrew";
403 calendars
[3] = "jalali";
405 QString calendarType
= m_locale
->calendarType();
406 int calendarSystem
= 0;
408 CalendarVector::iterator it
= qFind(calendars
.begin(), calendars
.end(),
410 if ( it
!= calendars
.end() )
411 calendarSystem
= it
- calendars
.begin();
413 kDebug() << "calSys: " << calendarSystem
<< ": " << calendarType
;
414 m_comboCalendarSystem
->setCurrentIndex( calendarSystem
);
416 // m_edTimeFmt->setText( m_locale->timeFormat() );
417 m_comboTimeFmt
->setEditText( storeToUser( timeMap(), m_locale
->timeFormat() ) );
418 // m_edDateFmt->setText( m_locale->dateFormat() );
419 m_comboDateFmt
->setEditText( storeToUser( dateMap(), m_locale
->dateFormat() ) );
420 //m_edDateFmtShort->setText( m_locale->dateFormatShort() );
421 m_comboDateFmtShort
->setEditText( storeToUser( dateMap(), m_locale
->dateFormatShort() ) );
422 m_comboWeekStartDay
->setCurrentIndex( m_locale
->weekStartDay() - 1 );
423 m_comboWorkingWeekStartDay
->setCurrentIndex( m_locale
->workingWeekStartDay() - 1 );
424 m_comboWorkingWeekEndDay
->setCurrentIndex( m_locale
->workingWeekEndDay() - 1 );
425 m_comboWeekDayOfPray
->setCurrentIndex( m_locale
->weekDayOfPray() ); // First option is None=0
427 if ( m_locale
->nounDeclension() )
428 m_chDateMonthNamePossessive
->setChecked( m_locale
->dateMonthNamePossessive() );
430 kDebug(173) << "converting: " << m_locale
->timeFormat();
431 kDebug(173) << storeToUser(timeMap(), m_locale
->timeFormat()) << endl
;
432 kDebug(173) << userToStore(timeMap(), QString::fromLatin1("HH:MM:SS AMPM test")) << endl
;
436 void KLocaleConfigTime::slotTimeFmtChanged(const QString
&t
)
438 // m_locale->setTimeFormat(t);
439 m_locale
->setTimeFormat( userToStore( timeMap(), t
) );
441 emit
localeChanged();
444 void KLocaleConfigTime::slotDateFmtChanged(const QString
&t
)
446 // m_locale->setDateFormat(t);
447 m_locale
->setDateFormat( userToStore( dateMap(), t
) );
448 emit
localeChanged();
451 void KLocaleConfigTime::slotDateFmtShortChanged(const QString
&t
)
453 //m_locale->setDateFormatShort(t);
454 m_locale
->setDateFormatShort( userToStore( dateMap(), t
) );
455 emit
localeChanged();
458 void KLocaleConfigTime::slotWeekStartDayChanged(int firstDay
) {
459 kDebug(173) << "first day is now: " << firstDay
;
460 m_locale
->setWeekStartDay(m_comboWeekStartDay
->currentIndex() + 1);
461 emit
localeChanged();
464 void KLocaleConfigTime::slotWorkingWeekStartDayChanged(int startDay
) {
465 kDebug(173) << "first working day is now: " << startDay
;
466 m_locale
->setWorkingWeekStartDay(m_comboWorkingWeekStartDay
->currentIndex() + 1);
467 emit
localeChanged();
470 void KLocaleConfigTime::slotWorkingWeekEndDayChanged(int endDay
) {
471 kDebug(173) << "last working day is now: " << endDay
;
472 m_locale
->setWorkingWeekEndDay(m_comboWorkingWeekEndDay
->currentIndex() + 1);
473 emit
localeChanged();
476 void KLocaleConfigTime::slotWeekDayOfPrayChanged(int prayDay
) {
477 kDebug(173) << "day of pray is now: " << prayDay
;
478 m_locale
->setWeekDayOfPray(m_comboWeekDayOfPray
->currentIndex()); // First option is None=0
479 emit
localeChanged();
482 void KLocaleConfigTime::slotDateMonthNamePossChanged()
484 if (m_locale
->nounDeclension())
486 m_locale
->setDateMonthNamePossessive(m_chDateMonthNamePossessive
->isChecked());
487 emit
localeChanged();
491 void KLocaleConfigTime::slotTranslate()
495 QString sep
= QString::fromLatin1("\n");
499 // clear() and insertStringList also changes the current item, so
500 // we better use save and restore here..
501 old
= m_comboTimeFmt
->currentText();
502 m_comboTimeFmt
->clear();
503 str
= i18nc("some reasonable time formats for the language",
506 m_comboTimeFmt
->addItems(str
.split( sep
));
507 m_comboTimeFmt
->setEditText(old
);
509 old
= m_comboDateFmt
->currentText();
510 m_comboDateFmt
->clear();
511 str
= i18nc("some reasonable date formats for the language",
512 "WEEKDAY MONTH dD YYYY\n"
513 "SHORTWEEKDAY MONTH dD YYYY");
514 m_comboDateFmt
->addItems(str
.split( sep
));
515 m_comboDateFmt
->setEditText(old
);
517 old
= m_comboDateFmtShort
->currentText();
518 m_comboDateFmtShort
->clear();
519 str
= i18nc("some reasonable short date formats for the language",
523 m_comboDateFmtShort
->addItems(str
.split( sep
));
524 m_comboDateFmtShort
->setEditText(old
);
526 updateWeekDayNames();
528 while ( m_comboCalendarSystem
->count() < 4 )
529 m_comboCalendarSystem
->addItem(QString());
530 m_comboCalendarSystem
->setItemText
531 (0, ki18nc("Calendar System Gregorian", "Gregorian").toString(m_locale
));
532 m_comboCalendarSystem
->setItemText
533 (1, ki18nc("Calendar System Hijri", "Hijri").toString(m_locale
));
534 m_comboCalendarSystem
->setItemText
535 (2, ki18nc("Calendar System Hebrew", "Hebrew").toString(m_locale
));
536 m_comboCalendarSystem
->setItemText
537 (3, ki18nc("Calendar System Jalali", "Jalali").toString(m_locale
));
540 ("<p>The text in this textbox will be used to format "
541 "time strings. The sequences below will be replaced:</p>"
543 "<tr><td><b>HH</b></td><td>The hour as a decimal number using a 24-hour "
544 "clock (00-23).</td></tr>"
545 "<tr><td><b>hH</b></td><td>The hour (24-hour clock) as a decimal number "
547 "<tr><td><b>PH</b></td><td>The hour as a decimal number using a 12-hour "
548 "clock (01-12).</td></tr>"
549 "<tr><td><b>pH</b></td><td>The hour (12-hour clock) as a decimal number "
551 "<tr><td><b>MM</b></td><td>The minutes as a decimal number (00-59)."
553 "<tr><td><b>SS</b></td><td>The seconds as a decimal number (00-59)."
555 "<tr><td><b>AMPM</b></td><td>Either \"am\" or \"pm\" according to the "
556 "given time value. Noon is treated as \"pm\" and midnight as \"am\"."
558 "</table>").toString(m_locale
);
559 m_labTimeFmt
->setWhatsThis( str
);
560 m_comboTimeFmt
->setWhatsThis( str
);
562 QString datecodes
= ki18n(
564 "<tr><td><b>YYYY</b></td><td>The year with century as a decimal number."
566 "<tr><td><b>YY</b></td><td>The year without century as a decimal number "
568 "<tr><td><b>MM</b></td><td>The month as a decimal number (01-12)."
570 "<tr><td><b>mM</b></td><td>The month as a decimal number (1-12).</td></tr>"
571 "<tr><td><b>SHORTMONTH</b></td><td>The first three characters of the month name. "
573 "<tr><td><b>MONTH</b></td><td>The full month name.</td></tr>"
574 "<tr><td><b>DD</b></td><td>The day of month as a decimal number (01-31)."
576 "<tr><td><b>dD</b></td><td>The day of month as a decimal number (1-31)."
578 "<tr><td><b>SHORTWEEKDAY</b></td><td>The first three characters of the weekday name."
580 "<tr><td><b>WEEKDAY</b></td><td>The full weekday name.</td></tr>"
581 "</table>").toString(m_locale
);
584 ( "<p>The text in this textbox will be used to format long "
585 "dates. The sequences below will be replaced:</p>").toString(m_locale
) + datecodes
;
586 m_labDateFmt
->setWhatsThis( str
);
587 m_comboDateFmt
->setWhatsThis( str
);
590 ( "<p>The text in this textbox will be used to format short "
591 "dates. For instance, this is used when listing files. "
592 "The sequences below will be replaced:</p>").toString(m_locale
) + datecodes
;
593 m_labDateFmtShort
->setWhatsThis( str
);
594 m_comboDateFmtShort
->setWhatsThis( str
);
597 ("<p>This option determines which day will be considered as "
598 "the first one of the week.</p>").toString(m_locale
);
599 m_comboWeekStartDay
->setWhatsThis( str
);
602 ("<p>This option determines which day will be considered as "
603 "the first working day of the week.</p>").toString(m_locale
);
604 m_comboWorkingWeekStartDay
->setWhatsThis( str
);
607 ("<p>This option determines which day will be considered as "
608 "the last working day of the week.</p>").toString(m_locale
);
609 m_comboWorkingWeekEndDay
->setWhatsThis( str
);
612 ("<p>This option determines which day will be considered as "
613 "the day of the week for religious observance.</p>").toString(m_locale
);
614 m_comboWeekDayOfPray
->setWhatsThis( str
);
616 if ( m_locale
->nounDeclension() )
619 ("<p>This option determines whether possessive form of month "
620 "names should be used in dates.</p>").toString(m_locale
);
621 m_chDateMonthNamePossessive
->setWhatsThis( str
);
625 void KLocaleConfigTime::updateWeekDayNames()
627 const KCalendarSystem
* calendar
= m_locale
->calendar();
628 int daysInWeek
= calendar
->daysInWeek(QDate::currentDate());
629 QString weekDayName
= i18nc("Day name list, option for no day of religious observance", "None");
631 m_comboWeekStartDay
->clear();
632 m_comboWorkingWeekStartDay
->clear();
633 m_comboWorkingWeekEndDay
->clear();
634 m_comboWeekDayOfPray
->clear();
636 m_comboWeekDayOfPray
->insertItem(0, weekDayName
);
638 for ( int i
= 1; i
<= daysInWeek
; ++i
)
640 weekDayName
= calendar
->weekDayName(i
);
641 m_comboWeekStartDay
->insertItem(i
- 1, weekDayName
);
642 m_comboWorkingWeekStartDay
->insertItem(i
- 1, weekDayName
);
643 m_comboWorkingWeekEndDay
->insertItem(i
- 1, weekDayName
);
644 m_comboWeekDayOfPray
->insertItem(i
, weekDayName
);
647 m_comboWeekStartDay
->setCurrentIndex( m_locale
->weekStartDay() - 1 );
648 m_comboWorkingWeekStartDay
->setCurrentIndex( m_locale
->workingWeekStartDay() - 1 );
649 m_comboWorkingWeekEndDay
->setCurrentIndex( m_locale
->workingWeekEndDay() - 1 );
650 m_comboWeekDayOfPray
->setCurrentIndex( m_locale
->weekDayOfPray() ); // First option is None=0