Changeset 651 for trunk/src/gui/dialogs/qfiledialog.cpp
- Timestamp:
- Mar 8, 2010, 12:52:58 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.2 (added) merged: 650 /branches/vendor/nokia/qt/current merged: 649 /branches/vendor/nokia/qt/4.6.1 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/dialogs/qfiledialog.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 670 670 if (changed & HideNameFilterDetails) 671 671 setNameFilters(d->nameFilters); 672 673 if (changed & ShowDirsOnly) 674 setFilter((options & ShowDirsOnly) ? filter() & ~QDir::Files : filter() | QDir::Files); 672 675 } 673 676 … … 996 999 997 1000 1001 /* 1002 Strip the filters by removing the details, e.g. (*.*). 1003 */ 1004 QStringList qt_strip_filters(const QStringList &filters) 1005 { 1006 QStringList strippedFilters; 1007 QRegExp r(QString::fromLatin1(qt_file_dialog_filter_reg_exp)); 1008 for (int i = 0; i < filters.count(); ++i) { 1009 QString filterName; 1010 int index = r.indexIn(filters[i]); 1011 if (index >= 0) 1012 filterName = r.cap(1); 1013 strippedFilters.append(filterName.simplified()); 1014 } 1015 return strippedFilters; 1016 } 1017 1018 998 1019 /*! 999 1020 \since 4.4 … … 1022 1043 return; 1023 1044 1024 if (testOption(HideNameFilterDetails)) { 1025 QStringList strippedFilters; 1026 QRegExp r(QString::fromLatin1(qt_file_dialog_filter_reg_exp)); 1027 for (int i = 0; i < cleanedFilters.count(); ++i) { 1028 QString filterName; 1029 int index = r.indexIn(cleanedFilters[i]); 1030 if (index >= 0) 1031 filterName = r.cap(1); 1032 strippedFilters.append(filterName.simplified()); 1033 } 1034 d->qFileDialogUi->fileTypeCombo->addItems(strippedFilters); 1035 } else { 1045 if (testOption(HideNameFilterDetails)) 1046 d->qFileDialogUi->fileTypeCombo->addItems(qt_strip_filters(cleanedFilters)); 1047 else 1036 1048 d->qFileDialogUi->fileTypeCombo->addItems(cleanedFilters); 1037 } 1049 1038 1050 d->_q_useNameFilter(0); 1039 1051 } … … 1086 1098 return; 1087 1099 } 1088 1089 int i = d->qFileDialogUi->fileTypeCombo->findText(filter); 1100 int i; 1101 if (testOption(HideNameFilterDetails)) { 1102 i = d->qFileDialogUi->fileTypeCombo->findText(qt_strip_filters(qt_make_filter_list(filter)).first()); 1103 } else { 1104 i = d->qFileDialogUi->fileTypeCombo->findText(filter); 1105 } 1090 1106 if (i >= 0) { 1091 1107 d->qFileDialogUi->fileTypeCombo->setCurrentIndex(i); … … 1207 1223 { 1208 1224 Q_D(QFileDialog); 1209 if (d->nativeDialogInUse){1210 d->model->setFilter(d->filterForMode(filter()));1211 d->setFilter_sys();1212 return;1213 }1214 1215 1225 d->fileMode = mode; 1216 1226 d->retranslateWindowTitle(); … … 1248 1258 } 1249 1259 setLabelText(Accept, buttonText); 1260 if (d->nativeDialogInUse){ 1261 d->setFilter_sys(); 1262 return; 1263 } 1264 1250 1265 d->qFileDialogUi->fileTypeCombo->setEnabled(!testOption(ShowDirsOnly)); 1251 1266 d->_q_updateOkButton(); … … 1285 1300 } 1286 1301 d->retranslateWindowTitle(); 1302 #if defined(Q_WS_MAC) 1303 d->deleteNativeDialog_sys(); 1304 setAttribute(Qt::WA_DontShowOnScreen, false); 1305 #endif 1287 1306 } 1288 1307 … … 3230 3249 QString path = index.data(QFileSystemModel::FilePathRole).toString(); 3231 3250 if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) { 3251 #if defined(Q_OS_UNIX) || defined(Q_OS_WINCE) 3252 if (currentLocation == QDir::separator()) 3253 return path.mid(currentLocation.length()); 3254 #endif 3232 3255 return path.mid(currentLocation.length() + 1); 3233 3256 } … … 3285 3308 dirModel = sourceModel; 3286 3309 QString currentLocation = QDir::toNativeSeparators(dirModel->rootPath()); 3310 #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) 3311 if (currentLocation.endsWith(QLatin1Char(':'))) 3312 currentLocation.append(sep); 3313 #endif 3287 3314 if (currentLocation.contains(sep) && path != currentLocation) { 3288 3315 QStringList currentLocationList = splitPath(currentLocation);
Note:
See TracChangeset
for help on using the changeset viewer.