diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-10 13:34:50 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-10 13:34:50 (GMT) |
commit | e875699fb4c25b23248aff09cb690a287640e67f (patch) | |
tree | 92721b44691ddb02660042db52a1dda1d5fad94f /src/gui | |
parent | 504fb8a30ffef1f90a4cd4d61ab7f73c95fd9a03 (diff) | |
parent | 799c350d0fe0a29c146c7a32a509b71ea6bb7f49 (diff) | |
download | Qt-e875699fb4c25b23248aff09cb690a287640e67f.zip Qt-e875699fb4c25b23248aff09cb690a287640e67f.tar.gz Qt-e875699fb4c25b23248aff09cb690a287640e67f.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:
Add QWidget::update() test.
Add license headers
Import static contents tests from old manualtests
Fix Build Failure for Maemo 5 Debug Build
Add ability to read last mod.time for zip entry.
Avoid asserting when index passed to QZipReader::entryInfoAt is out of boundaries
Add isValid() method to QZipReader::FileInfo.
Add `QIODevice* device() const` public method to QZip classes.
Rebuild configure.exe (again enable QtDeclarative module by default)
Update src/3rdparty/javascriptcore and adapt src/script to the changes
Use index-based approach for iterating over JS array properties
QFSFileEngine reduce number of system calls
remove unneeded "permissions normalization" code from QFileInfoGatherer
remove unneeded code from QFileInfo
QFSFileEngine: Don't use owner's permissions for current user; calculate them instead
In QFSFileEngine::fileFlags call getPermissions() only if entry exists
move permissions calculation code to separate method
Assistant: Fix full text indexing.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/dialogs/qfileinfogatherer.cpp | 31 | ||||
-rw-r--r-- | src/gui/dialogs/qfileinfogatherer_p.h | 8 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qzip.cpp | 44 | ||||
-rw-r--r-- | src/gui/text/qzipreader_p.h | 5 | ||||
-rw-r--r-- | src/gui/text/qzipwriter_p.h | 2 |
6 files changed, 52 insertions, 40 deletions
diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index c75cdfd..3b08bf6 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -216,41 +216,10 @@ void QFileInfoGatherer::run() } } -/* - QFileInfo::permissions is different depending upon your platform. - - "normalize this" so they can mean the same to us. -*/ -QFile::Permissions QFileInfoGatherer::translatePermissions(const QFileInfo &fileInfo) const { - QFile::Permissions permissions = fileInfo.permissions(); -#ifdef Q_OS_WIN - return permissions; -#else - QFile::Permissions p = permissions; - p &= ~(QFile::ReadUser|QFile::WriteUser|QFile::ExeUser); - if ( permissions & QFile::ReadOther - || (fileInfo.ownerId() == userId && permissions & QFile::ReadOwner) - || (fileInfo.groupId() == groupId && permissions & QFile::ReadGroup)) - p |= QFile::ReadUser; - - if ( permissions & QFile::WriteOther - || (fileInfo.ownerId() == userId && permissions & QFile::WriteOwner) - || (fileInfo.groupId() == groupId && permissions & QFile::WriteGroup)) - p |= QFile::WriteUser; - - if ( permissions & QFile::ExeOther - || (fileInfo.ownerId() == userId && permissions & QFile::ExeOwner) - || (fileInfo.groupId() == groupId && permissions & QFile::ExeGroup)) - p |= QFile::ExeUser; - return p; -#endif -} - QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const { QExtendedInformation info(fileInfo); info.icon = m_iconProvider->icon(fileInfo); - info.setPermissions(translatePermissions(fileInfo)); info.displayType = m_iconProvider->type(fileInfo); #ifndef QT_NO_FILESYSTEMWATCHER // ### Not ready to listen all modifications diff --git a/src/gui/dialogs/qfileinfogatherer_p.h b/src/gui/dialogs/qfileinfogatherer_p.h index b8b58a2..eff6b3c 100644 --- a/src/gui/dialogs/qfileinfogatherer_p.h +++ b/src/gui/dialogs/qfileinfogatherer_p.h @@ -88,11 +88,7 @@ public: return fe.caseSensitive(); } QFile::Permissions permissions() const { - return mPermissions; - } - - void setPermissions (QFile::Permissions permissions) { - mPermissions = permissions; + return mFileInfo.permissions(); } Type type() const { @@ -140,7 +136,6 @@ public: private : QFileInfo mFileInfo; - QFile::Permissions mPermissions; }; class QFileIconProvider; @@ -181,7 +176,6 @@ protected: private: void fetch(const QFileInfo &info, QTime &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path); QString translateDriveName(const QFileInfo &drive) const; - QFile::Permissions translatePermissions(const QFileInfo &fileInfo) const; QMutex mutex; QWaitCondition condition; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 581b538..8203549 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7964,6 +7964,8 @@ void qInitDrawhelperAsm() } #endif +#endif // QT_NO_DEBUG + if (functionForModeSolidAsm) { const int destinationMode = QPainter::CompositionMode_Destination; functionForModeSolidAsm[destinationMode] = functionForModeSolid_C[destinationMode]; diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp index d30c996..6f099a9 100644 --- a/src/gui/text/qzip.cpp +++ b/src/gui/text/qzip.cpp @@ -280,6 +280,21 @@ static QFile::Permissions modeToPermissions(quint32 mode) return ret; } +static QDateTime readMSDosDate(const uchar *src) +{ + uint dosDate = readUInt(src); + quint64 uDate; + uDate = (quint64)(dosDate >> 16); + uint tm_mday = (uDate & 0x1f); + uint tm_mon = ((uDate & 0x1E0) >> 5); + uint tm_year = (((uDate & 0x0FE00) >> 9) + 1980); + uint tm_hour = ((dosDate & 0xF800) >> 11); + uint tm_min = ((dosDate & 0x7E0) >> 5); + uint tm_sec = ((dosDate & 0x1f) << 1); + + return QDateTime(QDate(tm_year, tm_mon, tm_mday), QTime(tm_hour, tm_min, tm_sec)); +} + struct LocalFileHeader { uchar signature[4]; // 0x04034b50 @@ -343,7 +358,7 @@ struct FileHeader }; QZipReader::FileInfo::FileInfo() - : isDir(false), isFile(true), isSymLink(false), crc32(0), size(0) + : isDir(false), isFile(false), isSymLink(false), crc32(0), size(0) { } @@ -365,9 +380,15 @@ QZipReader::FileInfo& QZipReader::FileInfo::operator=(const FileInfo &other) permissions = other.permissions; crc32 = other.crc32; size = other.size; + lastModified = other.lastModified; return *this; } +bool QZipReader::FileInfo::isValid() const +{ + return isDir || isFile || isSymLink; +} + class QZipPrivate { public: @@ -403,6 +424,7 @@ void QZipPrivate::fillFileInfo(int index, QZipReader::FileInfo &fileInfo) const fileInfo.permissions = modeToPermissions(mode); fileInfo.crc32 = readUInt(header.h.crc_32); fileInfo.size = readUInt(header.h.uncompressed_size); + fileInfo.lastModified = readMSDosDate(header.h.last_mod_file); } class QZipReaderPrivate : public QZipPrivate @@ -750,6 +772,14 @@ QZipReader::~QZipReader() } /*! + Returns device used for reading zip archive. +*/ +QIODevice* QZipReader::device() const +{ + return d->device; +} + +/*! Returns true if the user can read the file; otherwise returns false. */ bool QZipReader::isReadable() const @@ -796,6 +826,7 @@ int QZipReader::count() const /*! Returns a FileInfo of an entry in the zipfile. The \a index is the index into the directoy listing of the zipfile. + Returns an invalid FileInfo if \a index is out of boundaries. \sa fileInfoList() */ @@ -803,7 +834,8 @@ QZipReader::FileInfo QZipReader::entryInfoAt(int index) const { d->scanFiles(); QZipReader::FileInfo fi; - d->fillFileInfo(index, fi); + if (index >= 0 && index < d->fileHeaders.count()) + d->fillFileInfo(index, fi); return fi; } @@ -1022,6 +1054,14 @@ QZipWriter::~QZipWriter() } /*! + Returns device used for writing zip archive. +*/ +QIODevice* QZipWriter::device() const +{ + return d->device; +} + +/*! Returns true if the user can write to the archive; otherwise returns false. */ bool QZipWriter::isWritable() const diff --git a/src/gui/text/qzipreader_p.h b/src/gui/text/qzipreader_p.h index 9b73373..6466a7b 100644 --- a/src/gui/text/qzipreader_p.h +++ b/src/gui/text/qzipreader_p.h @@ -55,6 +55,7 @@ // We mean it. // +#include <QtCore/qdatetime.h> #include <QtCore/qfile.h> #include <QtCore/qstring.h> @@ -70,6 +71,8 @@ public: explicit QZipReader(QIODevice *device); ~QZipReader(); + QIODevice* device() const; + bool isReadable() const; bool exists() const; @@ -79,6 +82,7 @@ public: FileInfo(const FileInfo &other); ~FileInfo(); FileInfo &operator=(const FileInfo &other); + bool isValid() const; QString filePath; uint isDir : 1; uint isFile : 1; @@ -86,6 +90,7 @@ public: QFile::Permissions permissions; uint crc32; qint64 size; + QDateTime lastModified; void *d; }; diff --git a/src/gui/text/qzipwriter_p.h b/src/gui/text/qzipwriter_p.h index 9322f4a..a50c172 100644 --- a/src/gui/text/qzipwriter_p.h +++ b/src/gui/text/qzipwriter_p.h @@ -69,6 +69,8 @@ public: explicit QZipWriter(QIODevice *device); ~QZipWriter(); + QIODevice* device() const; + bool isWritable() const; bool exists() const; |