summaryrefslogtreecommitdiffabout
path: root/microkde
Unidiff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdecore/klocale.cpp4
-rw-r--r--microkde/kdecore/klocale.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp
index 27acfec..673d845 100644
--- a/microkde/kdecore/klocale.cpp
+++ b/microkde/kdecore/klocale.cpp
@@ -798,51 +798,53 @@ void KLocale::insertCatalogue ( const QString & )
798} 798}
799 799
800KCalendarSystem *KLocale::calendar() 800KCalendarSystem *KLocale::calendar()
801{ 801{
802 if ( !mCalendarSystem ) { 802 if ( !mCalendarSystem ) {
803 mCalendarSystem = new KCalendarSystemGregorian; 803 mCalendarSystem = new KCalendarSystemGregorian;
804 } 804 }
805 805
806 return mCalendarSystem; 806 return mCalendarSystem;
807} 807}
808 808
809int KLocale::timezoneOffset( QString timeZone ) 809int KLocale::timezoneOffset( QString timeZone )
810{ 810{
811 int ret = 1001; 811 int ret = 1001;
812 int index = mTimeZoneList.findIndex( timeZone ); 812 int index = mTimeZoneList.findIndex( timeZone );
813 if ( index < 24 ) 813 if ( index < 24 )
814 ret = ( index-11 ) * 60 ; 814 ret = ( index-11 ) * 60 ;
815 return ret; 815 return ret;
816} 816}
817 817
818QStringList KLocale::timeZoneList() const 818QStringList KLocale::timeZoneList() const
819{ 819{
820 return mTimeZoneList; 820 return mTimeZoneList;
821} 821}
822void KLocale::setTimezone( const QString &timeZone ) 822void KLocale::setTimezone( const QString &timeZone, bool oddTZ )
823{ 823{
824 mTimeZoneOffset = timezoneOffset( timeZone ); 824 mTimeZoneOffset = timezoneOffset( timeZone );
825 if ( oddTZ )
826 mTimeZoneOffset += 30;
825} 827}
826 828
827void KLocale::setDaylightSaving( bool b, int start , int end ) 829void KLocale::setDaylightSaving( bool b, int start , int end )
828{ 830{
829 daylightEnabled = b; 831 daylightEnabled = b;
830 daylightStart = start; 832 daylightStart = start;
831 daylightEnd = end; 833 daylightEnd = end;
832 mSouthDaylight = (end < start); 834 mSouthDaylight = (end < start);
833 // qDebug("klocale daylight %d %d %d ", b, start , end ); 835 // qDebug("klocale daylight %d %d %d ", b, start , end );
834} 836}
835 837
836int KLocale::localTimeOffset( const QDateTime &dt ) 838int KLocale::localTimeOffset( const QDateTime &dt )
837{ 839{
838 bool addDaylight = false; 840 bool addDaylight = false;
839 if ( daylightEnabled ) { 841 if ( daylightEnabled ) {
840 int d_end, d_start; 842 int d_end, d_start;
841 int dayofyear = dt.date().dayOfYear(); 843 int dayofyear = dt.date().dayOfYear();
842 int year = dt.date().year(); 844 int year = dt.date().year();
843 int add = 0; 845 int add = 0;
844 if ( QDate::leapYear(year) ) 846 if ( QDate::leapYear(year) )
845 add = 1; 847 add = 1;
846 QDate date ( year,1,1 ); 848 QDate date ( year,1,1 );
847 if ( daylightEnd > 59 ) 849 if ( daylightEnd > 59 )
848 d_end = daylightEnd +add; 850 d_end = daylightEnd +add;
diff --git a/microkde/kdecore/klocale.h b/microkde/kdecore/klocale.h
index 5783530..be9442c 100644
--- a/microkde/kdecore/klocale.h
+++ b/microkde/kdecore/klocale.h
@@ -74,45 +74,45 @@ class KLocale
74 74
75 KCalendarSystem *calendar(); 75 KCalendarSystem *calendar();
76 void setHore24Format ( bool ); 76 void setHore24Format ( bool );
77 void setWeekStartMonday( bool ); 77 void setWeekStartMonday( bool );
78 void setIntDateFormat( IntDateFormat ); 78 void setIntDateFormat( IntDateFormat );
79 void setIntTimeFormat( IntDateFormat ); 79 void setIntTimeFormat( IntDateFormat );
80 IntDateFormat getIntDateFormat( ); 80 IntDateFormat getIntDateFormat( );
81 IntDateFormat getIntTimeFormat( ); 81 IntDateFormat getIntTimeFormat( );
82 void setLanguage( int ); 82 void setLanguage( int );
83 void setDateFormat( QString ); 83 void setDateFormat( QString );
84 void setDateFormatShort( QString ); 84 void setDateFormatShort( QString );
85 85
86 QString m_decimalSymbol; 86 QString m_decimalSymbol;
87 QString m_thousandsSeparator; 87 QString m_thousandsSeparator;
88 QString m_currencySymbol; 88 QString m_currencySymbol;
89 QString m_monetaryDecimalSymbol; 89 QString m_monetaryDecimalSymbol;
90 QString m_monetaryThousandsSeparator; 90 QString m_monetaryThousandsSeparator;
91 QString m_positiveSign; 91 QString m_positiveSign;
92 QString m_negativeSign; 92 QString m_negativeSign;
93 93
94 int timezoneOffset( QString ); 94 int timezoneOffset( QString );
95 QStringList timeZoneList() const; 95 QStringList timeZoneList() const;
96 void setDaylightSaving( bool, int , int ); 96 void setDaylightSaving( bool, int , int );
97 int localTimeOffset(const QDateTime &); 97 int localTimeOffset(const QDateTime &);
98 void setTimezone( const QString &timeZone ); 98 void setTimezone( const QString &timeZone , bool oddTZ);
99 private: 99 private:
100 QTime readTime(const QString &str, bool seconds, bool *ok) const; 100 QTime readTime(const QString &str, bool seconds, bool *ok) const;
101 QDate readDate(const QString &str, bool shortFormat, bool *ok) const; 101 QDate readDate(const QString &str, bool shortFormat, bool *ok) const;
102 KCalendarSystem *mCalendarSystem; 102 KCalendarSystem *mCalendarSystem;
103 bool mWeekStartsMonday; 103 bool mWeekStartsMonday;
104 bool mHourF24Format; 104 bool mHourF24Format;
105 IntDateFormat mIntDateFormat; 105 IntDateFormat mIntDateFormat;
106 IntDateFormat mIntTimeFormat; 106 IntDateFormat mIntTimeFormat;
107 int mLanguage; 107 int mLanguage;
108 QString mDateFormat; 108 QString mDateFormat;
109 QString mDateFormatShort; 109 QString mDateFormatShort;
110 QStringList mTimeZoneList; 110 QStringList mTimeZoneList;
111 bool daylightEnabled; 111 bool daylightEnabled;
112 int mDaylightTZoffset; 112 int mDaylightTZoffset;
113 int mNondaylightTZoffset; 113 int mNondaylightTZoffset;
114 bool mSouthDaylight; 114 bool mSouthDaylight;
115 int daylightStart, daylightEnd, mTimeZoneOffset; 115 int daylightStart, daylightEnd, mTimeZoneOffset;
116}; 116};
117 117
118#endif 118#endif