[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:45:46 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d455619eec02489d2d96a0cecbd449371127143d
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 20 16:59:12 2001 +0000

    Added and modified a couple more classes in _q* land
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/kwq/KWQDateTime.h b/WebCore/kwq/KWQDateTime.h
index 9ec7036..f185d3f 100644
--- a/WebCore/kwq/KWQDateTime.h
+++ b/WebCore/kwq/KWQDateTime.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qdatetime.h>
+#else
+
 // class QTime =================================================================
 
 class QTime {
@@ -153,4 +159,6 @@ public:
 
 }; // class QDateTime ==========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/kwq/KWQPtrList.h b/WebCore/kwq/KWQPtrList.h
index 5c8ae91..b0a5152 100644
--- a/WebCore/kwq/KWQPtrList.h
+++ b/WebCore/kwq/KWQPtrList.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qlist.h>
+#else
+
 #include <KWQDef.h>
 #include <KWQCollection.h>
 
@@ -136,4 +142,6 @@ private:
 
 }; // class QListIterator ======================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/kwq/KWQSortedList.h b/WebCore/kwq/KWQSortedList.h
index cfb570c..eee362a 100644
--- a/WebCore/kwq/KWQSortedList.h
+++ b/WebCore/kwq/KWQSortedList.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qsortedlist.h>
+#else
+
 #include "qlist.h"
 
 // class QSortedList ===========================================================
@@ -59,4 +65,6 @@ public:
 
 }; // class QSortedList ========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/kwq/KWQStringList.h b/WebCore/kwq/KWQStringList.h
index 35207db..5f339a6 100644
--- a/WebCore/kwq/KWQStringList.h
+++ b/WebCore/kwq/KWQStringList.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qstringlist.h>
+#else
+
 #include "qstring.h"
 #include "qvaluelist.h"
 
@@ -69,4 +75,6 @@ public:
 
 }; // class QStringList ========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/kwq/KWQTextStream.h b/WebCore/kwq/KWQTextStream.h
index e600247..d679c4b 100644
--- a/WebCore/kwq/KWQTextStream.h
+++ b/WebCore/kwq/KWQTextStream.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qtextstream.h>
+#else
+
 #include "qstring.h"
 
 // class QTextStream ===========================================================
@@ -159,4 +165,6 @@ private:
 
 }; // class QTextOStream =======================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/kwq/KWQValueList.h b/WebCore/kwq/KWQValueList.h
index 069f71a..ed60c14 100644
--- a/WebCore/kwq/KWQValueList.h
+++ b/WebCore/kwq/KWQValueList.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qvaluelist.h>
+#else
+
 #include <KWQDef.h>
 
 // class QValueListIterator ====================================================
@@ -158,4 +164,6 @@ public:
 
 }; // class QValueList =========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/kwq/qt/_qdatetime.cpp b/WebCore/kwq/qt/_qdatetime.cpp
