summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-13 19:07:50 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-13 19:07:50 (GMT)
commit31486a63ebc74964ad63cf3187b4476d6563b841 (patch)
tree84fc263b3d85758b569c4f2ad4a902a90d6b2e71 /src
parent42dda19d82ceea48f19d356cfaf2b26acb763df8 (diff)
parent060155f2819b4dbad9d91cffa8af1d6ec7e4338c (diff)
downloadQt-31486a63ebc74964ad63cf3187b4476d6563b841.zip
Qt-31486a63ebc74964ad63cf3187b4476d6563b841.tar.gz
Qt-31486a63ebc74964ad63cf3187b4476d6563b841.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (28 commits) Optimized QLocale to access system locale on demand. Fix QRegion under Mac OS X. update according to Thiago's comments. Changes: add functionality for dbus auto start to qt Add license header to this file readdir64 is not available on HP-UX Fix bug in QDirPrivate::setPath, affecting QDir::cd, cdUp and setPath qdoc3: Completed handling of the new \pagekeywords command. Wrong cursor shown by the parent window after setOverrideCursor(). Fixed Mac OS X compile time error by using GLint for temp. qdoc3: Added curly braces in switch statement for braindead compiler. qdoc: Added a build rule for the documentation - disabled by default. Doc: Added the qdoc manual to the repository for future maintenance. qdoc3: Fixed bug in creation of qt.pageindex. qdoc3: Added capability to create qt.pageindex. Incorrect property setter generated by dumpcpp for Microsoft Word 2007. Cocoa: Implement our own NSApplication subclass Cocoa: Menu in menubar stays highlighted qdoc: Made a temporary fix for comment highlighting. Doc: Tidied up the class layout and removed an unnecessary image. ...
Diffstat (limited to 'src')
-rw-r--r--src/activeqt/container/qaxbase.cpp5
-rw-r--r--src/corelib/io/qdir.cpp18
-rw-r--r--src/corelib/tools/qlocale.cpp215
-rw-r--r--src/corelib/tools/qlocale.h1
-rw-r--r--src/corelib/tools/qlocale_p.h2
-rw-r--r--src/dbus/qdbus_symbols_p.h5
-rw-r--r--src/dbus/qdbusmessage.cpp43
-rw-r--r--src/dbus/qdbusmessage.h3
-rw-r--r--src/dbus/qdbusmessage_p.h1
-rw-r--r--src/gui/kernel/qapplication_mac.mm2
-rw-r--r--src/gui/kernel/qapplication_win.cpp11
-rw-r--r--src/gui/kernel/qcocoaapplication_mac.mm45
-rw-r--r--src/gui/kernel/qcocoaapplication_mac_p.h8
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac.mm6
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac_p.h1
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h12
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm10
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm3
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm45
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h25
-rw-r--r--src/gui/widgets/qdialogbuttonbox.cpp28
-rw-r--r--src/gui/widgets/qmenu_mac.mm15
-rw-r--r--src/gui/widgets/qmenubar_p.h1
-rw-r--r--src/opengl/qglshaderprogram.cpp2
24 files changed, 398 insertions, 109 deletions
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp
index 99447a9..02a29d9 100644
--- a/src/activeqt/container/qaxbase.cpp
+++ b/src/activeqt/container/qaxbase.cpp
@@ -2543,6 +2543,11 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs)
break;
}
if (funcdesc->invkind == INVOKE_PROPERTYPUT) {
+ // remove the typename guessed for property setters
+ // its done only for setter's with more than one parameter.
+ if (funcdesc->cParams - funcdesc->cParamsOpt > 1) {
+ type.clear();
+ }
QByteArray set;
if (isupper(prototype.at(0))) {
set = "Set";
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index f5d803e..7cfdddf 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -89,8 +89,6 @@ public:
QDirPrivate(const QDir *copy = 0);
~QDirPrivate();
- QString initFileEngine(const QString &file);
-
void updateFileLists() const;
void sortFileList(QDir::SortFlags, QFileInfoList &, QStringList *, QFileInfoList *) const;
@@ -146,6 +144,7 @@ public:
} *data;
inline void setPath(const QString &p)
{
+ detach(false);
QString path = p;
if ((path.endsWith(QLatin1Char('/')) || path.endsWith(QLatin1Char('\\')))
&& path.length() > 1) {
@@ -155,8 +154,12 @@ public:
path.truncate(path.length() - 1);
}
+ delete data->fileEngine;
+ data->fileEngine = QAbstractFileEngine::create(path);
+
// set the path to be the qt friendly version so then we can operate on it using just /
- data->path = initFileEngine(path);
+ data->path = data->fileEngine->fileName(QAbstractFileEngine::DefaultName);
+ data->clear();
}
inline void reset() {
detach();
@@ -310,15 +313,6 @@ inline void QDirPrivate::updateFileLists() const
}
}
-inline QString QDirPrivate::initFileEngine(const QString &path)
-{
- detach(false);
- data->clear();
- delete data->fileEngine;
- data->fileEngine = QAbstractFileEngine::create(path);
- return data->fileEngine->fileName(QAbstractFileEngine::DefaultName);
-}
-
void QDirPrivate::detach(bool createFileEngine)
{
qAtomicDetach(data);
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index ff10fa1..1df4fa0 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -1274,11 +1274,25 @@ QLocale QSystemLocale::fallbackLocale() const
*/
QVariant QSystemLocale::query(QueryType type, QVariant /* in */) const
{
- if (type == MeasurementSystem) {
+ switch (type) {
+ case MeasurementSystem:
return QVariant(unixGetSystemMeasurementSystem());
- } else {
- return QVariant();
+ case LanguageId:
+ case CountryId: {
+ QString locale = QLatin1String(envVarLocale());
+ QLocale::Language lang;
+ QLocale::Country cntry;
+ getLangAndCountry(locale, lang, cntry);
+ if (type == LanguageId)
+ return lang;
+ if (cntry == QLocale::AnyCountry)
+ return fallbackLocale().country();
+ return cntry;
}
+ default:
+ break;
+ }
+ return QVariant();
}
#elif !defined(Q_OS_SYMBIAN)
@@ -1388,7 +1402,8 @@ QSystemLocale::QSystemLocale()
/*! \internal */
QSystemLocale::QSystemLocale(bool)
-{ }
+{
+}
/*!
Deletes the object.
@@ -1410,16 +1425,71 @@ static const QSystemLocale *systemLocale()
return QSystemLocale_globalSystemLocale();
}
+// returns the private data for the system locale. Cached data will not be
+// initialized until the updateSystemPrivate is called.
+static const QLocalePrivate *systemPrivate()
+{
+#ifndef QT_NO_SYSTEMLOCALE
+ if (!system_lp) {
+ system_lp = globalLocalePrivate();
+ // mark the locale as uninitialized system locale
+ system_lp->m_language_id = 0;
+ }
+ return system_lp;
+#else
+ return locale_data;
+#endif
+}
+
+#ifndef QT_NO_SYSTEMLOCALE
+static const QLocalePrivate *maybeSystemPrivate()
+{
+ return system_lp;
+}
+#endif
+
+static const QLocalePrivate *defaultPrivate()
+{
+ if (!default_lp)
+ default_lp = systemPrivate();
+ return default_lp;
+}
+
+bool QLocalePrivate::isUninitializedSystemLocale() const
+{
+ return this == maybeSystemPrivate() && m_language_id == 0;
+}
+
+QVariant QLocalePrivate::querySystemLocale(QSystemLocale::QueryType type, const QVariant &in) const
+{
+ QVariant res = systemLocale()->query(type, in);
+ if (res.isNull() && isUninitializedSystemLocale()) {
+ // if we were not able to get data from the system, initialize the
+ // system locale private data (which is essentially equals to this)
+ // with a fallback locale.
+ QLocalePrivate *system_private = globalLocalePrivate();
+ *system_private = *systemLocale()->fallbackLocale().d();
+ // internal cache is not initialized with values from the system, mark
+ // it as not fully initialized system locale.
+ system_private->m_language_id = 0;
+ }
+ return res;
+}
+
+// retrieves data from the system locale and caches them locally.
void QLocalePrivate::updateSystemPrivate()
{
const QSystemLocale *sys_locale = systemLocale();
if (!system_lp)
- system_lp = globalLocalePrivate();
+ return;
+
+ // copy over the information from the fallback locale and modify
*system_lp = *sys_locale->fallbackLocale().d();
QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant());
if (!res.isNull())
system_lp->m_language_id = res.toInt();
+
res = sys_locale->query(QSystemLocale::CountryId, QVariant());
if (!res.isNull())
system_lp->m_country_id = res.toInt();
@@ -1446,26 +1516,6 @@ void QLocalePrivate::updateSystemPrivate()
}
#endif
-static const QLocalePrivate *systemPrivate()
-{
-#ifndef QT_NO_SYSTEMLOCALE
- // copy over the information from the fallback locale and modify
- if (!system_lp || system_lp->m_language_id == 0)
- QLocalePrivate::updateSystemPrivate();
-
- return system_lp;
-#else
- return locale_data;
-#endif
-}
-
-static const QLocalePrivate *defaultPrivate()
-{
- if (!default_lp)
- default_lp = systemPrivate();
- return default_lp;
-}
-
static QString getLocaleListData(const ushort *data, int size, int index)
{
static const ushort separator = ';';
@@ -2283,7 +2333,12 @@ void QLocale::setDefault(const QLocale &locale)
*/
QLocale::Language QLocale::language() const
{
- return Language(d()->languageId());
+ const QLocalePrivate *dd = d();
+#ifndef QT_NO_SYSTEMLOCALE
+ if (dd->isUninitializedSystemLocale())
+ QLocalePrivate::updateSystemPrivate();
+#endif
+ return Language(dd->languageId());
}
/*!
@@ -2293,7 +2348,12 @@ QLocale::Language QLocale::language() const
*/
QLocale::Country QLocale::country() const
{
- return Country(d()->countryId());
+ const QLocalePrivate *dd = d();
+#ifndef QT_NO_SYSTEMLOCALE
+ if (dd->isUninitializedSystemLocale())
+ QLocalePrivate::updateSystemPrivate();
+#endif
+ return Country(dd->countryId());
}
/*!
@@ -2631,8 +2691,8 @@ QString QLocale::toString(const QDate &date, FormatType format) const
return QString();
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(format == LongFormat
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(format == LongFormat
? QSystemLocale::DateToStringLong : QSystemLocale::DateToStringShort,
date);
if (!res.isNull())
@@ -2726,8 +2786,8 @@ QString QLocale::toString(const QDateTime &dateTime, FormatType format) const
return QString();
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(format == LongFormat
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(format == LongFormat
? QSystemLocale::DateTimeToStringLong
: QSystemLocale::DateTimeToStringShort,
dateTime);
@@ -2752,8 +2812,8 @@ QString QLocale::toString(const QTime &time, FormatType format) const
return QString();
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(format == LongFormat
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(format == LongFormat
? QSystemLocale::TimeToStringLong : QSystemLocale::TimeToStringShort,
time);
if (!res.isNull())
@@ -2779,8 +2839,8 @@ QString QLocale::toString(const QTime &time, FormatType format) const
QString QLocale::dateFormat(FormatType format) const
{
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(format == LongFormat
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(format == LongFormat
? QSystemLocale::DateFormatLong : QSystemLocale::DateFormatShort,
QVariant());
if (!res.isNull())
@@ -2816,8 +2876,8 @@ QString QLocale::dateFormat(FormatType format) const
QString QLocale::timeFormat(FormatType format) const
{
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(format == LongFormat
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(format == LongFormat
? QSystemLocale::TimeFormatLong : QSystemLocale::TimeFormatShort,
QVariant());
if (!res.isNull())
@@ -2853,8 +2913,8 @@ QString QLocale::timeFormat(FormatType format) const
QString QLocale::dateTimeFormat(FormatType format) const
{
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(format == LongFormat
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(format == LongFormat
? QSystemLocale::DateTimeFormatLong
: QSystemLocale::DateTimeFormatShort,
QVariant());
@@ -3021,7 +3081,12 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format) cons
*/
QChar QLocale::decimalPoint() const
{
- return d()->decimal();
+ const QLocalePrivate *dd = d();
+#ifndef QT_NO_SYSTEMLOCALE
+ if (dd->isUninitializedSystemLocale())
+ QLocalePrivate::updateSystemPrivate();
+#endif
+ return dd->decimal();
}
/*!
@@ -3031,7 +3096,12 @@ QChar QLocale::decimalPoint() const
*/
QChar QLocale::groupSeparator() const
{
- return d()->group();
+ const QLocalePrivate *dd = d();
+#ifndef QT_NO_SYSTEMLOCALE
+ if (dd->isUninitializedSystemLocale())
+ QLocalePrivate::updateSystemPrivate();
+#endif
+ return dd->group();
}
/*!
@@ -3041,7 +3111,12 @@ QChar QLocale::groupSeparator() const
*/
QChar QLocale::percent() const
{
- return d()->percent();
+ const QLocalePrivate *dd = d();
+#ifndef QT_NO_SYSTEMLOCALE
+ if (dd->isUninitializedSystemLocale())
+ QLocalePrivate::updateSystemPrivate();
+#endif
+ return dd->percent();
}
/*!
@@ -3051,7 +3126,12 @@ QChar QLocale::percent() const
*/
QChar QLocale::zeroDigit() const
{
- return d()->zero();
+ const QLocalePrivate *dd = d();
+#ifndef QT_NO_SYSTEMLOCALE
+ if (dd->isUninitializedSystemLocale())
+ QLocalePrivate::updateSystemPrivate();
+#endif
+ return dd->zero();
}
/*!
@@ -3061,7 +3141,12 @@ QChar QLocale::zeroDigit() const
*/
QChar QLocale::negativeSign() const
{
- return d()->minus();
+ const QLocalePrivate *dd = d();
+#ifndef QT_NO_SYSTEMLOCALE
+ if (dd->isUninitializedSystemLocale())
+ QLocalePrivate::updateSystemPrivate();
+#endif
+ return dd->minus();
}
/*!
@@ -3071,7 +3156,12 @@ QChar QLocale::negativeSign() const
*/
QChar QLocale::positiveSign() const
{
- return d()->plus();
+ const QLocalePrivate *dd = d();
+#ifndef QT_NO_SYSTEMLOCALE
+ if (dd->isUninitializedSystemLocale())
+ QLocalePrivate::updateSystemPrivate();
+#endif
+ return dd->plus();
}
/*!
@@ -3081,7 +3171,12 @@ QChar QLocale::positiveSign() const
*/
QChar QLocale::exponential() const
{
- return d()->exponential();
+ const QLocalePrivate *dd = d();
+#ifndef QT_NO_SYSTEMLOCALE
+ if (dd->isUninitializedSystemLocale())
+ QLocalePrivate::updateSystemPrivate();
+#endif
+ return dd->exponential();
}
static bool qIsUpper(char c)
@@ -3200,8 +3295,8 @@ QString QLocale::monthName(int month, FormatType type) const
return QString();
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(type == LongFormat
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(type == LongFormat
? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort,
month);
if (!res.isNull())
@@ -3246,8 +3341,8 @@ QString QLocale::standaloneMonthName(int month, FormatType type) const
return QString();
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(type == LongFormat
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(type == LongFormat
? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort,
month);
if (!res.isNull())
@@ -3293,8 +3388,8 @@ QString QLocale::dayName(int day, FormatType type) const
return QString();
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(type == LongFormat
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(type == LongFormat
? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort,
day);
if (!res.isNull())
@@ -3342,8 +3437,8 @@ QString QLocale::standaloneDayName(int day, FormatType type) const
return QString();
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(type == LongFormat
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(type == LongFormat
? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort,
day);
if (!res.isNull())
@@ -3387,8 +3482,8 @@ QLocale::MeasurementSystem QLocale::measurementSystem() const
bool found = false;
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(QSystemLocale::MeasurementSystem, QVariant());
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(QSystemLocale::MeasurementSystem, QVariant());
if (!res.isNull()) {
meas = MeasurementSystem(res.toInt());
found = true;
@@ -3415,8 +3510,8 @@ QLocale::MeasurementSystem QLocale::measurementSystem() const
QString QLocale::amText() const
{
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(QSystemLocale::AMText, QVariant());
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(QSystemLocale::AMText, QVariant());
if (!res.isNull())
return res.toString();
}
@@ -3435,8 +3530,8 @@ QString QLocale::amText() const
QString QLocale::pmText() const
{
#ifndef QT_NO_SYSTEMLOCALE
- if (d() == systemPrivate()) {
- QVariant res = systemLocale()->query(QSystemLocale::PMText, QVariant());
+ if (d() == maybeSystemPrivate()) {
+ QVariant res = d()->querySystemLocale(QSystemLocale::PMText, QVariant());
if (!res.isNull())
return res.toString();
}
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index e854c84..9b7b214 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -638,6 +638,7 @@ public:
;
private:
friend struct QLocalePrivate;
+
// ### We now use this field to pack an index into locale_data and NumberOptions.
// ### Qt 5: change to a QLocaleData *d; uint numberOptions.
union {
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index ecf79e9..b1bdea7 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -132,6 +132,8 @@ public:
CharBuff *result) const;
inline char digitToCLocale(const QChar &c) const;
+ inline bool isUninitializedSystemLocale() const;
+ QVariant querySystemLocale(QSystemLocale::QueryType type, const QVariant &in) const;
static void updateSystemPrivate();
enum NumberMode { IntegerMode, DoubleStandardMode, DoubleScientificMode };
diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h
index 9ea05b2..7168e05 100644
--- a/src/dbus/qdbus_symbols_p.h
+++ b/src/dbus/qdbus_symbols_p.h
@@ -196,6 +196,8 @@ DEFINEFUNC(void , dbus_free, (void *memory), (memory), )
/* dbus-message.h */
DEFINEFUNC(DBusMessage* , dbus_message_copy, (const DBusMessage *message),
(message), return)
+DEFINEFUNC(dbus_bool_t , dbus_message_get_auto_start, (DBusMessage *message),
+ (message), return)
DEFINEFUNC(const char* , dbus_message_get_error_name, (DBusMessage *message),
(message), return)
DEFINEFUNC(const char* , dbus_message_get_interface, (DBusMessage *message),
@@ -268,6 +270,9 @@ DEFINEFUNC(DBusMessage* , dbus_message_new_signal, (const char *path,
(path, interface, name), return)
DEFINEFUNC(DBusMessage* , dbus_message_ref, (DBusMessage *message),
(message), return)
+DEFINEFUNC(void , dbus_message_set_auto_start, (DBusMessage *message,
+ dbus_bool_t auto_start),
+ (message, auto_start), return)
DEFINEFUNC(dbus_bool_t , dbus_message_set_destination, (DBusMessage *message,
const char *destination),
(message, destination), return)
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index 83b5503..79c7644 100644
--- a/src/dbus/qdbusmessage.cpp
+++ b/src/dbus/qdbusmessage.cpp
@@ -63,7 +63,7 @@ static inline const char *data(const QByteArray &arr)
QDBusMessagePrivate::QDBusMessagePrivate()
: msg(0), reply(0), type(DBUS_MESSAGE_TYPE_INVALID),
timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false),
- parametersValidated(false)
+ parametersValidated(false), autoStartService(true)
{
}
@@ -129,6 +129,7 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB
msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), d_ptr->path.toUtf8(),
data(d_ptr->interface.toUtf8()), d_ptr->name.toUtf8());
+ q_dbus_message_set_auto_start( msg, d_ptr->autoStartService );
break;
case DBUS_MESSAGE_TYPE_METHOD_RETURN:
msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
@@ -644,6 +645,46 @@ bool QDBusMessage::isDelayedReply() const
}
/*!
+ Sets whether this message will have the auto start flag.
+ This flag only makes sense for method call messages. For
+ these messages it tells the D-Bus server to either auto
+ start the service responsible for the service name, or
+ not to auto start it.
+
+ By default this flag is true, i.e. a service is autostarted.
+ This means:
+
+ When the service that this method call is sent to is already
+ running, the method call is sent to it. If the service is not
+ running yet, the D-Bus daemon is requested to autostart the
+ service that is assigned to this service name. This is
+ handled by .service files that are placed in a directory known
+ to the D-Bus server. These files then each contain a service
+ name and the path to a program that should be executed when
+ this service name is requested.
+
+ \since 4.7
+*/
+void QDBusMessage::setAutoStartService(bool enable)
+{
+ d_ptr->autoStartService = enable;
+}
+
+/*!
+ Returns the auto start flag, as set by setAutoStartService(). By default, this
+ flag is true, which means QtDBus will auto start a service, if it is
+ not running already.
+
+ \sa setAutoStartService()
+
+ \since 4.7
+*/
+bool QDBusMessage::autoStartService() const
+{
+ return d_ptr->autoStartService;
+}
+
+/*!
Sets the arguments that are going to be sent over D-Bus to \a arguments. Those
will be the arguments to a method call or the parameters in the signal.
diff --git a/src/dbus/qdbusmessage.h b/src/dbus/qdbusmessage.h
index 1a85983..6df5215 100644
--- a/src/dbus/qdbusmessage.h
+++ b/src/dbus/qdbusmessage.h
@@ -104,6 +104,9 @@ public:
void setDelayedReply(bool enable) const;
bool isDelayedReply() const;
+ void setAutoStartService(bool enable);
+ bool autoStartService() const;
+
void setArguments(const QList<QVariant> &arguments);
QList<QVariant> arguments() const;
diff --git a/src/dbus/qdbusmessage_p.h b/src/dbus/qdbusmessage_p.h
index 6bf5448..b6da4a5 100644
--- a/src/dbus/qdbusmessage_p.h
+++ b/src/dbus/qdbusmessage_p.h
@@ -85,6 +85,7 @@ public:
mutable uint delayedReply : 1;
uint localMessage : 1;
mutable uint parametersValidated : 1;
+ uint autoStartService : 1;
static void setParametersValidated(QDBusMessage &msg, bool enable)
{ msg.d_ptr->parametersValidated = enable; }
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index 25c98c5..e511c3a 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1237,7 +1237,7 @@ void qt_init(QApplicationPrivate *priv, int)
// Cocoa application delegate
#ifdef QT_MAC_USE_COCOA
- NSApplication *cocoaApp = [NSApplication sharedApplication];
+ NSApplication *cocoaApp = [QNSApplication sharedApplication];
QMacCocoaAutoReleasePool pool;
NSObject *oldDelegate = [cocoaApp delegate];
QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) *newDelegate = [QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate];
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 0a4869b..b71a1bb 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -2551,6 +2551,17 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
result = true;
break;
}
+#ifndef QT_NO_CURSOR
+ case WM_SETCURSOR: {
+ QCursor *ovr = QApplication::overrideCursor();
+ if (ovr) {
+ SetCursor(ovr->handle());
+ RETURN(TRUE);
+ }
+ result = false;
+ break;
+ }
+#endif
default:
result = false; // event was not processed
break;
diff --git a/src/gui/kernel/qcocoaapplication_mac.mm b/src/gui/kernel/qcocoaapplication_mac.mm
index 5b98420..5629940 100644
--- a/src/gui/kernel/qcocoaapplication_mac.mm
+++ b/src/gui/kernel/qcocoaapplication_mac.mm
@@ -107,5 +107,50 @@
| NSFontPanelStrikethroughEffectModeMask;
}
+
+- (void)qt_sendPostedMessage:(NSEvent *)event
+{
+ // WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5!
+ // That is why we need to split the address in two parts:
+ quint64 lower = [event data1];
+ quint64 upper = [event data2];
+ QCocoaPostMessageArgs *args = reinterpret_cast<QCocoaPostMessageArgs *>(lower | (upper << 32));
+ [args->target performSelector:args->selector];
+ delete args;
+}
+
+- (BOOL)qt_sendEvent:(NSEvent *)event
+{
+ if ([event type] == NSApplicationDefined) {
+ switch ([event subtype]) {
+ case QtCocoaEventSubTypePostMessage:
+ [NSApp qt_sendPostedMessage:event];
+ return true;
+ default:
+ break;
+ }
+ }
+ return false;
+}
+
@end
+
+@implementation QNSApplication
+
+// WARNING: If Qt did not create NSApplication (this can e.g.
+// happend if Qt is used as a plugin from a 3rd-party cocoa
+// application), QNSApplication::sendEvent will never be called.
+// SO DO NOT RELY ON THIS FUNCTION BEING AVAILABLE.
+// Plugin developers that _do_ control the NSApplication sub-class
+// implementation of the 3rd-party application can call qt_sendEvent
+// from the sub-class event handler (like we do here) to work around
+// any issues.
+- (void)sendEvent:(NSEvent *)event
+{
+ if (![self qt_sendEvent:event])
+ [super sendEvent:event];
+}
+
+@end
+
#endif
diff --git a/src/gui/kernel/qcocoaapplication_mac_p.h b/src/gui/kernel/qcocoaapplication_mac_p.h
index e845d58..5569feb 100644
--- a/src/gui/kernel/qcocoaapplication_mac_p.h
+++ b/src/gui/kernel/qcocoaapplication_mac_p.h
@@ -99,5 +99,13 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate)
- (QApplicationPrivate *)QT_MANGLE_NAMESPACE(qt_qappPrivate);
- (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader);
- (int)QT_MANGLE_NAMESPACE(qt_validModesForFontPanel):(NSFontPanel *)fontPanel;
+
+- (void)qt_sendPostedMessage:(NSEvent *)event;
+- (BOOL)qt_sendEvent:(NSEvent *)event;
+@end
+
+@interface QNSApplication : NSApplication {
+}
@end
+
#endif
diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm
index 18b3772..573b763 100644
--- a/src/gui/kernel/qcocoamenuloader_mac.mm
+++ b/src/gui/kernel/qcocoamenuloader_mac.mm
@@ -46,6 +46,7 @@
#include <private/qcocoamenuloader_mac_p.h>
#include <private/qapplication_p.h>
#include <private/qt_mac_p.h>
+#include <private/qmenubar_p.h>
#include <qmenubar.h>
QT_FORWARD_DECLARE_CLASS(QCFString)
@@ -208,6 +209,11 @@ QT_USE_NAMESPACE
[NSApp hide:sender];
}
+- (void)qtUpdateMenubar
+{
+ QMenuBarPrivate::macUpdateMenuBarImmediatly();
+}
+
- (IBAction)qtDispatcherToQAction:(id)sender
{
QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData);
diff --git a/src/gui/kernel/qcocoamenuloader_mac_p.h b/src/gui/kernel/qcocoamenuloader_mac_p.h
index 81c136e..2504b8c 100644
--- a/src/gui/kernel/qcocoamenuloader_mac_p.h
+++ b/src/gui/kernel/qcocoamenuloader_mac_p.h
@@ -85,6 +85,7 @@
- (IBAction)unhideAllApplications:(id)sender;
- (IBAction)hide:(id)sender;
- (IBAction)qtDispatcherToQAction:(id)sender;
+- (void)qtUpdateMenubar;
@end
#endif // QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index a1d2c61..9fe5ae0 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -183,8 +183,18 @@ QT_END_NAMESPACE
- (void)sendEvent:(NSEvent *)event
{
- QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
+ if ([event type] == NSApplicationDefined) {
+ switch ([event subtype]) {
+ case QtCocoaEventSubTypePostMessage:
+ [NSApp qt_sendPostedMessage:event];
+ return;
+ default:
+ break;
+ }
+ return;
+ }
+ QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
// Cocoa can hold onto the window after we've disavowed its knowledge. So,
// if we get sent an event afterwards just have it go through the super's
// version and don't do any stuff with Qt.
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 873fb7e..ec00583 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -489,7 +489,15 @@ extern "C" {
qWarning("QWidget::repaint: Recursive repaint detected");
const QRect qrect = QRect(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height);
- QRegion qrgn(qrect);
+ QRegion qrgn;
+
+ const NSRect *rects;
+ NSInteger count;
+ [self getRectsBeingDrawn:&rects count:&count];
+ for (int i = 0; i < count; ++i) {
+ QRect tmpRect = QRect(rects[i].origin.x, rects[i].origin.y, rects[i].size.width, rects[i].size.height);
+ qrgn += tmpRect;
+ }
if (!qwidget->isWindow() && !qobject_cast<QAbstractScrollArea *>(qwidget->parent())) {
const QRegion &parentMask = qwidget->window()->mask();
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index c7d042d..8a67dee 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -1064,10 +1064,9 @@ void QEventDispatcherMacPrivate::cancelWaitForMoreEvents()
// In case the event dispatcher is waiting for more
// events somewhere, we post a dummy event to wake it up:
QMacCocoaAutoReleasePool pool;
- static const short NSAppShouldStopForQt = SHRT_MAX;
[NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint
modifierFlags:0 timestamp:0. windowNumber:0 context:0
- subtype:NSAppShouldStopForQt data1:0 data2:0] atStart:NO];
+ subtype:QtCocoaEventSubTypeWakeup data1:0 data2:0] atStart:NO];
}
#endif
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 4e51cf4..f2ec4af 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -83,6 +83,7 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qt_mac_p.h>
#include <private/qapplication_p.h>
+#include <private/qcocoaapplication_mac_p.h>
#include <private/qcocoawindow_mac_p.h>
#include <private/qcocoaview_mac_p.h>
#include <private/qkeymapper_p.h>
@@ -1279,22 +1280,42 @@ void qt_cocoaChangeOverrideCursor(const QCursor &cursor)
QMacCocoaAutoReleasePool pool;
[static_cast<NSCursor *>(qt_mac_nsCursorForQCursor(cursor)) set];
}
-#endif
-@implementation DebugNSApplication {
-}
-- (void)sendEvent:(NSEvent *)event
+// WARNING: If Qt did not create NSApplication (e.g. in case it is
+// used as a plugin), and at the same time, there is no window on
+// screen (or the window that the event is sendt to becomes hidden etc
+// before the event gets delivered), the message will not be performed.
+bool qt_cocoaPostMessage(id target, SEL selector)
{
- NSLog(@"NSAppDebug: sendEvent: %@", event);
- return [super sendEvent:event];
-}
+ if (!target)
+ return false;
-- (BOOL)sendAction:(SEL)anAction to:(id)aTarget from:(id)sender
-{
- NSLog(@"NSAppDebug: sendAction: %s to %@ from %@", anAction, aTarget, sender);
- return [super sendAction:anAction to:aTarget from:sender];
+ NSInteger windowNumber = 0;
+ if (![NSApp isMemberOfClass:[QNSApplication class]]) {
+ // INVARIANT: Cocoa is not using our NSApplication subclass. That means
+ // we don't control the main event handler either. So target the event
+ // for one of the windows on screen:
+ NSWindow *nswin = [NSApp mainWindow];
+ if (!nswin) {
+ nswin = [NSApp keyWindow];
+ if (!nswin)
+ return false;
+ }
+ windowNumber = [nswin windowNumber];
+ }
+
+ // WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5!
+ // That is why we need to split the address in two parts:
+ QCocoaPostMessageArgs *args = new QCocoaPostMessageArgs(target, selector);
+ quint32 lower = quintptr(args);
+ quint32 upper = quintptr(args) >> 32;
+ NSEvent *e = [NSEvent otherEventWithType:NSApplicationDefined
+ location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:windowNumber
+ context:nil subtype:QtCocoaEventSubTypePostMessage data1:lower data2:upper];
+ [NSApp postEvent:e atStart:NO];
+ return true;
}
-@end
+#endif
QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool()
{
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index ace8255..c43ea55 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -114,6 +114,12 @@ typedef struct CGPoint NSPoint;
#endif
QT_BEGIN_NAMESPACE
+
+enum {
+ QtCocoaEventSubTypeWakeup = SHRT_MAX,
+ QtCocoaEventSubTypePostMessage = SHRT_MAX-1
+};
+
Qt::MouseButtons qt_mac_get_buttons(int buttons);
Qt::MouseButton qt_mac_get_button(EventMouseButton button);
void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds = 0.15);
@@ -182,8 +188,23 @@ inline QString qt_mac_NSStringToQString(const NSString *nsstr)
inline NSString *qt_mac_QStringToNSString(const QString &qstr)
{ return [reinterpret_cast<const NSString *>(QCFString::toCFStringRef(qstr)) autorelease]; }
-@interface DebugNSApplication : NSApplication {}
-@end
+#ifdef QT_MAC_USE_COCOA
+class QCocoaPostMessageArgs {
+public:
+ id target;
+ SEL selector;
+ QCocoaPostMessageArgs(id target, SEL selector) : target(target), selector(selector)
+ {
+ [target retain];
+ }
+
+ ~QCocoaPostMessageArgs()
+ {
+ [target release];
+ }
+};
+bool qt_cocoaPostMessage(id target, SEL selector);
+#endif
#endif
diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp
index 6a0e363..cc74a53 100644
--- a/src/gui/widgets/qdialogbuttonbox.cpp
+++ b/src/gui/widgets/qdialogbuttonbox.cpp
@@ -103,7 +103,7 @@ QT_BEGIN_NAMESPACE
You can mix and match normal buttons and standard buttons.
Currently the buttons are laid out in the following way if the button box is horizontal:
- \table 100%
+ \table
\row \o \inlineimage buttonbox-gnomelayout-horizontal.png GnomeLayout Horizontal
\o Button box laid out in horizontal GnomeLayout
\row \o \inlineimage buttonbox-kdelayout-horizontal.png KdeLayout Horizontal
@@ -116,25 +116,23 @@ QT_BEGIN_NAMESPACE
The buttons are laid out the following way if the button box is vertical:
- \table 100%
+ \table
+ \row \o GnomeLayout
+ \o KdeLayout
+ \o MacLayout
+ \o WinLayout
\row \o \inlineimage buttonbox-gnomelayout-vertical.png GnomeLayout Vertical
- \o Button box laid out in vertical GnomeLayout
- \row \o \inlineimage buttonbox-kdelayout-vertical.png KdeLayout Vertical
- \o Button box laid out in vertical KdeLayout
- \row \o \inlineimage buttonbox-maclayout-vertical.png MacLayout Vertical
- \o Button box laid out in vertical MacLayout
- \row \o \inlineimage buttonbox-winlayout-vertical.png WinLayout Vertical
- \o Button box laid out in vertical WinLayout
+ \o \inlineimage buttonbox-kdelayout-vertical.png KdeLayout Vertical
+ \o \inlineimage buttonbox-maclayout-vertical.png MacLayout Vertical
+ \o \inlineimage buttonbox-winlayout-vertical.png WinLayout Vertical
\endtable
Additionally, button boxes that contain only buttons with ActionRole or
- HelpRole can be considered modeless and have an alternate look on the mac:
+ HelpRole can be considered modeless and have an alternate look on Mac OS X:
- \table 100%
- \row \o \inlineimage buttonbox-mac-modeless-horizontal.png Screenshot of modeless horizontal MacLayout
- \o modeless horizontal MacLayout
- \row \o \inlineimage buttonbox-mac-modeless-vertical.png Screenshot of modeless vertical MacLayout
- \o modeless vertical MacLayout
+ \table
+ \row \o modeless horizontal MacLayout
+ \o \inlineimage buttonbox-mac-modeless-horizontal.png Screenshot of modeless horizontal MacLayout
\endtable
When a button is clicked in the button box, the clicked() signal is emitted
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 658a020..99c550f 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -2030,6 +2030,18 @@ void qt_mac_clear_menubar()
*/
bool QMenuBar::macUpdateMenuBar()
{
+#ifdef QT_MAC_USE_COCOA
+ QMacCocoaAutoReleasePool pool;
+ if (!qt_cocoaPostMessage(getMenuLoader(), @selector(qtUpdateMenubar)))
+ return QMenuBarPrivate::macUpdateMenuBarImmediatly();
+ return true;
+#else
+ return QMenuBarPrivate::macUpdateMenuBarImmediatly();
+#endif
+}
+
+bool QMenuBarPrivate::macUpdateMenuBarImmediatly()
+{
bool ret = false;
cancelAllMenuTracking();
QWidget *w = findWindowThatShouldDisplayMenubar();
@@ -2095,8 +2107,9 @@ bool QMenuBar::macUpdateMenuBar()
}
}
- if(!ret)
+ if (!ret) {
qt_mac_clear_menubar();
+ }
return ret;
}
diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h
index f2e5357..819aee4 100644
--- a/src/gui/widgets/qmenubar_p.h
+++ b/src/gui/widgets/qmenubar_p.h
@@ -196,6 +196,7 @@ public:
return 0;
}
} *mac_menubar;
+ static bool macUpdateMenuBarImmediatly();
bool macWidgetHasNativeMenubar(QWidget *widget);
void macCreateMenuBar(QWidget *);
void macDestroyMenuBar();
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index a0b332d..c18129d 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -3086,7 +3086,7 @@ void QGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x4 *
*/
int QGLShaderProgram::maxGeometryOutputVertices() const
{
- int n;
+ GLint n;
glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT, &n);
return n;
}