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

2020-03-21 Thread Ahmad Samir
ahmadsamir abandoned this revision.
ahmadsamir added a comment.


  OK.

REPOSITORY
  R126 KDE CLI Utilities

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

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


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

2020-03-21 Thread David Faure
dfaure added a comment.


  I wrote QMimeDatabase, and my only intent was to move the main glob to be 
first. Not to prevent people from removing it. So this is a Qt bug.

REPOSITORY
  R126 KDE CLI Utilities

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

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


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

2020-03-17 Thread Ahmad Samir
ahmadsamir added a comment.


  For background see: https://bugs.kde.org/show_bug.cgi?id=414742
  
  I may be wrong, but personally I think QMimeDatabase is acting sensibly by 
not allowing to remove the "main" glob pattern of a mimetype.
  
  Also IIUC it seems other tools are sort of doing the same, e.g. gio (see the 
bug report for some testing I posted there).
  
  So, either this diff makes sense, or someone will have to put his upstream Qt 
hat on and change QMimeDatabase :p; I dug into the git history upstream, and 
IIRC it seems QMimeDatabase prepends the main glob pattern since 2012 (from 
before it was merged into qtbase).

REPOSITORY
  R126 KDE CLI Utilities

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

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


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

2020-03-16 Thread Ahmad Samir
ahmadsamir updated this revision to Diff 77754.
ahmadsamir added a comment.


  Tweak comment

REPOSITORY
  R126 KDE CLI Utilities

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D28079?vs=77753=77754

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


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

2020-03-16 Thread Ahmad Samir
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