summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore 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.cpp39
-rw-r--r--microkde/kdecore/klocale.h14
6 files changed, 33 insertions, 39 deletions
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp
index d8c1aca..5e42640 100644
--- a/kaddressbook/addresseeeditordialog.cpp
+++ b/kaddressbook/addresseeeditordialog.cpp
@@ -45,33 +45,32 @@ AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
45 45
46 QVBoxLayout *layout = new QVBoxLayout( page ); 46 QVBoxLayout *layout = new QVBoxLayout( page );
47 47
48 mEditorWidget = new AddresseeEditorWidget( core, false, page ); 48 mEditorWidget = new AddresseeEditorWidget( core, false, page );
49 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ), 49 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ),
50 SLOT( widgetModified() ) ); 50 SLOT( widgetModified() ) );
51 layout->addWidget( mEditorWidget ); 51 layout->addWidget( mEditorWidget );
52 52
53 enableButton( KDialogBase::Apply, false ); 53 enableButton( KDialogBase::Apply, false );
54 if ( QApplication::desktop()->width() < 480 ) { 54 if ( QApplication::desktop()->width() < 480 ) {
55 hideButtons(); 55 hideButtons();
56 } 56 }
57} 57}
58 58
59AddresseeEditorDialog::~AddresseeEditorDialog() 59AddresseeEditorDialog::~AddresseeEditorDialog()
60{ 60{
61 qDebug("AddresseeEditorDialog::~AddresseeEditorDialog()");
62 //emit editorDestroyed( mEditorWidget->addressee().uid() ); 61 //emit editorDestroyed( mEditorWidget->addressee().uid() );
63} 62}
64 63
65void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) 64void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr )
66{ 65{
67 enableButton( KDialogBase::Apply, false ); 66 enableButton( KDialogBase::Apply, false );
68 67
69 mEditorWidget->setAddressee( addr ); 68 mEditorWidget->setAddressee( addr );
70} 69}
71 70
72KABC::Addressee AddresseeEditorDialog::addressee() 71KABC::Addressee AddresseeEditorDialog::addressee()
73{ 72{
74 return mEditorWidget->addressee(); 73 return mEditorWidget->addressee();
75} 74}
76 75
77bool AddresseeEditorDialog::dirty() 76bool AddresseeEditorDialog::dirty()
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 4365ee5..3cfc1f2 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1052,37 +1052,33 @@ void AddresseeEditorWidget::save()
1052//US qDebug("AddresseeEditorWidget::save sound not supported"); 1052//US qDebug("AddresseeEditorWidget::save sound not supported");
1053#endif //KAB_EMBEDDED 1053#endif //KAB_EMBEDDED
1054 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1054 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1055 1055
1056 // save custom fields 1056 // save custom fields
1057 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); 1057 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
1058 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); 1058 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
1059 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); 1059 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
1060 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); 1060 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
1061 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); 1061 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
1062 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1062 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1063 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1063 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1064 if ( mAnniversaryPicker->inputIsValid() ) { 1064 if ( mAnniversaryPicker->inputIsValid() ) {
1065 1065
1066//US mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", 1066//US mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary",
1067//US mAnniversaryPicker->date().toString( Qt::ISODate ) ); 1067//US mAnniversaryPicker->date().toString( Qt::ISODate ) );
1068 int orgformat = KGlobal::locale()->getIntDateFormat(); 1068 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1069 QDate da = mAnniversaryPicker->date();
1070 KGlobal::locale()->setIntDateFormat( 2 ); // = Qt::ISODate
1071 QString dt = KGlobal::locale()->formatDate(da, true);
1072 KGlobal::locale()->setIntDateFormat(orgformat );
1073 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1069 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1074 } 1070 }
1075 else 1071 else
1076 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1072 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1077 1073
1078 // Save the email addresses 1074 // Save the email addresses
1079 QStringList emails = mAddressee.emails(); 1075 QStringList emails = mAddressee.emails();
1080 QStringList::Iterator iter; 1076 QStringList::Iterator iter;
1081 for ( iter = emails.begin(); iter != emails.end(); ++iter ) 1077 for ( iter = emails.begin(); iter != emails.end(); ++iter )
1082 mAddressee.removeEmail( *iter ); 1078 mAddressee.removeEmail( *iter );
1083 1079
1084 emails = mEmailWidget->emails(); 1080 emails = mEmailWidget->emails();
1085 bool first = true; 1081 bool first = true;
1086 for ( iter = emails.begin(); iter != emails.end(); ++iter ) { 1082 for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
1087 mAddressee.insertEmail( *iter, first ); 1083 mAddressee.insertEmail( *iter, first );
1088 first = false; 1084 first = false;
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index c3c3d47..58b3d70 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1763,33 +1763,33 @@ void CalendarView::goPrevious()
1763{ 1763{
1764 mNavigator->selectPrevious(); 1764 mNavigator->selectPrevious();
1765} 1765}
1766void CalendarView::goNextMonth() 1766void CalendarView::goNextMonth()
1767{ 1767{
1768 mNavigator->selectNextMonth(); 1768 mNavigator->selectNextMonth();
1769} 1769}
1770 1770
1771void CalendarView::goPreviousMonth() 1771void CalendarView::goPreviousMonth()
1772{ 1772{
1773 mNavigator->selectPreviousMonth(); 1773 mNavigator->selectPreviousMonth();
1774} 1774}
1775void CalendarView::writeLocale() 1775void CalendarView::writeLocale()
1776{ 1776{
1777 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 1777 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
1778 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 1778 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
1779 KGlobal::locale()->setIntDateFormat( KOPrefs::instance()->mPreferredDate ); 1779 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
1780 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 1780 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
1781 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1781 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1782 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 1782 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
1783 dummy = KOPrefs::instance()->mUserDateFormatShort; 1783 dummy = KOPrefs::instance()->mUserDateFormatShort;
1784 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 1784 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
1785 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 1785 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
1786 KOPrefs::instance()->mDaylightsavingStart, 1786 KOPrefs::instance()->mDaylightsavingStart,
1787 KOPrefs::instance()->mDaylightsavingEnd ); 1787 KOPrefs::instance()->mDaylightsavingEnd );
1788 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); 1788 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId );
1789} 1789}
1790void CalendarView::updateConfig() 1790void CalendarView::updateConfig()
1791{ 1791{
1792 writeLocale(); 1792 writeLocale();
1793 if ( KOPrefs::instance()->mUseAppColors ) 1793 if ( KOPrefs::instance()->mUseAppColors )
1794 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 1794 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
1795 emit configChanged(); 1795 emit configChanged();
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 0547a2e..b2001ec 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -437,38 +437,35 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
437 else if ( st < cdt ) 437 else if ( st < cdt )
438 mText += "<font color=\"#008000\">" + dateText + "</font>"; 438 mText += "<font color=\"#008000\">" + dateText + "</font>";
439 else 439 else
440 mText += dateText; 440 mText += dateText;
441 } 441 }
442 442
443 } else { 443 } else {
444 mText += i18n("Allday:"); 444 mText += i18n("Allday:");
445 445
446 } 446 }
447 } else { 447 } else {
448 mTodos.append( ev ); 448 mTodos.append( ev );
449 mText += i18n("ToDo:"); 449 mText += i18n("ToDo:");
450 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { 450 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
451 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 451 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
452 QString dfs = KGlobal::locale()->dateFormatShort(); 452 QString dfs = KGlobal::locale()->dateFormatShort();
453 KGlobal::locale()->setIntDateFormat( 3 );
454 KGlobal::locale()->setDateFormatShort("%d.%b"); 453 KGlobal::locale()->setDateFormatShort("%d.%b");
455 mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true) + "</font>"; 454 mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
456
457 KGlobal::locale()->setDateFormatShort(dfs); 455 KGlobal::locale()->setDateFormatShort(dfs);
458 KGlobal::locale()->setIntDateFormat( KOPrefs::instance()->mPreferredDate );
459 } else { 456 } else {
460 if (!ev->doesFloat() ) 457 if (!ev->doesFloat() )
461 if( ( (Todo*)ev)->dtDue() < cdt ) { 458 if( ( (Todo*)ev)->dtDue() < cdt ) {
462 mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; 459 mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
463 460
464 461
465 } else 462 } else
466 mText +=((Todo*)ev)->dtDueTimeStr(); 463 mText +=((Todo*)ev)->dtDueTimeStr();
467 mTodos.append( ev ); 464 mTodos.append( ev );
468 } 465 }
469 } 466 }
470 mText += "</b></td><td>"; 467 mText += "</b></td><td>";
471 bool needClose = false; 468 bool needClose = false;
472 if ( ev->cancelled() ) { 469 if ( ev->cancelled() ) {
473 mText += "<font color=\"#F00000\">[c"; 470 mText += "<font color=\"#F00000\">[c";
474 needClose =true; 471 needClose =true;
@@ -554,38 +551,35 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
554 // mText += "r"; 551 // mText += "r";
555 // needClose =true; 552 // needClose =true;
556 // } 553 // }
557 if ( needClose ) 554 if ( needClose )
558 mText += "] "; 555 mText += "] ";
559 if ( ev->cancelled() ) 556 if ( ev->cancelled() )
560 mText += "</font>"; 557 mText += "</font>";
561 mText += "<a href=\"todo:" + ev->uid() + "\">"; 558 mText += "<a href=\"todo:" + ev->uid() + "\">";
562 mText += ev->summary(); 559 mText += ev->summary();
563 mText += "</a>"; 560 mText += "</a>";
564 if ( ((Todo*)ev)->hasDueDate () ) { 561 if ( ((Todo*)ev)->hasDueDate () ) {
565 QString year = ""; 562 QString year = "";
566 int ye = ((Todo*)ev)->dtDue().date().year(); 563 int ye = ((Todo*)ev)->dtDue().date().year();
567 if ( QDateTime::currentDateTime().date().year() != ye ) 564 if ( QDateTime::currentDateTime().date().year() != ye )
568 year = QString::number( ye ); 565 year = QString::number( ye );
569 QString dfs = KGlobal::locale()->dateFormatShort(); 566 QString dfs = KGlobal::locale()->dateFormatShort();
570 KGlobal::locale()->setIntDateFormat( 3 );
571 KGlobal::locale()->setDateFormatShort("%d.%b"); 567 KGlobal::locale()->setDateFormatShort("%d.%b");
572 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true) + "."+ year +"]</font>"; 568 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
573
574 KGlobal::locale()->setDateFormatShort(dfs); 569 KGlobal::locale()->setDateFormatShort(dfs);
575 KGlobal::locale()->setIntDateFormat( KOPrefs::instance()->mPreferredDate );
576 } 570 }
577 if ( KOPrefs::instance()->mWNViewShowLocation ) 571 if ( KOPrefs::instance()->mWNViewShowLocation )
578 if ( !ev->location().isEmpty() ) 572 if ( !ev->location().isEmpty() )
579 mText += " ("+ev->location() +")"; 573 mText += " ("+ev->location() +")";
580 if ( !isSub ) { 574 if ( !isSub ) {
581 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) 575 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents)
582 mText += " ["+ev->relatedTo()->summary() +"]"; 576 mText += " ["+ev->relatedTo()->summary() +"]";
583 mText += "</p>\n"; 577 mText += "</p>\n";
584 } 578 }
585 else { 579 else {
586 ind += "-"; 580 ind += "-";
587 mText += "</li>\n"; 581 mText += "</li>\n";
588 } 582 }
589 QPtrList<Incidence> Relations = ev->relations(); 583 QPtrList<Incidence> Relations = ev->relations();
590 Incidence *to; 584 Incidence *to;
591 for (to=Relations.first();to;to=Relations.next()) { 585 for (to=Relations.first();to;to=Relations.next()) {
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
@@ -73,33 +73,33 @@ static int readInt(const QString &str, uint &pos)
73 return result; 73 return result;
74} 74}
75 75
76KLocale::KLocale() : mCalendarSystem( 0 ) 76KLocale::KLocale() : mCalendarSystem( 0 )
77{ 77{
78 78
79 m_decimalSymbol = "."; 79 m_decimalSymbol = ".";
80 m_positiveSign = ""; 80 m_positiveSign = "";
81 m_negativeSign = "-"; 81 m_negativeSign = "-";
82 m_thousandsSeparator = ","; 82 m_thousandsSeparator = ",";
83 83
84 84
85 85
86 86
87 mWeekStartsMonday = true; 87 mWeekStartsMonday = true;
88 mHourF24Format = true; 88 mHourF24Format = true;
89 mIntDateFormat = 0; 89 mIntDateFormat = Default;
90 mLanguage = 0; 90 mLanguage = 0;
91 mDateFormat = "%a %Y %b %d"; 91 mDateFormat = "%a %Y %b %d";
92 mDateFormatShort = "%Y-%m-%d"; 92 mDateFormatShort = "%Y-%m-%d";
93 mTimeZoneList << i18n ("-11:00 US/Samoa") 93 mTimeZoneList << i18n ("-11:00 US/Samoa")
94 << i18n ("-10:00 US/Hawaii") 94 << i18n ("-10:00 US/Hawaii")
95 << i18n ("-09:00 US/Alaska") 95 << i18n ("-09:00 US/Alaska")
96 << i18n ("-08:00 US/Pacific") 96 << i18n ("-08:00 US/Pacific")
97 << i18n ("-07:00 US/Mountain") 97 << i18n ("-07:00 US/Mountain")
98 << i18n ("-06:00 US/Central") 98 << i18n ("-06:00 US/Central")
99 << i18n ("-05:00 US/Eastern") 99 << i18n ("-05:00 US/Eastern")
100 << i18n ("-04:00 Brazil/West") 100 << i18n ("-04:00 Brazil/West")
101 << i18n ("-03:00 Brazil/East") 101 << i18n ("-03:00 Brazil/East")
102 << i18n ("-02:00 Brazil/DeNoronha") 102 << i18n ("-02:00 Brazil/DeNoronha")
103 << i18n ("-01:00 Atlantic/Azores") 103 << i18n ("-01:00 Atlantic/Azores")
104 << i18n (" 00:00 Europe/London(UTC)") 104 << i18n (" 00:00 Europe/London(UTC)")
105 << i18n ("+01:00 Europe/Oslo(CET)") 105 << i18n ("+01:00 Europe/Oslo(CET)")
@@ -126,38 +126,38 @@ void KLocale::setDateFormat( QString s )
126 mDateFormat = s; 126 mDateFormat = s;
127} 127}
128 128
129void KLocale::setDateFormatShort( QString s ) 129void KLocale::setDateFormatShort( QString s )
130{ 130{
131 mDateFormatShort = s; 131 mDateFormatShort = s;
132} 132}
133 133
134void KLocale::setHore24Format ( bool b ) 134void KLocale::setHore24Format ( bool b )
135{ 135{
136 mHourF24Format = b; 136 mHourF24Format = b;
137} 137}
138void KLocale::setWeekStartMonday( bool b ) 138void KLocale::setWeekStartMonday( bool b )
139{ 139{
140 mWeekStartsMonday = b; 140 mWeekStartsMonday = b;
141} 141}
142int KLocale::getIntDateFormat( ) 142KLocale::IntDateFormat KLocale::getIntDateFormat( )
143{ 143{
144 return mIntDateFormat ; 144 return mIntDateFormat;
145 145
146} 146}
147void KLocale::setIntDateFormat( int i ) 147void KLocale::setIntDateFormat( KLocale::IntDateFormat i )
148{ 148{
149 mIntDateFormat = i; 149 mIntDateFormat = i;
150} 150}
151void KLocale::setLanguage( int i ) 151void KLocale::setLanguage( int i )
152{ 152{
153 mLanguage = i; 153 mLanguage = i;
154} 154}
155QString KLocale::translate( const char *index ) const 155QString KLocale::translate( const char *index ) const
156{ 156{
157 return i18n( index ); 157 return i18n( index );
158} 158}
159 159
160QString KLocale::translate( const char *, const char *fallback) const 160QString KLocale::translate( const char *, const char *fallback) const
161{ 161{
162 return i18n( fallback ); 162 return i18n( fallback );
163} 163}
@@ -228,35 +228,35 @@ QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const
228 else 228 else
229 put_it_in( buffer, index, i18n("am") ); 229 put_it_in( buffer, index, i18n("am") );
230 break; 230 break;
231 } 231 }
232 default: 232 default:
233 buffer[index++] = rst.at( format_index ); 233 buffer[index++] = rst.at( format_index );
234 break; 234 break;
235 } 235 }
236 escape = false; 236 escape = false;
237 } 237 }
238 } 238 }
239 QString ret( buffer, index ); 239 QString ret( buffer, index );
240 delete [] buffer; 240 delete [] buffer;
241 return ret; 241 return ret;
242} 242}
243 243
244QString KLocale::formatDate(const QDate &pDate, bool shortFormat) const 244QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat intIntDateFormat) const
245{ 245{
246 const QString rst = shortFormat?dateFormatShort():dateFormat(); 246 const QString rst = shortFormat?dateFormatShort(intIntDateFormat):dateFormat(intIntDateFormat);
247 247
248 // I'm rather safe than sorry 248 // I'm rather safe than sorry
249 QChar *buffer = new QChar[rst.length() * 3 / 2 + 50]; 249 QChar *buffer = new QChar[rst.length() * 3 / 2 + 50];
250 250
251 unsigned int index = 0; 251 unsigned int index = 0;
252 bool escape = false; 252 bool escape = false;
253 int number = 0; 253 int number = 0;
254 254
255 for ( uint format_index = 0; format_index < rst.length(); ++format_index ) 255 for ( uint format_index = 0; format_index < rst.length(); ++format_index )
256 { 256 {
257 if ( !escape ) 257 if ( !escape )
258 { 258 {
259 if ( rst.at( format_index ).unicode() == '%' ) 259 if ( rst.at( format_index ).unicode() == '%' )
260 escape = true; 260 escape = true;
261 else 261 else
262 buffer[index++] = rst.at( format_index ); 262 buffer[index++] = rst.at( format_index );
@@ -631,61 +631,64 @@ QString KLocale::monthName(int i,bool shortName) const
631 case 7: return i18n("July"); 631 case 7: return i18n("July");
632 case 8: return i18n("August"); 632 case 8: return i18n("August");
633 case 9: return i18n("September"); 633 case 9: return i18n("September");
634 case 10: return i18n("October"); 634 case 10: return i18n("October");
635 case 11: return i18n("November"); 635 case 11: return i18n("November");
636 case 12: return i18n("December"); 636 case 12: return i18n("December");
637 } 637 }
638 638
639 return QString::null; 639 return QString::null;
640} 640}
641 641
642QString KLocale::country() const 642QString KLocale::country() const
643{ 643{
644 return QString::null; 644 return QString::null;
645} 645}
646 646
647QString KLocale::dateFormat() const 647QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const
648{ 648{
649 const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat;
650
649 if ( QApplication::desktop()->width() < 480 ) { 651 if ( QApplication::desktop()->width() < 480 ) {
650 if ( mIntDateFormat == 0 ) 652 if ( dformat == Default )
651 return "%a %d %b %Y"; 653 return "%a %d %b %Y";
652 else if ( mIntDateFormat == 1 ) 654 else if ( dformat == Format1 )
653 return "%a %b %d %Y"; 655 return "%a %b %d %Y";
654 else if ( mIntDateFormat == 2 ) 656 else if ( dformat == ISODate )
655 return "%a %Y %b %d"; 657 return "%a %Y %b %d";
656 } else { 658 } else {
657 659
658 if ( mIntDateFormat == 0 ) 660 if ( dformat == Default )
659 return "%A %d %B %Y"; 661 return "%A %d %B %Y";
660 else if ( mIntDateFormat == 1 ) 662 else if ( dformat == Format1 )
661 return "%A %B %d %Y"; 663 return "%A %B %d %Y";
662 else if ( mIntDateFormat == 2 ) 664 else if ( dformat == ISODate )
663 return "%A %Y %B %d"; 665 return "%A %Y %B %d";
664 } 666 }
665 return mDateFormat ; 667 return mDateFormat ;
666} 668}
667 669
668QString KLocale::dateFormatShort() const 670QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const
669{ 671{
672 const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat;
670 673
671 if ( mIntDateFormat == 0 ) 674 if ( dformat == Default )
672 return "%d.%m.%Y"; 675 return "%d.%m.%Y";
673 else if ( mIntDateFormat == 1 ) 676 else if ( dformat == Format1 )
674 return "%m.%d.%Y"; 677 return "%m.%d.%Y";
675 else if ( mIntDateFormat == 2 ) 678 else if ( dformat == ISODate ) // = Qt::ISODate
676 return "%Y-%m-%d"; 679 return "%Y-%m-%d";
677 return mDateFormatShort ; 680 return mDateFormatShort ;
678 681
679} 682}
680 683
681 684
682QString KLocale::timeFormat() const 685QString KLocale::timeFormat() const
683{ 686{
684 if ( mHourF24Format) 687 if ( mHourF24Format)
685 return "%H:%M:%S"; 688 return "%H:%M:%S";
686 return "%I:%M:%S%p"; 689 return "%I:%M:%S%p";
687} 690}
688 691
689void KLocale::insertCatalogue ( const QString & ) 692void KLocale::insertCatalogue ( const QString & )
690{ 693{
691} 694}
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
@@ -28,83 +28,85 @@ class KLocale
28 public: 28 public:
29 KLocale(); 29 KLocale();
30 30
31 QString formatNumber(double num, int precision = -1) const; 31 QString formatNumber(double num, int precision = -1) const;
32 QString formatNumber(const QString &numStr) const; 32 QString formatNumber(const QString &numStr) const;
33 double readNumber(const QString &numStr, bool * ok = 0) const; 33 double readNumber(const QString &numStr, bool * ok = 0) const;
34 34
35 QString decimalSymbol() const; 35 QString decimalSymbol() const;
36 QString thousandsSeparator() const; 36 QString thousandsSeparator() const;
37 QString positiveSign() const; 37 QString positiveSign() const;
38 QString negativeSign() const; 38 QString negativeSign() const;
39 39
40 40
41 QString translate( const char *index ) const; 41 QString translate( const char *index ) const;
42 QString translate( const char *index, const char *fallback) const; 42 QString translate( const char *index, const char *fallback) const;
43 43
44 QString formatDate(const QDate &pDate, bool shortFormat = false) const; 44 enum IntDateFormat { Undefined=-1, Default=0, Format1=1, ISODate=2, Userdefined=3 };
45
46 QString formatDate(const QDate &pDate, bool shortFormat = false, IntDateFormat intIntDateFormat = Undefined) const;
45 QString formatTime(const QTime &pTime, bool includeSecs = false) const; 47 QString formatTime(const QTime &pTime, bool includeSecs = false) const;
46 QString formatDateTime(const QDateTime &pDateTime) const; 48 QString formatDateTime(const QDateTime &pDateTime) const;
47 QString formatDateTime(const QDateTime &pDateTime, 49 QString formatDateTime(const QDateTime &pDateTime,
48 bool shortFormat, 50 bool shortFormat,
49 bool includeSecs = false) const; 51 bool includeSecs = false) const;
50 52
51 QDate readDate(const QString &str, bool* ok = 0) const; 53 QDate readDate(const QString &str, bool* ok = 0) const;
52 QDate readDate( const QString &intstr, const QString &fmt, bool* ok = 0) const; 54 QDate readDate( const QString &intstr, const QString &fmt, bool* ok = 0) const;
53 QTime readTime(const QString &str, bool* ok = 0) const; 55 QTime readTime(const QString &str, bool* ok = 0) const;
54 56
55 bool use12Clock() const; 57 bool use12Clock() const;
56 bool weekStartsMonday() const; 58 bool weekStartsMonday() const;
57 int weekStartDay() const; 59 int weekStartDay() const;
58 60
59 QString weekDayName(int,bool=false) const; 61 QString weekDayName(int,bool=false) const;
60 QString monthName(int,bool=false) const; 62 QString monthName(int,bool=false) const;
61 63
62 QString country() const; 64 QString country() const;
63 65
64 QString dateFormat() const; 66 QString dateFormat(IntDateFormat intIntDateFormat = Undefined) const;
65 QString dateFormatShort() const; 67 QString dateFormatShort(IntDateFormat intIntDateFormat = Undefined) const;
66 QString timeFormat() const; 68 QString timeFormat() const;
67 69
68 void insertCatalogue ( const QString & ); 70 void insertCatalogue ( const QString & );
69 71
70 KCalendarSystem *calendar(); 72 KCalendarSystem *calendar();
71 void setHore24Format ( bool ); 73 void setHore24Format ( bool );
72 void setWeekStartMonday( bool ); 74 void setWeekStartMonday( bool );
73 void setIntDateFormat( int ); 75 void setIntDateFormat( IntDateFormat );
74 int getIntDateFormat( ); 76 IntDateFormat getIntDateFormat( );
75 void setLanguage( int ); 77 void setLanguage( int );
76 void setDateFormat( QString ); 78 void setDateFormat( QString );
77 void setDateFormatShort( QString ); 79 void setDateFormatShort( QString );
78 80
79 QString m_decimalSymbol; 81 QString m_decimalSymbol;
80 QString m_thousandsSeparator; 82 QString m_thousandsSeparator;
81 QString m_currencySymbol; 83 QString m_currencySymbol;
82 QString m_monetaryDecimalSymbol; 84 QString m_monetaryDecimalSymbol;
83 QString m_monetaryThousandsSeparator; 85 QString m_monetaryThousandsSeparator;
84 QString m_positiveSign; 86 QString m_positiveSign;
85 QString m_negativeSign; 87 QString m_negativeSign;
86 88
87 int timezoneOffset( QString ); 89 int timezoneOffset( QString );
88 QStringList timeZoneList() const; 90 QStringList timeZoneList() const;
89 void setDaylightSaving( bool, int , int ); 91 void setDaylightSaving( bool, int , int );
90 int localTimeOffset(const QDateTime &); 92 int localTimeOffset(const QDateTime &);
91 void setTimezone( const QString &timeZone ); 93 void setTimezone( const QString &timeZone );
92 private: 94 private:
93 QTime readTime(const QString &str, bool seconds, bool *ok) const; 95 QTime readTime(const QString &str, bool seconds, bool *ok) const;
94 QDate readDate(const QString &str, bool shortFormat, bool *ok) const; 96 QDate readDate(const QString &str, bool shortFormat, bool *ok) const;
95 KCalendarSystem *mCalendarSystem; 97 KCalendarSystem *mCalendarSystem;
96 bool mWeekStartsMonday; 98 bool mWeekStartsMonday;
97 bool mHourF24Format; 99 bool mHourF24Format;
98 int mIntDateFormat; 100 IntDateFormat mIntDateFormat;
99 int mLanguage; 101 int mLanguage;
100 QString mDateFormat; 102 QString mDateFormat;
101 QString mDateFormatShort; 103 QString mDateFormatShort;
102 QStringList mTimeZoneList; 104 QStringList mTimeZoneList;
103 bool daylightEnabled; 105 bool daylightEnabled;
104 int mDaylightTZoffset; 106 int mDaylightTZoffset;
105 int mNondaylightTZoffset; 107 int mNondaylightTZoffset;
106 bool mSouthDaylight; 108 bool mSouthDaylight;
107 int daylightStart, daylightEnd, mTimeZoneOffset; 109 int daylightStart, daylightEnd, mTimeZoneOffset;
108}; 110};
109 111
110#endif 112#endif