summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-07-09 08:02:25 (UTC)
committer ulf69 <ulf69>2004-07-09 08:02:25 (UTC)
commitd91c533ffc42d7bf48fa1326754894b2c30b6831 (patch) (unidiff)
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) (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
@@ -60,3 +60,2 @@ AddresseeEditorDialog::~AddresseeEditorDialog()
60{ 60{
61 qDebug("AddresseeEditorDialog::~AddresseeEditorDialog()");
62 //emit editorDestroyed( mEditorWidget->addressee().uid() ); 61 //emit editorDestroyed( mEditorWidget->addressee().uid() );
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 4365ee5..3cfc1f2 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1067,7 +1067,3 @@ void AddresseeEditorWidget::save()
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);
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index c3c3d47..58b3d70 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1778,3 +1778,3 @@ void CalendarView::writeLocale()
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 );
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 0547a2e..b2001ec 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -452,8 +452,5 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
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 {
@@ -569,8 +566,5 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
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 }
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
@@ -88,3 +88,3 @@ KLocale::KLocale() : mCalendarSystem( 0 )
88 mHourF24Format = true; 88 mHourF24Format = true;
89 mIntDateFormat = 0; 89 mIntDateFormat = Default;
90 mLanguage = 0; 90 mLanguage = 0;
@@ -141,8 +141,8 @@ void KLocale::setWeekStartMonday( bool 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{
@@ -243,5 +243,5 @@ QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const
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
@@ -646,10 +646,12 @@ QString KLocale::country() const
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";
@@ -657,7 +659,7 @@ QString KLocale::dateFormat() const
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";
@@ -667,10 +669,11 @@ QString KLocale::dateFormat() const
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";
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
@@ -43,3 +43,5 @@ class KLocale
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;
@@ -63,4 +65,4 @@ class KLocale
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;
@@ -72,4 +74,4 @@ class KLocale
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 );
@@ -97,3 +99,3 @@ class KLocale
97 bool mHourF24Format; 99 bool mHourF24Format;
98 int mIntDateFormat; 100 IntDateFormat mIntDateFormat;
99 int mLanguage; 101 int mLanguage;