diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-04-28 12:44:50 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-04-28 12:44:50 (GMT) |
commit | 22fcb9580a6e2a183489c35eeafb6b32fcde96ea (patch) | |
tree | 4d4bf0ab41d92e96de6b2cbe47e9f81e9c7c8be4 | |
parent | 133a766d2e893a2f954f6bfbb18319e860e3836f (diff) | |
parent | 776e3379952e039ba1a6649e1bc0bcf8b45a1576 (diff) | |
download | Qt-22fcb9580a6e2a183489c35eeafb6b32fcde96ea.zip Qt-22fcb9580a6e2a183489c35eeafb6b32fcde96ea.tar.gz Qt-22fcb9580a6e2a183489c35eeafb6b32fcde96ea.tar.bz2 |
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 4 | ||||
-rw-r--r-- | tests/auto/network-settings.h | 54 |
2 files changed, 31 insertions, 27 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index b38a6c6..f7605c8 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -365,9 +365,9 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta start(); } - Q_ASSERT(!m_AOStatuses.contains(notifier)); - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); + + Q_ASSERT(!m_AOStatuses.contains(notifier)); m_AOStatuses.insert(notifier, status); diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index 9afe815..952ab89 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -131,11 +131,10 @@ public: if(QtNetworkSettings::entries.contains("server.ip")) { QtNetworkSettingsRecord* entry = entries["server.ip"]; - QByteArray valueAsAscii = entry->recordValue().toAscii(); - if(*serverIPAscii == 0) { - ::strcpy(serverIPAscii, valueAsAscii.data()); + if(serverIp.isNull()) { + serverIp = entry->recordValue().toAscii(); } - return serverIPAscii; + return serverIp.data(); } #endif //return "10.10.0.147"; @@ -178,13 +177,22 @@ public: #ifdef Q_OS_SYMBIAN static void setDefaultIap() { + loadDefaultIap(); + struct ifreq ifReq; - strcpy( ifReq.ifr_name, getDefaultIap().toAscii().constData()); + if(entries.contains("iap.default")) { + QtNetworkSettingsRecord* entry = entries["iap.default"]; + QByteArray tmp(entry->recordValue().toAscii()); + strcpy( ifReq.ifr_name, tmp.data()); + } + else // some default value + strcpy( ifReq.ifr_name, "Lab"); + int err = setdefaultif( &ifReq ); if(err) - printf("Setting default IAP - '%s' failed: %d\n", getDefaultIap().toAscii().constData(), err); + printf("Setting default IAP - '%s' failed: %d\n", ifReq.ifr_name, err); else - printf("'%s' used as an default IAP\n", getDefaultIap().toAscii().constData()); + printf("'%s' used as an default IAP\n", ifReq.ifr_name); } #endif @@ -196,20 +204,14 @@ private: static bool bDefaultIapLoaded; static bool bTestSettingsLoaded; static QString iapFileFullPath; - static QString strDefaultIap; - static char serverIPAscii[256]; - - static QString getDefaultIap() { - if(!bDefaultIapLoaded) { - if(!loadDefaultIap()) // not found in file - use default - strDefaultIap = QString("Lab"); - } - - return strDefaultIap; - } + static QByteArray serverIp; static bool loadDefaultIap() { + if(bDefaultIapLoaded) + return true; + QFile iapCfgFile(iapFileFullPath); + bool bFoundDefaultIapTag = false; if (iapCfgFile.open(QFile::ReadOnly)) { @@ -222,21 +224,24 @@ private: if(line.contains(QString("[DEFAULT]"))) { bFoundDefaultIapTag = true; - } else if(line.startsWith(QString("[")) && bFoundDefaultIapTag) { - bFoundDefaultIapTag = false; - break; // stick to default + } else if(line.contains(QString("[")) && bFoundDefaultIapTag) { + break; } if(bFoundDefaultIapTag && line.contains("name")) { int position = line.indexOf(QString("=")); position += QString("=").length(); - strDefaultIap = line.mid(position).trimmed(); + + //create record + QtNetworkSettingsRecord *entry = + new QtNetworkSettingsRecord( QString("iap.default"), line.mid(position).trimmed() ); + entries.insert(entry->recordName(), entry); break; } } while (!line.isNull()); } - return bFoundDefaultIapTag; + return bDefaultIapLoaded = bFoundDefaultIapTag; } static bool loadTestSettings() { @@ -290,8 +295,7 @@ QHash<QString, QtNetworkSettingsRecord* > QtNetworkSettings::entries = QHash<QSt bool QtNetworkSettings::bDefaultIapLoaded = false; bool QtNetworkSettings::bTestSettingsLoaded = false; QString QtNetworkSettings::iapFileFullPath = QString("C:\\Data\\iap.txt"); -QString QtNetworkSettings::strDefaultIap = QString(""); -char QtNetworkSettings::serverIPAscii[256]; +QByteArray QtNetworkSettings::serverIp; #endif #ifdef Q_OS_SYMBIAN |