Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,20 +1039,8 @@ void AccountSettings::slotScheduleCurrentFolderForceRemoteDiscovery()
void AccountSettings::slotForceSyncCurrentFolder()
{
FolderMan *folderMan = FolderMan::instance();
if (auto selectedFolder = folderMan->folder(selectedFolderAlias())) {
// Terminate and reschedule any running sync
for (auto f : folderMan->map()) {
if (f->isSyncRunning()) {
f->slotTerminateSync();
folderMan->scheduleFolder(f);
}
}

selectedFolder->slotWipeErrorBlacklist(); // issue #6757

// Insert the selected folder at the front of the queue
folderMan->scheduleFolderNext(selectedFolder);
}
auto selectedFolder = folderMan->folder(selectedFolderAlias());
folderMan->forceSyncForFolder(selectedFolder);
}

void AccountSettings::slotOpenOC()
Expand Down
15 changes: 15 additions & 0 deletions src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,21 @@ void FolderMan::scheduleAllFolders()
}
}

void FolderMan::forceSyncForFolder(Folder *folder)
{
// Terminate and reschedule any running sync
for (const auto folderInMap : map()) {
if (folderInMap->isSyncRunning()) {
folderInMap->slotTerminateSync();
scheduleFolder(folderInMap);
}
}

folder->slotWipeErrorBlacklist(); // issue #6757
// Insert the selected folder at the front of the queue
scheduleFolderNext(folder);
}

