Don't show reply button in Linux native notifications when it's not supposed to

All modern notification daemons have support for the default action and it's a requirement with the portal spec
This commit is contained in:
Ilya Fedin 2022-11-29 00:29:45 +04:00 committed by John Preston
parent b9a766387c
commit 05524c3f6c
1 changed files with 23 additions and 19 deletions

View File

@ -431,10 +431,12 @@ bool NotificationData::init(
idTuple); idTuple);
} }
_notification->add_button( if (!options.hideReplyButton) {
tr::lng_notification_reply(tr::now).toStdString(), _notification->add_button(
"app.notification-reply", tr::lng_notification_reply(tr::now).toStdString(),
idTuple); "app.notification-reply",
idTuple);
}
return true; return true;
} }
@ -520,22 +522,24 @@ bool NotificationData::init(
tr::lng_context_mark_read(tr::now).toStdString()); tr::lng_context_mark_read(tr::now).toStdString());
} }
if (capabilities.contains("inline-reply") && !options.hideReplyButton) { if (!options.hideReplyButton) {
_actions.push_back("inline-reply"); if (capabilities.contains("inline-reply")) {
_actions.push_back( _actions.push_back("inline-reply");
tr::lng_notification_reply(tr::now).toStdString()); _actions.push_back(
tr::lng_notification_reply(tr::now).toStdString());
_notificationRepliedSignalId = _dbusConnection->signal_subscribe( _notificationRepliedSignalId = _dbusConnection->signal_subscribe(
signalEmitted, signalEmitted,
std::string(kService), std::string(kService),
std::string(kInterface), std::string(kInterface),
"NotificationReplied", "NotificationReplied",
std::string(kObjectPath)); std::string(kObjectPath));
} else { } else {
// icon name according to https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html // icon name according to https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
_actions.push_back("mail-reply-sender"); _actions.push_back("mail-reply-sender");
_actions.push_back( _actions.push_back(
tr::lng_notification_reply(tr::now).toStdString()); tr::lng_notification_reply(tr::now).toStdString());
}
} }
_actionInvokedSignalId = _dbusConnection->signal_subscribe( _actionInvokedSignalId = _dbusConnection->signal_subscribe(