summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-22 05:28:16 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-22 05:28:16 (GMT)
commit1c47be7174ca1e9ed393a12461742975079710d7 (patch)
tree63d106994a06e516c92b261ced8629c1ddfdb186 /src
parentef06a357aaeb83768d9170859bd99f0ceaf7e82b (diff)
parent84a0a0c949d877dfc9a0eb05996a2b73d61b64f8 (diff)
downloadQt-1c47be7174ca1e9ed393a12461742975079710d7.zip
Qt-1c47be7174ca1e9ed393a12461742975079710d7.tar.gz
Qt-1c47be7174ca1e9ed393a12461742975079710d7.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (34 commits) Cocoa: fix namespace build breakage Trivial doc fix qdoc: Updated the extra images variable for each manual.qdocconf. Cocoa: cocoa sometimes show a hidden window Default (Parentless) QMenuBar actions do not work (without autotest) Reorganised double stream out operator in QDataStream to avoid causing unnecessary floating point exceptions. Revert "Report the error as being AlreadyExists if this is why it fails" Revert "Default (Parentless) QMenuBar actions do not work" fix memory bug fix nativeFilePath character width issue fix typos Just use the path as the url can have an anchor attached etc... Doc: Cleaning HTML generator and updating index.qdoc Default (Parentless) QMenuBar actions do not work Fix Mac OS Tiger-vs-Leopard crash due to memory tagging by JavaScriptCore qdoc: Avoided putting bad chars in links Improve itemview appearance on Mac Backport a few fixes to the Designer filteredit from Creator Doc: Correcting qdocconf files for assistant ScrollBar width not updated dynamically on Windows. ...
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/clucene/src/CLucene/util/bufferedstream.h2
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog26
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h39
-rw-r--r--src/3rdparty/javascriptcore/VERSION4
-rw-r--r--src/corelib/io/qdatastream.cpp7
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp8
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp2
-rw-r--r--src/gui/kernel/qapplication_win.cpp25
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac.mm7
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h11
-rw-r--r--src/gui/styles/qmacstyle_mac.mm16
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp1
-rw-r--r--src/gui/widgets/qmenu_mac.mm19
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp2
-rw-r--r--src/network/kernel/qhostinfo.cpp22
-rw-r--r--src/network/kernel/qhostinfo_p.h3
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h41
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm671
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp5
-rw-r--r--src/plugins/bearer/generic/qgenericengine.h1
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp8
-rw-r--r--src/plugins/bearer/icd/qicdengine.h2
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp7
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.h1
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp6
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h3
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp7
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h1
-rw-r--r--src/script/api/qscriptengine.cpp4
-rw-r--r--src/script/bridge/qscriptqobject.cpp9
-rw-r--r--src/script/bridge/qscriptvariant.cpp6
31 files changed, 592 insertions, 374 deletions
diff --git a/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h b/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h
index b73ad98..d905955 100644
--- a/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h
+++ b/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h
@@ -46,7 +46,7 @@ protected:
/**
* This function must be implemented by the subclasses.
* It should write a maximum of @p space characters at the buffer
- * position pointed to by @p start. If no more data is avaiable due to
+ * position pointed to by @p start. If no more data is available due to
* end of file, -1 should be returned. If an error occurs, the status
* should be set to Error, an error message should be set and the function
* must return -1.
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
index 4f6e565..11572b0 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-04-14 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Mac OS X: Use deployment target to determine whether memory tagging should be enabled
+ https://bugs.webkit.org/show_bug.cgi?id=34888
+
+ When building on (Snow) Leopard but targeting Tiger
+ (TARGETING_TIGER defined, BUILDING_ON_TIGER not defined),
+ WebKit would crash on Tiger because the tags passed to mmap
+ caused those function calls to fail.
+
+ Conversely, when building on Tiger but targeting Leopard
+ (BUILDING_ON_TIGER defined, TARGETING_LEOPARD defined), WebKit
+ would crash on Leopard because the tags passed to vm_map and
+ vm_allocate caused those function calls to fail.
+
+ Solution: Use TARGETING_TIGER rather than BUILDING_ON_TIGER to
+ govern the tag definitions. Use the same tags for vm_map and
+ vm_allocate regardless of target, since they work on
+ both. Fall back to the mmap tags that work on Tiger (that is,
+ "no tags") if targeting Tiger, since those tags also work on
+ Leopard.
+
+ * wtf/VMTags.h:
+
2010-03-29 Patrick Gansterer <paroga@paroga.com>
Reviewed by Darin Adler.
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h
index 34e2494..75bec11 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h
@@ -30,25 +30,48 @@
// On Mac OS X, the VM subsystem allows tagging memory requested from mmap and vm_map
// in order to aid tools that inspect system memory use.
-#if OS(DARWIN) && !defined(BUILDING_ON_TIGER)
+#if OS(DARWIN)
#include <mach/vm_statistics.h>
+#if !defined(TARGETING_TIGER)
+
#if defined(VM_MEMORY_TCMALLOC)
#define VM_TAG_FOR_TCMALLOC_MEMORY VM_MAKE_TAG(VM_MEMORY_TCMALLOC)
#else
#define VM_TAG_FOR_TCMALLOC_MEMORY VM_MAKE_TAG(53)
#endif // defined(VM_MEMORY_TCMALLOC)
-#if defined(VM_MEMORY_JAVASCRIPT_CORE) && defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE) && defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR) && defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
-#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_CORE)
-#define VM_TAG_FOR_REGISTERFILE_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+#if defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
#else
-#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(63)
#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY VM_MAKE_TAG(64)
+#endif // defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
+
+#if defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+#define VM_TAG_FOR_REGISTERFILE_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+#else
#define VM_TAG_FOR_REGISTERFILE_MEMORY VM_MAKE_TAG(65)
-#endif // defined(VM_MEMORY_JAVASCRIPT_CORE) && defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE) && defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR) && defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
+#endif // defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+
+#else // !defined(TARGETING_TIGER)
+
+// mmap on Tiger fails with tags that work on Leopard, so fall
+// back to Tiger-compatible tags (that also work on Leopard)
+// when targeting Tiger.
+#define VM_TAG_FOR_TCMALLOC_MEMORY -1
+#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY -1
+#define VM_TAG_FOR_REGISTERFILE_MEMORY -1
+
+#endif // !defined(TARGETING_TIGER)
+
+// Tags for vm_map and vm_allocate work on both Tiger and Leopard.
+
+#if defined(VM_MEMORY_JAVASCRIPT_CORE)
+#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_CORE)
+#else
+#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(63)
+#endif // defined(VM_MEMORY_JAVASCRIPT_CORE)
#if defined(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY VM_MAKE_TAG(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
@@ -56,7 +79,7 @@
#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY VM_MAKE_TAG(69)
#endif // defined(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
-#else // OS(DARWIN) && !defined(BUILDING_ON_TIGER)
+#else // OS(DARWIN)
#define VM_TAG_FOR_TCMALLOC_MEMORY -1
#define VM_TAG_FOR_COLLECTOR_MEMORY -1
@@ -64,6 +87,6 @@
#define VM_TAG_FOR_REGISTERFILE_MEMORY -1
#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY -1
-#endif // OS(DARWIN) && !defined(BUILDING_ON_TIGER)
+#endif // OS(DARWIN)
#endif // VMTags_h
diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION
index 2b885a7..9a02027 100644
--- a/src/3rdparty/javascriptcore/VERSION
+++ b/src/3rdparty/javascriptcore/VERSION
@@ -4,8 +4,8 @@ This is a snapshot of JavaScriptCore from
The commit imported was from the
- javascriptcore-snapshot-07042010 branch/tag
+ javascriptcore-snapshot-20042010 branch/tag
and has the sha1 checksum
- 475f8c67522d8b3f3163dc3a6b24d6083fd0ac19
+ c589321ffdda5e93cf77e2cf2cf43afe3e996f6e
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 2731ae1..3a9d284 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -1144,16 +1144,17 @@ QDataStream &QDataStream::operator<<(double f)
CHECK_STREAM_PRECOND(*this)
#ifndef Q_DOUBLE_FORMAT
- if (!noswap) {
+ if (noswap) {
+ dev->write((char *)&f, sizeof(double));
+ } else {
union {
double val1;
quint64 val2;
} x;
x.val1 = f;
x.val2 = qbswap(x.val2);
- f = x.val1;
+ dev->write((char *)&x.val2, sizeof(double));
}
- dev->write((char *)&f, sizeof(double));
#else
union {
double val1;
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index eeca07e..ec49f1a 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -542,11 +542,13 @@ qint64 QFSFileEnginePrivate::nativeSize() const
if (errorCode == ERROR_ACCESS_DENIED || errorCode == ERROR_SHARING_VIOLATION) {
QByteArray path = nativeFilePath;
// path for the FindFirstFile should not end with a trailing slash
- while (path.endsWith('\\'))
- path.chop(1);
+ while (!path.isEmpty() && reinterpret_cast<const wchar_t *>(
+ path.constData() + path.length())[-1] == '\\')
+ path.chop(2);
// FindFirstFile can not handle drives
- if (!path.endsWith(':')) {
+ if (!path.isEmpty() && reinterpret_cast<const wchar_t *>(
+ path.constData() + path.length())[-1] != ':') {
WIN32_FIND_DATA findData;
HANDLE hFind = ::FindFirstFile((const wchar_t*)path.constData(),
&findData);
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 2633a7c..135ec303 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -595,7 +595,7 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
} else {
ok = t->fastTimerId = qtimeSetEvent(t->interval, 1, qt_fast_timer_proc, (DWORD_PTR)t,
TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
- if (ok == 0) { // fall back to normal timer if no more multimedia timers avaiable
+ if (ok == 0) { // fall back to normal timer if no more multimedia timers available
ok = SetTimer(internalHwnd, t->timerId, (uint) t->interval, 0);
}
}
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 1d8eb4c..fb2837e 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -79,6 +79,7 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
#include "qlayout.h"
#include "qtooltip.h"
#include "qt_windows.h"
+#include "qscrollbar.h"
#if defined(QT_NON_COMMERCIAL)
#include "qnc_win.h"
#endif
@@ -701,6 +702,21 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
QApplication::setPalette(menu, "QMenuBar");
}
+static void qt_set_windows_updateScrollBar(QWidget *widget)
+{
+ QList<QObject*> children = widget->children();
+ for (int i = 0; i < children.size(); ++i) {
+ QObject *o = children.at(i);
+ if(!o->isWidgetType())
+ continue;
+ if (QWidget *w = static_cast<QWidget *>(o))
+ qt_set_windows_updateScrollBar(w);
+ }
+ if (qobject_cast<QScrollBar*>(widget))
+ widget->updateGeometry();
+}
+
+
/*****************************************************************************
qt_init() - initializes Qt for Windows
*****************************************************************************/
@@ -1930,6 +1946,15 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
}
}
}
+ else if (msg.wParam == SPI_SETNONCLIENTMETRICS) {
+ widget = (QETWidget*)QWidget::find(hwnd);
+ if (widget && !widget->parentWidget()) {
+ qt_set_windows_updateScrollBar(widget);
+ QEvent e(QEvent::LayoutRequest);
+ QApplication::sendEvent(widget, &e);
+ }
+ }
+
break;
case WM_PAINT: // paint event
diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm
index b58fd7c..8d65aa1 100644
--- a/src/gui/kernel/qcocoamenuloader_mac.mm
+++ b/src/gui/kernel/qcocoamenuloader_mac.mm
@@ -53,6 +53,12 @@
QT_FORWARD_DECLARE_CLASS(QCFString)
QT_FORWARD_DECLARE_CLASS(QString)
+#ifndef QT_NO_TRANSLATION
+ QT_BEGIN_NAMESPACE
+ extern QString qt_mac_applicationmenu_string(int type);
+ QT_END_NAMESPACE
+#endif
+
QT_USE_NAMESPACE
@implementation QT_MANGLE_NAMESPACE(QCocoaMenuLoader)
@@ -226,7 +232,6 @@ QT_USE_NAMESPACE
- (void)qtTranslateApplicationMenu
{
#ifndef QT_NO_TRANSLATION
- extern QString qt_mac_applicationmenu_string(int type);
[servicesItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(0))];
[hideItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(1).arg(qAppName()))];
[hideAllOthersItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(2))];
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index ec00915..e94d247 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -101,6 +101,17 @@ QT_END_NAMESPACE
return !(isPopup || isToolTip || isTool);
}
+- (void)becomeMainWindow
+{
+ [super becomeMainWindow];
+ // Cocoa sometimes tell a hidden window to become the
+ // main window (and as such, show it). This can e.g
+ // happend when the application gets activated. If
+ // this is the case, we tell it to hide again:
+ if (![self isVisible])
+ [self orderOut:self];
+}
+
- (void)toggleToolbarShown:(id)sender
{
macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]);
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 074dd89..f5b0b0c 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -2143,7 +2143,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
if (qstyleoption_cast<const QStyleOptionComboBox *>(opt) != 0)
ret = 0;
else
- ret = QWindowsStyle::pixelMetric(metric, opt, widget);
+ ret = 1;
break;
case PM_MaximumDragDistance:
ret = -1;
@@ -3099,14 +3099,16 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
HIRect hirect = qt_hirectForQRect(opt->rect);
HIThemeDrawButton(&hirect, &bi, cg, kHIThemeOrientationNormal, 0);
break; }
+
case PE_Frame: {
QPen oldPen = p->pen();
- QPen newPen;
- newPen.setBrush(opt->palette.dark());
- p->setPen(newPen);
+ p->setPen(opt->palette.base().color().darker(140));
p->drawRect(opt->rect.adjusted(0, 0, -1, -1));
+ p->setPen(opt->palette.base().color().darker(180));
+ p->drawLine(opt->rect.topLeft(), opt->rect.topRight());
p->setPen(oldPen);
break; }
+
case PE_FrameLineEdit:
if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
if (frame->state & State_Sunken) {
@@ -3279,10 +3281,14 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (header->orientation == Qt::Horizontal){
switch (header->position) {
case QStyleOptionHeader::Beginning:
+ ir.adjust(-1, -1, 0, 0);
break;
case QStyleOptionHeader::Middle:
+ ir.adjust(-1, -1, 0, 0);
+ break;
+ case QStyleOptionHeader::OnlyOneSection:
case QStyleOptionHeader::End:
- ir.adjust(-1, 0, 0, 0);
+ ir.adjust(-1, -1, 1, 0);
break;
default:
break;
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index 73ec53e..8cffebd 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -983,6 +983,7 @@ bool QAbstractScrollArea::event(QEvent *e)
case QEvent::StyleChange:
case QEvent::LayoutDirectionChange:
case QEvent::ApplicationLayoutDirectionChange:
+ case QEvent::LayoutRequest:
d->layoutChildren();
// fall through
default:
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 6a0eb53..7645c23 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -665,6 +665,7 @@ void qt_mac_set_modal_state_helper_recursive(OSMenuRef menu, OSMenuRef merge, bo
}
}
#else
+ bool modalWindowOnScreen = qApp->activeModalWidget() != 0;
for (NSMenuItem *item in [menu itemArray]) {
OSMenuRef submenu = [item submenu];
if (submenu != merge) {
@@ -674,10 +675,20 @@ void qt_mac_set_modal_state_helper_recursive(OSMenuRef menu, OSMenuRef merge, bo
// The item should follow what the QAction has.
if ([item tag]) {
QAction *action = reinterpret_cast<QAction *>([item tag]);
- syncNSMenuItemEnabled(item, action->isEnabled());
- } else {
- syncNSMenuItemEnabled(item, YES);
- }
+ syncNSMenuItemEnabled(item, action->isEnabled());
+ } else {
+ syncNSMenuItemEnabled(item, YES);
+ }
+ // We sneak in some extra code here to handle a menu problem:
+ // If there is no window on screen, we cannot set 'nil' as
+ // menu item target, because then cocoa will disable the item
+ // (guess it assumes that there will be no first responder to
+ // catch the trigger anyway?) OTOH, If we have a modal window,
+ // then setting the menu loader as target will make cocoa not
+ // deliver the trigger because the loader is then seen as modally
+ // shaddowed). So either way there are shortcomings. Instead, we
+ // decide the target as late as possible:
+ [item setTarget:modalWindowOnScreen ? nil : getMenuLoader()];
} else {
syncNSMenuItemEnabled(item, NO);
}
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
index a651dd1..a7bd2d5 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ b/src/network/bearer/qnetworkconfigmanager_p.cpp
@@ -381,7 +381,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations()
connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)),
this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer)));
- QMetaObject::invokeMethod(engine, "requestUpdate");
+ QMetaObject::invokeMethod(engine, "initialize");
}
}
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index baf69e7..7e006e0 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -488,9 +488,23 @@ QHostInfoLookupManager::~QHostInfoLookupManager()
wasDeleted = true;
// don't qDeleteAll currentLookups, the QThreadPool has ownership
- qDeleteAll(postponedLookups);
- qDeleteAll(scheduledLookups);
- qDeleteAll(finishedLookups);
+ clear();
+}
+
+void QHostInfoLookupManager::clear()
+{
+ {
+ QMutexLocker locker(&mutex);
+ qDeleteAll(postponedLookups);
+ qDeleteAll(scheduledLookups);
+ qDeleteAll(finishedLookups);
+ postponedLookups.clear();
+ scheduledLookups.clear();
+ finishedLookups.clear();
+ }
+
+ threadPool.waitForDone();
+ cache.clear();
}
void QHostInfoLookupManager::work()
@@ -636,7 +650,7 @@ void qt_qhostinfo_clear_cache()
{
QHostInfoLookupManager* manager = theHostInfoLookupManager();
if (manager) {
- manager->cache.clear();
+ manager->clear();
}
}
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index 4fc74e9..e11766b 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -116,7 +116,7 @@ public:
// These functions are outside of the QHostInfo class and strictly internal.
// Do NOT use them outside of QAbstractSocket.
QHostInfo Q_NETWORK_EXPORT qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char *member, bool *valid, int *id);
-void Q_NETWORK_EXPORT qt_qhostinfo_clear_cache();
+void Q_AUTOTEST_EXPORT qt_qhostinfo_clear_cache();
void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e);
class QHostInfoCache
@@ -161,6 +161,7 @@ public:
QHostInfoLookupManager();
~QHostInfoLookupManager();
+ void clear();
void work();
// called from QHostInfo
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 5c69299..3c24c54 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -47,15 +47,18 @@
#include <QMap>
#include <QTimer>
#include <SystemConfiguration/SystemConfiguration.h>
+#include <QThread>
#ifndef QT_NO_BEARERMANAGEMENT
QT_BEGIN_NAMESPACE
class QNetworkConfigurationPrivate;
+class QScanThread;
class QCoreWlanEngine : public QBearerEngineImpl
{
+ friend class QScanThread;
Q_OBJECT
public:
@@ -70,6 +73,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
@@ -84,27 +88,52 @@ public:
private Q_SLOTS:
void doRequestUpdate();
+ void networksChanged();
private:
bool isWifiReady(const QString &dev);
- QMap<QString, QString> configurationInterface;
- QStringList scanForSsids(const QString &interfaceName);
-
- bool isKnownSsid(const QString &ssid);
QList<QNetworkConfigurationPrivate *> foundConfigurations;
SCDynamicStoreRef storeSession;
CFRunLoopSourceRef runloopSource;
bool hasWifi;
+ bool scanning;
+ QScanThread *scanThread;
protected:
- QMap<QString, QMap<QString,QString> > userProfiles;
-
void startNetworkChangeLoop();
+
+};
+
+class QScanThread : public QThread
+{
+ Q_OBJECT
+
+public:
+ QScanThread(QObject *parent = 0);
+ ~QScanThread();
+
+ void quit();
+ QList<QNetworkConfigurationPrivate *> getConfigurations();
+ QString interfaceName;
+ QMap<QString, QString> configurationInterface;
void getUserConfigurations();
QString getNetworkNameFromSsid(const QString &ssid);
QString getSsidFromNetworkName(const QString &name);
+ bool isKnownSsid(const QString &ssid);
+ QMap<QString, QMap<QString,QString> > userProfiles;
+
+signals:
+ void networksChanged();
+
+protected:
+ void run();
+
+private:
+ QList<QNetworkConfigurationPrivate *> fetchedConfigurations;
+ QMutex mutex;
QStringList foundNetwork(const QString &id, const QString &ssid, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose);
+
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 268126a..3206833 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -67,10 +67,6 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#include "private/qcore_mac_p.h"
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
@interface QNSListener : NSObject
{
NSNotificationCenter *center;
@@ -96,7 +92,6 @@ QT_BEGIN_NAMESPACE
QMacCocoaAutoReleasePool pool;
center = [NSNotificationCenter defaultCenter];
currentInterface = [CWInterface interfaceWithName:nil];
-// [center addObserver:self selector:@selector(notificationHandler:) name:kCWLinkDidChangeNotification object:nil];
[center addObserver:self selector:@selector(notificationHandler:) name:kCWPowerDidChangeNotification object:nil];
[locker unlock];
return self;
@@ -130,6 +125,8 @@ QT_BEGIN_NAMESPACE
QNSListener *listener = 0;
+QT_BEGIN_NAMESPACE
+
void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys, void *info)
{
for ( long i = 0; i < CFArrayGetCount(changedKeys); i++) {
@@ -143,20 +140,279 @@ void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys,
return;
}
-QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
-: QBearerEngineImpl(parent)
+
+QScanThread::QScanThread(QObject *parent)
+ :QThread(parent)
{
- startNetworkChangeLoop();
+}
+
+QScanThread::~QScanThread()
+{
+}
+
+void QScanThread::quit()
+{
+ wait();
+}
+
+void QScanThread::run()
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ QStringList found;
+ mutex.lock();
+ CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)];
+ mutex.unlock();
+
+ if([currentInterface power]) {
+ NSError *err = nil;
+ NSDictionary *parametersDict = [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithBool:YES], kCWScanKeyMerge,
+ [NSNumber numberWithInteger:100], kCWScanKeyRestTime, nil];
+
+ NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err];
+ CWNetwork *apNetwork;
+
+ if (!err) {
+
+ for(uint row=0; row < [apArray count]; row++ ) {
+ apNetwork = [apArray objectAtIndex:row];
+
+ const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]);
+ const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
+ found.append(id);
+
+ QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
+ bool known = isKnownSsid(networkSsid);
+ if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
+ if( networkSsid == qt_mac_NSStringToQString( [currentInterface ssid])) {
+ state = QNetworkConfiguration::Active;
+ }
+ }
+ if(state == QNetworkConfiguration::Undefined) {
+ if(known) {
+ state = QNetworkConfiguration::Discovered;
+ } else {
+ state = QNetworkConfiguration::Undefined;
+ }
+ }
+ QNetworkConfiguration::Purpose purpose = QNetworkConfiguration::UnknownPurpose;
+ if([[apNetwork securityMode] intValue] == kCWSecurityModeOpen) {
+ purpose = QNetworkConfiguration::PublicPurpose;
+ } else {
+ purpose = QNetworkConfiguration::PrivatePurpose;
+ }
+
+ found.append(foundNetwork(id, networkSsid, state, interfaceName, purpose));
+
+ } //end row
+// [parametersDict release];
+
+ } //end error
+ } // endwifi power
+ // add known configurations that are not around.
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+
+ QString networkName = i.key();
+ const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkName));
+
+ if(!found.contains(id)) {
+ QString networkSsid = getSsidFromNetworkName(networkName);
+ const QString ssidId = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
+ QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
+ QString interfaceName;
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ interfaceName = ij.value();
+ }
+
+ if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
+ if( networkSsid == qt_mac_NSStringToQString([currentInterface ssid])) {
+ state = QNetworkConfiguration::Active;
+ }
+ }
+ if(state == QNetworkConfiguration::Undefined) {
+ if( userProfiles.contains(networkName)
+ && found.contains(ssidId)) {
+ state = QNetworkConfiguration::Discovered;
+ }
+ }
+
+ if(state == QNetworkConfiguration::Undefined) {
+ state = QNetworkConfiguration::Defined;
+ }
+
+ found.append(foundNetwork(id, networkName, state, interfaceName, QNetworkConfiguration::UnknownPurpose));
+ }
+ }
+ emit networksChanged();
+ [pool release];
+}
+
+QStringList QScanThread::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose)
+{
+ QStringList found;
+ QMutexLocker locker(&mutex);
+ QNetworkConfigurationPrivate *ptr = new QNetworkConfigurationPrivate;
+
+ ptr->name = name;
+ ptr->isValid = true;
+ ptr->id = id;
+ ptr->state = state;
+ ptr->type = QNetworkConfiguration::InternetAccessPoint;
+ ptr->bearer = QLatin1String("WLAN");
+ ptr->purpose = purpose;
+
+ fetchedConfigurations.append( ptr);
+ configurationInterface.insert(ptr->id, interfaceName);
+
+ locker.unlock();
+ locker.relock();
+ found.append(id);
+ return found;
+}
+
+QList<QNetworkConfigurationPrivate *> QScanThread::getConfigurations()
+{
+ QMutexLocker locker(&mutex);
+
+ QList<QNetworkConfigurationPrivate *> foundConfigurations = fetchedConfigurations;
+ fetchedConfigurations.clear();
+
+ return foundConfigurations;
+}
+
+void QScanThread::getUserConfigurations()
+{
+ QMutexLocker locker(&mutex);
QMacCocoaAutoReleasePool pool;
- if([[CWInterface supportedInterfaces] count] > 0 && !listener) {
- listener = [[QNSListener alloc] init];
- listener.engine = this;
- hasWifi = true;
- } else {
- hasWifi = false;
+ userProfiles.clear();
+
+ NSArray *wifiInterfaces = [CWInterface supportedInterfaces];
+ for(uint row=0; row < [wifiInterfaces count]; row++ ) {
+
+ CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]];
+ NSString *nsInterfaceName = [wifiInterface name];
+// add user configured system networks
+ SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil);
+ NSDictionary * airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName]);
+ CFRelease(dynRef);
+
+ NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"];
+
+ NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
+ for(NSString *ssidkey in thisSsidarray) {
+ QString thisSsid = qt_mac_NSStringToQString(ssidkey);
+ if(!userProfiles.contains(thisSsid)) {
+ QMap <QString,QString> map;
+ map.insert(thisSsid, qt_mac_NSStringToQString(nsInterfaceName));
+ userProfiles.insert(thisSsid, map);
+ }
+ }
+ CFRelease(airportPlist);
+
+ // 802.1X user profiles
+ QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist";
+ NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:qt_mac_QStringToNSString(userProfilePath)] autorelease];
+ NSString *profileStr= @"Profiles";
+ NSString *nameStr = @"UserDefinedName";
+ NSString *networkSsidStr = @"Wireless Network";
+ for (id profileKey in eapDict) {
+ if ([profileStr isEqualToString:profileKey]) {
+ NSDictionary *itemDict = [eapDict objectForKey:profileKey];
+ for (id itemKey in itemDict) {
+
+ NSInteger dictSize = [itemKey count];
+ id objects[dictSize];
+ id keys[dictSize];
+
+ [itemKey getObjects:objects andKeys:keys];
+ QString networkName;
+ QString ssid;
+ for(int i = 0; i < dictSize; i++) {
+ if([nameStr isEqualToString:keys[i]]) {
+ networkName = qt_mac_NSStringToQString(objects[i]);
+ }
+ if([networkSsidStr isEqualToString:keys[i]]) {
+ ssid = qt_mac_NSStringToQString(objects[i]);
+ }
+ if(!userProfiles.contains(networkName)
+ && !ssid.isEmpty()) {
+ QMap<QString,QString> map;
+ map.insert(ssid, qt_mac_NSStringToQString(nsInterfaceName));
+ userProfiles.insert(networkName, map);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+QString QScanThread::getSsidFromNetworkName(const QString &name)
+{
+ QMutexLocker locker(&mutex);
+
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QMap<QString,QString> map = i.value();
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ const QString networkNameHash = QString::number(qHash(QLatin1String("corewlan:") +i.key()));
+ if(name == i.key() || name == networkNameHash) {
+ return ij.key();
+ }
+ }
+ }
+ return QString();
+}
+
+QString QScanThread::getNetworkNameFromSsid(const QString &ssid)
+{
+ QMutexLocker locker(&mutex);
+
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QMap<QString,QString> map = i.value();
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ if(ij.key() == ssid) {
+ return i.key();
+ }
+ }
}
- QMetaObject::invokeMethod(this, "requestUpdate", Qt::QueuedConnection);
+ return QString();
+}
+
+bool QScanThread::isKnownSsid(const QString &ssid)
+{
+ QMutexLocker locker(&mutex);
+
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QMap<QString,QString> map = i.value();
+ if(map.keys().contains(ssid)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
+: QBearerEngineImpl(parent), scanThread(0)
+{
+ scanThread = new QScanThread(this);
+ connect(scanThread, SIGNAL(networksChanged()),
+ this, SLOT(networksChanged()));
}
QCoreWlanEngine::~QCoreWlanEngine()
@@ -167,18 +423,35 @@ QCoreWlanEngine::~QCoreWlanEngine()
[listener release];
}
+void QCoreWlanEngine::initialize()
+{
+ QMutexLocker locker(&mutex);
+
+ if([[CWInterface supportedInterfaces] count] > 0 && !listener) {
+ listener = [[QNSListener alloc] init];
+ listener.engine = this;
+ hasWifi = true;
+ } else {
+ hasWifi = false;
+ }
+ storeSession = NULL;
+
+ startNetworkChangeLoop();
+}
+
+
QString QCoreWlanEngine::getInterfaceFromId(const QString &id)
{
QMutexLocker locker(&mutex);
- return configurationInterface.value(id);
+ return scanThread->configurationInterface.value(id);
}
bool QCoreWlanEngine::hasIdentifier(const QString &id)
{
QMutexLocker locker(&mutex);
- return configurationInterface.contains(id);
+ return scanThread->configurationInterface.contains(id);
}
void QCoreWlanEngine::connectToId(const QString &id)
@@ -195,13 +468,14 @@ void QCoreWlanEngine::connectToId(const QString &id)
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
QString wantedSsid;
- bool using8021X = false;
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- const QString idHash = QString::number(qHash(QLatin1String("corewlan:") + getNetworkNameFromSsid(ptr->name)));
+ const QString idHash = QString::number(qHash(QLatin1String("corewlan:") + ptr->name));
+ const QString idHash2 = QString::number(qHash(QLatin1String("corewlan:") + scanThread->getNetworkNameFromSsid(ptr->name)));
- if (idHash != id) {
+ bool using8021X = false;
+ if (idHash2 != id) {
NSArray *array = [CW8021XProfile allUser8021XProfiles];
for (NSUInteger i = 0; i < [array count]; ++i) {
@@ -210,7 +484,7 @@ void QCoreWlanEngine::connectToId(const QString &id)
const QString ssidHash = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] ssid])));
if (id == networkNameHashCheck || id == ssidHash) {
- const QString thisName = getSsidFromNetworkName(id);
+ const QString thisName = scanThread->getSsidFromNetworkName(id);
if (thisName.isEmpty())
wantedSsid = id;
else
@@ -225,24 +499,25 @@ void QCoreWlanEngine::connectToId(const QString &id)
if (!using8021X) {
QString wantedNetwork;
- QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ QMapIterator<QString, QMap<QString,QString> > i(scanThread->userProfiles);
while (i.hasNext()) {
i.next();
wantedNetwork = i.key();
const QString networkNameHash = QString::number(qHash(QLatin1String("corewlan:") + wantedNetwork));
if (id == networkNameHash) {
- wantedSsid = getSsidFromNetworkName(wantedNetwork);
+ wantedSsid = scanThread->getSsidFromNetworkName(wantedNetwork);
break;
}
}
}
NSDictionary *scanParameters = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], kCWScanKeyMerge,
+ [NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType,
[NSNumber numberWithInteger:100], kCWScanKeyRestTime,
qt_mac_QStringToNSString(wantedSsid), kCWScanKeySSID,
nil];
- NSArray *scanArray = [NSArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:scanParameters error:&err]];
+ NSArray *scanArray = [wifiInterface scanForNetworksWithParameters:scanParameters error:&err];
if(!err) {
for(uint row=0; row < [scanArray count]; row++ ) {
@@ -349,7 +624,7 @@ void QCoreWlanEngine::disconnectFromId(const QString &id)
void QCoreWlanEngine::requestUpdate()
{
- getUserConfigurations();
+ scanThread->getUserConfigurations();
doRequestUpdate();
}
@@ -359,228 +634,12 @@ void QCoreWlanEngine::doRequestUpdate()
QMacCocoaAutoReleasePool pool;
- QStringList previous = accessPointConfigurations.keys();
-
NSArray *wifiInterfaces = [CWInterface supportedInterfaces];
for (uint row = 0; row < [wifiInterfaces count]; ++row) {
- foreach (const QString &interface,
- scanForSsids(qt_mac_NSStringToQString([wifiInterfaces objectAtIndex:row]))) {
- previous.removeAll(interface);
- }
+ scanThread->interfaceName = qt_mac_NSStringToQString([wifiInterfaces objectAtIndex:row]);
+ scanThread->start();
}
-
- while (!previous.isEmpty()) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(previous.takeFirst());
-
- configurationInterface.remove(ptr->id);
-
- locker.unlock();
- emit configurationRemoved(ptr);
- locker.relock();
- }
-
locker.unlock();
- emit updateCompleted();
-}
-
-QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name)
-{
- QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
- while (i.hasNext()) {
- i.next();
- QMap<QString,QString> map = i.value();
- QMapIterator<QString, QString> ij(i.value());
- while (ij.hasNext()) {
- ij.next();
- const QString networkNameHash = QString::number(qHash(QLatin1String("corewlan:") + i.key()));
- if (name == i.key() || name == networkNameHash) {
- return ij.key();
- }
- }
- }
- return QString();
-}
-
-QString QCoreWlanEngine::getNetworkNameFromSsid(const QString &ssid)
-{
- QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
- while (i.hasNext()) {
- i.next();
- QMap<QString,QString> map = i.value();
- QMapIterator<QString, QString> ij(i.value());
- while (ij.hasNext()) {
- ij.next();
- if(ij.key() == ssid) {
- return i.key();
- }
- }
- }
- return QString();
-}
-
-QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
-{
- QMutexLocker locker(&mutex);
-
- QStringList found;
-
- if(!hasWifi) {
- return found;
- }
- QMacCocoaAutoReleasePool pool;
-
- CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)];
- QStringList addedConfigs;
-
- if([currentInterface power]) {
- NSError *err = nil;
- NSDictionary *parametersDict = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithBool:YES], kCWScanKeyMerge,
- [NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType, // get the networks in the scan cache
- [NSNumber numberWithInteger:100], kCWScanKeyRestTime, nil];
- NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err];
- CWNetwork *apNetwork;
- if (!err) {
-
- for(uint row=0; row < [apArray count]; row++ ) {
- apNetwork = [apArray objectAtIndex:row];
-
- const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]);
-
- const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
- found.append(id);
-
- QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
- bool known = isKnownSsid(networkSsid);
- if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
- if( networkSsid == qt_mac_NSStringToQString( [currentInterface ssid])) {
- state = QNetworkConfiguration::Active;
- }
- }
- if(state == QNetworkConfiguration::Undefined) {
- if(known) {
- state = QNetworkConfiguration::Discovered;
- } else {
- state = QNetworkConfiguration::Undefined;
- }
- }
- QNetworkConfiguration::Purpose purpose = QNetworkConfiguration::UnknownPurpose;
- if([[apNetwork securityMode] intValue] == kCWSecurityModeOpen) {
- purpose = QNetworkConfiguration::PublicPurpose;
- } else {
- purpose = QNetworkConfiguration::PrivatePurpose;
- }
-
- found.append(foundNetwork(id, networkSsid, state, interfaceName, purpose));
-
- } //end row
- } //end error
- } // endwifi power
-
- // add known configurations that are not around.
- QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
- while (i.hasNext()) {
- i.next();
-
- QString networkName = i.key();
- const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkName));
-
- if(!found.contains(id)) {
- QString networkSsid = getSsidFromNetworkName(networkName);
- const QString ssidId = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
- QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
- QString interfaceName;
- QMapIterator<QString, QString> ij(i.value());
- while (ij.hasNext()) {
- ij.next();
- interfaceName = ij.value();
- }
-
- if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
- if( networkSsid == qt_mac_NSStringToQString([currentInterface ssid])) {
- state = QNetworkConfiguration::Active;
- }
- }
- if(state == QNetworkConfiguration::Undefined) {
- if( userProfiles.contains(networkName)
- && found.contains(ssidId)) {
- state = QNetworkConfiguration::Discovered;
- }
- }
-
- if(state == QNetworkConfiguration::Undefined) {
- state = QNetworkConfiguration::Defined;
- }
-
- found.append(foundNetwork(id, networkName, state, interfaceName, QNetworkConfiguration::UnknownPurpose));
- }
- }
- return found;
-}
-
-QStringList QCoreWlanEngine::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose)
-{
- QStringList found;
- QMutexLocker locker(&mutex);
- if (accessPointConfigurations.contains(id)) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- bool changed = false;
-
- ptr->mutex.lock();
-
- if (!ptr->isValid) {
- ptr->isValid = true;
- changed = true;
- }
-
- if (ptr->name != name) {
- ptr->name = name;
- changed = true;
- }
-
- if (ptr->id != id) {
- ptr->id = id;
- changed = true;
- }
-
- if (ptr->state != state) {
- ptr->state = state;
- changed = true;
- }
-
- if (ptr->purpose != purpose) {
- ptr->purpose = purpose;
- changed = true;
- }
- ptr->mutex.unlock();
-
- if (changed) {
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- }
- found.append(id);
- } else {
- QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
-
- ptr->name = name;
- ptr->isValid = true;
- ptr->id = id;
- ptr->state = state;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->bearer = QLatin1String("WLAN");
- ptr->purpose = purpose;
-
- accessPointConfigurations.insert(ptr->id, ptr);
- configurationInterface.insert(ptr->id, interfaceName);
-
- locker.unlock();
- emit configurationAdded(ptr);
- locker.relock();
- found.append(id);
- }
- return found;
}
bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
@@ -596,20 +655,6 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
return false;
}
-bool QCoreWlanEngine::isKnownSsid(const QString &ssid)
-{
- QMutexLocker locker(&mutex);
-
- QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
- while (i.hasNext()) {
- i.next();
- QMap<QString,QString> map = i.value();
- if(map.keys().contains(ssid)) {
- return true;
- }
- }
- return false;
-}
QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id)
{
@@ -644,7 +689,6 @@ QNetworkConfigurationManager::Capabilities QCoreWlanEngine::capabilities() const
void QCoreWlanEngine::startNetworkChangeLoop()
{
- storeSession = NULL;
SCDynamicStoreContext dynStoreContext = { 0, this/*(void *)storeSession*/, NULL, NULL, NULL };
storeSession = SCDynamicStoreCreate(NULL,
@@ -711,74 +755,73 @@ bool QCoreWlanEngine::requiresPolling() const
return true;
}
-void QCoreWlanEngine::getUserConfigurations()
+void QCoreWlanEngine::networksChanged()
{
- QMacCocoaAutoReleasePool pool;
- userProfiles.clear();
+ QMutexLocker locker(&mutex);
- NSArray *wifiInterfaces = [CWInterface supportedInterfaces];
- for(uint row=0; row < [wifiInterfaces count]; row++ ) {
+ QStringList previous = accessPointConfigurations.keys();
- CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]];
- NSString *nsInterfaceName = [wifiInterface name];
-// add user configured system networks
- SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil);
- NSDictionary *airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName] autorelease]);
- CFRelease(dynRef);
+ QList<QNetworkConfigurationPrivate *> foundConfigurations = scanThread->getConfigurations();
+ while (!foundConfigurations.isEmpty()) {
+ QNetworkConfigurationPrivate *cpPriv = foundConfigurations.takeFirst();
- NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"];
+ previous.removeAll(cpPriv->id);
- NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
- for(NSString *ssidkey in thisSsidarray) {
- QString thisSsid = qt_mac_NSStringToQString(ssidkey);
- if(!userProfiles.contains(thisSsid)) {
- QMap <QString,QString> map;
- map.insert(thisSsid, qt_mac_NSStringToQString(nsInterfaceName));
- userProfiles.insert(thisSsid, map);
+ if (accessPointConfigurations.contains(cpPriv->id)) {
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(cpPriv->id);
+
+ bool changed = false;
+
+ ptr->mutex.lock();
+
+ if (ptr->isValid != cpPriv->isValid) {
+ ptr->isValid = cpPriv->isValid;
+ changed = true;
}
- }
- CFRelease(airportPlist);
- // 802.1X user profiles
- QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist";
- NSDictionary* eapDict = [[NSDictionary alloc] initWithContentsOfFile:qt_mac_QStringToNSString(userProfilePath)];
- NSString *profileStr= @"Profiles";
- NSString *nameStr = @"UserDefinedName";
- NSString *networkSsidStr = @"Wireless Network";
- for (id profileKey in eapDict) {
- if ([profileStr isEqualToString:profileKey]) {
- NSDictionary *itemDict = [eapDict objectForKey:profileKey];
- for (id itemKey in itemDict) {
+ if (ptr->name != cpPriv->name) {
+ ptr->name = cpPriv->name;
+ changed = true;
+ }
- NSInteger dictSize = [itemKey count];
- id objects[dictSize];
- id keys[dictSize];
+ if (ptr->state != cpPriv->state) {
+ ptr->state = cpPriv->state;
+ changed = true;
+ }
- [itemKey getObjects:objects andKeys:keys];
- QString networkName;
- QString ssid;
- for(int i = 0; i < dictSize; i++) {
- if([nameStr isEqualToString:keys[i]]) {
- networkName = qt_mac_NSStringToQString(objects[i]);
- }
- if([networkSsidStr isEqualToString:keys[i]]) {
- ssid = qt_mac_NSStringToQString(objects[i]);
- }
- if(!userProfiles.contains(networkName)
- && !ssid.isEmpty()) {
- QMap<QString,QString> map;
- map.insert(ssid, qt_mac_NSStringToQString(nsInterfaceName));
- userProfiles.insert(networkName, map);
- }
- }
- }
- [itemDict release];
+ ptr->mutex.unlock();
+
+ if (changed) {
+ locker.unlock();
+ emit configurationChanged(ptr);
+ locker.relock();
}
+
+ delete cpPriv;
+ } else {
+ QNetworkConfigurationPrivatePointer ptr(cpPriv);
+
+ accessPointConfigurations.insert(ptr->id, ptr);
+
+ locker.unlock();
+ emit configurationAdded(ptr);
+ locker.relock();
}
- [eapDict release];
}
+
+ while (!previous.isEmpty()) {
+ QNetworkConfigurationPrivatePointer ptr =
+ accessPointConfigurations.take(previous.takeFirst());
+
+ locker.unlock();
+ emit configurationRemoved(ptr);
+ locker.relock();
+ }
+
+ locker.unlock();
+ emit updateCompleted();
+
}
-QT_END_NAMESPACE
-#endif // QT_NO_BEARERMANAGEMENT
+QT_END_NAMESPACE
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index 41ff3e0..652fe4a 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -177,6 +177,11 @@ void QGenericEngine::disconnectFromId(const QString &id)
emit connectionError(id, OperationNotSupported);
}
+void QGenericEngine::initialize()
+{
+ doRequestUpdate();
+}
+
void QGenericEngine::requestUpdate()
{
doRequestUpdate();
diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h
index 82d22af..cdbbc9d 100644
--- a/src/plugins/bearer/generic/qgenericengine.h
+++ b/src/plugins/bearer/generic/qgenericengine.h
@@ -70,6 +70,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
index fc9b469..9d1bfab 100644
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ b/src/plugins/bearer/icd/qicdengine.cpp
@@ -225,8 +225,6 @@ QIcdEngine::QIcdEngine(QObject *parent)
: QBearerEngine(parent), iapMonitor(new IapMonitor), m_dbusInterface(0),
firstUpdate(true), m_scanGoingOn(false)
{
- QMetaObject::invokeMethod(this, "doRequestUpdate", Qt::QueuedConnection);
- init();
}
QIcdEngine::~QIcdEngine()
@@ -243,8 +241,10 @@ QNetworkConfigurationManager::Capabilities QIcdEngine::capabilities() const
QNetworkConfigurationManager::NetworkSessionRequired;
}
-void QIcdEngine::init()
+void QIcdEngine::initialize()
{
+ QMutexLocker locker(&mutex);
+
// Setup DBus Interface for ICD
m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE,
ICD_DBUS_API_PATH,
@@ -272,6 +272,8 @@ void QIcdEngine::init()
QNetworkConfigurationPrivatePointer ptr(cpPriv);
userChoiceConfigurations.insert(cpPriv->id, ptr);
+
+ doRequestUpdate();
}
static inline QString network_attrs_to_security(uint network_attrs)
diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h
index 841874f..2f9f8ed 100644
--- a/src/plugins/bearer/icd/qicdengine.h
+++ b/src/plugins/bearer/icd/qicdengine.h
@@ -91,6 +91,7 @@ public:
bool hasIdentifier(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkConfigurationManager::Capabilities capabilities() const;
@@ -123,7 +124,6 @@ public:
emit configurationChanged(ptr);
}
- void init();
void cleanup();
void addConfiguration(QString &iap_id);
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
index e796df3..9b6ffa0 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
@@ -100,8 +100,6 @@ QNativeWifiEngine::QNativeWifiEngine(QObject *parent)
if (result != ERROR_SUCCESS)
qDebug("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result);
#endif
-
- scanComplete();
}
QNativeWifiEngine::~QNativeWifiEngine()
@@ -472,6 +470,11 @@ void QNativeWifiEngine::disconnectFromId(const QString &id)
}
}
+void QNativeWifiEngine::initialize()
+{
+ scanComplete();
+}
+
void QNativeWifiEngine::requestUpdate()
{
QMutexLocker locker(&mutex);
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h
index 77764e4..3b21985 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.h
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h
@@ -80,6 +80,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 13b2252..3ebc356 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -93,16 +93,16 @@ QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent)
userSettings->setConnections();
connect(userSettings, SIGNAL(newConnection(QDBusObjectPath)),
this, SLOT(newConnection(QDBusObjectPath)));
-
- QMetaObject::invokeMethod(this, "init", Qt::QueuedConnection);
}
QNetworkManagerEngine::~QNetworkManagerEngine()
{
}
-void QNetworkManagerEngine::init()
+void QNetworkManagerEngine::initialize()
{
+ QMutexLocker locker(&mutex);
+
// Get current list of access points.
foreach (const QDBusObjectPath &devicePath, interface->getDevices())
deviceAdded(devicePath);
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index 7f8badb..8e95a2c 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -73,8 +73,6 @@ public:
QNetworkManagerEngine(QObject *parent = 0);
~QNetworkManagerEngine();
- Q_INVOKABLE void init();
-
bool networkManagerAvailable() const;
QString getInterfaceFromId(const QString &id);
@@ -85,6 +83,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index c629d02..8e9675e 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -137,7 +137,12 @@ SymbianEngine::SymbianEngine(QObject *parent)
return;
}
#endif
-
+}
+
+void SymbianEngine::initialize()
+{
+ QMutexLocker locker(&mutex);
+
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
cpPriv->name = "UserChoice";
cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown;
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index dfd12bd..afb37de 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -110,6 +110,7 @@ public:
bool hasIdentifier(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkConfigurationManager::Capabilities capabilities() const;
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 0b8a2e4..03d535c 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -796,7 +796,7 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS
JSC::UString context;
// The first non-empty source URL in the call stack determines the translation context.
{
- JSC::ExecState *frame = exec->removeHostCallFrameFlag();
+ JSC::ExecState *frame = exec->callerFrame()->removeHostCallFrameFlag();
while (frame) {
if (frame->codeBlock() && frame->codeBlock()->source()
&& !frame->codeBlock()->source()->url().isEmpty()) {
@@ -3404,7 +3404,7 @@ void QScriptEngine::installTranslatorFunctions(const QScriptValue &object)
// unsigned attribs = JSC::DontEnum;
JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 5, JSC::Identifier(exec, "qsTranslate"), QScript::functionQsTranslate));
JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 2, JSC::Identifier(exec, "QT_TRANSLATE_NOOP"), QScript::functionQsTranslateNoOp));
- JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::PrototypeFunction(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr));
+ JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr));
JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "QT_TR_NOOP"), QScript::functionQsTrNoOp));
glob->stringPrototype()->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "arg"), QScript::stringProtoFuncArg));
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 0477454..5e4f097 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -35,6 +35,7 @@
#include "Error.h"
#include "PrototypeFunction.h"
+#include "NativeFunctionWrapper.h"
#include "PropertyNameArray.h"
#include "JSFunction.h"
#include "JSString.h"
@@ -1753,9 +1754,9 @@ QObjectPrototype::QObjectPrototype(JSC::ExecState* exec, WTF::PassRefPtr<JSC::St
| QScriptEngine::ExcludeSuperClassProperties
| QScriptEngine::ExcludeChildObjects));
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/0, exec->propertyNames().toString, qobjectProtoFuncToString), JSC::DontEnum);
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/1, JSC::Identifier(exec, "findChild"), qobjectProtoFuncFindChild), JSC::DontEnum);
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/1, JSC::Identifier(exec, "findChildren"), qobjectProtoFuncFindChildren), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, /*length=*/0, exec->propertyNames().toString, qobjectProtoFuncToString), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, /*length=*/1, JSC::Identifier(exec, "findChild"), qobjectProtoFuncFindChild), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, /*length=*/1, JSC::Identifier(exec, "findChildren"), qobjectProtoFuncFindChildren), JSC::DontEnum);
this->structure()->setHasGetterSetterProperties(true);
}
@@ -2015,7 +2016,7 @@ QMetaObjectPrototype::QMetaObjectPrototype(
JSC::Structure* prototypeFunctionStructure)
: QMetaObjectWrapperObject(exec, StaticQtMetaObject::get(), /*ctor=*/JSC::JSValue(), structure)
{
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/0, JSC::Identifier(exec, "className"), qmetaobjectProtoFuncClassName), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, /*length=*/0, JSC::Identifier(exec, "className"), qmetaobjectProtoFuncClassName), JSC::DontEnum);
}
static const uint qt_meta_data_QObjectConnectionManager[] = {
diff --git a/src/script/bridge/qscriptvariant.cpp b/src/script/bridge/qscriptvariant.cpp
index b2dd3b0..93459a8 100644
--- a/src/script/bridge/qscriptvariant.cpp
+++ b/src/script/bridge/qscriptvariant.cpp
@@ -29,6 +29,8 @@
#include "Error.h"
#include "PrototypeFunction.h"
+#include "JSFunction.h"
+#include "NativeFunctionWrapper.h"
#include "JSString.h"
namespace JSC
@@ -139,8 +141,8 @@ QVariantPrototype::QVariantPrototype(JSC::ExecState* exec, WTF::PassRefPtr<JSC::
{
setDelegate(new QVariantDelegate(QVariant()));
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, variantProtoFuncToString), JSC::DontEnum);
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, variantProtoFuncValueOf), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, variantProtoFuncToString), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, variantProtoFuncValueOf), JSC::DontEnum);
}