Changeset 173 for trunk/src/gui/dialogs/qfilesystemmodel_p.h
- Timestamp:
- Sep 9, 2009, 2:38:34 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/dialogs/qfilesystemmodel_p.h
r2 r173 81 81 82 82 public: 83 84 #if defined(Q_OS_WIN) || defined(Q_OS_OS2) 85 // On Windows and OS/2, file names are case insensitive so use a lowercased 86 // string as a key in the hash map of name->node pairs. Note that strictly 87 // speaking we should use QAbstractFileEngine::caseSensitive() to check if 88 // the case should matter but on these platforms this method in QFSFileEngine 89 // always returns false while doing this check would require to add a 90 // QFileSystemNode* argument to the constructor and hence change almost every 91 // line that uses the hash because the automatic QString->FileNameKey would 92 // not work in this case. Note2: on Windows, evreything actually works without 93 // this class but that's just because we use qt_GetLongPathName() which 94 // always returns a real filename case and any changes in the case are 95 // instantly picked up by QFileSystemWatcher anyway (otherwise we'd get dups 96 // in the file ilst there too). 97 class FileNameKey : public QString 98 { 99 public: 100 FileNameKey(const QString ©) : QString(copy.toLower()) {} 101 }; 102 #else 103 typedef QString FileNameKey; 104 #endif 105 83 106 class QFileSystemNode 84 107 { … … 87 110 : fileName(filename), populatedChildren(false), isVisible(false), parent(p), info(0) {} 88 111 ~QFileSystemNode() { 89 QHash< QString, QFileSystemNode*>::const_iterator i = children.constBegin();112 QHash<FileNameKey, QFileSystemNode*>::const_iterator i = children.constBegin(); 90 113 while (i != children.constEnd()) { 91 114 delete i.value(); … … 162 185 if (info) 163 186 info->icon = iconProvider->icon(QFileInfo(path)); 164 QHash< QString, QFileSystemNode *>::const_iterator iterator;187 QHash<FileNameKey, QFileSystemNode *>::const_iterator iterator; 165 188 for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) { 166 189 iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName); … … 171 194 if (info) 172 195 info->displayType = iconProvider->type(QFileInfo(path)); 173 QHash< QString, QFileSystemNode *>::const_iterator iterator;196 QHash<FileNameKey, QFileSystemNode *>::const_iterator iterator; 174 197 for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) { 175 198 iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName); … … 179 202 bool populatedChildren; 180 203 bool isVisible; 181 QHash< QString,QFileSystemNode *> children;204 QHash<FileNameKey, QFileSystemNode *> children; 182 205 QList<QString> visibleChildren; 183 206 QFileSystemNode *parent;
Note:
See TracChangeset
for help on using the changeset viewer.