summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-07-09 08:02:25 (UTC)
committer ulf69 <ulf69>2004-07-09 08:02:25 (UTC)
commitd91c533ffc42d7bf48fa1326754894b2c30b6831 (patch) (side-by-side diff)
treeba1eada897522030f17ccdf1afd4d4d96a65464e
parent82dabc14cc446fb8c0486cd4c32064e3866d2be9 (diff)
downloadkdepimpi-d91c533ffc42d7bf48fa1326754894b2c30b6831.zip
kdepimpi-d91c533ffc42d7bf48fa1326754894b2c30b6831.tar.gz
kdepimpi-d91c533ffc42d7bf48fa1326754894b2c30b6831.tar.bz2
changed the IntDateFormat from type int to enum, for easier categorization
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/addresseeeditordialog.cpp1
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp6
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp10
-rw-r--r--microkde/kdecore/klocale.cpp35
-rw-r--r--microkde/kdecore/klocale.h14
6 files changed, 31 insertions, 37 deletions
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp
index d8c1aca..5e42640 100644
--- a/kaddressbook/addresseeeditordialog.cpp
+++ b/kaddressbook/addresseeeditordialog.cpp
@@ -29,65 +29,64 @@
#include <kglobal.h>
#include "addresseeeditorwidget.h"
#include "kabcore.h"
#include "addresseeeditordialog.h"
AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
const char *name )
: KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ),
KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply,
KDialogBase::Ok, parent, name, true )
{
QWidget *page = plainPage();
QVBoxLayout *layout = new QVBoxLayout( page );
mEditorWidget = new AddresseeEditorWidget( core, false, page );
connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ),
SLOT( widgetModified() ) );
layout->addWidget( mEditorWidget );
enableButton( KDialogBase::Apply, false );
if ( QApplication::desktop()->width() < 480 ) {
hideButtons();
}
}
AddresseeEditorDialog::~AddresseeEditorDialog()
{
- qDebug("AddresseeEditorDialog::~AddresseeEditorDialog()");
//emit editorDestroyed( mEditorWidget->addressee().uid() );
}
void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr )
{
enableButton( KDialogBase::Apply, false );
mEditorWidget->setAddressee( addr );
}
KABC::Addressee AddresseeEditorDialog::addressee()
{
return mEditorWidget->addressee();
}
bool AddresseeEditorDialog::dirty()
{
return mEditorWidget->dirty();
}
void AddresseeEditorDialog::slotApply()
{
if ( mEditorWidget->dirty() ) {
mEditorWidget->save();
emit contactModified( mEditorWidget->addressee() );
}
enableButton( KDialogBase::Apply, false );
KDialogBase::slotApply();
}
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 4365ee5..3cfc1f2 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1036,69 +1036,65 @@ void AddresseeEditorWidget::save()
mAddressee.setNote( mNoteEdit->text() );
if ( mBirthdayPicker->inputIsValid() )
mAddressee.setBirthday( QDateTime( mBirthdayPicker->date() ) );
else
mAddressee.setBirthday( QDateTime() );
mAddressee.setNickName( mNicknameEdit->text() );
mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
mAddressee.setGeo( mGeoWidget->geo() );
mAddressee.setPhoto( mImageWidget->photo() );
mAddressee.setLogo( mImageWidget->logo() );
mAddressee.setKeys( mKeyWidget->keys() );
#ifndef KAB_EMBEDDED
mAddressee.setSound( mSoundWidget->sound() );
#else //KAB_EMBEDDED
//US qDebug("AddresseeEditorWidget::save sound not supported");
#endif //KAB_EMBEDDED
mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
// save custom fields
mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
if ( mAnniversaryPicker->inputIsValid() ) {
//US mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary",
//US mAnniversaryPicker->date().toString( Qt::ISODate ) );
- int orgformat = KGlobal::locale()->getIntDateFormat();
- QDate da = mAnniversaryPicker->date();
- KGlobal::locale()->setIntDateFormat( 2 ); // = Qt::ISODate
- QString dt = KGlobal::locale()->formatDate(da, true);
- KGlobal::locale()->setIntDateFormat(orgformat );
+ QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
}
else
mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
// Save the email addresses
QStringList emails = mAddressee.emails();
QStringList::Iterator iter;
for ( iter = emails.begin(); iter != emails.end(); ++iter )
mAddressee.removeEmail( *iter );
emails = mEmailWidget->emails();
bool first = true;
for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
mAddressee.insertEmail( *iter, first );
first = false;
}
// Save the phone numbers
KABC::PhoneNumber::List phoneNumbers;
KABC::PhoneNumber::List::Iterator phoneIter;
phoneNumbers = mAddressee.phoneNumbers();
for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
++phoneIter )
mAddressee.removePhoneNumber( *phoneIter );
phoneNumbers = mPhoneEditWidget->phoneNumbers();
for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
++phoneIter )
mAddressee.insertPhoneNumber( *phoneIter );
// Save the addresses
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index c3c3d47..58b3d70 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1747,65 +1747,65 @@ void CalendarView::writeFilterSettings(KConfig *config)
config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
}
void CalendarView::goToday()
{
mNavigator->selectToday();
}
void CalendarView::goNext()
{
mNavigator->selectNext();
}
void CalendarView::goPrevious()
{
mNavigator->selectPrevious();
}
void CalendarView::goNextMonth()
{
mNavigator->selectNextMonth();
}
void CalendarView::goPreviousMonth()
{
mNavigator->selectPreviousMonth();
}
void CalendarView::writeLocale()
{
KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
- KGlobal::locale()->setIntDateFormat( KOPrefs::instance()->mPreferredDate );
+ KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
QString dummy = KOPrefs::instance()->mUserDateFormatLong;
KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
dummy = KOPrefs::instance()->mUserDateFormatShort;
KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
KOPrefs::instance()->mDaylightsavingStart,
KOPrefs::instance()->mDaylightsavingEnd );
KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId );
}
void CalendarView::updateConfig()
{
writeLocale();
if ( KOPrefs::instance()->mUseAppColors )
QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
emit configChanged();
mTodoList->updateConfig();
// mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
// To make the "fill window" configurations work
//mViewManager->raiseCurrentView();
}
void CalendarView::eventChanged(Event *event)
{
changeEventDisplay(event,KOGlobals::EVENTEDITED);
//updateUnmanagedViews();
}
void CalendarView::eventAdded(Event *event)
{
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 0547a2e..b2001ec 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -421,70 +421,67 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
if (reply) mText += "on " + event->dtStartDateStr() + ": ";
QString dateText;
// qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() );
if ( st.date() < mEventDate )
dateText = "++:++-";
else
dateText = event->dtStartTimeStr() + "-";
if ( end.date() > mEventDate )
dateText += "++:++";
else
dateText += event->dtEndTimeStr();
if ( notRed )
mText += dateText;
else {
if ( end < cdt )
mText += "<font color=\"#F00000\">" + dateText + "</font>";
else if ( st < cdt )
mText += "<font color=\"#008000\">" + dateText + "</font>";
else
mText += dateText;
}
} else {
mText += i18n("Allday:");
}
} else {
mTodos.append( ev );
mText += i18n("ToDo:");
if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
// mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
QString dfs = KGlobal::locale()->dateFormatShort();
- KGlobal::locale()->setIntDateFormat( 3 );
KGlobal::locale()->setDateFormatShort("%d.%b");
- mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true) + "</font>";
-
+ mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
KGlobal::locale()->setDateFormatShort(dfs);
- KGlobal::locale()->setIntDateFormat( KOPrefs::instance()->mPreferredDate );
} else {
if (!ev->doesFloat() )
if( ( (Todo*)ev)->dtDue() < cdt ) {
mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
} else
mText +=((Todo*)ev)->dtDueTimeStr();
mTodos.append( ev );
}
}
mText += "</b></td><td>";
bool needClose = false;
if ( ev->cancelled() ) {
mText += "<font color=\"#F00000\">[c";
needClose =true;
}
if ( ev->isAlarmEnabled() ) {
if ( !needClose)
mText +="[";
mText += "a";
needClose =true;
}
if ( ev->description().length() > 0 ) {
if ( !needClose)
mText +="[";
mText += "i";
needClose =true;
}
if ( ev->recurrence()->doesRecur() ) {
@@ -538,70 +535,67 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
if ( !needClose)
mText +="[";
mText += "a";
needClose =true;
}
if ( ev->description().length() > 0 ) {
if ( !needClose)
mText +="[";
mText += "i";
needClose =true;
}
// if ( ev->recurrence()->doesRecur() ) {
// if ( !needClose)
// mText +="(";
// mText += "r";
// needClose =true;
// }
if ( needClose )
mText += "] ";
if ( ev->cancelled() )
mText += "</font>";
mText += "<a href=\"todo:" + ev->uid() + "\">";
mText += ev->summary();
mText += "</a>";
if ( ((Todo*)ev)->hasDueDate () ) {
QString year = "";
int ye = ((Todo*)ev)->dtDue().date().year();
if ( QDateTime::currentDateTime().date().year() != ye )
year = QString::number( ye );
QString dfs = KGlobal::locale()->dateFormatShort();
- KGlobal::locale()->setIntDateFormat( 3 );
KGlobal::locale()->setDateFormatShort("%d.%b");
- mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true) + "."+ year +"]</font>";
-
+ mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
KGlobal::locale()->setDateFormatShort(dfs);
- KGlobal::locale()->setIntDateFormat( KOPrefs::instance()->mPreferredDate );
}
if ( KOPrefs::instance()->mWNViewShowLocation )
if ( !ev->location().isEmpty() )
mText += " ("+ev->location() +")";
if ( !isSub ) {
if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents)
mText += " ["+ev->relatedTo()->summary() +"]";
mText += "</p>\n";
}
else {
ind += "-";
mText += "</li>\n";
}
QPtrList<Incidence> Relations = ev->relations();
Incidence *to;
for (to=Relations.first();to;to=Relations.next()) {
if (!((Todo*)to)->isCompleted())
appendTodo( to, ind , true );
}
return true;
}
/*
void KOWhatsNextView::createEventViewer()
{
if (!mEventViewer) {
mEventViewer = new KOEventViewerDialog(this);
}
}
*/
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp
index d77e251..9d7e60b 100644
--- a/microkde/kdecore/klocale.cpp
+++ b/microkde/kdecore/klocale.cpp
@@ -57,123 +57,123 @@ inline void put_it_in( QChar *buffer, uint& index, const QString &s )
inline void put_it_in( QChar *buffer, uint& index, int number )
{
buffer[index++] = number / 10 + '0';
buffer[index++] = number % 10 + '0';
}
static int readInt(const QString &str, uint &pos)
{
if (!str.at(pos).isDigit()) return -1;
int result = 0;
for (; str.length() > pos && str.at(pos).isDigit(); pos++)
{
result *= 10;
result += str.at(pos).digitValue();
}
return result;
}
KLocale::KLocale() : mCalendarSystem( 0 )
{
m_decimalSymbol = ".";
m_positiveSign = "";
m_negativeSign = "-";
m_thousandsSeparator = ",";
mWeekStartsMonday = true;
mHourF24Format = true;
- mIntDateFormat = 0;
+ mIntDateFormat = Default;
mLanguage = 0;
mDateFormat = "%a %Y %b %d";
mDateFormatShort = "%Y-%m-%d";
mTimeZoneList << i18n ("-11:00 US/Samoa")
<< i18n ("-10:00 US/Hawaii")
<< i18n ("-09:00 US/Alaska")
<< i18n ("-08:00 US/Pacific")
<< i18n ("-07:00 US/Mountain")
<< i18n ("-06:00 US/Central")
<< i18n ("-05:00 US/Eastern")
<< i18n ("-04:00 Brazil/West")
<< i18n ("-03:00 Brazil/East")
<< i18n ("-02:00 Brazil/DeNoronha")
<< i18n ("-01:00 Atlantic/Azores")
<< i18n (" 00:00 Europe/London(UTC)")
<< i18n ("+01:00 Europe/Oslo(CET)")
<< i18n ("+02:00 Europe/Helsinki")
<< i18n ("+03:00 Europe/Moscow")
<< i18n ("+04:00 Indian/Mauritius")
<< i18n ("+05:00 Indian/Maldives")
<< i18n ("+06:00 Indian/Chagos")
<< i18n ("+07:00 Asia/Bangkok")
<< i18n ("+08:00 Asia/Hongkong")
<< i18n ("+09:00 Asia/Tokyo")
<< i18n ("+10:00 Asia/Vladivostok")
<< i18n ("+11:00 Asia/Magadan")
<< i18n ("+12:00 Asia/Kamchatka")
// << i18n (" xx:xx User defined offset")
<< i18n (" Local Time");
mSouthDaylight = false;
mTimeZoneOffset = 0;
daylightEnabled = false;
}
void KLocale::setDateFormat( QString s )
{
mDateFormat = s;
}
void KLocale::setDateFormatShort( QString s )
{
mDateFormatShort = s;
}
void KLocale::setHore24Format ( bool b )
{
mHourF24Format = b;
}
void KLocale::setWeekStartMonday( bool b )
{
mWeekStartsMonday = b;
}
-int KLocale::getIntDateFormat( )
+KLocale::IntDateFormat KLocale::getIntDateFormat( )
{
return mIntDateFormat ;
}
-void KLocale::setIntDateFormat( int i )
+void KLocale::setIntDateFormat( KLocale::IntDateFormat i )
{
mIntDateFormat = i;
}
void KLocale::setLanguage( int i )
{
mLanguage = i;
}
QString KLocale::translate( const char *index ) const
{
return i18n( index );
}
QString KLocale::translate( const char *, const char *fallback) const
{
return i18n( fallback );
}
QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const
{
const QString rst = timeFormat();
// only "pm/am" here can grow, the rest shrinks, but
// I'm rather safe than sorry
QChar *buffer = new QChar[rst.length() * 3 / 2 + 30];
uint index = 0;
bool escape = false;
int number = 0;
for ( uint format_index = 0; format_index < rst.length(); format_index++ )
{
if ( !escape )
@@ -212,67 +212,67 @@ QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const
break;
case 'k':
number = pTime.hour();
case 'l':
// to share the code
if ( rst.at( format_index ).unicode() == 'l' )
number = (pTime.hour() + 11) % 12 + 1;
if ( number / 10 )
buffer[index++] = number / 10 + '0';
buffer[index++] = number % 10 + '0';
break;
case 'p':
{
QString s;
if ( pTime.hour() >= 12 )
put_it_in( buffer, index, i18n("pm") );
else
put_it_in( buffer, index, i18n("am") );
break;
}
default:
buffer[index++] = rst.at( format_index );
break;
}
escape = false;
}
}
QString ret( buffer, index );
delete [] buffer;
return ret;
}
-QString KLocale::formatDate(const QDate &pDate, bool shortFormat) const
+QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat intIntDateFormat) const
{
- const QString rst = shortFormat?dateFormatShort():dateFormat();
+ const QString rst = shortFormat?dateFormatShort(intIntDateFormat):dateFormat(intIntDateFormat);
// I'm rather safe than sorry
QChar *buffer = new QChar[rst.length() * 3 / 2 + 50];
unsigned int index = 0;
bool escape = false;
int number = 0;
for ( uint format_index = 0; format_index < rst.length(); ++format_index )
{
if ( !escape )
{
if ( rst.at( format_index ).unicode() == '%' )
escape = true;
else
buffer[index++] = rst.at( format_index );
}
else
{
switch ( rst.at( format_index ).unicode() )
{
case '%':
buffer[index++] = '%';
break;
case 'Y':
put_it_in( buffer, index, pDate.year() / 100 );
case 'y':
put_it_in( buffer, index, pDate.year() % 100 );
break;
case 'n':
number = pDate.month();
case 'e':
@@ -615,93 +615,96 @@ QString KLocale::monthName(int i,bool shortName) const
case 7: return i18n("July", "Jul");
case 8: return i18n("August", "Aug");
case 9: return i18n("September", "Sep");
case 10: return i18n("October", "Oct");
case 11: return i18n("November", "Nov");
case 12: return i18n("December", "Dec");
}
else
switch (i)
{
case 1: return i18n("January");
case 2: return i18n("February");
case 3: return i18n("March");
case 4: return i18n("April");
case 5: return i18n("May long", "May");
case 6: return i18n("June");
case 7: return i18n("July");
case 8: return i18n("August");
case 9: return i18n("September");
case 10: return i18n("October");
case 11: return i18n("November");
case 12: return i18n("December");
}
return QString::null;
}
QString KLocale::country() const
{
return QString::null;
}
-QString KLocale::dateFormat() const
+QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const
{
+ const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat;
+
if ( QApplication::desktop()->width() < 480 ) {
- if ( mIntDateFormat == 0 )
+ if ( dformat == Default )
return "%a %d %b %Y";
- else if ( mIntDateFormat == 1 )
+ else if ( dformat == Format1 )
return "%a %b %d %Y";
- else if ( mIntDateFormat == 2 )
+ else if ( dformat == ISODate )
return "%a %Y %b %d";
} else {
- if ( mIntDateFormat == 0 )
+ if ( dformat == Default )
return "%A %d %B %Y";
- else if ( mIntDateFormat == 1 )
+ else if ( dformat == Format1 )
return "%A %B %d %Y";
- else if ( mIntDateFormat == 2 )
+ else if ( dformat == ISODate )
return "%A %Y %B %d";
}
return mDateFormat ;
}
-QString KLocale::dateFormatShort() const
+QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const
{
+ const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat;
- if ( mIntDateFormat == 0 )
+ if ( dformat == Default )
return "%d.%m.%Y";
- else if ( mIntDateFormat == 1 )
+ else if ( dformat == Format1 )
return "%m.%d.%Y";
- else if ( mIntDateFormat == 2 )
+ else if ( dformat == ISODate ) // = Qt::ISODate
return "%Y-%m-%d";
return mDateFormatShort ;
}
QString KLocale::timeFormat() const
{
if ( mHourF24Format)
return "%H:%M:%S";
return "%I:%M:%S%p";
}
void KLocale::insertCatalogue ( const QString & )
{
}
KCalendarSystem *KLocale::calendar()
{
if ( !mCalendarSystem ) {
mCalendarSystem = new KCalendarSystemGregorian;
}
return mCalendarSystem;
}
int KLocale::timezoneOffset( QString timeZone )
{
int ret = 1001;
int index = mTimeZoneList.findIndex( timeZone );
if ( index < 24 )
ret = ( index-11 ) * 60 ;
diff --git a/microkde/kdecore/klocale.h b/microkde/kdecore/klocale.h
index 7470cd2..f6c0253 100644
--- a/microkde/kdecore/klocale.h
+++ b/microkde/kdecore/klocale.h
@@ -12,99 +12,101 @@
class KCalendarSystem;
void setLocaleDict( QDict<QString> * dict );
QString i18n(const char *text);
QString i18n(const char *hint, const char *text);
QString i18n(const char *text1, const char *textn, int num);
// Qt3's uic generates i18n( "msg", "comment" ) calls which conflict
// with our i18n method. we use uic -tr tr2i18n to redirect
// to the right i18n() function
inline QString tr2i18n(const char* message, const char* =0) {
return i18n( message);
}
class KLocale
{
public:
KLocale();
QString formatNumber(double num, int precision = -1) const;
QString formatNumber(const QString &numStr) const;
double readNumber(const QString &numStr, bool * ok = 0) const;
QString decimalSymbol() const;
QString thousandsSeparator() const;
QString positiveSign() const;
QString negativeSign() const;
QString translate( const char *index ) const;
QString translate( const char *index, const char *fallback) const;
- QString formatDate(const QDate &pDate, bool shortFormat = false) const;
+ enum IntDateFormat { Undefined=-1, Default=0, Format1=1, ISODate=2, Userdefined=3 };
+
+ QString formatDate(const QDate &pDate, bool shortFormat = false, IntDateFormat intIntDateFormat = Undefined) const;
QString formatTime(const QTime &pTime, bool includeSecs = false) const;
QString formatDateTime(const QDateTime &pDateTime) const;
QString formatDateTime(const QDateTime &pDateTime,
bool shortFormat,
bool includeSecs = false) const;
QDate readDate(const QString &str, bool* ok = 0) const;
QDate readDate( const QString &intstr, const QString &fmt, bool* ok = 0) const;
QTime readTime(const QString &str, bool* ok = 0) const;
bool use12Clock() const;
bool weekStartsMonday() const;
int weekStartDay() const;
QString weekDayName(int,bool=false) const;
QString monthName(int,bool=false) const;
QString country() const;
- QString dateFormat() const;
- QString dateFormatShort() const;
+ QString dateFormat(IntDateFormat intIntDateFormat = Undefined) const;
+ QString dateFormatShort(IntDateFormat intIntDateFormat = Undefined) const;
QString timeFormat() const;
void insertCatalogue ( const QString & );
KCalendarSystem *calendar();
void setHore24Format ( bool );
void setWeekStartMonday( bool );
- void setIntDateFormat( int );
- int getIntDateFormat( );
+ void setIntDateFormat( IntDateFormat );
+ IntDateFormat getIntDateFormat( );
void setLanguage( int );
void setDateFormat( QString );
void setDateFormatShort( QString );
QString m_decimalSymbol;
QString m_thousandsSeparator;
QString m_currencySymbol;
QString m_monetaryDecimalSymbol;
QString m_monetaryThousandsSeparator;
QString m_positiveSign;
QString m_negativeSign;
int timezoneOffset( QString );
QStringList timeZoneList() const;
void setDaylightSaving( bool, int , int );
int localTimeOffset(const QDateTime &);
void setTimezone( const QString &timeZone );
private:
QTime readTime(const QString &str, bool seconds, bool *ok) const;
QDate readDate(const QString &str, bool shortFormat, bool *ok) const;
KCalendarSystem *mCalendarSystem;
bool mWeekStartsMonday;
bool mHourF24Format;
- int mIntDateFormat;
+ IntDateFormat mIntDateFormat;
int mLanguage;
QString mDateFormat;
QString mDateFormatShort;
QStringList mTimeZoneList;
bool daylightEnabled;
int mDaylightTZoffset;
int mNondaylightTZoffset;
bool mSouthDaylight;
int daylightStart, daylightEnd, mTimeZoneOffset;
};
#endif