new file mode 100644
index 0000000..0423f50
--- /dev/null
+++ b/WebCore/kwq/qt/_qdatetime.cpp
@@ -0,0 +1,1438 @@
+/****************************************************************************
+** $Id$
+**
+** Implementation of date and time classes
+**
+** Created : 940124
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#define gettimeofday	__hide_gettimeofday
+#include "qdatetime.h"
+
+#ifndef QT_NO_DATASTREAM
+#include "qdatastream.h"
+#endif
+
+#include <stdio.h>
+#include <time.h>
+#if defined(_OS_WIN32_)
+#if defined(_CC_BOOL_DEF_)
+#undef	bool
+#include <windows.h>
+#define bool int
+#else
+#include <windows.h>
+#endif
+#elif defined(_OS_MSDOS_)
+#include <dos.h>
+#elif defined(_OS_OS2_)
+#include <os2.h>
+#elif defined(_OS_UNIX_)
+#include <unistd.h>
+#include <sys/time.h>
+#undef	gettimeofday
+extern "C" int gettimeofday( struct timeval *, struct timezone * );
+#endif
+
+static const uint FIRST_DAY	= 2361222;	// Julian day for 1752/09/14
+static const int  FIRST_YEAR	= 1752;		// ### wrong for many countries
+static const uint SECS_PER_DAY	= 86400;
+static const uint MSECS_PER_DAY = 86400000;
+static const uint SECS_PER_HOUR = 3600;
+static const uint MSECS_PER_HOUR= 3600000;
+static const uint SECS_PER_MIN	= 60;
+static const uint MSECS_PER_MIN = 60000;
+
+static const short monthDays[] ={0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+
+// ##### Localize.
+
+const char * const QDate::monthNames[] = {
+    "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+const char * const QDate::weekdayNames[] ={
+    "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
+
+
+/*****************************************************************************
+  QDate member functions
+ *****************************************************************************/
+
+// REVISED: aavit
+
+/*!
+  \class QDate qdatetime.h
+  \brief The QDate class provides date functions.
+
+  \ingroup time
+
+  A QDate object contains a calendar date, i.e. year, month, and day
+  numbers in the modern western (Gregorian) calendar. It can read the
+  current date from the system clock. It provides functions for
+  comparing dates and for manipulating a date by adding a number of
+  days.
+
+  A QDate object is typically created either by giving the year, month
+  and day numbers explicitly, or by using the static function
+  currentDate(), which makes a QDate object which contains the
+  system's clock date. An explicit date can also be set using
+  setYMD().
+
+  The year(), month(), and day() functions provide access to the year,
+  month, and day numbers. Also, dayOfWeek() and dayOfYear() functions
+  are provided. The same information is provided in textual format by
+  the toString(), dayName(), and monthName() functions.
+
+  QDate provides a full set of operators to compare two QDate
+  objects. A date is considered smaller than another if it is earlier
+  than the other.
+
+  The date a given number of days later than a given date can be found
+  using the addDays() function. Correspondingly, the number of days
+  between two dates can be found using the daysTo() function.
+
+  The daysInMonth() and daysInYear() functions tell how many days
+  there are in this date's month and year, respectively. The
+  isLeapYear() function tells whether this date is in a leap year.
+
+  Note that QDate may not be used for date calculations for dates in
+  the remote past, i.e. prior to the introduction of the Gregorian
+  calendar. This calendar was adopted by England Sep. 14. 1752 (hence
+  this is the earliest valid QDate), and subsequently by most other
+  western countries, until 1923.
+
+  The end of time is reached around 8000AD, by which time we expect Qt
+  to be obsolete.
+
+  \sa QTime, QDateTime
+*/
+
+
+/*!
+  \fn QDate::QDate()
+  Constructs a null date. Null dates are invalid.
+
+  \sa isNull(), isValid()
+*/
+
+
+/*!
+  Constructs a date with the year \a y, month \a m and day \a d.
+
+  \a y must be in the range 1752-ca. 8000, \a m must be in the range
+  1-12, and \a d must be in the range 1-31. Exception: if \a y is in
+  the range 0-99, it is interpreted as 1900-1999.
+
+  \sa isValid()
+*/
+
+QDate::QDate( int y, int m, int d )
+{
+    jd = 0;
+    setYMD( y, m, d );
+}
+
+
+/*!
+  \fn bool QDate::isNull() const
+
+  Returns TRUE if the date is null.  A null date is invalid.
+
+  \sa isValid()
+*/
+
+
+/*!
+  Returns TRUE if this date is valid.
+
+  \sa isNull()
+*/
+
+bool QDate::isValid() const
+{
+    return jd >= FIRST_DAY;
+}
+
+
+/*!
+  Returns the year (>= 1752) of this date.
+
+  \sa month(), day()
+*/
+
+int QDate::year() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    return y;
+}
+
+/*!
+  Returns the month (January=1 .. December=12) of this date.
+
+  \sa year(), day()
+*/
+
+int QDate::month() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    return m;
+}
+
+/*!
+  Returns the day of the month (1..31) of this date.
+
+  \sa year(), month(), dayOfWeek()
+*/
+
+int QDate::day() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    return d;
+}
+
+/*!
+  Returns the weekday (Monday=1 .. Sunday=7) for this date.
+
+  \sa day(), dayOfYear()
+*/
+
+int QDate::dayOfWeek() const
+{
+    return (((jd+1) % 7) + 6)%7 + 1;
+}
+
+/*!
+  Returns the day of the year (1..365) for this date.
+
+  \sa day(), dayOfWeek()
+*/
+
+int QDate::dayOfYear() const
+{
+    return jd - greg2jul(year(), 1, 1) + 1;
+}
+
+/*!
+  Returns the number of days in the month (28..31) for this date.
+
+  \sa day(), daysInYear()
+*/
+
+int QDate::daysInMonth() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    if ( m == 2 && leapYear(y) )
+	return 29;
+    else
+	return monthDays[m];
+}
+
+/*!
+  Returns the number of days in the year (365 or 366) for this date.
+
+  \sa day(), daysInMonth()
+*/
+
+int QDate::daysInYear() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    return leapYear(y) ? 366 : 365;
+}
+
+
+/*!
+  Returns the name of the \a month.
+
+  Month 1 == "Jan", month 2 == "Feb" etc.
+
+  \sa toString(), dayName()
+*/
+
+QString QDate::monthName( int month ) const
+{
+#if defined(CHECK_RANGE)
+    if ( month < 1 || month > 12 ) {
+	qWarning( "QDate::monthName: Parameter out ouf range." );
+	month = 1;
+    }
+#endif
+    // ### Remove the fromLatin1 during localization
+    return QString::fromLatin1(monthNames[month-1]);
+}
+
+/*!
+  Returns the name of the \a weekday.
+
+  Weekday 1 == "Mon", day 2 == "Tue" etc.
+
+  \sa toString(), monthName()
+*/
+
+QString QDate::dayName( int weekday ) const
+{
+#if defined(CHECK_RANGE)
+    if ( weekday < 1 || weekday > 7 ) {
+	qWarning( "QDate::dayName: Parameter out of range." );
+	weekday = 1;
+    }
+#endif
+    // ### Remove the fromLatin1 during localization
+    return QString::fromLatin1(weekdayNames[weekday-1]);
+}
+
+
+/*!
+  Returns the date as a string.
+
+  The string format is "Sat May 20 1995". This function uses the
+  dayName() and monthName() functions to generate the string.
+
+  \sa dayName(), monthName()
+*/
+
+QString QDate::toString() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    QString buf = dayName(dayOfWeek());
+    buf += ' ';
+    buf += monthName(m);
+    QString t;
+    t.sprintf( " %d %d", d, y);
+    buf += t;
+    return buf;
+}
+
+
+/*!
+  Sets the year \a y, month \a m and day \a d.
+
+  \a y must be in the range 1752-ca. 8000, \a m must be in the range
+  1-12, and \a d must be in the range 1-31. Exception: if \a y is in
+  the range 0-99, it is interpreted as 1900-1999.
+
+  Returns TRUE if the date is valid, otherwise FALSE.
+*/
+
+bool QDate::setYMD( int y, int m, int d )
+{
+    if ( !isValid(y,m,d) ) {
+#if defined(CHECK_RANGE)
+	 qWarning( "QDate::setYMD: Invalid date %04d/%02d/%02d", y, m, d );
+#endif
+	 return FALSE;
+    }
+    jd = greg2jul( y, m, d );
+#if defined(DEBUG)
+    ASSERT( year() == (y > 99 ? y : 1900+y) && month() == m && day() == d );
+#endif
+    return TRUE;
+}
+
+/*!
+  Returns a QDate object containing a date \a ndays later than the
+  date of this object (or earlier if \a ndays is negative).
+
+  \sa daysTo()
+*/
+
+QDate QDate::addDays( int ndays ) const
+{
+    QDate d;
+    d.jd = jd + ndays;
+    return d;
+}
+
+/*!
+  Returns the number of days from this date to \a d (which is negative
+  if \a d is earlier than this date).
+
+  Example:
+  \code
+    QDate d1( 1995, 5, 17 );		// May 17th 1995
+    QDate d2( 1995, 5, 20 );		// May 20th 1995
+    d1.daysTo( d2 );			// returns 3
+    d2.daysTo( d1 );			// returns -3
+  \endcode
+
+  \sa addDays()
+*/
+
+int QDate::daysTo( const QDate &d ) const
+{
+    return d.jd - jd;
+}
+
+
+/*!
+  \fn bool QDate::operator==( const QDate &d ) const
+  Returns TRUE if this date is equal to \a d, or FALSE if
+  they are different.
+*/
+
+/*!
+  \fn bool QDate::operator!=( const QDate &d ) const
+  Returns TRUE if this date is different from \a d, or FALSE if
+  they are equal.
+*/
+
+/*!
+  \fn bool QDate::operator<( const QDate &d ) const
+  Returns TRUE if this date is earlier than \a d, otherwise FALSE.
+*/
+
+/*!
+  \fn bool QDate::operator<=( const QDate &d ) const
+  Returns TRUE if this date is earlier than or equal to \a d, otherwise FALSE.
+*/
+
+/*!
+  \fn bool QDate::operator>( const QDate &d ) const
+  Returns TRUE if this date is later than \a d, otherwise FALSE.
+*/
+
+/*!
+  \fn bool QDate::operator>=( const QDate &d ) const
+  Returns TRUE if this date is later than or equal to \a d, otherwise FALSE.
+*/
+
+
+/*!
+  Returns the current date, as reported by the system clock.
+
+  \sa QTime::currentTime(), QDateTime::currentDateTime()
+*/
+
+QDate QDate::currentDate()
+{
+#if defined(_OS_WIN32_)
+
+    SYSTEMTIME t;
+    GetLocalTime( &t );
+    QDate d;
+    d.jd = greg2jul( t.wYear, t.wMonth, t.wDay );
+    return d;
+
+#else
+
+    time_t ltime;
+    time( &ltime );
+    tm *t = localtime( &ltime );
+    QDate d;
+    d.jd = greg2jul( t->tm_year + 1900, t->tm_mon + 1, t->tm_mday );
+    return d;
+
+#endif
+}
+
+/*!
+  Returns TRUE if the specified date (year \a y, month \a m and day \a
+  d) is valid.
+
+  Example:
+  \code
+    QDate::isValid( 2002, 5, 17 );	// TRUE;  May 17th 2002 is OK.
+    QDate::isValid( 2002, 2, 30 );	// FALSE; Feb 30th does not exist
+    QDate::isValid( 2004, 2, 29 );	// TRUE; 2004 is a leap year
+    QDate::isValid( 1202, 6, 6 );	// FALSE; 1202 is pre-Gregorian
+  \endcode
+
+  Note that a \a y value in the range 00-99 is interpreted as
+  1900-1999.
+
+  \sa isNull(), setYMD()
+*/
+
+bool QDate::isValid( int y, int m, int d )
+{
+    if ( y >= 0 && y <= 99 )
+	y += 1900;
+    else if ( y < FIRST_YEAR || (y == FIRST_YEAR && (m < 9 ||
+						    (m == 9 && d < 14))) )
+	return FALSE;
+    return (d > 0 && m > 0 && m <= 12) &&
+	   (d <= monthDays[m] || (d == 29 && m == 2 && leapYear(y)));
+}
+
+/*!
+  Returns TRUE if the specified year \a y is a leap year.
+*/
+
+bool QDate::leapYear( int y )
+{
+    return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
+}
+
+/*!
+  \internal
+  Converts a Gregorian date to a Julian day.
+  This algorithm is taken from Communications of the ACM, Vol 6, No 8.
+  \sa jul2greg()
+*/
+
+uint QDate::greg2jul( int y, int m, int d )
+{
+    uint c, ya;
+    if ( y <= 99 )
+	y += 1900;
+    if ( m > 2 ) {
+	m -= 3;
+    } else {
+	m += 9;
+	y--;
+    }
+    c = y;					// NOTE: Sym C++ 6.0 bug
+    c /= 100;
+    ya = y - 100*c;
+    return 1721119 + d + (146097*c)/4 + (1461*ya)/4 + (153*m+2)/5;
+}
+
+/*!
+  \internal
+  Converts a Julian day to a Gregorian date.
+  This algorithm is taken from Communications of the ACM, Vol 6, No 8.
+  \sa greg2jul()
+*/
+
+void QDate::jul2greg( uint jd, int &y, int &m, int &d )
+{
+    uint x;
+    uint j = jd - 1721119;
+    y = (j*4 - 1)/146097;
+    j = j*4 - 146097*y - 1;
+    x = j/4;
+    j = (x*4 + 3) / 1461;
+    y = 100*y + j;
+    x = (x*4) + 3 - 1461*j;
+    x = (x + 4)/4;
+    m = (5*x - 3)/153;
+    x = 5*x - 3 - 153*m;
+    d = (x + 5)/5;
+    if ( m < 10 ) {
+	m += 3;
+    } else {
+	m -= 9;
+	y++;
+    }
+}
+
+
+/*****************************************************************************
+  QTime member functions
+ *****************************************************************************/
+
+/*!
+  \class QTime qdatetime.h
+
+  \brief The QTime class provides clock time functions.
+
+  \ingroup time
+
+  A QTime object contains a clock time, i.e. a number of hours,
+  minutes, seconds and milliseconds since midnight. It can read the
+  current time from the system clock, and measure a span of elapsed
+  time. It provides functions for comparing times and for manipulating
+  a time by adding a number of (milli)seconds.
+
+  QTime operates with 24-hour clock format; it has no concept of
+  AM/PM. It operates with local time; it does not know anything about
+  time zones or daylight savings time.
+
+  A QTime object is typically created either by giving the number of
+  hours, minutes, seconds, and milliseconds explicitly, or by using
+  the static function currentTime(), which makes a QTime object which
+  contains the system's clock time. Note that the accuracy depends on
+  the accuracy of the underlying operating system; not all systems
+  provide 1-millisecond accuracy.
+
+  The hour(), minute(), second(), and msec() functions provide access
+  to the number of hours, minutes, seconds, and milliseconds of the
+  time. The same information is provided in textual format by the
+  toString() function.
+
+  QTime provides a full set of operators to compare two QTime
+  objects. A time is considered smaller than another if it is earlier
+  than the other.
+
+  The time a given number of seconds or milliseconds later than a
+  given time can be found using the addSecs() or addMSecs()
+  functions. Correspondingly, the number of (milli)seconds between two
+  times can be found using the secsTo() or msecsTo() functions.
+
+  QTime can be used to measure a span of elapsed time using the
+  start(), restart(), and elapsed() functions.
+
+  \sa QDate, QDateTime
+*/
+
+/*!
+  \fn QTime::QTime()
+
+  Constructs the time 0 hours, minutes, seconds and milliseconds,
+  i.e. 00:00:00.000 (midnight). This is a valid time.
+
+  \sa isValid()
+*/
+
+/*!
+  Constructs a time with hour \a h, minute \a m, seconds \a s and
+  milliseconds \a ms.
+
+  \a h must be in the range 0-23, \a m and \a s must be in the range
+  0-59, and \a ms must be in the range 0-999.
+
+  \sa isValid()
+*/
+
+QTime::QTime( int h, int m, int s, int ms )
+{
+    setHMS( h, m, s, ms );
+}
+
+
+/*!
+  \fn bool QTime::isNull() const
+  Returns TRUE if the time is equal to 00:00:00.000. A null time is valid.
+
+  \sa isValid()
+*/
+
+/*!
+  Returns TRUE if the time is valid, or FALSE if the time is invalid.
+  The time 23:30:55.746 is valid, while 24:12:30 is invalid.
+
+  \sa isNull()
+*/
+
+bool QTime::isValid() const
+{
+    return ds < MSECS_PER_DAY;
+}
+
+
+/*!
+  Returns the hour part (0..23) of the time.
+*/
+
+int QTime::hour() const
+{
+    return ds / MSECS_PER_HOUR;
+}
+
+/*!
+  Returns the minute part (0..59) of the time.
+*/
+
+int QTime::minute() const
+{
+    return (ds % MSECS_PER_HOUR)/MSECS_PER_MIN;
+}
+
+/*!
+  Returns the second part (0..59) of the time.
+*/
+
+int QTime::second() const
+{
+    return (ds / 1000)%SECS_PER_MIN;
+}
+
+/*!
+  Returns the millisecond part (0..999) of the time.
+*/
+
+int QTime::msec() const
+{
+    return ds % 1000;
+}
+
+
+/*!
+  Returns the time of this object in a textual format. Milliseconds
+  are not included. The string format is HH:MM:SS, e.g. 1 second
+  before midnight would be "23:59:59".
+*/
+
+QString QTime::toString() const
+{
+    QString buf;
+    buf.sprintf( "%.2d:%.2d:%.2d", hour(), minute(), second() );
+    return buf;
+}
+
+
+/*!
+  Sets the time to hour \a h, minute \a m, seconds \a s and
+  milliseconds \a ms.
+
+  \a h must be in the range 0-23, \a m and \a s must be in the range
+  0-59, and \a ms must be in the range 0-999. Returns TRUE if the set
+  time is valid, otherwise FALSE.
+
+  \sa isValid()
+*/
+
+bool QTime::setHMS( int h, int m, int s, int ms )
+{
+    if ( !isValid(h,m,s,ms) ) {
+#if defined(CHECK_RANGE)
+	qWarning( "QTime::setHMS Invalid time %02d:%02d:%02d.%03d", h, m, s,
+		 ms );
+#endif
+	ds = MSECS_PER_DAY;		// make this invalid
+	return FALSE;
+    }
+    ds = (h*SECS_PER_HOUR + m*SECS_PER_MIN + s)*1000 + ms;
+    return TRUE;
+}
+
+/*!
+  Returns a QTime object containing a time \a nsecs seconds later than
+  the time of this object (or earlier if \a ms is negative).
+
+  Note that the time will wrap if it passes midnight.
+
+  Example:
+  \code
+    QTime n( 14, 0, 0 );                // n == 14:00:00
+    QTime t;
+    t = n.addSecs( 70 );                // t == 14:01:10
+    t = n.addSecs( -70 );               // t == 13:58:50
+    t = n.addSecs( 10*60*60 + 5 );      // t == 00:00:05
+    t = n.addSecs( -15*60*60 );         // t == 23:00:00
+  \endcode
+
+  \sa addMSecs(), secsTo(), QDateTime::addSecs()
+*/
+
+QTime QTime::addSecs( int nsecs ) const
+{
+    return addMSecs(nsecs*1000);
+}
+
+/*!
+  Returns the number of seconds from this time to \a t (which is
+  negative if \a t is earlier than this time).
+
+  Since QTime measures time within a day and there are 86400 seconds
+  in a day, the result is between -86400 and 86400.
+
+  \sa addSecs() QDateTime::secsTo()
+*/
+
+int QTime::secsTo( const QTime &t ) const
+{
+    return ((int)t.ds - (int)ds)/1000;
+}
+
+/*!
+  Returns a QTime object containing a time \a ms milliseconds later than
+  the time of this object (or earlier if \a ms is negative).
+
+  Note that the time will wrap if it passes midnight. See addSecs()
+  for an example.
+
+  \sa addSecs(), msecsTo()
+*/
+
+QTime QTime::addMSecs( int ms ) const
+{
+    QTime t;
+    if ( ms < 0 ) {
+	// % not well-defined for -ve, but / is.
+	int negdays = (MSECS_PER_DAY-ms) / MSECS_PER_DAY;
+	t.ds = ((int)ds + ms + negdays*MSECS_PER_DAY)
+		% MSECS_PER_DAY;
+    } else {
+	t.ds = ((int)ds + ms) % MSECS_PER_DAY;
+    }
+    return t;
+}
+
+/*!
+  Returns the number of milliseconds from this time to \a t (which is
+  negative if \a t is earlier than this time).
+
+  Since QTime measures time within a day and there are 86400000
+  milliseconds in a day, the result is between -86400000 and 86400000.
+
+  \sa secsTo()
+*/
+
+int QTime::msecsTo( const QTime &t ) const
+{
+    return (int)t.ds - (int)ds;
+}
+
+
+/*!
+  \fn bool QTime::operator==( const QTime &t ) const
+
+  Returns TRUE if this time is equal to \a t, or FALSE if they are
+  different.
+*/
+
+/*!
+  \fn bool QTime::operator!=( const QTime &t ) const
+
+  Returns TRUE if this time is different from \a t, or FALSE if they
+  are equal.
+*/
+
+/*!
+  \fn bool QTime::operator<( const QTime &t ) const
+
+  Returns TRUE if this time is earlier than \a t, otherwise FALSE.
+*/
+
+/*!
+  \fn bool QTime::operator<=( const QTime &t ) const
+
+  Returns TRUE if this time is earlier than or equal to \a t,
+  otherwise FALSE.
+*/
+
+/*!
+  \fn bool QTime::operator>( const QTime &t ) const
+
+  Returns TRUE if this time is later than \a t, otherwise FALSE.
+*/
+
+/*!
+  \fn bool QTime::operator>=( const QTime &t ) const
+
+  Returns TRUE if this time is later than or equal to \a t, otherwise
+  FALSE.
+*/
+
+
+
+/*!
+  Returns the current time, as reported by the system clock.
+
+  Note that the accuracy depends on the accuracy of the underlying
+  operating system; not all systems provide 1-millisecond accuracy.
+*/
+
+QTime QTime::currentTime()
+{
+    QTime ct;
+    currentTime( &ct );
+    return ct;
+}
+
+/*!
+  \internal
+
+  Fetches the current time and returns TRUE if the time is within one
+  minute after midnight, otherwise FALSE. The return value is used by
+  QDateTime::currentDateTime() to ensure that the date there is correct.
+*/
+
+bool QTime::currentTime( QTime *ct )
+{
+    if ( !ct ) {
+#if defined(CHECK_NULL)
+	qWarning( "QTime::currentTime(QTime *): Null pointer not allowed" );
+#endif
+	return FALSE;
+    }
+
+#if defined(_OS_WIN32_)
+
+    SYSTEMTIME t;
+    GetLocalTime( &t );
+    ct->ds = MSECS_PER_HOUR*t.wHour + MSECS_PER_MIN*t.wMinute +
+	     1000*t.wSecond + t.wMilliseconds;
+    return (t.wHour == 0 && t.wMinute == 0);
+
+#elif defined(_OS_OS2_)
+
+    DATETIME t;
+    DosGetDateTime( &t );
+    ct->ds = MSECS_PER_HOUR*t.hours + MSECS_PER_MIN*t.minutes +
+	     1000*t.seconds + 10*t.hundredths;
+    return (t.hours == 0 && t.minutes == 0);
+
+#elif defined(_OS_MSDOS_)
+
+    _dostime_t t;
+    _dos_gettime( &t );
+    ct->ds = MSECS_PER_HOUR*t.hour + MSECS_PER_MIN*t.minute +
+	     t.second*1000 + t.hsecond*10;
+    return (t.hour== 0 && t.minute == 0);
+
+#elif defined(_OS_UNIX_)
+
+    struct timeval tv;
+    gettimeofday( &tv, 0 );
+    time_t ltime = tv.tv_sec;
+    tm *t = localtime( &ltime );
+    ct->ds = (uint)( MSECS_PER_HOUR*t->tm_hour + MSECS_PER_MIN*t->tm_min +
+		     1000*t->tm_sec + tv.tv_usec/1000 );
+    return (t->tm_hour== 0 && t->tm_min == 0);
+
+#else
+
+    time_t ltime;			// no millisecond resolution!!
+    ::time( &ltime );
+    tm *t = localtime( &ltime );
+    ct->ds = MSECS_PER_HOUR*t->tm_hour + MSECS_PER_MIN*t->tm_min +
+	     1000*t->tm_sec;
+    return (t->tm_hour== 0 && t->tm_min == 0);
+#endif
+}
+
+/*!
+  Returns TRUE if the specified time is valid, otherwise FALSE.
+
+  The time is valid if \a h is in the range 0-23, \a m and \a s are in
+  the range 0-59, and \a ms is in the range 0-999.
+
+  Example:
+  \code
+    QTime::isValid(21, 10, 30);		// returns TRUE
+    QTime::isValid(22, 5,  62);		// returns FALSE
+  \endcode
+*/
+
+bool QTime::isValid( int h, int m, int s, int ms )
+{
+    return (uint)h < 24 && (uint)m < 60 && (uint)s < 60 && (uint)ms < 1000;
+}
+
+
+/*!
+  Sets this time to the current time. This is practical for timing:
+
+  \code
+    QTime t;
+    t.start();				// start clock
+    ... // some lengthy task
+    qDebug( "%d\n", t.elapsed() );	// prints # msecs elapsed
+  \endcode
+
+  \sa restart(), elapsed(), currentTime()
+*/
+
+void QTime::start()
+{
+    *this = currentTime();
+}
+
+/*!
+  Sets this time to the current time, and returns the number of
+  milliseconds that have elapsed since the last time start() or
+  restart() was called.
+
+  This function is guaranteed to be atomic, and is thus very handy for
+  repeated measurements: call start() to start the first measurement,
+  then restart() for each later measurement.
+
+  Note that the counter wraps to zero 24 hours after the last call to
+  start() or restart().
+
+  \warning If the system's clock setting has been changed since the
+  last time start() or restart() was called, the result is undefined.
+  This can happen e.g. when daylight saving is turned on or off.
+
+  \sa start(), elapsed(), currentTime()
+*/
+
+int QTime::restart()
+{
+    QTime t = currentTime();
+    int n = msecsTo( t );
+    if ( n < 0 )				// passed midnight
+	n += 86400*1000;
+    *this = t;
+    return n;
+}
+
+/*!
+  Returns the number of milliseconds that have elapsed since the last
+  time start() or restart() was called.
+
+  Note that the counter wraps to zero 24 hours after the last call to
+  start() or restart.
+
+  Note that the accuracy depends on the accuracy of the underlying
+  operating system; not all systems provide 1-millisecond accuracy.
+
+  \warning If the system's clock setting has been changed since the
+  last time start() or restart() was called, the result is undefined.
+  This can happen e.g. when daylight saving is turned on or off.
+
+  \sa start(), restart()
+*/
+
+int QTime::elapsed()
+{
+    int n = msecsTo( currentTime() );
+    if ( n < 0 )				// passed midnight
+	n += 86400*1000;
+    return n;
+}
+
+
+/*****************************************************************************
+  QDateTime member functions
+ *****************************************************************************/
+
+/*!
+  \class QDateTime qdatetime.h
+  \brief The QDateTime class provides date and time functions.
+
+  \ingroup time
+
+  A QDateTime object contains a calendar date and a clock time (a
+  "datetime"). It is a combination of the QDate and QTime classes. It
+  can read the current datetime from the system clock. It provides
+  functions for comparing datetimes and for manipulating a datetime by
+  adding a number of seconds or days.
+
+  A QDateTime object is typically created either by giving a date and
+  time explicitly, or by using the static function currentTime(),
+  which makes a QDateTime object which contains the system's clock
+  time.
+
+  The date() and time() functions provide access to the date and time
+  parts of the datetime. The same information is provided in textual
+  format by the toString() function.
+
+  QDateTime provides a full set of operators to compare two QDateTime
+  objects. A datetime is considered smaller than another if it is
+  earlier than the other.
+
+  The datetime a given number of days or seconds later than a given
+  datetime can be found using the addDays() and addSecs()
+  functions. Correspondingly, the number of days or seconds between
+  two times can be found using the daysTo() or secsTo() functions.
+
+  A datetime can also be set using the setTime_t() function, which
+  takes a POSIX-standard "number of seconds since 00:00:00 on January
+  1, 1970" value.
+
+  The limitations regarding range and resolution mentioned in the
+  QDate and QTime documentation apply for QDateTime also.
+
+  \sa QDate, QTime
+*/
+
+
+/*!
+  \fn QDateTime::QDateTime()
+
+  Constructs a null datetime (i.e. null date and null time).  A null
+  datetime is invalid, since the date is invalid.
+
+  \sa isValid()
+*/
+
+
+/*!
+  Constructs a datetime with date \a date and null time (00:00:00.000).
+*/
+
+QDateTime::QDateTime( const QDate &date )
+    : d(date)
+{
+}
+
+/*!
+  Constructs a datetime with date \a date and time \a time.
+*/
+
+QDateTime::QDateTime( const QDate &date, const QTime &time )
+    : d(date), t(time)
+{
+}
+
+
+/*!
+  \fn bool QDateTime::isNull() const
+
+  Returns TRUE if both the date and the time are null.	A null date is invalid.
+
+  \sa QDate::isNull(), QTime::isNull()
+*/
+
+/*!
+  \fn bool QDateTime::isValid() const
+
+  Returns TRUE if both the date and the time are valid.
+
+  \sa QDate::isValid(), QTime::isValid()
+*/
+
+/*!
+  \fn QDate QDateTime::date() const
+
+  Returns the date part of this datetime.
+
+  \sa setDate(), time()
+*/
+
+/*!
+  \fn QTime QDateTime::time() const
+
+  Returns the time part of this datetime.
+
+  \sa setTime(), date()
+*/
+
+/*!
+  \fn void QDateTime::setDate( const QDate &date )
+
+  Sets the date part of this datetime.
+
+  \sa date(), setTime()
+*/
+
+/*!
+  \fn void QDateTime::setTime( const QTime &time )
+
+  Sets the time part of this datetime.
+
+  \sa time(), setDate()
+*/
+
+
+/*!
+  Sets the local date and time given the number of seconds that have passed
+  since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
+  On systems that do not support timezones this function will behave as if
+  local time were UTC.
+
+  Note that Microsoft Windows supports only a limited range of values for
+  \a secsSince1Jan1970UTC.
+*/
+
+void QDateTime::setTime_t( uint secsSince1Jan1970UTC )
+{
+    time_t tmp = (time_t) secsSince1Jan1970UTC;
+    tm *tM = localtime( &tmp );
+    if ( !tM ) {
+	tM = gmtime( &tmp );
+	if ( !tM ) {
+	    d.jd = QDate::greg2jul( 1970, 1, 1 );
+	    t.ds = 0;
+	    return;
+	}
+    }
+    d.jd = QDate::greg2jul( tM->tm_year + 1900, tM->tm_mon + 1, tM->tm_mday );
+    t.ds = MSECS_PER_HOUR*tM->tm_hour + MSECS_PER_MIN*tM->tm_min +
+	    1000*tM->tm_sec;
+}
+
+
+/*!
+  Returns the datetime as a string.
+
+  The string format is "Sat May 20 03:40:13 1998".
+
+  This function uses QDate::dayName(), QDate::monthName(), and
+  QTime::toString() to generate the string.
+
+*/
+
+QString QDateTime::toString() const
+{
+    QString buf = d.dayName(d.dayOfWeek());
+    buf += ' ';
+    buf += d.monthName(d.month());
+    buf += ' ';
+    buf += QString().setNum(d.day());
+    buf += ' ';
+    buf += t.toString();
+    buf += ' ';
+    buf += QString().setNum(d.year());
+    return buf;
+}
+
+/*!
+  Returns a QDateTime object containing a datetime \a ndays days later
+  than the datetime of this object (or earlier if \a ndays is
+  negative).
+
+  \sa daysTo(), addSecs()
+*/
+
+QDateTime QDateTime::addDays( int ndays ) const
+{
+    return QDateTime( d.addDays(ndays), t );
+}
+
+/*!
+  Returns a QDateTime object containing a datetime \a nsecs seconds
+  later than the datetime of this object (or earlier if \a nsecs is
+  negative).
+
+  \sa secsTo(), addDays()
+*/
+
+QDateTime QDateTime::addSecs( int nsecs ) const
+{
+    uint dd = d.jd;
+    int  tt = t.ds;
+    int  sign = 1;
+    if ( nsecs < 0 ) {
+	nsecs = -nsecs;
+	sign = -1;
+    }
+    if ( nsecs >= (int)SECS_PER_DAY ) {
+	dd += sign*(nsecs/SECS_PER_DAY);
+	nsecs %= SECS_PER_DAY;
+    }
+    tt += sign*nsecs*1000;
+    if ( tt < 0 ) {
+	tt = MSECS_PER_DAY - tt - 1;
+	dd -= tt / MSECS_PER_DAY;
+	tt = tt % MSECS_PER_DAY;
+	tt = MSECS_PER_DAY - tt - 1;
+    } else if ( tt >= (int)MSECS_PER_DAY ) {
+	dd += ( tt / MSECS_PER_DAY );
+	tt = tt % MSECS_PER_DAY;
+    }
+    QDateTime ret;
+    ret.t.ds = tt;
+    ret.d.jd = dd;
+    return ret;
+}
+
+/*!
+  Returns the number of days from this datetime to \a dt (which is
+  negative if \a dt is earlier than this datetime).
+
+  \sa addDays(), secsTo()
+*/
+
+int QDateTime::daysTo( const QDateTime &dt ) const
+{
+    return d.daysTo( dt.d );
+}
+
+/*!
+  Returns the number of seconds from this datetime to \a dt (which is
+  negative if \a dt is earlier than this datetime).
+
+  Example:
+  \code
+    QDateTime dt = QDateTime::currentDateTime();
+    QDateTime x( QDate(dt.year(),12,24), QTime(17,00) );
+    qDebug( "There are %d seconds to Christmas", dt.secsTo(x) );
+  \endcode
+
+  \sa addSecs(), daysTo(), QTime::secsTo()
+*/
+
+int QDateTime::secsTo( const QDateTime &dt ) const
+{
+    return t.secsTo(dt.t) + d.daysTo(dt.d)*SECS_PER_DAY;
+}
+
+
+/*!
+  Returns TRUE if this datetime is equal to \a dt, or FALSE if
+  they are different.
+  \sa operator!=()
+*/
+
+bool QDateTime::operator==( const QDateTime &dt ) const
+{
+    return  t == dt.t && d == dt.d;
+}
+
+/*!
+  Returns TRUE if this datetime is different from \a dt, or FALSE if
+  they are equal.
+  \sa operator==()
+*/
+
+bool QDateTime::operator!=( const QDateTime &dt ) const
+{
+    return  t != dt.t || d != dt.d;
+}
+
+/*!
+  Returns TRUE if this datetime is earlier than \a dt, otherwise FALSE.
+*/
+
+bool QDateTime::operator<( const QDateTime &dt ) const
+{
+    if ( d < dt.d )
+	return TRUE;
+    return d == dt.d ? t < dt.t : FALSE;
+}
+
+/*!
+  Returns TRUE if this datetime is earlier than or equal to \a dt,
+  otherwise FALSE.
+*/
+
+bool QDateTime::operator<=( const QDateTime &dt ) const
+{
+    if ( d < dt.d )
+	return TRUE;
+    return d == dt.d ? t <= dt.t : FALSE;
+}
+
+/*!
+  Returns TRUE if this datetime is later than \a dt, otherwise FALSE.
+*/
+
+bool QDateTime::operator>( const QDateTime &dt ) const
+{
+    if ( d > dt.d )
+	return TRUE;
+    return d == dt.d ? t > dt.t : FALSE;
+}
+
+/*!
+  Returns TRUE if this datetime is later than or equal to \a dt,
+  otherwise FALSE.
+*/
+
+bool QDateTime::operator>=( const QDateTime &dt ) const
+{
+    if ( d > dt.d )
+	return TRUE;
+    return d == dt.d ? t >= dt.t : FALSE;
+}
+
+/*!
+  Returns the current datetime, as reported by the system clock.
+
+  \sa QDate::currentDate(), QTime::currentTime()
+*/
+
+QDateTime QDateTime::currentDateTime()
+{
+    QDate cd = QDate::currentDate();
+    QTime ct;
+    if ( QTime::currentTime(&ct) )		// too close to midnight?
+	cd = QDate::currentDate();		// YES! time for some midnight
+						// voodoo, fetch date again
+    return QDateTime( cd, ct );
+}
+
+
+/*****************************************************************************
+  Date/time stream functions
+ *****************************************************************************/
+
+#ifndef QT_NO_DATASTREAM
+/*!
+  \relates QDate
+  Writes the date to the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator<<( QDataStream &s, const QDate &d )
+{
+    return s << (Q_UINT32)(d.jd);
+}
+
+/*!
+  \relates QDate
+  Reads a date from the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator>>( QDataStream &s, QDate &d )
+{
+    Q_UINT32 jd;
+    s >> jd;
+    d.jd = jd;
+    return s;
+}
+
+/*!
+  \relates QTime
+  Writes a time to the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator<<( QDataStream &s, const QTime &t )
+{
+    return s << (Q_UINT32)(t.ds);
+}
+
+/*!
+  \relates QTime
+  Reads a time from the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator>>( QDataStream &s, QTime &t )
+{
+    Q_UINT32 ds;
+    s >> ds;
+    t.ds = ds;
+    return s;
+}
+
+/*!
+  \relates QDateTime
+  Writes a datetime to the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator<<( QDataStream &s, const QDateTime &dt )
+{
+    return s << dt.d << dt.t;
+}
+
+/*!
+  \relates QDateTime
+  Reads a datetime from the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator>>( QDataStream &s, QDateTime &dt )
+{
+    s >> dt.d >> dt.t;
+    return s;
+}
+#endif //QT_NO_DATASTREAM
diff --git a/WebCore/kwq/qt/_qdatetime.h b/WebCore/kwq/qt/_qdatetime.h
new file mode 100644
index 0000000..820fde3
--- /dev/null
+++ b/WebCore/kwq/qt/_qdatetime.h
@@ -0,0 +1,215 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of date and time classes
+**
+** Created : 940124
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QDATETIME_H
+#define QDATETIME_H
+
+#ifndef QT_H
+#include "qstring.h"
+#endif // QT_H
+
+
+/*****************************************************************************
+  QDate class
+ *****************************************************************************/
+
+class Q_EXPORT QDate
+{
+public:
+    QDate()  { jd=0; }				// set null date
+    QDate( int y, int m, int d );		// set date
+
+    bool   isNull()	 const { return jd == 0; }
+    bool   isValid()	 const;			// valid date
+
+    int	   year()	 const;			// 1752..
+    int	   month()	 const;			// 1..12
+    int	   day()	 const;			// 1..31
+    int	   dayOfWeek()	 const;			// 1..7 (monday==1)
+    int	   dayOfYear()	 const;			// 1..365
+    int	   daysInMonth() const;			// 28..31
+    int	   daysInYear()	 const;			// 365 or 366
+
+    virtual QString monthName( int month ) const;
+    virtual QString dayName( int weekday ) const;
+
+    QString toString()	 const;
+
+    bool   setYMD( int y, int m, int d );
+
+    QDate  addDays( int days )		const;
+    int	   daysTo( const QDate & )	const;
+
+    bool   operator==( const QDate &d ) const { return jd == d.jd; }
+    bool   operator!=( const QDate &d ) const { return jd != d.jd; }
+    bool   operator<( const QDate &d )	const { return jd < d.jd; }
+    bool   operator<=( const QDate &d ) const { return jd <= d.jd; }
+    bool   operator>( const QDate &d )	const { return jd > d.jd; }
+    bool   operator>=( const QDate &d ) const { return jd >= d.jd; }
+
+    static QDate currentDate();
+    static bool	 isValid( int y, int m, int d );
+    static bool	 leapYear( int year );
+
+protected:
+    static uint	 greg2jul( int y, int m, int d );
+    static void	 jul2greg( uint jd, int &y, int &m, int &d );
+private:
+    static const char * const monthNames[];
+    static const char * const weekdayNames[];
+    uint	 jd;
+    friend class QDateTime;
+#ifndef QT_NO_DATASTREAM
+    friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QDate & );
+    friend Q_EXPORT QDataStream &operator>>( QDataStream &, QDate & );
+#endif
+};
+
+
+/*****************************************************************************
+  QTime class
+ *****************************************************************************/
+
+class Q_EXPORT QTime
+{
+public:
+    QTime() { ds=0; }				// set null time
+    QTime( int h, int m, int s=0, int ms=0 );	// set time
+
+    bool   isNull()	 const { return ds == 0; }
+    bool   isValid()	 const;			// valid time
+
+    int	   hour()	 const;			// 0..23
+    int	   minute()	 const;			// 0..59
+    int	   second()	 const;			// 0..59
+    int	   msec()	 const;			// 0..999
+
+    QString toString()	 const;
+
+    bool   setHMS( int h, int m, int s, int ms=0 );
+
+    QTime  addSecs( int secs )		const;
+    int	   secsTo( const QTime & )	const;
+    QTime  addMSecs( int ms )		const;
+    int	   msecsTo( const QTime & )	const;
+
+    bool   operator==( const QTime &d ) const { return ds == d.ds; }
+    bool   operator!=( const QTime &d ) const { return ds != d.ds; }
+    bool   operator<( const QTime &d )	const { return ds < d.ds; }
+    bool   operator<=( const QTime &d ) const { return ds <= d.ds; }
+    bool   operator>( const QTime &d )	const { return ds > d.ds; }
+    bool   operator>=( const QTime &d ) const { return ds >= d.ds; }
+
+    static QTime currentTime();
+    static bool	 isValid( int h, int m, int s, int ms=0 );
+
+    void   start();
+    int	   restart();
+    int	   elapsed();
+
+private:
+    static bool currentTime( QTime * );
+
+    uint   ds;
+    friend class QDateTime;
+#ifndef QT_NO_DATASTREAM
+    friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QTime & );
+    friend Q_EXPORT QDataStream &operator>>( QDataStream &, QTime & );
+#endif
+};
+
+
+/*****************************************************************************
+  QDateTime class
+ *****************************************************************************/
+
+class Q_EXPORT QDateTime
+{
+public:
+    QDateTime() {}				// set null date and null time
+    QDateTime( const QDate & );
+    QDateTime( const QDate &, const QTime & );
+
+    bool   isNull()	const		{ return d.isNull() && t.isNull(); }
+    bool   isValid()	const		{ return d.isValid() && t.isValid(); }
+
+    QDate  date()	const		{ return d; }
+    QTime  time()	const		{ return t; }
+    void   setDate( const QDate &date ) { d=date; }
+    void   setTime( const QTime &time ) { t=time; }
+    void   setTime_t( uint secsSince1Jan1970UTC );
+
+    QString toString()	const;
+
+    QDateTime addDays( int days )	const;
+    QDateTime addSecs( int secs )	const;
+    int	   daysTo( const QDateTime & )	const;
+    int	   secsTo( const QDateTime & )	const;
+
+    bool   operator==( const QDateTime &dt ) const;
+    bool   operator!=( const QDateTime &dt ) const;
+    bool   operator<( const QDateTime &dt )  const;
+    bool   operator<=( const QDateTime &dt ) const;
+    bool   operator>( const QDateTime &dt )  const;
+    bool   operator>=( const QDateTime &dt ) const;
+
+    static QDateTime currentDateTime();
+
+private:
+    QDate  d;
+    QTime  t;
+#ifndef QT_NO_DATASTREAM
+    friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QDateTime &);
+    friend Q_EXPORT QDataStream &operator>>( QDataStream &, QDateTime & );
+#endif
+};
+
+
+/*****************************************************************************
+  Date and time stream functions
+ *****************************************************************************/
+
+#ifndef QT_NO_DATASTREAM
+Q_EXPORT QDataStream &operator<<( QDataStream &, const QDate & );
+Q_EXPORT QDataStream &operator>>( QDataStream &, QDate & );
+Q_EXPORT QDataStream &operator<<( QDataStream &, const QTime & );
+Q_EXPORT QDataStream &operator>>( QDataStream &, QTime & );
+Q_EXPORT QDataStream &operator<<( QDataStream &, const QDateTime & );
+Q_EXPORT QDataStream &operator>>( QDataStream &, QDateTime & );
+#endif // QT_NO_DATASTREAM
+
+#endif // QDATETIME_H
diff --git a/WebCore/kwq/qt/_qiodevice.h b/WebCore/kwq/qt/_qiodevice.h
new file mode 100644
index 0000000..6688bda
--- /dev/null
+++ b/WebCore/kwq/qt/_qiodevice.h
@@ -0,0 +1,155 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of QIODevice class
+**
+** Created : 940913
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QIODEVICE_H
+#define QIODEVICE_H
+
+#ifndef QT_H
+#include "qglobal.h"
+#include "qcstring.h"
+#endif // QT_H
+
+
+// IO device access types
+
+#define IO_Direct		0x0100		// direct access device
+#define IO_Sequential		0x0200		// sequential access device
+#define IO_Combined		0x0300		// combined direct/sequential
+#define IO_TypeMask		0x0f00
+
+// IO handling modes
+
+#define IO_Raw			0x0040		// raw access (not buffered)
+#define IO_Async		0x0080		// asynchronous mode
+
+// IO device open modes
+
+#define IO_ReadOnly		0x0001		// readable device
+#define IO_WriteOnly		0x0002		// writable device
+#define IO_ReadWrite		0x0003		// read+write device
+#define IO_Append		0x0004		// append
+#define IO_Truncate		0x0008		// truncate device
+#define IO_Translate		0x0010		// translate CR+LF
+#define IO_ModeMask		0x00ff
+
+// IO device state
+
+#define IO_Open			0x1000		// device is open
+#define IO_StateMask		0xf000
+
+
+// IO device status
+
+#define IO_Ok			0
+#define IO_ReadError		1		// read error
+#define IO_WriteError		2		// write error
+#define IO_FatalError		3		// fatal unrecoverable error
+#define IO_ResourceError	4		// resource limitation
+#define IO_OpenError		5		// cannot open device
+#define IO_ConnectError		5		// cannot connect to device
+#define IO_AbortError		6		// abort error
+#define IO_TimeOutError		7		// time out
+#define IO_UnspecifiedError		8		// unspecified error
+
+class Q_EXPORT QIODevice					// IO device class
+{
+public:
+    QIODevice();
+    virtual ~QIODevice();
+
+    int		 flags()  const { return ioMode; }
+    int		 mode()	  const { return ioMode & IO_ModeMask; }
+    int		 state()  const { return ioMode & IO_StateMask; }
+
+    bool	 isDirectAccess()     const { return ((ioMode & IO_Direct)     == IO_Direct); }
+    bool	 isSequentialAccess() const { return ((ioMode & IO_Sequential) == IO_Sequential); }
+    bool	 isCombinedAccess()   const { return ((ioMode & IO_Combined)   == IO_Combined); }
+    bool	 isBuffered()	      const { return ((ioMode & IO_Raw)        != IO_Raw); }
+    bool	 isRaw()	      const { return ((ioMode & IO_Raw)        == IO_Raw); }
+    bool	 isSynchronous()      const { return ((ioMode & IO_Async)      != IO_Async); }
+    bool	 isAsynchronous()     const { return ((ioMode & IO_Async)      == IO_Async); }
+    bool	 isTranslated()	      const { return ((ioMode & IO_Translate)  == IO_Translate); }
+    bool	 isReadable()	      const { return ((ioMode & IO_ReadOnly)   == IO_ReadOnly); }
+    bool	 isWritable()	      const { return ((ioMode & IO_WriteOnly)  == IO_WriteOnly); }
+    bool	 isReadWrite()	      const { return ((ioMode & IO_ReadWrite)  == IO_ReadWrite); }
+    bool	 isInactive()	      const { return state() == 0; }
+    bool	 isOpen()	      const { return state() == IO_Open; }
+
+    int		 status() const { return ioSt; }
+    void	 resetStatus()	{ ioSt = IO_Ok; }
+
+    virtual bool open( int mode ) = 0;
+    virtual void close() = 0;
+    virtual void flush() = 0;
+
+    virtual uint size()	  const = 0;
+    virtual int	 at()	  const;
+    virtual bool at( int );
+    virtual bool atEnd()  const;
+    bool	 reset() { return at(0); }
+
+    virtual int	 readBlock( char *data, uint maxlen ) = 0;
+    virtual int	 writeBlock( const char *data, uint len ) = 0;
+    virtual int	 readLine( char *data, uint maxlen );
+    int writeBlock( const QByteArray& data );
+    QByteArray readAll();
+
+    virtual int	 getch() = 0;
+    virtual int	 putch( int ) = 0;
+    virtual int	 ungetch( int ) = 0;
+
+protected:
+    void	 setFlags( int f ) { ioMode = f; }
+    void	 setType( int );
+    void	 setMode( int );
+    void	 setState( int );
+    void	 setStatus( int );
+    int		 ioIndex;
+
+private:
+    int		 ioMode;
+    int		 ioSt;
+
+private:	// Disabled copy constructor and operator=
+#if defined(Q_DISABLE_COPY)
+    QIODevice( const QIODevice & );
+    QIODevice &operator=( const QIODevice & );
+#endif
+};
+
+
+#endif // QIODEVICE_H
diff --git a/WebCore/kwq/qt/_qlist.h b/WebCore/kwq/qt/_qlist.h
new file mode 100644
index 0000000..1a9a25d
--- /dev/null
+++ b/WebCore/kwq/qt/_qlist.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of QList template/macro class
+**
+** Created : 920701
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QLIST_H
+#define QLIST_H
+
+#ifndef QT_H
+#include "_qglist.h"
+#endif // QT_H
+
+
+template<class type> class Q_EXPORT QList : public QGList
+{
+public:
+    QList()				{}
+    QList( const QList<type> &l ) : QGList(l) {}
+   ~QList()				{ clear(); }
+    QList<type> &operator=(const QList<type> &l)
+			{ return (QList<type>&)QGList::operator=(l); }
+    bool operator==( const QList<type> &list ) const
+    { return QGList::operator==( list ); }
+    uint  count()   const		{ return QGList::count(); }
+    bool  isEmpty() const		{ return QGList::count() == 0; }
+    bool  insert( uint i, const type *d){ return QGList::insertAt(i,(QCollection::Item)d); }
+    void  inSort( const type *d )	{ QGList::inSort((QCollection::Item)d); }
+    void  prepend( const type *d )	{ QGList::insertAt(0,(QCollection::Item)d); }
+    void  append( const type *d )	{ QGList::append((QCollection::Item)d); }
+    bool  remove( uint i )		{ return QGList::removeAt(i); }
+    bool  remove()			{ return QGList::remove((QCollection::Item)0); }
+    bool  remove( const type *d )	{ return QGList::remove((QCollection::Item)d); }
+    bool  removeRef( const type *d )	{ return QGList::removeRef((QCollection::Item)d); }
+    void  removeNode( QLNode *n )	{ QGList::removeNode(n); }
+    bool  removeFirst()			{ return QGList::removeFirst(); }
+    bool  removeLast()			{ return QGList::removeLast(); }
+    type *take( uint i )		{ return (type *)QGList::takeAt(i); }
+    type *take()			{ return (type *)QGList::take(); }
+    type *takeNode( QLNode *n )		{ return (type *)QGList::takeNode(n); }
+    void  clear()			{ QGList::clear(); }
+    void  sort()			{ QGList::sort(); }
+    int	  find( const type *d )		{ return QGList::find((QCollection::Item)d); }
+    int	  findNext( const type *d )	{ return QGList::find((QCollection::Item)d,FALSE); }
+    int	  findRef( const type *d )	{ return QGList::findRef((QCollection::Item)d); }
+    int	  findNextRef( const type *d ){ return QGList::findRef((QCollection::Item)d,FALSE);}
+    uint  contains( const type *d ) const { return QGList::contains((QCollection::Item)d); }
+    uint  containsRef( const type *d ) const
+					{ return QGList::containsRef((QCollection::Item)d); }
+    type *at( uint i )			{ return (type *)QGList::at(i); }
+    int	  at() const			{ return QGList::at(); }
+    type *current()  const		{ return (type *)QGList::get(); }
+    QLNode *currentNode()  const	{ return QGList::currentNode(); }
+    type *getFirst() const		{ return (type *)QGList::cfirst(); }
+    type *getLast()  const		{ return (type *)QGList::clast(); }
+    type *first()			{ return (type *)QGList::first(); }
+    type *last()			{ return (type *)QGList::last(); }
+    type *next()			{ return (type *)QGList::next(); }
+    type *prev()			{ return (type *)QGList::prev(); }
+    void  toVector( QGVector *vec )const{ QGList::toVector(vec); }
+private:
+    void  deleteItem( QCollection::Item d );
+};
+
+#if defined(Q_DELETING_VOID_UNDEFINED)
+template<> inline void QList<void>::deleteItem( QCollection::Item )
+{
+}
+#endif
+
+template<class type> inline void QList<type>::deleteItem( QCollection::Item d )
+{
+    if ( del_item ) delete (type *)d;
+}
+
+
+template<class type> class Q_EXPORT QListIterator : public QGListIterator
+{
+public:
+    QListIterator(const QList<type> &l) :QGListIterator((QGList &)l) {}
+   ~QListIterator()	      {}
+    uint  count()   const     { return list->count(); }
+    bool  isEmpty() const     { return list->count() == 0; }
+    bool  atFirst() const     { return QGListIterator::atFirst(); }
+    bool  atLast()  const     { return QGListIterator::atLast(); }
+    type *toFirst()	      { return (type *)QGListIterator::toFirst(); }
+    type *toLast()	      { return (type *)QGListIterator::toLast(); }
+    operator type *() const   { return (type *)QGListIterator::get(); }
+    type *operator*()         { return (type *)QGListIterator::get(); }
+
+    // No good, since QList<char> (ie. QStrList fails...
+    //
+    // MSVC++ gives warning
+    // Sunpro C++ 4.1 gives error
+    //    type *operator->()        { return (type *)QGListIterator::get(); }
+
+    type *current()   const   { return (type *)QGListIterator::get(); }
+    type *operator()()	      { return (type *)QGListIterator::operator()();}
+    type *operator++()	      { return (type *)QGListIterator::operator++(); }
+    type *operator+=(uint j)  { return (type *)QGListIterator::operator+=(j);}
+    type *operator--()	      { return (type *)QGListIterator::operator--(); }
+    type *operator-=(uint j)  { return (type *)QGListIterator::operator-=(j);}
+    QListIterator<type>& operator=(const QListIterator<type>&it)
+			      { QGListIterator::operator=(it); return *this; }
+};
+
+
+#endif // QLIST_H
diff --git a/WebCore/kwq/qt/_qcollection.h b/WebCore/kwq/qt/_qsortedlist.h
similarity index 59%
copy from WebCore/kwq/qt/_qcollection.h
copy to WebCore/kwq/qt/_qsortedlist.h
index 63d676e..7b90da6 100644
--- a/WebCore/kwq/qt/_qcollection.h
+++ b/WebCore/kwq/qt/_qsortedlist.h
@@ -1,9 +1,9 @@
 /****************************************************************************
 ** $Id$
 **
-** Definition of base class for all collection classes
+** Definition of QList template/macro class
 **
-** Created : 920629
+** Created : 920701
 **
 ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
 **
@@ -35,40 +35,25 @@
 **
 **********************************************************************/
 
