OSDN Git Service

get rid of QDir::drives() and QFSFileEngine::drives()
authorIvailo Monev <xakepa10@laimg.moc>
Tue, 1 Nov 2016 14:36:33 +0000 (14:36 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Tue, 1 Nov 2016 14:36:33 +0000 (14:36 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/core/io/qdir.cpp
src/core/io/qdir.h
src/core/io/qfsfileengine.cpp
src/core/io/qfsfileengine.h
src/core/io/qfsfileengine_unix.cpp
src/gui/dialogs/qfileinfogatherer.cpp
src/gui/dialogs/qfileinfogatherer_p.h
src/gui/itemviews/qdirmodel.cpp

index df30e5e..a359a7c 100644 (file)
@@ -450,12 +450,6 @@ inline void QDirPrivate::initFileEngine()
     If you want to find the directory containing the application's executable,
     see \l{QCoreApplication::applicationDirPath()}.
 
-    The drives() static function provides a list of root directories for each
-    device that contains a filing system. On Unix systems this returns a list
-    containing a single root directory "/"; on Windows the list will usually
-    contain \c{C:/}, and possibly other drive letters such as \c{D:/}, depending
-    on the configuration of the user's system.
-
     \section1 Path Manipulation and Strings
 
     Paths containing "." elements that reference the current directory at that
@@ -1622,24 +1616,6 @@ bool QDir::exists(const QString &name) const
 }
 
 /*!
-    Returns a list of the root directories on this system.
-
-    On Windows this returns a list of QFileInfo objects containing "C:/",
-    "D:/", etc. On other operating systems, it returns a list containing
-    just one root directory (i.e. "/").
-
-    \sa root(), rootPath()
-*/
-QFileInfoList QDir::drives()
-{
-#ifdef QT_NO_FSFILEENGINE
-    return QFileInfoList();
-#else
-    return QFSFileEngine::drives();
-#endif
-}
-
-/*!
     \fn QChar QDir::separator()
     Returns the native directory separator: "/" under Unix (including
     Mac OS X) and "\\" under Windows.
@@ -1703,7 +1679,7 @@ QString QDir::currentPath()
 
     See homePath() for details.
 
-    \sa drives(), current(), root(), temp()
+    \sa current(), root(), temp()
 */
 
 /*!
@@ -1765,7 +1741,7 @@ QString QDir::homePath()
 
     See tempPath() for details.
 
-    \sa drives(), current(), home(), root()
+    \sa current(), home(), root()
 */
 
 /*!
@@ -1794,7 +1770,7 @@ QString QDir::tempPath()
 
     See rootPath() for details.
 
-    \sa drives(), current(), home(), temp()
+    \sa current(), home(), temp()
 */
 
 /*!
@@ -1803,7 +1779,7 @@ QString QDir::tempPath()
     For Unix operating systems this returns "/". For Windows and Symbian file
     systems this normally returns "c:/". I.E. the root of the system drive.
 
-    \sa root(), drives(), currentPath(), homePath(), tempPath()
+    \sa root(), currentPath(), homePath(), tempPath()
 */
 QString QDir::rootPath()
 {
index 702b504..d136002 100644 (file)
@@ -182,8 +182,6 @@ public:
     bool rename(const QString &oldName, const QString &newName);
     bool exists(const QString &name) const;
 
-    static QFileInfoList drives();
-
     static bool setCurrent(const QString &path);
     static inline QDir current() { return QDir(currentPath()); }
     static QString currentPath();
index f0dc81f..36c4f7c 100644 (file)
@@ -809,15 +809,6 @@ bool QFSFileEngine::supportsExtension(Extension extension) const
   \sa setCurrentPath()
 */
 
-/*! \fn QFileInfoList QFSFileEngine::drives()
-  For Windows, returns the list of drives in the file system as a list
-  of QFileInfo objects. On unix, Mac OS X and Windows CE, only the
-  root path is returned.  On Windows, this function returns all drives
-  (A:\, C:\, D:\, etc.).
-
-  For Unix, the list contains just the root path "/".
-*/
-
 /*! \fn QString QFSFileEngine::fileName(FileName file) const
   \reimp
 */
index 16afea7..5c8834f 100644 (file)
@@ -109,7 +109,6 @@ public:
     static QString homePath();
     static QString rootPath();
     static QString tempPath();
-    static QFileInfoList drives();
 
 protected:
     QFSFileEngine(QFSFileEnginePrivate &dd);
index 94788b6..ed9ea8d 100644 (file)
@@ -458,13 +458,6 @@ QString QFSFileEngine::tempPath()
     return QFileSystemEngine::tempPath();
 }
 
-QFileInfoList QFSFileEngine::drives()
-{
-    QFileInfoList ret;
-    ret.append(QFileInfo(rootPath()));
-    return ret;
-}
-
 bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) const
 {
     if (!tried_stat || !metaData.hasFlags(flags)) {
index 5cbfc99..83bef43 100644 (file)
@@ -229,11 +229,6 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const
     return info;
 }
 
-QString QFileInfoGatherer::translateDriveName(const QFileInfo &drive) const
-{
-    return drive.absoluteFilePath();
-}
-
 /*
     Get specific file info's, batch the files so update when we have 100
     items and every 200ms after that
@@ -256,15 +251,15 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
 #endif
         QFileInfoList infoList;
         if (files.isEmpty()) {
-            infoList = QDir::drives();
+            infoList << QFieInfo(QDir::rootPath());
         } else {
             for (int i = 0; i < files.count(); ++i)
                 infoList << QFileInfo(files.at(i));
         }
         for (int i = infoList.count() - 1; i >= 0; --i) {
-            QString driveName = translateDriveName(infoList.at(i));
+            QString driveName = infoList.at(i);
             QList<QPair<QString,QFileInfo> > updatedFiles;
-            updatedFiles.append(QPair<QString,QFileInfo>(driveName, infoList.at(i)));
+            updatedFiles.append(QPair<QString,QFileInfo>(driveName.absoluteFilePath(), infoList.at(i)));
             emit updates(path, updatedFiles);
         }
         return;
index 7193bcc..490cd4f 100644 (file)
@@ -177,7 +177,6 @@ protected:
 
 private:
     void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path);
-    QString translateDriveName(const QFileInfo &drive) const;
 
     QMutex mutex;
     QWaitCondition condition;
index e667396..822829e 100644 (file)
@@ -230,7 +230,7 @@ QDirModel::QDirModel(const QStringList &nameFilters,
     : QAbstractItemModel(*new QDirModelPrivate, parent)
 {
     Q_D(QDirModel);
-    // we always start with QDir::drives()
+    // we always start with QDir::rootPath()
     d->nameFilters = nameFilters.isEmpty() ? QStringList(QLatin1String("*")) : nameFilters;
     d->filters = filters;
     d->sort = sort;
@@ -1140,7 +1140,7 @@ QVector<QDirModelPrivate::QDirNode> QDirModelPrivate::children(QDirNode *parent,
     QFileInfoList infoList;
     if (parent == &root) {
         parent = 0;
-        infoList = QDir::drives();
+        infoList << QFileInfo(QDir::rootPath());
     } else if (parent->info.isDir()) {
         //resolve directory links only if requested.
         if (parent->info.isSymLink() && resolveSymlinks) {