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
@@ -55,13 +55,12 @@ AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
hideButtons();
}
}
AddresseeEditorDialog::~AddresseeEditorDialog()
{
- qDebug("AddresseeEditorDialog::~AddresseeEditorDialog()");
//emit editorDestroyed( mEditorWidget->addressee().uid() );
}
void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr )
{
enableButton( KDialogBase::Apply, false );
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 4365ee5..3cfc1f2 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1062,17 +1062,13 @@ void AddresseeEditorWidget::save()
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
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index c3c3d47..58b3d70 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1773,13 +1773,13 @@ 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,
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 0547a2e..b2001ec 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -447,18 +447,15 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
} 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>";
@@ -564,18 +561,15 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
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)
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
@@ -83,13 +83,13 @@ KLocale::KLocale() : mCalendarSystem( 0 )
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")
@@ -136,18 +136,18 @@ void KLocale::setHore24Format ( bool b )
mHourF24Format = b;
}
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;
}
void KLocale::setLanguage( int i )
{
mLanguage = i;
@@ -238,15 +238,15 @@ QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const
}
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;
@@ -641,41 +641,44 @@ QString KLocale::monthName(int i,bool shortName) const
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 ;
}
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
@@ -38,13 +38,15 @@ class KLocale
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;
@@ -58,23 +60,23 @@ class KLocale
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;
@@ -92,13 +94,13 @@ class KLocale
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;