summaryrefslogtreecommitdiff
path: root/library/timestring.cpp
authoreilers <eilers>2003-08-08 14:45:49 (UTC)
committer eilers <eilers>2003-08-08 14:45:49 (UTC)
commit14d394e6c107b037a09a31a92605034fe50f7813 (patch) (side-by-side diff)
tree800699cf4dc9681c3eb023340634dd6a15fd04c8 /library/timestring.cpp
parentdbc6ea35f5535a1f69deb7ebbafc0f721721dbf2 (diff)
downloadopie-14d394e6c107b037a09a31a92605034fe50f7813.zip
opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.gz
opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.bz2
Merged branches from BRANCH_1_0
Diffstat (limited to 'library/timestring.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/timestring.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/timestring.cpp b/library/timestring.cpp
index 6443b6b..8f60b72 100644
--- a/library/timestring.cpp
+++ b/library/timestring.cpp
@@ -206,104 +206,104 @@ QString DateFormat::wordDate(const QDate &d, int v) const
break;
}
}
return buf;
}
#ifndef QT_NO_DATASTREAM
void DateFormat::save(QDataStream &d) const
{
d << _shortSeparator.unicode();
uint v= _shortOrder;
d << v;
v = _longOrder;
d << v;
}
void DateFormat::load(QDataStream &d)
{
ushort value;
d >> value;
_shortSeparator = QChar(value);
uint v = 0;
d >> v;
_shortOrder = (Order)v;
v = 0;
d >> v;
_longOrder = (Order)v;
}
QDataStream &operator<<(QDataStream &s, const DateFormat&df)
{
df.save(s);
return s;
}
QDataStream &operator>>(QDataStream &s, DateFormat&df)
{
df.load(s);
return s;
}
#endif
QString TimeString::shortDate( const QDate &d, DateFormat dtf )
{
return dtf.wordDate(d);
}
QString TimeString::dateString( const QDate &d, DateFormat dtf )
{
- return dtf.wordDate(d, DateFormat::longNumber | DateFormat::longWord);
+ return QObject::tr( dtf.wordDate(d, DateFormat::longNumber | DateFormat::longWord) );
}
QString TimeString::longDateString( const QDate &d, DateFormat dtf )
{
- return dtf.wordDate(d, DateFormat::showWeekDay | DateFormat::longNumber
- | DateFormat::longWord);
+ return QObject::tr( dtf.wordDate(d, DateFormat::showWeekDay | DateFormat::longNumber
+ | DateFormat::longWord) );
}
DateFormat TimeString::currentDateFormat()
{
return TimeStringFormatKeeper::currentFormat();
}
QString TimeString::dateString( const QDateTime &dt, bool ampm, bool seconds, DateFormat dtf )
{
const QDate& d = dt.date();
const QTime& t = dt.time();
// based on QDateTime::toString()
QString buf = timeString(t,ampm,seconds);
buf += " ";
buf += longDateString( d, dtf );
return buf;
}
QString TimeString::timeString( const QTime &t, bool ampm, bool seconds )
{
if ( !ampm ) {
if ( seconds )
return t.toString();
QString r = QString::number(t.hour());
if ( t.hour() < 10 ) r.prepend( "0" );
r.append( ":" );
if ( t.minute() < 10 ) r.append( "0" );
r.append(QString::number(t.minute()));
return r;
}
// ### else the hard case that should disappear in Qt 3.0
QString argString = seconds ? "%4:%5:%6 %7" : "%4:%5 %7";
int hour = t.hour();
QString strMin = QString::number( t.minute() );
QString strSec = QString::number( t.second() );
if ( hour > 12 )
argString = argString.arg( hour - 12, 2 );
else {
if ( hour == 0 )
argString = argString.arg( 12 );
else
argString = argString.arg( hour, 2 );
}
if ( t.minute() < 10 )
strMin.prepend( "0" );