Skip to content

Commit 99497cf

Browse files
authored
Merge pull request #9617 from nextcloud/bugfix/integration
Improve integration.
2 parents 85f3057 + 2116ce5 commit 99497cf

File tree

2 files changed

+41
-74
lines changed

2 files changed

+41
-74
lines changed

src/gui/integration/FileActionsWindow.qml

Lines changed: 39 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,42 @@ ApplicationWindow {
129129
spacing: Style.trayHorizontalMargin
130130
Layout.fillWidth: true
131131
Layout.fillHeight: true
132-
delegate: fileActionsDelegate
132+
delegate: ItemDelegate {
133+
id: fileActionsDelegate
134+
135+
required property string name
136+
required property int index
137+
required property string actionIcon
138+
139+
Layout.fillWidth: true
140+
height: implicitHeight
141+
width: parent.width
142+
implicitHeight: Style.activityListButtonHeight
143+
padding: Style.standardSpacing
144+
145+
text: name
146+
font.pixelSize: Style.defaultFontPtSize
147+
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
148+
icon {
149+
source: actionIcon
150+
color: palette.windowText
151+
width: Style.minimumActivityItemHeight
152+
height: Style.minimumActivityItemHeight
153+
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
154+
}
155+
156+
background: Rectangle {
157+
color: "transparent"
158+
radius: root.windowRadius
159+
border.width: fileActionsDelegate.hovered ? Style.trayWindowBorderWidth : 0
160+
border.color: palette.dark
161+
anchors.margins: Style.standardSpacing
162+
height: parent.height
163+
width: parent.width
164+
}
165+
166+
onClicked: fileActionModel.createRequest(index)
167+
}
133168
}
134169

135170
Button {
@@ -186,79 +221,11 @@ ApplicationWindow {
186221
id: responseArea
187222
anchors.fill: parent
188223
cursorShape: Qt.PointingHandCursor
189-
onClicked: Qt.openUrlExternally(fileActionModel.responseUrl)
190-
}
191-
}
192-
}
193-
}
194-
195-
Component {
196-
id: fileActionsDelegate
197-
198-
RowLayout {
199-
id: fileAction
200-
Layout.fillWidth: true
201-
height: implicitHeight
202-
width: parent.width
203-
204-
required property string name
205-
required property int index
206-
required property string icon
207-
208-
Button {
209-
id: fileActionButton
210-
flat: true
211-
Layout.fillWidth: true
212-
implicitHeight: Style.activityListButtonHeight
213-
214-
padding: Style.standardSpacing
215-
216-
contentItem: Row {
217-
id: fileActionsContent
218-
anchors.fill: parent
219-
anchors.topMargin: Style.standardSpacing
220-
anchors.rightMargin: Style.standardSpacing
221-
anchors.bottomMargin: Style.standardSpacing
222-
anchors.leftMargin: Style.extraSmallSpacing
223-
spacing: Style.standardSpacing
224-
Layout.fillWidth: true
225-
226-
Image {
227-
source: fileAction.icon + palette.windowText
228-
width: Style.minimumActivityItemHeight
229-
height: Style.minimumActivityItemHeight
230-
fillMode: Image.PreserveAspectFit
231-
Layout.preferredWidth: Style.minimumActivityItemHeight
232-
Layout.preferredHeight: Style.minimumActivityItemHeight
233-
anchors.verticalCenter: parent.verticalCenter
234-
}
235-
236-
EnforcedPlainTextLabel {
237-
text: fileAction.name
238-
color: palette.text
239-
font.pixelSize: Style.defaultFontPtSize
240-
verticalAlignment: Text.AlignVCenter
241-
anchors.verticalCenter: parent.verticalCenter
224+
onClicked: {
225+
Qt.openUrlExternally(fileActionModel.responseUrl)
226+
root.close()
242227
}
243228
}
244-
245-
background: Rectangle {
246-
color: "transparent"
247-
radius: root.windowRadius
248-
border.width: fileActionButton.hovered ? Style.trayWindowBorderWidth : 0
249-
border.color: palette.dark
250-
anchors.margins: Style.standardSpacing
251-
height: parent.height
252-
width: parent.width
253-
}
254-
255-
MouseArea {
256-
id: fileActionMouseArea
257-
anchors.fill: parent
258-
anchors.margins: Style.standardSpacing
259-
cursorShape: Qt.PointingHandCursor
260-
onClicked: fileActionModel.createRequest(fileAction.index)
261-
}
262229
}
263230
}
264231
}

src/gui/integration/fileactionsmodel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ int FileActionsModel::rowCount(const QModelIndex &parent) const
5959
QHash<int, QByteArray> FileActionsModel::roleNames() const
6060
{
6161
auto roles = QAbstractListModel::roleNames();
62-
roles[FileActionIconRole] = "icon";
62+
roles[FileActionIconRole] = "actionIcon";
6363
roles[FileActionNameRole] = "name";
6464
roles[FileActionUrlRole] = "url";
6565
roles[FileActionMethodRole] = "method";
@@ -325,7 +325,7 @@ QString FileActionsModel::parseIcon(const QString &icon) const
325325
return QStringLiteral("image://svgimage-custom-color/convert_to_text.svg/");
326326
}
327327

328-
return _accountUrl + icon;
328+
return QStringLiteral("image://tray-image-provider/") + _accountUrl + icon;
329329
}
330330

331331
void FileActionsModel::createRequest(const int row)

0 commit comments

Comments
 (0)