diff options
author | Sergio Ahumada <sergio.ahumada@nokia.com> | 2011-08-31 11:54:04 (GMT) |
---|---|---|
committer | Sergio Ahumada <sergio.ahumada@nokia.com> | 2011-08-31 11:54:04 (GMT) |
commit | 9f51c31a0f492c20e6d882b2ae1e036b29c2755c (patch) | |
tree | cbb3beed71735514632b4f2788b63e72667cfc04 /src/corelib/tools | |
parent | 0e10b8dbb7d84694cbdeb57bf42df52b12d79f47 (diff) | |
parent | 4f933036a0ecbc6e6174b312ec2fd6078cea5b70 (diff) | |
download | Qt-9f51c31a0f492c20e6d882b2ae1e036b29c2755c.zip Qt-9f51c31a0f492c20e6d882b2ae1e036b29c2755c.tar.gz Qt-9f51c31a0f492c20e6d882b2ae1e036b29c2755c.tar.bz2 |
Merge remote-tracking branch 'upstream/4.8' into qt-4.8-from-4.7
Conflicts:
src/network/ssl/qsslcertificate.cpp
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 7 | ||||
-rw-r--r-- | src/corelib/tools/qlist.h | 31 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.qdoc | 4 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_symbian.cpp | 63 |
4 files changed, 84 insertions, 21 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index a6fee43..e33b7d5 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -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.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; } |