-#ifndef QCOLLECTION_H
-#define QCOLLECTION_H
+#ifndef QSORTEDLIST_H
+#define QSORTEDLIST_H
 
-// KWQ hacks ---------------------------------------------------------------
+#ifndef QT_H
+#include "qlist.h"
+#endif // QT_H
 
-#include <KWQDef.h>
 
-// -------------------------------------------------------------------------
-
-class QGVector;
-class QGList;
-class QGDict;
-
-class Q_EXPORT QCollection			// inherited by all collections
+template<class type> class Q_EXPORT QSortedList : public QList<type>
 {
 public:
-    bool autoDelete()	const	       { return del_item; }
-    void setAutoDelete( bool enable )  { del_item = enable; }
-
-    virtual uint  count() const = 0;
-    virtual void  clear() = 0;			// delete all objects
-
-    typedef void *Item;				// generic collection item
-
-protected:
-    QCollection() { del_item = FALSE; }		// no deletion of objects
-    QCollection(const QCollection &) { del_item = FALSE; }
-    virtual ~QCollection() {}
-
-    bool del_item;				// default FALSE
-
-    virtual Item     newItem( Item );		// create object
-    virtual void     deleteItem( Item );	// delete object
+    QSortedList() {}
+    QSortedList( const QSortedList<type> &l ) : QList<type>(l) {}
+    ~QSortedList() { clear(); }
+    QSortedList<type> &operator=(const QSortedList<type> &l)
+      { return (QSortedList<type>&)QList<type>::operator=(l); }
+
+    virtual int compareItems( QCollection::Item s1, QCollection::Item s2 )
+      { if ( *((type*)s1) == *((type*)s2) ) return 0; return ( *((type*)s1) < *((type*)s2) ? -1 : 1 ); }
 };
 
-
-#endif // QCOLLECTION_H
+#endif
diff --git a/WebCore/kwq/qt/_qstringlist.cpp b/WebCore/kwq/qt/_qstringlist.cpp
new file mode 100644
index 0000000..8854008
--- /dev/null
+++ b/WebCore/kwq/qt/_qstringlist.cpp
@@ -0,0 +1,306 @@
+/****************************************************************************
+** $Id$
+**
+** Implementation of QStringList
+**
+** Created : 990406
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "qstringlist.h"
+
+#ifndef QT_NO_STRINGLIST
+#include "_qstrlist.h"
+
+#ifndef QT_NO_DATASTREAM
+#include "qdatastream.h"
+#endif
+
+#include "_qtl.h"
+
+// NOT REVISED
+/*!
+  \class QStringList qstringlist.h
+  \brief A list of strings.
+
+  \ingroup qtl
+  \ingroup tools
+  \ingroup shared
+
+  QStringList is basically a QValueList of QString objects. As opposed
+  to QStrList, that stores pointers to characters, QStringList deals
+  with real QString objects.  It is the class of choice whenever you
+  work with unicode strings.
+
+  Like QString itself, QStringList objects are implicit shared.
+  Passing them around as value-parameters is both fast and safe.
+
+  Example:
+  \code
+	QStringList list;
+
+	// three different ways of appending values:
+	list.append( "Torben");
+	list += "Warwick";
+	list << "Matthias" << "Arnt" << "Paul";
+
+	// sort the list, Arnt's now first
+	list.sort();
+
+	// print it out
+	for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
+	    printf( "%s \n", (*it).latin1() );
+	}
+  \endcode
+
+  Convenience methods such as sort(), split(), join() and grep() make
+  working with QStringList easy.
+*/
+
+/*!
+ \fn QStringList::QStringList()
+  Creates an empty list.
+*/
+
+/*! \fn QStringList::QStringList( const QStringList& l )
+  Creates a copy of the list. This function is very fast since
+  QStringList is implicit shared. However, for the programmer this
+  is the same as a deep copy. If this list or the original one or some
+  other list referencing the same shared data is modified, then the
+  modifying list makes a copy first.
+*/
+
+/*!
+  \fn QStringList::QStringList (const QString & i)
+  Constructs a string list consisting of the single string \a i.
+  To make longer lists easily, use:
+  \code
+    QString s1,s2,s3;
+    ...
+    QStringList mylist = QStringList() << s1 << s2 << s3;
+  \endcode
+*/
+
+/*!
+  \fn QStringList::QStringList (const char* i)
+  Constructs a string list consisting of the single latin-1 string \a i.
+*/
+
+/*! \fn QStringList::QStringList( const QValueList<QString>& l )
+
+  Constructs a new string list that is a copy of \a l.
+*/
+
+/*!
+  Sorts the list of strings in ascending order.
+
+  Sorting is very fast. It uses the Qt Template Library's
+  efficient HeapSort implementation that operates in O(n*log n).
+*/
+void QStringList::sort()
+{
+    qHeapSort(*this);
+}
+
+/*!
+  Splits the string \a str using \a sep as separator. Returns the
+  list of strings. If \a allowEmptyEntries is TRUE, also empty
+  entries are inserted into the list, else not. So if you have
+  a string 'abc..d.e.', a list which contains 'abc', 'd', and 'e'
+  would be returned if \a allowEmptyEntries is FALSE, but
+  a list containing 'abc', '', 'd', 'e' and '' would be returned if
+  \a allowEmptyEntries is TRUE.
+  If \a str doesn't contain \a sep, a stringlist
+  with one item, which is the same as \a str, is returned.
+
+  \sa join()
+*/
+
+QStringList QStringList::split( const QChar &sep, const QString &str, bool allowEmptyEntries )
+{
+    return split( QString( sep ), str, allowEmptyEntries );
+}
+
+/*!
+  Splits the string \a str using \a sep as separator. Returns the
+  list of strings. If \a allowEmptyEntries is TRUE, also empty
+  entries are inserted into the list, else not. So if you have
+  a string 'abc..d.e.', a list which contains 'abc', 'd', and 'e'
+  would be returned if \a allowEmptyEntries is FALSE, but
+  a list containing 'abc', '', 'd', 'e' and '' would be returned if
+  \a allowEmptyEntries is TRUE.
+  If \a str doesn't contain \a sep, a stringlist
+  with one item, which is the same as \a str, is returned.
+
+  \sa join()
+*/
+
+QStringList QStringList::split( const QString &sep, const QString &str, bool allowEmptyEntries )
+{
+    QStringList lst;
+
+    int j = 0;
+    int i = str.find( sep, j );
+
+    while ( i != -1 ) {
+	if ( str.mid( j, i - j ).length() > 0 )
+	    lst << str.mid( j, i - j );
+	else if ( allowEmptyEntries )
+	    lst << QString::null;
+	j = i + sep.length();
+	i = str.find( sep, j );
+    }
+
+    int l = str.length() - 1;
+    if ( str.mid( j, l - j + 1 ).length() > 0 )
+	lst << str.mid( j, l - j + 1 );
+    else if ( allowEmptyEntries )
+	lst << QString::null;
+
+    return lst;
+}
+
+/*!
+  Splits the string \a str using the regular expression \a sep as separator. Returns the
+  list of strings. If \a allowEmptyEntries is TRUE, also empty
+  entries are inserted into the list, else not. So if you have
+  a string 'abc..d.e.', a list which contains 'abc', 'd', and 'e'
+  would be returned if \a allowEmptyEntries is FALSE, but
+  a list containing 'abc', '', 'd', 'e' and '' would be returned if
+  \a allowEmptyEntries is TRUE.
+  If \a str doesn't contain \a sep, a stringlist
+  with one item, which is the same as \a str, is returned.
+
+  \sa join()
+*/
+
+QStringList QStringList::split( const QRegExp &sep, const QString &str, bool allowEmptyEntries )
+{
+    QStringList lst;
+
+    int j = 0;
+    int len = 0;
+    int i = sep.match( str, j, &len );
+
+    while ( i != -1 ) {
+	if ( str.mid( j, i - j ).length() > 0 )
+	    lst << str.mid( j, i - j );
+	else if ( allowEmptyEntries )
+	    lst << QString::null;
+	j = i + len;
+	i = sep.match( str, j, &len );
+    }
+
+    int l = str.length() - 1;
+    if ( str.mid( j, l - j + 1 ).length() > 0 )
+	lst << str.mid( j, l - j + 1 );
+    else if ( allowEmptyEntries )
+	lst << QString::null;
+
+    return lst;
+}
+
+/*!
+  Returns a list of all strings containing the substring \a str.
+
+  If \a cs is TRUE, the grep is done case sensitively, else not.
+*/
+
+QStringList QStringList::grep( const QString &str, bool cs ) const
+{
+    QStringList res;
+    for ( QStringList::ConstIterator it = begin(); it != end(); ++it )
+	if ( (*it).contains( str, cs ) )
+	    res << *it;
+
+    return res;
+}
+
+/*!
+  Returns a list of all strings containing a substring that matches
+  the regular expression \a expr.
+*/
+
+QStringList QStringList::grep( const QRegExp &expr ) const
+{
+    QStringList res;
+    for ( QStringList::ConstIterator it = begin(); it != end(); ++it )
+	if ( (*it).contains( expr ) )
+	    res << *it;
+
+    return res;
+}
+
+/*!
+  Joins the stringlist into a single string with each element
+  separated by \a sep.
+
+  \sa split()
+*/
+QString QStringList::join( const QString &sep ) const
+{
+    QString res;
+    bool alredy = FALSE;
+    for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
+	if ( alredy )
+	    res += sep;
+	alredy = TRUE;
+	res += *it;
+    }
+
+    return res;
+}
+
+#ifndef QT_NO_DATASTREAM
+Q_EXPORT QDataStream &operator>>( QDataStream & s, QStringList& l )
+{
+    return s >> (QValueList<QString>&)l;
+}
+
+Q_EXPORT QDataStream &operator<<( QDataStream & s, const QStringList& l )
+{
+    return s << (const QValueList<QString>&)l;
+}
+#endif
+
+/*!
+  Converts from a QStrList (ASCII) to a QStringList (Unicode).
+*/
+QStringList QStringList::fromStrList(const QStrList& ascii)
+{
+    QStringList res;
+    const char * s;
+    for ( QStrListIterator it(ascii); (s=it.current()); ++it )
+	res << s;
+    return res;
+}
+
+#endif //QT_NO_STRINGLIST
diff --git a/WebCore/kwq/qt/_qstack.h b/WebCore/kwq/qt/_qstringlist.h
similarity index 52%
copy from WebCore/kwq/qt/_qstack.h
copy to WebCore/kwq/qt/_qstringlist.h
index 2958a42..04d11c6 100644
--- a/WebCore/kwq/qt/_qstack.h
+++ b/WebCore/kwq/qt/_qstringlist.h
@@ -1,9 +1,9 @@
 /****************************************************************************
 ** $Id$
 **
-** Definition of QStack template/macro class
+** Definition of QStringList class
 **
-** Created : 920917
+** Created : 990406
 **
 ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
 **
@@ -35,36 +35,47 @@
 **
 **********************************************************************/
 
-#ifndef QSTACK_H
-#define QSTACK_H
+#ifndef QSTRINGLIST_H
+#define QSTRINGLIST_H
 
 #ifndef QT_H
-#include "_qglist.h"
+#include "qvaluelist.h"
+#include "qstring.h"
+#include "qregexp.h"
 #endif // QT_H
 
+#ifndef QT_NO_STRINGLIST
 
-template<class type> class QStack : private QGList
+class QStrList;
+
+class Q_EXPORT QStringList : public QValueList<QString>
 {
 public:
-    QStack()				{}
-    QStack( const QStack<type> &s ) : QGList(s) {}
-   ~QStack()				{ clear(); }
-    QStack<type> &operator=(const QStack<type> &s)
-			{ return (QStack<type>&)QGList::operator=(s); }
-    bool  autoDelete() const		{ return QCollection::autoDelete(); }
-    void  setAutoDelete( bool del )	{ QCollection::setAutoDelete(del); }
-    uint  count()   const		{ return QGList::count(); }
-    bool  isEmpty() const		{ return QGList::count() == 0; }
-    void  push( const type *d )		{ QGList::insertAt(0,Item(d)); }
-    type *pop()				{ return (type *)QGList::takeFirst(); }
-    bool  remove()			{ return QGList::removeFirst(); }
-    void  clear()			{ QGList::clear(); }
-    type *top()	    const		{ return (type *)QGList::cfirst(); }
-	  operator type *() const	{ return (type *)QGList::cfirst(); }
-    type *current() const		{ return (type *)QGList::cfirst(); }
-private:
-    void  deleteItem( Item d ) { if ( del_item ) delete (type *)d; }
-};
+    QStringList() { }
+    QStringList( const QStringList& l ) : QValueList<QString>(l) { }
+    QStringList( const QValueList<QString>& l ) : QValueList<QString>(l) { }
+    QStringList( const QString& i ) { append(i); }
+#ifndef QT_NO_CAST_ASCII
+    QStringList( const char* i ) { append(i); }
+#endif
+
+    static QStringList fromStrList(const QStrList&);
 
