summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qfilesystemmodel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-12-181-12/+12
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/painting.pri src/plugins/platforms/xcb/qxcbconnection.cpp tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro tests/auto/corelib/tools/qlocale/test/test.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp tools/configure/environment.cpp Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
| * QFileSystemModel: report special files which are not symlinksGiuseppe D'Angelo2015-12-131-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since special files have file size == -1, they were always filtered out by QFileSystemModel, even when passing QDir::System as filtering option. Keep them instead. The testcase is more convoluted than it should be because QFSM is so broken that it returns valid indexes for invisible elements in the model (such as filtered out elements). Change-Id: I023a9813dbfeed7be99dded42c66b1191afdc17e Task-number: QTBUG-20968 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * QFileSystemModel: do not unwatch directories if removal failsGiuseppe D'Angelo2015-12-101-8/+12
| | | | | | | | | | | | | | | | | | ... otherwise we would not detect subsequent file/directories added into the non-removed one. Change-Id: I43018dfb9a9c6c0399190800da3f0d572ec5d8d8 Task-number: QTBUG-49307 Reviewed-by: David Faure <david.faure@kdab.com>
* | QtWidgets: replace some index-based for loops with C++11 range-forMarc Mutz2015-12-161-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This needs to be handled a bit carefully, because Qt containers will detach upon being iteratoed over using range-for. In the cases of this patch, that cannot happen, because all containers are marked as const (either by this patch or before). Separate patches will deal with other situations. Apart from being more readable, range-for loops are also the most efficient for loop. This patch shaves almost 2K of text size off an optimized Linux AMD64 GCC 4.9 build. Change-Id: I53810c7b25420b4fd449d20c90c07503c5e76a66 Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-12-021-90/+22
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qcoreapplication.cpp src/corelib/kernel/qeventdispatcher_blackberry.cpp src/network/bearer/qnetworkconfiguration.cpp src/plugins/bearer/blackberry/qbbengine.cpp src/plugins/platforms/android/androidjnimain.cpp src/plugins/platforms/android/qandroidplatformtheme.cpp src/plugins/platforms/qnx/qqnxbpseventfilter.cpp src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp src/plugins/platforms/qnx/qqnxintegration.cpp src/plugins/platforms/qnx/qqnxnavigatorbps.cpp src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp src/plugins/platforms/qnx/qqnxwindow.cpp src/widgets/kernel/qwidgetwindow.cpp src/widgets/styles/qwindowsvistastyle.cpp src/widgets/styles/qwindowsxpstyle.cpp src/widgets/widgets/qtoolbararealayout.cpp tests/auto/corelib/global/qflags/qflags.pro tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp tests/auto/corelib/tools/qversionnumber/qversionnumber.pro tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp Change-Id: I37be88c6c185bb85404823353e027a0a6acdbce4
| * Don't use QList<QPair>Lars Knoll2015-11-301-5/+5
| | | | | | | | | | | | | | Change it to use a QVector instead. Change-Id: Ie1749f326ba1165db48c0eb8763eb738672c7afd Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * Use natural comparison also for the file typesLars Knoll2015-11-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | If we want to sort according to file types, we're also sorting user visible strings. For that we can also use the natural comparison collator, as file types should be case insensitive, and won't contain numbers. And even if they do a natual sorting will make it easier for the end user to find what they are looking for. Change-Id: Ie1d7d0af041a08be0f0d1a4eeb2eae9be885ffc7 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * Use QCollator for sorting in the filesystem modelLars Knoll2015-11-301-84/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | The old code was extremely inefficient, and QCollator can provide the same functionality in a much better and faster way. Task-number: QTBUG-30902 Change-Id: Iaf5dbe587d9a6ebca26885259fdee74a29d3c84f Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| * De-inline QFileSystemModel::fileInfo() and implement it efficientlyLars Knoll2015-11-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | De-inline the method, and return the file info that's already being cached by the model. This is ok to do in a minor release, as apps compiled against an older version of Qt will simply continue to use the less efficient implementation. Change-Id: I164c7961a8cf97447638af316512326442767dd8 Task-number: QTBUG-30902 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-11-041-1/+1
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/ptrsize.test configure src/corelib/global/qnamespace.h src/network/socket/qabstractsocket.cpp tests/auto/other/networkselftest/networkselftest.pro Change-Id: Ic78abb4a34f9068567cea876861d4220f5a07672
| * QtWidgets: use printf-style qWarning/qDebug where possible (I)Marc Mutz2015-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "..."; with qWarning("..."); Change-Id: I1f6869b024103c98262f1deae014e0d7337a541c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-231-37/+16
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf configure src/corelib/global/qglobal.h src/tools/qdoc/node.cpp src/tools/qdoc/qdocdatabase.cpp tests/auto/corelib/io/qsettings/tst_qsettings.cpp tools/configure/configureapp.cpp Change-Id: I66028ae5e441a06b73ee85ba72a03a3af3e8593f
| * QFileSystemModel: cleanup sortChildren()Maks Naumov2015-10-201-10/+10
| | | | | | | | | | | | | | | | Second value of QPair is not used. And add reserve for "indexNode->visibleChildren" list before pushing. Change-Id: Ia002130c929f71e0802f73f4c0694fd2887b4c91 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * QFileSystemModelPrivate::name(): avoid the double-lookupMaks Naumov2015-10-201-2/+1
| | | | | | | | | | Change-Id: I67507248220fbbddc67ab60ecb1933e1fbacf5fd Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * QFileSystemModel: avoid detachingMaks Naumov2015-10-191-6/+6
| | | | | | | | | | Change-Id: If7e9f11e5514b2f8975e7f83c56b606e67f5952f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * QFileSystemModel: remove unused functorMaks Naumov2015-10-171-20/+0
| | | | | | | | | | Change-Id: I5809ebdfcd973336cf42735a1275b57f12e1823c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-141-1/+1
|\| | | | | | | | | | | | | | | | | Conflicts: tests/auto/corelib/io/qfile/tst_qfile.cpp tests/auto/corelib/io/qprocess/tst_qprocess.cpp tests/auto/corelib/tools/qversionnumber/qversionnumber.pro Change-Id: Ia93ce500349d96a2fbf0b4a37b73f088cc505c6e
| * Libraries: Fix single-character string literals.Friedemann Kleint2015-10-131-1/+1
| | | | | | | | | | | | | | Use character literals where applicable. Change-Id: I8e198774c2247c1cc1d852a41b59b301199b7878 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QFileSystemModel: reimplement sibling for same-rowMarc Mutz2015-09-131-0/+15
|/ | | | | | | | | | | | | Since QFSM, like most models, uses QModelIndex::internalPointer() as an indicator of the row, getting a sibling in the same row is as easy as copying the internalPointer() of the incoming index and just creating a new index with the column adjusted. For rows, the situation is quite a bit more complicated, so we currently continue to call the generic implementation. Change-Id: I36921e3f9c01c458a75aa439018f21c4c657e1cf Reviewed-by: David Faure <david.faure@kdab.com>
* QFileSystemModel: reserve() a QListMarc Mutz2015-07-191-1/+3
| | | | | | Change-Id: I136c24382a869ef92446dbe79bfd6a64273e55c6 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* QFileSystemModel: avoid sibling() callsMarc Mutz2015-07-181-9/+4
| | | | | | | | | | | | | | | | ...by allowing to pass the column to the Private::index() overloads. Because Private::index() always returns an index in column 0, callers that needed a different column used QModelIndex::sibling() to adjust the column of the returned index. But that calls QAIM::sibling(), which calls both QFSM::index() and ::parent(). Simply allowing to pass the column number instead of hard-coding 0 avoids that heavy detour. Change-Id: I8895b3d102d576ba291333cf61075b7263f96b9d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: David Faure <david.faure@kdab.com>
* QFileSystemModel: add a symbolic constant for the number of columnsMarc Mutz2015-07-161-1/+1
| | | | | | | | There are other literal 4's used in the implementation, so disambiguate. Change-Id: I5b0e4ac0018f9d5734e3de8b4f75259e175b23d3 Reviewed-by: David Faure <david.faure@kdab.com>
* widgets: Use QList::reserve(), reduces reallocations.Sérgio Martins2015-06-231-6/+12
| | | | | Change-Id: I49cc03f365c77f142f62c8e77505ec09723a44d9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* WinRT/Winphone: Fix warnings in qtbaseOliver Wolff2015-05-181-1/+3
| | | | | | Change-Id: I41725bcfeee0124b259e96f1e3a261e30f14350a Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
* QFileSystemModel: remove useless checkGiuseppe D'Angelo2015-05-151-1/+1
| | | | | | | The NULL check is on the line before, no point of repeating it again. Change-Id: Id6fa9ffc4dcc00819882f2d3157e9dbdb0e1db78 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Doc: Fix method names for QFileSystemModelAlexander Volkov2014-10-281-1/+1
| | | | | | | | | There are no methods called name() and path(), replace them by fileName() and filePath(). Task-number: QTBUG-41881 Change-Id: I001a8ead197327fac69e69d94230587ddb1a4692 Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
* Fix MSVC2013-compiler warnings with QT_NO_FILESYSTEMWATCHERJochen Seemann2014-09-251-4/+11
| | | | | | | | | dialogs\qfilesystemmodel.cpp(203,1667,1680): C4189: 'd': local variable is initialized but not referenced dialogs\qfilesystemmodel.cpp(1547,1720,1847): C4100: 'variable': unreferenced formal parameter Change-Id: Ic3cef264dcd0b939748bec914eb9c29f86f6ed0e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Doc: Replace obsolete types with their newer counterpartsSze Howe Koh2014-02-251-1/+1
| | | | | | | | | This patch ignores: - Docs for obsolete types themselves - Comparisons between new and obsolete types Change-Id: Id9b1e628255113e7c44520abe0f8a4e0db4a283d Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Strip any trailing spaces from the filename before trying to open itAndy Shaw2014-02-211-2/+11
| | | | | | | | | | | | | | | On Windows, trailing spaces in a filename are silently ignored, so we need to strip it before trying to open a file with it. Otherwise it ends up being stripped later and in a case like " ." it will end up causing Qt to think that a folder exists when it does not. [ChangeLog][Platform Specific Changes][Windows][QtWidgets][QFileDialog] Handled the case of having trailing spaces in a filename correctly so if the filename ends up being empty that the parent path is used instead. Change-Id: I6500cc3a44746bf4a65e73bcfb63265a0a97c8a3 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-10-241-0/+2
|\ | | | | | | Change-Id: Ie56539b2e0be611a363b5f15ae5412a78d6945a2
| * QFileDialog can delete files too, not just directoriesShawn Rutledge2013-10-231-0/+2
| | | | | | | | | | | | | | | | | | After Ic12de12ec51c20de52d040514e90be5e783add43 this functionality was broken. Added an autotest. Task-number: QTBUG-34159 Change-Id: I8f41b7073dc57fea855ab87796f09e8a91520d13 Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-10-111-7/+7
|\| | | | | | | Change-Id: Ib8cfeee7d9ca15e8ad520e428b72c200827a8628
| * Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* | WinRT: Fix Widget buildsAndrew Knight2013-09-271-1/+1
|/ | | | | | | | Tweak pri files and preprocessor usage to support widgets under WinRT. Change-Id: I6dc7d160078c0da343d6d39d2a0d52112c6f9f59 Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Remove some qBinaryFind usages from QtWidgetsGiuseppe D'Angelo2013-09-231-5/+3
| | | | | | | | This is done per the mailing list discussion at http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I7e4a5a4010b0ded59dbe2cacc6afe23ae4121bfe Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
* QFileSystemModel: Fix build when QT_NO_FILESYSTEMWATCHER is definedAndrew Knight2013-09-231-2/+45
| | | | | | | | This class already has some guards for QT_NO_FILESYSTEMWATCHER; implement the rest. Change-Id: I97072c9cd1debb726f9d10ff49ff0c01bbb9bc6e Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Simplify QFileSystemModel::remove by using QDir::removeRecursivelyDavid Faure2013-09-161-24/+2
| | | | | | | | This also fixes it in case of hidden or system files, which were missing from the filter (found by Denis Kovalskiy). Change-Id: Ic12de12ec51c20de52d040514e90be5e783add43 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove qSort from QtWidgetsGiuseppe D'Angelo2013-09-051-2/+2
| | | | | | | | | QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: Iec5c10fc4c3b4e684b51f6223bf3cb56acc42b58 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-04-221-1/+1
|\ | | | | | | Change-Id: I059725e3b7d7ffd5a16a0931e6c17200917172b5
| * Convert the new filename to native separators before checking itAndy Shaw2013-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | If a native separator was put in the new name when renaming a file name via the file dialog then it would correctly fail. But if a non-native one was used on Windows then it would cause the file to be moved instead if the directory existed. Change-Id: If01760b8c54a69b600c9a44c7509017be70d33e3 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-03-281-3/+3
|\| | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/qnx/qqnxtheme.cpp src/widgets/dialogs/qfileinfogatherer.cpp src/widgets/dialogs/qfilesystemmodel.cpp Change-Id: Ifa536969c4beafcdfeebbf6beda1674b86750be8
| * Fix documentation of QFileSystemModel::resolveSymlinks().Sérgio Martins2013-03-261-2/+2
| | | | | | | | | | | | | | It's Windows only, and it defaults to true. Change-Id: I82badbcae0fdba589b57a7dfe627b99ec6cc92c5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
| * Merge branch 'dev' into stableOswald Buddenhagen2013-03-201-1/+3
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This starts Qt 5.1 release cycle Conflicts: src/gui/text/qfontdatabase.cpp src/gui/text/qharfbuzz_copy_p.h src/widgets/kernel/qapplication.cpp src/widgets/kernel/qcoreapplication.cpp Change-Id: I72fbf83ab3c2206aeea1b089428b0fc2a89bd62b
| * | Reorder for performance reasons.Sérgio Martins2013-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | isSymLink() can be expensive in a few cases. Change-Id: I6f84414cf7057453d62225ab4f45dcdf92ed017b Reviewed-by: David Faure (KDE) <faure@kde.org>
* | | Windows: Fix the last file dialog bottleneck.Sérgio Martins2013-03-271-1/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Went from taking 30 seconds to 2 seconds, on a SDCard with 10k files. Windows file dialog does not resolve NTFS symlinks, it just shows an empty icon, and the link name, not the target. This allows for a big performance gain by reducing the number of calls to GetFileAttributesEx() by checking the extension directly. This also fixes the problems with the native file dialog, which for some reason, is creating a QFileSystemModel too. Task-number: QTBUG-13182 Change-Id: Ie2739765fd6c7daea64e3cf1d208ba9720bd39f2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* | Fix license headers stating QtGui for QtWidgets files.Jake Petroules2013-03-191-1/+1
| | | | | | | | | | Change-Id: I0ca49e3e1f9f603f0b0f7f3553e854b871efe303 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add the Qt::ItemNeverHasChildren flag and use it in QTreeView.Stephen Kelly2013-01-291-0/+2
|/ | | | | | | | | It can be used to determine whether expand() should really expand. Change-Id: If79d8c295a4ca1356e60051682b227524a065126 Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>