Bug 391465

Summary: number of columns show by default is hardcoded
Product: [Applications] muon Reporter: Carlo Vanini <silhusk>
Component: muonAssignee: Jonathan Thomas <echidnaman>
Status: REPORTED ---    
Severity: normal CC: silhusk
Priority: NOR    
Version: 5.6   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Carlo Vanini 2018-03-06 12:52:11 UTC
When new columns have been added (Installed-Size, Version, Available-Version), they have been hidden by default in order to keep the UI the same as before. But their order is assumed and their number if hardcoded in `PackageWidget.cpp`.

> For the record: I think the actual way to write this smartly is to have 
> PackageModel::headerData implement a UserRole that returns an enum value. 
> The enum would be the header types. Then you iter all columns and hide the 
> headers based on their enum value. Which means nothing needs hardcoding and 
> should more columns get added later the switch cases handling would light up 
> in compiler warnings so no one can forget to handle the new headers to either 
> hide or show by default.
> 
> -- https://phabricator.kde.org/D10877