+    void sort();
+
+    static QStringList split( const QString &sep, const QString &str, bool allowEmptyEntries = FALSE );
+    static QStringList split(  const QChar &sep, const QString &str, bool allowEmptyEntries = FALSE );
+    static QStringList split(  const QRegExp &sep, const QString &str, bool allowEmptyEntries = FALSE );
+    QString join( const QString &sep ) const;
+
+    QStringList grep( const QString &str, bool cs = TRUE ) const;
+    QStringList grep( const QRegExp &expr ) const;
+};
 
-#endif // QSTACK_H
+#ifndef QT_NO_DATASTREAM
+class QDataStream;
+extern Q_EXPORT QDataStream &operator>>( QDataStream &, QStringList& );
+extern Q_EXPORT QDataStream &operator<<( QDataStream &, const QStringList& );
+#endif
+#endif // QT_NO_STRINGLIST
+#endif // QSTRINGLIST_H
diff --git a/WebCore/kwq/qt/_qstrlist.h b/WebCore/kwq/qt/_qstrlist.h
new file mode 100644
index 0000000..cf4caef
--- /dev/null
+++ b/WebCore/kwq/qt/_qstrlist.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of QStrList, QStrIList and QStrListIterator classes
+**
+** Created : 920730
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QSTRLIST_H
+#define QSTRLIST_H
+
+#ifndef QT_H
+#include "qstring.h"
+#include "qlist.h"
+
+#ifndef QT_NO_DATASTREAM
+#include "qdatastream.h"
+#endif
+
+#endif // QT_H
+
+
+#if defined(Q_TEMPLATEDLL)
+template class Q_EXPORT QList<char>;
+template class Q_EXPORT QListIterator<char>;
+#endif
+
+typedef QList<char>		QStrListBase;
+typedef QListIterator<char>	QStrListIterator;
+
+
+class Q_EXPORT QStrList : public QStrListBase
+{
+public:
+    QStrList( bool deepCopies=TRUE ) { dc = deepCopies; del_item = deepCopies; }
+    QStrList( const QStrList & );
+   ~QStrList()			{ clear(); }
+    QStrList& operator=( const QStrList & );
+
+private:
+    QCollection::Item newItem( QCollection::Item d ) { return dc ? qstrdup( (const char*)d ) : d; }
+    void deleteItem( QCollection::Item d ) { if ( del_item ) delete[] (char*)d; }
+    int compareItems( QCollection::Item s1, QCollection::Item s2 ) { return qstrcmp((const char*)s1,
+							 (const char*)s2); }
+#ifndef QT_NO_DATASTREAM
+    QDataStream &read( QDataStream &s, QCollection::Item &d )
+				{ s >> (char *&)d; return s; }
+    QDataStream &write( QDataStream &s, QCollection::Item d ) const
+				{ return s << (const char *)d; }
+#endif
+    bool  dc;
+};
+
+
+class Q_EXPORT QStrIList : public QStrList	// case insensitive string list
+{
+public:
+    QStrIList( bool deepCopies=TRUE ) : QStrList( deepCopies ) {}
+   ~QStrIList()			{ clear(); }
+private:
+    int	  compareItems( QCollection::Item s1, QCollection::Item s2 )
+				{ return qstricmp((const char*)s1,
+						    (const char*)s2); }
+};
+
+
+inline QStrList & QStrList::operator=( const QStrList &strList )
+{
+    clear();
+    dc = strList.dc;
+    del_item = dc;
+    QStrListBase::operator=(strList);
+    return *this;
+}
+
+inline QStrList::QStrList( const QStrList &strList )
+    : QStrListBase( strList )
+{
+    dc = FALSE;
+    operator=(strList);
+}
+
+
+#endif // QSTRLIST_H
diff --git a/WebCore/kwq/qt/_qtextstream.h b/WebCore/kwq/qt/_qtextstream.h
new file mode 100644
index 0000000..d1182ac
--- /dev/null
+++ b/WebCore/kwq/qt/_qtextstream.h
@@ -0,0 +1,2 @@
+// This file is empty for now until we can put in some support
+// for Qt I/O devices
diff --git a/WebCore/kwq/qt/_qtl.h b/WebCore/kwq/qt/_qtl.h
new file mode 100644
index 0000000..3b3b082
--- /dev/null
+++ b/WebCore/kwq/qt/_qtl.h
@@ -0,0 +1,227 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of Qt template library classes
+**
+** Created : 990128
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef QTL_H
+#define QTL_H
+
+#ifndef QT_H
+
+#ifndef QT_NO_TEXTSTREAM
+#include "qtextstream.h"
+#endif
+
+#include "qstring.h"
+#endif // QT_H
+
+#ifndef QT_NO_TEXTSTREAM
+template <class T>
+class QTextOStreamIterator
+{
+protected:
+    QTextOStream& stream;
+    QString separator;
+
+public:
+    QTextOStreamIterator( QTextOStream& s) : stream( s ) {}
+    QTextOStreamIterator( QTextOStream& s, const QString& sep )
+	: stream( s ), separator( sep )  {}
+    QTextOStreamIterator<T>& operator= ( const T& x ) {
+	stream << x;
+	if ( !separator.isEmpty() )
+	    stream << separator;
+	return *this;
+    }
+    QTextOStreamIterator<T>& operator*() { return *this; }
+    QTextOStreamIterator<T>& operator++() { return *this; }
+    QTextOStreamIterator<T>& operator++(int) { return *this; }
+};
+#endif //QT_NO_TEXTSTREAM
+
+template <class InputIterator, class OutputIterator>
+inline OutputIterator qCopy( InputIterator _begin, InputIterator _end,
+			     OutputIterator _dest )
+{
+    while( _begin != _end )
+	*_dest++ = *_begin++;
+    return _dest;
+}
+
+
+template <class T>
+inline void qSwap( T& _value1, T& _value2 )
+{
+    T tmp = _value1;
+    _value1 = _value2;
+    _value2 = tmp;
+}
+
+
+template <class InputIterator>
+inline void qBubbleSort( InputIterator b, InputIterator e )
+{
+    // Goto last element;
+    InputIterator last = e;
+    --last;
+    // only one element or no elements ?
+    if ( last == b )
+	return;
+
+    // So we have at least two elements in here
+    while( b != last ) {
+	bool swapped = FALSE;
+	InputIterator swap_pos = b;
+	InputIterator x = e;
+	InputIterator y = x;
+	y--;
+	do {
+	    --x;
+	    --y;
+	    if ( *x < *y ) {
+		swapped = TRUE;
+		qSwap( *x, *y );
+		swap_pos = y;
+	    }
+	} while( y != b );
+	if ( !swapped )
+	    return;
+	b = swap_pos;
+	b++;
+    }
+}
+
+
+template <class Container>
+inline void qBubbleSort( Container &c )
+{
+  qBubbleSort( c.begin(), c.end() );
+}
+
+
+template <class Value>
+inline void qHeapSortPushDown( Value* heap, int first, int last )
+{
+    int r = first;
+    while( r <= last/2 ) {
+	// Node r has only one child ?
+	if ( last == 2*r ) {
+	    // Need for swapping ?
+	    if ( heap[r] > heap[ 2*r ] )
+		qSwap( heap[r], heap[ 2*r ] );
+	    // That's it ...
+	    r = last;
+	} else { // Node has two children
+	    if ( heap[r] > heap[ 2*r ] && heap[ 2*r ] <= heap[ 2*r+1 ] ) {
+		// Swap with left child
+		qSwap( heap[r], heap[ 2*r ] );
+		r *= 2;
+	    } else if ( heap[r] > heap[ 2*r+1 ] &&
+			heap[ 2*r+1 ] < heap[ 2*r ] ) {
+		// Swap with right child
+		qSwap( heap[r], heap[ 2*r+1 ] );
+		r = 2*r+1;
+	    } else {
+		// We are done
+		r = last;
+	    }
+	}
+    }
+}
+
+
+template <class InputIterator, class Value>
+inline void qHeapSortHelper( InputIterator b, InputIterator e, Value, uint n )
+{
+    // Create the heap
+    InputIterator insert = b;
+    Value* realheap = new Value[ n ];
+    // Wow, what a fake. But I want the heap to be indexed as 1...n
+    Value* heap = realheap - 1;
+    int size = 0;
+    for( ; insert != e; ++insert ) {
+	heap[++size] = *insert;
+	int i = size;
+	while( i > 1 && heap[i] < heap[ i / 2 ] ) {
+	    qSwap( heap[i], heap[ i / 2 ] );
+	    i /= 2;
+	}
+    }
+
+    // Now do the sorting
+    for( uint i = n; i > 0; i-- ) {
+	*b++ = heap[1];
+	if ( i > 1 ) {
+	    heap[1] = heap[i];
+	    qHeapSortPushDown( heap, 1, (int)i - 1 );
+	}
+    }
+
+    delete[] realheap;
+}
+
+
+template <class InputIterator>
+inline void qHeapSort( InputIterator b, InputIterator e )
+{
+    // Empty ?
+    if ( b == e )
+	return;
+
+    // How many entries have to be sorted ?
+    InputIterator it = b;
+    uint n = 0;
+    while ( it != e ) {
+	++n;
+	++it;
+    }
+
+    // The second last parameter is a hack to retrieve the value type
+    // Do the real sorting here
+    qHeapSortHelper( b, e, *b, n );
+}
+
+
+template <class Container>
+inline void qHeapSort( Container &c )
+{
+    if ( c.isEmpty() )
+	return;
+
+    // The second last parameter is a hack to retrieve the value type
+    // Do the real sorting here
+    qHeapSortHelper( c.begin(), c.end(), *(c.begin()), c.count() );
+}
+
+#endif
diff --git a/WebCore/kwq/qt/_qvaluelist.h b/WebCore/kwq/qt/_qvaluelist.h
new file mode 100644
index 0000000..28231c5
--- /dev/null
+++ b/WebCore/kwq/qt/_qvaluelist.h
@@ -0,0 +1,453 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of QValueList class
+**
+** Created : 990406
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QVALUELIST_H
+#define QVALUELIST_H
+
+#ifndef QT_H
+#include "_qshared.h"
+
+#ifndef QT_NO_DATASTREAM
+#include "qdatastream.h"
+#endif
+
+#endif // QT_H
+
+#if defined(_CC_MSVC_)
+#pragma warning(disable:4284) // "return type for operator -> is not a UDT"
+#endif
+
+template <class T>
+class Q_EXPORT QValueListNode
+{
+public:
+    QValueListNode( const T& t ) : data( t ) { }
+    QValueListNode() { }
+#if defined(Q_TEMPLATEDLL)
+    // Workaround MS bug in memory de/allocation in DLL vs. EXE 
+    virtual ~QValueListNode() { }
+#endif
+
+    QValueListNode<T>* next;
+    QValueListNode<T>* prev;
+    T data;
+};
+
+template<class T>
+class Q_EXPORT QValueListIterator
+{
+ public:
+    /**
+     * Typedefs
+     */
+    typedef QValueListNode<T>* NodePtr;
+
+    /**
+     * Variables
+     */
+    NodePtr node;
+
+    /**
+     * Functions
+     */
+    QValueListIterator() : node( 0 ) {}
+    QValueListIterator( NodePtr p ) : node( p ) {}
+    QValueListIterator( const QValueListIterator<T>& it ) : node( it.node ) {}
+
+    bool operator==( const QValueListIterator<T>& it ) const { return node == it.node; }
+    bool operator!=( const QValueListIterator<T>& it ) const { return node != it.node; }
+    const T& operator*() const { return node->data; }
+    T& operator*() { return node->data; }
+
+    // Compilers are too dumb to understand this for QValueList<int>
+    //T* operator->() const { return &(node->data); }
+
+    QValueListIterator<T>& operator++() {
+	node = node->next;
+	return *this;
+    }
+
+    QValueListIterator<T> operator++(int) {
+	QValueListIterator<T> tmp = *this;
+	node = node->next;
+	return tmp;
+    }
+
+    QValueListIterator<T>& operator--() {
+	node = node->prev;
+	return *this;
+    }
+
+    QValueListIterator<T> operator--(int) {
+	QValueListIterator<T> tmp = *this;
+	node = node->prev;
+	return tmp;
+    }
+};
+
+template<class T>
+class Q_EXPORT QValueListConstIterator
+{
+ public:
+    /**
+     * Typedefs
+     */
+    typedef QValueListNode<T>* NodePtr;
+
+    /**
+     * Variables
+     */
+    NodePtr node;
+
+    /**
+     * Functions
+     */
+    QValueListConstIterator() : node( 0 ) {}
+    QValueListConstIterator( NodePtr p ) : node( p ) {}
+    QValueListConstIterator( const QValueListConstIterator<T>& it ) : node( it.node ) {}
+    QValueListConstIterator( const QValueListIterator<T>& it ) : node( it.node ) {}
+
+    bool operator==( const QValueListConstIterator<T>& it ) const { return node == it.node; }
+    bool operator!=( const QValueListConstIterator<T>& it ) const { return node != it.node; }
+    const T& operator*() const { return node->data; }
+
+    // Compilers are too dumb to understand this for QValueList<int>
+    //const T* operator->() const { return &(node->data); }
+
+    QValueListConstIterator<T>& operator++() {
+	node = node->next;
+	return *this;
+    }
+
+    QValueListConstIterator<T> operator++(int) {
+	QValueListConstIterator<T> tmp = *this;
+	node = node->next;
+	return tmp;
+    }
+
+    QValueListConstIterator<T>& operator--() {
+	node = node->prev;
+	return *this;
+    }
+
+    QValueListConstIterator<T> operator--(int) {
+	QValueListConstIterator<T> tmp = *this;
+	node = node->prev;
+	return tmp;
+    }
+};
+
+template <class T>
+class Q_EXPORT QValueListPrivate : public QShared
+{
+public:
+    /**
+     * Typedefs
+     */
+    typedef QValueListIterator<T> Iterator;
+    typedef QValueListConstIterator<T> ConstIterator;
+    typedef QValueListNode<T> Node;
+    typedef QValueListNode<T>* NodePtr;
+
+    /**
+     * Functions
+     */
+    QValueListPrivate() { node = new Node; node->next = node->prev = node; nodes = 0; }
+    QValueListPrivate( const QValueListPrivate<T>& _p ) : QShared() {
+	node = new Node; node->next = node->prev = node; nodes = 0;
+	Iterator b( _p.node->next );
+	Iterator e( _p.node );
+	Iterator i( node );
+	while( b != e )
+	    insert( i, *b++ );
+    }
+
+    void derefAndDelete() // ### hack to get around hp-cc brain damage
+    {
+	if ( deref() )
+	    delete this;
+    }
+
+#if defined(Q_TEMPLATEDLL)
+    // Workaround MS bug in memory de/allocation in DLL vs. EXE 
+    virtual
+#endif
+    ~QValueListPrivate() {
+	NodePtr p = node->next;
+	while( p != node ) {
+	    NodePtr x = p->next;
+	    delete p;
+	    p = x;
+	}
+	delete node;
+    }
+
+    Iterator insert( Iterator it, const T& x ) {
+	NodePtr p = new Node( x );
+	p->next = it.node;
+	p->prev = it.node->prev;
+	it.node->prev->next = p;
+	it.node->prev = p;
+	nodes++;
+	return p;
+    }
+
+    Iterator remove( Iterator it ) {
+	ASSERT ( it.node != node );
+	NodePtr next = it.node->next;
+	NodePtr prev = it.node->prev;
+	prev->next = next;
+	next->prev = prev;
+	delete it.node;
+	nodes--;
+	return Iterator( next );
+    }
+
+    NodePtr find( NodePtr start, const T& x ) const {
+	ConstIterator first( start );
+	ConstIterator last( node );
+	while( first != last) {
+	    if ( *first == x )
+		return first.node;
+	    ++first;
+	}
+	return last.node;
+    }
+
+    int findIndex( NodePtr start, const T& x ) const {
+	ConstIterator first( start );
+	ConstIterator last( node );
+	int pos = 0;
+	while( first != last) {
+	    if ( *first == x )
+		return pos;
+	    ++first;
+	    ++pos;
+	}
+	return -1;
+    }
+
+    uint contains( const T& x ) const {
+	uint result = 0;
+	Iterator first = Iterator( node->next );
+	Iterator last = Iterator( node );
+	while( first != last) {
+	    if ( *first == x )
+		++result;
+	    ++first;
+	}
+	return result;
+    }
+
+    void remove( const T& x ) {
+	Iterator first = Iterator( node->next );
+	Iterator last = Iterator( node );
+	while( first != last) {
+	    if ( *first == x )
+		first = remove( first );
+	    else
+		++first;
+	}
+    }
+
+    NodePtr at( uint i ) const {
+	ASSERT( i <= nodes );
+	NodePtr p = node->next;
+	for( uint x = 0; x < i; ++x )
+	    p = p->next;
+	return p;
+    }
+
+    void clear() {
+	nodes = 0;
+	NodePtr p = node->next;
+	while( p != node ) {
+	    NodePtr next = p->next;
+	    delete p;
+	    p = next;
+	}
+	node->next = node->prev = node;
+    }
+
+    NodePtr node;
+    uint nodes;
+};
+
+template <class T>
+class Q_EXPORT QValueList
+{
+public:
+    /**
+     * Typedefs
+     */
+    typedef QValueListIterator<T> Iterator;
+    typedef QValueListConstIterator<T> ConstIterator;
+    typedef T ValueType;
+
+    /**
+     * API
+     */
+    QValueList() { sh = new QValueListPrivate<T>; }
+    QValueList( const QValueList<T>& l ) { sh = l.sh; sh->ref(); }
+    ~QValueList() { sh->derefAndDelete(); }
+
+    QValueList<T>& operator= ( const QValueList<T>& l )
+    {
+	l.sh->ref();
+	sh->derefAndDelete();
+	sh = l.sh;
+	return *this;
+    }
+
+    QValueList<T> operator+ ( const QValueList<T>& l ) const
+    {
+	QValueList<T> l2( *this );
+	for( ConstIterator it = l.begin(); it != l.end(); ++it )
+	    l2.append( *it );
+	return l2;
+    }
+
+    QValueList<T>& operator+= ( const QValueList<T>& l )
+    {
+	for( ConstIterator it = l.begin(); it != l.end(); ++it )
+	    append( *it );
+	return *this;
+    }
+
+    bool operator== ( const QValueList<T>& l ) const
+    {
+	if ( count() != l.count() )
+	    return FALSE;
+	ConstIterator it2 = begin();
+	ConstIterator it = l.begin();
+	for( ; it != l.end(); ++it, ++it2 )
+	    if ( !( *it == *it2 ) )
+		return FALSE;
+	return TRUE;
+    }
+
+    bool operator!= ( const QValueList<T>& l ) const { return !( *this == l ); }
+
+    Iterator begin() { detach(); return Iterator( sh->node->next ); }
+    ConstIterator begin() const { return ConstIterator( sh->node->next ); }
+    Iterator end() { detach(); return Iterator( sh->node ); }
+    ConstIterator end() const { return ConstIterator( sh->node ); }
+    Iterator fromLast() { detach(); return Iterator( sh->node->prev ); }
+    ConstIterator fromLast() const { return ConstIterator( sh->node->prev ); }
+
+    bool isEmpty() const { return ( sh->nodes == 0 ); }
+
+    Iterator insert( Iterator it, const T& x ) { detach(); return sh->insert( it, x ); }
+
+    Iterator append( const T& x ) { detach(); return sh->insert( end(), x ); }
+    Iterator prepend( const T& x ) { detach(); return sh->insert( begin(), x ); }
+
+    Iterator remove( Iterator it ) { detach(); return sh->remove( it ); }
+    void remove( const T& x ) { detach(); sh->remove( x ); }
+
+    T& first() { detach(); return sh->node->next->data; }
+    const T& first() const { return sh->node->next->data; }
+    T& last() { detach(); return sh->node->prev->data; }
+    const T& last() const { return sh->node->prev->data; }
+
+    T& operator[] ( uint i ) { detach(); return sh->at(i)->data; }
+    const T& operator[] ( uint i ) const { return sh->at(i)->data; }
+    Iterator at( uint i ) { detach(); return Iterator( sh->at(i) ); }
+    ConstIterator at( uint i ) const { return ConstIterator( sh->at(i) ); }
+    Iterator find ( const T& x ) { detach(); return Iterator( sh->find( sh->node->next, x) ); }
+    ConstIterator find ( const T& x ) const { return ConstIterator( sh->find( sh->node->next, x) ); }
+    Iterator find ( Iterator it, const T& x ) { detach(); return Iterator( sh->find( it.node, x ) ); }
+    ConstIterator find ( ConstIterator it, const T& x ) const { return ConstIterator( sh->find( it.node, x ) ); }
+    int findIndex( const T& x ) const { return sh->findIndex( sh->node->next, x) ; }
+    uint contains( const T& x ) const { return sh->contains( x ); }
+
+    uint count() const { return sh->nodes; }
+
+    void clear() { if ( sh->count == 1 ) sh->clear(); else { sh->deref(); sh = new QValueListPrivate<T>; } }
+
+
+    QValueList<T>& operator+= ( const T& x )
+    {
+	append( x );
+	return *this;
+    }
+    QValueList<T>& operator<< ( const T& x )
+    {
+	append( x );
+	return *this;
+    }
+
+
+protected:
+    /**
+     * Helpers
+     */
+    void detach() { if ( sh->count > 1 ) { sh->deref(); sh = new QValueListPrivate<T>( *sh ); } }
+
+    /**
+     * Variables
+     */
+    QValueListPrivate<T>* sh;
+};
+
+#ifndef QT_NO_DATASTREAM
+template<class T>
+inline QDataStream& operator>>( QDataStream& s, QValueList<T>& l )
+{
+    l.clear();
+    Q_UINT32 c;
+    s >> c;
+    for( Q_UINT32 i = 0; i < c; ++i )
+    {
+	T t;
+	s >> t;
+	l.append( t );
+    }
+    return s;
+}
+
+template<class T>
+inline QDataStream& operator<<( QDataStream& s, const QValueList<T>& l )
+{
+    s << (Q_UINT32)l.count();
+    QValueListConstIterator<T> it = l.begin();
+    for( ; it != l.end(); ++it )
+	s << *it;
+    return s;
+}
+#endif // QT_NO_DATASTREAM
+#endif // QVALUELIST_H
diff --git a/WebCore/kwq/qt/qdatetime.h b/WebCore/kwq/qt/qdatetime.h
index 9ec7036..f185d3f 100644
--- a/WebCore/kwq/qt/qdatetime.h
+++ b/WebCore/kwq/qt/qdatetime.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qdatetime.h>
+#else
+
 // class QTime =================================================================
 
 class QTime {
@@ -153,4 +159,6 @@ public:
 
 }; // class QDateTime ==========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/kwq/qt/qlist.h b/WebCore/kwq/qt/qlist.h
index 5c8ae91..b0a5152 100644
--- a/WebCore/kwq/qt/qlist.h
+++ b/WebCore/kwq/qt/qlist.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qlist.h>
+#else
+
 #include <KWQDef.h>
 #include <KWQCollection.h>
 
@@ -136,4 +142,6 @@ private:
 
 }; // class QListIterator ======================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/kwq/qt/qsortedlist.h b/WebCore/kwq/qt/qsortedlist.h
index cfb570c..eee362a 100644
--- a/WebCore/kwq/qt/qsortedlist.h
+++ b/WebCore/kwq/qt/qsortedlist.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qsortedlist.h>
+#else
+
 #include "qlist.h"
 
 // class QSortedList ===========================================================
@@ -59,4 +65,6 @@ public:
 
 }; // class QSortedList ========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/kwq/qt/qstringlist.h b/WebCore/kwq/qt/qstringlist.h
index 35207db..5f339a6 100644
--- a/WebCore/kwq/qt/qstringlist.h
+++ b/WebCore/kwq/qt/qstringlist.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qstringlist.h>
+#else
+
 #include "qstring.h"
 #include "qvaluelist.h"
 
