Changeset 626 for trunk/src/corelib
- Timestamp:
- Mar 3, 2010, 11:18:36 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/io/qfilesystemwatcher.cpp
r616 r626 71 71 QT_BEGIN_NAMESPACE 72 72 73 #if defined(Q_OS_OS2)74 # define DRIVES_ROOT QString::null75 #endif76 77 73 class QPollingFileSystemWatcherEngine : public QFileSystemWatcherEngine 78 74 { … … 119 115 mutable QMutex mutex; 120 116 QHash<QString, FileInfo> files, directories; 121 #if defined(Q_OS_OS2)122 QFileInfoList drives;123 #endif124 117 125 118 public: … … 171 164 QHash<QString, FileInfo>::iterator x = dit.next(); 172 165 QString path = x.key(); 173 #if defined(Q_OS_OS2) 174 if (path.isEmpty()) { 175 // check if we got new/changed drives 176 QFileInfoList newDrives = QDir::drives(); 177 if (drives != QDir::drives()) { 178 drives = newDrives; 179 emit directoryChanged(QString::null, false); 180 } 181 } else 182 #endif 183 { 184 QFileInfo fi(path); 185 if (!path.endsWith(QLatin1Char('/'))) 186 fi = QFileInfo(path + QLatin1Char('/')); 187 if (!fi.exists()) { 188 dit.remove(); 189 emit directoryChanged(path, true); 190 } else if (x.value() != fi) { 191 x.value() = fi; 192 emit directoryChanged(path, false); 193 } 166 QFileInfo fi(path); 167 if (!path.endsWith(QLatin1Char('/'))) 168 fi = QFileInfo(path + QLatin1Char('/')); 169 if (!fi.exists()) { 170 dit.remove(); 171 emit directoryChanged(path, true); 172 } else if (x.value() != fi) { 173 x.value() = fi; 174 emit directoryChanged(path, false); 194 175 } 195 176 yieldCurrentThread(); … … 216 197 while (it.hasNext()) { 217 198 QString path = it.next(); 218 #if defined(Q_OS_OS2) 219 if (path.isEmpty()) { 220 // asked to watch for drives 221 if (!directories->contains(DRIVES_ROOT)) 222 directories->append(DRIVES_ROOT); 223 this->directories.insert(DRIVES_ROOT, QFileInfo()); 199 QFileInfo fi(path); 200 if (!fi.exists()) 201 continue; 202 if (fi.isDir()) { 203 if (!directories->contains(path)) 204 directories->append(path); 205 if (!path.endsWith(QLatin1Char('/'))) 206 fi = QFileInfo(path + QLatin1Char('/')); 207 this->directories.insert(path, fi); 224 208 startOver = true; 225 } else 226 #endif 227 { 228 QFileInfo fi(path); 229 if (!fi.exists()) 230 continue; 231 if (fi.isDir()) { 232 if (!directories->contains(path)) 233 directories->append(path); 234 if (!path.endsWith(QLatin1Char('/'))) 235 fi = QFileInfo(path + QLatin1Char('/')); 236 this->directories.insert(path, fi); 237 startOver = true; 238 } else { 239 if (!files->contains(path)) 240 files->append(path); 241 this->files.insert(path, fi); 242 startOver = true; 243 } 209 } else { 210 if (!files->contains(path)) 211 files->append(path); 212 this->files.insert(path, fi); 213 startOver = true; 244 214 } 245 215 it.remove(); … … 258 228 while (it.hasNext()) { 259 229 QString path = it.next(); 260 #if defined(Q_OS_OS2)261 if (path.isEmpty()) {262 // asked to stop watching for drives263 if (this->directories.remove(DRIVES_ROOT)) {264 directories->removeAll(DRIVES_ROOT);265 it.remove();266 startOver = true;267 }268 } else269 #endif270 230 if (this->directories.remove(path)) { 271 231 directories->removeAll(path); … … 533 493 void QFileSystemWatcher::addPath(const QString &path) 534 494 { 535 #if !defined(Q_OS_OS2)536 495 if (path.isEmpty()) { 537 496 qWarning("QFileSystemWatcher::addPath: path is empty"); 538 497 return; 539 498 } 540 #endif541 499 addPaths(QStringList(path)); 542 500 }
Note:
See TracChangeset
for help on using the changeset viewer.