diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-17 05:44:14 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-17 05:44:14 (GMT) |
commit | 67d8b96d11b560367f068c2466664898a6fb5aed (patch) | |
tree | b60a7fd15f68d49c530bfa3ca326bdcfe070a9c3 /src/gui/dialogs | |
parent | 53fd1e2fd9c75d7d55606d4ac5df75eda96b9cc9 (diff) | |
parent | da8eb86480e188112193b66a265a7e957efc9de1 (diff) | |
download | Qt-67d8b96d11b560367f068c2466664898a6fb5aed.zip Qt-67d8b96d11b560367f068c2466664898a6fb5aed.tar.gz Qt-67d8b96d11b560367f068c2466664898a6fb5aed.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: (83 commits)
probably need to update user configurations once in a while too
use dynamicstore instead
Define JS_NO_EXPORT to avoid JSC C API functions being exported
Don't use QScriptValueIterator to iterate over an array
QtScript: Fix regression when calling newQObject() from native constructor
Added note to OS X installation instructions.
Keypress events ignored in listview on Cocoa (64 Bit) with Japanese IME
Update only appropriate rectangles during update_sys().
Marked QTDS obsolete from Qt 4.7.
QNetworkReply: Fix canReadLine()
Abort waiting replies on session error.
different approach to fixing "the other" aliasing issue
fix aliasing issue in node_construct()
detach in fewer cases, remove redundant calculation
SSL: Fix memleak related to local certificate
Improve keyboard layout detection on X11
Compile on ARM with -Werror -Wold-style-cast
Use the vista-style native dialog for QFileDialog::getExistingDirectory
Apply the stdset attribute for resource properties
doc: Completed sentence about HideNameFilterDetails
...
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r-- | src/gui/dialogs/qfiledialog.cpp | 3 | ||||
-rw-r--r-- | src/gui/dialogs/qfiledialog_win.cpp | 62 | ||||
-rw-r--r-- | src/gui/dialogs/qfileinfogatherer.cpp | 31 | ||||
-rw-r--r-- | src/gui/dialogs/qfileinfogatherer_p.h | 8 |
4 files changed, 65 insertions, 39 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 089e04a..ef2b223 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -228,7 +228,8 @@ Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook \value ReadOnly Indicates that the model is readonly. - \value HideNameFilterDetails Indicates if the is hidden or not. + \value HideNameFilterDetails Indicates if the file name filter details are + hidden or not. \value DontUseSheet In previous versions of Qt, the static functions would create a sheet by default if the static function diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp index 3120938..afeed8e 100644 --- a/src/gui/dialogs/qfiledialog_win.cpp +++ b/src/gui/dialogs/qfiledialog_win.cpp @@ -583,6 +583,63 @@ static QStringList qt_win_CID_get_open_file_names(const QFileDialogArgs &args, return result; } +QString qt_win_CID_get_existing_directory(const QFileDialogArgs &args) +{ + QString result; + QDialog modal_widget; + modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); + modal_widget.setParent(args.parent, Qt::Window); + QApplicationPrivate::enterModal(&modal_widget); + + IFileOpenDialog *pfd = 0; + HRESULT hr = CoCreateInstance(QT_CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, + QT_IID_IFileOpenDialog, reinterpret_cast<void**>(&pfd)); + + if (SUCCEEDED(hr)) { + qt_win_set_IFileDialogOptions(pfd, args.selection, + args.directory, args.caption, + QStringList(), QFileDialog::ExistingFiles, + args.options); + + // Set the FOS_PICKFOLDERS flag + DWORD newOptions; + hr = pfd->GetOptions(&newOptions); + newOptions |= FOS_PICKFOLDERS; + if (SUCCEEDED(hr) && SUCCEEDED((hr = pfd->SetOptions(newOptions)))) { + QWidget *parentWindow = args.parent; + if (parentWindow) + parentWindow = parentWindow->window(); + else + parentWindow = QApplication::activeWindow(); + + // Show the file dialog. + hr = pfd->Show(parentWindow ? parentWindow->winId() : 0); + if (SUCCEEDED(hr)) { + // Retrieve the result + IShellItem *psi = 0; + hr = pfd->GetResult(&psi); + if (SUCCEEDED(hr)) { + // Retrieve the file name from shell item. + wchar_t *pszPath; + hr = psi->GetDisplayName(SIGDN_FILESYSPATH, &pszPath); + if (SUCCEEDED(hr)) { + result = QString::fromWCharArray(pszPath); + CoTaskMemFree(pszPath); + } + psi->Release(); // Free the current item. + } + } + } + } + QApplicationPrivate::leaveModal(&modal_widget); + + qt_win_eatMouseMove(); + + if (pfd) + pfd->Release(); + return result; +} + #endif QStringList qt_win_get_open_file_names(const QFileDialogArgs &args, @@ -701,6 +758,11 @@ static int __stdcall winGetExistDirCallbackProc(HWND hwnd, QString qt_win_get_existing_directory(const QFileDialogArgs &args) { +#ifndef Q_WS_WINCE + if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) + return qt_win_CID_get_existing_directory(args); +#endif + QString currentDir = QDir::currentPath(); QString result; QWidget *parent = args.parent; 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; |