@@ -69,4 +75,6 @@ public:
 
 }; // class QStringList ========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/kwq/qt/qtextstream.h b/WebCore/kwq/qt/qtextstream.h
index e600247..d679c4b 100644
--- a/WebCore/kwq/qt/qtextstream.h
+++ b/WebCore/kwq/qt/qtextstream.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qtextstream.h>
+#else
+
 #include "qstring.h"
 
 // class QTextStream ===========================================================
@@ -159,4 +165,6 @@ private:
 
 }; // class QTextOStream =======================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/kwq/qt/qvaluelist.h b/WebCore/kwq/qt/qvaluelist.h
index 069f71a..ed60c14 100644
--- a/WebCore/kwq/qt/qvaluelist.h
+++ b/WebCore/kwq/qt/qvaluelist.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qvaluelist.h>
+#else
+
 #include <KWQDef.h>
 
 // class QValueListIterator ====================================================
@@ -158,4 +164,6 @@ public:
 
 }; // class QValueList =========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/src/kwq/qt/_qdatetime.cpp b/WebCore/src/kwq/qt/_qdatetime.cpp
new file mode 100644
index 0000000..0423f50
--- /dev/null
+++ b/WebCore/src/kwq/qt/_qdatetime.cpp
@@ -0,0 +1,1438 @@
+/****************************************************************************
+** $Id$
+**
+** Implementation of date and time classes
+**
+** Created : 940124
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#define gettimeofday	__hide_gettimeofday
+#include "qdatetime.h"
+
+#ifndef QT_NO_DATASTREAM
+#include "qdatastream.h"
+#endif
+
+#include <stdio.h>
+#include <time.h>
+#if defined(_OS_WIN32_)
+#if defined(_CC_BOOL_DEF_)
+#undef	bool
+#include <windows.h>
+#define bool int
+#else
+#include <windows.h>
+#endif
+#elif defined(_OS_MSDOS_)
+#include <dos.h>
+#elif defined(_OS_OS2_)
+#include <os2.h>
+#elif defined(_OS_UNIX_)
+#include <unistd.h>
+#include <sys/time.h>
+#undef	gettimeofday
+extern "C" int gettimeofday( struct timeval *, struct timezone * );
+#endif
+
+static const uint FIRST_DAY	= 2361222;	// Julian day for 1752/09/14
+static const int  FIRST_YEAR	= 1752;		// ### wrong for many countries
+static const uint SECS_PER_DAY	= 86400;
+static const uint MSECS_PER_DAY = 86400000;
+static const uint SECS_PER_HOUR = 3600;
+static const uint MSECS_PER_HOUR= 3600000;
+static const uint SECS_PER_MIN	= 60;
+static const uint MSECS_PER_MIN = 60000;
+
+static const short monthDays[] ={0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+
+// ##### Localize.
+
+const char * const QDate::monthNames[] = {
+    "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+const char * const QDate::weekdayNames[] ={
+    "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
+
+
+/*****************************************************************************
+  QDate member functions
+ *****************************************************************************/
+
+// REVISED: aavit
+
+/*!
+  \class QDate qdatetime.h
+  \brief The QDate class provides date functions.
+
+  \ingroup time
+
+  A QDate object contains a calendar date, i.e. year, month, and day
+  numbers in the modern western (Gregorian) calendar. It can read the
+  current date from the system clock. It provides functions for
+  comparing dates and for manipulating a date by adding a number of
+  days.
+
+  A QDate object is typically created either by giving the year, month
+  and day numbers explicitly, or by using the static function
+  currentDate(), which makes a QDate object which contains the
+  system's clock date. An explicit date can also be set using
+  setYMD().
+
+  The year(), month(), and day() functions provide access to the year,
+  month, and day numbers. Also, dayOfWeek() and dayOfYear() functions
+  are provided. The same information is provided in textual format by
+  the toString(), dayName(), and monthName() functions.
+
+  QDate provides a full set of operators to compare two QDate
+  objects. A date is considered smaller than another if it is earlier
+  than the other.
+
+  The date a given number of days later than a given date can be found
+  using the addDays() function. Correspondingly, the number of days
+  between two dates can be found using the daysTo() function.
+
+  The daysInMonth() and daysInYear() functions tell how many days
+  there are in this date's month and year, respectively. The
+  isLeapYear() function tells whether this date is in a leap year.
+
+  Note that QDate may not be used for date calculations for dates in
+  the remote past, i.e. prior to the introduction of the Gregorian
+  calendar. This calendar was adopted by England Sep. 14. 1752 (hence
+  this is the earliest valid QDate), and subsequently by most other
+  western countries, until 1923.
+
+  The end of time is reached around 8000AD, by which time we expect Qt
+  to be obsolete.
+
+  \sa QTime, QDateTime
+*/
+
+
+/*!
+  \fn QDate::QDate()
+  Constructs a null date. Null dates are invalid.
+
+  \sa isNull(), isValid()
+*/
+
+
+/*!
+  Constructs a date with the year \a y, month \a m and day \a d.
+
+  \a y must be in the range 1752-ca. 8000, \a m must be in the range
+  1-12, and \a d must be in the range 1-31. Exception: if \a y is in
+  the range 0-99, it is interpreted as 1900-1999.
+
+  \sa isValid()
+*/
+
+QDate::QDate( int y, int m, int d )
+{
+    jd = 0;
+    setYMD( y, m, d );
+}
+
+
+/*!
+  \fn bool QDate::isNull() const
+
+  Returns TRUE if the date is null.  A null date is invalid.
+
+  \sa isValid()
+*/
+
+
+/*!
+  Returns TRUE if this date is valid.
+
+  \sa isNull()
+*/
+
+bool QDate::isValid() const
+{
+    return jd >= FIRST_DAY;
+}
+
+
+/*!
+  Returns the year (>= 1752) of this date.
+
+  \sa month(), day()
+*/
+
+int QDate::year() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    return y;
+}
+
+/*!
+  Returns the month (January=1 .. December=12) of this date.
+
+  \sa year(), day()
+*/
+
+int QDate::month() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    return m;
+}
+
+/*!
+  Returns the day of the month (1..31) of this date.
+
+  \sa year(), month(), dayOfWeek()
+*/
+
+int QDate::day() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    return d;
+}
+
+/*!
+  Returns the weekday (Monday=1 .. Sunday=7) for this date.
+
+  \sa day(), dayOfYear()
+*/
+
+int QDate::dayOfWeek() const
+{
+    return (((jd+1) % 7) + 6)%7 + 1;
+}
+
+/*!
+  Returns the day of the year (1..365) for this date.
+
+  \sa day(), dayOfWeek()
+*/
+
+int QDate::dayOfYear() const
+{
+    return jd - greg2jul(year(), 1, 1) + 1;
+}
+
+/*!
+  Returns the number of days in the month (28..31) for this date.
+
+  \sa day(), daysInYear()
+*/
+
+int QDate::daysInMonth() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    if ( m == 2 && leapYear(y) )
+	return 29;
+    else
+	return monthDays[m];
+}
+
+/*!
+  Returns the number of days in the year (365 or 366) for this date.
+
+  \sa day(), daysInMonth()
+*/
+
+int QDate::daysInYear() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    return leapYear(y) ? 366 : 365;
+}
+
+
+/*!
+  Returns the name of the \a month.
+
+  Month 1 == "Jan", month 2 == "Feb" etc.
+
+  \sa toString(), dayName()
+*/
+
+QString QDate::monthName( int month ) const
+{
+#if defined(CHECK_RANGE)
+    if ( month < 1 || month > 12 ) {
+	qWarning( "QDate::monthName: Parameter out ouf range." );
+	month = 1;
+    }
+#endif
+    // ### Remove the fromLatin1 during localization
+    return QString::fromLatin1(monthNames[month-1]);
+}
+
+/*!
+  Returns the name of the \a weekday.
+
+  Weekday 1 == "Mon", day 2 == "Tue" etc.
+
+  \sa toString(), monthName()
+*/
+
+QString QDate::dayName( int weekday ) const
+{
+#if defined(CHECK_RANGE)
+    if ( weekday < 1 || weekday > 7 ) {
+	qWarning( "QDate::dayName: Parameter out of range." );
+	weekday = 1;
+    }
+#endif
+    // ### Remove the fromLatin1 during localization
+    return QString::fromLatin1(weekdayNames[weekday-1]);
+}
+
+
+/*!
+  Returns the date as a string.
+
+  The string format is "Sat May 20 1995". This function uses the
+  dayName() and monthName() functions to generate the string.
+
+  \sa dayName(), monthName()
+*/
+
+QString QDate::toString() const
+{
+    int y, m, d;
+    jul2greg( jd, y, m, d );
+    QString buf = dayName(dayOfWeek());
+    buf += ' ';
+    buf += monthName(m);
+    QString t;
+    t.sprintf( " %d %d", d, y);
+    buf += t;
+    return buf;
+}
+
+
+/*!
+  Sets the year \a y, month \a m and day \a d.
+
+  \a y must be in the range 1752-ca. 8000, \a m must be in the range
+  1-12, and \a d must be in the range 1-31. Exception: if \a y is in
+  the range 0-99, it is interpreted as 1900-1999.
+
+  Returns TRUE if the date is valid, otherwise FALSE.
+*/
+
+bool QDate::setYMD( int y, int m, int d )
+{
+    if ( !isValid(y,m,d) ) {
+#if defined(CHECK_RANGE)
+	 qWarning( "QDate::setYMD: Invalid date %04d/%02d/%02d", y, m, d );
+#endif
+	 return FALSE;
+    }
+    jd = greg2jul( y, m, d );
+#if defined(DEBUG)
+    ASSERT( year() == (y > 99 ? y : 1900+y) && month() == m && day() == d );
+#endif
+    return TRUE;
+}
+
+/*!
+  Returns a QDate object containing a date \a ndays later than the
+  date of this object (or earlier if \a ndays is negative).
+
+  \sa daysTo()
+*/
+
+QDate QDate::addDays( int ndays ) const
+{
+    QDate d;
+    d.jd = jd + ndays;
+    return d;
+}
+
+/*!
+  Returns the number of days from this date to \a d (which is negative
+  if \a d is earlier than this date).
+
+  Example:
+  \code
+    QDate d1( 1995, 5, 17 );		// May 17th 1995
+    QDate d2( 1995, 5, 20 );		// May 20th 1995
+    d1.daysTo( d2 );			// returns 3
+    d2.daysTo( d1 );			// returns -3
+  \endcode
+
+  \sa addDays()
+*/
+
+int QDate::daysTo( const QDate &d ) const
+{
+    return d.jd - jd;
+}
+
+
+/*!
+  \fn bool QDate::operator==( const QDate &d ) const
+  Returns TRUE if this date is equal to \a d, or FALSE if
+  they are different.
+*/
+
+/*!
+  \fn bool QDate::operator!=( const QDate &d ) const
+  Returns TRUE if this date is different from \a d, or FALSE if
+  they are equal.
+*/
+
+/*!
+  \fn bool QDate::operator<( const QDate &d ) const
+  Returns TRUE if this date is earlier than \a d, otherwise FALSE.
+*/
+
+/*!
+  \fn bool QDate::operator<=( const QDate &d ) const
+  Returns TRUE if this date is earlier than or equal to \a d, otherwise FALSE.
+*/
+
+/*!
+  \fn bool QDate::operator>( const QDate &d ) const
+  Returns TRUE if this date is later than \a d, otherwise FALSE.
+*/
+
+/*!
+  \fn bool QDate::operator>=( const QDate &d ) const
+  Returns TRUE if this date is later than or equal to \a d, otherwise FALSE.
+*/
+
+
+/*!
+  Returns the current date, as reported by the system clock.
+
+  \sa QTime::currentTime(), QDateTime::currentDateTime()
+*/
+
+QDate QDate::currentDate()
+{
+#if defined(_OS_WIN32_)
+
+    SYSTEMTIME t;
+    GetLocalTime( &t );
+    QDate d;
+    d.jd = greg2jul( t.wYear, t.wMonth, t.wDay );
+    return d;
+
+#else
+
+    time_t ltime;
+    time( &ltime );
+    tm *t = localtime( &ltime );
+    QDate d;
+    d.jd = greg2jul( t->tm_year + 1900, t->tm_mon + 1, t->tm_mday );
+    return d;
+
+#endif
+}
+
+/*!
+  Returns TRUE if the specified date (year \a y, month \a m and day \a
+  d) is valid.
+
+  Example:
+  \code
+    QDate::isValid( 2002, 5, 17 );	// TRUE;  May 17th 2002 is OK.
+    QDate::isValid( 2002, 2, 30 );	// FALSE; Feb 30th does not exist
+    QDate::isValid( 2004, 2, 29 );	// TRUE; 2004 is a leap year
+    QDate::isValid( 1202, 6, 6 );	// FALSE; 1202 is pre-Gregorian
+  \endcode
+
+  Note that a \a y value in the range 00-99 is interpreted as
+  1900-1999.
+
+  \sa isNull(), setYMD()
+*/
+
+bool QDate::isValid( int y, int m, int d )
+{
+    if ( y >= 0 && y <= 99 )
+	y += 1900;
+    else if ( y < FIRST_YEAR || (y == FIRST_YEAR && (m < 9 ||
+						    (m == 9 && d < 14))) )
+	return FALSE;
+    return (d > 0 && m > 0 && m <= 12) &&
+	   (d <= monthDays[m] || (d == 29 && m == 2 && leapYear(y)));
+}
+
+/*!
+  Returns TRUE if the specified year \a y is a leap year.
+*/
+
+bool QDate::leapYear( int y )
+{
+    return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
+}
+
+/*!
+  \internal
+  Converts a Gregorian date to a Julian day.
+  This algorithm is taken from Communications of the ACM, Vol 6, No 8.
+  \sa jul2greg()
+*/
+
+uint QDate::greg2jul( int y, int m, int d )
+{
+    uint c, ya;
+    if ( y <= 99 )
+	y += 1900;
+    if ( m > 2 ) {
+	m -= 3;
+    } else {
+	m += 9;
+	y--;
+    }
+    c = y;					// NOTE: Sym C++ 6.0 bug
+    c /= 100;
+    ya = y - 100*c;
+    return 1721119 + d + (146097*c)/4 + (1461*ya)/4 + (153*m+2)/5;
+}
+
+/*!
+  \internal
+  Converts a Julian day to a Gregorian date.
+  This algorithm is taken from Communications of the ACM, Vol 6, No 8.
+  \sa greg2jul()
+*/
+
+void QDate::jul2greg( uint jd, int &y, int &m, int &d )
+{
+    uint x;
+    uint j = jd - 1721119;
+    y = (j*4 - 1)/146097;
+    j = j*4 - 146097*y - 1;
+    x = j/4;
+    j = (x*4 + 3) / 1461;
+    y = 100*y + j;
+    x = (x*4) + 3 - 1461*j;
+    x = (x + 4)/4;
+    m = (5*x - 3)/153;
+    x = 5*x - 3 - 153*m;
+    d = (x + 5)/5;
+    if ( m < 10 ) {
+	m += 3;
+    } else {
+	m -= 9;
+	y++;
+    }
+}
+
+
+/*****************************************************************************
+  QTime member functions
+ *****************************************************************************/
+
+/*!
+  \class QTime qdatetime.h
+
+  \brief The QTime class provides clock time functions.
+
+  \ingroup time
+
+  A QTime object contains a clock time, i.e. a number of hours,
+  minutes, seconds and milliseconds since midnight. It can read the
+  current time from the system clock, and measure a span of elapsed
+  time. It provides functions for comparing times and for manipulating
+  a time by adding a number of (milli)seconds.
+
+  QTime operates with 24-hour clock format; it has no concept of
+  AM/PM. It operates with local time; it does not know anything about
+  time zones or daylight savings time.
+
+  A QTime object is typically created either by giving the number of
+  hours, minutes, seconds, and milliseconds explicitly, or by using
+  the static function currentTime(), which makes a QTime object which
+  contains the system's clock time. Note that the accuracy depends on
+  the accuracy of the underlying operating system; not all systems
+  provide 1-millisecond accuracy.
+
+  The hour(), minute(), second(), and msec() functions provide access
+  to the number of hours, minutes, seconds, and milliseconds of the
+  time. The same information is provided in textual format by the
+  toString() function.
+
+  QTime provides a full set of operators to compare two QTime
+  objects. A time is considered smaller than another if it is earlier
+  than the other.
+
+  The time a given number of seconds or milliseconds later than a
+  given time can be found using the addSecs() or addMSecs()
+  functions. Correspondingly, the number of (milli)seconds between two
+  times can be found using the secsTo() or msecsTo() functions.
+
+  QTime can be used to measure a span of elapsed time using the
+  start(), restart(), and elapsed() functions.
+
+  \sa QDate, QDateTime
+*/
+
+/*!
+  \fn QTime::QTime()
+
+  Constructs the time 0 hours, minutes, seconds and milliseconds,
+  i.e. 00:00:00.000 (midnight). This is a valid time.
+
+  \sa isValid()
+*/
+
+/*!
+  Constructs a time with hour \a h, minute \a m, seconds \a s and
+  milliseconds \a ms.
+
+  \a h must be in the range 0-23, \a m and \a s must be in the range
+  0-59, and \a ms must be in the range 0-999.
+
+  \sa isValid()
+*/
+
+QTime::QTime( int h, int m, int s, int ms )
+{
+    setHMS( h, m, s, ms );
+}
+
+
+/*!
+  \fn bool QTime::isNull() const
+  Returns TRUE if the time is equal to 00:00:00.000. A null time is valid.
+
+  \sa isValid()
+*/
+
+/*!
+  Returns TRUE if the time is valid, or FALSE if the time is invalid.
+  The time 23:30:55.746 is valid, while 24:12:30 is invalid.
+
+  \sa isNull()
+*/
+
+bool QTime::isValid() const
+{
+    return ds < MSECS_PER_DAY;
+}
+
+
+/*!
+  Returns the hour part (0..23) of the time.
+*/
+
+int QTime::hour() const
+{
+    return ds / MSECS_PER_HOUR;
+}
+
+/*!
+  Returns the minute part (0..59) of the time.
+*/
+
+int QTime::minute() const
+{
+    return (ds % MSECS_PER_HOUR)/MSECS_PER_MIN;
+}
+
+/*!
+  Returns the second part (0..59) of the time.
+*/
+
+int QTime::second() const
+{
+    return (ds / 1000)%SECS_PER_MIN;
+}
+
+/*!
+  Returns the millisecond part (0..999) of the time.
+*/
+
+int QTime::msec() const
+{
+    return ds % 1000;
+}
+
+
+/*!
+  Returns the time of this object in a textual format. Milliseconds
+  are not included. The string format is HH:MM:SS, e.g. 1 second
+  before midnight would be "23:59:59".
+*/
+
+QString QTime::toString() const
+{
+    QString buf;
+    buf.sprintf( "%.2d:%.2d:%.2d", hour(), minute(), second() );
+    return buf;
+}
+
+
+/*!
+  Sets the time to hour \a h, minute \a m, seconds \a s and
+  milliseconds \a ms.
+
+  \a h must be in the range 0-23, \a m and \a s must be in the range
+  0-59, and \a ms must be in the range 0-999. Returns TRUE if the set
+  time is valid, otherwise FALSE.
+
+  \sa isValid()
+*/
+
+bool QTime::setHMS( int h, int m, int s, int ms )
+{
+    if ( !isValid(h,m,s,ms) ) {
+#if defined(CHECK_RANGE)
+	qWarning( "QTime::setHMS Invalid time %02d:%02d:%02d.%03d", h, m, s,
+		 ms );
+#endif
+	ds = MSECS_PER_DAY;		// make this invalid
+	return FALSE;
+    }
+    ds = (h*SECS_PER_HOUR + m*SECS_PER_MIN + s)*1000 + ms;
+    return TRUE;
+}
+
+/*!
+  Returns a QTime object containing a time \a nsecs seconds later than
+  the time of this object (or earlier if \a ms is negative).
+
+  Note that the time will wrap if it passes midnight.
+
+  Example:
+  \code
+    QTime n( 14, 0, 0 );                // n == 14:00:00
+    QTime t;
+    t = n.addSecs( 70 );                // t == 14:01:10
+    t = n.addSecs( -70 );               // t == 13:58:50
+    t = n.addSecs( 10*60*60 + 5 );      // t == 00:00:05
+    t = n.addSecs( -15*60*60 );         // t == 23:00:00
+  \endcode
+
+  \sa addMSecs(), secsTo(), QDateTime::addSecs()
+*/
+
+QTime QTime::addSecs( int nsecs ) const
+{
+    return addMSecs(nsecs*1000);
+}
+
+/*!
+  Returns the number of seconds from this time to \a t (which is
+  negative if \a t is earlier than this time).
+
+  Since QTime measures time within a day and there are 86400 seconds
+  in a day, the result is between -86400 and 86400.
+
+  \sa addSecs() QDateTime::secsTo()
+*/
+
+int QTime::secsTo( const QTime &t ) const
+{
+    return ((int)t.ds - (int)ds)/1000;
+}
+
+/*!
+  Returns a QTime object containing a time \a ms milliseconds later than
+  the time of this object (or earlier if \a ms is negative).
+
+  Note that the time will wrap if it passes midnight. See addSecs()
+  for an example.
+
+  \sa addSecs(), msecsTo()
+*/
+
+QTime QTime::addMSecs( int ms ) const
+{
+    QTime t;
+    if ( ms < 0 ) {
+	// % not well-defined for -ve, but / is.
+	int negdays = (MSECS_PER_DAY-ms) / MSECS_PER_DAY;
+	t.ds = ((int)ds + ms + negdays*MSECS_PER_DAY)
+		% MSECS_PER_DAY;
+    } else {
+	t.ds = ((int)ds + ms) % MSECS_PER_DAY;
+    }
+    return t;
+}
+
+/*!
+  Returns the number of milliseconds from this time to \a t (which is
+  negative if \a t is earlier than this time).
+
+  Since QTime measures time within a day and there are 86400000
+  milliseconds in a day, the result is between -86400000 and 86400000.
+
+  \sa secsTo()
+*/
+
+int QTime::msecsTo( const QTime &t ) const
+{
+    return (int)t.ds - (int)ds;
+}
+
+
+/*!
+  \fn bool QTime::operator==( const QTime &t ) const
+
+  Returns TRUE if this time is equal to \a t, or FALSE if they are
+  different.
+*/
+
+/*!
+  \fn bool QTime::operator!=( const QTime &t ) const
+
+  Returns TRUE if this time is different from \a t, or FALSE if they
+  are equal.
+*/
+
+/*!
+  \fn bool QTime::operator<( const QTime &t ) const
+
+  Returns TRUE if this time is earlier than \a t, otherwise FALSE.
+*/
+
+/*!
+  \fn bool QTime::operator<=( const QTime &t ) const
+
+  Returns TRUE if this time is earlier than or equal to \a t,
+  otherwise FALSE.
+*/
+
+/*!
+  \fn bool QTime::operator>( const QTime &t ) const
+
+  Returns TRUE if this time is later than \a t, otherwise FALSE.
+*/
+
+/*!
+  \fn bool QTime::operator>=( const QTime &t ) const
+
+  Returns TRUE if this time is later than or equal to \a t, otherwise
+  FALSE.
+*/
+
+
+
+/*!
+  Returns the current time, as reported by the system clock.
+
+  Note that the accuracy depends on the accuracy of the underlying
+  operating system; not all systems provide 1-millisecond accuracy.
+*/
+
+QTime QTime::currentTime()
+{
+    QTime ct;
+    currentTime( &ct );
+    return ct;
+}
+
+/*!
+  \internal
+
+  Fetches the current time and returns TRUE if the time is within one
+  minute after midnight, otherwise FALSE. The return value is used by
+  QDateTime::currentDateTime() to ensure that the date there is correct.
+*/
+
+bool QTime::currentTime( QTime *ct )
+{
+    if ( !ct ) {
+#if defined(CHECK_NULL)
+	qWarning( "QTime::currentTime(QTime *): Null pointer not allowed" );
+#endif
+	return FALSE;
+    }
+
+#if defined(_OS_WIN32_)
+
+    SYSTEMTIME t;
+    GetLocalTime( &t );
+    ct->ds = MSECS_PER_HOUR*t.wHour + MSECS_PER_MIN*t.wMinute +
+	     1000*t.wSecond + t.wMilliseconds;
+    return (t.wHour == 0 && t.wMinute == 0);
+
+#elif defined(_OS_OS2_)
+
+    DATETIME t;
+    DosGetDateTime( &t );
+    ct->ds = MSECS_PER_HOUR*t.hours + MSECS_PER_MIN*t.minutes +
+	     1000*t.seconds + 10*t.hundredths;
+    return (t.hours == 0 && t.minutes == 0);
+
+#elif defined(_OS_MSDOS_)
+
+    _dostime_t t;
+    _dos_gettime( &t );
+    ct->ds = MSECS_PER_HOUR*t.hour + MSECS_PER_MIN*t.minute +
+	     t.second*1000 + t.hsecond*10;
+    return (t.hour== 0 && t.minute == 0);
+
+#elif defined(_OS_UNIX_)
+
+    struct timeval tv;
+    gettimeofday( &tv, 0 );
+    time_t ltime = tv.tv_sec;
+    tm *t = localtime( &ltime );
+    ct->ds = (uint)( MSECS_PER_HOUR*t->tm_hour + MSECS_PER_MIN*t->tm_min +
+		     1000*t->tm_sec + tv.tv_usec/1000 );
+    return (t->tm_hour== 0 && t->tm_min == 0);
+
+#else
+
+    time_t ltime;			// no millisecond resolution!!
+    ::time( &ltime );
+    tm *t = localtime( &ltime );
+    ct->ds = MSECS_PER_HOUR*t->tm_hour + MSECS_PER_MIN*t->tm_min +
+	     1000*t->tm_sec;
+    return (t->tm_hour== 0 && t->tm_min == 0);
+#endif
+}
+
+/*!
+  Returns TRUE if the specified time is valid, otherwise FALSE.
+
+  The time is valid if \a h is in the range 0-23, \a m and \a s are in
+  the range 0-59, and \a ms is in the range 0-999.
+
+  Example:
+  \code
+    QTime::isValid(21, 10, 30);		// returns TRUE
+    QTime::isValid(22, 5,  62);		// returns FALSE
+  \endcode
+*/
+
+bool QTime::isValid( int h, int m, int s, int ms )
+{
+    return (uint)h < 24 && (uint)m < 60 && (uint)s < 60 && (uint)ms < 1000;
+}
+
+
+/*!
+  Sets this time to the current time. This is practical for timing:
+
+  \code
+    QTime t;
+    t.start();				// start clock
+    ... // some lengthy task
+    qDebug( "%d\n", t.elapsed() );	// prints # msecs elapsed
+  \endcode
+
+  \sa restart(), elapsed(), currentTime()
+*/
+
+void QTime::start()
+{
+    *this = currentTime();
+}
+
+/*!
+  Sets this time to the current time, and returns the number of
+  milliseconds that have elapsed since the last time start() or
+  restart() was called.
+
+  This function is guaranteed to be atomic, and is thus very handy for
+  repeated measurements: call start() to start the first measurement,
+  then restart() for each later measurement.
+
+  Note that the counter wraps to zero 24 hours after the last call to
+  start() or restart().
+
+  \warning If the system's clock setting has been changed since the
+  last time start() or restart() was called, the result is undefined.
+  This can happen e.g. when daylight saving is turned on or off.
+
+  \sa start(), elapsed(), currentTime()
+*/
+
+int QTime::restart()
+{
+    QTime t = currentTime();
+    int n = msecsTo( t );
+    if ( n < 0 )				// passed midnight
+	n += 86400*1000;
+    *this = t;
+    return n;
+}
+
+/*!
+  Returns the number of milliseconds that have elapsed since the last
+  time start() or restart() was called.
+
+  Note that the counter wraps to zero 24 hours after the last call to
+  start() or restart.
+
+  Note that the accuracy depends on the accuracy of the underlying
+  operating system; not all systems provide 1-millisecond accuracy.
+
+  \warning If the system's clock setting has been changed since the
+  last time start() or restart() was called, the result is undefined.
+  This can happen e.g. when daylight saving is turned on or off.
+
+  \sa start(), restart()
+*/
+
+int QTime::elapsed()
+{
+    int n = msecsTo( currentTime() );
+    if ( n < 0 )				// passed midnight
+	n += 86400*1000;
+    return n;
+}
+
+
+/*****************************************************************************
+  QDateTime member functions
+ *****************************************************************************/
+
+/*!
+  \class QDateTime qdatetime.h
+  \brief The QDateTime class provides date and time functions.
+
+  \ingroup time
+
+  A QDateTime object contains a calendar date and a clock time (a
+  "datetime"). It is a combination of the QDate and QTime classes. It
+  can read the current datetime from the system clock. It provides
+  functions for comparing datetimes and for manipulating a datetime by
+  adding a number of seconds or days.
+
+  A QDateTime object is typically created either by giving a date and
+  time explicitly, or by using the static function currentTime(),
+  which makes a QDateTime object which contains the system's clock
+  time.
+
+  The date() and time() functions provide access to the date and time
+  parts of the datetime. The same information is provided in textual
+  format by the toString() function.
+
+  QDateTime provides a full set of operators to compare two QDateTime
+  objects. A datetime is considered smaller than another if it is
+  earlier than the other.
+
+  The datetime a given number of days or seconds later than a given
+  datetime can be found using the addDays() and addSecs()
+  functions. Correspondingly, the number of days or seconds between
+  two times can be found using the daysTo() or secsTo() functions.
+
+  A datetime can also be set using the setTime_t() function, which
+  takes a POSIX-standard "number of seconds since 00:00:00 on January
+  1, 1970" value.
+
+  The limitations regarding range and resolution mentioned in the
+  QDate and QTime documentation apply for QDateTime also.
+
+  \sa QDate, QTime
+*/
+
+
+/*!
+  \fn QDateTime::QDateTime()
+
+  Constructs a null datetime (i.e. null date and null time).  A null
+  datetime is invalid, since the date is invalid.
+
+  \sa isValid()
+*/
+
+
+/*!
+  Constructs a datetime with date \a date and null time (00:00:00.000).
+*/
+
+QDateTime::QDateTime( const QDate &date )
+    : d(date)
+{
+}
+
+/*!
+  Constructs a datetime with date \a date and time \a time.
+*/
+
+QDateTime::QDateTime( const QDate &date, const QTime &time )
+    : d(date), t(time)
+{
+}
+
+
+/*!
+  \fn bool QDateTime::isNull() const
+
+  Returns TRUE if both the date and the time are null.	A null date is invalid.
+
+  \sa QDate::isNull(), QTime::isNull()
+*/
+
+/*!
+  \fn bool QDateTime::isValid() const
+
+  Returns TRUE if both the date and the time are valid.
+
+  \sa QDate::isValid(), QTime::isValid()
+*/
+
+/*!
+  \fn QDate QDateTime::date() const
+
+  Returns the date part of this datetime.
+
+  \sa setDate(), time()
+*/
+
+/*!
+  \fn QTime QDateTime::time() const
+
+  Returns the time part of this datetime.
+
+  \sa setTime(), date()
+*/
+
+/*!
+  \fn void QDateTime::setDate( const QDate &date )
+
+  Sets the date part of this datetime.
+
+  \sa date(), setTime()
+*/
+
+/*!
+  \fn void QDateTime::setTime( const QTime &time )
+
+  Sets the time part of this datetime.
+
+  \sa time(), setDate()
+*/
+
+
+/*!
+  Sets the local date and time given the number of seconds that have passed
+  since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
+  On systems that do not support timezones this function will behave as if
+  local time were UTC.
+
+  Note that Microsoft Windows supports only a limited range of values for
+  \a secsSince1Jan1970UTC.
+*/
+
+void QDateTime::setTime_t( uint secsSince1Jan1970UTC )
+{
+    time_t tmp = (time_t) secsSince1Jan1970UTC;
+    tm *tM = localtime( &tmp );
+    if ( !tM ) {
+	tM = gmtime( &tmp );
+	if ( !tM ) {
+	    d.jd = QDate::greg2jul( 1970, 1, 1 );
+	    t.ds = 0;
+	    return;
+	}
+    }
+    d.jd = QDate::greg2jul( tM->tm_year + 1900, tM->tm_mon + 1, tM->tm_mday );
+    t.ds = MSECS_PER_HOUR*tM->tm_hour + MSECS_PER_MIN*tM->tm_min +
+	    1000*tM->tm_sec;
+}
+
+
+/*!
+  Returns the datetime as a string.
+
+  The string format is "Sat May 20 03:40:13 1998".
+
+  This function uses QDate::dayName(), QDate::monthName(), and
+  QTime::toString() to generate the string.
+
+*/
+
+QString QDateTime::toString() const
+{
+    QString buf = d.dayName(d.dayOfWeek());
+    buf += ' ';
+    buf += d.monthName(d.month());
+    buf += ' ';
+    buf += QString().setNum(d.day());
+    buf += ' ';
+    buf += t.toString();
+    buf += ' ';
+    buf += QString().setNum(d.year());
+    return buf;
+}
+
+/*!
+  Returns a QDateTime object containing a datetime \a ndays days later
+  than the datetime of this object (or earlier if \a ndays is
+  negative).
+
+  \sa daysTo(), addSecs()
+*/
+
+QDateTime QDateTime::addDays( int ndays ) const
+{
+    return QDateTime( d.addDays(ndays), t );
+}
+
+/*!
+  Returns a QDateTime object containing a datetime \a nsecs seconds
+  later than the datetime of this object (or earlier if \a nsecs is
+  negative).
+
+  \sa secsTo(), addDays()
+*/
+
+QDateTime QDateTime::addSecs( int nsecs ) const
+{
+    uint dd = d.jd;
+    int  tt = t.ds;
+    int  sign = 1;
+    if ( nsecs < 0 ) {
+	nsecs = -nsecs;
+	sign = -1;
+    }
+    if ( nsecs >= (int)SECS_PER_DAY ) {
+	dd += sign*(nsecs/SECS_PER_DAY);
+	nsecs %= SECS_PER_DAY;
+    }
+    tt += sign*nsecs*1000;
+    if ( tt < 0 ) {
+	tt = MSECS_PER_DAY - tt - 1;
+	dd -= tt / MSECS_PER_DAY;
+	tt = tt % MSECS_PER_DAY;
+	tt = MSECS_PER_DAY - tt - 1;
+    } else if ( tt >= (int)MSECS_PER_DAY ) {
+	dd += ( tt / MSECS_PER_DAY );
+	tt = tt % MSECS_PER_DAY;
+    }
+    QDateTime ret;
+    ret.t.ds = tt;
+    ret.d.jd = dd;
+    return ret;
+}
+
+/*!
+  Returns the number of days from this datetime to \a dt (which is
+  negative if \a dt is earlier than this datetime).
+
+  \sa addDays(), secsTo()
+*/
+
+int QDateTime::daysTo( const QDateTime &dt ) const
+{
+    return d.daysTo( dt.d );
+}
+
+/*!
+  Returns the number of seconds from this datetime to \a dt (which is
+  negative if \a dt is earlier than this datetime).
+
+  Example:
+  \code
+    QDateTime dt = QDateTime::currentDateTime();
+    QDateTime x( QDate(dt.year(),12,24), QTime(17,00) );
+    qDebug( "There are %d seconds to Christmas", dt.secsTo(x) );
+  \endcode
+
+  \sa addSecs(), daysTo(), QTime::secsTo()
+*/
+
+int QDateTime::secsTo( const QDateTime &dt ) const
+{
+    return t.secsTo(dt.t) + d.daysTo(dt.d)*SECS_PER_DAY;
+}
+
+
+/*!
+  Returns TRUE if this datetime is equal to \a dt, or FALSE if
+  they are different.
+  \sa operator!=()
+*/
+
+bool QDateTime::operator==( const QDateTime &dt ) const
+{
+    return  t == dt.t && d == dt.d;
+}
+
+/*!
+  Returns TRUE if this datetime is different from \a dt, or FALSE if
+  they are equal.
+  \sa operator==()
+*/
+
+bool QDateTime::operator!=( const QDateTime &dt ) const
+{
+    return  t != dt.t || d != dt.d;
+}
+
+/*!
+  Returns TRUE if this datetime is earlier than \a dt, otherwise FALSE.
+*/
+
+bool QDateTime::operator<( const QDateTime &dt ) const
+{
+    if ( d < dt.d )
+	return TRUE;
+    return d == dt.d ? t < dt.t : FALSE;
+}
+
+/*!
+  Returns TRUE if this datetime is earlier than or equal to \a dt,
+  otherwise FALSE.
+*/
+
+bool QDateTime::operator<=( const QDateTime &dt ) const
+{
+    if ( d < dt.d )
+	return TRUE;
+    return d == dt.d ? t <= dt.t : FALSE;
+}
+
+/*!
+  Returns TRUE if this datetime is later than \a dt, otherwise FALSE.
+*/
+
+bool QDateTime::operator>( const QDateTime &dt ) const
+{
+    if ( d > dt.d )
+	return TRUE;
+    return d == dt.d ? t > dt.t : FALSE;
+}
+
+/*!
+  Returns TRUE if this datetime is later than or equal to \a dt,
+  otherwise FALSE.
+*/
+
+bool QDateTime::operator>=( const QDateTime &dt ) const
+{
+    if ( d > dt.d )
+	return TRUE;
+    return d == dt.d ? t >= dt.t : FALSE;
+}
+
+/*!
+  Returns the current datetime, as reported by the system clock.
+
+  \sa QDate::currentDate(), QTime::currentTime()
+*/
+
+QDateTime QDateTime::currentDateTime()
+{
+    QDate cd = QDate::currentDate();
+    QTime ct;
+    if ( QTime::currentTime(&ct) )		// too close to midnight?
+	cd = QDate::currentDate();		// YES! time for some midnight
+						// voodoo, fetch date again
+    return QDateTime( cd, ct );
+}
+
+
+/*****************************************************************************
+  Date/time stream functions
+ *****************************************************************************/
+
+#ifndef QT_NO_DATASTREAM
+/*!
+  \relates QDate
+  Writes the date to the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator<<( QDataStream &s, const QDate &d )
+{
+    return s << (Q_UINT32)(d.jd);
+}
+
+/*!
+  \relates QDate
+  Reads a date from the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator>>( QDataStream &s, QDate &d )
+{
+    Q_UINT32 jd;
+    s >> jd;
+    d.jd = jd;
+    return s;
+}
+
+/*!
+  \relates QTime
+  Writes a time to the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator<<( QDataStream &s, const QTime &t )
+{
+    return s << (Q_UINT32)(t.ds);
+}
+
+/*!
+  \relates QTime
+  Reads a time from the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator>>( QDataStream &s, QTime &t )
+{
+    Q_UINT32 ds;
+    s >> ds;
+    t.ds = ds;
+    return s;
+}
+
+/*!
+  \relates QDateTime
+  Writes a datetime to the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator<<( QDataStream &s, const QDateTime &dt )
+{
+    return s << dt.d << dt.t;
+}
+
+/*!
+  \relates QDateTime
+  Reads a datetime from the stream.
+
+  \sa \link datastreamformat.html Format of the QDataStream operators \endlink
+*/
+
+QDataStream &operator>>( QDataStream &s, QDateTime &dt )
+{
+    s >> dt.d >> dt.t;
+    return s;
+}
+#endif //QT_NO_DATASTREAM
diff --git a/WebCore/src/kwq/qt/_qdatetime.h b/WebCore/src/kwq/qt/_qdatetime.h
new file mode 100644
index 0000000..820fde3
--- /dev/null
+++ b/WebCore/src/kwq/qt/_qdatetime.h
@@ -0,0 +1,215 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of date and time classes
+**
+** Created : 940124
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QDATETIME_H
+#define QDATETIME_H
+
+#ifndef QT_H
+#include "qstring.h"
+#endif // QT_H
+
+
+/*****************************************************************************
+  QDate class
+ *****************************************************************************/
+
+class Q_EXPORT QDate
+{
+public:
+    QDate()  { jd=0; }				// set null date
+    QDate( int y, int m, int d );		// set date
+
+    bool   isNull()	 const { return jd == 0; }
+    bool   isValid()	 const;			// valid date
+
+    int	   year()	 const;			// 1752..
+    int	   month()	 const;			// 1..12
+    int	   day()	 const;			// 1..31
+    int	   dayOfWeek()	 const;			// 1..7 (monday==1)
+    int	   dayOfYear()	 const;			// 1..365
+    int	   daysInMonth() const;			// 28..31
+    int	   daysInYear()	 const;			// 365 or 366
+
+    virtual QString monthName( int month ) const;
+    virtual QString dayName( int weekday ) const;
+
+    QString toString()	 const;
+
+    bool   setYMD( int y, int m, int d );
+
+    QDate  addDays( int days )		const;
+    int	   daysTo( const QDate & )	const;
+
+    bool   operator==( const QDate &d ) const { return jd == d.jd; }
+    bool   operator!=( const QDate &d ) const { return jd != d.jd; }
+    bool   operator<( const QDate &d )	const { return jd < d.jd; }
+    bool   operator<=( const QDate &d ) const { return jd <= d.jd; }
+    bool   operator>( const QDate &d )	const { return jd > d.jd; }
+    bool   operator>=( const QDate &d ) const { return jd >= d.jd; }
+
+    static QDate currentDate();
+    static bool	 isValid( int y, int m, int d );
+    static bool	 leapYear( int year );
+
+protected:
+    static uint	 greg2jul( int y, int m, int d );
+    static void	 jul2greg( uint jd, int &y, int &m, int &d );
+private:
+    static const char * const monthNames[];
+    static const char * const weekdayNames[];
+    uint	 jd;
+    friend class QDateTime;
+#ifndef QT_NO_DATASTREAM
+    friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QDate & );
+    friend Q_EXPORT QDataStream &operator>>( QDataStream &, QDate & );
+#endif
+};
+
+
+/*****************************************************************************
+  QTime class
+ *****************************************************************************/
+
+class Q_EXPORT QTime
+{
+public:
+    QTime() { ds=0; }				// set null time
+    QTime( int h, int m, int s=0, int ms=0 );	// set time
+
+    bool   isNull()	 const { return ds == 0; }
+    bool   isValid()	 const;			// valid time
+
+    int	   hour()	 const;			// 0..23
+    int	   minute()	 const;			// 0..59
+    int	   second()	 const;			// 0..59
+    int	   msec()	 const;			// 0..999
+
+    QString toString()	 const;
+
+    bool   setHMS( int h, int m, int s, int ms=0 );
+
+    QTime  addSecs( int secs )		const;
+    int	   secsTo( const QTime & )	const;
+    QTime  addMSecs( int ms )		const;
+    int	   msecsTo( const QTime & )	const;
+
+    bool   operator==( const QTime &d ) const { return ds == d.ds; }
+    bool   operator!=( const QTime &d ) const { return ds != d.ds; }
+    bool   operator<( const QTime &d )	const { return ds < d.ds; }
+    bool   operator<=( const QTime &d ) const { return ds <= d.ds; }
+    bool   operator>( const QTime &d )	const { return ds > d.ds; }
+    bool   operator>=( const QTime &d ) const { return ds >= d.ds; }
+
+    static QTime currentTime();
+    static bool	 isValid( int h, int m, int s, int ms=0 );
+
+    void   start();
+    int	   restart();
+    int	   elapsed();
+
+private:
+    static bool currentTime( QTime * );
+
+    uint   ds;
+    friend class QDateTime;
+#ifndef QT_NO_DATASTREAM
+    friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QTime & );
+    friend Q_EXPORT QDataStream &operator>>( QDataStream &, QTime & );
+#endif
+};
+
+
+/*****************************************************************************
+  QDateTime class
+ *****************************************************************************/
+
+class Q_EXPORT QDateTime
+{
+public:
+    QDateTime() {}				// set null date and null time
+    QDateTime( const QDate & );
+    QDateTime( const QDate &, const QTime & );
+
+    bool   isNull()	const		{ return d.isNull() && t.isNull(); }
+    bool   isValid()	const		{ return d.isValid() && t.isValid(); }
+
+    QDate  date()	const		{ return d; }
+    QTime  time()	const		{ return t; }
+    void   setDate( const QDate &date ) { d=date; }
+    void   setTime( const QTime &time ) { t=time; }
+    void   setTime_t( uint secsSince1Jan1970UTC );
+
+    QString toString()	const;
+
+    QDateTime addDays( int days )	const;
+    QDateTime addSecs( int secs )	const;
+    int	   daysTo( const QDateTime & )	const;
+    int	   secsTo( const QDateTime & )	const;
+
+    bool   operator==( const QDateTime &dt ) const;
+    bool   operator!=( const QDateTime &dt ) const;
+    bool   operator<( const QDateTime &dt )  const;
+    bool   operator<=( const QDateTime &dt ) const;
+    bool   operator>( const QDateTime &dt )  const;
+    bool   operator>=( const QDateTime &dt ) const;
+
+    static QDateTime currentDateTime();
+
+private:
+    QDate  d;
+    QTime  t;
+#ifndef QT_NO_DATASTREAM
+    friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QDateTime &);
+    friend Q_EXPORT QDataStream &operator>>( QDataStream &, QDateTime & );
+#endif
+};
+
+
+/*****************************************************************************
+  Date and time stream functions
+ *****************************************************************************/
+
+#ifndef QT_NO_DATASTREAM
+Q_EXPORT QDataStream &operator<<( QDataStream &, const QDate & );
+Q_EXPORT QDataStream &operator>>( QDataStream &, QDate & );
+Q_EXPORT QDataStream &operator<<( QDataStream &, const QTime & );
+Q_EXPORT QDataStream &operator>>( QDataStream &, QTime & );
+Q_EXPORT QDataStream &operator<<( QDataStream &, const QDateTime & );
+Q_EXPORT QDataStream &operator>>( QDataStream &, QDateTime & );
+#endif // QT_NO_DATASTREAM
+
+#endif // QDATETIME_H
diff --git a/WebCore/src/kwq/qt/_qiodevice.h b/WebCore/src/kwq/qt/_qiodevice.h
new file mode 100644
index 0000000..6688bda
--- /dev/null
+++ b/WebCore/src/kwq/qt/_qiodevice.h
@@ -0,0 +1,155 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of QIODevice class
+**
+** Created : 940913
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QIODEVICE_H
+#define QIODEVICE_H
+
+#ifndef QT_H
+#include "qglobal.h"
+#include "qcstring.h"
+#endif // QT_H
+
+
+// IO device access types
+
+#define IO_Direct		0x0100		// direct access device
+#define IO_Sequential		0x0200		// sequential access device
+#define IO_Combined		0x0300		// combined direct/sequential
+#define IO_TypeMask		0x0f00
+
+// IO handling modes
+
+#define IO_Raw			0x0040		// raw access (not buffered)
+#define IO_Async		0x0080		// asynchronous mode
+
+// IO device open modes
+
+#define IO_ReadOnly		0x0001		// readable device
+#define IO_WriteOnly		0x0002		// writable device
+#define IO_ReadWrite		0x0003		// read+write device
+#define IO_Append		0x0004		// append
+#define IO_Truncate		0x0008		// truncate device
+#define IO_Translate		0x0010		// translate CR+LF
+#define IO_ModeMask		0x00ff
+
+// IO device state
+
+#define IO_Open			0x1000		// device is open
+#define IO_StateMask		0xf000
+
+
+// IO device status
+
+#define IO_Ok			0
+#define IO_ReadError		1		// read error
+#define IO_WriteError		2		// write error
+#define IO_FatalError		3		// fatal unrecoverable error
+#define IO_ResourceError	4		// resource limitation
+#define IO_OpenError		5		// cannot open device
+#define IO_ConnectError		5		// cannot connect to device
+#define IO_AbortError		6		// abort error
+#define IO_TimeOutError		7		// time out
+#define IO_UnspecifiedError		8		// unspecified error
+
+class Q_EXPORT QIODevice					// IO device class
+{
+public:
+    QIODevice();
+    virtual ~QIODevice();
+
+    int		 flags()  const { return ioMode; }
+    int		 mode()	  const { return ioMode & IO_ModeMask; }
+    int		 state()  const { return ioMode & IO_StateMask; }
+
+    bool	 isDirectAccess()     const { return ((ioMode & IO_Direct)     == IO_Direct); }
+    bool	 isSequentialAccess() const { return ((ioMode & IO_Sequential) == IO_Sequential); }
+    bool	 isCombinedAccess()   const { return ((ioMode & IO_Combined)   == IO_Combined); }
+    bool	 isBuffered()	      const { return ((ioMode & IO_Raw)        != IO_Raw); }
+    bool	 isRaw()	      const { return ((ioMode & IO_Raw)        == IO_Raw); }
+    bool	 isSynchronous()      const { return ((ioMode & IO_Async)      != IO_Async); }
+    bool	 isAsynchronous()     const { return ((ioMode & IO_Async)      == IO_Async); }
+    bool	 isTranslated()	      const { return ((ioMode & IO_Translate)  == IO_Translate); }
+    bool	 isReadable()	      const { return ((ioMode & IO_ReadOnly)   == IO_ReadOnly); }
+    bool	 isWritable()	      const { return ((ioMode & IO_WriteOnly)  == IO_WriteOnly); }
+    bool	 isReadWrite()	      const { return ((ioMode & IO_ReadWrite)  == IO_ReadWrite); }
+    bool	 isInactive()	      const { return state() == 0; }
+    bool	 isOpen()	      const { return state() == IO_Open; }
+
+    int		 status() const { return ioSt; }
+    void	 resetStatus()	{ ioSt = IO_Ok; }
+
+    virtual bool open( int mode ) = 0;
+    virtual void close() = 0;
+    virtual void flush() = 0;
+
+    virtual uint size()	  const = 0;
+    virtual int	 at()	  const;
+    virtual bool at( int );
+    virtual bool atEnd()  const;
+    bool	 reset() { return at(0); }
+
+    virtual int	 readBlock( char *data, uint maxlen ) = 0;
+    virtual int	 writeBlock( const char *data, uint len ) = 0;
+    virtual int	 readLine( char *data, uint maxlen );
+    int writeBlock( const QByteArray& data );
+    QByteArray readAll();
+
+    virtual int	 getch() = 0;
+    virtual int	 putch( int ) = 0;
+    virtual int	 ungetch( int ) = 0;
+
+protected:
+    void	 setFlags( int f ) { ioMode = f; }
+    void	 setType( int );
+    void	 setMode( int );
+    void	 setState( int );
+    void	 setStatus( int );
+    int		 ioIndex;
+
+private:
+    int		 ioMode;
+    int		 ioSt;
+
+private:	// Disabled copy constructor and operator=
+#if defined(Q_DISABLE_COPY)
+    QIODevice( const QIODevice & );
+    QIODevice &operator=( const QIODevice & );
+#endif
+};
+
+
+#endif // QIODEVICE_H
diff --git a/WebCore/src/kwq/qt/_qlist.h b/WebCore/src/kwq/qt/_qlist.h
new file mode 100644
index 0000000..1a9a25d
--- /dev/null
+++ b/WebCore/src/kwq/qt/_qlist.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of QList template/macro class
+**
+** Created : 920701
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QLIST_H
+#define QLIST_H
+
+#ifndef QT_H
+#include "_qglist.h"
+#endif // QT_H
+
+
+template<class type> class Q_EXPORT QList : public QGList
+{
+public:
+    QList()				{}
+    QList( const QList<type> &l ) : QGList(l) {}
+   ~QList()				{ clear(); }
+    QList<type> &operator=(const QList<type> &l)
+			{ return (QList<type>&)QGList::operator=(l); }
+    bool operator==( const QList<type> &list ) const
+    { return QGList::operator==( list ); }
+    uint  count()   const		{ return QGList::count(); }
+    bool  isEmpty() const		{ return QGList::count() == 0; }
+    bool  insert( uint i, const type *d){ return QGList::insertAt(i,(QCollection::Item)d); }
+    void  inSort( const type *d )	{ QGList::inSort((QCollection::Item)d); }
+    void  prepend( const type *d )	{ QGList::insertAt(0,(QCollection::Item)d); }
+    void  append( const type *d )	{ QGList::append((QCollection::Item)d); }
+    bool  remove( uint i )		{ return QGList::removeAt(i); }
+    bool  remove()			{ return QGList::remove((QCollection::Item)0); }
+    bool  remove( const type *d )	{ return QGList::remove((QCollection::Item)d); }
+    bool  removeRef( const type *d )	{ return QGList::removeRef((QCollection::Item)d); }
+    void  removeNode( QLNode *n )	{ QGList::removeNode(n); }
+    bool  removeFirst()			{ return QGList::removeFirst(); }
+    bool  removeLast()			{ return QGList::removeLast(); }
+    type *take( uint i )		{ return (type *)QGList::takeAt(i); }
+    type *take()			{ return (type *)QGList::take(); }
+    type *takeNode( QLNode *n )		{ return (type *)QGList::takeNode(n); }
+    void  clear()			{ QGList::clear(); }
+    void  sort()			{ QGList::sort(); }
+    int	  find( const type *d )		{ return QGList::find((QCollection::Item)d); }
+    int	  findNext( const type *d )	{ return QGList::find((QCollection::Item)d,FALSE); }
+    int	  findRef( const type *d )	{ return QGList::findRef((QCollection::Item)d); }
+    int	  findNextRef( const type *d ){ return QGList::findRef((QCollection::Item)d,FALSE);}
+    uint  contains( const type *d ) const { return QGList::contains((QCollection::Item)d); }
+    uint  containsRef( const type *d ) const
+					{ return QGList::containsRef((QCollection::Item)d); }
+    type *at( uint i )			{ return (type *)QGList::at(i); }
+    int	  at() const			{ return QGList::at(); }
+    type *current()  const		{ return (type *)QGList::get(); }
+    QLNode *currentNode()  const	{ return QGList::currentNode(); }
+    type *getFirst() const		{ return (type *)QGList::cfirst(); }
+    type *getLast()  const		{ return (type *)QGList::clast(); }
+    type *first()			{ return (type *)QGList::first(); }
+    type *last()			{ return (type *)QGList::last(); }
+    type *next()			{ return (type *)QGList::next(); }
+    type *prev()			{ return (type *)QGList::prev(); }
+    void  toVector( QGVector *vec )const{ QGList::toVector(vec); }
+private:
+    void  deleteItem( QCollection::Item d );
+};
+
+#if defined(Q_DELETING_VOID_UNDEFINED)
+template<> inline void QList<void>::deleteItem( QCollection::Item )
+{
+}
+#endif
+
+template<class type> inline void QList<type>::deleteItem( QCollection::Item d )
+{
+    if ( del_item ) delete (type *)d;
+}
+
+
+template<class type> class Q_EXPORT QListIterator : public QGListIterator
+{
+public:
+    QListIterator(const QList<type> &l) :QGListIterator((QGList &)l) {}
+   ~QListIterator()	      {}
+    uint  count()   const     { return list->count(); }
+    bool  isEmpty() const     { return list->count() == 0; }
+    bool  atFirst() const     { return QGListIterator::atFirst(); }
+    bool  atLast()  const     { return QGListIterator::atLast(); }
+    type *toFirst()	      { return (type *)QGListIterator::toFirst(); }
+    type *toLast()	      { return (type *)QGListIterator::toLast(); }
+    operator type *() const   { return (type *)QGListIterator::get(); }
+    type *operator*()         { return (type *)QGListIterator::get(); }
+
+    // No good, since QList<char> (ie. QStrList fails...
+    //
+    // MSVC++ gives warning
+    // Sunpro C++ 4.1 gives error
+    //    type *operator->()        { return (type *)QGListIterator::get(); }
+
+    type *current()   const   { return (type *)QGListIterator::get(); }
+    type *operator()()	      { return (type *)QGListIterator::operator()();}
+    type *operator++()	      { return (type *)QGListIterator::operator++(); }
+    type *operator+=(uint j)  { return (type *)QGListIterator::operator+=(j);}
+    type *operator--()	      { return (type *)QGListIterator::operator--(); }
+    type *operator-=(uint j)  { return (type *)QGListIterator::operator-=(j);}
+    QListIterator<type>& operator=(const QListIterator<type>&it)
+			      { QGListIterator::operator=(it); return *this; }
+};
+
+
+#endif // QLIST_H
diff --git a/WebCore/kwq/qt/_qcollection.h b/WebCore/src/kwq/qt/_qsortedlist.h
similarity index 59%
copy from WebCore/kwq/qt/_qcollection.h
copy to WebCore/src/kwq/qt/_qsortedlist.h
index 63d676e..7b90da6 100644
--- a/WebCore/kwq/qt/_qcollection.h
+++ b/WebCore/src/kwq/qt/_qsortedlist.h
@@ -1,9 +1,9 @@
 /****************************************************************************
 ** $Id$
 **
-** Definition of base class for all collection classes
+** Definition of QList template/macro class
 **
-** Created : 920629
+** Created : 920701
 **
 ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
 **
@@ -35,40 +35,25 @@
 **
 **********************************************************************/
 
