<table><tr><td style="">nibags edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-5mvmyopgjrwnbd4/">(Show Details)</a><br />nibags edited the test plan for this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-dkiu36qopes5rgb/">(Show Details)</a><br />nibags added reviewers: KTextEditor, cullmann, dhaumann.
</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/D25389">View Revision</a></tr></table><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">The session config file `$HOME/.config/katemetainfos` stores the mode of the last open files. However, it may contain invalid or non-existent modes, for example, when applying an highlighting mode of a custom XML file that will be renamed or deleted. Therefore, a verification is added, only existing modes will be applied.<br />
<br />
**Changes:**<br />
* The `KTextEditor::DocumentPrivate::updateFileType()` function now returns a boolean, which is false if the mode name entered in the parameter doesn't exist or is invalid.<br />
* Modes with empty names are considered invalid, since `KateModeManager::fileType(const QString &name)` returns an empty `KateFileType` object if the name of the parameter doesn't exist. It's understood that the name of a mode shouldn't be empty, since it acts as a unique identifier.<br />
* When reading the session config file (`KTextEditor::DocumentPrivate::readSessionConfig()`), it's checked if the stored mode is valid. If the mode is invalid, it will not be applied and the default mode will be used, depending on the file extension or MIME-type.</span></div></div></div><br /><div><strong>CHANGES TO TEST PLAN</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">**TEST 1:**<br />
1. Create a custom XML highlighting file, which we will call "TestMode".<br />
2. Open any file, for example `$HOME/test.c`.<br />
3. Apply the mode "TestMode". Now, when the file is opened, the "TestMode" mode will be used by default.<br />
4. Close Kate and delete the custom XML file of "TestMode" or rename the definition name.<br />
5. Reopen `test.c`. Now the "TestMode" mode is invalid:<br />
<br />
   **Before:** The "Normal" mode was used and an empty string was displayed as the mode name in the status bar.<br />
<br />
   **Now:** The default mode, defined by the file extension or MIME-type, is used.<br />
<br />
**TEST 2:**<br />
1. Open any file, for example `$HOME/test.c`.<br />
2. Open `$HOME/.config/katemetainfos`, search for the previous file and modify the value of **Mode=**, by entering an invalid or empty one.<br />
3. Reopen `test.c`</span></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R39 KTextEditor</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D25389">https://phabricator.kde.org/D25389</a></div></div><br /><div><strong>To: </strong>nibags, KTextEditor, cullmann, dhaumann<br /><strong>Cc: </strong>kwrite-devel, kde-frameworks-devel, LeGast00n, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann<br /></div>