summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2004-02-18 23:25:18 (UTC)
committer zecke <zecke>2004-02-18 23:25:18 (UTC)
commitab41e301eb7f06af0869844d197e38a7838f3f2d (patch) (side-by-side diff)
tree65fb4cf5e4af1cb2c8d85ec46bc53096a97d110a /library
parent28b63b3270b8162fcea4449b53b75fa325d740ad (diff)
downloadopie-ab41e301eb7f06af0869844d197e38a7838f3f2d.zip
opie-ab41e301eb7f06af0869844d197e38a7838f3f2d.tar.gz
opie-ab41e301eb7f06af0869844d197e38a7838f3f2d.tar.bz2
Gross hack to allow compilation with Qt3 more easily
Qt got a DateFormat as well so we use a define to call our QPEDateFormat
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/timestring.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/library/timestring.h b/library/timestring.h
index f8cb3e6..0335715 100644
--- a/library/timestring.h
+++ b/library/timestring.h
@@ -14,29 +14,33 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef _TIMESTRING_H_
#define _TIMESTRING_H_
#include <qdatetime.h>
#include <qstring.h>
+#if (QT_VERSION-0 >= 0x030000)
+#define DateFormat QPEDateFormat
+#endif
+
// return a string with the time based on whether or not you want
// you want it in 12 hour form. if ampm is true, then return
// it in 12 hour (am/pm) form otherwise return it in 24 hour form
// in theory Qt 3,0 handles this better (hopefully obsoleteing this)
-class DateFormat
+class DateFormat
{
public:
// date format type 001,010,100 = day month year
enum Order {
DayMonthYear = 0x0111, // 0x001 + 0x010(0x2 << 3) + 0x100(0x4 << 3)
MonthDayYear = 0x010A,
YearMonthDay = 0x0054
};
DateFormat(QChar s = '/', Order so = MonthDayYear) : _shortOrder(so),
_longOrder(so), _shortSeparator(s) { }
DateFormat(QChar s, Order so, Order lo) : _shortOrder(so),
@@ -86,29 +90,29 @@ private:
QChar _shortSeparator;
};
#ifndef QT_NO_DATASTREAM
QDataStream &operator<<(QDataStream &s, const DateFormat&df);
QDataStream &operator>>(QDataStream &s, DateFormat&df);
#endif
class TimeString
{
public:
- //enum DateFormat { MonthDayYear, DayMonthYear, ISO8601,
+ //enum DateFormat { MonthDayYear, DayMonthYear, ISO8601,
//YearMonthDay = ISO8601 };
- static QString shortDate( const QDate &d )
+ static QString shortDate( const QDate &d )
{ return shortDate( d, currentDateFormat() ); }
static QString dateString( const QDate &d )
{ return dateString( d, currentDateFormat() ); }
static QString longDateString( const QDate &d )
{ return longDateString( d, currentDateFormat() ); }
static QString dateString( const QDateTime &dt, bool ampm, bool seconds )
{ return dateString( dt, ampm, seconds, currentDateFormat() ); }
static QString dateString( const QDateTime &t, bool ampm = false );
static QString timeString( const QTime &t, bool ampm, bool seconds );
static QString timeString( const QTime &t, bool ampm = false );
static QString shortTime( bool ampm, bool seconds );
@@ -120,17 +124,17 @@ public:
static QString longNumberDateString( const QDate &d, DateFormat );
static QString longNumberDateString( const QDate &d )
{ return longNumberDateString( d, currentDateFormat() ); }
static QString shortDate( const QDate &, DateFormat );
static QString dateString( const QDate &, DateFormat );
static QString longDateString( const QDate &, DateFormat );
static DateFormat currentDateFormat();
private:
static QString dateString( const QDateTime &t, bool ampm, bool seconds, DateFormat );
-
+
};
#endif