-#ifndef QCOLLECTION_H
-#define QCOLLECTION_H
+#ifndef QSORTEDLIST_H
+#define QSORTEDLIST_H
 
-// KWQ hacks ---------------------------------------------------------------
+#ifndef QT_H
+#include "qlist.h"
+#endif // QT_H
 
-#include <KWQDef.h>
 
-// -------------------------------------------------------------------------
-
-class QGVector;
-class QGList;
-class QGDict;
-
-class Q_EXPORT QCollection			// inherited by all collections
+template<class type> class Q_EXPORT QSortedList : public QList<type>
 {
 public:
-    bool autoDelete()	const	       { return del_item; }
-    void setAutoDelete( bool enable )  { del_item = enable; }
-
-    virtual uint  count() const = 0;
-    virtual void  clear() = 0;			// delete all objects
-
-    typedef void *Item;				// generic collection item
-
-protected:
-    QCollection() { del_item = FALSE; }		// no deletion of objects
-    QCollection(const QCollection &) { del_item = FALSE; }
-    virtual ~QCollection() {}
-
-    bool del_item;				// default FALSE
-
-    virtual Item     newItem( Item );		// create object
-    virtual void     deleteItem( Item );	// delete object
+    QSortedList() {}
+    QSortedList( const QSortedList<type> &l ) : QList<type>(l) {}
+    ~QSortedList() { clear(); }
+    QSortedList<type> &operator=(const QSortedList<type> &l)
+      { return (QSortedList<type>&)QList<type>::operator=(l); }
+
+    virtual int compareItems( QCollection::Item s1, QCollection::Item s2 )
+      { if ( *((type*)s1) == *((type*)s2) ) return 0; return ( *((type*)s1) < *((type*)s2) ? -1 : 1 ); }
 };
 
-
-#endif // QCOLLECTION_H
+#endif
diff --git a/WebCore/src/kwq/qt/_qstringlist.cpp b/WebCore/src/kwq/qt/_qstringlist.cpp
new file mode 100644
index 0000000..8854008
--- /dev/null
+++ b/WebCore/src/kwq/qt/_qstringlist.cpp
@@ -0,0 +1,306 @@
+/****************************************************************************
+** $Id$
+**
+** Implementation of QStringList
+**
+** Created : 990406
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "qstringlist.h"
+
+#ifndef QT_NO_STRINGLIST
+#include "_qstrlist.h"
+
+#ifndef QT_NO_DATASTREAM
+#include "qdatastream.h"
+#endif
+
+#include "_qtl.h"
+
+// NOT REVISED
+/*!
+  \class QStringList qstringlist.h
+  \brief A list of strings.
+
+  \ingroup qtl
+  \ingroup tools
+  \ingroup shared
+
+  QStringList is basically a QValueList of QString objects. As opposed
+  to QStrList, that stores pointers to characters, QStringList deals
+  with real QString objects.  It is the class of choice whenever you
+  work with unicode strings.
+
+  Like QString itself, QStringList objects are implicit shared.
+  Passing them around as value-parameters is both fast and safe.
+
+  Example:
+  \code
+	QStringList list;
+
+	// three different ways of appending values:
+	list.append( "Torben");
+	list += "Warwick";
+	list << "Matthias" << "Arnt" << "Paul";
+
+	// sort the list, Arnt's now first
+	list.sort();
+
+	// print it out
+	for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
+	    printf( "%s \n", (*it).latin1() );
+	}
+  \endcode
+
+  Convenience methods such as sort(), split(), join() and grep() make
+  working with QStringList easy.
+*/
+
+/*!
+ \fn QStringList::QStringList()
+  Creates an empty list.
+*/
+
+/*! \fn QStringList::QStringList( const QStringList& l )
+  Creates a copy of the list. This function is very fast since
+  QStringList is implicit shared. However, for the programmer this
+  is the same as a deep copy. If this list or the original one or some
+  other list referencing the same shared data is modified, then the
+  modifying list makes a copy first.
+*/
+
+/*!
+  \fn QStringList::QStringList (const QString & i)
+  Constructs a string list consisting of the single string \a i.
+  To make longer lists easily, use:
+  \code
+    QString s1,s2,s3;
+    ...
+    QStringList mylist = QStringList() << s1 << s2 << s3;
+  \endcode
+*/
+
+/*!
+  \fn QStringList::QStringList (const char* i)
+  Constructs a string list consisting of the single latin-1 string \a i.
+*/
+
+/*! \fn QStringList::QStringList( const QValueList<QString>& l )
+
+  Constructs a new string list that is a copy of \a l.
+*/
+
+/*!
+  Sorts the list of strings in ascending order.
+
+  Sorting is very fast. It uses the Qt Template Library's
+  efficient HeapSort implementation that operates in O(n*log n).
+*/
+void QStringList::sort()
+{
+    qHeapSort(*this);
+}
+
+/*!
+  Splits the string \a str using \a sep as separator. Returns the
+  list of strings. If \a allowEmptyEntries is TRUE, also empty
+  entries are inserted into the list, else not. So if you have
+  a string 'abc..d.e.', a list which contains 'abc', 'd', and 'e'
+  would be returned if \a allowEmptyEntries is FALSE, but
+  a list containing 'abc', '', 'd', 'e' and '' would be returned if
+  \a allowEmptyEntries is TRUE.
+  If \a str doesn't contain \a sep, a stringlist
+  with one item, which is the same as \a str, is returned.
+
+  \sa join()
+*/
+
+QStringList QStringList::split( const QChar &sep, const QString &str, bool allowEmptyEntries )
+{
+    return split( QString( sep ), str, allowEmptyEntries );
+}
+
+/*!
+  Splits the string \a str using \a sep as separator. Returns the
+  list of strings. If \a allowEmptyEntries is TRUE, also empty
+  entries are inserted into the list, else not. So if you have
+  a string 'abc..d.e.', a list which contains 'abc', 'd', and 'e'
+  would be returned if \a allowEmptyEntries is FALSE, but
+  a list containing 'abc', '', 'd', 'e' and '' would be returned if
+  \a allowEmptyEntries is TRUE.
+  If \a str doesn't contain \a sep, a stringlist
+  with one item, which is the same as \a str, is returned.
+
+  \sa join()
+*/
+
+QStringList QStringList::split( const QString &sep, const QString &str, bool allowEmptyEntries )
+{
+    QStringList lst;
+
+    int j = 0;
+    int i = str.find( sep, j );
+
+    while ( i != -1 ) {
+	if ( str.mid( j, i - j ).length() > 0 )
+	    lst << str.mid( j, i - j );
+	else if ( allowEmptyEntries )
+	    lst << QString::null;
+	j = i + sep.length();
+	i = str.find( sep, j );
+    }
+
+    int l = str.length() - 1;
+    if ( str.mid( j, l - j + 1 ).length() > 0 )
+	lst << str.mid( j, l - j + 1 );
+    else if ( allowEmptyEntries )
+	lst << QString::null;
+
+    return lst;
+}
+
+/*!
+  Splits the string \a str using the regular expression \a sep as separator. Returns the
+  list of strings. If \a allowEmptyEntries is TRUE, also empty
+  entries are inserted into the list, else not. So if you have
+  a string 'abc..d.e.', a list which contains 'abc', 'd', and 'e'
+  would be returned if \a allowEmptyEntries is FALSE, but
+  a list containing 'abc', '', 'd', 'e' and '' would be returned if
+  \a allowEmptyEntries is TRUE.
+  If \a str doesn't contain \a sep, a stringlist
+  with one item, which is the same as \a str, is returned.
+
+  \sa join()
+*/
+
+QStringList QStringList::split( const QRegExp &sep, const QString &str, bool allowEmptyEntries )
+{
+    QStringList lst;
+
+    int j = 0;
+    int len = 0;
+    int i = sep.match( str, j, &len );
+
+    while ( i != -1 ) {
+	if ( str.mid( j, i - j ).length() > 0 )
+	    lst << str.mid( j, i - j );
+	else if ( allowEmptyEntries )
+	    lst << QString::null;
+	j = i + len;
+	i = sep.match( str, j, &len );
+    }
+
+    int l = str.length() - 1;
+    if ( str.mid( j, l - j + 1 ).length() > 0 )
+	lst << str.mid( j, l - j + 1 );
+    else if ( allowEmptyEntries )
+	lst << QString::null;
+
+    return lst;
+}
+
+/*!
+  Returns a list of all strings containing the substring \a str.
+
+  If \a cs is TRUE, the grep is done case sensitively, else not.
+*/
+
+QStringList QStringList::grep( const QString &str, bool cs ) const
+{
+    QStringList res;
+    for ( QStringList::ConstIterator it = begin(); it != end(); ++it )
+	if ( (*it).contains( str, cs ) )
+	    res << *it;
+
+    return res;
+}
+
+/*!
+  Returns a list of all strings containing a substring that matches
+  the regular expression \a expr.
+*/
+
+QStringList QStringList::grep( const QRegExp &expr ) const
+{
+    QStringList res;
+    for ( QStringList::ConstIterator it = begin(); it != end(); ++it )
+	if ( (*it).contains( expr ) )
+	    res << *it;
+
+    return res;
+}
+
+/*!
+  Joins the stringlist into a single string with each element
+  separated by \a sep.
+
+  \sa split()
+*/
+QString QStringList::join( const QString &sep ) const
+{
+    QString res;
+    bool alredy = FALSE;
+    for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
+	if ( alredy )
+	    res += sep;
+	alredy = TRUE;
+	res += *it;
+    }
+
+    return res;
+}
+
+#ifndef QT_NO_DATASTREAM
+Q_EXPORT QDataStream &operator>>( QDataStream & s, QStringList& l )
+{
+    return s >> (QValueList<QString>&)l;
+}
+
+Q_EXPORT QDataStream &operator<<( QDataStream & s, const QStringList& l )
+{
+    return s << (const QValueList<QString>&)l;
+}
+#endif
+
+/*!
+  Converts from a QStrList (ASCII) to a QStringList (Unicode).
+*/
+QStringList QStringList::fromStrList(const QStrList& ascii)
+{
+    QStringList res;
+    const char * s;
+    for ( QStrListIterator it(ascii); (s=it.current()); ++it )
+	res << s;
+    return res;
+}
+
+#endif //QT_NO_STRINGLIST
diff --git a/WebCore/kwq/qt/_qstack.h b/WebCore/src/kwq/qt/_qstringlist.h
similarity index 52%
copy from WebCore/kwq/qt/_qstack.h
copy to WebCore/src/kwq/qt/_qstringlist.h
index 2958a42..04d11c6 100644
--- a/WebCore/kwq/qt/_qstack.h
+++ b/WebCore/src/kwq/qt/_qstringlist.h
@@ -1,9 +1,9 @@
 /****************************************************************************
 ** $Id$
 **
-** Definition of QStack template/macro class
+** Definition of QStringList class
 **
-** Created : 920917
+** Created : 990406
 **
 ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
 **
@@ -35,36 +35,47 @@
 **
 **********************************************************************/
 
-#ifndef QSTACK_H
-#define QSTACK_H
+#ifndef QSTRINGLIST_H
+#define QSTRINGLIST_H
 
 #ifndef QT_H
-#include "_qglist.h"
+#include "qvaluelist.h"
+#include "qstring.h"
+#include "qregexp.h"
 #endif // QT_H
 
+#ifndef QT_NO_STRINGLIST
 
-template<class type> class QStack : private QGList
+class QStrList;
+
+class Q_EXPORT QStringList : public QValueList<QString>
 {
 public:
-    QStack()				{}
-    QStack( const QStack<type> &s ) : QGList(s) {}
-   ~QStack()				{ clear(); }
-    QStack<type> &operator=(const QStack<type> &s)
-			{ return (QStack<type>&)QGList::operator=(s); }
-    bool  autoDelete() const		{ return QCollection::autoDelete(); }
-    void  setAutoDelete( bool del )	{ QCollection::setAutoDelete(del); }
-    uint  count()   const		{ return QGList::count(); }
-    bool  isEmpty() const		{ return QGList::count() == 0; }
-    void  push( const type *d )		{ QGList::insertAt(0,Item(d)); }
-    type *pop()				{ return (type *)QGList::takeFirst(); }
-    bool  remove()			{ return QGList::removeFirst(); }
-    void  clear()			{ QGList::clear(); }
-    type *top()	    const		{ return (type *)QGList::cfirst(); }
-	  operator type *() const	{ return (type *)QGList::cfirst(); }
-    type *current() const		{ return (type *)QGList::cfirst(); }
-private:
-    void  deleteItem( Item d ) { if ( del_item ) delete (type *)d; }
-};
+    QStringList() { }
+    QStringList( const QStringList& l ) : QValueList<QString>(l) { }
+    QStringList( const QValueList<QString>& l ) : QValueList<QString>(l) { }
+    QStringList( const QString& i ) { append(i); }
+#ifndef QT_NO_CAST_ASCII
+    QStringList( const char* i ) { append(i); }
+#endif
+
+    static QStringList fromStrList(const QStrList&);
 
+    void sort();
+
+    static QStringList split( const QString &sep, const QString &str, bool allowEmptyEntries = FALSE );
+    static QStringList split(  const QChar &sep, const QString &str, bool allowEmptyEntries = FALSE );
+    static QStringList split(  const QRegExp &sep, const QString &str, bool allowEmptyEntries = FALSE );
+    QString join( const QString &sep ) const;
+
+    QStringList grep( const QString &str, bool cs = TRUE ) const;
+    QStringList grep( const QRegExp &expr ) const;
+};
 
