Skip to content

Commit

Permalink
[transfer-engine] Avoid excessive notification action updates. JB#51671
Browse files Browse the repository at this point in the history
When there are rapid consecutive action name changes (due to the auto-
generated action name being different each time a progress notification
is created), this confuses the UI as it needs to rebuild the action
data, and by the time the user triggers an action, it may already have
changed the UI to refer to a different action underneath. To avoid
this, just use the same action name each time.
  • Loading branch information
blammit committed Oct 26, 2020
1 parent 1c01b59 commit c20bc4d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/transferengine.cpp
Expand Up @@ -434,7 +434,11 @@ void TransferEnginePrivate::sendNotification(TransferEngineData::TransferType ty
useProgress = true;

if (canCancel) {
remoteActions.append(Notification::remoteAction(QString(),
// Use a constant action name instead of an auto-generated one which is different
// every time, to avoid excessive changes to the action data which disrupts the UI.
static const QString cancelActionName = QStringLiteral("transferengine_cancel_transfer");

remoteActions.append(Notification::remoteAction(cancelActionName,
//: Cancel the file transfer
//% "Cancel"
qtTrId("transferengine-no-cancel"),
Expand Down

0 comments on commit c20bc4d

Please sign in to comment.