summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qcache.h3
-rw-r--r--src/corelib/tools/qdatetime.cpp11
-rw-r--r--src/corelib/tools/qlist.cpp4
-rw-r--r--src/corelib/tools/qlist.h31
-rw-r--r--src/corelib/tools/qlocale.qdoc4
-rw-r--r--src/corelib/tools/qlocale_symbian.cpp63
6 files changed, 89 insertions, 27 deletions
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index 16861c9..2408cd3 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -205,8 +205,7 @@ void QCache<Key,T>::trim(int m)
while (n && total > m) {
Node *u = n;
n = n->p;
- if (qIsDetached(*u->t))
- unlink(*u);
+ unlink(*u);
}
}
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index a6fee43..e1b4232 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -1538,7 +1538,7 @@ int QTime::msec() const
If \a format is Qt::ISODate, the string format corresponds to the
ISO 8601 extended specification for representations of dates,
- which is also HH:MM:SS. (However, contrary to ISO 8601, dates
+ which is also HH:mm:ss. (However, contrary to ISO 8601, dates
before 15 October 1582 are handled as Julian dates, not Gregorian
dates. See \l{QDate G and J} {Use of Gregorian and Julian
Calendars}. This might change in a future version of Qt.)
@@ -2461,7 +2461,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
If the \a format is Qt::ISODate, the string format corresponds
to the ISO 8601 extended specification for representations of
- dates and times, taking the form YYYY-MM-DDTHH:MM:SS[Z|[+|-]HH:MM],
+ dates and times, taking the form YYYY-MM-DDTHH:mm:ss[Z|[+|-]HH:mm],
depending on the timeSpec() of the QDateTime. If the timeSpec()
is Qt::UTC, Z will be appended to the string; if the timeSpec() is
Qt::OffsetFromUTC the offset in hours and minutes from UTC will
@@ -2788,6 +2788,8 @@ int QDateTime::secsTo(const QDateTime &other) const
}
/*!
+ \since 4.7
+
Returns the number of milliseconds from this datetime to the \a other
datetime. If the \a other datetime is earlier than this datetime,
the value returned is negative.
@@ -4040,8 +4042,11 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time)
RTz tz;
User::LeaveIfError(tz.Connect());
CleanupClosePushL(tz);
- res.tm_isdst = tz.IsDaylightSavingOnL(*tz.GetTimeZoneIdL(),utcTTime);
+ CTzId *tzId = tz.GetTimeZoneIdL();
+ CleanupStack::PushL(tzId);
+ res.tm_isdst = tz.IsDaylightSavingOnL(*tzId,utcTTime);
User::LeaveIfError(tz.ConvertToLocalTime(utcTTime));
+ CleanupStack::PopAndDestroy(tzId);
CleanupStack::PopAndDestroy(&tz));
if (KErrNone == err) {
TDateTime localDateTime = utcTTime.DateTime();
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index e68ddd5..18bfe24 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -460,8 +460,8 @@ void **QListData::erase(void **xi)
Note that the internal array only ever gets bigger over the life
of the list. It never shrinks. The internal array is deallocated
- by the destructor and by the assignment operator, when one list
- is assigned to another.
+ by the destructor, by clear(), and by the assignment operator,
+ when one list is assigned to another.
Here's an example of a QList that stores integers and
a QList that stores QDate values:
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 4eb05d6..9f7b23f 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -769,25 +769,32 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::clear()
template <typename T>
Q_OUTOFLINE_TEMPLATE int QList<T>::removeAll(const T &_t)
{
- detachShared();
+ int index = indexOf(_t);
+ if (index == -1)
+ return 0;
+
const T t = _t;
- int removedCount=0, i=0;
- Node *n;
- while (i < p.size())
- if ((n = reinterpret_cast<Node *>(p.at(i)))->t() == t) {
- node_destruct(n);
- p.remove(i);
- ++removedCount;
- } else {
- ++i;
- }
+ detach();
+
+ Node *i = reinterpret_cast<Node *>(p.at(index));
+ Node *e = reinterpret_cast<Node *>(p.end());
+ Node *n = i;
+ node_destruct(i);
+ while (++i != e) {
+ if (i->t() == t)
+ node_destruct(i);
+ else
+ *n++ = *i;
+ }
+
+ int removedCount = e - n;
+ d->end -= removedCount;
return removedCount;
}
template <typename T>
Q_OUTOFLINE_TEMPLATE bool QList<T>::removeOne(const T &_t)
{
- detachShared();
int index = indexOf(_t);
if (index != -1) {
removeAt(index);
diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc
index 5d4f305..95a7165 100644
--- a/src/corelib/tools/qlocale.qdoc
+++ b/src/corelib/tools/qlocale.qdoc
@@ -806,6 +806,10 @@
\internal
*/
/*!
+ \fn QSystemLocale::CurrencyToStringArgument::CurrencyToStringArgument(const QVariant &v, const QString &s)
+ \internal
+*/
+/*!
\variable QSystemLocale::CurrencyToStringArgument::value
An input value that should be converted to its string representation.
diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp
index cdf0ab1..1214e46 100644
--- a/src/corelib/tools/qlocale_symbian.cpp
+++ b/src/corelib/tools/qlocale_symbian.cpp
@@ -195,7 +195,9 @@ QByteArray qt_symbianLocaleName(int code)
return qt_resolveSymbianLocaleName(code, ISO);
}
-// order is: normal, abbr, nmode, nmode+abbr
+// Rows are: normal, abbr, nmode, nmode+abbr
+// First three values on a row are used for three component date,
+// while the last two are used for two component date (i.e. no year).
static const char *us_locale_dep[] = {
"MM", "dd", "yyyy", "MM", "dd",
"M", "d", "yy", "M", "d",
@@ -214,6 +216,13 @@ static const char *jp_locale_dep[] = {
"yyyy", "MMMM", "dd", "MMMM", "dd",
"yy", "MMM", "d", "MMM", "d" };
+// 0 = day, 1 = month, 2 = year
+static const int digit_map[] = {
+ 1, 0, 2, 1, 0, // American
+ 0, 1, 2, 0, 1, // European
+ 2, 1, 0, 1, 0 // Japanese
+};
+
/*!
Returns a Qt version of the given \a sys_fmt Symbian locale format string.
*/
@@ -229,6 +238,9 @@ static QString s60ToQtFormat(const QString &sys_fmt)
int i = 0;
bool open_escape = false;
bool abbrev_next = false;
+ bool abbrev_day = false;
+ bool abbrev_month = false;
+ bool abbrev_year = false;
bool locale_indep_ordering = false;
bool minus_mode = false;
bool plus_mode = false;
@@ -305,8 +317,11 @@ static QString s60ToQtFormat(const QString &sys_fmt)
case 'D':
{
- if (!locale_indep_ordering)
+ if (!locale_indep_ordering) {
+ if (abbrev_next)
+ abbrev_day = true;
break;
+ }
if (!abbrev_next)
result += QLatin1String("dd");
@@ -318,8 +333,11 @@ static QString s60ToQtFormat(const QString &sys_fmt)
case 'M':
{
- if (!locale_indep_ordering)
+ if (!locale_indep_ordering) {
+ if (abbrev_next)
+ abbrev_month = true;
break;
+ }
if (!n_mode) {
if (!abbrev_next)
@@ -340,8 +358,11 @@ static QString s60ToQtFormat(const QString &sys_fmt)
{
n_mode = true;
- if (!locale_indep_ordering)
+ if (!locale_indep_ordering) {
+ if (abbrev_next)
+ abbrev_month = true;
break;
+ }
if (!abbrev_next)
result += QLatin1String("MMMM");
@@ -353,8 +374,11 @@ static QString s60ToQtFormat(const QString &sys_fmt)
case 'Y':
{
- if (!locale_indep_ordering)
+ if (!locale_indep_ordering) {
+ if (abbrev_next)
+ abbrev_year = true;
break;
+ }
if (!abbrev_next)
result += QLatin1String("yyyy");
@@ -522,7 +546,9 @@ static QString s60ToQtFormat(const QString &sys_fmt)
const char **locale_dep;
switch (df) {
- default: // fallthru to american
+ default:
+ df = EDateAmerican;
+ // fallthru to american
case EDateAmerican:
locale_dep = us_locale_dep;
break;
@@ -534,12 +560,33 @@ static QString s60ToQtFormat(const QString &sys_fmt)
break;
}
int offset = 0;
- if (abbrev_next)
+ int adjustedDigit = c.digitValue() - 1;
+
+ bool abbrev_this = abbrev_next;
+ // If abbreviation specified for this digit, use that.
+ // Otherwise abbreviate according to %D, %M, and %Y specified previously.
+ if (!abbrev_this) {
+ switch (digit_map[adjustedDigit + (static_cast<int>(df) * 5)]) {
+ case 0:
+ abbrev_this = abbrev_day;
+ break;
+ case 1:
+ abbrev_this = abbrev_month;
+ break;
+ case 2:
+ abbrev_this = abbrev_year;
+ break;
+ default:
+ break; // never happens
+ }
+ }
+
+ if (abbrev_this)
offset += 5;
if (n_mode)
offset += 10;
- result += QLatin1String(locale_dep[offset + (c.digitValue()-1)]);
+ result += QLatin1String(locale_dep[offset + (adjustedDigit)]);
break;
}