Changeset View
Changeset View
Standalone View
Standalone View
core/MenuProxyModel.cpp
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | 59 | { | |||
---|---|---|---|---|---|
73 | } | 73 | } | ||
74 | return KCategorizedSortFilterProxyModel::subSortLessThan( left, right ); | 74 | return KCategorizedSortFilterProxyModel::subSortLessThan( left, right ); | ||
75 | } | 75 | } | ||
76 | 76 | | |||
77 | 77 | | |||
78 | bool MenuProxyModel::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const | 78 | bool MenuProxyModel::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const | ||
79 | { | 79 | { | ||
80 | if (!m_filterHighlightsEntries) { | 80 | if (!m_filterHighlightsEntries) { | ||
81 | // Don't show empty categories | ||||
82 | QModelIndex index = sourceModel()->index( source_row, 0, source_parent ); | ||||
83 | MenuItem * mItem = index.data( Qt::UserRole ).value<MenuItem*>(); | ||||
84 | if ( mItem->menu() && mItem->children().isEmpty() ) { | ||||
85 | return false; | ||||
86 | } | ||||
81 | return KCategorizedSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); | 87 | return KCategorizedSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); | ||
82 | } | 88 | } | ||
83 | 89 | | |||
84 | QModelIndex index = sourceModel()->index( source_row, 0, source_parent ); | 90 | QModelIndex index = sourceModel()->index( source_row, 0, source_parent ); | ||
85 | MenuItem * mItem = index.data( Qt::UserRole ).value<MenuItem*>(); | 91 | MenuItem * mItem = index.data( Qt::UserRole ).value<MenuItem*>(); | ||
86 | // accept only systemsettings categories that have children | 92 | // accept only systemsettings categories that have children | ||
87 | if ( mItem->children().isEmpty() && mItem->service()->serviceTypes().contains(QLatin1String("SystemSettingsCategory") ) ) { | 93 | if ( mItem->children().isEmpty() && mItem->service()->serviceTypes().contains(QLatin1String("SystemSettingsCategory") ) ) { | ||
88 | return false; | 94 | return false; | ||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |