diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-01-08 10:53:28 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-01-08 10:53:28 (GMT) |
commit | 2e62227f950aac8205f2b67e4d7d046836b2c799 (patch) | |
tree | 87e91115d86896949f69e8c8d993ba795422ef3b /src/gui/dialogs | |
parent | 9b0502aa6abf6bb9c07f205bccdf2d9c65027bde (diff) | |
parent | 118e7a807d0764dee97612589fe5d7072d271e1e (diff) | |
download | Qt-2e62227f950aac8205f2b67e4d7d046836b2c799.zip Qt-2e62227f950aac8205f2b67e4d7d046836b2c799.tar.gz Qt-2e62227f950aac8205f2b67e4d7d046836b2c799.tar.bz2 |
Merge branch '4.6'
Conflicts:
src/corelib/io/qfsfileengine.cpp
src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
src/opengl/opengl.pro
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r-- | src/gui/dialogs/qcolordialog_mac.mm | 1 | ||||
-rw-r--r-- | src/gui/dialogs/qfiledialog.cpp | 46 | ||||
-rw-r--r-- | src/gui/dialogs/qfilesystemmodel.cpp | 5 | ||||
-rw-r--r-- | src/gui/dialogs/qfilesystemmodel_p.h | 16 |
4 files changed, 42 insertions, 26 deletions
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm index 5753954..a350be1 100644 --- a/src/gui/dialogs/qcolordialog_mac.mm +++ b/src/gui/dialogs/qcolordialog_mac.mm @@ -347,6 +347,7 @@ QT_USE_NAMESPACE } } + QAbstractEventDispatcher::instance()->interrupt(); if (mResultCode == NSCancelButton) mPriv->colorDialog()->reject(); else diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 45a410f..3c388de 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -669,6 +669,9 @@ void QFileDialog::setOptions(Options options) } if (changed & HideNameFilterDetails) setNameFilters(d->nameFilters); + + if (changed & ShowDirsOnly) + setFilter((options & ShowDirsOnly) ? filter() & ~QDir::Files : filter() | QDir::Files); } QFileDialog::Options QFileDialog::options() const @@ -995,6 +998,24 @@ bool QFileDialog::isNameFilterDetailsVisible() const } +/* + Strip the filters by removing the details, e.g. (*.*). +*/ +QStringList qt_strip_filters(const QStringList &filters) +{ + QStringList strippedFilters; + QRegExp r(QString::fromLatin1(qt_file_dialog_filter_reg_exp)); + for (int i = 0; i < filters.count(); ++i) { + QString filterName; + int index = r.indexIn(filters[i]); + if (index >= 0) + filterName = r.cap(1); + strippedFilters.append(filterName.simplified()); + } + return strippedFilters; +} + + /*! \since 4.4 @@ -1021,20 +1042,11 @@ void QFileDialog::setNameFilters(const QStringList &filters) if (cleanedFilters.isEmpty()) return; - if (testOption(HideNameFilterDetails)) { - QStringList strippedFilters; - QRegExp r(QString::fromLatin1(qt_file_dialog_filter_reg_exp)); - for (int i = 0; i < cleanedFilters.count(); ++i) { - QString filterName; - int index = r.indexIn(cleanedFilters[i]); - if (index >= 0) - filterName = r.cap(1); - strippedFilters.append(filterName.simplified()); - } - d->qFileDialogUi->fileTypeCombo->addItems(strippedFilters); - } else { + if (testOption(HideNameFilterDetails)) + d->qFileDialogUi->fileTypeCombo->addItems(qt_strip_filters(cleanedFilters)); + else d->qFileDialogUi->fileTypeCombo->addItems(cleanedFilters); - } + d->_q_useNameFilter(0); } @@ -1085,8 +1097,12 @@ void QFileDialog::selectNameFilter(const QString &filter) d->selectNameFilter_sys(filter); return; } - - int i = d->qFileDialogUi->fileTypeCombo->findText(filter); + int i; + if (testOption(HideNameFilterDetails)) { + i = d->qFileDialogUi->fileTypeCombo->findText(qt_strip_filters(qt_make_filter_list(filter)).first()); + } else { + i = d->qFileDialogUi->fileTypeCombo->findText(filter); + } if (i >= 0) { d->qFileDialogUi->fileTypeCombo->setCurrentIndex(i); d->_q_useNameFilter(d->qFileDialogUi->fileTypeCombo->currentIndex()); diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 8e78503..6ec80a9 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -1223,8 +1223,7 @@ bool QFileSystemModel::dropMimeData(const QMimeData *data, Qt::DropAction action case Qt::MoveAction: for (; it != urls.constEnd(); ++it) { QString path = (*it).toLocalFile(); - success = QFile::copy(path, to + QFileInfo(path).fileName()) - && QFile::remove(path) && success; + success = QFile::rename(path, to + QFileInfo(path).fileName()) && success; } break; default: @@ -1779,7 +1778,7 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QL node->fileName = fileName; } - if (info.size() == -1) { + if (info.size() == -1 && !info.isSymLink()) { removeNode(parentNode, fileName); continue; } diff --git a/src/gui/dialogs/qfilesystemmodel_p.h b/src/gui/dialogs/qfilesystemmodel_p.h index 175159f..68e19dc 100644 --- a/src/gui/dialogs/qfilesystemmodel_p.h +++ b/src/gui/dialogs/qfilesystemmodel_p.h @@ -238,15 +238,15 @@ public: void sortChildren(int column, const QModelIndex &parent); inline int translateVisibleLocation(QFileSystemNode *parent, int row) const { - if (sortOrder == Qt::AscendingOrder) - return row; - if (parent->dirtyChildrenIndex == -1 || row < parent->dirtyChildrenIndex) - if (parent->dirtyChildrenIndex != -1) - return parent->dirtyChildrenIndex - row - 1; - else + if (sortOrder != Qt::AscendingOrder) { + if (parent->dirtyChildrenIndex == -1) return parent->visibleChildren.count() - row - 1; - else - return row; + + if (row < parent->dirtyChildrenIndex) + return parent->dirtyChildrenIndex - row - 1; + } + + return row; } inline static QString myComputer() { |