summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qfiledialog.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-02-01 10:19:07 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-01 11:06:19 +0100
commitb44e67e1ca5766daef3e4f7a6dd433ebe0f744d1 (patch)
treefd10ab1e36f4b0c2c6b8d2061ae3dc71c508ba7b /src/widgets/dialogs/qfiledialog.cpp
parent9fa4e51dbb8cac4f7f5a6bee6e1b9b029b57f393 (diff)
Windows: Fix inclusion of <windows.h>
- Always use <qt_windows.h> as the last file to be included. - Remove it from some headers, use Qt::HANDLE instead of HANDLE. - Clean up #ifdef, use Q_OS_WIN for Windows/Windows CE. - Add NOMINMAX to qt_windows.h to avoid problems with the min/max macros. - Remove <windows.h> from qplatformdefs.h (VS2005) Change-Id: Ic44e2cb3eafce38e1ad645c3bf85745439398e50 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Diffstat (limited to 'src/widgets/dialogs/qfiledialog.cpp')
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index da734c80f0..e5a24075d9 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -45,6 +45,7 @@
#ifndef QT_NO_FILEDIALOG
#include "qfiledialog_p.h"
+#include "qplatformdialoghelper_qpa.h"
#include <private/qguiapplication_p.h>
#include <qfontmetrics.h>
#include <qaction.h>
@@ -67,11 +68,12 @@
#if defined(Q_OS_WINCE)
extern bool qt_priv_ptr_valid;
#endif
+#endif
#if defined(Q_OS_UNIX)
#include <pwd.h>
+#elif defined(Q_OS_WIN)
+# include <QtCore/qt_windows.h>
#endif
-#endif
-#include "qplatformdialoghelper_qpa.h"
QT_BEGIN_NAMESPACE
@@ -1386,6 +1388,25 @@ QLineEdit *QFileDialogPrivate::lineEdit() const {
return (QLineEdit*)qFileDialogUi->fileNameEdit;
}
+int QFileDialogPrivate::maxNameLength(const QString &path)
+{
+#if defined(Q_OS_UNIX)
+ return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX);
+#elif defined(Q_OS_WINCE)
+ Q_UNUSED(path);
+ return MAX_PATH;
+#elif defined(Q_OS_WIN)
+ DWORD maxLength;
+ const QString drive = path.left(3);
+ if (::GetVolumeInformation(reinterpret_cast<const wchar_t *>(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == FALSE)
+ return -1;
+ return maxLength;
+#else
+ Q_UNUSED(path);
+#endif
+ return -1;
+}
+
/*
Sets the view root index to be the file system model index
*/