mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
Don't show selection toggle areas on files while in selection mode
This commit is contained in:
parent
e464b58c33
commit
0f50abe12d
|
@ -333,6 +333,17 @@ void KItemListWidget::setEnabledSelectionToggle(bool enable)
|
|||
{
|
||||
if (m_enabledSelectionToggle != enable) {
|
||||
m_enabledSelectionToggle = enable;
|
||||
|
||||
// We want the change to take effect immediately.
|
||||
if (m_enabledSelectionToggle) {
|
||||
if (m_hovered) {
|
||||
initializeSelectionToggle();
|
||||
}
|
||||
} else if (m_selectionToggle) {
|
||||
m_selectionToggle->deleteLater();
|
||||
m_selectionToggle = nullptr;
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,19 @@ int DolphinItemListView::zoomLevel() const
|
|||
return m_zoomLevel;
|
||||
}
|
||||
|
||||
void DolphinItemListView::setEnabledSelectionToggles(DolphinItemListView::SelectionTogglesEnabled selectionTogglesEnabled)
|
||||
{
|
||||
m_selectionTogglesEnabled = selectionTogglesEnabled;
|
||||
switch (m_selectionTogglesEnabled) {
|
||||
case True:
|
||||
return setEnabledSelectionToggles(true);
|
||||
case False:
|
||||
return setEnabledSelectionToggles(false);
|
||||
case FollowSetting:
|
||||
return setEnabledSelectionToggles(GeneralSettings::showSelectionToggle());
|
||||
}
|
||||
}
|
||||
|
||||
void DolphinItemListView::readSettings()
|
||||
{
|
||||
ViewModeSettings settings(itemLayout());
|
||||
|
@ -72,7 +85,7 @@ void DolphinItemListView::readSettings()
|
|||
|
||||
beginTransaction();
|
||||
|
||||
setEnabledSelectionToggles(GeneralSettings::showSelectionToggle());
|
||||
setEnabledSelectionToggles(m_selectionTogglesEnabled);
|
||||
setHighlightEntireRow(DetailsModeSettings::sidePadding());
|
||||
setSupportsItemExpanding(itemLayoutSupportsItemExpanding(itemLayout()));
|
||||
|
||||
|
|
|
@ -30,6 +30,18 @@ public:
|
|||
void setZoomLevel(int level);
|
||||
int zoomLevel() const;
|
||||
|
||||
enum SelectionTogglesEnabled {
|
||||
True,
|
||||
False,
|
||||
FollowSetting
|
||||
};
|
||||
/**
|
||||
* Sets whether the items in this view should show a small selection toggle area on mouse hover.
|
||||
* The default for this view is to follow the "showSelectionToggle" setting but this method can
|
||||
* be used to ignore that setting and force a different value.
|
||||
*/
|
||||
void setEnabledSelectionToggles(SelectionTogglesEnabled selectionTogglesEnabled);
|
||||
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
|
@ -46,6 +58,10 @@ protected:
|
|||
private:
|
||||
void updateGridSize();
|
||||
|
||||
using KItemListView::setEnabledSelectionToggles; // Makes sure that the setEnabledSelectionToggles() declaration above doesn't hide
|
||||
// the one from the base class so we can still use it privately.
|
||||
SelectionTogglesEnabled m_selectionTogglesEnabled = FollowSetting;
|
||||
|
||||
private:
|
||||
int m_zoomLevel;
|
||||
};
|
||||
|
|
|
@ -111,7 +111,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
|
|||
|
||||
m_model = new KFileItemModel(this);
|
||||
m_view = new DolphinItemListView();
|
||||
m_view->setEnabledSelectionToggles(GeneralSettings::showSelectionToggle());
|
||||
m_view->setEnabledSelectionToggles(DolphinItemListView::SelectionTogglesEnabled::FollowSetting);
|
||||
m_view->setVisibleRoles({"text"});
|
||||
applyModeToView();
|
||||
|
||||
|
@ -289,9 +289,11 @@ void DolphinView::setSelectionModeEnabled(const bool enabled)
|
|||
m_proxyStyle = std::make_unique<SelectionMode::SingleClickSelectionProxyStyle>();
|
||||
setStyle(m_proxyStyle.get());
|
||||
m_view->setStyle(m_proxyStyle.get());
|
||||
m_view->setEnabledSelectionToggles(DolphinItemListView::SelectionTogglesEnabled::False);
|
||||
} else {
|
||||
setStyle(QApplication::style());
|
||||
m_view->setStyle(QApplication::style());
|
||||
m_view->setEnabledSelectionToggles(DolphinItemListView::SelectionTogglesEnabled::FollowSetting);
|
||||
}
|
||||
m_container->controller()->setSelectionModeEnabled(enabled);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue