Changeset 561 for trunk/src/gui/itemviews/qdirmodel.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/itemviews/qdirmodel.cpp
r376 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 45 45 #include <qstack.h> 46 46 #include <qfile.h> 47 #include <qfilesystemmodel.h> 47 48 #include <qurl.h> 48 49 #include <qmime.h> … … 190 191 \ingroup model-view 191 192 193 \note The usage of QDirModel is not recommended anymore. The 194 QFileSystemModel class is a more performant alternative. 195 192 196 This class provides access to the local filesystem, providing functions 193 197 for renaming and removing files and directories, and for creating new … … 228 232 \note QDirModel requires an instance of a GUI application. 229 233 230 \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, 234 \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel, 231 235 {Dir View Example}, {Model Classes} 232 236 */ … … 869 873 870 874 QString absolutePath = QDir(path).absolutePath(); 875 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) || defined(Q_OS_OS2) 876 absolutePath = absolutePath.toLower(); 877 #endif 871 878 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_OS2) 872 absolutePath = absolutePath.toLower();873 879 // On Windows, "filename......." and "filename" are equivalent 874 880 if (absolutePath.endsWith(QLatin1Char('.'))) { … … 910 916 if (childAppended) 911 917 emit const_cast<QDirModel*>(this)->layoutChanged(); 912 } else if (pathElements.at(0).endsWith(QLatin1Char(':'))) { 918 } else 919 #endif 920 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) || defined(Q_OS_OS2) 921 if (pathElements.at(0).endsWith(QLatin1Char(':'))) { 913 922 pathElements[0] += QLatin1Char('/'); 914 923 } … … 932 941 const QFileInfo& fi = parent->children.at(j).info; 933 942 QString childFileName; 934 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_OS2)935 943 childFileName = idx.isValid() ? fi.fileName() : fi.absoluteFilePath(); 944 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) || defined(Q_OS_OS2) 936 945 childFileName = childFileName.toLower(); 937 #else938 childFileName = idx.isValid() ? fi.fileName() : fi.absoluteFilePath();939 946 #endif 940 947 if (childFileName == element) { … … 953 960 newPath = parent->info.absoluteFilePath() + element; 954 961 else 955 newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element;962 newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; 956 963 #else 957 964 QString newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; … … 1305 1312 if (name.startsWith(QLatin1Char('/'))) // UNC host 1306 1313 return info.fileName(); 1314 #endif 1315 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) || defined(Q_OS_OS2) 1307 1316 if (name.endsWith(QLatin1Char('/'))) 1308 1317 name.chop(1); … … 1336 1345 quint64 bytes = n->info.size(); 1337 1346 if (bytes >= tb) 1338 return Q Locale().toString(bytes / tb) + QString::fromLatin1(" TB");1347 return QFileSystemModel::tr("%1 TB").arg(QLocale().toString(qreal(bytes) / tb, 'f', 3)); 1339 1348 if (bytes >= gb) 1340 return Q Locale().toString(bytes / gb) + QString::fromLatin1(" GB");1349 return QFileSystemModel::tr("%1 GB").arg(QLocale().toString(qreal(bytes) / gb, 'f', 2)); 1341 1350 if (bytes >= mb) 1342 return Q Locale().toString(bytes / mb) + QString::fromLatin1(" MB");1351 return QFileSystemModel::tr("%1 MB").arg(QLocale().toString(qreal(bytes) / mb, 'f', 1)); 1343 1352 if (bytes >= kb) 1344 return Q Locale().toString(bytes / kb) + QString::fromLatin1(" KB");1345 return Q Locale().toString(bytes) + QString::fromLatin1(" bytes");1353 return QFileSystemModel::tr("%1 KB").arg(QLocale().toString(bytes / kb)); 1354 return QFileSystemModel::tr("%1 byte(s)").arg(QLocale().toString(bytes)); 1346 1355 } 1347 1356
Note:
See TracChangeset
for help on using the changeset viewer.