aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/mimetypes
Commit message (Collapse)AuthorAgeFilesLines
* Remove uses of QRegularExpression::OptimizeOnFirstUsageOptionhjk2020-06-181-1/+0
| | | | | | | | Deprecated, and declared to have no effect for Qt >= 5.12. Task-number: QTCREATORBUG-24098 Change-Id: I11067b8e2ae40ff1f1dd4de92a734a40d2eae556 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Replace foreach with range-based forOrgad Shaneh2020-06-165-32/+29
| | | | | Change-Id: I9aeea9c029ffc56cbadc04edd20e9b35b154f986 Reviewed-by: hjk <hjk@qt.io>
* Doc: Fix MimeType docsLeena Miettinen2020-02-061-66/+48
| | | | | | | | | | | | - Remove internal and duplicate docs - Add missing docs - Edit language and formatting - Remove unnecessary \fn commands, so the signatures don't need to be maintained Task-number: QTCREATORBUG-23544 Change-Id: I85193979e4679b4e2fd2c219132eab4c977ac886 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Compile fix with recent Qt devhjk2019-07-293-17/+13
| | | | | | | | | The reasoning in 1b4766e26c6b did not take into account that the scope of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with f70905448f6 in Qt base. Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Cope with Qt 5.14's dropping of the MIME type DB as a resourceThiago Macieira2019-07-171-10/+3
| | | | | | | | | The copy is still present on non-Linux systems, but is not accessible as a resource, so we must ship our own copy. Fixes: QTCREATORBUG-22636 Change-Id: Ie7ae7616eadf4035bec6fffd15ac303c1d2badce Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Merge remote-tracking branch 'origin/4.9' into 4.10Eike Ziller2019-07-161-22/+16
|\ | | | | | | | | | | | | Conflicts: src/libs/utils/mimetypes/mimeprovider.cpp Change-Id: If771d3fba60b670cb0de3a43c9039e24c74aabb1
| * Re-fix QtCore resource path changing and prepare for Qt 5.134.9Thiago Macieira2019-07-161-26/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 9cf8ab3b3d44ac50a1f8d4893d8f70b8aedb18b0 added the #ifdef, but that of course only works if you don't upgrade Qt compared to what Qt Creator was compiled with. Instead, attempt both paths and only do that if the system copy is not found. Searching the system copy is required to address Qt 5.13's configure option -no-mimetype-database (used by Linux distributions because the system copy is always present). This code will still need work to deal with Qt 5.14 changes. Task-number: QTCREATORBUG-19600 Task-number: QTCREATORBUG-22636 Change-Id: I6aed4df6a12e43c3ac8efffd15ac952a6e9d4770 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* | Bump minimum Qt version (to build Qt Creator) to 5.11Alessandro Portale2019-02-151-4/+0
|/ | | | | | | | | Recent adaptations to Qt 5.13's API deprecations require using APIs which were introduces in Qt 5.11. Change-Id: I6c077d824c9ce716e019543b290c355a5d512fad Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: ModernizeOrgad Shaneh2018-09-214-24/+20
| | | | | | | range-based for, nullptr, member initializers, override. Change-Id: I21ac5b23883c08dbd75819bb3298bc956cdb972c Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* Utils: Do not export inlined functionsDavid Schulz2018-09-041-1/+1
| | | | | Change-Id: I1a61b526179d843cc6379044fb1fc4a8b283f3d5 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge remote-tracking branch 'origin/4.7'Eike Ziller2018-08-201-0/+1
|\ | | | | | | Change-Id: I15962a85b0cc37c5a00e15ef7eac0445aad6c295
| * MimeProvider: Add #include <QtGlobal> for version checkOrgad Shaneh2018-08-161-0/+1
| | | | | | | | | | | | | | | | It is required with Qt 5.11. Task-number: QTCREATORBUG-20912 Change-Id: I172caf605a95d560d730d8007f2cf623abc90957 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | Utils: ModernizeAlessandro Portale2018-07-204-14/+7
| | | | | | | | | | | | | | | | | | | | | | | | modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using modernize-use-default-member-init modernize-use-equals-default Change-Id: I8d44d9405011a1878353baf9325f7af90b89db02 Reviewed-by: hjk <hjk@qt.io>
* | MimeDatabase: Don't pollute global namespaceEike Ziller2018-06-131-2/+2
| | | | | | | | | | | | | | Task-number: QTCREATORBUG-16119 Change-Id: If234669adf19ccf84b76b99c1a71574f3859eaf1 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | Utils: add hash function for MimeTypeDavid Schulz2018-05-161-0/+3
|/ | | | | Change-Id: I4ba86887a4ed575e4aee0cbe1157254e8cd5abb8 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Consistently use nullptrTobias Hunger2018-05-132-2/+2
| | | | | | | Fixed by clang-tidy modernize-use-nullptr. Change-Id: I93edae67271a521e3b2a1f97f486e5fa97009836 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Fix mime type detection for Qt 5.11Friedemann Kleint2018-01-171-1/+6
| | | | | | | | | Add an #ifdef for the changed path to the QtCore resource following qtbase/7a5644d6481a3c1a7416772998ca4e60c977bfbd. Task-number: QTCREATORBUG-19600 Change-Id: I8fa8bbf9a7ec91ca569f65671eaab1798b129981 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Merge remote-tracking branch 'origin/4.3'Eike Ziller2017-04-251-2/+2
|\ | | | | | | Change-Id: I01d7d8aa282f2bca94f85f55c832c76672e229f7
| * Don't use return keyword when method doesn't return anythingLaurent Montel2017-04-241-2/+2
| | | | | | | | | | Change-Id: Ia9757be7cb51fb946557d40134a93acd1aec0a94 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* | Use QString::*Ref methodMontel Laurent2017-04-211-1/+1
|/ | | | | | | Change-Id: I63a10f274dd17e08b5b8a2577762cc9f7960b5af Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Wrap MimeDatabase into static functionshjk2017-03-033-72/+134
| | | | | | | | To avoid repeating the 'MimeDatabase mdb; mdb.something(); ' mantra all over the place. Change-Id: I4bfef62e73275a991455141671d6071162788e9d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Move mimetype definitions to plugin specsEike Ziller2017-02-274-17/+25
| | | | | | | | | | | | - Avoids the hassle of QRC files and manually registering mime types - Avoids performance regressions because of mime types that are registered after mime database has been used - Makes it technically possible to detect that a disabled plugin could handle a mime type if it was enabled Change-Id: I373008b1b56e9c6b4853055f20b3eeb112a6eff9 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Convert some 0 to nullptrMontel Laurent2017-02-231-2/+2
| | | | | Change-Id: Ib3ca8e2cc0d63fd35582c73b3cf7c915fb64ddfb Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Replace a few occurrences of QStringList() << ...hjk2017-02-081-1/+1
| | | | | | | ... by something shorter. Change-Id: I363b4e509adb07997517b2d233246a333aea4aea Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* MimeTypes: Slurp in XML contents in one gohjk2017-01-133-8/+5
| | | | | | | | Saves ~3% cycles in MimeTypeParserBase::parse() i.e. ~0.35% of total startup time. Change-Id: Ia69cacae359191bd6e55d38758db315d1992ffad Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* MimeDatabase: Add some startup phase trackinghjk2017-01-113-0/+37
| | | | | | | | | ... to warn about situations where Mime types are registered too late (i.e. after Plugin::initialize() or used too early (i.e. before Plugin::extensionsInitialized()) Change-Id: I22681e94bfdd508e954bb3457b834ec3ad1f0fee Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Do not dereference nullptr via errorMessageTobias Hunger2016-12-051-1/+2
| | | | | | | | | The errorMessage passed into this function apparently can be a nullptr, at least everywhere else it is checked whether or not errorMessage is nullptr before accessing it. Change-Id: If0920275ebce394a1b7085b815eaa6994b76ee3b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Merge remote-tracking branch 'origin/4.2'Orgad Shaneh2016-11-281-1/+1
|\ | | | | | | Change-Id: I259a402bc896fc2e359cc96b7510453ac9a9a552
| * Remove last nokia references in commentsOrgad Shaneh2016-11-241-1/+1
| | | | | | | | | | Change-Id: Ic5b815061212f66af5e36396b9a2b94cfbdfbe52 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | Fix that it was not possible to save with arbitrary file extensionEike Ziller2016-11-152-3/+12
|/ | | | | | | | On Windows. Task-number: QTCREATORBUG-15862 Change-Id: I5cc76662e4996bfa26eece09f2e30dc3ce873eb5 Reviewed-by: David Schulz <david.schulz@qt.io>
* Wholesale conversion to #pragma oncehjk2016-03-309-36/+9
| | | | | | | Kudos to cgmb and https://github.com/cgmb/guardonce Change-Id: Ifa8970734b8d43fd08c9260c645bdb0228633791 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* Update License according to agreement with Free Qt FoundationTobias Hunger2016-01-1916-242/+336
| | | | | | | * Update remaining files in src Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* Fix that bogus mime data could lead to endless loopEike Ziller2015-11-101-2/+8
| | | | | | | | | | <mime-type type="text/foo"> <sub-class-of type="text/foo"/> </mime-type> Change-Id: Id03cb4a37345ccc083eaaa03c33847b3735a5d4b Task-number: QTCREATORBUG-13965 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
* Remove some superfluous QT_VERSION_CHECKs.Christian Kandeler2015-04-301-2/+0
| | | | | | | 5.4.0 is required these days. Change-Id: I0dc4c788b058f4c3fd2b9026fd7d6c7ab2840884 Reviewed-by: hjk <hjk@theqtcompany.com>
* Utils: MIME types: Fix compile for Qt less than 5.4Christian Stenger2015-03-261-1/+4
| | | | | Change-Id: I28ed17dfba96e000d624049d12e082c536f2a27d Reviewed-by: hjk <hjk@theqtcompany.com>
* MimeDatabase: Allow regular expressions for magic rulesEike Ziller2015-03-252-2/+29
| | | | | | | | | | | | | | | This extends the freedesktop standard, which really is lacking in many ways. Adds a type "regexp", which interprets the "value" as a QRegularExpression with MultilineOption and DotMatchesEverythingOption. The range/offset is the range of the sub-string that is matched against the regular expression. If the value for the end of the range is omitted, or the same as the start, the whole string is matched against the regular expression. The mask is ignored. Change-Id: Iaaaf769451ed23112f1fbeee254fdff3198b74a2 Reviewed-by: BogDan Vatra <bogdan@kde.org>
* MimeMagic: Remove now no longer needed Qt Creator additionEike Ziller2015-03-242-3/+1
| | | | | Change-Id: I3560a8ff60ae6cf8b0c57b036979f11be036e634 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
* MimeDatabase: Fix that xml files were opened in bar descriptor editorEike Ziller2015-03-091-2/+6
| | | | | | | | | | | | | | | | | | | | Fix MIME detection issues with magics in MIME hierarchies Assume two MIME types A and B are registered, both with the same glob pattern, A being parent of B, A with some magic rule, and B with another magic rule. Given a file that matches the glob pattern and the magic rule of A, the resulting MIME type depended on the order of registration of A and B, because it would just check if some glob matching MIME type was also a subclass of the magic matching MIME type. The patch prefers the the MIME type that matches by magic if that matches by glob pattern as well (i.e. A in our example). The "recommended checking order" of the spec does handle that case. Change-Id: Ia914aa7b6d0fb52f6c833897a5be69eb59fca6ab Task-number: QTBUG-44846 Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
* MimeDatabase: Fix leak on invalid magicEike Ziller2015-03-091-1/+3
| | | | | | | Introduced by 673be1a3f8d28474d830762e46c7157a54ef3c39 Change-Id: Ia937b3607d6a709b86185f428a6e3ff1202e0869 Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
* MimeDatabase: Do not crash/assert on invalid mime magic dataEike Ziller2015-03-053-16/+43
| | | | | Change-Id: I355241e472b1bb379ccc94fdd896c6d894206b0a Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
* MimeDatabase: Remove bestMatch, which was broken beyond repairEike Ziller2015-02-274-134/+0
| | | | | | | | | | | | The problem is that, if you check e.g. a .pro file against all C/C++ mime types, and these define magic matchers, it would find that .pro doesn't match C/C++ mime types by extension, so it would open the file to find a magic match. Even though the extension .pro would identify it already as a qmake .pro file when checking for the mime type globally. Change-Id: I3341187e88e2263bf38169c3c99e5d2161e2a9ee Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* MimeType: Improve performance for matchesNameOrgad Shaneh2015-02-271-1/+3
| | | | | | | | aliases() iterates through the entire hash. It should not be called so frequently. Change-Id: I2f896489459b2237a0a1763919fb8a52fb411ae1 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
* MimeDatabase: Avoid empty filter string in allFilterStrings.Eike Ziller2015-02-271-2/+5
| | | | | Change-Id: I975423d2b0fcde7ff6e625e9d3cdaf271dd57dec Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
* MimeDatabase: Avoid opening files even if already file name matchesEike Ziller2015-02-251-4/+4
| | | | | | Change-Id: If669985f8ef852c31ecbaae76c533c7286e5a294 Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Add freedesktop.org.xml to .pri file for easy access in locator.Eike Ziller2015-02-251-0/+1
| | | | | Change-Id: I6c408a7f8cf367038140c9d35d7dea8f7e0cd628 Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
* MimeDatabase: Fix remaining problems with overriding mime typesEike Ziller2015-02-241-4/+1
| | | | | | | | | | | If mime info is requested during Qt Creator's initialization cycle, the mime files might be parsed before all custom types are registered. To ensure that custom mime types override the built-in ones we must force a complete reload after they are registered. Change-Id: I94032a5efe1bbc22885cbeb1f43080270c23381c Task-number: QTCREATORBUG-13995 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
* MimeDatabase: Prevent funny mixing of different mime type definitionsEike Ziller2015-02-183-18/+32
| | | | | | | | | | | | | | | | | | | | If multiple definitions for the same mime type are found, the mime XML parser/provider would on the one hand replace the first MimeType instance by the later one, but on the other hand keep all previously parsed glob and magic matchers from the first definition. The patch - makes the XML parser ignore definitions of mime types that are already defined - parses custom types first, so custom types can override types from freedesktop.org.xml This fixes opening Cmake projects (CMakeLists.txt) in Qt Creator, because freedesktop.org.xml defines these files to be x-cmake, but we need them to be x-cmake-project. Change-Id: Ia5598c2d0201f608aed6ae8c3268f0512d822f51 Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
* MimeData: Never detect anything as application/x-zerosizeEike Ziller2015-02-181-4/+4
| | | | | | | | | | | | | | - That mime type is pretty useless - If there are two mime types that match a file by glob pattern, the mime database implementation will find the best matching mime type by data of *all* mime types and take that instead (this doesn't make sense btw). That means that if .h is matched by c-hdr and c++-hdr, empty .h files are detected as mime type application/x-zerosize, which is pretty useless Change-Id: I4f9d532ef1efd29df00279c693486c92611485a8 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com> Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
* MimeDatabase: Fix compilation with namespaced QtEike Ziller2015-02-172-12/+14
| | | | | | Change-Id: I977a115e75302a5341352b593bf3182c0b093031 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com> Reviewed-by: hjk <hjk@theqtcompany.com>
* MimeDatabase: Never use installed mime data.Eike Ziller2015-02-171-17/+17
| | | | | | | | | It gets in the way, e.g. "No plugin can open project type "application/ x-kicad-project"" when trying to open .pro files. Change-Id: I5d8dcb52b65b1e617fe0c6dfcdc94e2cf8fc5f5d Reviewed-by: Tim Sander <tim@krieglstein.org> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>