From 830cbb1aaf047d8f0ab63f25148b7dc7cc9f8fe0 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Sat, 13 Apr 2013 15:54:12 +0900 Subject: Make qtbase compile with QT_NO_TEMPORARYFILE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ida2f59bb245ef70bf65f7e8944c4c315d5bc2f81 Reviewed-by: David Faure (KDE) Reviewed-by: Jørgen Lind Reviewed-by: Gunnar Sletta Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qfeatures.h | 5 +++++ src/corelib/global/qfeatures.txt | 7 +++++++ src/corelib/io/qlockfile_unix.cpp | 9 +++++++-- src/corelib/io/qsavefile.cpp | 7 ++++++- src/corelib/io/qsavefile.h | 7 ++++++- src/corelib/io/qsavefile_p.h | 6 ++++++ src/corelib/io/qtemporaryfile_p.h | 6 ++++++ 7 files changed, 43 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index f2e5dc7633..4534e9bf13 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -311,6 +311,11 @@ #define QT_NO_LOCALSERVER #endif +// QPdf +#if !defined(QT_NO_PDF) && (defined(QT_NO_TEMPORARYFILE)) +#define QT_NO_PDF +#endif + // QMenu #if !defined(QT_NO_MENU) && (defined(QT_NO_ACTION)) #define QT_NO_MENU diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 43db585643..61a3df39f3 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -851,6 +851,13 @@ Requires: Name: Color Names SeeAlso: ??? +Feature: PDF +Description: Supports pdf format +Section: Painting +Requires: TEMPORARYFILE +Name: QPdf +SeeAlso: ??? + Feature: PRINTER Description: Supports printing Section: Painting diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index ed3b399fbf..db81d65565 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -45,6 +45,7 @@ #include "QtCore/qcoreapplication.h" #include "QtCore/qfileinfo.h" #include "QtCore/qdebug.h" +#include "QtCore/qdatetime.h" #include "private/qcore_unix_p.h" // qt_safe_open #include "private/qabstractfileengine_p.h" @@ -80,12 +81,13 @@ static qint64 qt_write_loop(int fd, const char *data, qint64 len) int QLockFilePrivate::checkFcntlWorksAfterFlock() { +#ifndef QT_NO_TEMPORARYFILE QTemporaryFile file; if (!file.open()) - return -2; + return 0; const int fd = file.d_func()->engine()->handle(); if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs - return -3; + return 0; struct flock flockData; flockData.l_type = F_WRLCK; flockData.l_whence = SEEK_SET; @@ -95,6 +97,9 @@ int QLockFilePrivate::checkFcntlWorksAfterFlock() if (fcntl(fd, F_SETLK, &flockData) == -1) // for networked filesystems return 0; return 1; +#else + return 0; +#endif } static QBasicAtomicInt fcntlOK = Q_BASIC_ATOMIC_INITIALIZER(-1); diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp index f8b5ebcabd..5ed429c464 100644 --- a/src/corelib/io/qsavefile.cpp +++ b/src/corelib/io/qsavefile.cpp @@ -39,8 +39,11 @@ ** ****************************************************************************/ -#include "qplatformdefs.h" #include "qsavefile.h" + +#ifndef QT_NO_TEMPORARYFILE + +#include "qplatformdefs.h" #include "private/qsavefile_p.h" #include "qfileinfo.h" #include "qabstractfileengine_p.h" @@ -381,3 +384,5 @@ bool QSaveFile::directWriteFallback() const } QT_END_NAMESPACE + +#endif // QT_NO_TEMPORARYFILE diff --git a/src/corelib/io/qsavefile.h b/src/corelib/io/qsavefile.h index 6d81f58d42..ad18417124 100644 --- a/src/corelib/io/qsavefile.h +++ b/src/corelib/io/qsavefile.h @@ -42,6 +42,10 @@ #ifndef QSAVEFILE_H #define QSAVEFILE_H +#include + +#ifndef QT_NO_TEMPORARYFILE + #include #include @@ -51,7 +55,6 @@ QT_BEGIN_NAMESPACE - class QAbstractFileEngine; class QSaveFilePrivate; @@ -90,4 +93,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_TEMPORARYFILE + #endif // QSAVEFILE_H diff --git a/src/corelib/io/qsavefile_p.h b/src/corelib/io/qsavefile_p.h index 53a8b5eb34..b9efd1ee7c 100644 --- a/src/corelib/io/qsavefile_p.h +++ b/src/corelib/io/qsavefile_p.h @@ -53,6 +53,10 @@ // We mean it. // +#include + +#ifndef QT_NO_TEMPORARYFILE + #include "private/qfiledevice_p.h" QT_BEGIN_NAMESPACE @@ -75,4 +79,6 @@ protected: QT_END_NAMESPACE +#endif // QT_NO_TEMPORARYFILE + #endif // QSAVEFILE_P_H diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index d274f60ecc..fe637c8dfd 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -42,6 +42,10 @@ #ifndef QTEMPORARYFILE_P_H #define QTEMPORARYFILE_P_H +#include + +#ifndef QT_NO_TEMPORARYFILE + #include "private/qfsfileengine_p.h" #include "private/qfilesystemengine_p.h" #include "private/qfile_p.h" @@ -99,5 +103,7 @@ public: QT_END_NAMESPACE +#endif // QT_NO_TEMPORARYFILE + #endif /* QTEMPORARYFILE_P_H */ -- cgit v1.2.3