summaryrefslogtreecommitdiffabout
Side-by-side diff
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
@@ -59,5 +59,4 @@ AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
AddresseeEditorDialog::~AddresseeEditorDialog()
{
- qDebug("AddresseeEditorDialog::~AddresseeEditorDialog()");
//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
@@ -1066,9 +1066,5 @@ void AddresseeEditorWidget::save()
//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);
}
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index c3c3d47..58b3d70 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1777,5 +1777,5 @@ 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;
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 0547a2e..b2001ec 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -451,10 +451,7 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
// 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() )
@@ -568,10 +565,7 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
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 )
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
@@ -87,5 +87,5 @@ KLocale::KLocale() : mCalendarSystem( 0 )
mWeekStartsMonday = true;
mHourF24Format = true;
- mIntDateFormat = 0;
+ mIntDateFormat = Default;
mLanguage = 0;
mDateFormat = "%a %Y %b %d";
@@ -140,10 +140,10 @@ void KLocale::setWeekStartMonday( bool b )
mWeekStartsMonday = b;
}
-int KLocale::getIntDateFormat( )
+KLocale::IntDateFormat KLocale::getIntDateFormat( )
{
- return mIntDateFormat ;
+ return mIntDateFormat;
}
-void KLocale::setIntDateFormat( int i )
+void KLocale::setIntDateFormat( KLocale::IntDateFormat i )
{
mIntDateFormat = i;
@@ -242,7 +242,7 @@ QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const
}
-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
@@ -645,20 +645,22 @@ QString KLocale::country() const
}
-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";
}
@@ -666,12 +668,13 @@ QString KLocale::dateFormat() const
}
-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 ;
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
@@ -42,5 +42,7 @@ class KLocale
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;
@@ -62,6 +64,6 @@ class KLocale
QString country() const;
- QString dateFormat() const;
- QString dateFormatShort() const;
+ QString dateFormat(IntDateFormat intIntDateFormat = Undefined) const;
+ QString dateFormatShort(IntDateFormat intIntDateFormat = Undefined) const;
QString timeFormat() const;
@@ -71,6 +73,6 @@ class KLocale
void setHore24Format ( bool );
void setWeekStartMonday( bool );
- void setIntDateFormat( int );
- int getIntDateFormat( );
+ void setIntDateFormat( IntDateFormat );
+ IntDateFormat getIntDateFormat( );
void setLanguage( int );
void setDateFormat( QString );
@@ -96,5 +98,5 @@ class KLocale
bool mWeekStartsMonday;
bool mHourF24Format;
- int mIntDateFormat;
+ IntDateFormat mIntDateFormat;
int mLanguage;
QString mDateFormat;