diff --git a/containments/desktop/package/contents/config/main.xml b/containments/desktop/package/contents/config/main.xml --- a/containments/desktop/package/contents/config/main.xml +++ b/containments/desktop/package/contents/config/main.xml @@ -81,6 +81,9 @@ imagethumbnail,jpegthumbnail + + 0 + 4 diff --git a/containments/desktop/package/contents/ui/ConfigIcons.qml b/containments/desktop/package/contents/ui/ConfigIcons.qml --- a/containments/desktop/package/contents/ui/ConfigIcons.qml +++ b/containments/desktop/package/contents/ui/ConfigIcons.qml @@ -52,6 +52,7 @@ property alias cfg_popups: popups.checked property alias cfg_previews: previews.checked property alias cfg_previewPlugins: previewPluginsDialog.previewPlugins + property alias cfg_viewMode: viewMode.currentIndex property alias cfg_iconSize: iconSize.value property alias cfg_textLines: textLines.value @@ -238,14 +239,27 @@ Layout.fillWidth: true - visible: !isPopup - title: i18n("Appearance") flat: true ColumnLayout { RowLayout { + visible: isPopup + + Label { + text: i18nc("whether to use icon or list view", "View Mode:") + } + + ComboBox { + id: viewMode + model: [i18n("List"), i18n("Icons")] + } + } + + RowLayout { + visible: !isPopup || viewMode.currentIndex === 1 + Label { text: i18n("Size:") } @@ -270,6 +284,8 @@ } RowLayout { + visible: !isPopup || viewMode.currentIndex === 1 + Label { text: i18n("Text lines:") } diff --git a/containments/desktop/package/contents/ui/FolderItemDelegate.qml b/containments/desktop/package/contents/ui/FolderItemDelegate.qml --- a/containments/desktop/package/contents/ui/FolderItemDelegate.qml +++ b/containments/desktop/package/contents/ui/FolderItemDelegate.qml @@ -129,7 +129,7 @@ active: (plasmoid.configuration.toolTips && popupDialog == null && !model.blank) interactive: false - location: root.isPopup ? (plasmoid.location == PlasmaCore.Types.LeftEdge ? PlasmaCore.Types.LeftEdge : PlasmaCore.Types.RightEdge) : plasmoid.location + location: root.useListViewMode ? (plasmoid.location == PlasmaCore.Types.LeftEdge ? PlasmaCore.Types.LeftEdge : PlasmaCore.Types.RightEdge) : plasmoid.location onContainsMouseChanged: { if (containsMouse && !model.blank) { @@ -150,11 +150,11 @@ PlasmaCore.FrameSvgItem { id: frame - x: root.isPopup ? 0 : units.smallSpacing - y: root.isPopup ? 0 : units.smallSpacing + x: root.useListViewMode ? 0 : units.smallSpacing + y: root.useListViewMode ? 0 : units.smallSpacing width: { - if (root.isPopup) { + if (root.useListViewMode) { if (main.GridView.view.overflowing) { return parent.width - units.smallSpacing; } else { @@ -166,7 +166,7 @@ } height: { - if (root.isPopup) { + if (root.useListViewMode) { return parent.height; } @@ -189,18 +189,18 @@ id: icon anchors { - top: root.isPopup ? undefined : parent.top + top: root.useListViewMode ? undefined : parent.top topMargin: units.largeSpacing - left: root.isPopup ? parent.left : undefined + left: root.useListViewMode ? parent.left : undefined leftMargin: units.smallSpacing - horizontalCenter: root.isPopup ? undefined : parent.horizontalCenter - verticalCenter: root.isPopup ? parent.verticalCenter : undefined + horizontalCenter: root.useListViewMode ? undefined : parent.horizontalCenter + verticalCenter: root.useListViewMode ? parent.verticalCenter : undefined } width: main.GridView.view.iconSize height: main.GridView.view.iconSize - opacity: root.isPopup ? (1.3 - selectionButton.opacity) : 1.0 + opacity: root.useListViewMode ? (1.3 - selectionButton.opacity) : 1.0 animated: false usesPlasmaTheme: false @@ -241,16 +241,16 @@ id: label anchors { - top: root.isPopup ? undefined : icon.bottom + top: root.useListViewMode ? undefined : icon.bottom topMargin: 2 * units.smallSpacing - left: root.isPopup ? icon.right : undefined + left: root.useListViewMode ? icon.right : undefined leftMargin: units.smallSpacing * 2 - horizontalCenter: root.isPopup ? undefined : parent.horizontalCenter - verticalCenter: root.isPopup ? parent.verticalCenter : undefined + horizontalCenter: root.useListViewMode ? undefined : parent.horizontalCenter + verticalCenter: root.useListViewMode ? parent.verticalCenter : undefined } width: { - if (root.isPopup) { + if (root.useListViewMode) { return parent.width - icon.width - (units.smallSpacing * 4); } @@ -261,11 +261,11 @@ textFormat: Text.PlainText - maximumLineCount: root.isPopup ? 1 : plasmoid.configuration.textLines + maximumLineCount: root.useListViewMode ? 1 : plasmoid.configuration.textLines wrapMode: Text.Wrap elide: Text.ElideRight - horizontalAlignment: root.isPopup ? Text.AlignHLeft : Text.AlignHCenter + horizontalAlignment: root.useListViewMode ? Text.AlignHLeft : Text.AlignHCenter color: PlasmaCore.ColorScope.textColor @@ -282,7 +282,7 @@ y: units.smallSpacing * 3 anchors { - centerIn: root.isPopup ? icon : undefined + centerIn: root.useListViewMode ? icon : undefined } width: implicitWidth @@ -304,7 +304,7 @@ id: popupButtonComponent FolderItemActionButton { - visible: !root.isPopup + visible: !root.useListViewMode opacity: (plasmoid.configuration.popups && impl.hovered && impl.popupDialog == null) ? 1.0 : 0.0 diff --git a/containments/desktop/package/contents/ui/FolderView.qml b/containments/desktop/package/contents/ui/FolderView.qml --- a/containments/desktop/package/contents/ui/FolderView.qml +++ b/containments/desktop/package/contents/ui/FolderView.qml @@ -102,7 +102,7 @@ target: root onIsPopupChanged: { - if (upButton == null && root.isPopup) { + if (upButton == null && root.useListViewMode) { upButton = makeUpButton(); } else if (upButton != null) { upButton.destroy(); @@ -238,7 +238,7 @@ if (!(pos.x <= hoveredItem.actionsOverlay.width && pos.y <= hoveredItem.actionsOverlay.height)) { if (systemSettings.singleClick() || doubleClickInProgress) { - var func = root.isPopup && (mouse.button == Qt.LeftButton) && hoveredItem.isDir ? dir.cd : dir.run; + var func = root.useListViewMode && (mouse.button == Qt.LeftButton) && hoveredItem.isDir ? dir.cd : dir.run; func(positioner.map(gridView.currentIndex)); hoveredItem = null; @@ -318,7 +318,7 @@ clearPressState(); } else { // Disable rubberband in popup list view mode. - if (root.isPopup) { + if (root.useListViewMode) { return; } @@ -405,7 +405,7 @@ boundsBehavior: Flickable.StopAtBounds cellWidth: { - if (root.isPopup) { + if (root.useListViewMode) { return gridView.width; } @@ -413,7 +413,7 @@ } cellHeight: { - if (root.isPopup) { + if (root.useListViewMode) { return Math.ceil((Math.max(theme.mSize(theme.defaultFont).height, iconSize) + Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom, listItemSvg.margins.top + listItemSvg.margins.bottom)) / 2) * 2; @@ -554,7 +554,7 @@ } function makeIconSize() { - if (root.isPopup) { + if (root.useListViewMode) { return units.iconSizes.small; } @@ -650,7 +650,7 @@ Keys.onReturnPressed: { if (currentIndex != -1 && dir.hasSelection()) { - var func = root.isPopup ? dir.cd : dir.run; + var func = root.useListViewMode ? dir.cd : dir.run; func(positioner.map(currentIndex)); } } @@ -977,7 +977,7 @@ } Component.onCompleted: { - if (upButton == null && root.isPopup) { + if (upButton == null && root.useListViewMode) { upButton = makeUpButton(); } } diff --git a/containments/desktop/package/contents/ui/main.qml b/containments/desktop/package/contents/ui/main.qml --- a/containments/desktop/package/contents/ui/main.qml +++ b/containments/desktop/package/contents/ui/main.qml @@ -38,7 +38,7 @@ width: { if (isContainment || !folderViewLayer.ready) { return undefined; - } else if (isPopup) { + } else if (useListViewMode) { return units.gridUnit * 16; } @@ -48,7 +48,7 @@ height: { if (isContainment || !folderViewLayer.ready) { return undefined; - } else if (isPopup) { + } else if (useListViewMode) { var height = (folderViewLayer.view.cellHeight * 15) + units.smallSpacing; } else { var height = (folderViewLayer.view.cellHeight * 2) + units.largeSpacing @@ -64,6 +64,7 @@ property bool isFolder: (plasmoid.pluginName == "org.kde.plasma.folder") property bool isContainment: ("containmentType" in plasmoid) property bool isPopup: (plasmoid.location != PlasmaCore.Types.Floating) + property bool useListViewMode: isPopup && plasmoid.configuration.viewMode === 0 property Item toolBox property var layoutManager: LayoutManager