void FolderMan::slotScheduleAppRestart()
{
_appRestartRequired = true;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/folderman.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ public slots:
/** Wipe folder */
void slotWipeFolderForAccount(AccountState *accountState);

void forceSyncForFolder(Folder *folder);

private slots:
void slotFolderSyncPaused(Folder *, bool paused);
void slotFolderCanSyncChanged();
Expand Down
6 changes: 3 additions & 3 deletions src/gui/tray/ActivityActionButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ AbstractButton {
property string imageSource: ""
property string imageSourceHover: ""

property color adjustedHeaderColor: Style.ncBlue
property color adjustedHeaderColor: Style.adjustedCurrentUserHeaderColor
property color textColor: primaryButton ? adjustedHeaderColor : Style.ncTextColor
property color textColorHovered: primaryButton ? UserModel.currentUser.headerTextColor : Style.ncTextColor
property color textColorHovered: primaryButton ? Style.currentUserHeaderTextColor : Style.ncTextColor

property string verb: ""
property bool isTalkReplyButton: false


background: NCButtonBackground {
color: UserModel.currentUser.headerColor
color: Style.currentUserHeaderColor
hovered: root.hovered
visible: root.primaryButton
}
Expand Down
8 changes: 1 addition & 7 deletions src/gui/tray/ActivityItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ ItemDelegate {
readonly property bool isTalkReplyPossible: model.conversationToken !== ""
property bool isTalkReplyOptionVisible: model.messageSent !== ""

property color adjustedHeaderColor: Theme.darkMode ? Qt.lighter(UserModel.currentUser.headerColor, 2)
: Qt.darker(UserModel.currentUser.headerColor, 1.5)

enabled: (model.path !== "" || model.link !== "" || model.links.length > 0 || model.isCurrentUserFileActivity === true)
padding: Style.standardSpacing

Expand Down Expand Up @@ -50,8 +47,6 @@ ItemDelegate {

activityData: model

adjustedHeaderColor: root.adjustedHeaderColor

onShareButtonClicked: Systray.openShareDialog(model.displayPath, model.path)

onDismissButtonClicked: activityModel.slotTriggerDismiss(model.activityIndex)
Expand Down Expand Up @@ -92,9 +87,8 @@ ItemDelegate {

flickable: root.flickable

adjustedHeaderColor: root.adjustedHeaderColor

onTriggerAction: activityModel.slotTriggerAction(model.activityIndex, actionIndex)

onShowReplyField: root.isTalkReplyOptionVisible = true
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/gui/tray/ActivityItemActions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ RowLayout {
property bool displayActions: false

property color moreActionsButtonColor: "transparent"
property color adjustedHeaderColor: "transparent"

property int maxActionButtons: 0

Expand All @@ -43,10 +42,10 @@ RowLayout {

text: model.modelData.label

adjustedHeaderColor: root.adjustedHeaderColor
adjustedHeaderColor: Style.adjustedCurrentUserHeaderColor

imageSource: model.modelData.imageSource ? model.modelData.imageSource + root.adjustedHeaderColor : ""
imageSourceHover: model.modelData.imageSourceHovered ? model.modelData.imageSourceHovered + UserModel.currentUser.headerTextColor : ""
imageSource: model.modelData.imageSource ? model.modelData.imageSource + Style.adjustedCurrentUserHeaderColor : ""
imageSourceHover: model.modelData.imageSourceHovered ? model.modelData.imageSourceHovered + Style.currentUserHeaderTextColor : ""

onClicked: isTalkReplyButton ? root.showReplyField() : root.triggerAction(model.index)
}
Expand Down
8 changes: 3 additions & 5 deletions src/gui/tray/ActivityItemContent.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ RowLayout {

property bool childHovered: shareButton.hovered || dismissActionButton.hovered

property color adjustedHeaderColor: "transparent"

signal dismissButtonClicked()
signal shareButtonClicked()

Expand Down Expand Up @@ -206,12 +204,12 @@ RowLayout {

visible: root.activityData.isShareable

imageSource: "image://svgimage-custom-color/share.svg" + "/" + root.adjustedHeaderColor
imageSourceHover: "image://svgimage-custom-color/share.svg" + "/" + UserModel.currentUser.headerTextColor
imageSource: "image://svgimage-custom-color/share.svg" + "/" + Style.adjustedCurrentUserHeaderColor
imageSourceHover: "image://svgimage-custom-color/share.svg" + "/" + Style.currentUserHeaderTextColor

toolTipText: qsTr("Open share dialog")

bgColor: UserModel.currentUser.headerColor
bgColor: Style.currentUserHeaderColor

onClicked: root.shareButtonClicked()
}
Expand Down
1 change: 1 addition & 0 deletions src/gui/tray/CustomButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Button {

leftPadding: root.text === "" ? 5 : 10
rightPadding: root.text === "" ? 5 : 10
implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding

NCToolTip {
text: root.toolTipText
Expand Down
2 changes: 1 addition & 1 deletion src/gui/tray/HeaderButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Button {
Layout.preferredHeight: Style.trayWindowHeaderHeight

background: Rectangle {
color: root.hovered || root.visualFocus ? UserModel.currentUser.headerTextColor : "transparent"
color: root.hovered || root.visualFocus ? Style.currentUserHeaderTextColor : "transparent"
opacity: 0.2
}
}
32 changes: 29 additions & 3 deletions src/gui/tray/SyncStatus.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Style 1.0
import com.nextcloud.desktopclient 1.0 as NC

RowLayout {
id: layout
id: root

property alias model: syncStatus

Expand Down Expand Up @@ -49,7 +49,7 @@ RowLayout {

Text {
id: syncProgressText

Layout.fillWidth: true

text: syncStatus.syncStatusString
Expand All @@ -64,7 +64,7 @@ RowLayout {

active: syncStatus.syncing
visible: syncStatus.syncing

sourceComponent: ProgressBar {
id: syncProgressBar

Expand Down Expand Up @@ -98,4 +98,30 @@ RowLayout {
font.pixelSize: Style.subLinePixelSize
}
}

CustomButton {
FontMetrics {
id: syncNowFm
font.bold: true
}

Layout.preferredWidth: syncNowFm.boundingRect(text).width + leftPadding + rightPadding
Layout.rightMargin: Style.trayHorizontalMargin

FontMetrics { font.bold: true }

text: qsTr("Sync now")
textColor: Style.adjustedCurrentUserHeaderColor
textColorHovered: Style.currentUserHeaderTextColor
bold: true
bgColor: Style.currentUserHeaderColor

visible: !syncStatus.syncing && NC.UserModel.currentUser.hasLocalFolder
enabled: visible
onClicked: {
if(!syncStatus.syncing) {
NC.UserModel.currentUser.forceSyncNow();
}
}
}
}
24 changes: 12 additions & 12 deletions src/gui/tray/Window.qml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ ApplicationWindow {
anchors.right: trayWindowMainItem.right
anchors.top: trayWindowMainItem.top
height: Style.trayWindowHeaderHeight
color: UserModel.currentUser.headerColor
color: Style.currentUserHeaderColor

RowLayout {
id: trayWindowHeaderLayout
Expand Down Expand Up @@ -383,7 +383,7 @@ ApplicationWindow {
}

background: Rectangle {
color: parent.hovered || parent.visualFocus ? UserModel.currentUser.headerTextColor : "transparent"
color: parent.hovered || parent.visualFocus ? Style.currentUserHeaderTextColor : "transparent"
opacity: 0.2
}

Expand Down Expand Up @@ -415,7 +415,7 @@ ApplicationWindow {
height: width
anchors.bottom: currentAccountAvatar.bottom
anchors.right: currentAccountAvatar.right
color: UserModel.currentUser.headerColor
color: Style.currentUserHeaderColor
radius: width*0.5
}

Expand All @@ -427,7 +427,7 @@ ApplicationWindow {
height: width
anchors.bottom: currentAccountAvatar.bottom
anchors.right: currentAccountAvatar.right
color: currentAccountButton.hovered ? UserModel.currentUser.headerTextColor : "transparent"
color: currentAccountButton.hovered ? Style.currentUserHeaderTextColor : "transparent"
opacity: 0.2
radius: width*0.5
}
Expand Down Expand Up @@ -463,7 +463,7 @@ ApplicationWindow {
text: UserModel.currentUser.name
textFormat: Text.PlainText
elide: Text.ElideRight
color: UserModel.currentUser.headerTextColor
color: Style.currentUserHeaderTextColor

font.pixelSize: Style.topLinePixelSize
font.bold: true
Expand Down Expand Up @@ -494,15 +494,15 @@ ApplicationWindow {
: UserModel.currentUser.server
textFormat: Text.PlainText
elide: Text.ElideRight
color: UserModel.currentUser.headerTextColor
color: Style.currentUserHeaderTextColor
font.pixelSize: Style.subLinePixelSize
}
}
}

ColorOverlay {
cached: true
color: UserModel.currentUser.headerTextColor
color: Style.currentUserHeaderTextColor
width: source.width
height: source.height
source: Image {
Expand Down Expand Up @@ -538,7 +538,7 @@ ApplicationWindow {
id: openLocalFolderButton
visible: UserModel.currentUser.hasLocalFolder
icon.source: "qrc:///client/theme/white/folder.svg"
icon.color: UserModel.currentUser.headerTextColor
icon.color: Style.currentUserHeaderTextColor
onClicked: UserModel.openCurrentAccountLocalFolder()

Image {
Expand All @@ -563,7 +563,7 @@ ApplicationWindow {
width: Style.folderStateIndicatorSize + 2
height: width
anchors.centerIn: parent
color: UserModel.currentUser.headerColor
color: Style.currentUserHeaderColor
radius: width*0.5
z: -2
}
Expand All @@ -573,7 +573,7 @@ ApplicationWindow {
width: Style.folderStateIndicatorSize + 2
height: width
anchors.centerIn: parent
color: openLocalFolderButton.hovered ? UserModel.currentUser.headerTextColor : "transparent"
color: openLocalFolderButton.hovered ? Style.currentUserHeaderTextColor : "transparent"
opacity: 0.2
radius: width*0.5
z: -1
Expand All @@ -587,7 +587,7 @@ ApplicationWindow {

visible: UserModel.currentUser.serverHasTalk
icon.source: "qrc:///client/theme/white/talk-app.svg"
icon.color: UserModel.currentUser.headerTextColor
icon.color: Style.currentUserHeaderTextColor
onClicked: UserModel.openCurrentAccountTalk()

Accessible.role: Accessible.Button
Expand All @@ -598,7 +598,7 @@ ApplicationWindow {
HeaderButton {
id: trayWindowAppsButton
icon.source: "qrc:///client/theme/white/more-apps.svg"
icon.color: UserModel.currentUser.headerTextColor
icon.color: Style.currentUserHeaderTextColor

onClicked: {
if(appsMenuListView.count <= 0) {
Expand Down
5 changes: 5 additions & 0 deletions src/gui/tray/usermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,11 @@ void User::slotSendReplyMessage(const int activityIndex, const QString &token, c
});
}

void User::forceSyncNow() const
{
FolderMan::instance()->forceSyncForFolder(getFolder());
}

/*-------------------------------------------------------------------------------------*/

UserModel *UserModel::_instance = nullptr;
Expand Down
1 change: 1 addition & 0 deletions src/gui/tray/usermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public slots:
void setNotificationRefreshInterval(std::chrono::milliseconds interval);
void slotRebuildNavigationAppList();
void slotSendReplyMessage(const int activityIndex, const QString &conversationToken, const QString &message, const QString &replyTo);
void forceSyncNow() const;

private:
void slotPushNotificationsReady();
Expand Down
5 changes: 5 additions & 0 deletions theme/Style/Style.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ QtObject {
readonly property color backgroundColor: Theme.systemPalette.base
readonly property color buttonBackgroundColor: Theme.systemPalette.button

readonly property color currentUserHeaderColor: UserModel.currentUser ? UserModel.currentUser.headerColor : ncBlue
readonly property color currentUserHeaderTextColor: UserModel.currentUser ? UserModel.currentUser.headerTextColor : ncHeaderTextColor
readonly property color adjustedCurrentUserHeaderColor: Theme.darkMode ? Qt.lighter(currentUserHeaderColor, 2)
: Qt.darker(currentUserHeaderColor, 1.5)

// ErrorBox colors
readonly property color errorBoxBackgroundColor: Qt.rgba(0.89, 0.18, 0.18, 1)
readonly property int errorBoxStripeWidth: 4
Expand Down