mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-23 21:05:44 +03:00
Add basic FileProviderFileDelegate UI component
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
b3c75750ab
commit
da20e7e179
3 changed files with 117 additions and 2 deletions
|
@ -63,6 +63,7 @@
|
|||
<file>src/gui/ConflictDelegate.qml</file>
|
||||
<file>src/gui/ConflictItemFileInfo.qml</file>
|
||||
<file>src/gui/macOS/ui/FileProviderSettings.qml</file>
|
||||
<file>src/gui/macOS/ui/FileProviderFileDelegate.qml</file>
|
||||
<file>src/gui/macOS/ui/FileProviderEvictionDialog.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -36,8 +36,9 @@ ApplicationWindow {
|
|||
ListView {
|
||||
anchors.fill: parent
|
||||
model: root.materialisedItemsModel
|
||||
delegate: Text {
|
||||
text: model.display
|
||||
delegate: FileProviderFileDelegate {
|
||||
width: parent.width
|
||||
height: 60
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
113
src/gui/macOS/ui/FileProviderFileDelegate.qml
Normal file
113
src/gui/macOS/ui/FileProviderFileDelegate.qml
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright (C) 2023 by Claudio Cambra <claudio.cambra@nextcloud.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import Style 1.0
|
||||
import "../../filedetails"
|
||||
import "../../tray"
|
||||
|
||||
import com.nextcloud.desktopclient 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
// Match with model rolenames for automagic setting of properties
|
||||
required property string fileName
|
||||
required property string userVisiblePath
|
||||
required property string fileType
|
||||
|
||||
required property size documentSize
|
||||
|
||||
GridLayout {
|
||||
id: internalLayout
|
||||
|
||||
anchors.fill: parent
|
||||
rows: 3
|
||||
columns: 4
|
||||
|
||||
Image {
|
||||
id: fileIconImage
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.row: 0
|
||||
Layout.rowSpan: internalLayout.rows
|
||||
Layout.column: 0
|
||||
|
||||
verticalAlignment: Image.AlignVCenter
|
||||
horizontalAlignment: Image.AlignHCenter
|
||||
source: "image://tray-image-provider/:/fileicon/" + root.userVisiblePath
|
||||
sourceSize.width: Style.trayListItemIconSize
|
||||
sourceSize.height: Style.trayListItemIconSize
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
|
||||
EnforcedPlainTextLabel {
|
||||
id: fileNameLabel
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.row: 0
|
||||
Layout.column: 1
|
||||
Layout.columnSpan: 2
|
||||
|
||||
text: root.fileName
|
||||
}
|
||||
|
||||
CustomButton {
|
||||
id: deleteButton
|
||||
|
||||
Layout.preferredWidth: width
|
||||
Layout.minimumWidth: implicitWidth
|
||||
Layout.fillHeight: true
|
||||
Layout.row: 0
|
||||
Layout.rowSpan: internalLayout.rows
|
||||
Layout.column: 2
|
||||
|
||||
text: qsTr("Delete")
|
||||
bgColor: Style.errorBoxBackgroundColor
|
||||
}
|
||||
|
||||
EnforcedPlainTextLabel {
|
||||
id: pathLabel
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.row: 1
|
||||
Layout.column: 1
|
||||
Layout.columnSpan: 2
|
||||
|
||||
text: root.userVisiblePath
|
||||
}
|
||||
|
||||
EnforcedPlainTextLabel {
|
||||
id: fileSizeLabel
|
||||
|
||||
Layout.row: 2
|
||||
Layout.column: 1
|
||||
|
||||
text: root.documentSize
|
||||
}
|
||||
|
||||
EnforcedPlainTextLabel {
|
||||
id: fileTypeLabel
|
||||
|
||||
Layout.row: 2
|
||||
Layout.column: 2
|
||||
|
||||
text: root.fileType
|
||||
color: Style.ncSecondaryTextColor
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue