|
4 | 4 | */ |
5 | 5 |
|
6 | 6 | import QtQuick |
| 7 | +import QtQuick.Window |
7 | 8 | import QtQuick.Layouts |
8 | 9 | import QtQuick.Controls |
| 10 | +import Qt5Compat.GraphicalEffects |
9 | 11 |
|
10 | 12 | import com.nextcloud.desktopclient |
11 | 13 | import Style |
12 | 14 | import "../tray" |
| 15 | +import "../" |
13 | 16 |
|
14 | 17 | Page { |
15 | 18 | id: root |
16 | 19 |
|
17 | | - signal closeButtonClicked |
18 | | - |
19 | | - property var accountState: ({}) |
20 | | - property string localPath: "" |
21 | | - |
22 | | - // We want the SwipeView to "spill" over the edges of the window to really |
23 | | - // make it look nice. If we apply page-wide padding, however, the swipe |
24 | | - // contents only go as far as the page contents, clipped by the padding. |
25 | | - // This property reflects the padding we intend to display, but not the real |
26 | | - // padding, which we have to apply selectively to achieve our desired effect. |
27 | | - property int intendedPadding: Style.standardSpacing * 2 |
28 | | - property int iconSize: 32 |
29 | | - property StackView rootStackView: StackView {} |
30 | | - property bool showCloseButton: false |
31 | 20 | property bool backgroundsVisible: true |
32 | 21 | property color accentColor: Style.ncBlue |
33 | 22 |
|
34 | | - property FileDetails fileDetails: FileDetails { |
35 | | - id: fileDetails |
36 | | - localPath: root.localPath |
37 | | - } |
38 | | - |
39 | | - Connections { |
40 | | - target: Systray |
41 | | - function onShowFileDetailsPage(fileLocalPath, page) { |
42 | | - if (page == Systray.FileDetailsPage.Activity || page == Systray.FileDetailsPage.Sharing) { |
43 | | - return; |
44 | | - } |
45 | | - |
46 | | - if (fileLocalPath === root.localPath) { |
47 | | - switch(page) { |
48 | | - case Systray.FileDetailsPage.Activity: |
49 | | - swipeView.currentIndex = fileActivityView.swipeIndex; |
50 | | - break; |
51 | | - case Systray.FileDetailsPage.Sharing: |
52 | | - swipeView.currentIndex = shareViewLoader.swipeIndex; |
53 | | - break; |
54 | | - case Systray.FileDetailsPage.Actions: |
55 | | - swipeView.currentIndex = shareViewLoader.swipeIndex; |
56 | | - break; |
57 | | - } |
58 | | - } |
59 | | - } |
60 | | - } |
| 23 | + property FileDetails fileDetails: FileDetails {} |
| 24 | + property var shareModelData: ({}) |
| 25 | + property StackView rootStackView: StackView {} |
61 | 26 |
|
62 | | - topPadding: intendedPadding |
63 | | - bottomPadding: intendedPadding |
| 27 | + padding: Style.standardSpacing * 2 |
64 | 28 |
|
65 | 29 | background: Rectangle { |
66 | 30 | color: palette.base |
67 | 31 | visible: root.backgroundsVisible |
68 | 32 | } |
69 | 33 |
|
70 | | - header: ColumnLayout { |
71 | | - spacing: root.intendedPadding |
72 | | - |
73 | | - GridLayout { |
74 | | - id: headerGridLayout |
75 | | - |
76 | | - readonly property bool showFileLockedString: root.fileDetails.lockExpireString !== "" |
77 | | - readonly property int textRightMargin: root.showCloseButton ? root.intendedPadding : 0 |
78 | | - |
79 | | - Layout.fillWidth: parent |
80 | | - Layout.topMargin: root.topPadding |
81 | | - |
82 | | - columns: root.showCloseButton ? 3 : 2 |
83 | | - rows: { |
84 | | - let rows = 2; |
85 | | - |
86 | | - if (showFileLockedString) { |
87 | | - rows++; |
88 | | - } |
89 | | - |
90 | | - if (root.fileDetails.fileTagModel.totalTags > 0) { |
91 | | - rows++; |
92 | | - } |
93 | | - |
94 | | - return rows; |
95 | | - } |
96 | | - |
97 | | - rowSpacing: Style.standardSpacing / 2 |
98 | | - columnSpacing: Style.standardSpacing |
99 | | - |
100 | | - Image { |
101 | | - id: fileIcon |
102 | | - |
103 | | - Layout.rowSpan: headerGridLayout.rows |
104 | | - Layout.preferredWidth: Style.trayListItemIconSize |
105 | | - Layout.leftMargin: root.intendedPadding |
106 | | - Layout.fillHeight: true |
107 | | - |
108 | | - verticalAlignment: Image.AlignVCenter |
109 | | - horizontalAlignment: Image.AlignHCenter |
110 | | - source: root.fileDetails.iconUrl |
111 | | - sourceSize.width: Style.trayListItemIconSize |
112 | | - sourceSize.height: Style.trayListItemIconSize |
113 | | - fillMode: Image.PreserveAspectFit |
114 | | - } |
115 | | - |
116 | | - EnforcedPlainTextLabel { |
117 | | - id: fileNameLabel |
118 | | - |
119 | | - Layout.fillWidth: true |
120 | | - Layout.rightMargin: headerGridLayout.textRightMargin |
121 | | - |
122 | | - text: root.fileDetails.name |
123 | | - font.bold: true |
124 | | - wrapMode: Text.Wrap |
125 | | - } |
126 | | - |
127 | | - Button { |
128 | | - id: closeButton |
129 | | - |
130 | | - Layout.rowSpan: headerGridLayout.rows |
131 | | - Layout.preferredWidth: Style.activityListButtonWidth |
132 | | - Layout.preferredHeight: Style.activityListButtonHeight |
133 | | - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter |
134 | | - Layout.rightMargin: headerGridLayout.textRightMargin |
135 | | - |
136 | | - icon.source: "image://svgimage-custom-color/clear.svg" + "/" + palette.buttonText |
137 | | - icon.width: Style.activityListButtonIconSize |
138 | | - icon.height: Style.activityListButtonIconSize |
139 | | - visible: root.showCloseButton |
140 | | - onClicked: root.closeButtonClicked() |
141 | | - } |
| 34 | + RowLayout { |
| 35 | + Layout.fillWidth: true |
| 36 | + Layout.leftMargin: root.horizontalPadding |
| 37 | + Layout.rightMargin: root.horizontalPadding |
142 | 38 |
|
| 39 | + ColumnLayout { |
143 | 40 | EnforcedPlainTextLabel { |
144 | | - id: fileDetailsLabel |
145 | | - |
146 | | - Layout.fillWidth: true |
147 | | - Layout.rightMargin: headerGridLayout.textRightMargin |
148 | | - |
149 | | - text: `${root.fileDetails.sizeString} · ${root.fileDetails.lastChangedString}` |
150 | | - wrapMode: Text.Wrap |
| 41 | + text: root.localPath; |
151 | 42 | } |
152 | 43 |
|
153 | 44 | EnforcedPlainTextLabel { |
154 | | - id: fileLockedLabel |
155 | | - |
156 | | - Layout.fillWidth: true |
157 | | - Layout.rightMargin: headerGridLayout.textRightMargin |
158 | | - |
159 | | - text: root.fileDetails.lockExpireString |
160 | | - wrapMode: Text.Wrap |
161 | | - visible: headerGridLayout.showFileLockedString |
162 | | - } |
163 | | - |
164 | | - Row { |
165 | | - id: tagRow |
166 | | - |
167 | | - Layout.fillWidth: true |
168 | | - Layout.rightMargin: headerGridLayout.textRightMargin |
169 | | - |
170 | | - Repeater { |
171 | | - id: tagRepeater |
172 | | - |
173 | | - readonly property var fileTagModel: root.fileDetails.fileTagModel |
174 | | - readonly property int maxTags: 3 |
175 | | - |
176 | | - model: fileTagModel |
177 | | - delegate: FileTag { |
178 | | - readonly property int availableLayoutSpace: tagRow.width - tagRow.spacing - overflowTag.width |
179 | | - readonly property int maxWidth: (availableLayoutSpace / tagRepeater.maxTags) - tagRow.spacing |
180 | | - |
181 | | - width: Math.min(maxWidth, implicitWidth) |
182 | | - text: model.display |
183 | | - } |
184 | | - |
185 | | - Component.onCompleted: fileTagModel.maxTags = 3 |
186 | | - } |
187 | | - |
188 | | - FileTag { |
189 | | - id: overflowTag |
190 | | - |
191 | | - readonly property int totalFileTags: tagRepeater.fileTagModel.totalTags |
192 | | - readonly property int maxFileTags: tagRepeater.fileTagModel.maxTags |
193 | | - |
194 | | - visible: totalFileTags > maxFileTags |
195 | | - text: "+" + String(totalFileTags - maxFileTags) |
196 | | - |
197 | | - HoverHandler { |
198 | | - id: hoverHandler |
199 | | - } |
200 | | - |
201 | | - ToolTip { |
202 | | - visible: hoverHandler.hovered |
203 | | - text: tagRepeater.fileTagModel.overflowTagsString |
204 | | - } |
205 | | - } |
206 | | - } |
207 | | - } |
208 | | - |
209 | | - TabBar { |
210 | | - id: viewBar |
211 | | - |
212 | | - Layout.leftMargin: root.intendedPadding |
213 | | - Layout.rightMargin: root.intendedPadding |
214 | | - |
215 | | - padding: 0 |
216 | | - background: null |
217 | | - |
218 | | - NCTabButton { |
219 | | - svgCustomColorSource: "image://svgimage-custom-color/activity.svg" |
220 | | - text: qsTr("Activity") |
221 | | - checked: swipeView.currentIndex === fileActivityView.swipeIndex |
222 | | - onClicked: swipeView.currentIndex = fileActivityView.swipeIndex |
223 | | - } |
224 | | - |
225 | | - NCTabButton { |
226 | | - width: visible ? implicitWidth : 0 |
227 | | - height: visible ? implicitHeight : 0 |
228 | | - svgCustomColorSource: "image://svgimage-custom-color/share.svg" |
229 | | - text: qsTr("Sharing") |
230 | | - checked: swipeView.currentIndex === shareViewLoader.swipeIndex |
231 | | - onClicked: swipeView.currentIndex = shareViewLoader.swipeIndex |
232 | | - visible: root.fileDetails.sharingAvailable |
233 | | - } |
234 | | - } |
235 | | - } |
236 | | - |
237 | | - SwipeView { |
238 | | - id: swipeView |
239 | | - |
240 | | - anchors.fill: parent |
241 | | - clip: true |
242 | | - |
243 | | - FileActivityView { |
244 | | - id: fileActivityView |
245 | | - |
246 | | - readonly property int swipeIndex: SwipeView.index |
247 | | - |
248 | | - delegateHorizontalPadding: root.intendedPadding |
249 | | - |
250 | | - accountState: root.accountState |
251 | | - localPath: root.localPath |
252 | | - iconSize: root.iconSize |
253 | | - } |
254 | | - |
255 | | - Loader { |
256 | | - id: shareViewLoader |
257 | | - |
258 | | - readonly property int swipeIndex: SwipeView.index |
259 | | - |
260 | | - width: swipeView.width |
261 | | - height: swipeView.height |
262 | | - active: root.fileDetails.sharingAvailable |
263 | | - |
264 | | - sourceComponent: ShareView { |
265 | | - id: shareView |
266 | | - |
267 | | - anchors.fill: parent |
268 | | - |
269 | | - accountState: root.accountState |
270 | | - localPath: root.localPath |
271 | | - fileDetails: root.fileDetails |
272 | | - horizontalPadding: root.intendedPadding |
273 | | - iconSize: root.iconSize |
274 | | - rootStackView: root.rootStackView |
275 | | - backgroundsVisible: root.backgroundsVisible |
276 | | - accentColor: root.accentColor |
| 45 | + text: qsTr("TBD"); |
277 | 46 | } |
278 | 47 | } |
279 | 48 | } |
|
0 commit comments