<table><tr><td style="">ahmadsamir created this revision.<br />ahmadsamir added reviewers: Plasma, dfaure, davidedmundson, apol.<br />Herald added a project: Plasma.<br />Herald added a subscriber: plasma-devel.<br />ahmadsamir requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D28079">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>QMimeDatabase re-adds/prepends the "main" glob pattern (the first one<br />
in the system-wide xml file) to the glob patterns list, even if the user<br />
has previously removed it e.g. via the filetypes kcm, as a result of that:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">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()</li>
<li class="remarkup-list-item">Disable the "Remove" button for the first entry in the glob patterns list view</li>
</ul>
<p>Fix filetypetest (unit test), use "*.inf" instead of "*.txt", the latter<br />
was always re-added by QMimeDatabase, which made the test fail.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Before applying the diff:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item phantom-item"><ul class="remarkup-list">
<li class="remarkup-list-item">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.</li>
</ul></li>
<li class="remarkup-list-item">Go to text/plain mimetype, the first entry isn't "*.txt"</li>
</ul>
<h6 class="remarkup-header"></h6>
<ul class="remarkup-list">
<li class="remarkup-list-item">Apply the diff then try again, the "Remove" button should be disabled when you select the first row in the patterns list view.</li>
<li class="remarkup-list-item">Select a different entry, "Remove" button should become enabled.</li>
<li class="remarkup-list-item">Go to text/plain mimetype, "*.txt" is the first entry.</li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R126 KDE CLI Utilities</div></div></div><br /><div><strong>BRANCH</strong><div><div>l-mainglobpattern (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D28079">https://phabricator.kde.org/D28079</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>keditfiletype/filetypedetails.cpp<br />
keditfiletype/mimetypedata.cpp<br />
keditfiletype/tests/filetypestest.cpp</div></div></div><br /><div><strong>To: </strong>ahmadsamir, Plasma, dfaure, davidedmundson, apol<br /><strong>Cc: </strong>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<br /></div>