示例#1
0
void DialogSettings::loadCalendars() {
    map<string, Calendar*> cals = calendars();

    ui->calendarList->addItem("Default"); // Precreated calendar

    qDebug("Calendars size: %d", cals.size());
    for (map<string, Calendar*>::iterator iter = cals.begin(); iter != cals.end(); iter++) {
        ui->calendarList->addItem(QString(iter->first.c_str()));
    }
}
示例#2
0
void KLocaleConfigTime::slotLocaleChanged()
{
  typedef QValueVector<QString> CalendarVector;
  CalendarVector calendars(4);
  calendars[0] = "gregorian";
  calendars[1] = "hijri";
  calendars[2] = "hebrew";
  calendars[3] = "jalali";

  QString calendarType = m_locale->calendarType();
  int calendarSystem = 0;

  CalendarVector::iterator it = qFind(calendars.begin(), calendars.end(),
calendarType);
  if ( it != calendars.end() )
    calendarSystem = it - calendars.begin();

  kdDebug() << "calSys: " << calendarSystem << ": " << calendarType << endl;
  m_comboCalendarSystem->setCurrentItem( calendarSystem );

  //  m_edTimeFmt->setText( m_locale->timeFormat() );
  m_comboTimeFmt->setEditText( storeToUser( timeMap(),
					    m_locale->timeFormat() ) );
  // m_edDateFmt->setText( m_locale->dateFormat() );
  m_comboDateFmt->setEditText( storeToUser( dateMap(),
					    m_locale->dateFormat() ) );
  //m_edDateFmtShort->setText( m_locale->dateFormatShort() );
  m_comboDateFmtShort->setEditText( storeToUser( dateMap(),
					  m_locale->dateFormatShort() ) );
  m_comboWeekStartDay->setCurrentItem( m_locale->weekStartDay() - 1 );

  if ( m_locale->nounDeclension() )
    m_chDateMonthNamePossessive->setChecked( m_locale->dateMonthNamePossessive() );

  kdDebug(173) << "converting: " << m_locale->timeFormat() << endl;
  kdDebug(173) << storeToUser(timeMap(),
			   m_locale->timeFormat()) << endl;
  kdDebug(173) << userToStore(timeMap(),
			   QString::fromLatin1("HH:MM:SS AMPM test")) << endl;

}
示例#3
0
void KLocaleConfigTime::slotCalendarSystemChanged(int calendarSystem)
{
  kdDebug() << "CalendarSystem: " << calendarSystem << endl;

  typedef QValueVector<QString> CalendarVector;
  CalendarVector calendars(4);
  calendars[0] = "gregorian";
  calendars[1] = "hijri";
  calendars[2] = "hebrew";
  calendars[3] = "jalali";

  QString calendarType;
  bool ok;
  calendarType = calendars.at(calendarSystem, &ok);
  if ( !ok )
    calendarType = calendars.first();

  m_locale->setCalendar(calendarType);

  updateWeekDayNames();
  emit localeChanged();
}