Skip to content

Commit 8f783b2

Browse files
committed
fix: file actions page.
Signed-off-by: Camila Ayres <[email protected]>
1 parent 63597af commit 8f783b2

File tree

4 files changed

+29
-261
lines changed

4 files changed

+29
-261
lines changed

resources.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,6 @@
6666
<file>src/gui/macOS/ui/FileProviderSyncStatus.qml</file>
6767
<file>src/gui/macOS/ui/FileProviderStorageInfo.qml</file>
6868
<file>src/gui/filedetails/FileActionsView.qml</file>
69+
<file>src/gui/filedetails/FileActionsPage.qml</file>
6970
</qresource>
7071
</RCC>

src/gui/filedetails/FileActionsPage.qml

Lines changed: 14 additions & 245 deletions
Original file line numberDiff line numberDiff line change
@@ -4,276 +4,45 @@
44
*/
55

66
import QtQuick
7+
import QtQuick.Window
78
import QtQuick.Layouts
89
import QtQuick.Controls
10+
import Qt5Compat.GraphicalEffects
911

1012
import com.nextcloud.desktopclient
1113
import Style
1214
import "../tray"
15+
import "../"
1316

1417
Page {
1518
id: root
1619

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
3120
property bool backgroundsVisible: true
3221
property color accentColor: Style.ncBlue
3322

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 {}
6126

62-
topPadding: intendedPadding
63-
bottomPadding: intendedPadding
27+
padding: Style.standardSpacing * 2
6428

6529
background: Rectangle {
6630
color: palette.base
6731
visible: root.backgroundsVisible
6832
}
6933

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
14238

39+
ColumnLayout {
14340
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;
15142
}
15243

15344
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");
27746
}
27847
}
27948
}

src/gui/filedetails/FileActionsView.qml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,29 @@ import Style
1212
import "../tray"
1313
import "../"
1414

15-
ColumnLayout {
15+
StackView {
1616
id: root
1717

18+
signal closeButtonClicked
19+
1820
property string localPath: ""
1921
property var accountState: ({})
2022
property FileDetails fileDetails: FileDetails {}
21-
property int horizontalPadding: 0
2223
property int iconSize: 32
2324
property bool backgroundsVisible: true
2425
property color accentColor: Style.ncBlue
2526
property StackView rootStackView: StackView {}
2627

27-
RowLayout {
28-
Layout.fillWidth: true
29-
Layout.leftMargin: root.horizontalPadding
30-
Layout.rightMargin: root.horizontalPadding
31-
32-
ColumnLayout {
33-
EnforcedPlainTextLabel {
34-
text: root.localPath;
35-
}
28+
background: Rectangle {
29+
color: palette.base
30+
visible: root.backgroundsVisible
31+
}
3632

37-
EnforcedPlainTextLabel {
38-
text: qsTr("TBD");
39-
}
40-
}
33+
initialItem: FileActionsPage {
34+
id: fileDetailsPage
35+
width: root.width
36+
height: root.height
37+
backgroundsVisible: root.backgroundsVisible
38+
rootStackView: root
4139
}
4240
}

src/gui/filedetails/FileDetailsPage.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Page {
5656
swipeView.currentIndex = shareViewLoader.swipeIndex;
5757
break;
5858
case Systray.FileDetailsPage.Actions:
59-
swipeView.currentIndex = shareViewLoader.swipeIndex;
59+
swipeView.currentIndex = fileActionsViewLoader.swipeIndex;
6060
break;
6161
}
6262
}

0 commit comments

Comments
 (0)