summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRitt Konstantin <ritt.ks@gmail.com>2010-03-09 13:57:26 (GMT)
committerJoão Abecasis <joao@trolltech.com>2010-03-09 15:46:30 (GMT)
commit1a682690ee31409223249cb0dd7c7ef588f6bdff (patch)
tree75645501517acd168785d2a25b64eb719f7e6a83 /src
parentaa235c3cf623f832c01df9a4065375ca610d4d06 (diff)
downloadQt-1a682690ee31409223249cb0dd7c7ef588f6bdff.zip
Qt-1a682690ee31409223249cb0dd7c7ef588f6bdff.tar.gz
Qt-1a682690ee31409223249cb0dd7c7ef588f6bdff.tar.bz2
remove unneeded code from QFileInfo
since we made sure user perms are calculated in file engine this dirty trick goes away...woohoo Merge-request: 428 Reviewed-by: João Abecasis <joao@trolltech.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qfileinfo.cpp51
-rw-r--r--src/corelib/io/qfileinfo_p.h7
2 files changed, 3 insertions, 55 deletions
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 625098e..37591c5 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -41,7 +41,6 @@
#include "qplatformdefs.h"
#include "qfileinfo.h"
-#include "qfsfileengine_p.h"
#include "qglobal.h"
#include "qdir.h"
#include "qfileinfo_p.h"
@@ -75,50 +74,6 @@ void QFileInfoPrivate::initFileEngine(const QString &file)
data->fileName = file;
}
-bool QFileInfoPrivate::hasAccess(Access access) const
-{
- if (!(getFileFlags(QAbstractFileEngine::PermsMask
- | QAbstractFileEngine::LocalDiskFlag) & QAbstractFileEngine::LocalDiskFlag)) {
- switch (access) {
- case ReadAccess:
- return getFileFlags(QAbstractFileEngine::ReadUserPerm);
- case WriteAccess:
- return getFileFlags(QAbstractFileEngine::WriteUserPerm);
- case ExecuteAccess:
- return getFileFlags(QAbstractFileEngine::ExeUserPerm);
- default:
- return false;
- }
- }
-
- int mode = 0;
- switch (access) {
- case ReadAccess:
- mode = R_OK;
- break;
- case WriteAccess:
- mode = W_OK;
- break;
- case ExecuteAccess:
- mode = X_OK;
- break;
- };
-#ifdef Q_OS_UNIX
- return QT_ACCESS(QFile::encodeName(data->fileName).data(), mode) == 0;
-#endif
-#ifdef Q_OS_WIN
- if ((access == ReadAccess && !getFileFlags(QAbstractFileEngine::ReadUserPerm))
- || (access == WriteAccess && !getFileFlags(QAbstractFileEngine::WriteUserPerm))) {
- return false;
- }
- if (access == ExecuteAccess)
- return getFileFlags(QAbstractFileEngine::ExeUserPerm);
-
- return ::_waccess((wchar_t*)QFSFileEnginePrivate::longFileName(data->fileName).utf16(), mode) == 0;
-#endif
- return false;
-}
-
void QFileInfoPrivate::detach()
{
qAtomicDetach(data);
@@ -893,7 +848,7 @@ bool QFileInfo::isReadable() const
Q_D(const QFileInfo);
if (!d->data->fileEngine)
return false;
- return d->hasAccess(QFileInfoPrivate::ReadAccess);
+ return d->getFileFlags(QAbstractFileEngine::ReadUserPerm);
}
/*!
@@ -906,7 +861,7 @@ bool QFileInfo::isWritable() const
Q_D(const QFileInfo);
if (!d->data->fileEngine)
return false;
- return d->hasAccess(QFileInfoPrivate::WriteAccess);
+ return d->getFileFlags(QAbstractFileEngine::WriteUserPerm);
}
/*!
@@ -919,7 +874,7 @@ bool QFileInfo::isExecutable() const
Q_D(const QFileInfo);
if (!d->data->fileEngine)
return false;
- return d->hasAccess(QFileInfoPrivate::ExecuteAccess);
+ return d->getFileFlags(QAbstractFileEngine::ExeUserPerm);
}
/*!
diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h
index d97a0cf..306ffe1 100644
--- a/src/corelib/io/qfileinfo_p.h
+++ b/src/corelib/io/qfileinfo_p.h
@@ -68,13 +68,6 @@ public:
void initFileEngine(const QString &);
- enum Access {
- ReadAccess,
- WriteAccess,
- ExecuteAccess
- };
- bool hasAccess(Access access) const;
-
uint getFileFlags(QAbstractFileEngine::FileFlags) const;
QDateTime &getFileTime(QAbstractFileEngine::FileTime) const;
QString getFileName(QAbstractFileEngine::FileName) const;