Skip to content

Commit

Permalink
Add button to scroll up the list on new item added.
Browse files Browse the repository at this point in the history
Signed-off-by: alex-z <blackslayer4@gmail.com>
  • Loading branch information
allexzander committed Sep 12, 2023
1 parent 374836c commit 691f08d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/gui/tray/ActivityList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ import com.nextcloud.desktopclient 1.0 as NC
ScrollView {
id: controlRoot
property alias model: sortedActivityList.sourceModel
property alias count: activityList.count
property alias contentY : activityList.contentY
property bool isFileActivityList: false
property int iconSize: Style.trayListItemIconSize
property int delegateHorizontalPadding: 0

function positionViewAtBeginning() {
activityList.positionViewAtBeginning()
}

signal openFile(string filePath)
signal activityItemClicked(int index)

Expand Down
40 changes: 40 additions & 0 deletions src/gui/tray/Window.qml
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,42 @@ ApplicationWindow {
anchors.right: trayWindowMainItem.right
}

Loader {
id: newActivitiesButton
anchors.bottom: activityList.bottom
anchors.bottomMargin: 20
width: 150
height: 40
anchors.horizontalCenter: activityList.horizontalCenter
z: 1

active: false

sourceComponent: CustomButton {
hoverEnabled: true
padding: Style.smallSpacing
display: Button.TextOnly

textColor: Style.currentUserHeaderTextColor
textColorHovered: Style.currentUserHeaderTextColor
contentsFont.bold: true
bgNormalColor: Qt.lighter(bgHoverColor, 1.25)
bgHoverColor: Style.currentUserHeaderColor
bgNormalOpacity: 1.0
bgHoverOpacity: 1.7

anchors.fill: parent

text: qsTr("New activities")
onClicked: {
activityList.positionViewAtBeginning();
newActivitiesButton.active = false;
}
}
}

ActivityList {
id: activityList
visible: !trayWindowMainItem.isUnifiedSearchActive
anchors.top: syncStatus.bottom
anchors.left: trayWindowMainItem.left
Expand All @@ -864,6 +899,11 @@ ApplicationWindow {
onActivityItemClicked: {
model.slotTriggerDefaultAction(index)
}
onCountChanged: {
if (contentY > 0) {
newActivitiesButton.active = true;
}
}
}
} // Item trayWindowMainItem
}
2 changes: 1 addition & 1 deletion theme/Style/Style.qml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ QtObject {
property int progressBarRadius: 4
property int progressBarContentBorderWidth: 1
property int progressBarBackgroundBorderWidth: 1
property color progressBarContentColor: buttonBackgroundColor
property color progressBarContentColor: ncBlue
property color progressBarContentBorderColor: menuBorder
property color progressBarBackgroundColor: backgroundColor
property color progressBarBackgroundBorderColor: menuBorder
Expand Down

0 comments on commit 691f08d

Please sign in to comment.