D28079: [keditfiletype] Prevent removing the "main" glob pattern for mime types

Ahmad Samir noreply at phabricator.kde.org
Mon Mar 16 17:24:54 GMT 2020


ahmadsamir created this revision.
ahmadsamir added reviewers: Plasma, dfaure, davidedmundson, apol.
Herald added a project: Plasma.
Herald added a subscriber: plasma-devel.
ahmadsamir requested review of this revision.

REVISION SUMMARY
  QMimeDatabase re-adds/prepends the "main" glob pattern (the first one
  in the system-wide xml file) to the glob patterns list, even if the user
  has previously removed it e.g. via the filetypes kcm, as a result of that:
  
  - Don't change the sort order of m_patterns. It seems the list returned by QMimeType::globPatterns() is "ordered". Also no need to sort() the patterns list in the unit test or in MimeTypeData::isMimeTypeDirty()
  - Disable the "Remove" button for the first entry in the glob patterns list view
  
  Fix filetypetest (unit test), use "*.inf" instead of "*.txt", the latter
  was always re-added by QMimeDatabase, which made the test fail.

TEST PLAN
  Before applying the diff:
  
    - Open the filetypes kcm, and remove the first glob pattern, "*.mp3" from audio/mpeg, apply, restart, note that it's been added back to the top of the list.
  - Go to text/plain mimetype, the first entry isn't "*.txt"
  
  
  
  
  - Apply the diff then try again, the "Remove" button should be disabled when you select the first row in the patterns list view.
  - Select a different entry, "Remove" button should become enabled.
  - Go to text/plain mimetype, "*.txt" is the first entry.

REPOSITORY
  R126 KDE CLI Utilities

BRANCH
  l-mainglobpattern (branched from master)

REVISION DETAIL
  https://phabricator.kde.org/D28079

AFFECTED FILES
  keditfiletype/filetypedetails.cpp
  keditfiletype/mimetypedata.cpp
  keditfiletype/tests/filetypestest.cpp

To: ahmadsamir, #plasma, dfaure, davidedmundson, apol
Cc: kde-frameworks-devel, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20200316/598ff242/attachment-0001.html>


More information about the Plasma-devel mailing list