From: Peter Penz Date: Wed, 15 Feb 2012 15:10:01 +0000 (+0100) Subject: Folders Panel: Use the whole width as selection region X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/749362987b9617ddfc461b647ac436be5a6eaca4 Folders Panel: Use the whole width as selection region As no rubberband-selection is enabled for the Folders Panel it does not make sense to keep the selection region as small as possible. BUG: 294111 FIXED-IN: 4.8.1 --- diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp index dc1554dab..83fb914a1 100644 --- a/src/kitemviews/kfileitemlistwidget.cpp +++ b/src/kitemviews/kfileitemlistwidget.cpp @@ -780,8 +780,11 @@ void KFileItemListWidget::updateDetailsLayoutTextCache() switch (textId) { case Name: { + const qreal textWidth = option.extendedSelectionRegion + ? size().width() - m_textPos[textId].x() + : requiredWidth + 2 * option.padding; m_textRect = QRectF(m_textPos[textId].x() - option.padding, 0, - requiredWidth + 2 * option.padding, size().height()); + textWidth, size().height()); // The column after the name should always be aligned on the same x-position independent // from the expansion-level shown in the name column diff --git a/src/kitemviews/kitemliststyleoption.cpp b/src/kitemviews/kitemliststyleoption.cpp index 5266ef6bd..c512fa43e 100644 --- a/src/kitemviews/kitemliststyleoption.cpp +++ b/src/kitemviews/kitemliststyleoption.cpp @@ -29,7 +29,8 @@ KItemListStyleOption::KItemListStyleOption() : padding(0), horizontalMargin(0), verticalMargin(0), - iconSize(KIconLoader::SizeMedium) + iconSize(KIconLoader::SizeMedium), + extendedSelectionRegion(false) { } @@ -41,7 +42,8 @@ KItemListStyleOption::KItemListStyleOption(const KItemListStyleOption& other) : padding(other.padding), horizontalMargin(other.horizontalMargin), verticalMargin(other.verticalMargin), - iconSize(other.iconSize) + iconSize(other.iconSize), + extendedSelectionRegion(other.extendedSelectionRegion) { } diff --git a/src/kitemviews/kitemliststyleoption.h b/src/kitemviews/kitemliststyleoption.h index 9284dc61b..62441ef4b 100644 --- a/src/kitemviews/kitemliststyleoption.h +++ b/src/kitemviews/kitemliststyleoption.h @@ -42,6 +42,7 @@ public: int horizontalMargin; int verticalMargin; int iconSize; + bool extendedSelectionRegion; }; #endif diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index cc7c75f96..58dd7904d 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -146,6 +146,7 @@ void FoldersPanel::showEvent(QShowEvent* event) KItemListStyleOption styleOption = view->styleOption(); styleOption.padding = 2; styleOption.iconSize = KIconLoader::SizeSmall; + styleOption.extendedSelectionRegion = true; view->setStyleOption(styleOption); const qreal itemHeight = qMax(int(KIconLoader::SizeSmall), styleOption.fontMetrics.height()); diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp index 8d0b24cf3..b91fccbc0 100644 --- a/src/panels/folders/treeviewcontextmenu.cpp +++ b/src/panels/folders/treeviewcontextmenu.cpp @@ -105,34 +105,38 @@ void TreeViewContextMenu::open() } popup->addSeparator(); + } + // insert 'Show Hidden Files' + QAction* showHiddenFilesAction = new QAction(i18nc("@action:inmenu", "Show Hidden Files"), this); + showHiddenFilesAction->setCheckable(true); + showHiddenFilesAction->setChecked(m_parent->showHiddenFiles()); + popup->addAction(showHiddenFilesAction); + connect(showHiddenFilesAction, SIGNAL(toggled(bool)), this, SLOT(setShowHiddenFiles(bool))); + + // insert 'Automatic Scrolling' + QAction* autoScrollingAction = new QAction(i18nc("@action:inmenu", "Automatic Scrolling"), this); + autoScrollingAction->setCheckable(true); + autoScrollingAction->setChecked(m_parent->autoScrolling()); + // TODO: Temporary disabled. Horizontal autoscrolling will be implemented later either + // in KItemViews or manually as part of the FoldersPanel + //popup->addAction(autoScrollingAction); + connect(autoScrollingAction, SIGNAL(toggled(bool)), this, SLOT(setAutoScrolling(bool))); + + if (!m_fileItem.isNull()) { // insert 'Properties' entry QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this); propertiesAction->setIcon(KIcon("document-properties")); connect(propertiesAction, SIGNAL(triggered()), this, SLOT(showProperties())); popup->addAction(propertiesAction); - - popup->addSeparator(); } - if (m_fileItem.isNull()) { - QAction* showHiddenFilesAction = new QAction(i18nc("@action:inmenu", "Show Hidden Files"), this); - showHiddenFilesAction->setCheckable(true); - showHiddenFilesAction->setChecked(m_parent->showHiddenFiles()); - popup->addAction(showHiddenFilesAction); - connect(showHiddenFilesAction, SIGNAL(toggled(bool)), this, SLOT(setShowHiddenFiles(bool))); - - QAction* autoScrollingAction = new QAction(i18nc("@action:inmenu", "Automatic Scrolling"), this); - autoScrollingAction->setCheckable(true); - autoScrollingAction->setChecked(m_parent->autoScrolling()); - // TODO: Temporary disabled. Horizontal autoscrolling will be implemented later either - // in KItemViews or manually as part of the FoldersPanel - //popup->addAction(autoScrollingAction); - connect(autoScrollingAction, SIGNAL(toggled(bool)), this, SLOT(setAutoScrolling(bool))); - } - - foreach (QAction* action, m_parent->customContextMenuActions()) { - popup->addAction(action); + QList customActions = m_parent->customContextMenuActions(); + if (!customActions.isEmpty()) { + popup->addSeparator(); + foreach (QAction* action, customActions) { + popup->addAction(action); + } } QWeakPointer popupPtr = popup;