From 3a2d02f3a8f02509023dd398da77f35b9b3ad68f Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Mon, 17 Aug 2009 19:53:45 +0200 Subject: Use qt_TDesC2QString() instead qstringFromDesc(). That way we will avoid duplicated functionality. --- src/network/kernel/qnetworkinterface_symbian.cpp | 26 ++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp index 717d80d..2ba5350 100644 --- a/src/network/kernel/qnetworkinterface_symbian.cpp +++ b/src/network/kernel/qnetworkinterface_symbian.cpp @@ -43,6 +43,7 @@ #include "qnetworkinterface.h" #include "qnetworkinterface_p.h" +#include "../corelib/kernel/qcore_symbian_p.h" #ifndef QT_NO_NETWORKINTERFACE @@ -66,11 +67,6 @@ static QNetworkInterface::InterfaceFlags convertFlags(const TSoInetInterfaceInfo return flags; } -QString qstringFromDesc(const TDesC& aData) -{ - return QString::fromUtf16(aData.Ptr(), aData.Length()); -} - static QList interfaceListing() { TInt err(KErrNone); @@ -111,7 +107,7 @@ static QList interfaceListing() iface = new QNetworkInterfacePrivate; iface->index = ifindex++; interfaces << iface; - iface->name = qstringFromDesc(info.iName); + iface->name = qt_TDesC2QString(info.iName); iface->flags = convertFlags(info); if (/*info.iFeatures&KIfHasHardwareAddr &&*/ info.iHwAddr.Family() != KAFUnspec) { @@ -121,37 +117,37 @@ static QList interfaceListing() address.Append(_L(":")); } address.UpperCase(); - iface->hardwareAddress = qstringFromDesc(address); + iface->hardwareAddress = qt_TDesC2QString(address); } // Get the address of the interface info.iAddress.Output(address); - entry.setIp(QHostAddress(qstringFromDesc(address))); + entry.setIp(QHostAddress(qt_TDesC2QString(address))); // Get the interface netmask // For some reason netmask is always 0.0.0.0 // info.iNetMask.Output(address); - // entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); + // entry.setNetmask( QHostAddress( qt_TDesC2QString( address ) ) ); // Workaround: Let Symbian determine netmask based on IP address class // TODO: Works only for IPv4 - Task: 259128 Implement IPv6 support TInetAddr netmask; netmask.NetMask(info.iAddress); netmask.Output(address); - entry.setNetmask(QHostAddress(qstringFromDesc(address))); + entry.setNetmask(QHostAddress(qt_TDesC2QString(address))); // Get the interface broadcast address if (iface->flags & QNetworkInterface::CanBroadcast) { // For some reason broadcast address is always 0.0.0.0 // info.iBrdAddr.Output(address); - // entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); + // entry.setBroadcast( QHostAddress( qt_TDesC2QString( address ) ) ); // Workaround: Let Symbian determine broadcast address based on IP address // TODO: Works only for IPv4 - Task: 259128 Implement IPv6 support TInetAddr broadcast; broadcast.NetBroadcast(info.iAddress); broadcast.Output(address); - entry.setBroadcast(QHostAddress(qstringFromDesc(address))); + entry.setBroadcast(QHostAddress(qt_TDesC2QString(address))); } // Add new entry to interface address entries @@ -193,12 +189,12 @@ static QList interfaceListing() // get interface address routeInfo.iIfAddr.Output(address); - QHostAddress ifAddr(qstringFromDesc(address)); + QHostAddress ifAddr(qt_TDesC2QString(address)); if (ifAddr.isNull()) continue; routeInfo.iDstAddr.Output(address); - QHostAddress destination(qstringFromDesc(address)); + QHostAddress destination(qt_TDesC2QString(address)); if (destination.isNull() || destination != ifAddr) continue; @@ -215,7 +211,7 @@ static QList interfaceListing() continue; } else { routeInfo.iNetMask.Output(address); - QHostAddress netmask(qstringFromDesc(address)); + QHostAddress netmask(qt_TDesC2QString(address)); entry.setNetmask(netmask); // NULL boradcast address for // ::postProcess to have effect -- cgit v0.12 From 547e737c4fc01fb33cb2eae8d4662b367fccb097 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 18 Aug 2009 09:30:46 +0200 Subject: Fixes to Symbian native engine for QFileSystemWatcher. The wrong version of cancel was used, resulting in all filesystem notifications being cancelled when one path was removed from the engine. For directory notifications, changed ENotifyAll to ENotifyEntry to reduce the spurious directory changed notifications which come from file modifications within that directory. On Symbian OS, opening a file for overwrite (truncate mode in Qt terms) will cause a directory change notification, the OS considers it to be the same type of event as creating a new file for the first time. Other platforms presumably do not have this behaviour otherwise the auto test would fail there as well. Reviewed-by: miikka heikkinen --- src/corelib/io/qfilesystemwatcher_symbian.cpp | 29 ++++++++++++++++++--------- src/corelib/io/qfilesystemwatcher_symbian_p.h | 4 ++-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp index 49a5f34..412372a 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian.cpp +++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp @@ -52,20 +52,25 @@ QT_BEGIN_NAMESPACE CNotifyChangeEvent* CNotifyChangeEvent::New(RFs &fs, const TDesC& file, - QSymbianFileSystemWatcherEngine* e) + QSymbianFileSystemWatcherEngine* e, bool aIsDir) { - CNotifyChangeEvent* self = new CNotifyChangeEvent(fs, file, e); + CNotifyChangeEvent* self = new CNotifyChangeEvent(fs, file, e, aIsDir); return self; } CNotifyChangeEvent::CNotifyChangeEvent(RFs &fs, const TDesC& file, - QSymbianFileSystemWatcherEngine* e, TInt aPriority) : + QSymbianFileSystemWatcherEngine* e, bool aIsDir, TInt aPriority) : CActive(aPriority), + isDir(aIsDir), fsSession(fs), watchedPath(file), engine(e) { - fsSession.NotifyChange(ENotifyAll, iStatus, file); + if(isDir) { + fsSession.NotifyChange(ENotifyEntry, iStatus, file); + } else { + fsSession.NotifyChange(ENotifyAll, iStatus, file); + } CActiveScheduler::Add(this); SetActive(); } @@ -77,8 +82,12 @@ CNotifyChangeEvent::~CNotifyChangeEvent() void CNotifyChangeEvent::RunL() { - if (iStatus.Int() == KErrNone){ - fsSession.NotifyChange(ENotifyAll, iStatus, watchedPath); + if (iStatus.Int() == KErrNone) { + if(isDir) { + fsSession.NotifyChange(ENotifyEntry, iStatus, watchedPath); + } else { + fsSession.NotifyChange(ENotifyAll, iStatus, watchedPath); + } SetActive(); QT_TRYCATCH_LEAVING(engine->emitPathChanged(this)); } else { @@ -88,7 +97,7 @@ void CNotifyChangeEvent::RunL() void CNotifyChangeEvent::DoCancel() { - fsSession.NotifyChangeCancel(); + fsSession.NotifyChangeCancel(iStatus); } QSymbianFileSystemWatcherEngine::QSymbianFileSystemWatcherEngine() : @@ -132,8 +141,8 @@ QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths, // Use absolute filepath as relative paths seem to have some issues. QString filePath = fi.absoluteFilePath(); - if(isDir && filePath.at(filePath.size()-1) != QChar('/')) { - filePath += QChar('/'); + if(isDir && filePath.at(filePath.size()-1) != QChar(L'/')) { + filePath += QChar(L'/'); } currentEvent = NULL; @@ -264,7 +273,7 @@ void QSymbianFileSystemWatcherEngine::addNativeListener(const QString &directory QMutexLocker locker(&mutex); QString nativeDir(QDir::toNativeSeparators(directoryPath)); TPtrC ptr(qt_QString2TPtrC(nativeDir)); - currentEvent = CNotifyChangeEvent::New(fsSession, ptr, this); + currentEvent = CNotifyChangeEvent::New(fsSession, ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive)); syncCondition.wakeOne(); } diff --git a/src/corelib/io/qfilesystemwatcher_symbian_p.h b/src/corelib/io/qfilesystemwatcher_symbian_p.h index 53b2b13..846541b 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian_p.h +++ b/src/corelib/io/qfilesystemwatcher_symbian_p.h @@ -71,10 +71,10 @@ class CNotifyChangeEvent : public CActive { public: CNotifyChangeEvent(RFs &fsSession, const TDesC& file, QSymbianFileSystemWatcherEngine* engine, - TInt aPriority = EPriorityStandard); + bool aIsDir, TInt aPriority = EPriorityStandard); ~CNotifyChangeEvent(); static CNotifyChangeEvent* New(RFs &fsSession, const TDesC& file, - QSymbianFileSystemWatcherEngine* engine); + QSymbianFileSystemWatcherEngine* engine, bool aIsDir); bool isDir; -- cgit v0.12 From bd62bc9d7a31507a2f1a4e627f32184cfd12711e Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 18 Aug 2009 09:57:09 +0200 Subject: Added ignore rules for Symbian build files. --- src/s60installs/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/s60installs/.gitignore diff --git a/src/s60installs/.gitignore b/src/s60installs/.gitignore new file mode 100644 index 0000000..d0a1b02 --- /dev/null +++ b/src/s60installs/.gitignore @@ -0,0 +1 @@ +bld.inf.qt_libs -- cgit v0.12