summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <peter.penz19@gmail.com>2012-02-15 15:10:01 (GMT)
committerPeter Penz <peter.penz19@gmail.com>2012-02-15 15:19:57 (GMT)
commit98d98f7c2457dc24223d77da77398c816dddf8b8 (patch)
tree6904b006a0e8f883b0f042f29879be4e06ebcec0
parent3fc1efc0f753e36ea9412eee4fe3ddd696fee172 (diff)
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
-rw-r--r--dolphin/src/kitemviews/kfileitemlistwidget.cpp5
-rw-r--r--dolphin/src/kitemviews/kitemliststyleoption.cpp6
-rw-r--r--dolphin/src/kitemviews/kitemliststyleoption.h1
-rw-r--r--dolphin/src/panels/folders/folderspanel.cpp1
-rw-r--r--dolphin/src/panels/folders/treeviewcontextmenu.cpp44
5 files changed, 34 insertions, 23 deletions
diff --git a/dolphin/src/kitemviews/kfileitemlistwidget.cpp b/dolphin/src/kitemviews/kfileitemlistwidget.cpp
index dc1554d..83fb914 100644
--- a/dolphin/src/kitemviews/kfileitemlistwidget.cpp
+++ b/dolphin/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/dolphin/src/kitemviews/kitemliststyleoption.cpp b/dolphin/src/kitemviews/kitemliststyleoption.cpp
index 5266ef6..c512fa4 100644
--- a/dolphin/src/kitemviews/kitemliststyleoption.cpp
+++ b/dolphin/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/dolphin/src/kitemviews/kitemliststyleoption.h b/dolphin/src/kitemviews/kitemliststyleoption.h
index 9284dc6..62441ef 100644
--- a/dolphin/src/kitemviews/kitemliststyleoption.h
+++ b/dolphin/src/kitemviews/kitemliststyleoption.h
@@ -42,6 +42,7 @@ public:
int horizontalMargin;
int verticalMargin;
int iconSize;
+ bool extendedSelectionRegion;
};
#endif
diff --git a/dolphin/src/panels/folders/folderspanel.cpp b/dolphin/src/panels/folders/folderspanel.cpp
index cc7c75f..58dd790 100644
--- a/dolphin/src/panels/folders/folderspanel.cpp
+++ b/dolphin/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/dolphin/src/panels/folders/treeviewcontextmenu.cpp b/dolphin/src/panels/folders/treeviewcontextmenu.cpp
index 8d0b24c..b91fccb 100644
--- a/dolphin/src/panels/folders/treeviewcontextmenu.cpp
+++ b/dolphin/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<QAction*> customActions = m_parent->customContextMenuActions();
+ if (!customActions.isEmpty()) {
+ popup->addSeparator();
+ foreach (QAction* action, customActions) {
+ popup->addAction(action);
+ }
}
QWeakPointer<KMenu> popupPtr = popup;