-#endif // QSTACK_H
+#ifndef QT_NO_DATASTREAM
+class QDataStream;
+extern Q_EXPORT QDataStream &operator>>( QDataStream &, QStringList& );
+extern Q_EXPORT QDataStream &operator<<( QDataStream &, const QStringList& );
+#endif
+#endif // QT_NO_STRINGLIST
+#endif // QSTRINGLIST_H
diff --git a/WebCore/src/kwq/qt/_qstrlist.h b/WebCore/src/kwq/qt/_qstrlist.h
new file mode 100644
index 0000000..cf4caef
--- /dev/null
+++ b/WebCore/src/kwq/qt/_qstrlist.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of QStrList, QStrIList and QStrListIterator classes
+**
+** Created : 920730
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QSTRLIST_H
+#define QSTRLIST_H
+
+#ifndef QT_H
+#include "qstring.h"
+#include "qlist.h"
+
+#ifndef QT_NO_DATASTREAM
+#include "qdatastream.h"
+#endif
+
+#endif // QT_H
+
+
+#if defined(Q_TEMPLATEDLL)
+template class Q_EXPORT QList<char>;
+template class Q_EXPORT QListIterator<char>;
+#endif
+
+typedef QList<char>		QStrListBase;
+typedef QListIterator<char>	QStrListIterator;
+
+
+class Q_EXPORT QStrList : public QStrListBase
+{
+public:
+    QStrList( bool deepCopies=TRUE ) { dc = deepCopies; del_item = deepCopies; }
+    QStrList( const QStrList & );
+   ~QStrList()			{ clear(); }
+    QStrList& operator=( const QStrList & );
+
+private:
+    QCollection::Item newItem( QCollection::Item d ) { return dc ? qstrdup( (const char*)d ) : d; }
+    void deleteItem( QCollection::Item d ) { if ( del_item ) delete[] (char*)d; }
+    int compareItems( QCollection::Item s1, QCollection::Item s2 ) { return qstrcmp((const char*)s1,
+							 (const char*)s2); }
+#ifndef QT_NO_DATASTREAM
+    QDataStream &read( QDataStream &s, QCollection::Item &d )
+				{ s >> (char *&)d; return s; }
+    QDataStream &write( QDataStream &s, QCollection::Item d ) const
+				{ return s << (const char *)d; }
+#endif
+    bool  dc;
+};
+
+
+class Q_EXPORT QStrIList : public QStrList	// case insensitive string list
+{
+public:
+    QStrIList( bool deepCopies=TRUE ) : QStrList( deepCopies ) {}
+   ~QStrIList()			{ clear(); }
+private:
+    int	  compareItems( QCollection::Item s1, QCollection::Item s2 )
+				{ return qstricmp((const char*)s1,
+						    (const char*)s2); }
+};
+
+
+inline QStrList & QStrList::operator=( const QStrList &strList )
+{
+    clear();
+    dc = strList.dc;
+    del_item = dc;
+    QStrListBase::operator=(strList);
+    return *this;
+}
+
+inline QStrList::QStrList( const QStrList &strList )
+    : QStrListBase( strList )
+{
+    dc = FALSE;
+    operator=(strList);
+}
+
+
+#endif // QSTRLIST_H
diff --git a/WebCore/src/kwq/qt/_qtextstream.h b/WebCore/src/kwq/qt/_qtextstream.h
new file mode 100644
index 0000000..d1182ac
--- /dev/null
+++ b/WebCore/src/kwq/qt/_qtextstream.h
@@ -0,0 +1,2 @@
+// This file is empty for now until we can put in some support
+// for Qt I/O devices
diff --git a/WebCore/src/kwq/qt/_qtl.h b/WebCore/src/kwq/qt/_qtl.h
new file mode 100644
index 0000000..3b3b082
--- /dev/null
+++ b/WebCore/src/kwq/qt/_qtl.h
@@ -0,0 +1,227 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of Qt template library classes
+**
+** Created : 990128
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef QTL_H
+#define QTL_H
+
+#ifndef QT_H
+
+#ifndef QT_NO_TEXTSTREAM
+#include "qtextstream.h"
+#endif
+
+#include "qstring.h"
+#endif // QT_H
+
+#ifndef QT_NO_TEXTSTREAM
+template <class T>
+class QTextOStreamIterator
+{
+protected:
+    QTextOStream& stream;
+    QString separator;
+
+public:
+    QTextOStreamIterator( QTextOStream& s) : stream( s ) {}
+    QTextOStreamIterator( QTextOStream& s, const QString& sep )
+	: stream( s ), separator( sep )  {}
+    QTextOStreamIterator<T>& operator= ( const T& x ) {
+	stream << x;
+	if ( !separator.isEmpty() )
+	    stream << separator;
+	return *this;
+    }
+    QTextOStreamIterator<T>& operator*() { return *this; }
+    QTextOStreamIterator<T>& operator++() { return *this; }
+    QTextOStreamIterator<T>& operator++(int) { return *this; }
+};
+#endif //QT_NO_TEXTSTREAM
+
+template <class InputIterator, class OutputIterator>
+inline OutputIterator qCopy( InputIterator _begin, InputIterator _end,
+			     OutputIterator _dest )
+{
+    while( _begin != _end )
+	*_dest++ = *_begin++;
+    return _dest;
+}
+
+
+template <class T>
+inline void qSwap( T& _value1, T& _value2 )
+{
+    T tmp = _value1;
+    _value1 = _value2;
+    _value2 = tmp;
+}
+
+
+template <class InputIterator>
+inline void qBubbleSort( InputIterator b, InputIterator e )
+{
+    // Goto last element;
+    InputIterator last = e;
+    --last;
+    // only one element or no elements ?
+    if ( last == b )
+	return;
+
+    // So we have at least two elements in here
+    while( b != last ) {
+	bool swapped = FALSE;
+	InputIterator swap_pos = b;
+	InputIterator x = e;
+	InputIterator y = x;
+	y--;
+	do {
+	    --x;
+	    --y;
+	    if ( *x < *y ) {
+		swapped = TRUE;
+		qSwap( *x, *y );
+		swap_pos = y;
+	    }
+	} while( y != b );
+	if ( !swapped )
+	    return;
+	b = swap_pos;
+	b++;
+    }
+}
+
+
+template <class Container>
+inline void qBubbleSort( Container &c )
+{
+  qBubbleSort( c.begin(), c.end() );
+}
+
+
+template <class Value>
+inline void qHeapSortPushDown( Value* heap, int first, int last )
+{
+    int r = first;
+    while( r <= last/2 ) {
+	// Node r has only one child ?
+	if ( last == 2*r ) {
+	    // Need for swapping ?
+	    if ( heap[r] > heap[ 2*r ] )
+		qSwap( heap[r], heap[ 2*r ] );
+	    // That's it ...
+	    r = last;
+	} else { // Node has two children
+	    if ( heap[r] > heap[ 2*r ] && heap[ 2*r ] <= heap[ 2*r+1 ] ) {
+		// Swap with left child
+		qSwap( heap[r], heap[ 2*r ] );
+		r *= 2;
+	    } else if ( heap[r] > heap[ 2*r+1 ] &&
+			heap[ 2*r+1 ] < heap[ 2*r ] ) {
+		// Swap with right child
+		qSwap( heap[r], heap[ 2*r+1 ] );
+		r = 2*r+1;
+	    } else {
+		// We are done
+		r = last;
+	    }
+	}
+    }
+}
+
+
+template <class InputIterator, class Value>
+inline void qHeapSortHelper( InputIterator b, InputIterator e, Value, uint n )
+{
+    // Create the heap
+    InputIterator insert = b;
+    Value* realheap = new Value[ n ];
+    // Wow, what a fake. But I want the heap to be indexed as 1...n
+    Value* heap = realheap - 1;
+    int size = 0;
+    for( ; insert != e; ++insert ) {
+	heap[++size] = *insert;
+	int i = size;
+	while( i > 1 && heap[i] < heap[ i / 2 ] ) {
+	    qSwap( heap[i], heap[ i / 2 ] );
+	    i /= 2;
+	}
+    }
+
+    // Now do the sorting
+    for( uint i = n; i > 0; i-- ) {
+	*b++ = heap[1];
+	if ( i > 1 ) {
+	    heap[1] = heap[i];
+	    qHeapSortPushDown( heap, 1, (int)i - 1 );
+	}
+    }
+
+    delete[] realheap;
+}
+
+
+template <class InputIterator>
+inline void qHeapSort( InputIterator b, InputIterator e )
+{
+    // Empty ?
+    if ( b == e )
+	return;
+
+    // How many entries have to be sorted ?
+    InputIterator it = b;
+    uint n = 0;
+    while ( it != e ) {
+	++n;
+	++it;
+    }
+
+    // The second last parameter is a hack to retrieve the value type
+    // Do the real sorting here
+    qHeapSortHelper( b, e, *b, n );
+}
+
+
+template <class Container>
+inline void qHeapSort( Container &c )
+{
+    if ( c.isEmpty() )
+	return;
+
+    // The second last parameter is a hack to retrieve the value type
+    // Do the real sorting here
+    qHeapSortHelper( c.begin(), c.end(), *(c.begin()), c.count() );
+}
+
+#endif
diff --git a/WebCore/src/kwq/qt/_qvaluelist.h b/WebCore/src/kwq/qt/_qvaluelist.h
new file mode 100644
index 0000000..28231c5
--- /dev/null
+++ b/WebCore/src/kwq/qt/_qvaluelist.h
@@ -0,0 +1,453 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of QValueList class
+**
+** Created : 990406
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the tools module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QVALUELIST_H
+#define QVALUELIST_H
+
+#ifndef QT_H
+#include "_qshared.h"
+
+#ifndef QT_NO_DATASTREAM
+#include "qdatastream.h"
+#endif
+
+#endif // QT_H
+
+#if defined(_CC_MSVC_)
+#pragma warning(disable:4284) // "return type for operator -> is not a UDT"
+#endif
+
+template <class T>
+class Q_EXPORT QValueListNode
+{
+public:
+    QValueListNode( const T& t ) : data( t ) { }
+    QValueListNode() { }
+#if defined(Q_TEMPLATEDLL)
+    // Workaround MS bug in memory de/allocation in DLL vs. EXE 
+    virtual ~QValueListNode() { }
+#endif
+
+    QValueListNode<T>* next;
+    QValueListNode<T>* prev;
+    T data;
+};
+
+template<class T>
+class Q_EXPORT QValueListIterator
+{
+ public:
+    /**
+     * Typedefs
+     */
+    typedef QValueListNode<T>* NodePtr;
+
+    /**
+     * Variables
+     */
+    NodePtr node;
+
+    /**
+     * Functions
+     */
+    QValueListIterator() : node( 0 ) {}
+    QValueListIterator( NodePtr p ) : node( p ) {}
+    QValueListIterator( const QValueListIterator<T>& it ) : node( it.node ) {}
+
+    bool operator==( const QValueListIterator<T>& it ) const { return node == it.node; }
+    bool operator!=( const QValueListIterator<T>& it ) const { return node != it.node; }
+    const T& operator*() const { return node->data; }
+    T& operator*() { return node->data; }
+
+    // Compilers are too dumb to understand this for QValueList<int>
+    //T* operator->() const { return &(node->data); }
+
+    QValueListIterator<T>& operator++() {
+	node = node->next;
+	return *this;
+    }
+
+    QValueListIterator<T> operator++(int) {
+	QValueListIterator<T> tmp = *this;
+	node = node->next;
+	return tmp;
+    }
+
+    QValueListIterator<T>& operator--() {
+	node = node->prev;
+	return *this;
+    }
+
+    QValueListIterator<T> operator--(int) {
+	QValueListIterator<T> tmp = *this;
+	node = node->prev;
+	return tmp;
+    }
+};
+
+template<class T>
+class Q_EXPORT QValueListConstIterator
+{
+ public:
+    /**
+     * Typedefs
+     */
+    typedef QValueListNode<T>* NodePtr;
+
+    /**
+     * Variables
+     */
+    NodePtr node;
+
+    /**
+     * Functions
+     */
+    QValueListConstIterator() : node( 0 ) {}
+    QValueListConstIterator( NodePtr p ) : node( p ) {}
+    QValueListConstIterator( const QValueListConstIterator<T>& it ) : node( it.node ) {}
+    QValueListConstIterator( const QValueListIterator<T>& it ) : node( it.node ) {}
+
+    bool operator==( const QValueListConstIterator<T>& it ) const { return node == it.node; }
+    bool operator!=( const QValueListConstIterator<T>& it ) const { return node != it.node; }
+    const T& operator*() const { return node->data; }
+
+    // Compilers are too dumb to understand this for QValueList<int>
+    //const T* operator->() const { return &(node->data); }
+
+    QValueListConstIterator<T>& operator++() {
+	node = node->next;
+	return *this;
+    }
+
+    QValueListConstIterator<T> operator++(int) {
+	QValueListConstIterator<T> tmp = *this;
+	node = node->next;
+	return tmp;
+    }
+
+    QValueListConstIterator<T>& operator--() {
+	node = node->prev;
+	return *this;
+    }
+
+    QValueListConstIterator<T> operator--(int) {
+	QValueListConstIterator<T> tmp = *this;
+	node = node->prev;
+	return tmp;
+    }
+};
+
+template <class T>
+class Q_EXPORT QValueListPrivate : public QShared
+{
+public:
+    /**
+     * Typedefs
+     */
+    typedef QValueListIterator<T> Iterator;
+    typedef QValueListConstIterator<T> ConstIterator;
+    typedef QValueListNode<T> Node;
+    typedef QValueListNode<T>* NodePtr;
+
+    /**
+     * Functions
+     */
+    QValueListPrivate() { node = new Node; node->next = node->prev = node; nodes = 0; }
+    QValueListPrivate( const QValueListPrivate<T>& _p ) : QShared() {
+	node = new Node; node->next = node->prev = node; nodes = 0;
+	Iterator b( _p.node->next );
+	Iterator e( _p.node );
+	Iterator i( node );
+	while( b != e )
+	    insert( i, *b++ );
+    }
+
+    void derefAndDelete() // ### hack to get around hp-cc brain damage
+    {
+	if ( deref() )
+	    delete this;
+    }
+
+#if defined(Q_TEMPLATEDLL)
+    // Workaround MS bug in memory de/allocation in DLL vs. EXE 
+    virtual
+#endif
+    ~QValueListPrivate() {
+	NodePtr p = node->next;
+	while( p != node ) {
+	    NodePtr x = p->next;
+	    delete p;
+	    p = x;
+	}
+	delete node;
+    }
+
+    Iterator insert( Iterator it, const T& x ) {
+	NodePtr p = new Node( x );
+	p->next = it.node;
+	p->prev = it.node->prev;
+	it.node->prev->next = p;
+	it.node->prev = p;
+	nodes++;
+	return p;
+    }
+
+    Iterator remove( Iterator it ) {
+	ASSERT ( it.node != node );
+	NodePtr next = it.node->next;
+	NodePtr prev = it.node->prev;
+	prev->next = next;
+	next->prev = prev;
+	delete it.node;
+	nodes--;
+	return Iterator( next );
+    }
+
+    NodePtr find( NodePtr start, const T& x ) const {
+	ConstIterator first( start );
+	ConstIterator last( node );
+	while( first != last) {
+	    if ( *first == x )
+		return first.node;
+	    ++first;
+	}
+	return last.node;
+    }
+
+    int findIndex( NodePtr start, const T& x ) const {
+	ConstIterator first( start );
+	ConstIterator last( node );
+	int pos = 0;
+	while( first != last) {
+	    if ( *first == x )
+		return pos;
+	    ++first;
+	    ++pos;
+	}
+	return -1;
+    }
+
+    uint contains( const T& x ) const {
+	uint result = 0;
+	Iterator first = Iterator( node->next );
+	Iterator last = Iterator( node );
+	while( first != last) {
+	    if ( *first == x )
+		++result;
+	    ++first;
+	}
+	return result;
+    }
+
+    void remove( const T& x ) {
+	Iterator first = Iterator( node->next );
+	Iterator last = Iterator( node );
+	while( first != last) {
+	    if ( *first == x )
+		first = remove( first );
+	    else
+		++first;
+	}
+    }
+
+    NodePtr at( uint i ) const {
+	ASSERT( i <= nodes );
+	NodePtr p = node->next;
+	for( uint x = 0; x < i; ++x )
+	    p = p->next;
+	return p;
+    }
+
+    void clear() {
+	nodes = 0;
+	NodePtr p = node->next;
+	while( p != node ) {
+	    NodePtr next = p->next;
+	    delete p;
+	    p = next;
+	}
+	node->next = node->prev = node;
+    }
+
+    NodePtr node;
+    uint nodes;
+};
+
+template <class T>
+class Q_EXPORT QValueList
+{
+public:
+    /**
+     * Typedefs
+     */
+    typedef QValueListIterator<T> Iterator;
+    typedef QValueListConstIterator<T> ConstIterator;
+    typedef T ValueType;
+
+    /**
+     * API
+     */
+    QValueList() { sh = new QValueListPrivate<T>; }
+    QValueList( const QValueList<T>& l ) { sh = l.sh; sh->ref(); }
+    ~QValueList() { sh->derefAndDelete(); }
+
+    QValueList<T>& operator= ( const QValueList<T>& l )
+    {
+	l.sh->ref();
+	sh->derefAndDelete();
+	sh = l.sh;
+	return *this;
+    }
+
+    QValueList<T> operator+ ( const QValueList<T>& l ) const
+    {
+	QValueList<T> l2( *this );
+	for( ConstIterator it = l.begin(); it != l.end(); ++it )
+	    l2.append( *it );
+	return l2;
+    }
+
+    QValueList<T>& operator+= ( const QValueList<T>& l )
+    {
+	for( ConstIterator it = l.begin(); it != l.end(); ++it )
+	    append( *it );
+	return *this;
+    }
+
+    bool operator== ( const QValueList<T>& l ) const
+    {
+	if ( count() != l.count() )
+	    return FALSE;
+	ConstIterator it2 = begin();
+	ConstIterator it = l.begin();
+	for( ; it != l.end(); ++it, ++it2 )
+	    if ( !( *it == *it2 ) )
+		return FALSE;
+	return TRUE;
+    }
+
+    bool operator!= ( const QValueList<T>& l ) const { return !( *this == l ); }
+
+    Iterator begin() { detach(); return Iterator( sh->node->next ); }
+    ConstIterator begin() const { return ConstIterator( sh->node->next ); }
+    Iterator end() { detach(); return Iterator( sh->node ); }
+    ConstIterator end() const { return ConstIterator( sh->node ); }
+    Iterator fromLast() { detach(); return Iterator( sh->node->prev ); }
+    ConstIterator fromLast() const { return ConstIterator( sh->node->prev ); }
+
+    bool isEmpty() const { return ( sh->nodes == 0 ); }
+
+    Iterator insert( Iterator it, const T& x ) { detach(); return sh->insert( it, x ); }
+
+    Iterator append( const T& x ) { detach(); return sh->insert( end(), x ); }
+    Iterator prepend( const T& x ) { detach(); return sh->insert( begin(), x ); }
+
+    Iterator remove( Iterator it ) { detach(); return sh->remove( it ); }
+    void remove( const T& x ) { detach(); sh->remove( x ); }
+
+    T& first() { detach(); return sh->node->next->data; }
+    const T& first() const { return sh->node->next->data; }
+    T& last() { detach(); return sh->node->prev->data; }
+    const T& last() const { return sh->node->prev->data; }
+
+    T& operator[] ( uint i ) { detach(); return sh->at(i)->data; }
+    const T& operator[] ( uint i ) const { return sh->at(i)->data; }
+    Iterator at( uint i ) { detach(); return Iterator( sh->at(i) ); }
+    ConstIterator at( uint i ) const { return ConstIterator( sh->at(i) ); }
+    Iterator find ( const T& x ) { detach(); return Iterator( sh->find( sh->node->next, x) ); }
+    ConstIterator find ( const T& x ) const { return ConstIterator( sh->find( sh->node->next, x) ); }
+    Iterator find ( Iterator it, const T& x ) { detach(); return Iterator( sh->find( it.node, x ) ); }
+    ConstIterator find ( ConstIterator it, const T& x ) const { return ConstIterator( sh->find( it.node, x ) ); }
+    int findIndex( const T& x ) const { return sh->findIndex( sh->node->next, x) ; }
+    uint contains( const T& x ) const { return sh->contains( x ); }
+
+    uint count() const { return sh->nodes; }
+
+    void clear() { if ( sh->count == 1 ) sh->clear(); else { sh->deref(); sh = new QValueListPrivate<T>; } }
+
+
+    QValueList<T>& operator+= ( const T& x )
+    {
+	append( x );
+	return *this;
+    }
+    QValueList<T>& operator<< ( const T& x )
+    {
+	append( x );
+	return *this;
+    }
+
+
+protected:
+    /**
+     * Helpers
+     */
+    void detach() { if ( sh->count > 1 ) { sh->deref(); sh = new QValueListPrivate<T>( *sh ); } }
+
+    /**
+     * Variables
+     */
+    QValueListPrivate<T>* sh;
+};
+
+#ifndef QT_NO_DATASTREAM
+template<class T>
+inline QDataStream& operator>>( QDataStream& s, QValueList<T>& l )
+{
+    l.clear();
+    Q_UINT32 c;
+    s >> c;
+    for( Q_UINT32 i = 0; i < c; ++i )
+    {
+	T t;
+	s >> t;
+	l.append( t );
+    }
+    return s;
+}
+
+template<class T>
+inline QDataStream& operator<<( QDataStream& s, const QValueList<T>& l )
+{
+    s << (Q_UINT32)l.count();
+    QValueListConstIterator<T> it = l.begin();
+    for( ; it != l.end(); ++it )
+	s << *it;
+    return s;
+}
+#endif // QT_NO_DATASTREAM
+#endif // QVALUELIST_H
diff --git a/WebCore/src/kwq/qt/qdatetime.h b/WebCore/src/kwq/qt/qdatetime.h
index 9ec7036..f185d3f 100644
--- a/WebCore/src/kwq/qt/qdatetime.h
+++ b/WebCore/src/kwq/qt/qdatetime.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qdatetime.h>
+#else
+
 // class QTime =================================================================
 
 class QTime {
@@ -153,4 +159,6 @@ public:
 
 }; // class QDateTime ==========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/src/kwq/qt/qlist.h b/WebCore/src/kwq/qt/qlist.h
index 5c8ae91..b0a5152 100644
--- a/WebCore/src/kwq/qt/qlist.h
+++ b/WebCore/src/kwq/qt/qlist.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qlist.h>
+#else
+
 #include <KWQDef.h>
 #include <KWQCollection.h>
 
@@ -136,4 +142,6 @@ private:
 
 }; // class QListIterator ======================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/src/kwq/qt/qsortedlist.h b/WebCore/src/kwq/qt/qsortedlist.h
index cfb570c..eee362a 100644
--- a/WebCore/src/kwq/qt/qsortedlist.h
+++ b/WebCore/src/kwq/qt/qsortedlist.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qsortedlist.h>
+#else
+
 #include "qlist.h"
 
 // class QSortedList ===========================================================
@@ -59,4 +65,6 @@ public:
 
 }; // class QSortedList ========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/src/kwq/qt/qstringlist.h b/WebCore/src/kwq/qt/qstringlist.h
index 35207db..5f339a6 100644
--- a/WebCore/src/kwq/qt/qstringlist.h
+++ b/WebCore/src/kwq/qt/qstringlist.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qstringlist.h>
+#else
+
 #include "qstring.h"
 #include "qvaluelist.h"
 
@@ -69,4 +75,6 @@ public:
 
 }; // class QStringList ========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/src/kwq/qt/qtextstream.h b/WebCore/src/kwq/qt/qtextstream.h
index e600247..d679c4b 100644
--- a/WebCore/src/kwq/qt/qtextstream.h
+++ b/WebCore/src/kwq/qt/qtextstream.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qtextstream.h>
+#else
+
 #include "qstring.h"
 
 // class QTextStream ===========================================================
@@ -159,4 +165,6 @@ private:
 
 }; // class QTextOStream =======================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif
diff --git a/WebCore/src/kwq/qt/qvaluelist.h b/WebCore/src/kwq/qt/qvaluelist.h
index 069f71a..ed60c14 100644
--- a/WebCore/src/kwq/qt/qvaluelist.h
+++ b/WebCore/src/kwq/qt/qvaluelist.h
@@ -30,6 +30,12 @@
 #include <config.h>
 #endif
 
+// _KWQ_COMPLETE_ ==============================================================
+
+#ifdef _KWQ_COMPLETE_
+#include <_qvaluelist.h>
+#else
+
 #include <KWQDef.h>
 
 // class QValueListIterator ====================================================
@@ -158,4 +164,6 @@ public:
 
 }; // class QValueList =========================================================
 
+#endif // _KWQ_COMPLETE_
+
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list