diff --git a/src/gui/filedetails/FileDetailsPage.qml b/src/gui/filedetails/FileDetailsPage.qml index 85eb57c3fff3a..ead5cd075c0c1 100644 --- a/src/gui/filedetails/FileDetailsPage.qml +++ b/src/gui/filedetails/FileDetailsPage.qml @@ -23,6 +23,8 @@ import "../tray" Page { id: root + signal closeButtonClicked + property var accountState: ({}) property string localPath: "" @@ -34,6 +36,8 @@ Page { property int intendedPadding: Style.standardSpacing * 2 property int iconSize: 32 property StackView rootStackView: StackView {} + property bool showCloseButton: false + property bool backgroundsVisible: true property FileDetails fileDetails: FileDetails { id: fileDetails @@ -61,6 +65,7 @@ Page { background: Rectangle { color: Style.backgroundColor + visible: root.backgroundsVisible } header: ColumnLayout { @@ -70,11 +75,12 @@ Page { id: headerGridLayout readonly property bool showFileLockedString: root.fileDetails.lockExpireString !== "" + readonly property int textRightMargin: root.showCloseButton ? root.intendedPadding : 0 Layout.fillWidth: parent Layout.topMargin: root.topPadding - columns: 2 + columns: root.showCloseButton ? 3 : 2 rows: showFileLockedString ? 3 : 2 rowSpacing: Style.standardSpacing / 2 @@ -100,7 +106,7 @@ Page { id: fileNameLabel Layout.fillWidth: true - Layout.rightMargin: root.intendedPadding + Layout.rightMargin: headerGridLayout.textRightMargin text: root.fileDetails.name color: Style.ncTextColor @@ -108,11 +114,29 @@ Page { wrapMode: Text.Wrap } + CustomButton { + id: closeButton + + Layout.rowSpan: headerGridLayout.rows + Layout.preferredWidth: Style.iconButtonWidth + Layout.preferredHeight: width + Layout.rightMargin: headerGridLayout.textRightMargin + + imageSource: "image://svgimage-custom-color/clear.svg" + "/" + Style.ncTextColor + bgColor: Style.lightHover + bgNormalOpacity: 0 + toolTipText: qsTr("Dismiss") + + visible: root.showCloseButton + + onClicked: root.closeButtonClicked() + } + EnforcedPlainTextLabel { id: fileDetailsLabel Layout.fillWidth: true - Layout.rightMargin: root.intendedPadding + Layout.rightMargin: headerGridLayout.textRightMargin text: `${root.fileDetails.sizeString} ยท ${root.fileDetails.lastChangedString}` color: Style.ncSecondaryTextColor @@ -123,7 +147,7 @@ Page { id: fileLockedLabel Layout.fillWidth: true - Layout.rightMargin: root.intendedPadding + Layout.rightMargin: headerGridLayout.textRightMargin text: root.fileDetails.lockExpireString color: Style.ncSecondaryTextColor @@ -188,6 +212,7 @@ Page { horizontalPadding: root.intendedPadding iconSize: root.iconSize rootStackView: root.rootStackView + backgroundsVisible: root.backgroundsVisible } } } diff --git a/src/gui/filedetails/FileDetailsView.qml b/src/gui/filedetails/FileDetailsView.qml index 8c9edbaf5a817..de5fec16e399a 100644 --- a/src/gui/filedetails/FileDetailsView.qml +++ b/src/gui/filedetails/FileDetailsView.qml @@ -22,14 +22,24 @@ import Style 1.0 StackView { id: root - property var accountState: ({}) - property string localPath: "" + signal closeButtonClicked + + property alias accountState: fileDetailsPage.accountState + property alias localPath: fileDetailsPage.localPath + property alias showCloseButton: fileDetailsPage.showCloseButton + property bool backgroundsVisible: true + + background: Rectangle { + color: Style.backgroundColor + visible: root.backgroundsVisible + } initialItem: FileDetailsPage { + id: fileDetailsPage width: parent.width height: parent.height - accountState: root.accountState - localPath: root.localPath + backgroundsVisible: root.backgroundsVisible rootStackView: root + onCloseButtonClicked: root.closeButtonClicked() } } diff --git a/src/gui/filedetails/ShareDelegate.qml b/src/gui/filedetails/ShareDelegate.qml index 2f0f324056830..5768cc44de347 100644 --- a/src/gui/filedetails/ShareDelegate.qml +++ b/src/gui/filedetails/ShareDelegate.qml @@ -47,6 +47,7 @@ GridLayout { property int iconSize: 32 property FileDetails fileDetails: FileDetails {} property StackView rootStackView: StackView {} + property bool backgroundsVisible: true property bool canCreateLinkShares: true @@ -221,6 +222,7 @@ GridLayout { width: parent.width height: parent.height + backgroundsVisible: root.backgroundsVisible fileDetails: root.fileDetails shareModelData: model diff --git a/src/gui/filedetails/ShareDetailsPage.qml b/src/gui/filedetails/ShareDetailsPage.qml index 3b52cac308b56..9c5618fece24c 100644 --- a/src/gui/filedetails/ShareDetailsPage.qml +++ b/src/gui/filedetails/ShareDetailsPage.qml @@ -41,6 +41,8 @@ Page { signal setPassword(string password) signal setNote(string note) + property bool backgroundsVisible: true + property FileDetails fileDetails: FileDetails {} property var shareModelData: ({}) @@ -177,6 +179,7 @@ Page { background: Rectangle { color: Style.backgroundColor + visible: root.backgroundsVisible } header: ColumnLayout { diff --git a/src/gui/filedetails/ShareView.qml b/src/gui/filedetails/ShareView.qml index 8bc90ba66ad83..e2cb0d658d912 100644 --- a/src/gui/filedetails/ShareView.qml +++ b/src/gui/filedetails/ShareView.qml @@ -30,6 +30,7 @@ ColumnLayout { property FileDetails fileDetails: FileDetails {} property int horizontalPadding: 0 property int iconSize: 32 + property bool backgroundsVisible: true readonly property bool sharingPossible: shareModel && shareModel.canShare && shareModel.sharingEnabled readonly property bool userGroupSharingPossible: sharingPossible && shareModel.userGroupSharingEnabled @@ -225,6 +226,7 @@ ColumnLayout { iconSize: root.iconSize fileDetails: root.fileDetails rootStackView: root.rootStackView + backgroundsVisible: root.backgroundsVisible canCreateLinkShares: root.publicLinkSharingPossible onCreateNewLinkShare: { diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index f9106ea8d6939..c45b870b09cb9 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -382,6 +382,18 @@ void Systray::createFileActivityDialog(const QString &localPath) Q_EMIT showFileDetailsPage(localPath, FileDetailsPage::Activity); } +void Systray::presentShareViewInTray(const QString &localPath) +{ + const auto folder = FolderMan::instance()->folderForPath(localPath); + if (!folder) { + qCWarning(lcSystray) << "Could not open file details view in tray for" << localPath << "no responsible folder found"; + return; + } + qCDebug(lcSystray) << "Opening file details view in tray for " << localPath; + + Q_EMIT showFileDetails(folder->accountState(), localPath, FileDetailsPage::Sharing); +} + void Systray::slotCurrentUserChanged() { if (_trayEngine) { diff --git a/src/gui/systray.h b/src/gui/systray.h index e2d4d738820aa..99a18296dff1c 100644 --- a/src/gui/systray.h +++ b/src/gui/systray.h @@ -102,6 +102,7 @@ class Systray void shutdown(); void showFileDetailsPage(const QString &fileLocalPath, const OCC::Systray::FileDetailsPage page); + void showFileDetails(AccountState *accountState, const QString &localPath, const OCC::Systray::FileDetailsPage fileDetailsPage); void sendChatMessage(const QString &token, const QString &message, const QString &replyTo); void showErrorMessageDialog(const QString &error); @@ -141,6 +142,8 @@ public slots: void createShareDialog(const QString &localPath); void createFileActivityDialog(const QString &localPath); + void presentShareViewInTray(const QString &localPath); + private slots: void slotUnpauseAllFolders(); void slotPauseAllFolders(); diff --git a/src/gui/tray/ActivityItem.qml b/src/gui/tray/ActivityItem.qml index 09e847a78a198..ebbac6e5a24ca 100644 --- a/src/gui/tray/ActivityItem.qml +++ b/src/gui/tray/ActivityItem.qml @@ -51,8 +51,6 @@ ItemDelegate { activityData: model - onShareButtonClicked: Systray.createShareDialog(model.openablePath) - onDismissButtonClicked: activityModel.slotTriggerDismiss(model.activityIndex) } diff --git a/src/gui/tray/ActivityItemActions.qml b/src/gui/tray/ActivityItemActions.qml index 1b7ffc4f9b58b..908aab9d6b372 100644 --- a/src/gui/tray/ActivityItemActions.qml +++ b/src/gui/tray/ActivityItemActions.qml @@ -89,17 +89,6 @@ RowLayout { moreActionsButtonContextMenu.close(); } } - - ActivityItemContextMenu { - id: moreActionsButtonContextMenu - - maxActionButtons: root.maxActionButtons - linksContextMenu: root.linksContextMenu - - onMenuEntryTriggered: function(entryIndex) { - root.triggerAction(entryIndex) - } - } } } } diff --git a/src/gui/tray/ActivityItemContent.qml b/src/gui/tray/ActivityItemContent.qml index 6a049ca9dc7e4..88caedaea48c6 100644 --- a/src/gui/tray/ActivityItemContent.qml +++ b/src/gui/tray/ActivityItemContent.qml @@ -15,12 +15,11 @@ RowLayout { property bool showDismissButton: false - property bool childHovered: shareButton.hovered || dismissActionButton.hovered + property bool childHovered: fileDetailsButton.hovered || dismissActionButton.hovered property int iconSize: Style.trayListItemIconSize signal dismissButtonClicked() - signal shareButtonClicked() spacing: Style.trayHorizontalMargin @@ -182,7 +181,7 @@ RowLayout { Layout.preferredWidth: Style.trayListItemIconSize Layout.preferredHeight: Style.trayListItemIconSize - visible: root.showDismissButton && !shareButton.visible + visible: root.showDismissButton && !fileDetailsButton.visible imageSource: "image://svgimage-custom-color/clear.svg" + "/" + Style.ncTextColor imageSourceHover: "image://svgimage-custom-color/clear.svg" + "/" + UserModel.currentUser.headerTextColor @@ -195,20 +194,18 @@ RowLayout { } CustomButton { - id: shareButton + id: fileDetailsButton Layout.preferredWidth: Style.trayListItemIconSize Layout.preferredHeight: Style.trayListItemIconSize - visible: root.activityData.isShareable - - imageSource: "image://svgimage-custom-color/share.svg" + "/" + Style.adjustedCurrentUserHeaderColor - imageSourceHover: "image://svgimage-custom-color/share.svg" + "/" + Style.currentUserHeaderTextColor - - toolTipText: qsTr("Open share dialog") - + imageSource: "image://svgimage-custom-color/more.svg" + "/" + Style.adjustedCurrentUserHeaderColor + imageSourceHover: "image://svgimage-custom-color/more.svg" + "/" + Style.currentUserHeaderTextColor + toolTipText: qsTr("Open file details") bgColor: Style.currentUserHeaderColor - onClicked: root.shareButtonClicked() + visible: model.showFileDetails + + onClicked: Systray.presentShareViewInTray(model.openablePath) } } diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index f363bc5c31b8b..356479f30bbef 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -4,7 +4,9 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.2 import QtGraphicalEffects 1.0 import Qt.labs.platform 1.1 as NativeDialogs + import "../" +import "../filedetails/" // Custom qml modules are in /theme (and included by resources.qrc) import Style 1.0 @@ -76,6 +78,7 @@ ApplicationWindow { function onIsOpenChanged() { userStatusDrawer.close() + fileDetailsDrawer.close(); if(Systray.isOpen) { accountMenu.close(); @@ -88,6 +91,10 @@ ApplicationWindow { newErrorDialog.text = error newErrorDialog.open() } + + function onShowFileDetails(accountState, localPath, fileDetailsPage) { + fileDetailsDrawer.openFileDetails(accountState, localPath, fileDetailsPage); + } } OpacityMask { @@ -140,6 +147,64 @@ ApplicationWindow { } } + Drawer { + id: fileDetailsDrawer + width: parent.width - Style.trayDrawerMargin + height: parent.height + padding: 0 + edge: Qt.RightEdge + modal: true + visible: false + clip: true + + background: Rectangle { + radius: Systray.useNormalWindow ? 0.0 : Style.trayWindowRadius + border.width: Style.trayWindowBorderWidth + border.color: Style.menuBorder + color: Style.backgroundColor + } + + property var folderAccountState: ({}) + property string fileLocalPath: "" + property var pageToShow: Systray.FileDetailsPage.Activity + + function openFileDetails(accountState, localPath, fileDetailsPage) { + console.log(`About to show file details view in tray for ${localPath}`); + folderAccountState = accountState; + fileLocalPath = localPath; + pageToShow = fileDetailsPage; + + if(!opened) { + open(); + } + } + + Loader { + id: fileDetailsContents + anchors.fill: parent + active: fileDetailsDrawer.visible + onActiveChanged: { + if (active) { + Systray.showFileDetailsPage(fileDetailsDrawer.fileLocalPath, + fileDetailsDrawer.pageToShow); + } + } + sourceComponent: FileDetailsView { + id: fileDetails + + width: parent.width + height: parent.height + + backgroundsVisible: false + accountState: fileDetailsDrawer.folderAccountState + localPath: fileDetailsDrawer.fileLocalPath + showCloseButton: true + + onCloseButtonClicked: fileDetailsDrawer.close() + } + } + } + Item { id: trayWindowMainItem diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index 352f23a559e28..5e16645d6a75e 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -76,7 +76,7 @@ QHash ActivityListModel::roleNames() const roles[ObjectNameRole] = "objectName"; roles[PointInTimeRole] = "dateTime"; roles[DisplayActions] = "displayActions"; - roles[ShareableRole] = "isShareable"; + roles[ShowFileDetailsRole] = "showFileDetails"; roles[IsCurrentUserFileActivityRole] = "isCurrentUserFileActivity"; roles[IsCurrentUserFileActivityRole] = "isCurrentUserFileActivity"; roles[ThumbnailRole] = "thumbnail"; @@ -342,7 +342,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const return (ast && ast->isConnected()); case DisplayActions: return _displayActions; - case ShareableRole: + case ShowFileDetailsRole: return !data(index, PathRole).toString().isEmpty() && a._objectType == QStringLiteral("files") && _displayActions && diff --git a/src/gui/tray/activitylistmodel.h b/src/gui/tray/activitylistmodel.h index 3ec5955557683..17f1557db9fcd 100644 --- a/src/gui/tray/activitylistmodel.h +++ b/src/gui/tray/activitylistmodel.h @@ -65,7 +65,7 @@ class ActivityListModel : public QAbstractListModel PointInTimeRole, AccountConnectedRole, DisplayActions, - ShareableRole, + ShowFileDetailsRole, IsCurrentUserFileActivityRole, ThumbnailRole, TalkNotificationConversationTokenRole,