Display filetags in file details window
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 11 Apr 2023 17:30:35 +0000 (01:30 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 16 May 2023 10:23:33 +0000 (18:23 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/filedetails/FileDetailsPage.qml

index ead5cd075c0c19026c52a67bb8b4a123b2151d60..1982beffbeaf1d1426053e0785b51cc50d75c6f5 100644 (file)
@@ -81,7 +81,19 @@ Page {
             Layout.topMargin: root.topPadding
 
             columns: root.showCloseButton ? 3 : 2
-            rows: showFileLockedString ? 3 : 2
+            rows: {
+                let rows = 2;
+
+                if (showFileLockedString) {
+                    rows++;
+                }
+
+                if (root.fileDetails.fileTagModel.totalTags > 0) {
+                    rows++;
+                }
+
+                return rows;
+            }
 
             rowSpacing: Style.standardSpacing / 2
             columnSpacing: Style.standardSpacing
@@ -154,6 +166,36 @@ Page {
                 wrapMode: Text.Wrap
                 visible: headerGridLayout.showFileLockedString
             }
+
+            RowLayout {
+                id: tagRow
+
+                Layout.fillWidth: true
+                Layout.rightMargin: headerGridLayout.textRightMargin
+
+                Repeater {
+                    id: tagRepeater
+
+                    readonly property var fileTagModel: root.fileDetails.fileTagModel
+
+                    model: fileTagModel
+                    delegate: FileTag {
+                        text: model.display
+                    }
+
+                    Component.onCompleted: fileTagModel.maxTags = 3
+                }
+
+                FileTag {
+                    id: overflowTag
+
+                    readonly property int totalFileTags: tagRepeater.fileTagModel.totalTags
+                    readonly property int maxFileTags: tagRepeater.fileTagModel.maxTags
+
+                    visible: totalFileTags > maxFileTags
+                    text: "+" + String(totalFileTags - maxFileTags)
+                }
+            }
         }
 
         TabBar {