summaryrefslogtreecommitdiff
path: root/components/filedialog
diff options
context:
space:
mode:
Diffstat (limited to 'components/filedialog')
-rw-r--r--components/filedialog/CurrentItem.qml9
-rw-r--r--components/filedialog/FolderContents.qml25
2 files changed, 19 insertions, 15 deletions
diff --git a/components/filedialog/CurrentItem.qml b/components/filedialog/CurrentItem.qml
index b051212..bb87133 100644
--- a/components/filedialog/CurrentItem.qml
+++ b/components/filedialog/CurrentItem.qml
@@ -79,7 +79,14 @@ Item {
anchors.rightMargin: Appearance.padding.larger - Appearance.padding.small
anchors.bottomMargin: Appearance.padding.normal - Appearance.padding.small
- text: qsTr(`"%1" selected`).arg(root.currentItem?.modelData.name)
+ Connections {
+ target: root
+
+ function onCurrentItemChanged(): void {
+ if (root.currentItem)
+ content.text = qsTr(`"%1" selected`).arg(root.currentItem.modelData.name);
+ }
+ }
}
}
diff --git a/components/filedialog/FolderContents.qml b/components/filedialog/FolderContents.qml
index 3efa697..0c6f891 100644
--- a/components/filedialog/FolderContents.qml
+++ b/components/filedialog/FolderContents.qml
@@ -141,21 +141,17 @@ Item {
anchors.topMargin: Appearance.padding.normal
implicitSize: Sizes.itemWidth - Appearance.padding.normal * 2
- source: {
- const file = item.modelData;
- if (!file)
- return Quickshell.iconPath("application-x-zerosize");
+ Component.onCompleted: {
+ const file = item.modelData;
if (file.isImage)
- return Qt.resolvedUrl(file.path);
-
- if (!file.isDir)
- return Quickshell.iconPath(file.mimeType.replace("/", "-"), "application-x-zerosize");
-
- if (root.dialog.cwd.length === 1 && ["Desktop", "Documents", "Downloads", "Music", "Pictures", "Public", "Templates", "Videos"].includes(file.name))
- return Quickshell.iconPath(`folder-${file.name.toLowerCase()}`);
-
- return Quickshell.iconPath("inode-directory");
+ source = Qt.resolvedUrl(file.path);
+ else if (!file.isDir)
+ source = Quickshell.iconPath(file.mimeType.replace("/", "-"), "application-x-zerosize");
+ else if (root.dialog.cwd.length === 1 && ["Desktop", "Documents", "Downloads", "Music", "Pictures", "Public", "Templates", "Videos"].includes(file.name))
+ source = Quickshell.iconPath(`folder-${file.name.toLowerCase()}`);
+ else
+ source = Quickshell.iconPath("inode-directory");
}
}
@@ -169,9 +165,10 @@ Item {
anchors.margins: Appearance.padding.normal
horizontalAlignment: Text.AlignHCenter
- text: item.modelData?.name ?? ""
elide: item.GridView.isCurrentItem ? Text.ElideNone : Text.ElideRight
wrapMode: item.GridView.isCurrentItem ? Text.WrapAtWordBoundaryOrAnywhere : Text.NoWrap
+
+ Component.onCompleted: text = item.modelData.name
}
Behavior on implicitHeight {