]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Folders Panel: Use the whole width as selection region
authorPeter Penz <peter.penz19@gmail.com>
Wed, 15 Feb 2012 15:10:01 +0000 (16:10 +0100)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 15 Feb 2012 15:20:47 +0000 (16:20 +0100)
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

src/kitemviews/kfileitemlistwidget.cpp
src/kitemviews/kitemliststyleoption.cpp
src/kitemviews/kitemliststyleoption.h
src/panels/folders/folderspanel.cpp
src/panels/folders/treeviewcontextmenu.cpp

index dc1554dab9e3005be0e858407752ec55c2b87259..83fb914a105d84b093aa3b4e6d6e6516fc9e7441 100644 (file)
@@ -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
index 5266ef6bdacfaf061945c1bf5819da17422c2a1f..c512fa43ec09f0caf3ee05243bdfceb2a937fad3 100644 (file)
@@ -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)
 {
 }
 
index 9284dc61be8dbec87966150400d2eb2117e2026a..62441ef4b059f0f98a14da4f4b5ad3694f6fca71 100644 (file)
@@ -42,6 +42,7 @@ public:
     int horizontalMargin;
     int verticalMargin;
     int iconSize;
+    bool extendedSelectionRegion;
 };
 #endif
 
index cc7c75f960c8f360b00c37d0c6997311c3dca28b..58dd7904db319ee127a5f90d311445ce22f73c4c 100644 (file)
@@ -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());
index 8d0b24cf30686303aceeaf272230ec682a17a2a1..b91fccbc07c6098cdad0e55fcfda494b57387c3c 100644 (file)
@@ -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;