BUG: 375234
FIXED-IN: 5.1
Details
Diff Detail
- Repository
- R33 KDevPlatform
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
More generally, it might be better to create a selectedProjects() (or so) method instead and use it instead of all the Core::self()->selectionController()->currentSelection() stuff?
EDIT: I meant including the single-project-always-selected behaviour, so perhaps my suggested name is misleading.
As I mentioned on IRC, there are other features that act on the currently-selected project, adding this sort of logic in every such call would be quite ugly.
shell/projectcontroller.cpp | ||
---|---|---|
230 | Aargh. Maybe something like this? int itemCount = m_projects.size(); if ( itemCount > 1 ) { // if only one project loaded, this is always our target, otherwise base on selection if ( auto itemContext = dynamic_cast<ProjectItemContext*>(ICore::self()->selectionController()->currentSelection()) ) { itemCount = itemContext->items().count(); } } m_openConfig->setEnabled(itemCount == 1); m_closeProject->setEnabled(itemCount > 0); |
Agreed, this should see some general improvement, not only for consistency. Partially this patch is also testing acceptance of if-one-project-then-always-selected-one :)
Let's get this one in already though, so it is fixed for now.
shell/projectcontroller.cpp | ||
---|---|---|
230 | Smaller code looks nice :) |